diff options
| -rw-r--r-- | lld/ELF/Relocations.cpp | 6 | ||||
| -rw-r--r-- | lld/ELF/Target.cpp | 24 | ||||
| -rw-r--r-- | lld/ELF/Target.h | 1 |
3 files changed, 3 insertions, 28 deletions
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 494aa7771da..715066c56d8 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -133,7 +133,7 @@ static unsigned handleNoRelaxTlsRelocation(GOT *Got, uint32_t Type, return 1; } - if (Target->isTlsGlobalDynamicRel(Type)) { + if (isRelExprOneOf<R_TLSGD, R_TLSGD_PC, R_MIPS_TLSGD>(Expr)) { if (Got->addDynTlsEntry(Body) && (Body.isPreemptible() || Config->EMachine == EM_ARM)) { uint64_t Off = Got->getGlobalDynOffset(Body); @@ -202,8 +202,8 @@ handleTlsRelocation(uint32_t Type, SymbolBody &Body, InputSectionBase &C, return 1; } - if (isRelExprOneOf<R_TLSDESC_PAGE, R_TLSDESC, R_TLSDESC_CALL>(Expr) || - Target->isTlsGlobalDynamicRel(Type)) { + if (isRelExprOneOf<R_TLSDESC, R_TLSDESC_PAGE, R_TLSDESC_CALL, R_TLSGD, + R_TLSGD_PC>(Expr)) { if (Config->Shared) { if (In<ELFT>::Got->addDynTlsEntry(Body)) { uint64_t Off = In<ELFT>::Got->getGlobalDynOffset(Body); diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index f62d083bae9..872d8e650ac 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -124,7 +124,6 @@ public: void writeGotPltHeader(uint8_t *Buf) const override; uint32_t getDynRel(uint32_t Type) const override; bool isTlsLocalDynamicRel(uint32_t Type) const override; - bool isTlsGlobalDynamicRel(uint32_t Type) const override; bool isTlsInitialExecRel(uint32_t Type) const override; void writeGotPlt(uint8_t *Buf, const SymbolBody &S) const override; void writeIgotPlt(uint8_t *Buf, const SymbolBody &S) const override; @@ -147,7 +146,6 @@ public: RelExpr getRelExpr(uint32_t Type, const SymbolBody &S) const override; bool isPicRel(uint32_t Type) const override; bool isTlsLocalDynamicRel(uint32_t Type) const override; - bool isTlsGlobalDynamicRel(uint32_t Type) const override; bool isTlsInitialExecRel(uint32_t Type) const override; void writeGotPltHeader(uint8_t *Buf) const override; void writeGotPlt(uint8_t *Buf, const SymbolBody &S) const override; @@ -219,7 +217,6 @@ public: uint32_t getDynRel(uint32_t Type) const override; int64_t getImplicitAddend(const uint8_t *Buf, uint32_t Type) const override; bool isTlsLocalDynamicRel(uint32_t Type) const override; - bool isTlsGlobalDynamicRel(uint32_t Type) const override; bool isTlsInitialExecRel(uint32_t Type) const override; void writeGotPlt(uint8_t *Buf, const SymbolBody &S) const override; void writeIgotPlt(uint8_t *Buf, const SymbolBody &S) const override; @@ -241,7 +238,6 @@ public: bool isPicRel(uint32_t Type) const override; uint32_t getDynRel(uint32_t Type) const override; bool isTlsLocalDynamicRel(uint32_t Type) const override; - bool isTlsGlobalDynamicRel(uint32_t Type) const override; void writeGotPlt(uint8_t *Buf, const SymbolBody &S) const override; void writePltHeader(uint8_t *Buf) const override; void writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, uint64_t PltEntryAddr, @@ -306,8 +302,6 @@ bool TargetInfo::isTlsInitialExecRel(uint32_t Type) const { return false; } bool TargetInfo::isTlsLocalDynamicRel(uint32_t Type) const { return false; } -bool TargetInfo::isTlsGlobalDynamicRel(uint32_t Type) const { return false; } - void TargetInfo::writeIgotPlt(uint8_t *Buf, const SymbolBody &S) const { writeGotPlt(Buf, S); } @@ -431,10 +425,6 @@ uint32_t X86TargetInfo::getDynRel(uint32_t Type) const { return Type; } -bool X86TargetInfo::isTlsGlobalDynamicRel(uint32_t Type) const { - return Type == R_386_TLS_GD; -} - bool X86TargetInfo::isTlsLocalDynamicRel(uint32_t Type) const { return Type == R_386_TLS_LDO_32 || Type == R_386_TLS_LDM; } @@ -758,11 +748,6 @@ bool X86_64TargetInfo<ELFT>::isTlsInitialExecRel(uint32_t Type) const { } template <class ELFT> -bool X86_64TargetInfo<ELFT>::isTlsGlobalDynamicRel(uint32_t Type) const { - return Type == R_X86_64_TLSGD; -} - -template <class ELFT> bool X86_64TargetInfo<ELFT>::isTlsLocalDynamicRel(uint32_t Type) const { return Type == R_X86_64_DTPOFF32 || Type == R_X86_64_DTPOFF64 || Type == R_X86_64_TLSLD; @@ -2048,10 +2033,6 @@ bool ARMTargetInfo::isTlsLocalDynamicRel(uint32_t Type) const { return Type == R_ARM_TLS_LDO32 || Type == R_ARM_TLS_LDM32; } -bool ARMTargetInfo::isTlsGlobalDynamicRel(uint32_t Type) const { - return Type == R_ARM_TLS_GD32; -} - bool ARMTargetInfo::isTlsInitialExecRel(uint32_t Type) const { return Type == R_ARM_TLS_IE32; } @@ -2153,11 +2134,6 @@ bool MipsTargetInfo<ELFT>::isTlsLocalDynamicRel(uint32_t Type) const { } template <class ELFT> -bool MipsTargetInfo<ELFT>::isTlsGlobalDynamicRel(uint32_t Type) const { - return Type == R_MIPS_TLS_GD; -} - -template <class ELFT> void MipsTargetInfo<ELFT>::writeGotPlt(uint8_t *Buf, const SymbolBody &) const { write32<ELFT::TargetEndianness>(Buf, In<ELFT>::Plt->getVA()); } diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h index 02a2384fb8a..deb9cc45e70 100644 --- a/lld/ELF/Target.h +++ b/lld/ELF/Target.h @@ -25,7 +25,6 @@ class TargetInfo { public: virtual bool isTlsInitialExecRel(uint32_t Type) const; virtual bool isTlsLocalDynamicRel(uint32_t Type) const; - virtual bool isTlsGlobalDynamicRel(uint32_t Type) const; virtual bool isPicRel(uint32_t Type) const { return true; } virtual uint32_t getDynRel(uint32_t Type) const { return Type; } virtual void writeGotPltHeader(uint8_t *Buf) const {} |

