diff --git a/cc/toolchains/args/BUILD b/cc/toolchains/args/BUILD index 2741f2f..a0e48a2 100644 --- a/cc/toolchains/args/BUILD +++ b/cc/toolchains/args/BUILD @@ -17,6 +17,7 @@ cc_feature( "//cc/toolchains/args/archiver_flags", "//cc/toolchains/args/force_pic_flags", "//cc/toolchains/args/linker_param_file", + "//cc/toolchains/args/shared_flag", ], feature_name = "experimental_replace_legacy_action_config_features", # TODO: Convert remaining items in this list into their actual args. @@ -37,6 +38,5 @@ cc_feature( "//cc/toolchains/features/legacy:user_link_flags", "//cc/toolchains/features/legacy:libraries_to_link", "//cc/toolchains/features/legacy:runtime_library_search_directories", - "//cc/toolchains/features/legacy:shared_flag", ], ) diff --git a/cc/toolchains/args/shared_flag/BUILD b/cc/toolchains/args/shared_flag/BUILD new file mode 100644 index 0000000..6a8401a --- /dev/null +++ b/cc/toolchains/args/shared_flag/BUILD @@ -0,0 +1,15 @@ +load("//cc/toolchains:args.bzl", "cc_args") + +package(default_visibility = ["//visibility:private"]) + +cc_args( + name = "shared_flag", + actions = [ + "//cc/toolchains/actions:cpp_link_dynamic_library", + "//cc/toolchains/actions:cpp_link_nodeps_dynamic_library", + "//cc/toolchains/actions:lto_index_for_dynamic_library", + "//cc/toolchains/actions:lto_index_for_nodeps_dynamic_library", + ], + args = ["-shared"], + visibility = ["//visibility:public"], +) diff --git a/cc/toolchains/features/legacy/BUILD b/cc/toolchains/features/legacy/BUILD index ffea87c..f0f0041 100644 --- a/cc/toolchains/features/legacy/BUILD +++ b/cc/toolchains/features/legacy/BUILD @@ -97,6 +97,7 @@ cc_external_feature( cc_external_feature( name = "shared_flag", + deprecation = "Use //cc/toolchains/args/shared_flag instead", feature_name = "shared_flag", overridable = True, ) diff --git a/tests/rule_based_toolchain/legacy_features_as_args/BUILD b/tests/rule_based_toolchain/legacy_features_as_args/BUILD index 002962d..acbe297 100644 --- a/tests/rule_based_toolchain/legacy_features_as_args/BUILD +++ b/tests/rule_based_toolchain/legacy_features_as_args/BUILD @@ -32,3 +32,9 @@ compare_feature_implementation( actual_implementation = "//cc/toolchains/args/linker_param_file", expected = "//tests/rule_based_toolchain/legacy_features_as_args:goldens/unix/linker_param_file.textproto", ) + +compare_feature_implementation( + name = "shared_flag_test", + actual_implementation = "//cc/toolchains/args/shared_flag", + expected = "//tests/rule_based_toolchain/legacy_features_as_args:goldens/unix/shared_flag.textproto", +) diff --git a/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/shared_flag.textproto b/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/shared_flag.textproto new file mode 100644 index 0000000..51b6868 --- /dev/null +++ b/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/shared_flag.textproto @@ -0,0 +1,11 @@ +enabled: false +flag_sets { + actions: "c++-link-dynamic-library" + actions: "c++-link-nodeps-dynamic-library" + actions: "lto-index-for-dynamic-library" + actions: "lto-index-for-nodeps-dynamic-library" + flag_groups { + flags: "-shared" + } +} +name: "shared_flag_test"