linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gcc-plugins: require GCC
@ 2018-08-11  9:48 Stefan Agner
  2018-08-13  7:38 ` Masahiro Yamada
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Agner @ 2018-08-11  9:48 UTC (permalink / raw)
  To: keescook
  Cc: yamada.masahiro, ast, akpm, jbacik, re.emese, linux-kernel, Stefan Agner

Unsurprisingly GCC plugins require GCC as a compiler. This avoids
GCC plugins being selectable when using clang.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 arch/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 1aa59063f1fd..8c693a837ed7 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -422,7 +422,7 @@ config HAVE_GCC_PLUGINS
 
 menuconfig GCC_PLUGINS
 	bool "GCC plugins"
-	depends on HAVE_GCC_PLUGINS
+	depends on HAVE_GCC_PLUGINS && CC_IS_GCC
 	depends on PLUGIN_HOSTCC != ""
 	help
 	  GCC plugins are loadable modules that provide extra features to the
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] gcc-plugins: require GCC
  2018-08-11  9:48 [PATCH] gcc-plugins: require GCC Stefan Agner
@ 2018-08-13  7:38 ` Masahiro Yamada
  2018-08-13 20:10   ` Kees Cook
  0 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2018-08-13  7:38 UTC (permalink / raw)
  To: Stefan Agner, Kees Cook
  Cc: Alexei Starovoitov, Andrew Morton, jbacik, Emese Revfy,
	Linux Kernel Mailing List

2018-08-11 18:48 GMT+09:00 Stefan Agner <stefan@agner.ch>:
> Unsurprisingly GCC plugins require GCC as a compiler. This avoids
> GCC plugins being selectable when using clang.
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
>  arch/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 1aa59063f1fd..8c693a837ed7 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -422,7 +422,7 @@ config HAVE_GCC_PLUGINS
>
>  menuconfig GCC_PLUGINS
>         bool "GCC plugins"
> -       depends on HAVE_GCC_PLUGINS
> +       depends on HAVE_GCC_PLUGINS && CC_IS_GCC
>         depends on PLUGIN_HOSTCC != ""
>         help
>           GCC plugins are loadable modules that provide extra features to the
> --
> 2.18.0
>

I guess the more correct way is to fix
scripts/gcc-plugin.sh

This shell script should exit 0
only when GCC plugin is supported.

Kees?



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gcc-plugins: require GCC
  2018-08-13  7:38 ` Masahiro Yamada
@ 2018-08-13 20:10   ` Kees Cook
  2018-08-13 20:18     ` Kees Cook
  0 siblings, 1 reply; 6+ messages in thread
From: Kees Cook @ 2018-08-13 20:10 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Stefan Agner, Alexei Starovoitov, Andrew Morton, Josef Bacik,
	Emese Revfy, Linux Kernel Mailing List

On Mon, Aug 13, 2018 at 12:38 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> 2018-08-11 18:48 GMT+09:00 Stefan Agner <stefan@agner.ch>:
>> Unsurprisingly GCC plugins require GCC as a compiler. This avoids
>> GCC plugins being selectable when using clang.
>>
>> Signed-off-by: Stefan Agner <stefan@agner.ch>
>> ---
>>  arch/Kconfig | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/Kconfig b/arch/Kconfig
>> index 1aa59063f1fd..8c693a837ed7 100644
>> --- a/arch/Kconfig
>> +++ b/arch/Kconfig
>> @@ -422,7 +422,7 @@ config HAVE_GCC_PLUGINS
>>
>>  menuconfig GCC_PLUGINS
>>         bool "GCC plugins"
>> -       depends on HAVE_GCC_PLUGINS
>> +       depends on HAVE_GCC_PLUGINS && CC_IS_GCC
>>         depends on PLUGIN_HOSTCC != ""
>>         help
>>           GCC plugins are loadable modules that provide extra features to the
>> --
>> 2.18.0
>>
>
> I guess the more correct way is to fix
> scripts/gcc-plugin.sh
>
> This shell script should exit 0
> only when GCC plugin is supported.

I'm of two minds: we already have the gcc test in Kconfig so we might
want to avoid redundant checks, but maybe the script should be a
"complete" test. I guess the latter. I will send a patch.

-Kees

-- 
Kees Cook
Pixel Security

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gcc-plugins: require GCC
  2018-08-13 20:10   ` Kees Cook
@ 2018-08-13 20:18     ` Kees Cook
  2018-08-13 21:29       ` Stefan Agner
  0 siblings, 1 reply; 6+ messages in thread
From: Kees Cook @ 2018-08-13 20:18 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Stefan Agner, Alexei Starovoitov, Andrew Morton, Josef Bacik,
	Emese Revfy, Linux Kernel Mailing List

On Mon, Aug 13, 2018 at 1:10 PM, Kees Cook <keescook@chromium.org> wrote:
> On Mon, Aug 13, 2018 at 12:38 AM, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
>> 2018-08-11 18:48 GMT+09:00 Stefan Agner <stefan@agner.ch>:
>>> Unsurprisingly GCC plugins require GCC as a compiler. This avoids
>>> GCC plugins being selectable when using clang.
>>>
>>> Signed-off-by: Stefan Agner <stefan@agner.ch>
>>> ---
>>>  arch/Kconfig | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/Kconfig b/arch/Kconfig
>>> index 1aa59063f1fd..8c693a837ed7 100644
>>> --- a/arch/Kconfig
>>> +++ b/arch/Kconfig
>>> @@ -422,7 +422,7 @@ config HAVE_GCC_PLUGINS
>>>
>>>  menuconfig GCC_PLUGINS
>>>         bool "GCC plugins"
>>> -       depends on HAVE_GCC_PLUGINS
>>> +       depends on HAVE_GCC_PLUGINS && CC_IS_GCC
>>>         depends on PLUGIN_HOSTCC != ""
>>>         help
>>>           GCC plugins are loadable modules that provide extra features to the
>>> --
>>> 2.18.0
>>>
>>
>> I guess the more correct way is to fix
>> scripts/gcc-plugin.sh
>>
>> This shell script should exit 0
>> only when GCC plugin is supported.
>
> I'm of two minds: we already have the gcc test in Kconfig so we might
> want to avoid redundant checks, but maybe the script should be a
> "complete" test. I guess the latter. I will send a patch.

Actually, how about we do the test in Kconfig, but ahead of the
script? That will reduce redundancy:

diff --git a/arch/Kconfig b/arch/Kconfig
index 1aa59063f1fd..18f518624e41 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -409,7 +409,7 @@ preferred-plugin-hostcc := $(if-success,[
$(gcc-version) -ge 40800 ],$(HOSTCXX),

 config PLUGIN_HOSTCC
        string
-       default "$(shell,$(srctree)/scripts/gcc-plugin.sh
"$(preferred-plugin-hostcc)" "$(HOSTCXX)" "$(CC)")"
+       default "$(shell,$(srctree)/scripts/gcc-plugin.sh
"$(preferred-plugin-hostcc)" "$(HOSTCXX)" "$(CC)")" if CC_IS_GCC
        help
          Host compiler used to build GCC plugins.  This can be $(HOSTCXX),
          $(HOSTCC), or a null string if GCC plugin is unsupported.


-Kees

-- 
Kees Cook
Pixel Security

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] gcc-plugins: require GCC
  2018-08-13 20:18     ` Kees Cook
@ 2018-08-13 21:29       ` Stefan Agner
  2018-08-14  2:28         ` Masahiro Yamada
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Agner @ 2018-08-13 21:29 UTC (permalink / raw)
  To: Kees Cook
  Cc: Masahiro Yamada, Alexei Starovoitov, Andrew Morton, Josef Bacik,
	Emese Revfy, Linux Kernel Mailing List

On 13.08.2018 22:18, Kees Cook wrote:
> On Mon, Aug 13, 2018 at 1:10 PM, Kees Cook <keescook@chromium.org> wrote:
>> On Mon, Aug 13, 2018 at 12:38 AM, Masahiro Yamada
>> <yamada.masahiro@socionext.com> wrote:
>>> 2018-08-11 18:48 GMT+09:00 Stefan Agner <stefan@agner.ch>:
>>>> Unsurprisingly GCC plugins require GCC as a compiler. This avoids
>>>> GCC plugins being selectable when using clang.
>>>>
>>>> Signed-off-by: Stefan Agner <stefan@agner.ch>
>>>> ---
>>>>  arch/Kconfig | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/arch/Kconfig b/arch/Kconfig
>>>> index 1aa59063f1fd..8c693a837ed7 100644
>>>> --- a/arch/Kconfig
>>>> +++ b/arch/Kconfig
>>>> @@ -422,7 +422,7 @@ config HAVE_GCC_PLUGINS
>>>>
>>>>  menuconfig GCC_PLUGINS
>>>>         bool "GCC plugins"
>>>> -       depends on HAVE_GCC_PLUGINS
>>>> +       depends on HAVE_GCC_PLUGINS && CC_IS_GCC
>>>>         depends on PLUGIN_HOSTCC != ""
>>>>         help
>>>>           GCC plugins are loadable modules that provide extra features to the
>>>> --
>>>> 2.18.0
>>>>
>>>
>>> I guess the more correct way is to fix
>>> scripts/gcc-plugin.sh
>>>
>>> This shell script should exit 0
>>> only when GCC plugin is supported.
>>
>> I'm of two minds: we already have the gcc test in Kconfig so we might
>> want to avoid redundant checks, but maybe the script should be a
>> "complete" test. I guess the latter. I will send a patch.
> 
> Actually, how about we do the test in Kconfig, but ahead of the
> script? That will reduce redundancy:
> 
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 1aa59063f1fd..18f518624e41 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -409,7 +409,7 @@ preferred-plugin-hostcc := $(if-success,[
> $(gcc-version) -ge 40800 ],$(HOSTCXX),
> 
>  config PLUGIN_HOSTCC
>         string
> -       default "$(shell,$(srctree)/scripts/gcc-plugin.sh
> "$(preferred-plugin-hostcc)" "$(HOSTCXX)" "$(CC)")"
> +       default "$(shell,$(srctree)/scripts/gcc-plugin.sh
> "$(preferred-plugin-hostcc)" "$(HOSTCXX)" "$(CC)")" if CC_IS_GCC
>         help
>           Host compiler used to build GCC plugins.  This can be $(HOSTCXX),
>           $(HOSTCC), or a null string if GCC plugin is unsupported.

I like this better. A script which is called gcc-plugin.sh should only
be called if gcc is used...

--
Stefan

> 
> 
> -Kees

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gcc-plugins: require GCC
  2018-08-13 21:29       ` Stefan Agner
@ 2018-08-14  2:28         ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2018-08-14  2:28 UTC (permalink / raw)
  To: Stefan Agner
  Cc: Kees Cook, Alexei Starovoitov, Andrew Morton, Josef Bacik,
	Emese Revfy, Linux Kernel Mailing List

2018-08-14 6:29 GMT+09:00 Stefan Agner <stefan@agner.ch>:
> On 13.08.2018 22:18, Kees Cook wrote:
>> On Mon, Aug 13, 2018 at 1:10 PM, Kees Cook <keescook@chromium.org> wrote:
>>> On Mon, Aug 13, 2018 at 12:38 AM, Masahiro Yamada
>>> <yamada.masahiro@socionext.com> wrote:
>>>> 2018-08-11 18:48 GMT+09:00 Stefan Agner <stefan@agner.ch>:
>>>>> Unsurprisingly GCC plugins require GCC as a compiler. This avoids
>>>>> GCC plugins being selectable when using clang.
>>>>>
>>>>> Signed-off-by: Stefan Agner <stefan@agner.ch>
>>>>> ---
>>>>>  arch/Kconfig | 2 +-
>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/arch/Kconfig b/arch/Kconfig
>>>>> index 1aa59063f1fd..8c693a837ed7 100644
>>>>> --- a/arch/Kconfig
>>>>> +++ b/arch/Kconfig
>>>>> @@ -422,7 +422,7 @@ config HAVE_GCC_PLUGINS
>>>>>
>>>>>  menuconfig GCC_PLUGINS
>>>>>         bool "GCC plugins"
>>>>> -       depends on HAVE_GCC_PLUGINS
>>>>> +       depends on HAVE_GCC_PLUGINS && CC_IS_GCC
>>>>>         depends on PLUGIN_HOSTCC != ""
>>>>>         help
>>>>>           GCC plugins are loadable modules that provide extra features to the
>>>>> --
>>>>> 2.18.0
>>>>>
>>>>
>>>> I guess the more correct way is to fix
>>>> scripts/gcc-plugin.sh
>>>>
>>>> This shell script should exit 0
>>>> only when GCC plugin is supported.
>>>
>>> I'm of two minds: we already have the gcc test in Kconfig so we might
>>> want to avoid redundant checks, but maybe the script should be a
>>> "complete" test. I guess the latter. I will send a patch.
>>
>> Actually, how about we do the test in Kconfig, but ahead of the
>> script? That will reduce redundancy:
>>
>> diff --git a/arch/Kconfig b/arch/Kconfig
>> index 1aa59063f1fd..18f518624e41 100644
>> --- a/arch/Kconfig
>> +++ b/arch/Kconfig
>> @@ -409,7 +409,7 @@ preferred-plugin-hostcc := $(if-success,[
>> $(gcc-version) -ge 40800 ],$(HOSTCXX),
>>
>>  config PLUGIN_HOSTCC
>>         string
>> -       default "$(shell,$(srctree)/scripts/gcc-plugin.sh
>> "$(preferred-plugin-hostcc)" "$(HOSTCXX)" "$(CC)")"
>> +       default "$(shell,$(srctree)/scripts/gcc-plugin.sh
>> "$(preferred-plugin-hostcc)" "$(HOSTCXX)" "$(CC)")" if CC_IS_GCC
>>         help
>>           Host compiler used to build GCC plugins.  This can be $(HOSTCXX),
>>           $(HOSTCC), or a null string if GCC plugin is unsupported.
>
> I like this better. A script which is called gcc-plugin.sh should only
> be called if gcc is used...
>

This does not work like that.

$(shell,$(srctree)/scripts/gcc-plugin.sh "$(preferred-plugin-hostcc)"
"$(HOSTCXX)" "$(CC)")

is expanded in the parse stage regardless of CC_IS_GCC.




If nobody comes up with a better way, I am fine with this.

Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>




> --
> Stefan
>
>>
>>
>> -Kees



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-08-14  2:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-11  9:48 [PATCH] gcc-plugins: require GCC Stefan Agner
2018-08-13  7:38 ` Masahiro Yamada
2018-08-13 20:10   ` Kees Cook
2018-08-13 20:18     ` Kees Cook
2018-08-13 21:29       ` Stefan Agner
2018-08-14  2:28         ` Masahiro Yamada

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).