All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
To: Kees Cook <keescook@chromium.org>,
	 Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org,
	"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Subject: [PATCH 2/2] gcc-plugins: disable plugins when gmp.h is unavailable
Date: Tue, 12 Mar 2024 16:03:30 +0100	[thread overview]
Message-ID: <20240312-gcc-plugins-gmp-v1-2-c5e082437b9e@linutronix.de> (raw)
In-Reply-To: <20240312-gcc-plugins-gmp-v1-0-c5e082437b9e@linutronix.de>

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)
 	default y
 	help
 	  GCC plugins are loadable modules that provide extra features to the

-- 
2.44.0


  parent reply	other threads:[~2024-03-12 15:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12 15:03 [PATCH 0/2] gcc-plugins: disable plugins when gmp.h is unavailable Thomas Weißschuh
2024-03-12 15:03 ` [PATCH 1/2] kbuild: add host-cc-option helper Thomas Weißschuh
2024-03-12 15:03 ` Thomas Weißschuh [this message]
2024-03-12 21:53   ` [PATCH 2/2] gcc-plugins: disable plugins when gmp.h is unavailable Kees Cook
2024-03-13  3:47     ` Masahiro Yamada
2024-03-13 14:42       ` Thomas Weißschuh

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=20240312-gcc-plugins-gmp-v1-2-c5e082437b9e@linutronix.de \
    --to=thomas.weissschuh@linutronix.de \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.