[WebAssembly] Remove special handling of entry point export.
Its much easier to export it via setHidden(false), now that
that is a thing.
As a side effect the start function is not longer always exports first
(becuase its being exported just like all the other function).
Differential Revision: https://reviews.llvm.org/D42321
llvm-svn: 323025
diff --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp
index 745c4b0..6471cc8 100644
--- a/lld/wasm/SymbolTable.cpp
+++ b/lld/wasm/SymbolTable.cpp
@@ -131,6 +131,9 @@
S->setFunctionType(Type);
} else if (!S->isFunction()) {
error("symbol type mismatch: " + Name);
+ } else if (!S->isDefined()) {
+ DEBUG(dbgs() << "resolving existing undefined function: " << Name << "\n");
+ S->update(Symbol::DefinedFunctionKind, nullptr, Flags);
}
return S;
}
@@ -140,10 +143,14 @@
Symbol *S;
bool WasInserted;
std::tie(S, WasInserted) = insert(Name);
- if (WasInserted)
+ if (WasInserted) {
S->update(Symbol::DefinedGlobalKind);
- else if (!S->isGlobal())
+ } else if (!S->isGlobal()) {
error("symbol type mismatch: " + Name);
+ } else {
+ DEBUG(dbgs() << "resolving existing undefined global: " << Name << "\n");
+ S->update(Symbol::DefinedGlobalKind);
+ }
return S;
}