summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMatthias Kaehlcke <mka@chromium.org>2017-06-21 16:28:03 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-27 16:07:59 +0100
commitbf6401610af484e94afdd9534e706e9bef5fbe5c (patch)
tree904d5359fda935f35214e133876db6982113323e /scripts
parentee43aaa95604334e35dba586bbf5910984498d7d (diff)
kbuild: Add __cc-option macro
commit 9f3f1fd299768782465cb32cdf0dd4528d11f26b upstream. cc-option uses KBUILD_CFLAGS and KBUILD_CPPFLAGS when it determines whether an option is supported or not. This is fine for options used to build the kernel itself, however some components like the x86 boot code use a different set of flags. Add the new macro __cc-option which is a more generic version of cc-option with additional parameters. One parameter is the compiler with which the check should be performed, the other the compiler options to be used instead KBUILD_C*FLAGS. Refactor cc-option and hostcc-option to use __cc-option and move hostcc-option to scripts/Kbuild.include. Suggested-by: Arnd Bergmann <arnd@arndb.de> Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Michal Marek <mmarek@suse.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> [nc: Fix conflicts due to lack of CC_OPTION_CFLAGS and hostcc-option wasn't added until v4.8 so no point including it in this tree] Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Kbuild.include9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 9f634b50e57b..5e9cf7d146f0 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -108,11 +108,16 @@ as-option = $(call try-run,\
as-instr = $(call try-run,\
printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
+# __cc-option
+# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
+__cc-option = $(call try-run,\
+ $(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4))
+
# cc-option
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
-cc-option = $(call try-run,\
- $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
+cc-option = $(call __cc-option, $(CC),\
+ $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS),$(1),$(2))
# cc-option-yn
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)