const MCSection &Sec, uint64_t FileOffset,
uint64_t RelocationsStart,
unsigned NumRelocations) {
- const MCSectionData &SD = Sec.getSectionData();
uint64_t SectionSize = Layout.getSectionAddressSize(&Sec);
const MCSectionMachO &Section = cast<MCSectionMachO>(Sec);
WriteBytes(Section.getSectionName(), 16);
WriteBytes(Section.getSegmentName(), 16);
if (is64Bit()) {
- Write64(getSectionAddress(&SD.getSection())); // address
+ Write64(getSectionAddress(&Sec)); // address
Write64(SectionSize); // size
} else {
- Write32(getSectionAddress(&SD.getSection())); // address
+ Write32(getSectionAddress(&Sec)); // address
Write32(SectionSize); // size
}
Write32(FileOffset);
Write32(NumRelocations ? RelocationsStart : 0);
Write32(NumRelocations);
Write32(Flags);
- Write32(IndirectSymBase.lookup(&SD.getSection())); // reserved1
+ Write32(IndirectSymBase.lookup(&Sec)); // reserved1
Write32(Section.getStubSize()); // reserved2
if (is64Bit())
Write32(0); // reserved3
Address = AliaseeInfo->StringIndex;
else if (Symbol->isDefined())
Address = getSymbolAddress(OrigSymbol, Layout);
- else if (Data.isCommon()) {
+ else if (Symbol->isCommon()) {
// Common symbols are encoded with the size in the address
// field, and their alignment in the flags.
- Address = Data.getCommonSize();
+ Address = Symbol->getCommonSize();
// Common alignment is packed into the 'desc' bits.
- if (unsigned Align = Data.getCommonAlignment()) {
+ if (unsigned Align = Symbol->getCommonAlignment()) {
unsigned Log2Size = Log2_32(Align);
assert((1U << Log2Size) == Align && "Invalid 'common' alignment!");
if (Log2Size > 15)
// or stub section.
for (MCAssembler::indirect_symbol_iterator it = Asm.indirect_symbol_begin(),
ie = Asm.indirect_symbol_end(); it != ie; ++it) {
- const MCSectionMachO &Section =
- cast<MCSectionMachO>(it->SectionData->getSection());
+ const MCSectionMachO &Section = cast<MCSectionMachO>(*it->Section);
if (Section.getType() != MachO::S_NON_LAZY_SYMBOL_POINTERS &&
Section.getType() != MachO::S_LAZY_SYMBOL_POINTERS &&
unsigned IndirectIndex = 0;
for (MCAssembler::indirect_symbol_iterator it = Asm.indirect_symbol_begin(),
ie = Asm.indirect_symbol_end(); it != ie; ++it, ++IndirectIndex) {
- const MCSectionMachO &Section =
- cast<MCSectionMachO>(it->SectionData->getSection());
+ const MCSectionMachO &Section = cast<MCSectionMachO>(*it->Section);
if (Section.getType() != MachO::S_NON_LAZY_SYMBOL_POINTERS)
continue;
// Initialize the section indirect symbol base, if necessary.
- IndirectSymBase.insert(
- std::make_pair(&it->SectionData->getSection(), IndirectIndex));
+ IndirectSymBase.insert(std::make_pair(it->Section, IndirectIndex));
Asm.getOrCreateSymbolData(*it->Symbol);
}
IndirectIndex = 0;
for (MCAssembler::indirect_symbol_iterator it = Asm.indirect_symbol_begin(),
ie = Asm.indirect_symbol_end(); it != ie; ++it, ++IndirectIndex) {
- const MCSectionMachO &Section =
- cast<MCSectionMachO>(it->SectionData->getSection());
+ const MCSectionMachO &Section = cast<MCSectionMachO>(*it->Section);
if (Section.getType() != MachO::S_LAZY_SYMBOL_POINTERS &&
Section.getType() != MachO::S_SYMBOL_STUBS)
continue;
// Initialize the section indirect symbol base, if necessary.
- IndirectSymBase.insert(
- std::make_pair(&it->SectionData->getSection(), IndirectIndex));
+ IndirectSymBase.insert(std::make_pair(it->Section, IndirectIndex));
// Set the symbol type to undefined lazy, but only on construction.
//
if (!hasReliableSymbolDifference) {
if (!SA.isInSection() || &SecA != &SecB ||
(!SA.isTemporary() &&
- FB.getAtom() != Asm.getSymbolData(SA).getFragment()->getAtom() &&
+ FB.getAtom() != SA.getData().getFragment()->getAtom() &&
Asm.getSubsectionsViaSymbols()))
return false;
return true;
if (&SecA != &SecB)
return false;
- const MCFragment *FA = Asm.getSymbolData(SA).getFragment();
+ const MCFragment *FA = SA.getData().getFragment();
// Bail if the symbol has no fragment.
if (!FA)
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(&Sec);
uint64_t Size = Layout.getSectionAddressSize(&Sec);
uint64_t FileSize = Layout.getSectionFileSize(&Sec);
VMSize = std::max(VMSize, Address + Size);
- if (SD.getSection().isVirtualSection())
+ if (it->isVirtualSection())
continue;
SectionDataSize = std::max(SectionDataSize, Address + Size);
// Write the actual section data.
for (MCAssembler::const_iterator it = Asm.begin(),
ie = Asm.end(); it != ie; ++it) {
- const MCSectionData &SD = it->getSectionData();
- Asm.writeSectionData(&SD, Layout);
+ MCSection &Sec = *it;
+ Asm.writeSectionData(&Sec, Layout);
- uint64_t Pad = getPaddingSize(&*it, Layout);
+ uint64_t Pad = getPaddingSize(&Sec, Layout);
WriteZeros(Pad);
}
// Indirect symbols in the non-lazy symbol pointer section have some
// special handling.
const MCSectionMachO &Section =
- static_cast<const MCSectionMachO&>(it->SectionData->getSection());
+ static_cast<const MCSectionMachO &>(*it->Section);
if (Section.getType() == MachO::S_NON_LAZY_SYMBOL_POINTERS) {
// If this symbol is defined and internal, mark it as such.
- if (it->Symbol->isDefined() &&
- !Asm.getSymbolData(*it->Symbol).isExternal()) {
+ if (it->Symbol->isDefined() && !it->Symbol->getData().isExternal()) {
uint32_t Flags = MachO::INDIRECT_SYMBOL_LOCAL;
if (it->Symbol->isAbsolute())
Flags |= MachO::INDIRECT_SYMBOL_ABS;