summaryrefslogtreecommitdiffstats
path: root/lld/wasm/Symbols.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-11-09 16:57:41 +0000
committerSam Clegg <sbc@chromium.org>2018-11-09 16:57:41 +0000
commit37125f080fa59ac0556ea1b4eb43e9841dd02284 (patch)
tree4190ebdb96c9128c26b2749a59789ef865b058d0 /lld/wasm/Symbols.cpp
parent4f2e66c0184baeccf43d08217c70efcd92674311 (diff)
downloadbcm5719-llvm-37125f080fa59ac0556ea1b4eb43e9841dd02284.tar.gz
bcm5719-llvm-37125f080fa59ac0556ea1b4eb43e9841dd02284.zip
[WebAssembly] Respect `--no-mangle` in more locations
`--no-demangle` now also applies to the name section. This change was motivated by the rust team that have a slightly different name mangling scheme to the standard C++ itanium one and prefer to do their de-mangling as a post-link setp. Patch by Alex Crichton! Differential Revision: https://reviews.llvm.org/D54279 llvm-svn: 346516
Diffstat (limited to 'lld/wasm/Symbols.cpp')
-rw-r--r--lld/wasm/Symbols.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lld/wasm/Symbols.cpp b/lld/wasm/Symbols.cpp
index 035c7f2d725..0e60262dcc8 100644
--- a/lld/wasm/Symbols.cpp
+++ b/lld/wasm/Symbols.cpp
@@ -226,10 +226,14 @@ void SectionSymbol::setOutputSectionIndex(uint32_t Index) {
void LazySymbol::fetch() { cast<ArchiveFile>(File)->addMember(&ArchiveSymbol); }
std::string lld::toString(const wasm::Symbol &Sym) {
+ return lld::maybeDemangleSymbol(Sym.getName());
+}
+
+std::string lld::maybeDemangleSymbol(StringRef Name) {
if (Config->Demangle)
- if (Optional<std::string> S = demangleItanium(Sym.getName()))
+ if (Optional<std::string> S = demangleItanium(Name))
return *S;
- return Sym.getName();
+ return Name;
}
std::string lld::toString(wasm::Symbol::Kind Kind) {
OpenPOWER on IntegriCloud