Index: ELF/OutputSections.cpp =================================================================== --- ELF/OutputSections.cpp +++ ELF/OutputSections.cpp @@ -229,7 +229,7 @@ return false; if (Target->canRelaxTls(Type, Body)) { - P->setSymbolAndType(Body->DynsymIndex, Target->getTlsGotRel(), + P->setSymbolAndType(Body->DynsymIndex, Target->TlsGotDynRel, Config->Mips64EL); P->r_offset = Body->getGotVA(); return true; @@ -319,7 +319,7 @@ else if (LazyReloc) Reloc = Target->PltRel; else if (NeedsGot) - Reloc = Body->isTls() ? Target->getTlsGotRel() : Target->GotRel; + Reloc = Body->isTls() ? Target->TlsGotDynRel : Target->GotRel; else Reloc = Target->getDynRel(Type); P->setSymbolAndType(CBP ? Body->DynsymIndex : 0, Reloc, Config->Mips64EL); Index: ELF/Target.h =================================================================== --- ELF/Target.h +++ ELF/Target.h @@ -26,7 +26,7 @@ bool isTlsGlobalDynamicRel(unsigned Type) const; virtual unsigned getDynRel(unsigned Type) const { return Type; } virtual bool isTlsDynRel(unsigned Type, const SymbolBody &S) const; - virtual unsigned getTlsGotRel(unsigned Type = -1) const { return TlsGotRel; } + virtual unsigned getTlsGotRel(unsigned Type) const { return TlsGotDynRel; } virtual void writeGotHeader(uint8_t *Buf) const {} virtual void writeGotPltHeader(uint8_t *Buf) const {} virtual void writeGotPlt(uint8_t *Buf, uint64_t Plt) const {}; @@ -81,7 +81,7 @@ unsigned PltRel; unsigned RelativeRel; unsigned IRelativeRel; - unsigned TlsGotRel = 0; + unsigned TlsGotDynRel = 0; unsigned TlsLocalDynamicRel = 0; unsigned TlsGlobalDynamicRel = 0; unsigned TlsModuleIndexRel; Index: ELF/Target.cpp =================================================================== --- ELF/Target.cpp +++ ELF/Target.cpp @@ -173,7 +173,7 @@ void writePltZero(uint8_t *Buf) const override; void writePlt(uint8_t *Buf, uint64_t GotEntryAddr, uint64_t PltEntryAddr, int32_t Index, unsigned RelOff) const override; - unsigned getTlsGotRel(unsigned Type = -1) const override; + unsigned getTlsGotRel(unsigned Type) const override; bool isTlsDynRel(unsigned Type, const SymbolBody &S) const override; bool needsCopyRel(uint32_t Type, const SymbolBody &S) const override; bool needsGot(uint32_t Type, const SymbolBody &S) const override; @@ -282,7 +282,7 @@ PltRel = R_386_JUMP_SLOT; IRelativeRel = R_386_IRELATIVE; RelativeRel = R_386_RELATIVE; - TlsGotRel = R_386_TLS_TPOFF; + TlsGotDynRel = R_386_TLS_TPOFF; TlsGlobalDynamicRel = R_386_TLS_GD; TlsLocalDynamicRel = R_386_TLS_LDM; TlsModuleIndexRel = R_386_TLS_DTPMOD32; @@ -313,7 +313,7 @@ unsigned X86TargetInfo::getTlsGotRel(unsigned Type) const { if (Type == R_386_TLS_IE) return Type; - return TlsGotRel; + return TlsGotDynRel; } bool X86TargetInfo::isTlsDynRel(unsigned Type, const SymbolBody &S) const { @@ -590,7 +590,7 @@ PltRel = R_X86_64_JUMP_SLOT; RelativeRel = R_X86_64_RELATIVE; IRelativeRel = R_X86_64_IRELATIVE; - TlsGotRel = R_X86_64_TPOFF64; + TlsGotDynRel = R_X86_64_TPOFF64; TlsLocalDynamicRel = R_X86_64_TLSLD; TlsGlobalDynamicRel = R_X86_64_TLSGD; TlsModuleIndexRel = R_X86_64_DTPMOD64; @@ -1143,7 +1143,7 @@ IRelativeRel = R_AARCH64_IRELATIVE; GotRel = R_AARCH64_GLOB_DAT; PltRel = R_AARCH64_JUMP_SLOT; - TlsGotRel = R_AARCH64_TLS_TPREL64; + TlsGotDynRel = R_AARCH64_TLS_TPREL64; UseLazyBinding = true; PltEntrySize = 16; PltZeroSize = 32; @@ -1208,7 +1208,7 @@ if (Type == R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 || Type == R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC) return Type; - return TlsGotRel; + return TlsGotDynRel; } bool AArch64TargetInfo::isTlsDynRel(unsigned Type, const SymbolBody &S) const {