summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/s2wasm.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h
index 19b3db79d..c85a214a1 100644
--- a/src/s2wasm.h
+++ b/src/s2wasm.h
@@ -78,6 +78,11 @@ class S2WasmBuilder {
// Place the stack pointer at the bottom of the linear memory, to keep its
// address small (and thus with a small encoding).
placeStackPointer(stackAllocation);
+ // Allocate __dso_handle. For asm.js, emscripten provides this in JS, but
+ // wasm modules can't import data objects. Its value is 0 for the main
+ // executable, which is all we have with static linking. In the future this
+ // can go in a crtbegin or similar file.
+ allocateStatic(4, 4, "__dso_handle");
process();
// Place the stack after the user's static data, to keep those addresses
// small.