diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2020-06-05 22:21:33 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-06-08 17:44:06 -0400 |
| commit | 0ff5d7b24e2017199566d1bab75254fa5ef68611 (patch) | |
| tree | 0c44d8f84b155eedef9e7cbfba47c0834d700a84 /src/link.cpp | |
| parent | cde7c756767348e4c96770327b490f824f2a8e60 (diff) | |
| download | zig-0ff5d7b24e2017199566d1bab75254fa5ef68611.tar.gz zig-0ff5d7b24e2017199566d1bab75254fa5ef68611.zip | |
Add option for overriding the stack size
This commit adds a `--stack [size]` link-time option to zig compiler
allowing the user to override the default stack size set for the
specified executable/library format. This is currently limited to
ELF, COFF and Wasm however (i.e., Mach-O is excluded).
Diffstat (limited to 'src/link.cpp')
| -rw-r--r-- | src/link.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/link.cpp b/src/link.cpp index 72997b4156..0f27cee9ab 100644 --- a/src/link.cpp +++ b/src/link.cpp @@ -2101,9 +2101,10 @@ static void construct_linker_job_wasm(LinkJob *lj) { 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. + // the default of 1 Wasm page being 64KB, unless overriden by the user. + size_t stack_size = (g->stack_size_override == 0) ? 1048576 : g->stack_size_override; lj->args.append("-z"); - lj->args.append("stack-size=1048576"); + lj->args.append(buf_ptr(buf_sprintf("stack-size=%" ZIG_PRI_usize, stack_size))); if (g->out_type != OutTypeExe) { lj->args.append("--no-entry"); // So lld doesn't look for _start. |
