Skip to content

[codex] Remove the legacy whole-archive heuristic#768

Draft
dzbarsky wants to merge 1 commit into
bazelbuild:mainfrom
dzbarsky:codex/remove-legacy-whole-archive-dead-code
Draft

[codex] Remove the legacy whole-archive heuristic#768
dzbarsky wants to merge 1 commit into
bazelbuild:mainfrom
dzbarsky:codex/remove-legacy-whole-archive-dead-code

Conversation

@dzbarsky

@dzbarsky dzbarsky commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

--incompatible_remove_legacy_whole_archive was introduced disabled in Bazel in February 2019 by e5735fd27d and enabled by default in September 2019 by 799328f8e0. The legacy rules_cc heuristic has therefore been disabled by default since Bazel 1.0.

This removes _need_whole_archive and uses the explicit whole_archive request directly. Explicit whole_archive requests and alwayslink libraries continue to set is_whole_archive.

The Bazel option cleanup is bazelbuild/bazel#29939.

Validation: buildifier -mode=check cc/private/link/finalize_link_action.bzl, bash -n tests/integration/cc_shared_library_tests.sh, and bazel test --jobs=3 --disk_cache=/private/tmp/bazel-pr-disk-cache //tests/cc/common:cc_common_tests //tests/alwayslink_srcs:alwayslink_test. The edited cc_shared_library_tests target is Linux-only and is intentionally incompatible with the macOS host platform.

--incompatible_remove_legacy_whole_archive was introduced disabled in Bazel in February 2019 by e5735fd27d and enabled by default in September 2019 by 799328f8e0. The legacy heuristic has therefore been disabled by default since Bazel 1.0.

Remove the unreachable compatibility heuristic. Explicit whole_archive requests and alwayslink libraries continue to set is_whole_archive.
@keith

keith commented Jun 22, 2026

Copy link
Copy Markdown
Member

i was recently talking to @trybka about this and it's definitely still used in google

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants