From 76f429b4dbc90906d85f5d5e42cf14e310459a91 Mon Sep 17 00:00:00 2001 From: George Rimar Date: Wed, 16 Nov 2016 17:24:06 +0000 Subject: [PATCH] [ELF] - Improve diagnostic messages. Particulaty "cannot preempt symbol" message is extended with locations now. Differential revision: https://reviews.llvm.org/D26738 llvm-svn: 287120 --- lld/ELF/Relocations.cpp | 6 ++++-- lld/test/ELF/copy-errors.s | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index ebcb17e..6aa0444 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -453,7 +453,8 @@ static RelExpr adjustExpr(const elf::ObjectFile &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 &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; } diff --git a/lld/test/ELF/copy-errors.s b/lld/test/ELF/copy-errors.s index 0767172..5be0aa6 100644 --- a/lld/test/ELF/copy-errors.s +++ b/lld/test/ELF/copy-errors.s @@ -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 -- 2.7.4