Attempt to make FreeBSD buildbot green.
It seems that __cxa_demangle function on the buildbot tried to demangle
a variable "tlsvar" as a C++ symbol. Do not call that function unless
it does not start with "_Z" which is the prefix of mangled names.
llvm-svn: 257661
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index f7ef342..1c5cae1 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -145,6 +145,11 @@
#else
if (!Config->Demangle)
return Name;
+
+ // Return if it does not look like a C++ symbol.
+ if (!Name.startswith("_Z"))
+ return Name;
+
char *Buf =
abi::__cxa_demangle(Name.str().c_str(), nullptr, nullptr, nullptr);
if (!Buf)