forked from OSchip/llvm-project
Drop vestigial support for UseLazyBinding=false.
Lazy binding is quite important for use case like a shared build of llvm. Also, if someone wants to disable it, it is better done in the compiler (disable plt generation). The only reason to keep it is to make it easier to add a new architecture. But it doesn't really help much as it is possible to start with non lazy relocation and plt code but still let the generic part create a dedicated .got.plt and .rela.plt. llvm-svn: 269982
This commit is contained in:
parent
522afdd77e
commit
e4c86d83fe
|
@ -270,17 +270,14 @@ PltSection<ELFT>::PltSection()
|
|||
|
||||
template <class ELFT> void PltSection<ELFT>::writeTo(uint8_t *Buf) {
|
||||
size_t Off = 0;
|
||||
if (Target->UseLazyBinding) {
|
||||
// At beginning of PLT, we have code to call the dynamic linker
|
||||
// to resolve dynsyms at runtime. Write such code.
|
||||
Target->writePltZero(Buf);
|
||||
Off += Target->PltZeroSize;
|
||||
}
|
||||
// At beginning of PLT, we have code to call the dynamic linker
|
||||
// to resolve dynsyms at runtime. Write such code.
|
||||
Target->writePltZero(Buf);
|
||||
Off += Target->PltZeroSize;
|
||||
for (auto &I : Entries) {
|
||||
const SymbolBody *B = I.first;
|
||||
unsigned RelOff = I.second;
|
||||
uint64_t Got =
|
||||
Target->UseLazyBinding ? B->getGotPltVA<ELFT>() : B->getGotVA<ELFT>();
|
||||
uint64_t Got = B->getGotPltVA<ELFT>();
|
||||
uint64_t Plt = this->getVA() + Off;
|
||||
Target->writePlt(Buf + Off, Got, Plt, B->PltIndex, RelOff);
|
||||
Off += Target->PltEntrySize;
|
||||
|
@ -289,9 +286,7 @@ template <class ELFT> void PltSection<ELFT>::writeTo(uint8_t *Buf) {
|
|||
|
||||
template <class ELFT> void PltSection<ELFT>::addEntry(SymbolBody &Sym) {
|
||||
Sym.PltIndex = Entries.size();
|
||||
unsigned RelOff = Target->UseLazyBinding
|
||||
? Out<ELFT>::RelaPlt->getRelocOffset()
|
||||
: Out<ELFT>::RelaDyn->getRelocOffset();
|
||||
unsigned RelOff = Out<ELFT>::RelaPlt->getRelocOffset();
|
||||
Entries.push_back(std::make_pair(&Sym, RelOff));
|
||||
}
|
||||
|
||||
|
|
|
@ -264,7 +264,6 @@ X86TargetInfo::X86TargetInfo() {
|
|||
TlsGotRel = R_386_TLS_TPOFF;
|
||||
TlsModuleIndexRel = R_386_TLS_DTPMOD32;
|
||||
TlsOffsetRel = R_386_TLS_DTPOFF32;
|
||||
UseLazyBinding = true;
|
||||
PltEntrySize = 16;
|
||||
PltZeroSize = 16;
|
||||
TlsGdToLeSkip = 2;
|
||||
|
@ -495,7 +494,6 @@ X86_64TargetInfo::X86_64TargetInfo() {
|
|||
TlsGotRel = R_X86_64_TPOFF64;
|
||||
TlsModuleIndexRel = R_X86_64_DTPMOD64;
|
||||
TlsOffsetRel = R_X86_64_DTPOFF64;
|
||||
UseLazyBinding = true;
|
||||
PltEntrySize = 16;
|
||||
PltZeroSize = 16;
|
||||
TlsGdToLeSkip = 2;
|
||||
|
@ -760,7 +758,7 @@ RelExpr PPCTargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S) const {
|
|||
}
|
||||
|
||||
PPC64TargetInfo::PPC64TargetInfo() {
|
||||
GotRel = R_PPC64_GLOB_DAT;
|
||||
PltRel = GotRel = R_PPC64_GLOB_DAT;
|
||||
RelativeRel = R_PPC64_RELATIVE;
|
||||
PltEntrySize = 32;
|
||||
|
||||
|
@ -936,7 +934,6 @@ AArch64TargetInfo::AArch64TargetInfo() {
|
|||
TlsGotRel = R_AARCH64_TLS_TPREL64;
|
||||
TlsModuleIndexRel = R_AARCH64_TLS_DTPMOD64;
|
||||
TlsOffsetRel = R_AARCH64_TLS_DTPREL64;
|
||||
UseLazyBinding = true;
|
||||
PltEntrySize = 16;
|
||||
PltZeroSize = 32;
|
||||
}
|
||||
|
@ -1235,7 +1232,6 @@ template <class ELFT> MipsTargetInfo<ELFT>::MipsTargetInfo() {
|
|||
PltEntrySize = 16;
|
||||
PltZeroSize = 32;
|
||||
ThunkSize = 16;
|
||||
UseLazyBinding = true;
|
||||
CopyRel = R_MIPS_COPY;
|
||||
PltRel = R_MIPS_JUMP_SLOT;
|
||||
if (ELFT::Is64Bits)
|
||||
|
|
|
@ -84,7 +84,6 @@ public:
|
|||
unsigned GotPltHeaderEntriesNum = 3;
|
||||
|
||||
uint32_t ThunkSize = 0;
|
||||
bool UseLazyBinding = false;
|
||||
|
||||
virtual void relaxTlsGdToIe(uint8_t *Loc, uint32_t Type, uint64_t Val) const;
|
||||
virtual void relaxTlsGdToLe(uint8_t *Loc, uint32_t Type, uint64_t Val) const;
|
||||
|
|
|
@ -170,11 +170,9 @@ template <class ELFT> void elf::writeResult(SymbolTable<ELFT> *Symtab) {
|
|||
GnuHashTab.reset(new GnuHashTableSection<ELFT>);
|
||||
if (Config->SysvHash)
|
||||
HashTab.reset(new HashTableSection<ELFT>);
|
||||
if (Target->UseLazyBinding) {
|
||||
StringRef S = Config->Rela ? ".rela.plt" : ".rel.plt";
|
||||
GotPlt.reset(new GotPltSection<ELFT>);
|
||||
RelaPlt.reset(new RelocationSection<ELFT>(S, false /*Sort*/));
|
||||
}
|
||||
StringRef S = Config->Rela ? ".rela.plt" : ".rel.plt";
|
||||
GotPlt.reset(new GotPltSection<ELFT>);
|
||||
RelaPlt.reset(new RelocationSection<ELFT>(S, false /*Sort*/));
|
||||
if (!Config->StripAll) {
|
||||
StrTab.reset(new StringTableSection<ELFT>(".strtab", false));
|
||||
SymTabSec.reset(new SymbolTableSection<ELFT>(*Symtab, *StrTab));
|
||||
|
@ -733,20 +731,12 @@ void Writer<ELFT>::scanRelocs(InputSectionBase<ELFT> &C, ArrayRef<RelTy> Rels) {
|
|||
if (Body.isGnuIFunc())
|
||||
Rel = Preemptible ? Target->PltRel : Target->IRelativeRel;
|
||||
else
|
||||
Rel = Target->UseLazyBinding ? Target->PltRel : Target->GotRel;
|
||||
Rel = Target->PltRel;
|
||||
|
||||
if (Target->UseLazyBinding) {
|
||||
Out<ELFT>::GotPlt->addEntry(Body);
|
||||
Out<ELFT>::RelaPlt->addReloc({Rel, Out<ELFT>::GotPlt,
|
||||
Body.getGotPltOffset<ELFT>(),
|
||||
!Preemptible, &Body, 0});
|
||||
} else {
|
||||
if (Body.isInGot())
|
||||
continue;
|
||||
Out<ELFT>::Got->addEntry(Body);
|
||||
AddDyn({Rel, Out<ELFT>::Got, Body.getGotOffset<ELFT>(), !Preemptible,
|
||||
&Body, 0});
|
||||
}
|
||||
Out<ELFT>::GotPlt->addEntry(Body);
|
||||
Out<ELFT>::RelaPlt->addReloc({Rel, Out<ELFT>::GotPlt,
|
||||
Body.getGotPltOffset<ELFT>(), !Preemptible,
|
||||
&Body, 0});
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ last:
|
|||
// CHECK: Disassembly of section .plt:
|
||||
// CHECK: .plt:
|
||||
// CHECK: 10010020: f8 41 00 28 std 2, 40(1)
|
||||
// CHECK: 10010024: 3d 62 00 00 addis 11, 2, 0
|
||||
// CHECK: 10010028: e9 8b 80 00 ld 12, -32768(11)
|
||||
// CHECK: 10010024: 3d 62 10 03 addis 11, 2, 4099
|
||||
// CHECK: 10010028: e9 8b 80 18 ld 12, -32744(11)
|
||||
// CHECK: 1001002c: e9 6c 00 00 ld 11, 0(12)
|
||||
// CHECK: 10010030: 7d 69 03 a6 mtctr 11
|
||||
// CHECK: 10010034: e8 4c 00 08 ld 2, 8(12)
|
||||
|
|
Loading…
Reference in New Issue