From: Rui Ueyama Date: Fri, 16 Sep 2016 03:52:45 +0000 (+0000) Subject: Demangle symbols in "undefined symbol" error message. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2644cd1d886d239dede202650065c2da7559c8c8;p=platform%2Fupstream%2Fllvm.git Demangle symbols in "undefined symbol" error message. llvm-svn: 281698 --- diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index a97418e..6bbdcdb 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -307,7 +307,9 @@ template 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) diff --git a/lld/test/ELF/undef.s b/lld/test/ELF/undef.s index c8211c7..121136b 100644 --- a/lld/test/ELF/undef.s +++ b/lld/test/ELF/undef.s @@ -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