Demangle symbols in "undefined symbol" error message.

llvm-svn: 281698
This commit is contained in:
Rui Ueyama
2016-09-16 03:52:45 +00:00
parent 8e68d6a023
commit 2644cd1d88
2 changed files with 11 additions and 3 deletions

View File

@@ -307,7 +307,9 @@ template <class ELFT> static void reportUndefined(SymbolBody *Sym) {
Config->UnresolvedSymbols != UnresolvedPolicy::NoUndef)
return;
std::string Msg = "undefined symbol: " + Sym->getName().str();
std::string Msg = "undefined symbol: ";
Msg += Config->Demangle ? demangle(Sym->getName()) : Sym->getName().str();
if (Sym->File)
Msg += " in " + getFilename(Sym->File);
if (Config->UnresolvedSymbols == UnresolvedPolicy::Warn)

View File

@@ -4,12 +4,18 @@
# RUN: llvm-ar rc %t2.a %t2.o
# RUN: not ld.lld %t.o %t2.a -o %t.exe 2>&1 | FileCheck %s
# RUN: not ld.lld -pie %t.o %t2.a -o %t.exe 2>&1 | FileCheck %s
# CHECK: undefined symbol: bar in {{.*}}
# CHECK: undefined symbol: foo in {{.*}}
# CHECK: undefined symbol: foo(int) in
# CHECK: undefined symbol: bar in
# CHECK: undefined symbol: foo in
# CHECK: undefined symbol: zed2 in {{.*}}2.a({{.*}}.o)
# RUN: not ld.lld %t.o %t2.a -o %t.exe -no-demangle 2>&1 | \
# RUN: FileCheck -check-prefix=NO-DEMANGLE %s
# NO-DEMANGLE: undefined symbol: _Z3fooi in
.globl _start
_start:
call foo
call bar
call zed1
call _Z3fooi