[lld] r312003 - [ELF] - Mention -fPIC in some error messages.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 08:03:01 PDT 2017


Author: grimar
Date: Tue Aug 29 08:03:01 2017
New Revision: 312003

URL: http://llvm.org/viewvc/llvm-project?rev=312003&view=rev
Log:
[ELF] - Mention -fPIC in some error messages.

This is PR32429.

We did not mention -fPIC in error about producing dynamic relocation
in readonly segment before. Patch changes that.

Differential revision: https://reviews.llvm.org/D36874

Modified:
    lld/trunk/ELF/Relocations.cpp
    lld/trunk/test/ELF/dynamic-reloc-in-ro.s

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=312003&r1=312002&r2=312003&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Tue Aug 29 08:03:01 2017
@@ -566,7 +566,8 @@ static RelExpr adjustExpr(SymbolBody &Bo
     error("can't create dynamic relocation " + toString(Type) + " against " +
           (Body.getName().empty() ? "local symbol"
                                   : "symbol: " + toString(Body)) +
-          " in readonly segment" + getLocation<ELFT>(S, Body, RelOff));
+          " in readonly segment; recompile object files with -fPIC" +
+          getLocation<ELFT>(S, Body, RelOff));
     return Expr;
   }
 

Modified: lld/trunk/test/ELF/dynamic-reloc-in-ro.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/dynamic-reloc-in-ro.s?rev=312003&r1=312002&r2=312003&view=diff
==============================================================================
--- lld/trunk/test/ELF/dynamic-reloc-in-ro.s (original)
+++ lld/trunk/test/ELF/dynamic-reloc-in-ro.s Tue Aug 29 08:03:01 2017
@@ -2,9 +2,9 @@
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 // RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s
 
-// CHECK: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment
-// CHECK: >>> defined in {{.*}}.o
-// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
+// CHECK:      can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC
+// CHECK-NEXT: >>> defined in {{.*}}.o
+// CHECK-NEXT: >>> referenced by {{.*}}.o:(.text+0x0)
 
 foo:
 .quad foo




More information about the llvm-commits mailing list