diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp --- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -665,6 +665,15 @@ return Result; } + if (Name.size() >= 2 && Name[0] == '_' && Name[1] == 'R') { + char *DemangledName = rustDemangle(Name.c_str(), nullptr, nullptr, nullptr); + if (DemangledName == nullptr) + return Name; + std::string Result = DemangledName; + free(DemangledName); + return Result; + } + if (!Name.empty() && Name.front() == '?') { // Only do MSVC C++ demangling on symbols starting with '?'. int status = 0; diff --git a/llvm/test/DebugInfo/symbolize-demangling.s b/llvm/test/DebugInfo/symbolize-demangling.s --- a/llvm/test/DebugInfo/symbolize-demangling.s +++ b/llvm/test/DebugInfo/symbolize-demangling.s @@ -2,23 +2,29 @@ # RUN: llvm-mc --filetype=obj --triple=x86_64-pc-linux %s -o %t.o -g -# RUN: llvm-symbolizer --obj=%t.o 0 1 2 | FileCheck %s +# RUN: llvm-symbolizer --obj=%t.o 0 1 2 3 | FileCheck %s # CHECK: f() -# CHECK-NEXT: symbolize-demangling.s:20 +# CHECK-NEXT: symbolize-demangling.s:24 # CHECK-EMPTY: # CHECK-NEXT: {{^g$}} -# CHECK-NEXT: symbolize-demangling.s:22 +# CHECK-NEXT: symbolize-demangling.s:26 # CHECK-EMPTY: # CHECK-NEXT: {{^baz$}} -# CHECK-NEXT: symbolize-demangling.s:24 +# CHECK-NEXT: symbolize-demangling.s:28 +# CHECK-EMPTY: +# CHECK-NEXT: {{^x::y$}} +# CHECK-NEXT: symbolize-demangling.s:30 .type _Z1fv,@function .type g,@function .type baz,@function +.type _RNvC1x1y,@function _Z1fv: nop g: nop baz: nop +_RNvC1x1y: + nop