[lld] r320430 - Return R_PLT_PC for R_PPC_PLTREL24.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 14:40:18 PST 2017


Author: rafael
Date: Mon Dec 11 14:40:18 2017
New Revision: 320430

URL: http://llvm.org/viewvc/llvm-project?rev=320430&view=rev
Log:
Return R_PLT_PC for R_PPC_PLTREL24.

The PPC port doesn't support PLT yet, but the architecture independent
code optimizes PLT access for non preemptible symbols, which is
exactly what returning R_PC was trying to implement.

Modified:
    lld/trunk/ELF/Arch/PPC.cpp

Modified: lld/trunk/ELF/Arch/PPC.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/PPC.cpp?rev=320430&r1=320429&r2=320430&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/PPC.cpp (original)
+++ lld/trunk/ELF/Arch/PPC.cpp Mon Dec 11 14:40:18 2017
@@ -34,15 +34,8 @@ RelExpr PPC::getRelExpr(RelType Type, co
   case R_PPC_REL24:
   case R_PPC_REL32:
     return R_PC;
-  // In general case R_PPC_PLTREL24 should result in R_PLT_PC, however, since
-  // PLT support is currently not available for PPC32 this workaround at least 
-  // allows lld to resolve local symbols when performing static linkage after
-  // LLVM started to forcibly use PLT relocations by default (see D38554).
-  // Non-local symbols will need a full PLT implementation, but once it lands
-  // local symbols should still avoid PLT table with static relocation model.
-  // This is the optimisation that bfd and gold are doing by default as well.
   case R_PPC_PLTREL24:
-    return R_PC;
+    return R_PLT_PC;
   default:
     return R_ABS;
   }




More information about the llvm-commits mailing list