[PATCH v2 3/5] kbuild: call cc-option with the current set of KBUILD_CFLAGS
Masahiro Yamada
yamada.masahiro at socionext.com
Thu May 10 15:29:49 AEST 2018
2018-05-10 14:16 GMT+09:00 Nicholas Piggin <npiggin at gmail.com>:
> In some cases, the options that gcc will accept depend on options it
> has already been given. For example -m32 / -m64 and -mbig-endian /
> -mlittle-endian can have this affect.
Is cc-option not working for you?
> Passing in KBUILD_CFLAGS to cc-option allows an architecture to
> set such basic machine types at the beginning, rather than override
> CC itself.
KBUILD_CFLAGS is passed to cc-option already
because CC_OPTION_CFLAGS includes it:
CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
This patch drops KBUILD_CPPFLAGS,
and adds KBUILD_CFLAGS twice, doesn't it?
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---
> scripts/Kbuild.include | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> index 9f7eb10079cc..66869bb815d2 100644
> --- a/scripts/Kbuild.include
> +++ b/scripts/Kbuild.include
> @@ -121,7 +121,7 @@ CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
> # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
>
> cc-option = $(call __cc-option, $(CC),\
> - $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS),$(1),$(2))
> + $(KBUILD_CFLAGS) $(CC_OPTION_CFLAGS),$(1),$(2))
>
> # hostcc-option
> # Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586)
> @@ -131,12 +131,12 @@ hostcc-option = $(call __cc-option, $(HOSTCC),\
> # cc-option-yn
> # Usage: flag := $(call cc-option-yn,-march=winchip-c6)
> cc-option-yn = $(call try-run,\
> - $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
> + $(CC) -Werror $(KBUILD_CFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
>
> # cc-disable-warning
> # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
> cc-disable-warning = $(call try-run,\
> - $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
> + $(CC) -Werror $(KBUILD_CFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
>
> # cc-name
> # Expands to either gcc or clang
> @@ -160,7 +160,7 @@ cc-if-fullversion = $(shell [ $(cc-fullversion) $(1) $(2) ] && echo $(3) || echo
> # cc-ldoption
> # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
> cc-ldoption = $(call try-run,\
> - $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
> + $(CC) $(1) $(KBUILD_CFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
>
> # ld-option
> # Usage: LDFLAGS += $(call ld-option, -X)
> --
> 2.17.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Best Regards
Masahiro Yamada
More information about the Linuxppc-dev
mailing list