summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/Target.cpp23
-rw-r--r--lld/ELF/Target.h1
-rw-r--r--lld/ELF/Writer.cpp3
3 files changed, 2 insertions, 25 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index aea6eabf7df..ccc0efacbae 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -83,7 +83,6 @@ public:
uint64_t getImplicitAddend(const uint8_t *Buf, uint32_t Type) const override;
void writeGotPltHeader(uint8_t *Buf) const override;
uint32_t getDynRel(uint32_t Type) const override;
- uint32_t getTlsGotRel(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;
@@ -104,7 +103,6 @@ public:
X86_64TargetInfo();
RelExpr getRelExpr(uint32_t Type, const SymbolBody &S) const override;
uint32_t getDynRel(uint32_t Type) const override;
- uint32_t getTlsGotRel(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;
@@ -148,7 +146,6 @@ public:
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;
- uint32_t getTlsGotRel(uint32_t Type) const override;
bool usesOnlyLowPageBits(uint32_t Type) const override;
void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override;
void relaxTlsGdToLe(uint8_t *Loc, uint32_t Type, uint64_t Val) const override;
@@ -319,12 +316,6 @@ uint32_t X86TargetInfo::getDynRel(uint32_t Type) const {
return Type;
}
-uint32_t X86TargetInfo::getTlsGotRel(uint32_t Type) const {
- if (Type == R_386_TLS_IE)
- return Type;
- return R_386_GOT32;
-}
-
bool X86TargetInfo::isTlsGlobalDynamicRel(uint32_t Type) const {
return Type == R_386_TLS_GD;
}
@@ -584,13 +575,6 @@ uint32_t X86_64TargetInfo::getDynRel(uint32_t Type) const {
return Type;
}
-uint32_t X86_64TargetInfo::getTlsGotRel(uint32_t Type) const {
- // No other types of TLS relocations requiring GOT should
- // reach here.
- assert(Type == R_X86_64_GOTTPOFF);
- return R_X86_64_PC32;
-}
-
bool X86_64TargetInfo::isTlsInitialExecRel(uint32_t Type) const {
return Type == R_X86_64_GOTTPOFF;
}
@@ -727,6 +711,7 @@ void X86_64TargetInfo::relocateOne(uint8_t *Loc, uint32_t Type,
case R_X86_64_GOTPCRELX:
case R_X86_64_REX_GOTPCRELX:
case R_X86_64_PC32:
+ case R_X86_64_GOTTPOFF:
case R_X86_64_PLT32:
case R_X86_64_TLSGD:
case R_X86_64_TLSLD:
@@ -1063,12 +1048,6 @@ void AArch64TargetInfo::writePlt(uint8_t *Buf, uint64_t GotEntryAddr,
relocateOne(Buf + 8, R_AARCH64_ADD_ABS_LO12_NC, GotEntryAddr);
}
-uint32_t AArch64TargetInfo::getTlsGotRel(uint32_t Type) const {
- assert(Type == R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 ||
- Type == R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC);
- return Type;
-}
-
static void updateAArch64Addr(uint8_t *L, uint64_t Imm) {
uint32_t ImmLo = (Imm & 0x3) << 29;
uint32_t ImmHi = ((Imm & 0x1FFFFC) >> 2) << 5;
diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h
index d142e752498..2923539773f 100644
--- a/lld/ELF/Target.h
+++ b/lld/ELF/Target.h
@@ -28,7 +28,6 @@ public:
virtual bool isTlsLocalDynamicRel(uint32_t Type) const;
virtual bool isTlsGlobalDynamicRel(uint32_t Type) const;
virtual uint32_t getDynRel(uint32_t Type) const { return Type; }
- virtual uint32_t getTlsGotRel(uint32_t Type) const { return TlsGotRel; }
virtual void writeGotPltHeader(uint8_t *Buf) const {}
virtual void writeGotPlt(uint8_t *Buf, uint64_t Plt) const {};
virtual uint64_t getImplicitAddend(const uint8_t *Buf, uint32_t Type) const;
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index c773b7ab040..d4bfc639195 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -672,10 +672,9 @@ void Writer<ELFT>::scanRelocs(InputSectionBase<ELFT> &C, ArrayRef<RelTy> Rels) {
// If a relocation needs GOT, we create a GOT slot for the symbol.
if (refersToGotEntry(Expr)) {
- uint32_t T = Body.isTls() ? Target->getTlsGotRel(Type) : Type;
if (Config->EMachine == EM_MIPS && Expr == R_GOT_OFF)
Addend -= MipsGPOffset;
- C.Relocations.push_back({Expr, T, Offset, Addend, &Body});
+ C.Relocations.push_back({Expr, Type, Offset, Addend, &Body});
if (Body.isInGot())
continue;
Out<ELFT>::Got->addEntry(Body);
OpenPOWER on IntegriCloud