aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-08-22 15:11:34 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-08-22 15:11:34 -0700
commitecdd4a9fe805c9b5b76cbb883b806ceb61aaddfe (patch)
tree1e9d02289a497118943df75d633face272e8a552 /lib/std
parentc955379504d4866f9c474c50317b2a0da18ee631 (diff)
downloadzig-ecdd4a9fe805c9b5b76cbb883b806ceb61aaddfe.tar.gz
zig-ecdd4a9fe805c9b5b76cbb883b806ceb61aaddfe.zip
build system: add flag for -fstack-protector
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/build.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/std/build.zig b/lib/std/build.zig
index b47f962a9d..4c05586159 100644
--- a/lib/std/build.zig
+++ b/lib/std/build.zig
@@ -1495,6 +1495,7 @@ pub const LibExeObjStep = struct {
emit_h: bool = false,
bundle_compiler_rt: ?bool = null,
single_threaded: ?bool = null,
+ stack_protector: ?bool = null,
disable_stack_probing: bool,
disable_sanitize_c: bool,
sanitize_thread: bool,
@@ -2825,6 +2826,13 @@ pub const LibExeObjStep = struct {
if (self.disable_stack_probing) {
try zig_args.append("-fno-stack-check");
}
+ if (self.stack_protector) |stack_protector| {
+ if (stack_protector) {
+ try zig_args.append("-fstack-protector");
+ } else {
+ try zig_args.append("-fno-stack-protector");
+ }
+ }
if (self.red_zone) |red_zone| {
if (red_zone) {
try zig_args.append("-mred-zone");