Skip to content

Commit

Permalink
Fix LTO warning by enabling parallel compilation
Browse files Browse the repository at this point in the history
When using make for builds, the following warning is observed:
lto-wrapper: warning: using serial compilation of 2 LTRANS jobs.

To address this, -flto=auto is now used.

According to GCC optimization options [1], use -flto=auto to use GNU
make's job server, if available, or otherwise fall back to
autodetection of the number of CPU threads present in your system.

While this patch does not fully suppress the warning in certain GCC
versions (11.4 or later but below 12), it improves build performance by
enabling parallel LTO compilation whenever possible.

[1] https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
  • Loading branch information
eleanorLYJ committed Dec 24, 2024
1 parent 5b90d0f commit cb7def0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ CFLAGS += -flto
endif
endif
ifeq ("$(CC_IS_GCC)", "1")
CFLAGS += -flto
CFLAGS += -flto=auto
endif
ifeq ("$(CC_IS_CLANG)", "1")
CFLAGS += -flto=thin -fsplit-lto-unit
Expand Down

0 comments on commit cb7def0

Please sign in to comment.