[PATCH] D99139: [lld][ELF] --warn-backrefs: Fix symbol name demangling
Yang Fan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 22 23:06:21 PDT 2021
nullptr.cpp updated this revision to Diff 332536.
nullptr.cpp added a comment.
Use the existing test
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99139/new/
https://reviews.llvm.org/D99139
Files:
lld/ELF/Symbols.cpp
lld/test/ELF/lto/warn-backrefs.ll
Index: lld/test/ELF/lto/warn-backrefs.ll
===================================================================
--- lld/test/ELF/lto/warn-backrefs.ll
+++ lld/test/ELF/lto/warn-backrefs.ll
@@ -4,19 +4,21 @@
; RUN: split-file %s %t
; RUN: llvm-as %t/a.ll -o %ta.o
; RUN: llvm-as %t/b.ll -o %tb.o
-; RUN: ld.lld --warn-backrefs --start-lib %tb.o --end-lib %ta.o -o /dev/null 2>&1 | FileCheck %s
+; RUN: ld.lld --demangle --warn-backrefs --start-lib %tb.o --end-lib %ta.o -o /dev/null 2>&1 | FileCheck %s -check-prefix=CHECK-DEMANGLE
+; RUN: ld.lld --no-demangle --warn-backrefs --start-lib %tb.o --end-lib %ta.o -o /dev/null 2>&1 | FileCheck %s -check-prefix=CHECK-NO-DEMANGLE
-; CHECK: warning: backward reference detected: f in {{.*}}a.o refers to {{.*}}b.o
+; CHECK-DEMANGLE: warning: backward reference detected: f() in {{.*}}a.o refers to {{.*}}b.o
+; CHECK-NO-DEMANGLE:: warning: backward reference detected: _Z1fv in {{.*}}a.o refers to {{.*}}b.o
;--- a.ll
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-declare void @f()
+declare void @_Z1fv()
define void @_start() {
entry:
- call void () @f()
+ call void () @_Z1fv()
ret void
}
@@ -24,7 +26,7 @@
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-define void @f() {
+define void @_Z1fv() {
entry:
ret void
}
Index: lld/ELF/Symbols.cpp
===================================================================
--- lld/ELF/Symbols.cpp
+++ lld/ELF/Symbols.cpp
@@ -385,7 +385,7 @@
break;
}
if (!exclude)
- warn("backward reference detected: " + sym.getName() + " in " +
+ warn("backward reference detected: " + toString(sym) + " in " +
toString(it.second.first) + " refers to " + to);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99139.332536.patch
Type: text/x-patch
Size: 1889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210323/a3f5b27d/attachment.bin>
More information about the llvm-commits
mailing list