summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2016-04-06 14:38:03 -0700
committerDerek Schuff <dschuff@chromium.org>2016-04-06 14:38:03 -0700
commit0d1a66c540a2c89e1d4543fe318976ad1c6411f1 (patch)
tree5a6a43f3adc6a965de0c01fb78dd717a312cc907 /src
parent62c07b549d14dfb974f73554026f0b9fff365968 (diff)
downloadbinaryen-0d1a66c540a2c89e1d4543fe318976ad1c6411f1.tar.gz
binaryen-0d1a66c540a2c89e1d4543fe318976ad1c6411f1.tar.bz2
binaryen-0d1a66c540a2c89e1d4543fe318976ad1c6411f1.zip
Allocate __dso_handle in s2wasm
Unlike asm.js modules, wasm modules cannot have imported/extern objects. So allocate __dso_handle (which is traditionally defined in a crtbegin or similar toolchain file linked with the user code) in s2wasm.
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.