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

From: Josh Poimboeuf
Date: Mon Jan 25 2021 - 17:12:19 EST


On Tue, Jan 26, 2021 at 06:44:35AM +0900, Masahiro Yamada wrote:
> > > If people use a different compiler, they must be
> > > prepared for any possible problem.
> > >
> > > Using different compiler flags for in-tree and out-of-tree
> > > is even more dangerous.
> > >
> > > For example, CONFIG_GCC_PLUGIN_RANDSTRUCT is enabled
> > > for in-tree build, and then disabled for out-of-tree modules,
> > > the struct layout will mismatch, won't it?
> >
> > If you read the patch you'll notice that it handles that case, when it's
> > caused by GCC mismatch.
> >
> > However, as alluded to in the [1] footnote, it doesn't handle the case
> > where the OOT build system doesn't have gcc-plugin-devel installed.
> > Then CONFIG_GCC_PLUGIN_RANDSTRUCT gets silently disabled and the build
> > succeeds! That happens even without a GCC mismatch.
>
>
> Ah, sorry.
>
> I responded too early before reading the patch fully.
>
> But, I do not like to make RANDSTRUCT a special case.
>
> I'd rather want to stop building for any plugin.

Other than RANDSTRUCT there doesn't seem to be any problem with
disabling them (and printing a warning) in the OOT build. Why not give
users that option? It's harmless, and will make distro's (and their
users') lives easier.

Either GCC mismatch is ok, or it's not. Let's not half-enforce it.

Also, how do you propose we solve the other problem, where a missing
optional library (gcc-plugin-devel) causes the OOT module build to
silently disable the plugin? This is related to my earlier complaint
about the dangers of toolchain-dependent kconfig options.

--
Josh