gh-132257: Remove -flto-partition=none for Linux LTO builds (GH-132258)

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.
This commit is contained in:
Ken Jin 2025-04-11 16:06:05 +08:00 committed by GitHub
parent 07b8d3117f
commit bc0b94b30c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 2 deletions

View file

@ -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.

2
configure generated vendored
View file

@ -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
;;

View 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
;;