[PATCH] D26738: [ELF] - Improve diagnostic messages.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 02:48:40 PST 2016


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar, evgeny777.

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


https://reviews.llvm.org/D26738

Files:
  ELF/Relocations.cpp
  test/ELF/copy-errors.s


Index: test/ELF/copy-errors.s
===================================================================
--- test/ELF/copy-errors.s
+++ test/ELF/copy-errors.s
@@ -9,7 +9,7 @@
 
 
 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
Index: ELF/Relocations.cpp
===================================================================
--- ELF/Relocations.cpp
+++ ELF/Relocations.cpp
@@ -453,7 +453,8 @@
     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 @@
     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;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26738.78155.patch
Type: text/x-patch
Size: 1186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161116/d9220ad7/attachment-0001.bin>


More information about the llvm-commits mailing list