[lld] r363236 - [ELF] Loosen the condition that changes absolute relocation types to relative relocations for ARM and PPC64

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 01:45:22 PDT 2019


Author: maskray
Date: Thu Jun 13 01:45:22 2019
New Revision: 363236

URL: http://llvm.org/viewvc/llvm-project?rev=363236&view=rev
Log:
[ELF] Loosen the condition that changes absolute relocation types to relative relocations for ARM and PPC64

Try fixing build bots after D63121

Modified:
    lld/trunk/ELF/Relocations.cpp

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=363236&r1=363235&r2=363236&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Thu Jun 13 01:45:22 2019
@@ -930,7 +930,13 @@ static void processRelocAux(InputSection
   }
   bool CanWrite = (Sec.Flags & SHF_WRITE) || !Config->ZText;
   if (CanWrite) {
-    if ((!Sym.IsPreemptible && Type == Target->SymbolicRel) || Expr == R_GOT) {
+    // FIXME Improve the way we handle absolute relocation types that will
+    // change to relative relocations. ARM has a relocation type R_ARM_TARGET1
+    // that is similar to SymbolicRel. PPC64 may have similar relocation types.
+    if ((!Sym.IsPreemptible &&
+         (Config->EMachine == EM_ARM || Config->EMachine == EM_PPC64 ||
+          Type == Target->SymbolicRel)) ||
+        Expr == R_GOT) {
       // If this is a symbolic relocation to a non-preemptable symbol, or an
       // R_GOT, its address is its link-time value plus load address. Represent
       // it with a relative relocation.




More information about the llvm-commits mailing list