Re: [PATCH RFC] gcc-plugins: Handle GCC version mismatch for OOT modules

From: Josh Poimboeuf
Date: Thu Mar 04 2021 - 10:10:44 EST


On Thu, Mar 04, 2021 at 09:27:28PM +0900, Masahiro Yamada wrote:
> I agree with rebuilding GCC plugins when the compiler is upgraded
> for *in-tree* building.
> Linus had reported it a couple of months before,
> and I just submitted a very easy fix.

Hm? So does that mean that a GCC version change won't trigger a
tree-wide rebuild? So you're asserting that a GCC mismatch is ok for
in-tree code, but not for external modules??? That seems backwards.

For in-tree, why not just rebuild the entire tree? Some kernel features
are dependent on compiler version or capability, so not rebuilding the
tree could introduce silent breakage.

For external modules, a tree-wide rebuild isn't an option so the risk is
assumed by the user. I posted a patch earlier [1] which prints a
warning if the compiler major/minor version changes with an external
module build.

[1] https://lkml.kernel.org/r/20210201211322.t2rxmvnrystc2ky7@treble

> Rebuilding plugins for external modules is not easy;
> plugins are placed in the read-only directory,
> /usr/src/linux-headers-$(uname -r)/scripts/gcc-plugins/.
>
> The external modules must not (cannot) update in-tree
> build artifacts. "Rebuild" means creating copies in a different
> writable directory.
> Doing that requires a lot of design changes.

Ok. So it sounds like the best/easiest option is the original patch in
this thread: when building an external module with a GCC mismatch, just
disable the GCC plugin, with a warning (or an error for randstruct).

--
Josh