diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-03-25 02:00:07 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-03-25 02:00:07 +0000 |
commit | 5d428511ca9607d52a09d3483d0738f483e09934 (patch) | |
tree | 8962b6cf6868e23e127512634022c006ce0cf3ff /lib/MC/MachObjectWriter.cpp | |
parent | 432cd5fd9b4c97f1e4a53fcf45e16f7dd6bc085e (diff) |
MC: Route access to SectionData offset and file size through MCAsmLayout.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99474 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MachObjectWriter.cpp')
-rw-r--r-- | lib/MC/MachObjectWriter.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp index 72e581bc0a..4382c2f489 100644 --- a/lib/MC/MachObjectWriter.cpp +++ b/lib/MC/MachObjectWriter.cpp @@ -275,9 +275,12 @@ public: void WriteSection(const MCAssembler &Asm, const MCAsmLayout &Layout, const MCSectionData &SD, uint64_t FileOffset, uint64_t RelocationsStart, unsigned NumRelocations) { + uint64_t SectionSize = Layout.getSectionSize(&SD); + uint64_t SectionFileSize = Layout.getSectionFileSize(&SD); + // The offset is unused for virtual sections. if (Asm.getBackend().isVirtualSection(SD.getSection())) { - assert(SD.getFileSize() == 0 && "Invalid file size!"); + assert(SectionFileSize == 0 && "Invalid file size!"); FileOffset = 0; } @@ -294,10 +297,10 @@ public: WriteBytes(Section.getSegmentName(), 16); if (Is64Bit) { Write64(Layout.getSectionAddress(&SD)); // address - Write64(SD.getSize()); // size + Write64(SectionSize); // size } else { Write32(Layout.getSectionAddress(&SD)); // address - Write32(SD.getSize()); // size + Write32(SectionSize); // size } Write32(FileOffset); @@ -965,15 +968,16 @@ public: ie = Asm.end(); it != ie; ++it) { const MCSectionData &SD = *it; uint64_t Address = Layout.getSectionAddress(&SD); + uint64_t Size = Layout.getSectionSize(&SD); + uint64_t FileSize = Layout.getSectionFileSize(&SD); - VMSize = std::max(VMSize, Address + SD.getSize()); + VMSize = std::max(VMSize, Address + Size); if (Asm.getBackend().isVirtualSection(SD.getSection())) continue; - SectionDataSize = std::max(SectionDataSize, Address + SD.getSize()); - SectionDataFileSize = std::max(SectionDataFileSize, - Address + SD.getFileSize()); + SectionDataSize = std::max(SectionDataSize, Address + Size); + SectionDataFileSize = std::max(SectionDataFileSize, Address + FileSize); } // The section data is padded to 4 bytes. |