Consolidate action labels in toolchain args

BEGIN_PUBLIC

Consolidate action labels in toolchain args

Consolidates action labels used by re-implementation of legacy features to use logical groups rather than individually listing every action. This simplifies the rule definitions slightly.

END_PUBLIC

PiperOrigin-RevId: 673920103
Change-Id: If5453dd5b45d5549ff75d656da8a2873232117ae
This commit is contained in:
Googler 2024-09-12 11:04:43 -07:00 committed by Copybara-Service
parent da1ac71c8e
commit 0d5561bcba
6 changed files with 10 additions and 44 deletions

View File

@ -16,7 +16,7 @@ cc_args_list(
cc_args(
name = "create_static_archive",
actions = ["//cc/toolchains/actions:cpp_link_static_library"],
actions = ["//cc/toolchains/actions:ar_actions"],
args = select({
"@platforms//os:macos": ["-static"],
"//conditions:default": ["rcsD"],
@ -25,7 +25,7 @@ cc_args(
cc_args(
name = "output_execpath",
actions = ["//cc/toolchains/actions:cpp_link_static_library"],
actions = ["//cc/toolchains/actions:ar_actions"],
args = select({
"@platforms//os:macos": ["-o"],
"//conditions:default": [],
@ -36,7 +36,7 @@ cc_args(
cc_args(
name = "libraries_to_link",
actions = ["//cc/toolchains/actions:cpp_link_static_library"],
actions = ["//cc/toolchains/actions:ar_actions"],
nested = ["libraries_to_link_expansion"],
requires_not_none = "//cc/toolchains/variables:libraries_to_link",
)

View File

@ -4,10 +4,7 @@ package(default_visibility = ["//visibility:private"])
cc_args(
name = "force_pic_flags",
actions = [
"//cc/toolchains/actions:cpp_link_executable",
"//cc/toolchains/actions:lto_index_for_executable",
],
actions = ["//cc/toolchains/actions:link_executable_actions"],
args = select({
"@platforms//os:macos": ["-Wl,-pie"],
"//conditions:default": ["-pie"],

View File

@ -6,14 +6,7 @@ package(default_visibility = ["//visibility:private"])
cc_args(
name = "libraries_to_link",
actions = [
"//cc/toolchains/actions:cpp_link_executable",
"//cc/toolchains/actions:cpp_link_dynamic_library",
"//cc/toolchains/actions:cpp_link_nodeps_dynamic_library",
"//cc/toolchains/actions:lto_index_for_executable",
"//cc/toolchains/actions:lto_index_for_dynamic_library",
"//cc/toolchains/actions:lto_index_for_nodeps_dynamic_library",
],
actions = ["//cc/toolchains/actions:link_actions"],
nested = [
":thinlto_param_file",
":libraries_to_link_args",

View File

@ -12,13 +12,8 @@ cc_args_list(
cc_args(
name = "use_param_file",
actions = [
"//cc/toolchains/actions:cpp_link_executable",
"//cc/toolchains/actions:cpp_link_dynamic_library",
"//cc/toolchains/actions:cpp_link_nodeps_dynamic_library",
"//cc/toolchains/actions:lto_index_for_executable",
"//cc/toolchains/actions:lto_index_for_dynamic_library",
"//cc/toolchains/actions:lto_index_for_nodeps_dynamic_library",
"//cc/toolchains/actions:cpp_link_static_library",
"//cc/toolchains/actions:link_actions",
"//cc/toolchains/actions:ar_actions",
],
args = ["@{param_file}"],
format = {"param_file": "//cc/toolchains/variables:linker_param_file"},

View File

@ -32,14 +32,7 @@ cc_args_list(
cc_args(
name = "runtime_library_search_directories_static_runtimes_args",
actions = [
"//cc/toolchains/actions:cpp_link_executable",
"//cc/toolchains/actions:cpp_link_dynamic_library",
"//cc/toolchains/actions:cpp_link_nodeps_dynamic_library",
"//cc/toolchains/actions:lto_index_for_executable",
"//cc/toolchains/actions:lto_index_for_dynamic_library",
"//cc/toolchains/actions:lto_index_for_nodeps_dynamic_library",
],
actions = ["//cc/toolchains/actions:link_actions"],
nested = [":iterate_over_search_dirs"],
requires_any_of = [":static_link_cpp_runtimes_enabled"],
requires_not_none = "//cc/toolchains/variables:runtime_library_search_directories",
@ -90,14 +83,7 @@ cc_nested_args(
# longer required.
cc_args(
name = "runtime_library_search_directories_args",
actions = [
"//cc/toolchains/actions:cpp_link_executable",
"//cc/toolchains/actions:cpp_link_dynamic_library",
"//cc/toolchains/actions:cpp_link_nodeps_dynamic_library",
"//cc/toolchains/actions:lto_index_for_executable",
"//cc/toolchains/actions:lto_index_for_dynamic_library",
"//cc/toolchains/actions:lto_index_for_nodeps_dynamic_library",
],
actions = ["//cc/toolchains/actions:link_actions"],
nested = [":search_dir_args"],
# Remove the requires_any_of here if the workaround for b/27153401 is no
# longer required.

View File

@ -4,12 +4,7 @@ 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",
],
actions = ["//cc/toolchains/actions:dynamic_library_link_actions"],
args = ["-shared"],
visibility = ["//visibility:public"],
)