bazel: simplify lto flags#29600
Merged
travisdowns merged 1 commit intoredpanda-data:devfrom Feb 15, 2026
Merged
Conversation
travisdowns
commented
Feb 13, 2026
| # LTO mixin: enable LTO for C++ and Rust. Usually mixed in with | ||
| # PGO + release, but should work with any. | ||
| build:lto --copt -flto=thin | ||
| build:lto --linkopt -flto=thin |
Member
Author
There was a problem hiding this comment.
Mostly a move (cut + paste) of the below, plus renaming, but this line is new.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the LTO (Link Time Optimization) configuration in Bazel to be more flexible and consistent. Previously, LTO was only enabled for the redpanda binary via a BUILD-level flag. Now, LTO is available as a reusable config mixin (--config=lto) that can be combined with any build mode.
Changes:
- Introduced a new
--config=ltomixin in.bazelrcthat enables thin LTO for C++ and fat LTO for Rust - Removed the redpanda-specific
ltobool_flag anduse_ltoconfig_setting fromsrc/v/redpanda/BUILD - Updated PGO configs to use
--config=ltoinstead of the deprecated--config=pgo-base
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .bazelrc | Added new --config=lto mixin with C++ and Rust LTO settings; updated pgo-instrument and pgo-optimize to use the new lto config |
| src/v/redpanda/BUILD | Removed redpanda-specific LTO flag and linkopts selection logic, now handled globally via .bazelrc |
Introduce --config=lto mixin which sets -flto=thin for C++ compile and link. Remove src/v/redpanda specific handling of the link flag, we pass this to all links now. This is effectively a no-op as lld will use LTO mode when inputs have only IR anyway. You can mix --config=lto with other build modes (most usefully, release) even without PGO.
Collaborator
CI test resultstest results on build#80512
|
StephanDollberg
approved these changes
Feb 13, 2026
rockwotj
approved these changes
Feb 14, 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.
Introduce --config=lto mixin which sets -flto=thin for C++ compile and link. Remove src/v/redpanda specific handling of the link flag, we pass this to all links now. This is effectively a no-op as lld will use LTO mode when inputs have only IR anyway.
You can mix --config=lto with other build modes (most usefully, release) even without PGO.
Backports Required
Release Notes