diff options
author | Derek Schuff <dschuff@chromium.org> | 2016-02-04 15:04:02 -0800 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2016-02-04 15:04:02 -0800 |
commit | 9b12bb3742534c25b8c2e5906ca663b66b4be766 (patch) | |
tree | 2990a37607887d0a681c7795ad145c8e68ea2a94 /src/s2wasm-main.cpp | |
parent | 3b89982be258921b120dfb2e951533b3e87b70e1 (diff) | |
parent | c081e08014473a66f7e1a496fdeb3477c1325d7f (diff) | |
download | binaryen-9b12bb3742534c25b8c2e5906ca663b66b4be766.tar.gz binaryen-9b12bb3742534c25b8c2e5906ca663b66b4be766.tar.bz2 binaryen-9b12bb3742534c25b8c2e5906ca663b66b4be766.zip |
Merge pull request #179 from WebAssembly/allocate_stack
Allocate space for user stack at link time
Diffstat (limited to 'src/s2wasm-main.cpp')
-rw-r--r-- | src/s2wasm-main.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/s2wasm-main.cpp b/src/s2wasm-main.cpp index c3f3d0a2f..e75147b75 100644 --- a/src/s2wasm-main.cpp +++ b/src/s2wasm-main.cpp @@ -46,6 +46,11 @@ int main(int argc, const char *argv[]) { [](Options *o, const std::string &argument) { o->extra["global-base"] = argument; }) + .add("--allocate-stack", "-s", "Size of the user stack in linear memory", + Options::Arguments::One, + [](Options *o, const std::string &argument) { + o->extra["stack-allocation"] = argument; + }) .add_positional("INFILE", Options::Arguments::One, [](Options *o, const std::string &argument) { o->extra["infile"] = argument; @@ -59,9 +64,13 @@ int main(int argc, const char *argv[]) { size_t globalBase = options.extra.find("global-base") != options.extra.end() ? std::stoull(options.extra["global-base"]) : 1; + size_t stackAllocation = + options.extra.find("stack-allocation") != options.extra.end() + ? std::stoull(options.extra["stack-allocation"]) + : 0; if (options.debug) std::cerr << "Global base " << globalBase << '\n'; S2WasmBuilder s2wasm(wasm, input.c_str(), options.debug, globalBase, - ignoreUnknownSymbols); + stackAllocation, ignoreUnknownSymbols); if (options.debug) std::cerr << "Emscripten gluing..." << std::endl; std::stringstream meta; |