MC: Sink Section address assignment into LayoutSection.

llvm-svn: 99528
This commit is contained in:
Daniel Dunbar 2010-03-25 18:16:38 +00:00
parent 5ca19faccc
commit 8d2b718d91
2 changed files with 11 additions and 10 deletions

View File

@ -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.

View File

@ -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);
}