Skip to content

Conversation

@illwieckz
Copy link
Member

Use -flto=auto compiler flag when supported, this silence this GCC warning:

lto-wrapper: warning: using serial compilation of # LTRANS jobs

This also greatly speeds-up the linkage time as it enables LTO multithreading in GCC (either by using Make jobserver if detected, either by detecting CPU cores).

Use -flto=auto compiler flag when supported, this silence this
GCC warning:

> lto-wrapper: warning: using serial compilation of # LTRANS jobs

This also greatly speeds-up the linkage time as it enables LTO
multithreading in GCC (either by using Make jobserver if detected,
either by detecting CPU cores).
@slipher
Copy link
Member

slipher commented Mar 2, 2025

LGTM. I tried on MSYS2 and it didn't break anything, although the parallelism didn't really appear to work. Running under Ninja, there were 6 processes but only one of them ever used the CPU at a time.

@DolceTriade
Copy link
Contributor

🤷 If we want faster linking, we should just use mold or one of the new fancy linkers, but no harm so LGTM

@illwieckz
Copy link
Member Author

I tested with:

clang-10
clang-11
clang-12
clang-13
clang-14
clang-15
clang-16
clang-17
clang-18
clang-19
clang-20
gcc-10
gcc-11
gcc-12
gcc-13
gcc-14
mingw
icx
aocc
icc
zig
apple-clang
freebsd-clang

Either the flag is used and there is no error, either the flag is not used because detected as unsupported. I haven't checked one by one how it ended, but in all cases this never failed neither printed obvious warnings.

@illwieckz illwieckz merged commit 4ee12e1 into master Mar 3, 2025
10 checks passed
@illwieckz illwieckz deleted the illwieckz/flto-auto branch March 3, 2025 07:38
@illwieckz illwieckz added A-Build T-Improvement Improvement for an existing feature labels Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Build T-Improvement Improvement for an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants