GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-161821: Fall back to lld for Clang LTO builds by nascheme · Pull Request #161822 · python/cpython

Conversation

@nascheme

@nascheme nascheme commented Nov 11, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

  • Issue: Building with LTO and Clang 20 on Debian fails to link #161821

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nascheme
pythongh-161821: Fall back to lld for Clang LTO builds
f74b453
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.
@nascheme nascheme added the build The build process and cross-build label Nov 11, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Nov 11, 2026
Building with LTO and Clang 20 on Debian fails to link #161821
Open
@nascheme nascheme added the OS-linux label Nov 11, 2026
@nascheme
nascheme marked this pull request as ready for review November 11, 2026 21:56
@nascheme
nascheme requested review from AA-Turner, corona10, emmatyping, erlend-aasland and itamaro as code owners November 11, 2026 21:56
@bedevere-app bedevere-app Bot added the awaiting core review label Nov 11, 2026
emmatyping
emmatyping reviewed Nov 11, 2026
View reviewed changes

@emmatyping emmatyping left a comment

Copy link
Copy Markdown
Member

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.

All reactions
Comment thread Doc/using/configure.rst
than macOS, configure tries ``-fuse-ld=lld`` if the configured linker cannot
link a Clang LTO program.

.. versionchanged:: 3.16

@emmatyping emmatyping Nov 11, 2026

Copy link
Copy Markdown
Member

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.

Suggested change
.. versionchanged:: 3.16
.. versionchanged:: next

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread configure.ac
Comment on lines +2226 to +2227
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $LDFLAGS_NODIST $LTOFLAGS"

@emmatyping emmatyping Nov 11, 2026

Copy link
Copy Markdown
Member

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.

All reactions
aozmekik
aozmekik reviewed Nov 12, 2026
View reviewed changes

@aozmekik aozmekik left a comment

Copy link
Copy Markdown
Contributor

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.

All reactions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@emmatyping emmatyping emmatyping left review comments
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner
@corona10 corona10 Awaiting requested review from corona10 corona10 is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner
@itamaro itamaro Awaiting requested review from itamaro itamaro is a code owner
+1 more reviewer
@aozmekik aozmekik aozmekik left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting core review build The build process and cross-build OS-linux

Projects

None yet

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.

3 participants

@nascheme @emmatyping @aozmekik
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.