From d3648cc0305ee94e24dd4378376e204587bc6f51 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 4 Mar 2022 18:10:37 -0700 Subject: [PATCH] zig cc: integrate with -fstack-check, -fno-stack-check --- src/clang_options_data.zig | 18 ++++++++++++++++-- src/main.zig | 4 ++++ tools/update_clang_options.zig | 8 ++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/clang_options_data.zig b/src/clang_options_data.zig index dbcf0f749f..25cdd04f82 100644 --- a/src/clang_options_data.zig +++ b/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"), diff --git a/src/main.zig b/src/main.zig index cdda56e8ad..ebbbe6da25 100644 --- a/src/main.zig +++ b/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, diff --git a/tools/update_clang_options.zig b/tools/update_clang_options.zig index bada964c91..0a8b00537c 100644 --- a/tools/update_clang_options.zig +++ b/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",