Skip to content

Commit 61fcdd7

Browse files
committed
Enable full LTO on Python 3.12 and 3.13
1 parent aa430e2 commit 61fcdd7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cpython-unix/build-cpython.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,9 @@ if [ -n "${CPYTHON_OPTIMIZED}" ]; then
427427
fi
428428

429429
if [ -n "${CPYTHON_LTO}" ]; then
430-
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --with-lto"
430+
# On Python 3.12 and 3.13, `--with-lto` enables thinLTO by default, while on other versions it
431+
# enables full LTO. We prefer runtime performance over build time, so force full on all versions.
432+
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --with-lto=full"
431433
fi
432434

433435
# Python 3.11 introduces a --with-build-python to denote the host Python.

0 commit comments

Comments
 (0)