From cde7c756767348e4c96770327b490f824f2a8e60 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Thu, 4 Jun 2020 06:56:08 +0200 Subject: [PATCH] Increase default Wasm stack to 1MB This commit increases the default Wasm stack to 1MB from the default of 1 Wasm page which equal 64KB. This seems like a reasonable default size while at the same time not overly large. Also, Rust lang seems to be favouring this default as well: [rust-lang#50083]. [rust-lang#50083]: https://github.com/rust-lang/rust/pull/50083 --- src/link.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/link.cpp b/src/link.cpp index 546c5cabc..72997b415 100644 --- a/src/link.cpp +++ b/src/link.cpp @@ -2100,6 +2100,10 @@ static void construct_linker_job_wasm(LinkJob *lj) { CodeGen *g = lj->codegen; lj->args.append("-error-limit=0"); + // Increase the default stack size to a more reasonable value of 1MB instead of + // the default of 1 Wasm page being 64KB. + lj->args.append("-z"); + lj->args.append("stack-size=1048576"); if (g->out_type != OutTypeExe) { lj->args.append("--no-entry"); // So lld doesn't look for _start.