From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH v2 3/5] kbuild: call cc-option with the current set of KBUILD_CFLAGS
Date: Thu, 10 May 2018 14:29:49 +0900 [thread overview]
Message-ID: <CAK7LNATnJ_xi7nFLA5-MeP=86bK19Z9-L=muCW8LKoDYBpDHGA@mail.gmail.com> (raw)
In-Reply-To: <20180510051659.15356-4-npiggin@gmail.com>
2018-05-10 14:16 GMT+09:00 Nicholas Piggin <npiggin@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@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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Best Regards
Masahiro Yamada
next prev parent reply other threads:[~2018-05-10 5:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-10 5:16 [PATCH v2 0/5] kbuild and powerpc patches for new Kconfig language Nicholas Piggin
2018-05-10 5:16 ` [PATCH v2 1/5] powerpc/kbuild: set default generic machine type for 32-bit compile Nicholas Piggin
2018-05-10 13:10 ` Segher Boessenkool
2018-05-10 13:24 ` Nicholas Piggin
2018-05-10 14:29 ` Segher Boessenkool
2018-05-10 14:52 ` Segher Boessenkool
2018-05-10 5:16 ` [PATCH v2 2/5] powerpc/kbuild: remove CROSS32 defines from top level powerpc Makefile Nicholas Piggin
2018-05-10 5:16 ` [PATCH v2 3/5] kbuild: call cc-option with the current set of KBUILD_CFLAGS Nicholas Piggin
2018-05-10 5:29 ` Masahiro Yamada [this message]
2018-05-10 6:09 ` Nicholas Piggin
2018-05-10 5:16 ` [PATCH v2 4/5] powerpc/kbuild: Use flags variables rather than overriding LD/CC/AS Nicholas Piggin
2018-05-10 13:03 ` Michael Ellerman
2018-05-10 13:11 ` Nicholas Piggin
2018-05-10 5:16 ` [PATCH v2 5/5] powerpc/kbuild: move -mprofile-kernel check to Kconfig Nicholas Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAK7LNATnJ_xi7nFLA5-MeP=86bK19Z9-L=muCW8LKoDYBpDHGA@mail.gmail.com' \
--to=yamada.masahiro@socionext.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).