summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MachObjectWriter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-05-26 02:00:36 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-05-26 02:00:36 +0000
commit5a1e80bc437db7f4fe9e62abd9c459c7000cade6 (patch)
tree131459e048acd6716b49ba125e5759daf9b0c7ca /llvm/lib/MC/MachObjectWriter.cpp
parent683703ea6d63a0a7650259a8a86dfce2dd0dc7eb (diff)
downloadbcm5719-llvm-5a1e80bc437db7f4fe9e62abd9c459c7000cade6.tar.gz
bcm5719-llvm-5a1e80bc437db7f4fe9e62abd9c459c7000cade6.zip
Stop using MCSectionData in MCAsmLayout.h.
llvm-svn: 238170
Diffstat (limited to 'llvm/lib/MC/MachObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/MachObjectWriter.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp
index f184bc23cc9..7a4200136d2 100644
--- a/llvm/lib/MC/MachObjectWriter.cpp
+++ b/llvm/lib/MC/MachObjectWriter.cpp
@@ -107,16 +107,15 @@ uint64_t MachObjectWriter::getSymbolAddress(const MCSymbol &S,
uint64_t MachObjectWriter::getPaddingSize(const MCSection *Sec,
const MCAsmLayout &Layout) const {
- uint64_t EndAddr = getSectionAddress(Sec) +
- Layout.getSectionAddressSize(&Sec->getSectionData());
+ uint64_t EndAddr = getSectionAddress(Sec) + Layout.getSectionAddressSize(Sec);
unsigned Next = Sec->getLayoutOrder() + 1;
if (Next >= Layout.getSectionOrder().size())
return 0;
- const MCSectionData &NextSD = *Layout.getSectionOrder()[Next];
- if (NextSD.getSection().isVirtualSection())
+ const MCSection &NextSec = *Layout.getSectionOrder()[Next];
+ if (NextSec.isVirtualSection())
return 0;
- return OffsetToAlignment(EndAddr, NextSD.getSection().getAlignment());
+ return OffsetToAlignment(EndAddr, NextSec.getAlignment());
}
void MachObjectWriter::WriteHeader(unsigned NumLoadCommands,
@@ -199,12 +198,12 @@ void MachObjectWriter::WriteSection(const MCAssembler &Asm,
uint64_t RelocationsStart,
unsigned NumRelocations) {
const MCSectionData &SD = Sec.getSectionData();
- uint64_t SectionSize = Layout.getSectionAddressSize(&SD);
+ uint64_t SectionSize = Layout.getSectionAddressSize(&Sec);
const MCSectionMachO &Section = cast<MCSectionMachO>(Sec);
// The offset is unused for virtual sections.
if (Section.isVirtualSection()) {
- assert(Layout.getSectionFileSize(&SD) == 0 && "Invalid file size!");
+ assert(Layout.getSectionFileSize(&Sec) == 0 && "Invalid file size!");
FileOffset = 0;
}
@@ -645,18 +644,17 @@ void MachObjectWriter::ComputeSymbolTable(
void MachObjectWriter::computeSectionAddresses(const MCAssembler &Asm,
const MCAsmLayout &Layout) {
uint64_t StartAddress = 0;
- const SmallVectorImpl<MCSectionData*> &Order = Layout.getSectionOrder();
+ const SmallVectorImpl<MCSection *> &Order = Layout.getSectionOrder();
for (int i = 0, n = Order.size(); i != n ; ++i) {
- const MCSectionData *SD = Order[i];
- StartAddress =
- RoundUpToAlignment(StartAddress, SD->getSection().getAlignment());
- SectionAddress[&SD->getSection()] = StartAddress;
- StartAddress += Layout.getSectionAddressSize(SD);
+ const MCSection *Sec = Order[i];
+ StartAddress = RoundUpToAlignment(StartAddress, Sec->getAlignment());
+ SectionAddress[Sec] = StartAddress;
+ StartAddress += Layout.getSectionAddressSize(Sec);
// Explicitly pad the section to match the alignment requirements of the
// following one. This is for 'gas' compatibility, it shouldn't
/// strictly be necessary.
- StartAddress += getPaddingSize(&SD->getSection(), Layout);
+ StartAddress += getPaddingSize(Sec, Layout);
}
}
@@ -804,11 +802,12 @@ void MachObjectWriter::WriteObject(MCAssembler &Asm,
uint64_t VMSize = 0;
for (MCAssembler::const_iterator it = Asm.begin(),
ie = Asm.end(); it != ie; ++it) {
+ const MCSection &Sec = *it;
const MCSectionData &SD = it->getSectionData();
- uint64_t Address = getSectionAddress(&*it);
- uint64_t Size = Layout.getSectionAddressSize(&SD);
- uint64_t FileSize = Layout.getSectionFileSize(&SD);
- FileSize += getPaddingSize(&*it, Layout);
+ uint64_t Address = getSectionAddress(&Sec);
+ uint64_t Size = Layout.getSectionAddressSize(&Sec);
+ uint64_t FileSize = Layout.getSectionFileSize(&Sec);
+ FileSize += getPaddingSize(&Sec, Layout);
VMSize = std::max(VMSize, Address + Size);
OpenPOWER on IntegriCloud