forked from OSchip/llvm-project
Move code to create RELATIVE reloc for TLS_IE to one place.
llvm-svn: 258760
This commit is contained in:
parent
00b87282cd
commit
1546fb2d65
|
@ -289,6 +289,14 @@ template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) {
|
|||
if (applyTlsDynamicReloc(Body, Type, P, reinterpret_cast<Elf_Rel *>(Buf)))
|
||||
continue;
|
||||
|
||||
// Writer::scanRelocs creates a RELATIVE reloc for some type of TLS reloc.
|
||||
// We want to write it down as is.
|
||||
if (Type == Target->getRelativeReloc()) {
|
||||
P->setSymbolAndType(0, Type, Config->Mips64EL);
|
||||
P->r_offset = C.getOffset(RI.r_offset) + C.OutSec->getVA();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Emit a copy relocation.
|
||||
auto *SS = dyn_cast_or_null<SharedSymbol<ELFT>>(Body);
|
||||
if (SS && SS->NeedsCopy) {
|
||||
|
@ -316,11 +324,10 @@ template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) {
|
|||
|
||||
bool LazyReloc = Body && Target->supportsLazyRelocations() &&
|
||||
Target->relocNeedsPlt(Type, *Body);
|
||||
bool IsDynRelative = Type == Target->getRelativeReloc();
|
||||
|
||||
unsigned Sym = CBP ? Body->DynamicSymbolTableIndex : 0;
|
||||
unsigned Reloc;
|
||||
if (!CBP || IsDynRelative)
|
||||
if (!CBP)
|
||||
Reloc = Target->getRelativeReloc();
|
||||
else if (LazyReloc)
|
||||
Reloc = Target->getPltReloc();
|
||||
|
@ -342,7 +349,7 @@ template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) {
|
|||
OrigAddend = static_cast<const Elf_Rela &>(RI).r_addend;
|
||||
|
||||
uintX_t Addend;
|
||||
if (CBP || IsDynRelative)
|
||||
if (CBP)
|
||||
Addend = OrigAddend;
|
||||
else if (Body)
|
||||
Addend = getSymVA<ELFT>(*Body) + OrigAddend;
|
||||
|
|
Loading…
Reference in New Issue