diff --git a/llvm/test/tools/llvm-objdump/X86/demangle.s b/llvm/test/tools/llvm-objdump/X86/demangle.s --- a/llvm/test/tools/llvm-objdump/X86/demangle.s +++ b/llvm/test/tools/llvm-objdump/X86/demangle.s @@ -11,7 +11,7 @@ ## Check the case when relocations are inlined into disassembly. # RUN: llvm-objdump -d -r --demangle %t | FileCheck %s --check-prefix=INLINE # INLINE: : -# INLINE-NEXT: 0: {{.*}} callq 0x5 <_Z3foov+0x5> +# INLINE-NEXT: 0: {{.*}} callq 0x5 # INLINE-NEXT: 0000000000000001: R_X86_64_PLT32 foo()-0x4 .text diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -1556,7 +1556,10 @@ if (TargetSym != TargetSectionSymbols->begin()) { --TargetSym; uint64_t TargetAddress = TargetSym->Addr; - StringRef TargetName = TargetSym->Name; + std::string TargetName = TargetSym->Name.str(); + if (Demangle) + TargetName = demangle(TargetName); + outs() << " <" << TargetName; uint64_t Disp = Target - TargetAddress; if (Disp)