Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
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.
37 changes: 36 additions & 1 deletion configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1914,6 +1914,19 @@ then
fi
fi

# Look for parallel LTO support in GCC to speed up builds.
AC_CACHE_CHECK([If GCC version supports parallel LTO],
[ac_cv_gcc_parallel_lto],
[AC_PREPROC_IFELSE([AC_LANG_SOURCE([
#if defined(__GNUC__) && (__GNUC__ >= 8)
/* GCC parallel LTO supported! */
#else
#error "GCC parallel lto unsupported"
#endif
], [])],
[ac_cv_gcc_parallel_lto=yes],
[ac_cv_gcc_parallel_lto=no])])

# Enable LTO flags
AC_MSG_CHECKING([for --with-lto])
AC_ARG_WITH([lto],
Expand Down Expand Up @@ -2031,7 +2044,12 @@ if test "$Py_LTO" = 'true' ; then
LTOCFLAGS="-flto"
;;
*)
LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
if test $ac_cv_gcc_parallel_lto = yes
then
LTOFLAGS="-flto=auto -fuse-linker-plugin -ffat-lto-objects"
else
LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects"
fi
;;
esac
;;
Expand Down
Loading