From cb7def0bd6ed63767a6c5e9394a6cbfda3942733 Mon Sep 17 00:00:00 2001 From: Yu-Chun Lin Date: Sat, 21 Dec 2024 14:58:16 +0800 Subject: [PATCH] Fix LTO warning by enabling parallel compilation 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 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f0928fdef..dc0f213a9 100644 --- a/Makefile +++ b/Makefile @@ -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