build system: add flag for -fstack-protector

This commit is contained in:
Andrew Kelley 2022-08-22 15:11:34 -07:00
parent c955379504
commit ecdd4a9fe8

View File

@ -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");