zig build: use stack protector for C code in debug mode

This commit is contained in:
Andrew Kelley 2017-09-17 19:20:48 -04:00
parent c7d80cc421
commit c5ca8b51f9

View File

@ -1343,7 +1343,11 @@ pub const CLibExeObjStep = struct {
%%args.append("-g"); %%args.append("-g");
} }
switch (self.build_mode) { switch (self.build_mode) {
builtin.Mode.Debug => {}, builtin.Mode.Debug => {
%%args.append("-fstack-protector-strong");
%%args.append("--param");
%%args.append("ssp-buffer-size=4");
},
builtin.Mode.ReleaseSafe => { builtin.Mode.ReleaseSafe => {
%%args.append("-O2"); %%args.append("-O2");
%%args.append("-D_FORTIFY_SOURCE=2"); %%args.append("-D_FORTIFY_SOURCE=2");