[lld] r268515 - Delete getTlsGotRel.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed May 4 08:51:23 PDT 2016


Author: rafael
Date: Wed May  4 10:51:23 2016
New Revision: 268515

URL: http://llvm.org/viewvc/llvm-project?rev=268515&view=rev
Log:
Delete getTlsGotRel.

It was an old hack to avoid duplicating expression computation, but that
is not needed with getExprRel.

Modified:
    lld/trunk/ELF/Target.cpp
    lld/trunk/ELF/Target.h
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=268515&r1=268514&r2=268515&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Wed May  4 10:51:23 2016
@@ -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
   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(uin
   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
   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
   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;

Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=268515&r1=268514&r2=268515&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Wed May  4 10:51:23 2016
@@ -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;

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=268515&r1=268514&r2=268515&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed May  4 10:51:23 2016
@@ -672,10 +672,9 @@ void Writer<ELFT>::scanRelocs(InputSecti
 
     // 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);




More information about the llvm-commits mailing list