summaryrefslogtreecommitdiffstats
path: root/lld/wasm/Writer.cpp
diff options
context:
space:
mode:
authorNicholas Wilson <nicholas@nicholaswilson.me.uk>2018-04-20 17:09:18 +0000
committerNicholas Wilson <nicholas@nicholaswilson.me.uk>2018-04-20 17:09:18 +0000
commit6c7fe30a1c9012d9881d0fe2faaf6fdfbf956359 (patch)
tree04bd393dc24403e82177a23ccaf6660afa950573 /lld/wasm/Writer.cpp
parentef90ff36daa5f244357e29dd28e7d5092d01be76 (diff)
downloadbcm5719-llvm-6c7fe30a1c9012d9881d0fe2faaf6fdfbf956359.tar.gz
bcm5719-llvm-6c7fe30a1c9012d9881d0fe2faaf6fdfbf956359.zip
[WebAssembly] Implement --print-gc-sections for synthetic functions
Enables cleaning up confusion between which name variables are mangled and which are unmangled, and --print-gc-sections then excersises and tests that. Differential Revision: https://reviews.llvm.org/D44440 llvm-svn: 330449
Diffstat (limited to 'lld/wasm/Writer.cpp')
-rw-r--r--lld/wasm/Writer.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp
index 18d5d4a8d52..4a52b526ae3 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -534,7 +534,7 @@ void Writer::createLinkingSection() {
void Writer::createNameSection() {
unsigned NumNames = NumImportedFunctions;
for (const InputFunction *F : InputFunctions)
- if (!F->getName().empty())
+ if (!F->getName().empty() || !F->getDebugName().empty())
++NumNames;
if (NumNames == 0)
@@ -558,8 +558,12 @@ void Writer::createNameSection() {
for (const InputFunction *F : InputFunctions) {
if (!F->getName().empty()) {
writeUleb128(Sub.OS, F->getFunctionIndex(), "func index");
- Optional<std::string> Name = demangleItanium(F->getName());
- writeStr(Sub.OS, Name ? StringRef(*Name) : F->getName(), "symbol name");
+ if (!F->getDebugName().empty()) {
+ writeStr(Sub.OS, F->getDebugName(), "symbol name");
+ } else {
+ Optional<std::string> Name = demangleItanium(F->getName());
+ writeStr(Sub.OS, Name ? StringRef(*Name) : F->getName(), "symbol name");
+ }
}
}
OpenPOWER on IntegriCloud