linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] docs/core-api: expand Fedora instructions for GCC plugins
@ 2022-08-27 19:38 Robert Elliott
  2022-08-29 19:25 ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Elliott @ 2022-08-27 19:38 UTC (permalink / raw)
  To: mpe, nanya, keescook, asahiroy, michal.lkml, corbet
  Cc: ndesaulniers, linux-hardening, linux-kbuild, linux-doc,
	linux-kernel, Robert Elliott

In Fedora 36, cross-compiling an allmodconfig configuration
for other architectures on x86 fails with this problem:

In file included from ../scripts/gcc-plugins/gcc-common.h:95,
                 from ../scripts/gcc-plugins/latent_entropy_plugin.c:78:
/usr/lib/gcc/aarch64-linux-gnu/12/plugin/include/builtins.h:23:10: fatal
error: mpc.h: No such file or directory
   23 | #include <mpc.h>
      |          ^~~~~~~
compilation terminated.

In that distro, that header file is available in the separate
libmpc-devel package.

Although future versions of Fedora might correctly mark
that dependency, mention this additional package.

To help detect such problems ahead of time, describe the
    gcc -print-file-name=plugin
command that is used by scripts/gcc-plugins/Kconfig to detect
plugins [1].

[1] https://lore.kernel.org/lkml/CAHk-=wjjiYjCp61gdAMpDOsUBU-A2hFFKJoVx5VAC7yV4K6WYg@xxxxxxxxxxxxxx/

Fixes: 43e96ef8b70c50f ("docs/core-api: Add Fedora instructions for GCC plugins");
Signed-off-by: Robert Elliott <elliott@hpe.com>
---
 Documentation/kbuild/gcc-plugins.rst | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/Documentation/kbuild/gcc-plugins.rst b/Documentation/kbuild/gcc-plugins.rst
index 0ba76719f1b9..c578c6ba3eb6 100644
--- a/Documentation/kbuild/gcc-plugins.rst
+++ b/Documentation/kbuild/gcc-plugins.rst
@@ -90,7 +90,11 @@ e.g., on Ubuntu for gcc-10::
 
 Or on Fedora::
 
-	dnf install gcc-plugin-devel
+	dnf install gcc-plugin-devel libmpc-devel
+
+Or on Fedora when using cross-compilers that include plugins::
+
+	dnf install libmpc-devel
 
 Enable the GCC plugin infrastructure and some plugin(s) you want to use
 in the kernel config::
@@ -99,6 +103,19 @@ in the kernel config::
 	CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y
 	...
 
+Run gcc (native or cross-compiler) to ensure plugin headers are detected::
+
+	gcc -print-file-name=plugin
+	CROSS_COMPILE=arm-linux-gnu- ${CROSS_COMPILE}gcc -print-file-name=plugin
+
+The word "plugin" means they are not detected::
+
+	plugin
+
+A full path means they are detected::
+
+       /usr/lib/gcc/x86_64-redhat-linux/12/plugin
+
 To compile the minimum tool set including the plugin(s)::
 
 	make scripts
-- 
2.37.1


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

* Re: [PATCH] docs/core-api: expand Fedora instructions for GCC plugins
  2022-08-27 19:38 [PATCH] docs/core-api: expand Fedora instructions for GCC plugins Robert Elliott
@ 2022-08-29 19:25 ` Kees Cook
  2022-08-29 20:53   ` Jonathan Corbet
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2022-08-29 19:25 UTC (permalink / raw)
  To: Robert Elliott
  Cc: mpe, nanya, asahiroy, michal.lkml, corbet, ndesaulniers,
	linux-hardening, linux-kbuild, linux-doc, linux-kernel

On Sat, Aug 27, 2022 at 02:38:36PM -0500, Robert Elliott wrote:
> In Fedora 36, cross-compiling an allmodconfig configuration
> for other architectures on x86 fails with this problem:
> 
> In file included from ../scripts/gcc-plugins/gcc-common.h:95,
>                  from ../scripts/gcc-plugins/latent_entropy_plugin.c:78:
> /usr/lib/gcc/aarch64-linux-gnu/12/plugin/include/builtins.h:23:10: fatal
> error: mpc.h: No such file or directory
>    23 | #include <mpc.h>
>       |          ^~~~~~~
> compilation terminated.
> 
> In that distro, that header file is available in the separate
> libmpc-devel package.
> 
> Although future versions of Fedora might correctly mark
> that dependency, mention this additional package.
> 
> To help detect such problems ahead of time, describe the
>     gcc -print-file-name=plugin
> command that is used by scripts/gcc-plugins/Kconfig to detect
> plugins [1].
> 
> [1] https://lore.kernel.org/lkml/CAHk-=wjjiYjCp61gdAMpDOsUBU-A2hFFKJoVx5VAC7yV4K6WYg@xxxxxxxxxxxxxx/
> 
> Fixes: 43e96ef8b70c50f ("docs/core-api: Add Fedora instructions for GCC plugins");
> Signed-off-by: Robert Elliott <elliott@hpe.com>

Thanks!

Reviewed-by: Kees Cook <keescook@chromium.org>

Jon, do you want to take this since it's entirely in the .rst file?

-- 
Kees Cook

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

* Re: [PATCH] docs/core-api: expand Fedora instructions for GCC plugins
  2022-08-29 19:25 ` Kees Cook
@ 2022-08-29 20:53   ` Jonathan Corbet
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Corbet @ 2022-08-29 20:53 UTC (permalink / raw)
  To: Kees Cook, Robert Elliott
  Cc: mpe, nanya, asahiroy, michal.lkml, ndesaulniers, linux-hardening,
	linux-kbuild, linux-doc, linux-kernel

Kees Cook <keescook@chromium.org> writes:

> On Sat, Aug 27, 2022 at 02:38:36PM -0500, Robert Elliott wrote:
>> In Fedora 36, cross-compiling an allmodconfig configuration
>> for other architectures on x86 fails with this problem:
>> 
>> In file included from ../scripts/gcc-plugins/gcc-common.h:95,
>>                  from ../scripts/gcc-plugins/latent_entropy_plugin.c:78:
>> /usr/lib/gcc/aarch64-linux-gnu/12/plugin/include/builtins.h:23:10: fatal
>> error: mpc.h: No such file or directory
>>    23 | #include <mpc.h>
>>       |          ^~~~~~~
>> compilation terminated.
>> 
>> In that distro, that header file is available in the separate
>> libmpc-devel package.
>> 
>> Although future versions of Fedora might correctly mark
>> that dependency, mention this additional package.
>> 
>> To help detect such problems ahead of time, describe the
>>     gcc -print-file-name=plugin
>> command that is used by scripts/gcc-plugins/Kconfig to detect
>> plugins [1].
>> 
>> [1] https://lore.kernel.org/lkml/CAHk-=wjjiYjCp61gdAMpDOsUBU-A2hFFKJoVx5VAC7yV4K6WYg@xxxxxxxxxxxxxx/
>> 
>> Fixes: 43e96ef8b70c50f ("docs/core-api: Add Fedora instructions for GCC plugins");
>> Signed-off-by: Robert Elliott <elliott@hpe.com>
>
> Thanks!
>
> Reviewed-by: Kees Cook <keescook@chromium.org>
>
> Jon, do you want to take this since it's entirely in the .rst file?

Yes, I'll do that.

Thanks,

jon

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

end of thread, other threads:[~2022-08-29 20:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-27 19:38 [PATCH] docs/core-api: expand Fedora instructions for GCC plugins Robert Elliott
2022-08-29 19:25 ` Kees Cook
2022-08-29 20:53   ` Jonathan Corbet

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