[PATCH] D127110: [lld-macho] Demangle symbol names in duplicate-symbol error when -demangle is specified
Vy Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 6 06:15:14 PDT 2022
oontvoo created this revision.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
oontvoo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D127110
Files:
lld/MachO/SymbolTable.cpp
lld/test/MachO/invalid/duplicate-symbol.s
Index: lld/test/MachO/invalid/duplicate-symbol.s
===================================================================
--- lld/test/MachO/invalid/duplicate-symbol.s
+++ lld/test/MachO/invalid/duplicate-symbol.s
@@ -1,15 +1,17 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t-dup.o
-# RUN: not %lld -o /dev/null %t-dup.o %t.o 2>&1 | FileCheck %s -DFILE_1=%t-dup.o -DFILE_2=%t.o
-# RUN: not %lld -o /dev/null %t.o %t.o 2>&1 | FileCheck %s -DFILE_1=%t.o -DFILE_2=%t.o
+# RUN: not %lld -dylib -o /dev/null %t-dup.o %t.o 2>&1 | FileCheck %s -DNAME=_ZN1a1bL3fooE -DFILE_1=%t-dup.o -DFILE_2=%t.o
+# RUN: not %lld -dylib -o /dev/null %t.o %t.o 2>&1 | FileCheck %s -DNAME=_ZN1a1bL3fooE -DFILE_1=%t.o -DFILE_2=%t.o
-# CHECK: error: duplicate symbol: _main
+# RUN: not %lld -dylib -demangle -o /dev/null %t-dup.o %t.o 2>&1 | FileCheck %s -DNAME="a::b::foo" -DFILE_1=%t-dup.o -DFILE_2=%t.o
+# RUN: not %lld -dylib -demangle -o /dev/null %t.o %t.o 2>&1 | FileCheck %s -DNAME="a::b::foo" -DFILE_1=%t.o -DFILE_2=%t.o
+
+# CHECK: error: duplicate symbol: [[NAME]]
# CHECK-NEXT: >>> defined in [[FILE_1]]
# CHECK-NEXT: >>> defined in [[FILE_2]]
.text
-.global _main
-_main:
- mov $0, %rax
+.global _ZN1a1bL3fooE
+_ZN1a1bL3fooE:
ret
Index: lld/MachO/SymbolTable.cpp
===================================================================
--- lld/MachO/SymbolTable.cpp
+++ lld/MachO/SymbolTable.cpp
@@ -83,7 +83,7 @@
concatIsec->symbols.erase(llvm::find(concatIsec->symbols, defined));
}
} else {
- error("duplicate symbol: " + name + "\n>>> defined in " +
+ error("duplicate symbol: " + toString(*defined) + "\n>>> defined in " +
toString(defined->getFile()) + "\n>>> defined in " +
toString(file));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127110.434452.patch
Type: text/x-patch
Size: 1884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220606/50b8bfb8/attachment.bin>
More information about the llvm-commits
mailing list