aboutsummaryrefslogtreecommitdiff
path: root/std/build.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-09-18 15:30:07 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-09-18 15:30:07 -0400
commit24b6dcc507c6598351ab817e03027cc60f220f19 (patch)
tree3064ca3080dc84a75f9265926c993853d79f3902 /std/build.zig
parent8cb6694752b780035b65b8d8720bac826d0ebea6 (diff)
downloadzig-24b6dcc507c6598351ab817e03027cc60f220f19.tar.gz
zig-24b6dcc507c6598351ab817e03027cc60f220f19.zip
std.build: explicitly disable stack protector when nostdlib
Diffstat (limited to 'std/build.zig')
-rw-r--r--std/build.zig9
1 files changed, 7 insertions, 2 deletions
diff --git a/std/build.zig b/std/build.zig
index a18bf4756c..a241064a84 100644
--- a/std/build.zig
+++ b/std/build.zig
@@ -1167,7 +1167,9 @@ pub const LibExeObjStep = struct {
}
switch (self.build_mode) {
builtin.Mode.Debug => {
- if (!self.disable_libc) {
+ if (self.disable_libc) {
+ %%args.append("-fno-stack-protector");
+ } else {
%%args.append("-fstack-protector-strong");
%%args.append("--param");
%%args.append("ssp-buffer-size=4");
@@ -1175,7 +1177,9 @@ pub const LibExeObjStep = struct {
},
builtin.Mode.ReleaseSafe => {
%%args.append("-O2");
- if (!self.disable_libc) {
+ if (self.disable_libc) {
+ %%args.append("-fno-stack-protector");
+ } else {
%%args.append("-D_FORTIFY_SOURCE=2");
%%args.append("-fstack-protector-strong");
%%args.append("--param");
@@ -1184,6 +1188,7 @@ pub const LibExeObjStep = struct {
},
builtin.Mode.ReleaseFast => {
%%args.append("-O2");
+ %%args.append("-fno-stack-protector");
},
}