summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-emscripten.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/wasm/wasm-emscripten.cpp b/src/wasm/wasm-emscripten.cpp
index 33a92a6c4..ed2f0f430 100644
--- a/src/wasm/wasm-emscripten.cpp
+++ b/src/wasm/wasm-emscripten.cpp
@@ -55,15 +55,16 @@ bool isExported(Module& wasm, Name name) {
Global* getStackPointerGlobal(Module& wasm) {
// Assumption: The stack pointer is either imported as __stack_pointer or
- // its the first non-imported and non-exported global.
+ // we just assume it's the first non-imported global.
// TODO(sbc): Find a better way to discover the stack pointer. Perhaps the
// linker could export it by name?
for (auto& g : wasm.globals) {
- if (g->imported()) {
- if (g->base == STACK_POINTER) {
- return g.get();
- }
- } else if (!isExported(wasm, g->name)) {
+ if (g->imported() && g->base == STACK_POINTER) {
+ return g.get();
+ }
+ }
+ for (auto& g : wasm.globals) {
+ if (!g->imported()) {
return g.get();
}
}