History

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.

Alexander Lobakin committed 5 years ago

Commit 2b868951 parent 112b6a81 file · +2 −2Browse files

Unified · Split

Makefile+2−2
@@ -895,10 +895,10 @@ endif · 894 unmodified lines
895 895
896ifdef CONFIG_LTO_CLANG896ifdef CONFIG_LTO_CLANG
897ifdef CONFIG_LTO_CLANG_THIN897ifdef CONFIG_LTO_CLANG_THIN
898CC_FLAGS_LTO += -flto=thin -fsplit-lto-unit898CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit
899KBUILD_LDFLAGS += --thinlto-cache-dir=$(extmod-prefix).thinlto-cache899KBUILD_LDFLAGS += --thinlto-cache-dir=$(extmod-prefix).thinlto-cache
900else900else
901CC_FLAGS_LTO += -flto901CC_FLAGS_LTO := -flto
902endif902endif
903CC_FLAGS_LTO += -fvisibility=hidden903CC_FLAGS_LTO += -fvisibility=hidden
904 904