GeezerVison is showing github.com — gh-161821: Fall back to lld for Clang LTO builds by nascheme · Pull Request #161822 · python/cpython
Conversation
nascheme
commented
Nov 11, 2026
•
edited by bedevere-app
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Clang LTO with a GNU linker needs the LLVMgold.so plugin, which some distributions (e.g. Debian 13) don't ship. When using Clang with --with-lto on non-macOS platforms, configure now test-links an LTO program and, if that fails, retries with -fuse-ld=lld.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Clang LTO with a GNU linker needs the LLVMgold.so plugin, which some
distributions (e.g. Debian 13) don't ship. When using Clang with
--with-lto on non-macOS platforms, configure now test-links an LTO
program and, if that fails, retries with -fuse-ld=lld.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of minor nits/suggestions but otherwise looks good!
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
than macOS, configure tries ``-fuse-ld=lld`` if the configured linker cannot
|
|
|
link a Clang LTO program.
|
|
|
|
|
|
.. versionchanged:: 3.16
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
.. versionchanged:: 3.16 |
|
.. versionchanged:: next |
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+2226
to
+2227
|
|
save_LDFLAGS="$LDFLAGS"
|
|
|
LDFLAGS="$LDFLAGS $LDFLAGS_NODIST $LTOFLAGS"
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to use the SAVE_ENV macro here
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried this on Debian trixie with clang 19 (trixie has no clang-20). LLVMgold.so comes with llvm-19-linker-tools there, so I removed it to get the failing setup:
- main: configure passes, then the first LTO link fails with
/usr/bin/ld: .../LLVMgold.so: error loading plugin.
- this PR with lld-19 installed: configure falls back to lld, and
python and the extension modules link with LLD 19.1.7. Same with --enable-shared, and test_sysconfig, test_embed and test_ctypes pass. -fuse-ld=lld stays out of sysconfig's LDFLAGS, so third-party extensions aren't affected.
- without lld: configure stops with the new error message.
- with LLVMgold.so present: the first check passes and GNU ld is kept.
A full --enable-optimizations --with-lto build works with the lld fallback too.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|