]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-132257: Remove -flto-partition=none for Linux LTO builds (GH-132258)
authorKen Jin <kenjin@python.org>
Fri, 11 Apr 2025 08:06:05 +0000 (16:06 +0800)
committerGitHub <noreply@github.com>
Fri, 11 Apr 2025 08:06:05 +0000 (16:06 +0800)
Change the default LTO flags on GCC to not pass -flto-partition=none, and allow parallelization of LTO. This has a multiple factor speedup for LTO build times on GCC, with no noticeable loss in performance.

On newer make and newer GCC, this passes the jobserver automatically to GCC (or more like GCC grabs it from the env vars).

On older make, this will have benign warnings about serial compilation. It's safe to ignore them.

Misc/NEWS.d/next/Build/2025-04-08-09-11-32.gh-issue-132257.oZWBV-.rst [new file with mode: 0644]
configure
configure.ac

diff --git a/Misc/NEWS.d/next/Build/2025-04-08-09-11-32.gh-issue-132257.oZWBV-.rst b/Misc/NEWS.d/next/Build/2025-04-08-09-11-32.gh-issue-132257.oZWBV-.rst
new file mode 100644 (file)
index 0000000..5bf20d2
--- /dev/null
@@ -0,0 +1 @@
+Change the default LTO flags on GCC to not pass ``-flto-partition=none``, and allow parallelization of LTO. For newer GNU makes and GCC, this has a multiple factor speedup for LTO build times, with no noticeable loss in performance.
index 24a7d1d43f0467fa9203b407e31bd33708aecb14..decb8f2449d1621764bd905b5f3cddb20ef747f2 100755 (executable)
--- a/configure
+++ b/configure
@@ -8894,7 +8894,7 @@ fi
           LTOCFLAGS="-flto"
           ;;
         *)
-          LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
+          LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects"
           ;;
       esac
       ;;
index bc6479c048f7453b8259e127ab9c9a282512d161..004797b5233c20700ad04b5025272a27c71e259d 100644 (file)
@@ -2031,7 +2031,7 @@ if test "$Py_LTO" = 'true' ; then
           LTOCFLAGS="-flto"
           ;;
         *)
-          LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
+          LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects"
           ;;
       esac
       ;;