summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Chancellor <nathan@kernel.org>2022-10-13 11:12:49 -0700
committerTreehugger Robot <treehugger-gerrit@google.com>2022-10-14 08:29:03 +0000
commit911f8b88a1dd70cb97fbaf15a5fd83ea054a77a5 (patch)
treee6ec71a4bc986163b0ff121d37eaa889a7725dee
parentfb269781c8a6b34e18f8957964e129a20b31b335 (diff)
downloadcommon-911f8b88a1dd70cb97fbaf15a5fd83ea054a77a5.tar.gz
ANDROID: kbuild: Wrap zero trivial-auto-var-init enablement flag with cc-option
Starting with LLVM 16, this flag is deprecated, which means its presence breaks the build: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler make[2]: *** [../Makefile:1289: prepare-compiler-check] Error 1 clang-16: warning: the flag '-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang' has been deprecated and will be ignored [-Wunused-command-line-argument] clang-16: warning: the flag '-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang' has been deprecated and will be ignored [-Wunused-command-line-argument] Wrap this option in cc-option so that it only gets added to the list of flags when it is supported. This is resolved properly upstream already with commit 607e57c6c62c ("hardening: Remove Clang's enable flag for -ftrivial-auto-var-init=zero") but that cannot be easily backported due to lack of cc-option support in Kconfig, hence this downstream only change. Change-Id: Ie1f7bcdec23f01bf19c68b4dae460923aaa150c9 Fixes: a7eda6eddca5 ("BACKPORT: security: allow using Clang's zero initialization for stack variables") Link: https://github.com/llvm/llvm-project/commit/aef03c9b3bed5cef5a1940774b80128aefcb4095 Signed-off-by: Nathan Chancellor <nathan@kernel.org>
-rw-r--r--Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 66ce056fcd16..6d6648a50caa 100644
--- a/Makefile
+++ b/Makefile
@@ -780,7 +780,7 @@ ifdef CONFIG_INIT_STACK_ALL_ZERO
# https://bugs.llvm.org/show_bug.cgi?id=45497. These flags are subject to being
# renamed or dropped.
KBUILD_CFLAGS += -ftrivial-auto-var-init=zero
-KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
+KBUILD_CFLAGS += $(call cc-option, -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang)
endif
KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments)