Subject: cross compile kernel to arm is stopped by GCC_PLUGIN_LATENT_ENTROPY

From: Tadhg McDonald-Jensen <[email-masked]>
Date: Mon, 31 Mar 2025 17:20:09 -0400

Hello,

if you try to run `guix build --target=arm-linux-gnueabihf --cores=1
[email-masked]` you will be greeted by an error that files under the
/gnu/store/...gcc-cross-arm... seem to have invalid syntax and are being
imported by `scripts/gcc-plugins/latent_entropy_plugin.c:78`

I'm trying to establish whether this is an upstream bug or a way that
guix deals with the cross compilation, I am not versed enough in C
pre-processor to be able to understand the exact issue.

and if you just disable that plugin the kernel can compile fine, for
instance if you copy the definition of linux-libre package and just add
a rule that disables that plugin (using customize-linux doesn't work as
it errors that the rule conflicts with the one specified by guix)

```scm
(use-modules (gnu packages linux))
;; get non exported helpers to replicate the exact notation used in
linux.scm
(define make-linux-libre* (@@ (gnu packages linux) make-linux-libre*))
(define default-extra-linux-options (@@ (gnu packages linux)
default-extra-linux-options))
(define kernel-config (@@ (gnu packages linux) kernel-config))
;; exact copy of linux-libre-6.13 from gnu/packages/linux.scm with one
extra-option
(define linux-libre-6.13-without-gcc-plugin-latent-entropy
  (make-linux-libre* linux-libre-6.13-version
                     linux-libre-6.13-gnu-revision
                     linux-libre-6.13-source
                     '("x86_64-linux" "i686-linux" "armhf-linux"
                       "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
                     #:configuration-file kernel-config
                     #:extra-options
                     (append
                      `(("CONFIG_GCC_PLUGIN_LATENT_ENTROPY" . #f))
                      (default-extra-linux-options
linux-libre-6.13-version))
		     ))

linux-libre-6.13-without-gcc-plugin-latent-entropy
```

this compiles with `guix build --target=arm-linux-gnueabihf -f
that_file.scm` just fine.

Currently with the 'normal' kernel not cross compiling and
`linux-libre-arm-generic` not setting up the initrd modules in a way
guix expects, it is currently not at all clear how to deploy guix to an
arm device so fixing this would be ideal.

In the case that this is an upstream issue can you at least give me a
bit of context for why the error is pointing to files in the guix cross
compiler? I'd like to report this as precisely as possible and really
don't have a clear idea of what is going on.

Thanks,
Tadhg