[PATCH] D41390: Wasm LLD: Don't write out discarded function symbols
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 19 10:34:04 PST 2017
sbc100 added a comment.
Cool. Didn't expect that to be so simple :)
I'll submit the cosmetic changes separately.
================
Comment at: wasm/InputFiles.cpp:232
+ if (S->getFile() == this)
+ ReachedFunctions[WasmSym.ElementIndex - NumFunctionImports] = true;
break;
----------------
How about just:
```if (S->getFile() != this) {
// This symbol was already defined in another file.
Functions[WasmSym.ElementIndex - NumFunctionImports] = &InputFunction::Discarded;
}```
And can we do the same for globals?
================
Comment at: wasm/InputFunction.cpp:18
+
+InputFunction InputFunction::Discarded(nullptr, nullptr, nullptr);
----------------
Seems a shame to add a new source file just for this.
I've not looked at how the other linker do this, but could we not just have a "Discarded" flag on these objects instead of the these magic statics?
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D41390
More information about the llvm-commits
mailing list