Skip to content

Commit 2b86895

Browse files
solbjornkees
authored andcommitted
kbuild: prevent CC_FLAGS_LTO self-bloating on recursive rebuilds
CC_FLAGS_LTO gets initialized only via +=, never with := or =. When building with CONFIG_TRIM_UNUSED_KSYMS, Kbuild may perform several kernel rebuilds to satisfy symbol dependencies. In this case, value of CC_FLAGS_LTO is concatenated each time, which triggers a full rebuild. Initialize it with := to fix this. Fixes: dc5723b ("kbuild: add support for Clang LTO") Signed-off-by: Alexander Lobakin <alobakin@pm.me> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20210121184544.659998-1-alobakin@pm.me
1 parent 112b6a8 commit 2b86895

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,10 +895,10 @@ endif
895895

896896
ifdef CONFIG_LTO_CLANG
897897
ifdef CONFIG_LTO_CLANG_THIN
898-
CC_FLAGS_LTO += -flto=thin -fsplit-lto-unit
898+
CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit
899899
KBUILD_LDFLAGS += --thinlto-cache-dir=$(extmod-prefix).thinlto-cache
900900
else
901-
CC_FLAGS_LTO += -flto
901+
CC_FLAGS_LTO := -flto
902902
endif
903903
CC_FLAGS_LTO += -fvisibility=hidden
904904

0 commit comments

Comments
 (0)