Commit 24b6dcc507

Andrew Kelley <superjoe30@gmail.com>
2017-09-18 21:30:07
std.build: explicitly disable stack protector when nostdlib
1 parent 8cb6694
Changed files (1)
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");
             },
         }