Repository navigation
Route Clang LTO to ThinLTO and honor linker job budgets - #6
Open
minelogy-dev wants to merge 2 commits into
Open
minelogy-dev wants to merge 2 commits into
minelogy-dev wants to merge 2 commits into
Conversation
Keep the existing LTO switch while moving Clang-specific policy into its backend. Honor explicit LLD and linker paths, translate job budgets for GNU LLVM plugins and ELF LLD, and cover real multi-module links in CI. Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
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.
Clang targets previously used implicit Full LTO and did not pass the build's job budget to the LTO backend. Keep the existing ENABLE/DISABLE contract: GCC retains native LTO, while Clang now selects ThinLTO at compilation and link time. No shared Full/Thin mode enum is introduced.
Clang-specific policy stays in its backend. On Linux, the default GNU linker/LLVM plugin receives -plugin-opt,jobs=N; explicitly selected ELF LLD receives --thinlto-jobs=N and --threads=N, including N=1. TARGET_LINKER=LLD now selects the actual linker, and TARGET_LINKER_PATH supports a matching versioned executable. Missing tools/plugins fail normally instead of silently disabling LTO. This intentionally changes Clang's default LTO strategy; docs/LTO.md explains dependencies, migration and raw-option overrides.
Validation: GCC 14 and Clang 19 each passed all 14 tests locally with ASan, UBSan and leak detection enabled, including required real multi-module links and executable execution through GNU/LLVM-plugin and LLD routes, LTO-disabled builds, and relinking after a job-budget change. Strict warnings with both compilers, GCC static analysis, Actionlint, whitespace checks and full-history Gitleaks passed. CI installs LLD 19 and requires the new scenarios to execute; toolchain downloads use Ubuntu's official HTTPS mirror with bounded timeouts and retries.
Hosted validation: CI and CodeQL passed for 29aa8b5 on Ubuntu 24.04. GCC 14 and Clang 19 each passed all 14 tests, including the required real ThinLTO scenarios.
I confirm that I have read and agree to the license terms, including
all additional permissions and additional terms, as stated in
CONTRIBUTING.md.