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 {...@@ -1495,6 +1495,7 @@ pub const LibExeObjStep = struct {
1495 emit_h: bool = false,1495 emit_h: bool = false,
1496 bundle_compiler_rt: ?bool = null,1496 bundle_compiler_rt: ?bool = null,
1497 single_threaded: ?bool = null,1497 single_threaded: ?bool = null,
1498 stack_protector: ?bool = null,
1498 disable_stack_probing: bool,1499 disable_stack_probing: bool,
1499 disable_sanitize_c: bool,1500 disable_sanitize_c: bool,
1500 sanitize_thread: bool,1501 sanitize_thread: bool,
...@@ -2825,6 +2826,13 @@ pub const LibExeObjStep = struct {...@@ -2825,6 +2826,13 @@ pub const LibExeObjStep = struct {
2825 if (self.disable_stack_probing) {2826 if (self.disable_stack_probing) {
2826 try zig_args.append("-fno-stack-check");2827 try zig_args.append("-fno-stack-check");
2827 }2828 }
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 }
2828 if (self.red_zone) |red_zone| {2836 if (self.red_zone) |red_zone| {
2829 if (red_zone) {2837 if (red_zone) {
2830 try zig_args.append("-mred-zone");2838 try zig_args.append("-mred-zone");