[lld] r267005 - Don't recompute getRelExpr. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 09:59:26 PDT 2016


Author: rafael
Date: Thu Apr 21 11:59:25 2016
New Revision: 267005

URL: http://llvm.org/viewvc/llvm-project?rev=267005&view=rev
Log:
Don't recompute getRelExpr. NFC.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=267005&r1=267004&r2=267005&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Apr 21 11:59:25 2016
@@ -435,7 +435,7 @@ namespace {
 enum PltNeed { Plt_No, Plt_Explicit, Plt_Implicit };
 }
 
-static PltNeed needsPlt(uint32_t Type, const SymbolBody &S) {
+static PltNeed needsPlt(RelExpr Expr, uint32_t Type, const SymbolBody &S) {
   if (S.isGnuIFunc())
     return Plt_Explicit;
   if (S.isPreemptible() && Target->needsPlt(Type))
@@ -462,11 +462,9 @@ static PltNeed needsPlt(uint32_t Type, c
   // that points to the real function is a dedicated got entry used by the
   // plt. That is identified by special relocation types (R_X86_64_JUMP_SLOT,
   // R_386_JMP_SLOT, etc).
-  if (S.isShared() && !Config->Pic && S.isFunc()) {
-    RelExpr Expr = Target->getRelExpr(Type, S);
+  if (S.isShared() && !Config->Pic && S.isFunc())
     if (!refersToGotEntry(Expr))
       return Plt_Implicit;
-  }
 
   return Plt_No;
 }
@@ -568,7 +566,7 @@ void Writer<ELFT>::scanRelocs(InputSecti
 
     // If a relocation needs PLT, we create a PLT and a GOT slot
     // for the symbol.
-    PltNeed NeedPlt = needsPlt(Type, Body);
+    PltNeed NeedPlt = needsPlt(Expr, Type, Body);
     if (NeedPlt) {
       if (NeedPlt == Plt_Implicit)
         Body.NeedsCopyOrPltAddr = true;




More information about the llvm-commits mailing list