authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-22 15:11:34-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-22 15:11:34-07:00
logecdd4a9fe805c9b5b76cbb883b806ceb61aaddfe
tree1e9d02289a497118943df75d633face272e8a552
parentc955379504d4866f9c474c50317b2a0da18ee631

build system: add flag for -fstack-protector


1 files changed, 8 insertions(+), 0 deletions(-)

lib/std/build.zig+8
......@@ -1495,6 +1495,7 @@ pub const LibExeObjStep = struct {
14951495 emit_h: bool = false,
14961496 bundle_compiler_rt: ?bool = null,
14971497 single_threaded: ?bool = null,
1498 stack_protector: ?bool = null,
14981499 disable_stack_probing: bool,
14991500 disable_sanitize_c: bool,
15001501 sanitize_thread: bool,
......@@ -2825,6 +2826,13 @@ pub const LibExeObjStep = struct {
28252826 if (self.disable_stack_probing) {
28262827 try zig_args.append("-fno-stack-check");
28272828 }
2829 if (self.stack_protector) |stack_protector| {
2830 if (stack_protector) {
2831 try zig_args.append("-fstack-protector");
2832 } else {
2833 try zig_args.append("-fno-stack-protector");
2834 }
2835 }
28282836 if (self.red_zone) |red_zone| {
28292837 if (red_zone) {
28302838 try zig_args.append("-mred-zone");