99)
1010load ("@rules_pkg//pkg:tar.bzl" , "pkg_tar" )
1111load ("@rules_cc//cc:find_cc_toolchain.bzl" , "find_cc_toolchain" )
12+ load ("@rules_cc//cc:action_names.bzl" , "OBJ_COPY_ACTION_NAME" )
1213load ("@lowrisc_opentitan//rules:rv.bzl" , "rv_rule" )
1314load (
1415 "//sw/device/silicon_creator/rom_ext/imm_section:defs.bzl" ,
1718
1819def _bin_to_imm_section_object_impl (ctx ):
1920 cc_toolchain = find_cc_toolchain (ctx )
21+ feature_config = cc_common .configure_features (
22+ ctx = ctx ,
23+ cc_toolchain = cc_toolchain ,
24+ requested_features = ctx .features ,
25+ unsupported_features = ctx .disabled_features ,
26+ )
27+ objcopy = cc_common .get_tool_for_action (
28+ feature_configuration = feature_config ,
29+ action_name = OBJ_COPY_ACTION_NAME ,
30+ )
2031
2132 for src in ctx .files .src :
2233 if src .extension != "bin" :
@@ -40,7 +51,7 @@ def _bin_to_imm_section_object_impl(ctx):
4051 src .path ,
4152 object .path ,
4253 ],
43- executable = cc_toolchain . objcopy_executable ,
54+ executable = objcopy ,
4455 )
4556
4657 # e2e/exec_env tests ensure the immutable rom_ext is the same across all
@@ -59,6 +70,7 @@ bin_to_imm_section_object = rv_rule(
5970 "src" : attr .label (allow_files = True ),
6071 "_cc_toolchain" : attr .label (default = Label ("@bazel_tools//tools/cpp:current_cc_toolchain" )),
6172 },
73+ fragments = ["cpp" ],
6274 toolchains = ["@rules_cc//cc:toolchain_type" ],
6375)
6476
0 commit comments