Implement linker_param_file as cc_args

BEGIN_PUBLIC

Implement linker_param_file as cc_args

Implements the linker_param_file feature as cc_args rules.

END_PUBLIC

PiperOrigin-RevId: 671762576
Change-Id: Ic6bd3ad3b059599c796680cdb4e2b63f6929b8a9
This commit is contained in:
Googler 2024-09-06 08:13:20 -07:00 committed by Copybara-Service
parent 9333569bc8
commit cf6ccb93f4
5 changed files with 49 additions and 1 deletions

View File

@ -15,6 +15,7 @@ cc_feature(
name = "experimental_replace_legacy_action_config_features",
args = [
"//cc/toolchains/args/archiver_flags",
"//cc/toolchains/args/linker_param_file",
],
feature_name = "experimental_replace_legacy_action_config_features",
# TODO: Convert remaining items in this list into their actual args.
@ -35,7 +36,6 @@ cc_feature(
"//cc/toolchains/features/legacy:user_link_flags",
"//cc/toolchains/features/legacy:force_pic_flags",
"//cc/toolchains/features/legacy:libraries_to_link",
"//cc/toolchains/features/legacy:linker_param_file",
"//cc/toolchains/features/legacy:runtime_library_search_directories",
"//cc/toolchains/features/legacy:shared_flag",
],

View File

@ -0,0 +1,26 @@
load("//cc/toolchains:args.bzl", "cc_args")
load("//cc/toolchains:args_list.bzl", "cc_args_list")
package(default_visibility = ["//visibility:private"])
cc_args_list(
name = "linker_param_file",
args = [":use_param_file"],
visibility = ["//visibility:public"],
)
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",
],
args = ["@{param_file}"],
format = {"param_file": "//cc/toolchains/variables:linker_param_file"},
requires_not_none = "//cc/toolchains/variables:linker_param_file",
)

View File

@ -215,6 +215,7 @@ cc_external_feature(
cc_external_feature(
name = "linker_param_file",
deprecation = "Use //cc/toolchains/args/linker_param_file instead",
feature_name = "linker_param_file",
overridable = True,
)

View File

@ -17,3 +17,9 @@ compare_feature_implementation(
"//conditions:default": "//tests/rule_based_toolchain/legacy_features_as_args:goldens/unix/archiver_flags.textproto",
}),
)
compare_feature_implementation(
name = "linker_param_file_test",
actual_implementation = "//cc/toolchains/args/linker_param_file",
expected = "//tests/rule_based_toolchain/legacy_features_as_args:goldens/unix/linker_param_file.textproto",
)

View File

@ -0,0 +1,15 @@
enabled: false
flag_sets {
actions: "c++-link-dynamic-library"
actions: "c++-link-executable"
actions: "c++-link-nodeps-dynamic-library"
actions: "c++-link-static-library"
actions: "lto-index-for-dynamic-library"
actions: "lto-index-for-executable"
actions: "lto-index-for-nodeps-dynamic-library"
flag_groups {
expand_if_available: "linker_param_file"
flags: "@%{linker_param_file}"
}
}
name: "linker_param_file_test"