Skip to content

Commit 4c700e9

Browse files
Googlercopybara-github
authored andcommitted
Add a dedicated exec group (cpp_dwp) for CcGenerateDwp actions of cc_binary and cc_test targets
This change introduces a new `cpp_dwp` exec group for the `CcGenerateDwp` action (which assembles DWARF object (`.dwo`) files into a DWARF package (`.dwp`) file) that is created when Fission is enabled. This allows users to configure execution properties specifically for the dwp generation step using, e.g., `exec_properties = {"cpp_dwp.mem": "..."}`. This complements the existing `cpp_link` exec group (memory requirements of `CcGenerateDwp` tend to increase as the number of dependencies increases, similar to linking). This change is backwards-compatible because previously, the only way to add exec properties to `CcGenerateDwp` actions was with an unqualified property name (e.g. `{"mem": "..."}`), and that will continue working (but now may be overridden with a `cpp_dwp.*` property). Rules other than `cc_binary` and `cc_test` may create `CcGenerateDwp` actions via calling the `create_debug_packager_actions` function in `cc_debug_helper.bzl`, but the actions will only have a non-default exec group if a `dwp_exec_group` argument is specified in the call to `create_debug_packager_actions`. PiperOrigin-RevId: 927158851 Change-Id: Idb57839404bd48b22b663a4dc9ced2b05352b5fc
1 parent 033f905 commit 4c700e9

4 files changed

Lines changed: 7 additions & 1 deletion

File tree

cc/common/cc_debug_helper.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ def create_debug_packager_actions(
3131
feature_configuration,
3232
linking_mode,
3333
use_pic = True,
34-
lto_artifacts = []):
34+
lto_artifacts = [],
35+
dwp_exec_group = None):
3536
"""Creates intermediate and final dwp creation action(s)
3637
3738
Args:
@@ -44,6 +45,7 @@ def create_debug_packager_actions(
4445
linking_mode: (str) See cc_helper.bzl%linker_mode
4546
use_pic: (bool)
4647
lto_artifacts: ([CcLtoBackendArtifacts])
48+
dwp_exec_group: (str) the exec group to use for the final dwp action
4749
"""
4850
dwo_files = _collect_transitive_dwo_artifacts(
4951
cc_compilation_outputs,
@@ -97,6 +99,7 @@ def create_debug_packager_actions(
9799
arguments = [packager["arguments"]],
98100
inputs = packager["inputs"],
99101
outputs = packager["outputs"],
102+
exec_group = dwp_exec_group,
100103
)
101104

102105
def _collect_transitive_dwo_artifacts(cc_compilation_outputs, cc_debug_context, linking_mode, use_pic, lto_backend_artifacts):

cc/private/rules_impl/cc_binary.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ be <code>main</code>.
5959
},
6060
fragments = ["cpp"] + semantics.additional_fragments(),
6161
exec_groups = {
62+
"cpp_dwp": exec_group(toolchains = use_cc_toolchain()),
6263
"cpp_link": exec_group(toolchains = use_cc_toolchain()),
6364
} | semantics.extra_exec_groups,
6465
toolchains = use_cc_toolchain() +

cc/private/rules_impl/cc_binary_impl.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ def cc_binary_impl(ctx, additional_linkopts, force_linkstatic = False):
717717
linking_mode = linking_mode,
718718
use_pic = use_pic,
719719
lto_artifacts = cc_linking_outputs_binary.all_lto_artifacts(),
720+
dwp_exec_group = "cpp_dwp",
720721
)
721722
explicit_dwp_file = dwp_file
722723
if not cc_helper.should_create_per_object_debug_info(feature_configuration, cpp_config):

cc/private/rules_impl/cc_test.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ attributes common to all test rules (*_test)</a>.</p>
109109
},
110110
fragments = ["cpp", "coverage"] + semantics.additional_fragments(),
111111
exec_groups = {
112+
"cpp_dwp": exec_group(toolchains = use_cc_toolchain()),
112113
"cpp_link": exec_group(toolchains = use_cc_toolchain()),
113114
# testing.ExecutionInfo defaults to an exec_group of "test".
114115
"test": exec_group(toolchains = [config_common.toolchain_type(_CC_TEST_TOOLCHAIN_TYPE, mandatory = False)]),

0 commit comments

Comments
 (0)