[ELF] - Improve diagnostic messages.
authorGeorge Rimar <grimar@accesssoftek.com>
Wed, 16 Nov 2016 17:24:06 +0000 (17:24 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Wed, 16 Nov 2016 17:24:06 +0000 (17:24 +0000)
Particulaty "cannot preempt symbol" message
is extended with locations now.

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

llvm-svn: 287120

lld/ELF/Relocations.cpp
lld/test/ELF/copy-errors.s

index ebcb17e..6aa0444 100644 (file)
@@ -453,7 +453,8 @@ static RelExpr adjustExpr(const elf::ObjectFile<ELFT> &File, SymbolBody &Body,
     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::ObjectFile<ELFT> &File, SymbolBody &Body,
     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;
 }
index 0767172..5be0aa6 100644 (file)
@@ -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