Index: lld/ELF/Symbols.cpp =================================================================== --- lld/ELF/Symbols.cpp +++ lld/ELF/Symbols.cpp @@ -299,6 +299,6 @@ std::string lld::toString(const Symbol &B) { if (Config->Demangle) if (Optional S = demangleItanium(B.getName())) - return *S; + return ("\"" + *S + "\" (" + B.getName() + ")").str(); return B.getName(); } Index: lld/test/ELF/conflict-variable-linkage-name.s =================================================================== --- lld/test/ELF/conflict-variable-linkage-name.s +++ lld/test/ELF/conflict-variable-linkage-name.s @@ -3,14 +3,14 @@ # RUN: not ld.lld %t.o %t.o -o /dev/null 2>&1 | FileCheck %s ## Check we can report the locations of 2 different "bar" variables. -# CHECK: duplicate symbol: A::bar +# CHECK: duplicate symbol: "A::bar" (_ZN1A3barE) # CHECK-NEXT: >>> defined at 1.cpp:2 -# CHECK-NEXT: >>> {{.*}}:(A::bar) +# CHECK-NEXT: >>> {{.*}}:("A::bar" (_ZN1A3barE)) # CHECK-NEXT: >>> defined at 1.cpp:2 # CHECK-NEXT: >>> {{.*}}:(.bss+0x0) -# CHECK: duplicate symbol: Z::bar +# CHECK: duplicate symbol: "Z::bar" (_ZN1Z3barE) # CHECK-NEXT: >>> defined at 1.cpp:6 -# CHECK-NEXT: >>> {{.*}}:(Z::bar) +# CHECK-NEXT: >>> {{.*}}:("Z::bar" (_ZN1Z3barE)) # CHECK-NEXT: >>> defined at 1.cpp:6 # CHECK-NEXT: >>> {{.*}}:(.data+0x0) Index: lld/test/ELF/conflict.s =================================================================== --- lld/test/ELF/conflict.s +++ lld/test/ELF/conflict.s @@ -3,7 +3,7 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o # RUN: not ld.lld %t1.o %t1.o -o %t2 2>&1 | FileCheck -check-prefix=DEMANGLE %s -# DEMANGLE: duplicate symbol: mul(double, double) +# DEMANGLE: duplicate symbol: "mul(double, double)" (_Z3muldd) # DEMANGLE-NEXT: >>> defined at {{.*}}:(.text+0x0) # DEMANGLE-NEXT: >>> defined at {{.*}}:(.text+0x0) # DEMANGLE: duplicate symbol: foo Index: lld/test/ELF/debug-line-str.s =================================================================== --- lld/test/ELF/debug-line-str.s +++ lld/test/ELF/debug-line-str.s @@ -4,7 +4,7 @@ # Check we do not crash and able to report the source location. -# CHECK: error: undefined symbol: foo() +# CHECK: error: undefined symbol: "foo()" (_Z3foov) # CHECK-NEXT: >>> referenced by test.cpp:3 # CHECK-NEXT: >>> {{.*}}.o:(.text+0x1) Index: lld/test/ELF/linkerscript/map-file2.test =================================================================== --- lld/test/ELF/linkerscript/map-file2.test +++ lld/test/ELF/linkerscript/map-file2.test @@ -34,7 +34,7 @@ # CHECK-NEXT: 1228 3218 30 1 {{.*}}{{/|\\}}map-file2.test.tmp.o:(.eh_frame+0x0) # CHECK-NEXT: 125c 324c 1 4 .text # CHECK-NEXT: 125c 324c 1 4 {{.*}}{{/|\\}}map-file2.test.tmp.o:(.text) -# CHECK-NEXT: 125c 324c 0 1 f(int) +# CHECK-NEXT: 125c 324c 0 1 "f(int)" (_Z1fi) # CHECK-NEXT: 125c 324c 0 1 _start # CHECK-NEXT: 0 0 8 1 .comment # CHECK-NEXT: 0 0 8 1 :(.comment) Index: lld/test/ELF/map-file.s =================================================================== --- lld/test/ELF/map-file.s +++ lld/test/ELF/map-file.s @@ -60,7 +60,7 @@ // CHECK-NEXT: 201000 201000 2d 4 .text // CHECK-NEXT: 201000 201000 28 4 {{.*}}{{/|\\}}map-file.s.tmp1.o:(.text) // CHECK-NEXT: 201000 201000 0 1 _start -// CHECK-NEXT: 20101f 20101f 0 1 f(int) +// CHECK-NEXT: 20101f 20101f 0 1 "f(int)" (_Z1fi) // CHECK-NEXT: 201028 201028 0 1 local // CHECK-NEXT: 201028 201028 2 4 {{.*}}{{/|\\}}map-file.s.tmp2.o:(.text) // CHECK-NEXT: 201028 201028 0 1 foo Index: lld/test/ELF/undef.s =================================================================== --- lld/test/ELF/undef.s +++ lld/test/ELF/undef.s @@ -16,11 +16,11 @@ # CHECK: >>> referenced by undef.s # CHECK: >>> {{.*}}:(.text+0x6) -# CHECK: error: undefined symbol: foo(int) +# CHECK: error: undefined symbol: "foo(int)" (_Z3fooi) # CHECK: >>> referenced by undef.s # CHECK: >>> {{.*}}:(.text+0x10) -# CHECK: error: undefined symbol: vtable for Foo +# CHECK: error: undefined symbol: "vtable for Foo" (_ZTV3Foo) # CHECK: the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction) # CHECK: error: undefined symbol: zed2