diff options
author | Alon Zakai <azakai@google.com> | 2019-12-12 19:15:39 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-12 19:15:39 -0800 |
commit | 16c6b44da64630cd6906433cf35edabcea93cffc (patch) | |
tree | f36d41e14f17b64bbfd3f7080cb624565fc11c59 /src/wasm-emscripten.h | |
parent | 89d1cf92be0636a219ee6415eead387241963dcf (diff) | |
download | binaryen-16c6b44da64630cd6906433cf35edabcea93cffc.tar.gz binaryen-16c6b44da64630cd6906433cf35edabcea93cffc.tar.bz2 binaryen-16c6b44da64630cd6906433cf35edabcea93cffc.zip |
Support stack overflow checks in standalone mode (#2525)
In normal mode we call a JS import, but we can't import from JS
in standalone mode. Instead, just trap in that case with an
unreachable. (The error reporting is not as good in this case, but
at least it catches all errors and halts, and the emitted wasm is
valid for standalone mode.)
Helps emscripten-core/emscripten#10019
Diffstat (limited to 'src/wasm-emscripten.h')
-rw-r--r-- | src/wasm-emscripten.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wasm-emscripten.h b/src/wasm-emscripten.h index 8aa911ef9..c7689b4bc 100644 --- a/src/wasm-emscripten.h +++ b/src/wasm-emscripten.h @@ -31,6 +31,8 @@ public: : wasm(wasm), builder(wasm), stackPointerOffset(stackPointerOffset), useStackPointerGlobal(stackPointerOffset == 0) {} + void setStandalone(bool standalone_) { standalone = standalone_; } + void generateRuntimeFunctions(); Function* generateMemoryGrowthFunction(); Function* generateAssignGOTEntriesFunction(); @@ -69,6 +71,7 @@ private: Builder builder; Address stackPointerOffset; bool useStackPointerGlobal; + bool standalone; // Used by generateDynCallThunk to track all the dynCall functions created // so far. std::unordered_set<Signature> sigs; |