blob: 7a5938175423cd939884d269993c9cb73af0e35a [file] [log] [blame]
From aeb41a5722e0ec9754eae57f49d26853c9ed40cf Mon Sep 17 00:00:00 2001
From: Masahiro Yamada <>
Date: Sat, 18 Jan 2020 02:14:35 +0900
Subject: [PATCH] kbuild: use -S instead of -E for precise cc-option test in
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
commit 3bed1b7b9d79ca40e41e3af130931a3225e951a3 upstream.
Currently, -E (stop after the preprocessing stage) is used to check
whether the given compiler flag is supported.
While it is faster than -S (or -c), it can be false-positive. You need
to run the compilation proper to check the flag more precisely.
For example, -E and -S disagree about the support of
"--param asan-instrument-allocas=1".
$ gcc -Werror --param asan-instrument-allocas=1 -E -x c /dev/null -o /dev/null
$ echo $?
$ gcc -Werror --param asan-instrument-allocas=1 -S -x c /dev/null -o /dev/null
cc1: error: invalid --param name asan-instrument-allocas’; did you mean asan-instrument-writes’?
$ echo $?
Signed-off-by: Masahiro Yamada <>
Signed-off-by: Paul Gortmaker <>
diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include
index 4bbf4fc163a2..35d6c4f8da46 100644
--- a/scripts/Kconfig.include
+++ b/scripts/Kconfig.include
@@ -25,7 +25,7 @@ failure = $(if-success,$(1),n,y)
# $(cc-option,<flag>)
# Return y if the compiler supports <flag>, n otherwise
-cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -E -x c /dev/null -o /dev/null)
+cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -S -x c /dev/null -o /dev/null)
# $(ld-option,<flag>)
# Return y if the linker supports <flag>, n otherwise