You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
[codex] Support distributed ThinLTO on macOS (#617)
This adds distributed ThinLTO for macOS targets after #615. The existing
`windows-thin-lto.patch` remains unchanged, and the macOS rules_cc
changes are isolated in `macos-thin-lto.patch`, which is applied after
`windows-thin-lto.patch`. The macOS patch corresponds to
bazelbuild/rules_cc#748 and only adds Mach-O LLD's direct distributed
ThinLTO arguments.
The LLVM source patch adds the exact-file `--lto-obj-path` contract
proposed upstream in llvm/llvm-project#203365. The exact-file contract
lets the indexing action produce rules_cc's declared
`thinlto_merged_object_file` without reproducing Mach-O LLD's
`0.<arch>.lto.o` directory naming.
`is_windows_capable_of_thinlto_feature` and
`is_macos_capable_of_thinlto_feature` default to false and independently
control whether the toolchain exposes the rules_cc `thin_lto` feature on
Windows and macOS. `windows_capable_of_thinlto_feature` and
`macos_capable_of_thinlto_feature` combine the corresponding build
setting with the target OS constraint. `--config=prebuilt` enables both
build settings. `is_windows_capable_of_thinlto_feature` can be removed
after a rules_cc release contains Windows distributed ThinLTO support.
`is_macos_capable_of_thinlto_feature` can be removed after rules_cc and
LLVM releases contain macOS distributed ThinLTO support. The previous
macOS `-flto=thin` fallback is removed because rules_cc now creates
separate indexing and backend actions.
Validation:
- Applied `windows-thin-lto.patch` followed by `macos-thin-lto.patch` to
a clean rules_cc checkout and compared the resulting ThinLTO feature
with the rules_cc source.
- `bazel test
//tests/rule_based_toolchain/legacy_features_as_args:thin_lto_macos_test
--test_output=errors` in rules_cc.
- `bazel build --config=prebuilt --config=remote --config=bootstrap
//prebuilt/llvm:for_windows_amd64 //prebuilt/llvm:for_windows_arm64
//prebuilt/llvm:for_macos_amd64 //prebuilt/llvm:for_macos_arm64`.
- BuildBuddy invocation:
https://app.buildbuddy.io/invocation/ff484673-abb8-41c9-ba4c-a19410241625