forked from OSchip/llvm-project
Simplify the creation of __rel[a]_iplt_{start,end}.
They can be regular DefinedSynthetic. llvm-svn: 265981
This commit is contained in:
parent
7469644259
commit
03ef404e97
|
@ -407,8 +407,8 @@ template <class ELFT> struct ElfSym {
|
|||
|
||||
// __rel_iplt_start/__rel_iplt_end for signaling
|
||||
// where R_[*]_IRELATIVE relocations do live.
|
||||
static DefinedRegular<ELFT> *RelaIpltStart;
|
||||
static DefinedRegular<ELFT> *RelaIpltEnd;
|
||||
static SymbolBody *RelaIpltStart;
|
||||
static SymbolBody *RelaIpltEnd;
|
||||
};
|
||||
|
||||
template <class ELFT> DefinedRegular<ELFT> *ElfSym<ELFT>::Etext;
|
||||
|
@ -418,8 +418,8 @@ template <class ELFT> DefinedRegular<ELFT> *ElfSym<ELFT>::Edata2;
|
|||
template <class ELFT> DefinedRegular<ELFT> *ElfSym<ELFT>::End;
|
||||
template <class ELFT> DefinedRegular<ELFT> *ElfSym<ELFT>::End2;
|
||||
template <class ELFT> DefinedRegular<ELFT> *ElfSym<ELFT>::MipsGp;
|
||||
template <class ELFT> DefinedRegular<ELFT> *ElfSym<ELFT>::RelaIpltStart;
|
||||
template <class ELFT> DefinedRegular<ELFT> *ElfSym<ELFT>::RelaIpltEnd;
|
||||
template <class ELFT> SymbolBody *ElfSym<ELFT>::RelaIpltStart;
|
||||
template <class ELFT> SymbolBody *ElfSym<ELFT>::RelaIpltEnd;
|
||||
|
||||
} // namespace elf
|
||||
} // namespace lld
|
||||
|
|
|
@ -806,10 +806,14 @@ void Writer<ELFT>::addRelIpltSymbols() {
|
|||
if (isOutputDynamic() || !Out<ELFT>::RelaPlt)
|
||||
return;
|
||||
StringRef S = Config->Rela ? "__rela_iplt_start" : "__rel_iplt_start";
|
||||
ElfSym<ELFT>::RelaIpltStart = Symtab.addIgnored(S);
|
||||
if (Symtab.find(S))
|
||||
ElfSym<ELFT>::RelaIpltStart =
|
||||
Symtab.addSynthetic(S, *Out<ELFT>::RelaPlt, 0, STV_HIDDEN);
|
||||
|
||||
S = Config->Rela ? "__rela_iplt_end" : "__rel_iplt_end";
|
||||
ElfSym<ELFT>::RelaIpltEnd = Symtab.addIgnored(S);
|
||||
if (Symtab.find(S))
|
||||
ElfSym<ELFT>::RelaIpltEnd = Symtab.addSynthetic(
|
||||
S, *Out<ELFT>::RelaPlt, DefinedSynthetic<ELFT>::SectionEnd, STV_HIDDEN);
|
||||
}
|
||||
|
||||
template <class ELFT> static bool includeInSymtab(const SymbolBody &B) {
|
||||
|
@ -1505,16 +1509,6 @@ static uint16_t getELFType() {
|
|||
// to each section. This function fixes some predefined absolute
|
||||
// symbol values that depend on section address and size.
|
||||
template <class ELFT> void Writer<ELFT>::fixAbsoluteSymbols() {
|
||||
// Update __rel[a]_iplt_{start,end} symbols so that they point
|
||||
// to beginning or ending of .rela.plt section, respectively.
|
||||
if (Out<ELFT>::RelaPlt) {
|
||||
uintX_t Start = Out<ELFT>::RelaPlt->getVA();
|
||||
if (ElfSym<ELFT>::RelaIpltStart)
|
||||
ElfSym<ELFT>::RelaIpltStart->Value = Start;
|
||||
if (ElfSym<ELFT>::RelaIpltEnd)
|
||||
ElfSym<ELFT>::RelaIpltEnd->Value = Start + Out<ELFT>::RelaPlt->getSize();
|
||||
}
|
||||
|
||||
// Update MIPS _gp absolute symbol so that it points to the static data.
|
||||
if (Config->EMachine == EM_MIPS)
|
||||
ElfSym<ELFT>::MipsGp->Value = getMipsGpAddr<ELFT>();
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
// CHECK-NEXT: Other [
|
||||
// CHECK-NEXT: STV_HIDDEN
|
||||
// CHECK-NEXT: ]
|
||||
// CHECK-NEXT: Section: Absolute
|
||||
// CHECK-NEXT: Section: .rela.plt
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: Symbol {
|
||||
// CHECK-NEXT: Name: __rela_iplt_start
|
||||
|
@ -65,7 +65,7 @@
|
|||
// CHECK-NEXT: Other [
|
||||
// CHECK-NEXT: STV_HIDDEN
|
||||
// CHECK-NEXT: ]
|
||||
// CHECK-NEXT: Section: Absolute
|
||||
// CHECK-NEXT: Section: .rela.plt
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: Symbol {
|
||||
// CHECK-NEXT: Name: _start
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
// CHECK-NEXT: Other [
|
||||
// CHECK-NEXT: STV_HIDDEN
|
||||
// CHECK-NEXT: ]
|
||||
// CHECK-NEXT: Section: Absolute
|
||||
// CHECK-NEXT: Section: .rel.plt
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: Symbol {
|
||||
// CHECK-NEXT: Name: __rel_iplt_start
|
||||
|
@ -57,7 +57,7 @@
|
|||
// CHECK-NEXT: Other [
|
||||
// CHECK-NEXT: STV_HIDDEN
|
||||
// CHECK-NEXT: ]
|
||||
// CHECK-NEXT: Section: Absolute
|
||||
// CHECK-NEXT: Section: .rel.plt
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: Symbol {
|
||||
// CHECK-NEXT: Name: _start
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
// CHECK-NEXT: Other [
|
||||
// CHECK-NEXT: STV_HIDDEN
|
||||
// CHECK-NEXT: ]
|
||||
// CHECK-NEXT: Section: Absolute
|
||||
// CHECK-NEXT: Section: .rela.plt
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: Symbol {
|
||||
// CHECK-NEXT: Name: __rela_iplt_start
|
||||
|
@ -56,7 +56,7 @@
|
|||
// CHECK-NEXT: Other [
|
||||
// CHECK-NEXT: STV_HIDDEN
|
||||
// CHECK-NEXT: ]
|
||||
// CHECK-NEXT: Section: Absolute
|
||||
// CHECK-NEXT: Section: .rela.plt
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: Symbol {
|
||||
// CHECK-NEXT: Name: _start
|
||||
|
|
Loading…
Reference in New Issue