Skip to content

gh-137403: Pass auto to -flto with gcc to parallelize LTO build on linux #137404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

tacaswell
Copy link
Contributor

@tacaswell tacaswell commented Aug 5, 2025

Currently when building CPython with loto (./configure --with-lto) on linux with gcc gives a number of similar warnings:

lto-wrapper: warning: using serial compilation of 70 LTRANS jobs
lto-wrapper: note: see the ‘-flto’ option documentation for more information

To fix this pass the -flot=auto to allow gcc to run the lto jobs in parallel. If no value is passed the default in 1 at a time.

The ability to pass auto goes back goc at least gcc 10 [1].

A similar change can be made on Darwin, but did not make that change without testing.

This significantly speeds up the build process when using lto (dependent on the number of cores available).

[1] https://gcc.gnu.org/onlinedocs/gcc-10.1.0/gcc/Optimize-Options.html

Currently when building CPython with loto (./configure --with-lto) on
linux with gcc gives a number of similar warnings:

  lto-wrapper: warning: using serial compilation of 70 LTRANS jobs
  lto-wrapper: note: see the ‘-flto’ option documentation for more information

To fix this pass the -flot=auto to allow gcc to run the lto jobs in parallel.
If no value is passed the default in 1 at a time.

The ability to pass auto goes back goc at least gcc 10 [1].

A similar change can be made on Darwin, but did not make that change without
testing.

This significantly speeds up the build process when using lto (dependent on
the number of cores available).

[1] https://gcc.gnu.org/onlinedocs/gcc-10.1.0/gcc/Optimize-Options.html
@Fidget-Spinner
Copy link
Member

I documented why this isn't intended here #137403 (comment)

@tacaswell tacaswell deleted the bld/parallel_gcc_lto branch August 6, 2025 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants