[lld] r321769 - Mention symbol name in error message.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 3 14:55:46 PST 2018


Author: rafael
Date: Wed Jan  3 14:55:46 2018
New Revision: 321769

URL: http://llvm.org/viewvc/llvm-project?rev=321769&view=rev
Log:
Mention symbol name in error message.

Modified:
    lld/trunk/ELF/Relocations.cpp
    lld/trunk/test/ELF/aarch64-fpic-abs16.s
    lld/trunk/test/ELF/aarch64-fpic-prel16.s
    lld/trunk/test/ELF/aarch64-fpic-prel32.s
    lld/trunk/test/ELF/aarch64-fpic-prel64.s
    lld/trunk/test/ELF/x86-64-dyn-rel-error.s
    lld/trunk/test/ELF/x86-64-dyn-rel-error2.s
    lld/trunk/test/ELF/x86-64-reloc-32-fpic.s
    lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s
    lld/trunk/test/ELF/x86-64-reloc-tpoff32-fpic.s
    lld/trunk/test/ELF/znotext-weak-undef.s

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=321769&r1=321768&r2=321769&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Wed Jan  3 14:55:46 2018
@@ -983,10 +983,9 @@ static void scanRelocs(InputSectionBase
       // We don't know anything about the finaly symbol. Just ask the dynamic
       // linker to handle the relocation for us.
       if (!Target->isPicRel(Type))
-        errorOrWarn(
-            "relocation " + toString(Type) +
-            " cannot be used against shared object; recompile with -fPIC" +
-            getLocation(Sec, Sym, Offset));
+        errorOrWarn("relocation " + toString(Type) +
+                    " cannot be used against symbol " + toString(Sym) +
+                    "; recompile with -fPIC" + getLocation(Sec, Sym, Offset));
 
       InX::RelaDyn->addReloc(
           {Target->getDynRel(Type), &Sec, Offset, false, &Sym, Addend});

Modified: lld/trunk/test/ELF/aarch64-fpic-abs16.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-abs16.s?rev=321769&r1=321768&r2=321769&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-abs16.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-abs16.s Wed Jan  3 14:55:46 2018
@@ -1,7 +1,7 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-// CHECK:      relocation R_AARCH64_ABS16 cannot be used against shared object; recompile with -fPIC
+// CHECK:      relocation R_AARCH64_ABS16 cannot be used against symbol foo; recompile with -fPIC
 // CHECK-NEXT: >>> defined in {{.*}}.o
 // CHECK-NEXT: >>> referenced by {{.*}}.o:(.data+0x0)
 

Modified: lld/trunk/test/ELF/aarch64-fpic-prel16.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-prel16.s?rev=321769&r1=321768&r2=321769&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-prel16.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-prel16.s Wed Jan  3 14:55:46 2018
@@ -1,7 +1,7 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-// CHECK: R_AARCH64_PREL16 cannot be used against shared object; recompile with -fPIC
+// CHECK: R_AARCH64_PREL16 cannot be used against symbol foo; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}
 // CHECK: >>> referenced by {{.*}}:(.data+0x0)
 

Modified: lld/trunk/test/ELF/aarch64-fpic-prel32.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-prel32.s?rev=321769&r1=321768&r2=321769&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-prel32.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-prel32.s Wed Jan  3 14:55:46 2018
@@ -1,7 +1,7 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-// CHECK: relocation R_AARCH64_PREL32 cannot be used against shared object; recompile with -fPIC
+// CHECK: relocation R_AARCH64_PREL32 cannot be used against symbol foo; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}
 // CHECK: >>> referenced by {{.*}}:(.data+0x0)
 

Modified: lld/trunk/test/ELF/aarch64-fpic-prel64.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-prel64.s?rev=321769&r1=321768&r2=321769&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-prel64.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-prel64.s Wed Jan  3 14:55:46 2018
@@ -1,7 +1,7 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-// CHECK: relocation R_AARCH64_PREL64 cannot be used against shared object; recompile with -fPIC
+// CHECK: relocation R_AARCH64_PREL64 cannot be used against symbol foo; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}
 // CHECK: >>> referenced by {{.*}}:(.data+0x0)
 

Modified: lld/trunk/test/ELF/x86-64-dyn-rel-error.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-dyn-rel-error.s?rev=321769&r1=321768&r2=321769&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-dyn-rel-error.s (original)
+++ lld/trunk/test/ELF/x86-64-dyn-rel-error.s Wed Jan  3 14:55:46 2018
@@ -9,6 +9,6 @@ _start:
         .data
         .long zed
 
-// CHECK: relocation R_X86_64_32 cannot be used against shared object; recompile with -fPIC
+// CHECK: relocation R_X86_64_32 cannot be used against symbol zed; recompile with -fPIC
 
 // RUN: ld.lld --noinhibit-exec %t.o %t2.so -o %t 2>&1 | FileCheck %s

Modified: lld/trunk/test/ELF/x86-64-dyn-rel-error2.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-dyn-rel-error2.s?rev=321769&r1=321768&r2=321769&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-dyn-rel-error2.s (original)
+++ lld/trunk/test/ELF/x86-64-dyn-rel-error2.s Wed Jan  3 14:55:46 2018
@@ -4,7 +4,7 @@
 // RUN: ld.lld %t2.o -shared -o %t2.so
 // RUN: not ld.lld -shared %t.o %t2.so -o %t 2>&1 | FileCheck %s
 
-// CHECK: relocation R_X86_64_PC32 cannot be used against shared object; recompile with -fPIC
+// CHECK: relocation R_X86_64_PC32 cannot be used against symbol zed; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}.so
 // CHECK: >>> referenced by {{.*}}.o:(.data+0x0)
 

Modified: lld/trunk/test/ELF/x86-64-reloc-32-fpic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-reloc-32-fpic.s?rev=321769&r1=321768&r2=321769&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-reloc-32-fpic.s (original)
+++ lld/trunk/test/ELF/x86-64-reloc-32-fpic.s Wed Jan  3 14:55:46 2018
@@ -2,7 +2,7 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 # RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
 
-# CHECK: relocation R_X86_64_32 cannot be used against shared object; recompile with -fPIC
+# CHECK: relocation R_X86_64_32 cannot be used against symbol _shared; recompile with -fPIC
 # CHECK: >>> defined in {{.*}}
 # CHECK: >>> referenced by {{.*}}:(.data+0x0)
 

Modified: lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s?rev=321769&r1=321768&r2=321769&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s (original)
+++ lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s Wed Jan  3 14:55:46 2018
@@ -2,7 +2,7 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 # RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
 
-# CHECK: relocation R_X86_64_PC32 cannot be used against shared object; recompile with -fPIC
+# CHECK: relocation R_X86_64_PC32 cannot be used against symbol _shared; recompile with -fPIC
 # CHECK: >>> defined in {{.*}}
 # CHECK: >>> referenced by {{.*}}:(.data+0x1)
 

Modified: lld/trunk/test/ELF/x86-64-reloc-tpoff32-fpic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-reloc-tpoff32-fpic.s?rev=321769&r1=321768&r2=321769&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-reloc-tpoff32-fpic.s (original)
+++ lld/trunk/test/ELF/x86-64-reloc-tpoff32-fpic.s Wed Jan  3 14:55:46 2018
@@ -2,7 +2,7 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 # RUN: not ld.lld %t.o -shared -o %t.so 2>&1 | FileCheck %s
 
-# CHECK: relocation R_X86_64_TPOFF32 cannot be used against shared object; recompile with -fPIC
+# CHECK: relocation R_X86_64_TPOFF32 cannot be used against symbol var; recompile with -fPIC
 # CHECK: >>> defined in {{.*}}.o
 # CHECK: >>> referenced by {{.*}}.o:(.tdata+0xC)
 

Modified: lld/trunk/test/ELF/znotext-weak-undef.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/znotext-weak-undef.s?rev=321769&r1=321768&r2=321769&view=diff
==============================================================================
--- lld/trunk/test/ELF/znotext-weak-undef.s (original)
+++ lld/trunk/test/ELF/znotext-weak-undef.s Wed Jan  3 14:55:46 2018
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 # RUN: not ld.lld -z notext -shared %t.o -o %t 2>&1 | FileCheck %s
-# CHECK: relocation R_X86_64_32 cannot be used against shared object; recompile with -fPIC
+# CHECK: relocation R_X86_64_32 cannot be used against symbol foo; recompile with -fPIC
 
 # RUN: ld.lld -z notext %t.o -o %t
 # RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=EXE




More information about the llvm-commits mailing list