[lld] r287120 - [ELF] - Improve diagnostic messages.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 09:24:06 PST 2016


Author: grimar
Date: Wed Nov 16 11:24:06 2016
New Revision: 287120

URL: http://llvm.org/viewvc/llvm-project?rev=287120&view=rev
Log:
[ELF] - Improve diagnostic messages.

Particulaty "cannot preempt symbol" message
is extended with locations now.

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

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=287120&r1=287119&r2=287120&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Wed Nov 16 11:24:06 2016
@@ -453,7 +453,8 @@ static RelExpr adjustExpr(const elf::Obj
     return Expr;
   }
   if (Body.getVisibility() != STV_DEFAULT) {
-    error("cannot preempt symbol " + Body.getName());
+    error(getLocation(S, RelOff) + ": cannot preempt symbol '" +
+          Body.getName() + "' previously defined in " + getFilename(Body.File));
     return Expr;
   }
   if (Body.isObject()) {
@@ -487,7 +488,8 @@ static RelExpr adjustExpr(const elf::Obj
     Body.NeedsCopyOrPltAddr = true;
     return toPlt(Expr);
   }
-  error("symbol " + Body.getName() + " is missing type");
+  error("symbol '" + Body.getName() + "' defined in " + getFilename(Body.File) +
+        " is missing type");
 
   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=287120&r1=287119&r2=287120&view=diff
==============================================================================
--- lld/trunk/test/ELF/copy-errors.s (original)
+++ lld/trunk/test/ELF/copy-errors.s Wed Nov 16 11:24:06 2016
@@ -9,7 +9,7 @@ _start:
 
 
 call bar
-// CHECK: cannot preempt symbol bar
+// CHECK: {{.*}}.o (.text+0x1): cannot preempt symbol 'bar' previously defined in {{.*}}.so
 
 call zed
-// CHECK: symbol zed is missing type
+// CHECK: symbol 'zed' defined in {{.*}}.so is missing type




More information about the llvm-commits mailing list