Pass fission flags to ThinLTO backend actions - #837
Open
akonradi wants to merge 2 commits into
Open
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Collaborator
|
I think you need to complete the Google CLA, but otherwise I think this looks good. |
With --fission enabled, a .dwo output is declared for every LTO backend action, but the default Unix toolchain config never passes -gsplit-dwarf to that action, so the output can never be written and --fission combined with --features=thin_lto fails at execution time with output '<target>.lto/.../foo.dwo' was not created This test documents the current behaviour: it asserts that the .dwo is declared and that -gsplit-dwarf is absent. The following commit fixes the toolchain configs and flips the assertion. The existing ThinLTO fission coverage in tests/cc/common/cc_binary_thin_lto_tests.bzl cannot catch this, because the test toolchain in tests/cc/testutil/toolchains defines its own fission_flags_for_lto_backend feature covering ACTION_NAMES.lto_backend. Toolchains built on unix_cc_toolchain_config.bzl have no such feature, so the gap can only be seen by testing against that config -- hence a new linux toolchain registration in tests/default_unix_toolchain, which so far registered only a macOS toolchain. The "dwp" tool_paths entry is required: without it, cc_binary analysis under --fission fails with a NoneType error out of create_debug_packager_actions before any flag can be inspected.
cc/private/link/lto_backends.bzl declares <object>.dwo as an output of
each LTO backend action and binds both per_object_debug_info_file and
is_using_fission for it, but neither production toolchain config puts
-gsplit-dwarf on ACTION_NAMES.lto_backend. The declared output is
therefore never written and the action always fails:
ERROR: output 'prog.lto/.../a.dwo' was not created
ERROR: LTO Backend Compile prog.lto/.../a.o failed:
not all outputs were created or valid
so --fission cannot be combined with --features=thin_lto at all.
Add ACTION_NAMES.lto_backend to the per_object_debug_info flag_set in
unix_cc_toolchain_config.bzl and legacy_features.bzl, and flip the
assertion added by the previous commit. The build variable the
flag_group gates on is already bound for that action, so no further
plumbing is needed.
Verified end to end outside the test suite with bazel 8.7.0 and clang
22.1.8 on a two-file cc_binary, --features=thin_lto --fission=yes
--features=per_object_debug_info and no --ltobackendopt: before, the
build fails as above; after, it succeeds and writes non-empty .dwo
files that llvm-dwp packs into a valid .dwp.
akonradi
force-pushed
the
abakon/fission-flags-for-lto-backend
branch
from
August 3, 2026 16:00
c43da3e to
c033aba
Compare
Author
|
Ha, it was the Claude co-author attribution. Removed and force-pushed, same contents. |
lilygorsheneva
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix interaction between
--fissionand--features=thin_lto. Without this, every LTO backend action fails:Fixed by adding
ACTION_NAMES.lto_backendto theper_object_debug_infoflag_set incc/private/toolchain/unix_cc_toolchain_config.bzlandcc/private/toolchain_config/legacy_features.bzl.Adds a test that uses the real Linux
cc_toolchain_configsince that wasn't covered by the existing test, and was broken.