diff --git a/crosstool/cc_toolchain_config.bzl b/crosstool/cc_toolchain_config.bzl index 93543213..e9162281 100644 --- a/crosstool/cc_toolchain_config.bzl +++ b/crosstool/cc_toolchain_config.bzl @@ -2153,15 +2153,21 @@ please file an issue at https://github.com/bazelbuild/apple_support/issues/new ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile, ], - flag_groups = [ - flag_group( - flags = [ - "-gline-tables-only", - "-fno-omit-frame-pointer", - "-fno-sanitize-recover=all", - ], - ), + flag_groups = [flag_group(flags = ["-gline-tables-only"])], + with_features = [ + with_feature_set(features = ["asan", "fastbuild"]), + with_feature_set(features = ["tsan", "fastbuild"]), + with_feature_set(features = ["ubsan", "fastbuild"]), + ], + ), + flag_set( + actions = [ + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.objc_compile, + ACTION_NAMES.objcpp_compile, ], + flag_groups = [flag_group(flags = ["-fno-sanitize-recover=all"])], with_features = [ with_feature_set(features = ["asan"]), with_feature_set(features = ["tsan"]), diff --git a/test/sanitizer_tests.bzl b/test/sanitizer_tests.bzl index 11f2df6d..6fc1eab6 100644 --- a/test/sanitizer_tests.bzl +++ b/test/sanitizer_tests.bzl @@ -9,18 +9,42 @@ default_test = make_action_command_line_test_rule() asan_test = make_action_command_line_test_rule( config_settings = { + "//command_line_option:compilation_mode": "fastbuild", + "//command_line_option:features": ["asan"], + }, +) + +asan_dbg_test = make_action_command_line_test_rule( + config_settings = { + "//command_line_option:compilation_mode": "dbg", "//command_line_option:features": ["asan"], }, ) tsan_test = make_action_command_line_test_rule( config_settings = { + "//command_line_option:compilation_mode": "fastbuild", + "//command_line_option:features": ["tsan"], + }, +) + +tsan_dbg_test = make_action_command_line_test_rule( + config_settings = { + "//command_line_option:compilation_mode": "dbg", "//command_line_option:features": ["tsan"], }, ) ubsan_test = make_action_command_line_test_rule( config_settings = { + "//command_line_option:compilation_mode": "fastbuild", + "//command_line_option:features": ["ubsan"], + }, +) + +ubsan_dbg_test = make_action_command_line_test_rule( + config_settings = { + "//command_line_option:compilation_mode": "dbg", "//command_line_option:features": ["ubsan"], }, ) @@ -53,13 +77,35 @@ def sanitizer_test_suite(name): name = "{}_asan_cc_compile_test".format(name), tags = [name], expected_argv = [ + "-fno-omit-frame-pointer", "-fsanitize=address", "-gline-tables-only", + "-fno-sanitize-recover=all", + ], + not_expected_argv = [ + "-D_FORTIFY_SOURCE=1", + "-g", + "-g0", + ], + mnemonic = "CppCompile", + target_under_test = "//test/test_data:cc_main", + ) + + asan_dbg_test( + name = "{}_asan_dbg_cc_compile_test".format(name), + tags = [name], + expected_argv = [ "-fno-omit-frame-pointer", + "-O0", + "-DDEBUG", + "-g", + "-fsanitize=address", "-fno-sanitize-recover=all", ], not_expected_argv = [ "-D_FORTIFY_SOURCE=1", + "-gline-tables-only", + "-g0", ], mnemonic = "CppCompile", target_under_test = "//test/test_data:cc_main", @@ -69,13 +115,15 @@ def sanitizer_test_suite(name): name = "{}_asan_objc_compile_test".format(name), tags = [name], expected_argv = [ + "-fno-omit-frame-pointer", "-fsanitize=address", "-gline-tables-only", - "-fno-omit-frame-pointer", "-fno-sanitize-recover=all", ], not_expected_argv = [ "-D_FORTIFY_SOURCE=1", + "-g", + "-g0", ], mnemonic = "ObjcCompile", target_under_test = "//test/test_data:objc_lib", @@ -106,11 +154,35 @@ def sanitizer_test_suite(name): tags = [name], expected_argv = [ "-D_FORTIFY_SOURCE=1", + "-fno-omit-frame-pointer", "-fsanitize=thread", "-gline-tables-only", + "-fno-sanitize-recover=all", + ], + not_expected_argv = [ + "-g", + "-g0", + ], + mnemonic = "CppCompile", + target_under_test = "//test/test_data:cc_main", + ) + + tsan_dbg_test( + name = "{}_tsan_dbg_cc_compile_test".format(name), + tags = [name], + expected_argv = [ + "-D_FORTIFY_SOURCE=1", "-fno-omit-frame-pointer", + "-O0", + "-DDEBUG", + "-g", + "-fsanitize=thread", "-fno-sanitize-recover=all", ], + not_expected_argv = [ + "-gline-tables-only", + "-g0", + ], mnemonic = "CppCompile", target_under_test = "//test/test_data:cc_main", ) @@ -120,11 +192,15 @@ def sanitizer_test_suite(name): tags = [name], expected_argv = [ "-D_FORTIFY_SOURCE=1", + "-fno-omit-frame-pointer", "-fsanitize=thread", "-gline-tables-only", - "-fno-omit-frame-pointer", "-fno-sanitize-recover=all", ], + not_expected_argv = [ + "-g", + "-g0", + ], mnemonic = "ObjcCompile", target_under_test = "//test/test_data:objc_lib", ) @@ -154,11 +230,35 @@ def sanitizer_test_suite(name): tags = [name], expected_argv = [ "-D_FORTIFY_SOURCE=1", + "-fno-omit-frame-pointer", "-fsanitize=undefined", "-gline-tables-only", + "-fno-sanitize-recover=all", + ], + not_expected_argv = [ + "-g", + "-g0", + ], + mnemonic = "CppCompile", + target_under_test = "//test/test_data:cc_main", + ) + + ubsan_dbg_test( + name = "{}_ubsan_dbg_cc_compile_test".format(name), + tags = [name], + expected_argv = [ + "-D_FORTIFY_SOURCE=1", "-fno-omit-frame-pointer", + "-O0", + "-DDEBUG", + "-g", + "-fsanitize=undefined", "-fno-sanitize-recover=all", ], + not_expected_argv = [ + "-gline-tables-only", + "-g0", + ], mnemonic = "CppCompile", target_under_test = "//test/test_data:cc_main", ) @@ -168,11 +268,15 @@ def sanitizer_test_suite(name): tags = [name], expected_argv = [ "-D_FORTIFY_SOURCE=1", + "-fno-omit-frame-pointer", "-fsanitize=undefined", "-gline-tables-only", - "-fno-omit-frame-pointer", "-fno-sanitize-recover=all", ], + not_expected_argv = [ + "-g", + "-g0", + ], mnemonic = "ObjcCompile", target_under_test = "//test/test_data:objc_lib", ) diff --git a/test/test_data/toolchain_configs/darwin_arm64.json b/test/test_data/toolchain_configs/darwin_arm64.json index e8f3f326..47a04355 100644 --- a/test/test_data/toolchain_configs/darwin_arm64.json +++ b/test/test_data/toolchain_configs/darwin_arm64.json @@ -4678,8 +4678,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/darwin_arm64e.json b/test/test_data/toolchain_configs/darwin_arm64e.json index fd63faea..b266491b 100644 --- a/test/test_data/toolchain_configs/darwin_arm64e.json +++ b/test/test_data/toolchain_configs/darwin_arm64e.json @@ -4682,8 +4682,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/darwin_x86_64.json b/test/test_data/toolchain_configs/darwin_x86_64.json index 012c062d..39810aaf 100644 --- a/test/test_data/toolchain_configs/darwin_x86_64.json +++ b/test/test_data/toolchain_configs/darwin_x86_64.json @@ -4682,8 +4682,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/ios_arm64.json b/test/test_data/toolchain_configs/ios_arm64.json index 18d23d4a..82fb9f21 100644 --- a/test/test_data/toolchain_configs/ios_arm64.json +++ b/test/test_data/toolchain_configs/ios_arm64.json @@ -4658,8 +4658,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/ios_arm64e.json b/test/test_data/toolchain_configs/ios_arm64e.json index 64fe92be..9880a217 100644 --- a/test/test_data/toolchain_configs/ios_arm64e.json +++ b/test/test_data/toolchain_configs/ios_arm64e.json @@ -4658,8 +4658,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/ios_sim_arm64.json b/test/test_data/toolchain_configs/ios_sim_arm64.json index 4cb734d5..5a159f0c 100644 --- a/test/test_data/toolchain_configs/ios_sim_arm64.json +++ b/test/test_data/toolchain_configs/ios_sim_arm64.json @@ -4685,8 +4685,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/ios_x86_64.json b/test/test_data/toolchain_configs/ios_x86_64.json index e5b1a49a..76c59b43 100644 --- a/test/test_data/toolchain_configs/ios_x86_64.json +++ b/test/test_data/toolchain_configs/ios_x86_64.json @@ -4685,8 +4685,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/tvos_arm64.json b/test/test_data/toolchain_configs/tvos_arm64.json index 4eeca169..d570a2a6 100644 --- a/test/test_data/toolchain_configs/tvos_arm64.json +++ b/test/test_data/toolchain_configs/tvos_arm64.json @@ -4632,8 +4632,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/tvos_sim_arm64.json b/test/test_data/toolchain_configs/tvos_sim_arm64.json index 27e108a7..6e5a01c7 100644 --- a/test/test_data/toolchain_configs/tvos_sim_arm64.json +++ b/test/test_data/toolchain_configs/tvos_sim_arm64.json @@ -4659,8 +4659,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/tvos_x86_64.json b/test/test_data/toolchain_configs/tvos_x86_64.json index a571b7e7..40212a80 100644 --- a/test/test_data/toolchain_configs/tvos_x86_64.json +++ b/test/test_data/toolchain_configs/tvos_x86_64.json @@ -4659,8 +4659,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/visionos_arm64.json b/test/test_data/toolchain_configs/visionos_arm64.json index 8800a45f..66aac769 100644 --- a/test/test_data/toolchain_configs/visionos_arm64.json +++ b/test/test_data/toolchain_configs/visionos_arm64.json @@ -4631,8 +4631,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/visionos_sim_arm64.json b/test/test_data/toolchain_configs/visionos_sim_arm64.json index 22144b8d..b1ea672f 100644 --- a/test/test_data/toolchain_configs/visionos_sim_arm64.json +++ b/test/test_data/toolchain_configs/visionos_sim_arm64.json @@ -4658,8 +4658,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/watchos_arm64.json b/test/test_data/toolchain_configs/watchos_arm64.json index adfe59f0..8ff12a49 100644 --- a/test/test_data/toolchain_configs/watchos_arm64.json +++ b/test/test_data/toolchain_configs/watchos_arm64.json @@ -4659,8 +4659,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/watchos_arm64_32.json b/test/test_data/toolchain_configs/watchos_arm64_32.json index 20ca2fc0..b0fe77c1 100644 --- a/test/test_data/toolchain_configs/watchos_arm64_32.json +++ b/test/test_data/toolchain_configs/watchos_arm64_32.json @@ -4632,8 +4632,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/watchos_device_arm64.json b/test/test_data/toolchain_configs/watchos_device_arm64.json index 9a39c1d9..962c12e3 100644 --- a/test/test_data/toolchain_configs/watchos_device_arm64.json +++ b/test/test_data/toolchain_configs/watchos_device_arm64.json @@ -4632,8 +4632,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/watchos_device_arm64e.json b/test/test_data/toolchain_configs/watchos_device_arm64e.json index 72bb81cc..8ac7194b 100644 --- a/test/test_data/toolchain_configs/watchos_device_arm64e.json +++ b/test/test_data/toolchain_configs/watchos_device_arm64e.json @@ -4632,8 +4632,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/test/test_data/toolchain_configs/watchos_x86_64.json b/test/test_data/toolchain_configs/watchos_x86_64.json index 9b9e7041..040216f4 100644 --- a/test/test_data/toolchain_configs/watchos_x86_64.json +++ b/test/test_data/toolchain_configs/watchos_x86_64.json @@ -4659,8 +4659,39 @@ "expand_if_true": null, "flag_groups": [], "flags": [ - "-gline-tables-only", - "-fno-omit-frame-pointer", + "-gline-tables-only" + ], + "iterate_over": null, + "type_name": "flag_group" + } + ], + "type_name": "flag_set", + "with_features": [ + { + "features": [ + "fastbuild" + ], + "not_features": [], + "type_name": "with_feature_set" + } + ] + }, + { + "actions": [ + "c++-compile", + "c-compile", + "objc++-compile", + "objc-compile" + ], + "flag_groups": [ + { + "expand_if_available": null, + "expand_if_equal": null, + "expand_if_false": null, + "expand_if_not_available": null, + "expand_if_true": null, + "flag_groups": [], + "flags": [ "-fno-sanitize-recover=all" ], "iterate_over": null, diff --git a/toolchain/BUILD b/toolchain/BUILD index a42de845..44778086 100644 --- a/toolchain/BUILD +++ b/toolchain/BUILD @@ -73,16 +73,19 @@ _LIMITED_COMPILE_ACTIONS = [ cc_feature( name = "dbg", overrides = "@rules_cc//cc/toolchains/features:dbg", + visibility = ["//visibility:public"], ) cc_feature( name = "fastbuild", overrides = "@rules_cc//cc/toolchains/features:fastbuild", + visibility = ["//visibility:public"], ) cc_feature( name = "opt", overrides = "@rules_cc//cc/toolchains/features:opt", + visibility = ["//visibility:public"], ) cc_feature( diff --git a/toolchain/sanitizers/BUILD b/toolchain/sanitizers/BUILD index 3090cd25..abcfb798 100644 --- a/toolchain/sanitizers/BUILD +++ b/toolchain/sanitizers/BUILD @@ -44,7 +44,10 @@ enableable_feature( cc_feature( name = "default_sanitizer_flags", - args = [":default_sanitizer_flags_args"], + args = [ + ":default_sanitizer_fastbuild_flags_args", + ":default_sanitizer_flags_args", + ], feature_name = "default_sanitizer_flags", requires_any_of = [ ":asan", @@ -53,12 +56,17 @@ cc_feature( ], ) +cc_args( + name = "default_sanitizer_fastbuild_flags_args", + actions = _LIMITED_COMPILE_ACTIONS, + args = ["-gline-tables-only"], + requires_any_of = ["//toolchain:fastbuild"], +) + cc_args( name = "default_sanitizer_flags_args", actions = _LIMITED_COMPILE_ACTIONS, args = [ - "-gline-tables-only", - "-fno-omit-frame-pointer", "-fno-sanitize-recover=all", ], )