Skip to content

Commit ca64aa3

Browse files
masahir0ygregkh
authored andcommitted
kbuild: use -S instead of -E for precise cc-option test in Kconfig
[ Upstream commit 3bed1b7 ] 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 $? 0 $ 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 $? 1 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ee33c38 commit ca64aa3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎scripts/Kconfig.include‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ failure = $(if-success,$(1),n,y)
2525

2626
# $(cc-option,<flag>)
2727
# Return y if the compiler supports <flag>, n otherwise
28-
cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -E -x c /dev/null -o /dev/null)
28+
cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -S -x c /dev/null -o /dev/null)
2929

3030
# $(ld-option,<flag>)
3131
# Return y if the linker supports <flag>, n otherwise

0 commit comments

Comments
 (0)