Skip to content

Commit 4331788

Browse files
committed
[bazel] SQUASHME: take objcopy from toolchain actions
Signed-off-by: James Wainwright <[email protected]>
1 parent 07b2c8c commit 4331788

File tree

1 file changed

+13
-1
lines changed
  • sw/device/silicon_creator/rom_ext/imm_section

1 file changed

+13
-1
lines changed

sw/device/silicon_creator/rom_ext/imm_section/utils.bzl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ load(
99
)
1010
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
1111
load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain")
12+
load("@rules_cc//cc:action_names.bzl", "OBJ_COPY_ACTION_NAME")
1213
load("@lowrisc_opentitan//rules:rv.bzl", "rv_rule")
1314
load(
1415
"//sw/device/silicon_creator/rom_ext/imm_section:defs.bzl",
@@ -17,6 +18,16 @@ load(
1718

1819
def _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

Comments
 (0)