Implement shared_flag as cc_args

BEGIN_PUBLIC

Implement shared_flag as cc_args

Implements the shared_flag feature as cc_args rules.

END_PUBLIC

PiperOrigin-RevId: 671765792
Change-Id: I0c13873ef2b5c19908cbed13c1b88b5fc957c4cd
This commit is contained in:
Googler 2024-09-06 08:24:25 -07:00 committed by Copybara-Service
parent 98ab8334e7
commit 4bf8bb1f7d
5 changed files with 34 additions and 1 deletions

View File

@ -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",
],
)

View File

@ -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"],
)

View File

@ -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,
)

View File

@ -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",
)

View File

@ -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"