Skip to content

Use LLVM tools including lld for native Linux builds - #1327

Merged
jjhelmus merged 4 commits into
mainfrom
jjh/use_lld_native
Oct 14, 2026
Merged

jjhelmus merged 4 commits into
mainfrom
jjh/use_lld_native

Conversation

@jjhelmus

@jjhelmus jjhelmus commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Use the bundled LLVM tools for native Linux builds including lld for linking.
Remove the separate binutils build.
Cross-compilation continues to use GCC and the cross linker from binutils provided by Debian.

In support of this change the following minor modification were needed:

  • Update musl’s linker wrapper for static builds
  • Make the glibc version detection work with LLVM objdump
  • Remove new build-only linker flags from Python _sysconfig data.

Extract GLIBC version strings without relying on the column layout used
by GNU objdump. Only inspect shared libraries on Linux when using glibc.
Add host linker flag (host_ldflags) support to target settings.

Forward host and target linker flags to dependency configure scripts.
Install aliases for the LLVM tools and use lld for Linux builds.
This removes the need for building binutils.

Update the musl linker wrapper for lld which has different behavior than
ld.
Delete the binutils build script, toolchain rule, and download.
Linux builds now use the bundled LLVM tools including lld.
@jjhelmus jjhelmus added platform:darwin Specific to the macOS platform platform:linux Specific to the Linux platform python:all Select all Python versions arch:all Select all architectures build:all and removed platform:darwin Specific to the macOS platform labels Oct 9, 2026
@jjhelmus
jjhelmus added this pull request to stack #1335 October 13, 2026 18:37
@jjhelmus
jjhelmus requested a review from EliteTK October 13, 2026 23:49
Comment thread cpython-unix/build-bdb.sh
fi

CFLAGS="${CFLAGS}" CPPFLAGS="${CFLAGS}" ../dist/configure \
CFLAGS="${CFLAGS}" CPPFLAGS="${CFLAGS}" LDFLAGS="${EXTRA_TARGET_LDFLAGS}" ../dist/configure \

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.

Do we intend to replace the LDFLAGS completely or should this just append?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. EXTRA_TARGET_LDFLAGS is exported by the build driver based on the flags specified in targets.yaml. The name is not idea but these are the starting LDFLAGS, similar to CFLAGS, etc. This should have been included for some time but was left out.

@jjhelmus
jjhelmus merged commit 968717d into main Oct 14, 2026
504 checks passed
@jjhelmus
jjhelmus deleted the jjh/use_lld_native branch October 14, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch:all Select all architectures build:all platform:linux Specific to the Linux platform python:all Select all Python versions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants