https://github.com/python/cpython/commit/a497a11c46c2bf096dd544e7a422cc457e806916 commit: a497a11c46c2bf096dd544e7a422cc457e806916 branch: main author: Vismay <[email protected]> committer: itamaro <[email protected]> date: 2026-11-08T02:46:48Z summary:
gh-153285: Preserve LTO target names on macOS (#153532) With `--with-lto` on macOS, linker flags include Make's `$@` target variable. Immediate expansion in `PY_CORE_EXE_LDFLAGS` erased the target name, causing executable links to share an LTO object path. Parallel links could then produce incorrect executables and cause `test_embed` failures. Use recursive assignment (`=` instead of `:=`) so `$@` expands when each link recipe runs. files: A Misc/NEWS.d/next/Build/2026-07-11-01-53-58.gh-issue-153285.YmSox4.rst M Makefile.pre.in diff --git a/Makefile.pre.in b/Makefile.pre.in index f1b5eb3bba34fd1..3955afae436e9c5 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -135,7 +135,7 @@ PY_CORE_CFLAGS= $(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE # LDFLAGS used to build executables and shared targets. PY_CORE_LDFLAGS=$(PY_LDFLAGS) $(PY_LDFLAGS_NODIST) CONFIGURE_EXE_LDFLAGS=@EXE_LDFLAGS@ -PY_CORE_EXE_LDFLAGS:= $(if $(CONFIGURE_EXE_LDFLAGS), $(CONFIGURE_EXE_LDFLAGS) $(PY_LDFLAGS_NODIST), $(PY_CORE_LDFLAGS)) +PY_CORE_EXE_LDFLAGS= $(if $(CONFIGURE_EXE_LDFLAGS), $(CONFIGURE_EXE_LDFLAGS) $(PY_LDFLAGS_NODIST), $(PY_CORE_LDFLAGS)) # Strict or non-strict aliasing flags used to compile dtoa.c, see above CFLAGS_ALIASING=@CFLAGS_ALIASING@ # Compilation flags only for ceval.c. diff --git a/Misc/NEWS.d/next/Build/2026-07-11-01-53-58.gh-issue-153285.YmSox4.rst b/Misc/NEWS.d/next/Build/2026-07-11-01-53-58.gh-issue-153285.YmSox4.rst new file mode 100644 index 000000000000000..d672c8b9910d76d --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-07-11-01-53-58.gh-issue-153285.YmSox4.rst @@ -0,0 +1,2 @@ +Fix incorrect executable linking on macOS with ``--with-lto`` caused by +premature expansion of Make's ``$@`` target variable. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
