Skip to content

gh-161821: Fall back to lld for Clang LTO builds - #161822

Open
nascheme wants to merge 1 commit into
python:mainfrom
nascheme:gh-161821-lto-lld
Open

nascheme wants to merge 1 commit into
python:mainfrom
nascheme:gh-161821-lto-lld

Conversation

@nascheme

@nascheme nascheme commented Nov 11, 2026 •

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.

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
@nascheme
nascheme marked this pull request as ready for review November 11, 2026 21:56

@emmatyping emmatyping left a comment

Copy link
Copy Markdown
Member

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!

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

Copy link
Copy Markdown
Member

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

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

Copy link
Copy Markdown
Member

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

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants