[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNARhhp2cJw=yxJTdB0_Cs4mBkkeHmNp7B9RYne92WXBQyw@mail.gmail.com>
Date: Tue, 13 Jun 2017 19:13:55 +0900
From: Masahiro Yamada <yamada.masahiro@...ionext.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Michal Marek <mmarek@...e.com>,
Matthias Kaehlcke <mka@...omium.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H . Peter Anvin" <hpa@...or.com>,
"H . J . Lu" <hjl.tools@...il.com>,
David Woodhouse <dwmw2@...radead.org>,
"the arch/x86 maintainers" <x86@...nel.org>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Michael Davidson <md@...gle.com>,
Greg Hackmann <ghackmann@...gle.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Stephen Hines <srhines@...gle.com>,
Kees Cook <keescook@...omium.org>,
Bernhard.Rosenkranzer@...aro.org,
Peter Foley <pefoley2@...oley.com>,
Behan Webster <behanw@...verseincode.com>,
Douglas Anderson <dianders@...omium.org>
Subject: Re: [PATCH 1/3] kbuild: Add cc-option-no-kbuild macro
2017-06-13 17:31 GMT+09:00 Arnd Bergmann <arnd@...db.de>:
> On Tue, Jun 13, 2017 at 9:49 AM, Michal Marek <mmarek@...e.com> wrote:
>> On 2017-06-13 02:55, Matthias Kaehlcke wrote:
>>> 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-no-kbuild which does the same as cc-option
>>> except that it has an additional parameter with the compiler options
>>> which are used instead of KBUILD_CFLAGS and KBUILD_CPPFLAGS.
>>>
>>> Signed-off-by: Matthias Kaehlcke <mka@...omium.org>
>>> ---
>>> scripts/Kbuild.include | 5 +++++
>>> 1 file changed, 5 insertions(+)
>>>
>>> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
>>> index 61f87a99bf0a..d9fdc740105f 100644
>>> --- a/scripts/Kbuild.include
>>> +++ b/scripts/Kbuild.include
>>> @@ -128,6 +128,11 @@ cc-option-yn = $(call try-run,\
>>> cc-option-align = $(subst -functions=0,,\
>>> $(call cc-option,-falign-functions=0,-malign-functions=0))
>>>
>>> +# cc-option-no-kbuild
>>> +# Usage: cflags-no-kbuild-y += $(call cc-option-no-kbuild,<other flags>,-march=winchip-c6,-march=i586)
>>> +cc-option-no-kbuild = $(call try-run,\
>>> + $(CC) -Werror $(filter-out $(GCC_PLUGINS_CFLAGS),$(1)) $(2) -c -x c /dev/null -o "$$TMP",$(2),$(3))
>>
>> As this is a version of cc-option with an extrra argument, how about
>> implementing cc-option as a shorthand for cc-option-no-kbuild? It would
>> make it more obvious what cc-option-no-kbuild does differently (it's
>> probably just me, but I was unable to infer the semantics from its name).
>
> Agreed, also the hostcc-option could be based on the same I think, if we
> also make the $(CC) an argument of the low-level helper.
>
Agree. One possible implementation:
cc-option-raw = $(call try-run,\
$(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4))
cc-option = $(call cc-option-raw, $(CC), $(KBUILD_CPPFLAGS)
$(CC_OPTION_CFLAGS),\
$(1), $(2))
This will allow us to do:
hostcc-option = $(call cc-option-raw, $(HOSTCC), $(HOSTCFLAGS), $(1), $(2))
Suggestion for a better name is welcome...
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists