Changeset View
Changeset View
Standalone View
Standalone View
contrib/llvm/tools/lld/ELF/SyntheticSections.cpp
Show First 20 Lines • Show All 1,127 Lines • ▼ Show 20 Lines | |||||
// On PowerPC64 the GotPltSection type is SHT_NOBITS so we have to follow suit | // On PowerPC64 the GotPltSection type is SHT_NOBITS so we have to follow suit | ||||
// with the IgotPltSection. | // with the IgotPltSection. | ||||
IgotPltSection::IgotPltSection() | IgotPltSection::IgotPltSection() | ||||
: SyntheticSection(SHF_ALLOC | SHF_WRITE, | : SyntheticSection(SHF_ALLOC | SHF_WRITE, | ||||
Config->EMachine == EM_PPC64 ? SHT_NOBITS : SHT_PROGBITS, | Config->EMachine == EM_PPC64 ? SHT_NOBITS : SHT_PROGBITS, | ||||
Target->GotPltEntrySize, getIgotPltName()) {} | Target->GotPltEntrySize, getIgotPltName()) {} | ||||
void IgotPltSection::addEntry(Symbol &Sym) { | void IgotPltSection::addEntry(Symbol &Sym) { | ||||
Sym.IsInIgot = true; | |||||
assert(Sym.PltIndex == Entries.size()); | assert(Sym.PltIndex == Entries.size()); | ||||
Entries.push_back(&Sym); | Entries.push_back(&Sym); | ||||
} | } | ||||
size_t IgotPltSection::getSize() const { | size_t IgotPltSection::getSize() const { | ||||
return Entries.size() * Target->GotPltEntrySize; | return Entries.size() * Target->GotPltEntrySize; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,190 Lines • ▼ Show 20 Lines | for (auto &I : Entries) { | ||||
Target->writePlt(Buf + Off, Got, Plt, B->PltIndex, RelOff); | Target->writePlt(Buf + Off, Got, Plt, B->PltIndex, RelOff); | ||||
Off += Target->PltEntrySize; | Off += Target->PltEntrySize; | ||||
} | } | ||||
} | } | ||||
template <class ELFT> void PltSection::addEntry(Symbol &Sym) { | template <class ELFT> void PltSection::addEntry(Symbol &Sym) { | ||||
Sym.PltIndex = Entries.size(); | Sym.PltIndex = Entries.size(); | ||||
RelocationBaseSection *PltRelocSection = In.RelaPlt; | RelocationBaseSection *PltRelocSection = In.RelaPlt; | ||||
if (IsIplt) { | if (IsIplt) | ||||
PltRelocSection = In.RelaIplt; | PltRelocSection = In.RelaIplt; | ||||
Sym.IsInIplt = true; | |||||
} | |||||
unsigned RelOff = | unsigned RelOff = | ||||
static_cast<RelocationSection<ELFT> *>(PltRelocSection)->getRelocOffset(); | static_cast<RelocationSection<ELFT> *>(PltRelocSection)->getRelocOffset(); | ||||
Entries.push_back(std::make_pair(&Sym, RelOff)); | Entries.push_back(std::make_pair(&Sym, RelOff)); | ||||
} | } | ||||
size_t PltSection::getSize() const { | size_t PltSection::getSize() const { | ||||
return HeaderSize + Entries.size() * Target->PltEntrySize; | return HeaderSize + Entries.size() * Target->PltEntrySize; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 879 Lines • Show Last 20 Lines |