summaryrefslogtreecommitdiffstats
path: root/lld/wasm/MarkLive.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-06-21 15:00:00 +0000
committerSam Clegg <sbc@chromium.org>2018-06-21 15:00:00 +0000
commit084d360f6984df29d0ea2bdf8fea1f1d97de2858 (patch)
treeb61af3e558b59923a0fe44a9713fa996b4ea1a09 /lld/wasm/MarkLive.cpp
parent3e5c051a06d42df95fdf76d96a01e5c09fa05a6c (diff)
downloadbcm5719-llvm-084d360f6984df29d0ea2bdf8fea1f1d97de2858.tar.gz
bcm5719-llvm-084d360f6984df29d0ea2bdf8fea1f1d97de2858.zip
[WebAssembly] Only mark non-hidden symbols as live if they are also defined
Previously we were also marking undefined symbols (i.e. imports) as live. Differential Revision: https://reviews.llvm.org/D48299 llvm-svn: 335243
Diffstat (limited to 'lld/wasm/MarkLive.cpp')
-rw-r--r--lld/wasm/MarkLive.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lld/wasm/MarkLive.cpp b/lld/wasm/MarkLive.cpp
index 6b90690cca5..c9dbbf59c95 100644
--- a/lld/wasm/MarkLive.cpp
+++ b/lld/wasm/MarkLive.cpp
@@ -40,6 +40,7 @@ void lld::wasm::markLive() {
auto Enqueue = [&](Symbol *Sym) {
if (!Sym || Sym->isLive())
return;
+ LLVM_DEBUG(dbgs() << "markLive: " << Sym->getName() << "\n");
Sym->markLive();
if (Sym->SignatureMismatch)
error("function signature mismatch: " + Sym->getName());
@@ -52,9 +53,9 @@ void lld::wasm::markLive() {
Enqueue(Symtab->find(Config->Entry));
Enqueue(WasmSym::CallCtors);
- // By default we export all non-hidden, so they are gc roots too
+ // We export all defined, non-hidden symbols so they are all gc roots too
for (Symbol *Sym : Symtab->getSymbols())
- if (!Sym->isHidden())
+ if (Sym->isDefined() && !Sym->isHidden())
Enqueue(Sym);
// The ctor functions are all used in the synthetic __wasm_call_ctors
OpenPOWER on IntegriCloud