Skip to content

Commit

Permalink
Add tool name for objcopy
Browse files Browse the repository at this point in the history
It is not clear to me why this constant is in [src/main/starlark/builtins_bzl/common/cc/action_names.bzl](https://github.com/bazelbuild/bazel/blob/master/src/main/starlark/builtins_bzl/common/cc/action_names.bzl) but not in [tools/build_defs/cc/action_names.bzl](https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl), but it makes `get_tool_for_action` really annoying.

Furthermore, it seems that if we are willing to define `llvm-cov` for everyone we should do the same for `objcopy`.

Closes #16158.

PiperOrigin-RevId: 503922270
Change-Id: Ic0803de27150bb6da02a9daf5bb0337ba5ccc17c
  • Loading branch information
m3rcuriel authored and hvadehra committed Feb 14, 2023
1 parent 2249a99 commit ed4f9ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/build_defs/cc/action_names.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ OBJC_FULLY_LINK_ACTION_NAME = "objc-fully-link"
# A string constant for the clif actions.
CLIF_MATCH_ACTION_NAME = "clif-match"

# A string constant for the obj copy actions.
OBJ_COPY_ACTION_NAME = "objcopy_embed_data"

ACTION_NAMES = struct(
c_compile = C_COMPILE_ACTION_NAME,
cpp_compile = CPP_COMPILE_ACTION_NAME,
Expand Down Expand Up @@ -118,4 +121,5 @@ ACTION_NAMES = struct(
objcpp_compile = OBJCPP_COMPILE_ACTION_NAME,
objcpp_executable = OBJCPP_EXECUTABLE_ACTION_NAME,
clif_match = CLIF_MATCH_ACTION_NAME,
objcopy_embed_data = OBJ_COPY_ACTION_NAME,
)
10 changes: 10 additions & 0 deletions tools/cpp/unix_cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,17 @@ def _impl(ctx):
],
)

objcopy_action = action_config(
action_name = ACTION_NAMES.objcopy_embed_data,
tools = [
tool(
path = ctx.attr.tool_paths["objcopy"],
),
],
)

action_configs.append(llvm_cov_action)
action_configs.append(objcopy_action)

supports_pic_feature = feature(
name = "supports_pic",
Expand Down

0 comments on commit ed4f9ee

Please sign in to comment.