diff mbox series

[2/2] gcc-plugins: disable plugins when gmp.h is unavailable

Message ID 20240312-gcc-plugins-gmp-v1-2-c5e082437b9e@linutronix.de (mailing list archive)
State Rejected
Headers show
Series gcc-plugins: disable plugins when gmp.h is unavailable | expand

Commit Message

Thomas Weißschuh March 12, 2024, 3:03 p.m. UTC
The header gmp.h is meant to be picked up from the host system.

When it is unavailable the plugin build fails:

In file included from ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/gcc-plugin.h:28,
                 from ../scripts/gcc-plugins/gcc-common.h:7,
                 from ../scripts/gcc-plugins/stackleak_plugin.c:30:
../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/system.h:703:10: fatal error: gmp.h: No such file or directory
  703 | #include <gmp.h>
      |          ^~~~~~~

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
 scripts/gcc-plugins/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Kees Cook March 12, 2024, 9:53 p.m. UTC | #1
On Tue, Mar 12, 2024 at 04:03:30PM +0100, Thomas Weißschuh wrote:
> The header gmp.h is meant to be picked up from the host system.
> 
> When it is unavailable the plugin build fails:
> 
> In file included from ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/gcc-plugin.h:28,
>                  from ../scripts/gcc-plugins/gcc-common.h:7,
>                  from ../scripts/gcc-plugins/stackleak_plugin.c:30:
> ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/system.h:703:10: fatal error: gmp.h: No such file or directory
>   703 | #include <gmp.h>
>       |          ^~~~~~~
> 
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
>  scripts/gcc-plugins/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/gcc-plugins/Kconfig b/scripts/gcc-plugins/Kconfig
> index e383cda05367..a664fb5cdde5 100644
> --- a/scripts/gcc-plugins/Kconfig
> +++ b/scripts/gcc-plugins/Kconfig
> @@ -10,6 +10,7 @@ menuconfig GCC_PLUGINS
>  	depends on HAVE_GCC_PLUGINS
>  	depends on CC_IS_GCC
>  	depends on $(success,test -e $(shell,$(CC) -print-file-name=plugin)/include/plugin-version.h)
> +	depends on $(host-cc-option,-include gmp.h)

Why does the prior depends not fail? That's where plugin detection is
happening.
Masahiro Yamada March 13, 2024, 3:47 a.m. UTC | #2
On Wed, Mar 13, 2024 at 6:53 AM Kees Cook <keescook@chromium.org> wrote:
>
> On Tue, Mar 12, 2024 at 04:03:30PM +0100, Thomas Weißschuh wrote:
> > The header gmp.h is meant to be picked up from the host system.
> >
> > When it is unavailable the plugin build fails:
> >
> > In file included from ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/gcc-plugin.h:28,
> >                  from ../scripts/gcc-plugins/gcc-common.h:7,
> >                  from ../scripts/gcc-plugins/stackleak_plugin.c:30:
> > ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/system.h:703:10: fatal error: gmp.h: No such file or directory
> >   703 | #include <gmp.h>
> >       |          ^~~~~~~
> >
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> > ---
> >  scripts/gcc-plugins/Kconfig | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/scripts/gcc-plugins/Kconfig b/scripts/gcc-plugins/Kconfig
> > index e383cda05367..a664fb5cdde5 100644
> > --- a/scripts/gcc-plugins/Kconfig
> > +++ b/scripts/gcc-plugins/Kconfig
> > @@ -10,6 +10,7 @@ menuconfig GCC_PLUGINS
> >       depends on HAVE_GCC_PLUGINS
> >       depends on CC_IS_GCC
> >       depends on $(success,test -e $(shell,$(CC) -print-file-name=plugin)/include/plugin-version.h)
> > +     depends on $(host-cc-option,-include gmp.h)
>
> Why does the prior depends not fail? That's where plugin detection is
> happening.
>
> --
> Kees Cook
>



This patch set should be rejected.


It was already discussed in the past.
Just install a proper package, then gcc-plugin will work.

https://lore.kernel.org/all/CAHk-=wjjiYjCp61gdAMpDOsUBU-A2hFFKJoVx5VAC7yV4K6WYg@mail.gmail.com/
Thomas Weißschuh March 13, 2024, 2:42 p.m. UTC | #3
On Wed, Mar 13, 2024 at 12:47:59PM +0900, Masahiro Yamada wrote:
> On Wed, Mar 13, 2024 at 6:53 AM Kees Cook <keescook@chromium.org> wrote:
> >
> > On Tue, Mar 12, 2024 at 04:03:30PM +0100, Thomas Weißschuh wrote:
> > > The header gmp.h is meant to be picked up from the host system.
> > >
> > > When it is unavailable the plugin build fails:
> > >
> > > In file included from ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/gcc-plugin.h:28,
> > >                  from ../scripts/gcc-plugins/gcc-common.h:7,
> > >                  from ../scripts/gcc-plugins/stackleak_plugin.c:30:
> > > ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/system.h:703:10: fatal error: gmp.h: No such file or directory
> > >   703 | #include <gmp.h>
> > >       |          ^~~~~~~
> > >
> > > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> > > ---
> > >  scripts/gcc-plugins/Kconfig | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/scripts/gcc-plugins/Kconfig b/scripts/gcc-plugins/Kconfig
> > > index e383cda05367..a664fb5cdde5 100644
> > > --- a/scripts/gcc-plugins/Kconfig
> > > +++ b/scripts/gcc-plugins/Kconfig
> > > @@ -10,6 +10,7 @@ menuconfig GCC_PLUGINS
> > >       depends on HAVE_GCC_PLUGINS
> > >       depends on CC_IS_GCC
> > >       depends on $(success,test -e $(shell,$(CC) -print-file-name=plugin)/include/plugin-version.h)
> > > +     depends on $(host-cc-option,-include gmp.h)
> >
> > Why does the prior depends not fail? That's where plugin detection is
> > happening.
> >
> > --
> > Kees Cook
> 
> This patch set should be rejected.
> 
> 
> It was already discussed in the past.
> Just install a proper package, then gcc-plugin will work.
> 
> https://lore.kernel.org/all/CAHk-=wjjiYjCp61gdAMpDOsUBU-A2hFFKJoVx5VAC7yV4K6WYg@mail.gmail.com/

Thanks for the pointer.

As there is already consensus I agree that the patches should not be used.

Thomas
diff mbox series

Patch

diff --git a/scripts/gcc-plugins/Kconfig b/scripts/gcc-plugins/Kconfig
index e383cda05367..a664fb5cdde5 100644
--- a/scripts/gcc-plugins/Kconfig
+++ b/scripts/gcc-plugins/Kconfig
@@ -10,6 +10,7 @@  menuconfig GCC_PLUGINS
 	depends on HAVE_GCC_PLUGINS
 	depends on CC_IS_GCC
 	depends on $(success,test -e $(shell,$(CC) -print-file-name=plugin)/include/plugin-version.h)
+	depends on $(host-cc-option,-include gmp.h)
 	default y
 	help
 	  GCC plugins are loadable modules that provide extra features to the