[lld] r266876 - Delete needsDynRelative.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 07:36:24 PDT 2016


Author: rafael
Date: Wed Apr 20 09:36:24 2016
New Revision: 266876

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

It is now redundant. Writer.cpp can reason that 2 dynamic relocations
are needed: one to find the final got entry address and one to fill the
got entry.

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=266876&r1=266875&r2=266876&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Wed Apr 20 09:36:24 2016
@@ -84,7 +84,6 @@ public:
                 int32_t Index, unsigned RelOff) const override;
   bool isRelRelative(uint32_t Type) const override;
   bool needsCopyRelImpl(uint32_t Type) const override;
-  bool needsDynRelative(uint32_t Type) const override;
   bool needsPltImpl(uint32_t Type) const override;
   void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override;
 
@@ -510,10 +509,6 @@ void X86TargetInfo::relocateOne(uint8_t
   write32le(Loc, Val);
 }
 
-bool X86TargetInfo::needsDynRelative(uint32_t Type) const {
-  return Config->Shared && Type == R_386_TLS_IE;
-}
-
 void X86TargetInfo::relaxTlsGdToLe(uint8_t *Loc, uint32_t Type,
                                    uint64_t Val) const {
   // GD can be optimized to LE:
@@ -1166,6 +1161,7 @@ bool AArch64TargetInfo::isRelRelative(ui
   case R_AARCH64_TLSLE_ADD_TPREL_HI12:
   case R_AARCH64_TLSLE_ADD_TPREL_LO12_NC:
   case R_AARCH64_TSTBR14:
+  case R_AARCH64_LD64_GOT_LO12_NC:
     return true;
   }
 }

Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=266876&r1=266875&r2=266876&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Wed Apr 20 09:36:24 2016
@@ -55,7 +55,6 @@ public:
   // dynamic linker if isRelRelative returns true.
   virtual bool isRelRelative(uint32_t Type) const;
 
-  virtual bool needsDynRelative(uint32_t Type) const { return false; }
   virtual bool refersToGotEntry(uint32_t Type) const;
 
   enum PltNeed { Plt_No, Plt_Explicit, Plt_Implicit };

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=266876&r1=266875&r2=266876&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Apr 20 09:36:24 2016
@@ -501,7 +501,7 @@ void Writer<ELFT>::scanRelocs(InputSecti
       continue;
     }
 
-    if (Target->needsDynRelative(Type))
+    if (Expr == R_GOT && !Target->isRelRelative(Type) && Config->Shared)
       AddDyn({Target->RelativeRel, C.OutSec, Offset, true, &Body,
               getAddend<ELFT>(RI)});
 




More information about the llvm-commits mailing list