[lld] r321768 - Use getLocation to improve error message.

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


Author: rafael
Date: Wed Jan  3 14:44:58 2018
New Revision: 321768

URL: http://llvm.org/viewvc/llvm-project?rev=321768&view=rev
Log:
Use getLocation to improve error message.

Modified:
    lld/trunk/ELF/Relocations.cpp
    lld/trunk/test/ELF/copy-errors.s

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=321768&r1=321767&r2=321768&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Wed Jan  3 14:44:58 2018
@@ -640,8 +640,8 @@ static RelExpr adjustExpr(Symbol &Sym, R
   if (Sym.isFunc())
     return getPltExpr(Sym, Expr, IsConstant);
 
-  errorOrWarn("symbol '" + toString(Sym) + "' defined in " +
-              toString(Sym.File) + " has no type");
+  errorOrWarn("symbol '" + toString(Sym) + "' has no type" +
+              getLocation(S, Sym, RelOff));
   return Expr;
 }
 

Modified: lld/trunk/test/ELF/copy-errors.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/copy-errors.s?rev=321768&r1=321767&r2=321768&view=diff
==============================================================================
--- lld/trunk/test/ELF/copy-errors.s (original)
+++ lld/trunk/test/ELF/copy-errors.s Wed Jan  3 14:44:58 2018
@@ -7,10 +7,15 @@
 // CHECK: cannot preempt symbol: bar
 // CHECK: >>> defined in {{.*}}.so
 // CHECK: >>> referenced by {{.*}}.o:(.text+0x1)
-// CHECK: symbol 'zed' defined in {{.*}}.so has no type
+
+// CHECK: error: symbol 'zed' has no type
+// CHECK-NEXT: >>> defined in {{.*}}.so
+// CHECK-NEXT: >>> referenced by {{.*}}.o:(.text+0x6)
 
 // RUN: not ld.lld --noinhibit-exec %t.o %t2.so -o %t 2>&1 | FileCheck %s --check-prefix=NOINHIBIT
-// NOINHIBIT: warning: symbol 'zed' defined in {{.*}}.so has no type
+// NOINHIBIT: warning: symbol 'zed' has no type
+// NOINHIBIT-NEXT: >>> defined in {{.*}}.so
+// NOINHIBIT-NEXT: >>> referenced by {{.*}}.o:(.text+0x6)
 
 .global _start
 _start:




More information about the llvm-commits mailing list