Skip to content

Route Clang LTO to ThinLTO and honor linker job budgets - #6

Open
minelogy-dev wants to merge 2 commits into
mainfrom
feat/clang-lto-parallelism
Open

minelogy-dev wants to merge 2 commits into
mainfrom
feat/clang-lto-parallelism

Conversation

@minelogy-dev

@minelogy-dev minelogy-dev commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

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.

minelogy-dev and others added 2 commits October 23, 2026 10:29
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>
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.

1 participant