Commit d3648cc030

Andrew Kelley <andrew@ziglang.org>
2022-03-05 02:10:37
zig cc: integrate with -fstack-check, -fno-stack-check
1 parent d486a7b
src/clang_options_data.zig
@@ -3274,7 +3274,14 @@ flagpd1("fno-split-lto-unit"),
 flagpd1("fno-split-machine-functions"),
 flagpd1("fno-split-stack"),
 flagpd1("fno-stack-arrays"),
-flagpd1("fno-stack-check"),
+.{
+    .name = "fno-stack-check",
+    .syntax = .flag,
+    .zig_equivalent = .no_stack_check,
+    .pd1 = true,
+    .pd2 = false,
+    .psl = false,
+},
 flagpd1("fno-stack-clash-protection"),
 flagpd1("fno-stack-protector"),
 flagpd1("fno-stack-size-section"),
@@ -3555,7 +3562,14 @@ flagpd1("fsplit-lto-unit"),
 flagpd1("fsplit-machine-functions"),
 flagpd1("fsplit-stack"),
 flagpd1("fstack-arrays"),
-flagpd1("fstack-check"),
+.{
+    .name = "fstack-check",
+    .syntax = .flag,
+    .zig_equivalent = .stack_check,
+    .pd1 = true,
+    .pd2 = false,
+    .psl = false,
+},
 flagpd1("fstack-clash-protection"),
 flagpd1("fstack-protector"),
 flagpd1("fstack-protector-all"),
src/main.zig
@@ -1393,6 +1393,8 @@ fn buildOutputType(
                     .no_function_sections => function_sections = false,
                     .color_diagnostics => color = .on,
                     .no_color_diagnostics => color = .off,
+                    .stack_check => want_stack_check = true,
+                    .no_stack_check => want_stack_check = false,
                     .unwind_tables => want_unwind_tables = true,
                     .no_unwind_tables => want_unwind_tables = false,
                     .nostdlib => ensure_libc_on_non_freestanding = false,
@@ -4360,6 +4362,8 @@ pub const ClangArgIterator = struct {
         no_function_sections,
         color_diagnostics,
         no_color_diagnostics,
+        stack_check,
+        no_stack_check,
         strip,
         exec_model,
         emit_llvm,
tools/update_clang_options.zig
@@ -332,6 +332,14 @@ const known_options = [_]KnownOpt{
         .name = "fno-caret-diagnostics",
         .ident = "no_color_diagnostics",
     },
+    .{
+        .name = "fstack-check",
+        .ident = "stack_check",
+    },
+    .{
+        .name = "fno-stack-check",
+        .ident = "no_stack_check",
+    },
     .{
         .name = "MD",
         .ident = "dep_file",