summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MachObjectWriter.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-25 02:00:07 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-25 02:00:07 +0000
commit5b07334c0dd182e86cbabbc2f8c5ce24bf20b520 (patch)
tree4def558f6a6f34e3c115d7a8fef1f30db2d85417 /llvm/lib/MC/MachObjectWriter.cpp
parent2522dd1c49ea402fe3d48ec504cc4810059dac9e (diff)
downloadbcm5719-llvm-5b07334c0dd182e86cbabbc2f8c5ce24bf20b520.tar.gz
bcm5719-llvm-5b07334c0dd182e86cbabbc2f8c5ce24bf20b520.zip
MC: Route access to SectionData offset and file size through MCAsmLayout.
llvm-svn: 99474
Diffstat (limited to 'llvm/lib/MC/MachObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/MachObjectWriter.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp
index 72e581bc0ab..4382c2f4893 100644
--- a/llvm/lib/MC/MachObjectWriter.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud