mirror of https://github.com/google/oss-fuzz.git
52 lines
1.7 KiB
Diff
52 lines
1.7 KiB
Diff
diff --git a/llvm/lib/DebugInfo/Symbolize/CMakeLists.txt b/llvm/lib/DebugInfo/Symbolize/CMakeLists.txt
|
|
index acfb3bd0e..5c4cf9763 100644
|
|
--- a/llvm/lib/DebugInfo/Symbolize/CMakeLists.txt
|
|
+++ b/llvm/lib/DebugInfo/Symbolize/CMakeLists.txt
|
|
@@ -12,4 +12,12 @@ add_llvm_component_library(LLVMSymbolize
|
|
Object
|
|
Support
|
|
Demangle
|
|
- )
|
|
+
|
|
+ LINK_LIBS
|
|
+ /usr/lib/swift_static/linux/libswiftCore.a
|
|
+ /usr/lib/swift_static/linux/libswiftImageInspectionShared.a
|
|
+ /usr/lib/swift_static/linux/libicui18nswift.a
|
|
+ /usr/lib/swift_static/linux/libicuucswift.a
|
|
+ /usr/lib/swift_static/linux/libicudataswift.a
|
|
+ /usr/lib/x86_64-linux-gnu/libstdc++.so.6
|
|
+)
|
|
diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
|
|
index 4c3f3a3767e1..aa7b9f0f5abb 100644
|
|
--- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
|
|
+++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
|
|
@@ -36,6 +36,13 @@
|
|
#include <cassert>
|
|
#include <cstring>
|
|
|
|
+
|
|
+extern "C" char *swift_demangle(const char *mangledName,
|
|
+ size_t mangledNameLength,
|
|
+ char *outputBuffer,
|
|
+ size_t *outputBufferSize,
|
|
+ uint32_t flags);
|
|
+
|
|
namespace llvm {
|
|
namespace symbolize {
|
|
|
|
@@ -632,6 +639,14 @@ LLVMSymbolizer::DemangleName(const std::string &Name,
|
|
free(DemangledName);
|
|
return Result;
|
|
}
|
|
+ if (!Name.empty() && Name.front() == '$') {
|
|
+ char *DemangledName = swift_demangle(Name.c_str(), Name.length(), 0, 0, 0);
|
|
+ if (DemangledName) {
|
|
+ std::string Result = DemangledName;
|
|
+ free(DemangledName);
|
|
+ return Result;
|
|
+ }
|
|
+ }
|
|
|
|
if (DbiModuleDescriptor && DbiModuleDescriptor->isWin32Module())
|
|
return std::string(demanglePE32ExternCFunc(Name));
|