We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fb9d552 commit bf273b7Copy full SHA for bf273b7
src/link.cpp
@@ -2107,6 +2107,10 @@ static void construct_linker_job_wasm(LinkJob *lj) {
2107
lj->args.append("-z");
2108
lj->args.append(buf_ptr(buf_sprintf("stack-size=%" ZIG_PRI_usize, stack_size)));
2109
2110
+ // put stack before globals so that stack overflow results in segfault immediately before corrupting globals
2111
+ // see https://github.com/ziglang/zig/issues/4496
2112
+ lj->args.append("--stack-first");
2113
+
2114
if (g->out_type != OutTypeExe) {
2115
lj->args.append("--no-entry"); // So lld doesn't look for _start.
2116
0 commit comments