diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-03-25 18:16:38 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-03-25 18:16:38 +0000 |
commit | be644a38c09bd0fa03bb07f48f2c1dec32052de8 (patch) | |
tree | 8f2ab07b9e005ef592b5ab0e8d341afb5b470d66 | |
parent | 352aa503faee6c58e9cdb5054cc5ec1d90c696b4 (diff) |
MC: Sink Section address assignment into LayoutSection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99528 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/MC/MCAssembler.h | 9 | ||||
-rw-r--r-- | lib/MC/MCAssembler.cpp | 12 |
2 files changed, 11 insertions, 10 deletions
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h index c34132db2f..9ded5dbb82 100644 --- a/include/llvm/MC/MCAssembler.h +++ b/include/llvm/MC/MCAssembler.h @@ -651,10 +651,11 @@ private: bool FragmentNeedsRelaxation(const MCInstFragment *IF, const MCAsmLayout &Layout) const; - /// LayoutSection - Assign offsets and sizes to the fragments in the section - /// \arg SD, and update the section size. The section file offset should - /// already have been computed. - void LayoutSection(MCSectionData &SD, MCAsmLayout &Layout); + /// LayoutSection - Assign the section the given \arg StartAddress, and then + /// assign offsets and sizes to the fragments in the section \arg SD, and + /// update the section size. + void LayoutSection(MCSectionData &SD, MCAsmLayout &Layout, + uint64_t StartAddress); /// LayoutOnce - Perform one layout iteration and return true if any offsets /// were adjusted. diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp index 5190239f5a..c0ec04df09 100644 --- a/lib/MC/MCAssembler.cpp +++ b/lib/MC/MCAssembler.cpp @@ -365,9 +365,11 @@ bool MCAssembler::EvaluateFixup(const MCAsmLayout &Layout, } void MCAssembler::LayoutSection(MCSectionData &SD, - MCAsmLayout &Layout) { - uint64_t Address, StartAddress = Address = Layout.getSectionAddress(&SD); + MCAsmLayout &Layout, + uint64_t StartAddress) { + Layout.setSectionAddress(&SD, StartAddress); + uint64_t Address = StartAddress; for (MCSectionData::iterator it = SD.begin(), ie = SD.end(); it != ie; ++it) { MCFragment &F = *it; @@ -690,8 +692,7 @@ bool MCAssembler::LayoutOnce(MCAsmLayout &Layout) { } // Layout the section fragments and its size. - Layout.setSectionAddress(&SD, Address); - LayoutSection(SD, Layout); + LayoutSection(SD, Layout, Address); Address += Layout.getSectionFileSize(&SD); Prev = &SD; @@ -709,8 +710,7 @@ bool MCAssembler::LayoutOnce(MCAsmLayout &Layout) { if (uint64_t Pad = OffsetToAlignment(Address, it->getAlignment())) Address += Pad; - Layout.setSectionAddress(&SD, Address); - LayoutSection(SD, Layout); + LayoutSection(SD, Layout, Address); Address += Layout.getSectionSize(&SD); } |