forked from OSchip/llvm-project
Don't use $ as suffix for symbol names in ThinLTOBitcodeWriter and other places
Using $ breaks demangling of the symbols. For example, $ c++filt _Z3foov\$123 _Z3foov$123 This causes problems for developers who would like to see nice stack traces etc., but also for automatic crash tracking systems which try to organize crashes based on the stack traces. Instead, use the period as suffix separator, since Itanium demanglers normally ignore such suffixes: $ c++filt _Z3foov.123 foo() [clone .123] This is already done in some places; try to do it everywhere. Differential revision: https://reviews.llvm.org/D97484
This commit is contained in:
parent
883912abe6
commit
c6e5c4654b
|
@ -1153,7 +1153,7 @@ bool DevirtModule::trySingleImplDevirt(
|
|||
// to make it visible to thin LTO objects. We can only get here during the
|
||||
// ThinLTO export phase.
|
||||
if (TheFn->hasLocalLinkage()) {
|
||||
std::string NewName = (TheFn->getName() + "$merged").str();
|
||||
std::string NewName = (TheFn->getName() + ".llvm.merged").str();
|
||||
|
||||
// Since we are renaming the function, any comdats with the same name must
|
||||
// also be renamed. This is required when targeting COFF, as the comdat name
|
||||
|
|
|
@ -289,7 +289,7 @@ std::string llvm::getUniqueModuleId(Module *M) {
|
|||
|
||||
SmallString<32> Str;
|
||||
MD5::stringifyResult(R, Str);
|
||||
return ("$" + Str).str();
|
||||
return ("." + Str).str();
|
||||
}
|
||||
|
||||
void VFABI::setVectorVariantNames(
|
||||
|
|
|
@ -25,18 +25,18 @@ target triple = "x86_64-unknown-linux-gnu"
|
|||
|
||||
; COMDAT: $global = comdat any
|
||||
; COMDAT: $dyn_init_global = comdat any
|
||||
; COMDAT: $"_ZZ4funcvE10static_var${{[01-9a-f]+}}" = comdat any
|
||||
; COMDAT: $".str${{[01-9a-f]+}}" = comdat any
|
||||
; COMDAT: $_ZZ4funcvE10static_var.{{[01-9a-f]+}} = comdat any
|
||||
; COMDAT: $.str.{{[01-9a-f]+}} = comdat any
|
||||
|
||||
; NOCOMDAT-NOT: $global = comdat any
|
||||
; NOCOMDAT-NOT: $dyn_init_global = comdat any
|
||||
; NOCOMDAT-NOT: $"_ZZ4funcvE10static_var${{[01-9a-f]+}}" = comdat any
|
||||
; NOCOMDAT-NOT: $".str${{[01-9a-f]+}}" = comdat any
|
||||
; NOCOMDAT-NOT: $_ZZ4funcvE10static_var.{{[01-9a-f]+}} = comdat any
|
||||
; NOCOMDAT-NOT: $.str.{{[01-9a-f]+}} = comdat any
|
||||
|
||||
; COMDAT: @global = global { i32, [60 x i8] } zeroinitializer, comdat, align 32
|
||||
; COMDAT: @dyn_init_global = global { i32, [60 x i8] } zeroinitializer, comdat, align 32
|
||||
; COMDAT: @_ZZ4funcvE10static_var = internal global { i32, [60 x i8] } zeroinitializer, comdat($"_ZZ4funcvE10static_var${{[01-9a-f]+}}"), align 32
|
||||
; COMDAT: @.str = internal constant { [14 x i8], [50 x i8] } { [14 x i8] c"Hello, world!\00", [50 x i8] zeroinitializer }, comdat($".str${{[01-9a-f]+}}"), align 32
|
||||
; COMDAT: @_ZZ4funcvE10static_var = internal global { i32, [60 x i8] } zeroinitializer, comdat($_ZZ4funcvE10static_var.{{[01-9a-f]+}}), align 32
|
||||
; COMDAT: @.str = internal constant { [14 x i8], [50 x i8] } { [14 x i8] c"Hello, world!\00", [50 x i8] zeroinitializer }, comdat($.str.{{[01-9a-f]+}}), align 32
|
||||
|
||||
; NOCOMDAT: @global = global { i32, [60 x i8] } zeroinitializer, align 32
|
||||
; NOCOMDAT: @dyn_init_global = global { i32, [60 x i8] } zeroinitializer, align 32
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
; NOENABLESPLITFLAG-DAG: typeidCompatibleVTable: (name: "_ZTS1B", summary: ((offset: 16, [[B]])))
|
||||
; NOENABLESPLITFLAG-DAG: typeidCompatibleVTable: (name: "_ZTS1C", summary: ((offset: 16, [[C]])))
|
||||
; Type Id on _ZTV1D should have been promoted
|
||||
; NOENABLESPLITFLAG-DAG: typeidCompatibleVTable: (name: "1${{.*}}", summary: ((offset: 16, [[D]])))
|
||||
; NOENABLESPLITFLAG-DAG: typeidCompatibleVTable: (name: "1.{{.*}}", summary: ((offset: 16, [[D]])))
|
||||
|
||||
; Legacy PM, Index based WPD
|
||||
; RUN: llvm-lto2 run %t2.o -save-temps -pass-remarks=. \
|
||||
|
|
|
@ -190,12 +190,12 @@
|
|||
; RUN: llvm-nm %t5.1 | FileCheck %s --check-prefix=NM-HYBRID1
|
||||
; RUN: llvm-nm %t5.2 | FileCheck %s --check-prefix=NM-HYBRID2
|
||||
|
||||
; NM-HYBRID1-DAG: U _ZN1A1nEi$
|
||||
; NM-HYBRID1-DAG: U _ZN1E1mEi$
|
||||
; NM-HYBRID1-DAG: U _ZN1A1nEi.{{[0-9a-f]*}}
|
||||
; NM-HYBRID1-DAG: U _ZN1E1mEi.{{[0-9a-f]*}}
|
||||
; NM-HYBRID1-DAG: U _ZN1D1mEi
|
||||
|
||||
; NM-HYBRID2-DAG: T _ZN1A1nEi$
|
||||
; NM-HYBRID2-DAG: T _ZN1E1mEi$
|
||||
; NM-HYBRID2-DAG: T _ZN1A1nEi.{{[0-9a-f]*}}
|
||||
; NM-HYBRID2-DAG: T _ZN1E1mEi.{{[0-9a-f]*}}
|
||||
; NM-HYBRID2-DAG: W _ZN1D1mEi
|
||||
; NM-HYBRID2-DAG: T _ZN1B1fEi
|
||||
; NM-HYBRID2-DAG: T _ZN1C1fEi
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
; M0: define void @f()
|
||||
; M1-NOT: @f()
|
||||
define void @f() {
|
||||
; M0: llvm.type.test{{.*}}metadata !"1$f50b51a12bb012bebbeff978335e34cf"
|
||||
; M0: llvm.type.test{{.*}}metadata !"1.f50b51a12bb012bebbeff978335e34cf"
|
||||
%p = call i1 @llvm.type.test(i8* null, metadata !0)
|
||||
; M0: llvm.type.checked.load{{.*}}metadata !"2$f50b51a12bb012bebbeff978335e34cf"
|
||||
; M0: llvm.type.checked.load{{.*}}metadata !"2.f50b51a12bb012bebbeff978335e34cf"
|
||||
%q = call {i8*, i1} @llvm.type.checked.load(i8* null, i32 0, metadata !3)
|
||||
ret void
|
||||
}
|
||||
|
@ -30,11 +30,11 @@ declare i1 @llvm.type.test(i8*, metadata)
|
|||
declare {i8*, i1} @llvm.type.checked.load(i8*, i32, metadata)
|
||||
|
||||
!0 = distinct !{}
|
||||
; M1: !0 = !{i32 0, !"1$f50b51a12bb012bebbeff978335e34cf"}
|
||||
; M1: !0 = !{i32 0, !"1.f50b51a12bb012bebbeff978335e34cf"}
|
||||
!1 = !{i32 0, !0}
|
||||
; M1: !1 = !{i32 1, !"1$f50b51a12bb012bebbeff978335e34cf"}
|
||||
; M1: !1 = !{i32 1, !"1.f50b51a12bb012bebbeff978335e34cf"}
|
||||
!2 = !{i32 1, !0}
|
||||
|
||||
!3 = distinct !{}
|
||||
; M1: !2 = !{i32 0, !"2$f50b51a12bb012bebbeff978335e34cf"}
|
||||
; M1: !2 = !{i32 0, !"2.f50b51a12bb012bebbeff978335e34cf"}
|
||||
!4 = !{i32 0, !3}
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
; BCA0: <GLOBALVAL_SUMMARY_BLOCK
|
||||
; BCA1-NOT: <GLOBALVAL_SUMMARY_BLOCK
|
||||
|
||||
; M0: @"g$581d7631532fa146ba4061179da39272" = external hidden global i8{{$}}
|
||||
; M1: @"g$581d7631532fa146ba4061179da39272" = hidden global i8 42, !type !0
|
||||
; M0: @g.581d7631532fa146ba4061179da39272 = external hidden global i8{{$}}
|
||||
; M1: @g.581d7631532fa146ba4061179da39272 = hidden global i8 42, !type !0
|
||||
@g = internal global i8 42, !type !0
|
||||
|
||||
; M0: define i8* @f()
|
||||
; M1-NOT: @f()
|
||||
define i8* @f() {
|
||||
; M0: ret i8* @"g$581d7631532fa146ba4061179da39272"
|
||||
; M0: ret i8* @g.581d7631532fa146ba4061179da39272
|
||||
ret i8* @g
|
||||
}
|
||||
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
; BCA1-NOT: <GLOBALVAL_SUMMARY_BLOCK
|
||||
|
||||
; M0: @g = external global void ()*{{$}}
|
||||
; M1: @g = global void ()* @"f$13757e0fb71915e385efa4dc9d1e08fd", !type !0
|
||||
; M1: @g = global void ()* @f.13757e0fb71915e385efa4dc9d1e08fd, !type !0
|
||||
@g = global void ()* @f, !type !0
|
||||
|
||||
; M0: define hidden void @"f$13757e0fb71915e385efa4dc9d1e08fd"()
|
||||
; M1: declare hidden void @"f$13757e0fb71915e385efa4dc9d1e08fd"()
|
||||
; M0: define hidden void @f.13757e0fb71915e385efa4dc9d1e08fd()
|
||||
; M1: declare hidden void @f.13757e0fb71915e385efa4dc9d1e08fd()
|
||||
define internal void @f() {
|
||||
call void @f2()
|
||||
ret void
|
||||
|
|
|
@ -6,14 +6,14 @@ define [1 x i8*]* @source() {
|
|||
ret [1 x i8*]* @g
|
||||
}
|
||||
|
||||
; M0: @"g$84f59439b469192440047efc8de357fb" = external hidden constant [1 x i8*]{{$}}
|
||||
; M1: @"g$84f59439b469192440047efc8de357fb" = hidden constant [1 x i8*] [i8* bitcast (i64 (i8*)* @"ok$84f59439b469192440047efc8de357fb" to i8*)]
|
||||
; M0: @g.84f59439b469192440047efc8de357fb = external hidden constant [1 x i8*]{{$}}
|
||||
; M1: @g.84f59439b469192440047efc8de357fb = hidden constant [1 x i8*] [i8* bitcast (i64 (i8*)* @ok.84f59439b469192440047efc8de357fb to i8*)]
|
||||
@g = internal constant [1 x i8*] [
|
||||
i8* bitcast (i64 (i8*)* @ok to i8*)
|
||||
], !type !0
|
||||
|
||||
; M0: define hidden i64 @"ok$84f59439b469192440047efc8de357fb"
|
||||
; M1: define available_externally hidden i64 @"ok$84f59439b469192440047efc8de357fb"
|
||||
; M0: define hidden i64 @ok.84f59439b469192440047efc8de357fb
|
||||
; M1: define available_externally hidden i64 @ok.84f59439b469192440047efc8de357fb
|
||||
define internal i64 @ok(i8* %this) {
|
||||
ret i64 42
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
; SUMMARY-NEXT: WPDRes:
|
||||
; SUMMARY-NEXT: 0:
|
||||
; SUMMARY-NEXT: Kind: SingleImpl
|
||||
; SUMMARY-NEXT: SingleImplName: 'vf3$merged'
|
||||
; SUMMARY-NEXT: SingleImplName: vf3.llvm.merged
|
||||
; SUMMARY-NEXT: ResByArg:
|
||||
; SUMMARY-NEXT: typeid1:
|
||||
; SUMMARY-NEXT: TTRes:
|
||||
|
@ -52,12 +52,12 @@
|
|||
; SUMMARY-NEXT: WPDRes:
|
||||
; SUMMARY-NEXT: 0:
|
||||
; SUMMARY-NEXT: Kind: SingleImpl
|
||||
; SUMMARY-NEXT: SingleImplName: 'vf4$merged'
|
||||
; SUMMARY-NEXT: SingleImplName: vf4.llvm.merged
|
||||
; SUMMARY-NEXT: ResByArg:
|
||||
; SUMMARY-NEXT: WithGlobalValueDeadStripping: false
|
||||
; SUMMARY-NEXT: ...
|
||||
|
||||
; CHECK: $"vf4$merged" = comdat largest
|
||||
; CHECK: $vf4.llvm.merged = comdat largest
|
||||
$vf4 = comdat largest
|
||||
|
||||
; CHECK: @vt1 = constant void (i8*)* @vf1
|
||||
|
@ -68,7 +68,7 @@ $vf4 = comdat largest
|
|||
|
||||
@vt3 = constant void (i8*)* @vf3, !type !2
|
||||
|
||||
; CHECK: @vt4 = constant void (i8*)* @"vf4$merged", comdat($"vf4$merged")
|
||||
; CHECK: @vt4 = constant void (i8*)* @vf4.llvm.merged, comdat($vf4.llvm.merged)
|
||||
@vt4 = constant void (i8*)* @vf4, comdat($vf4), !type !3
|
||||
|
||||
@vt5 = constant void (i8*)* @vf5, !type !4
|
||||
|
@ -81,12 +81,12 @@ define void @vf2(i8*) {
|
|||
ret void
|
||||
}
|
||||
|
||||
; CHECK: define hidden void @"vf3$merged"(i8* %0) {
|
||||
; CHECK: define hidden void @vf3.llvm.merged(i8* %0) {
|
||||
define internal void @vf3(i8*) {
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: define hidden void @"vf4$merged"(i8* %0) comdat {
|
||||
; CHECK: define hidden void @vf4.llvm.merged(i8* %0) comdat {
|
||||
define internal void @vf4(i8*) comdat {
|
||||
ret void
|
||||
}
|
||||
|
|
|
@ -325,12 +325,12 @@ static int run(int argc, char **argv) {
|
|||
std::vector<SymbolResolution> Res;
|
||||
for (const InputFile::Symbol &Sym : Input->symbols()) {
|
||||
auto I = CommandLineResolutions.find({F, std::string(Sym.getName())});
|
||||
// If it isn't found, look for "$", which would have been added
|
||||
// If it isn't found, look for ".", which would have been added
|
||||
// (followed by a hash) when the symbol was promoted during module
|
||||
// splitting if it was defined in one part and used in the other.
|
||||
// Try looking up the symbol name before the "$".
|
||||
// Try looking up the symbol name before the suffix.
|
||||
if (I == CommandLineResolutions.end()) {
|
||||
auto SplitName = Sym.getName().rsplit("$");
|
||||
auto SplitName = Sym.getName().rsplit(".");
|
||||
I = CommandLineResolutions.find({F, std::string(SplitName.first)});
|
||||
}
|
||||
if (I == CommandLineResolutions.end()) {
|
||||
|
|
Loading…
Reference in New Issue