[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAROPTVO6B2+4pQ-hkx3=3annhtVL7ebaOjE_YX3Cf3p1w@mail.gmail.com>
Date: Sat, 19 Nov 2022 15:09:38 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Alexander Lobakin <alobakin@...me>
Cc: linux-kbuild@...r.kernel.org,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nick Terrell <terrelln@...com>,
Nicolas Schier <nicolas@...sle.eu>, Tom Rix <trix@...hat.com>,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH v2 2/2] kbuild: warn objects shared among multiple modules
On Sat, Nov 19, 2022 at 6:36 AM Alexander Lobakin <alobakin@...me> wrote:
>
> From: Masahiro Yamada <masahiroy@...nel.org>
> Date: Sat, 19 Nov 2022 04:15:51 +0900
>
> > If an object is shared among multiple modules, amd some of them are
> > configured as 'm', but the others as 'y', the shared object is built
> > as modular, then linked to the modules and vmlinux. This is a potential
> > issue because the expected CFLAGS are different between modules and
> > builtins.
> >
> > Commit 637a642f5ca5 ("zstd: Fixing mixed module-builtin objects")
> > reported that this could be even more fatal in some cases such as
> > Clang LTO.
> >
> > That commit fixed lib/zlib/zstd_{compress,decompress}, but there are
> > still more instances of breakage.
> >
> > This commit adds a W=1 warning for shared objects, so that the kbuild
> > test robot, which provides build tests with W=1, will avoid a new
> > breakage slipping in.
> >
> > Quick compile tests on v6.1-rc4 detected the following:
>
> For the series:
>
> Reviewed-and-tested-by: Alexander Lobakin <alobakin@...me>
>
> [...]
>
> > Once all the warnings are fixed, it can become an error irrespective of
> > W= option.
>
> BTW I've fixed most of these (the ones that get build on typical
> x86_64 distroconfig) during my local tests, basing off your WIP
> tree. I could send a series if you wish.
Yes, thanks for the help.
>
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> > ---
> >
> > Changes in v2:
> > - Add drivers/block/rnbd/Makefile for commit log
> >
> > scripts/Makefile.build | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> > index 37cf88d076e8..799df12b53f3 100644
> > --- a/scripts/Makefile.build
> > +++ b/scripts/Makefile.build
> > @@ -222,6 +222,10 @@ endif
> >
> > cmd_check_local_export = $(srctree)/scripts/check-local-export $@
> >
> > +ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
> > +cmd_warn_shared_object = $(if $(word 2, $(modname-multi)),$(warning $(kbuild-file): $*.o is added to multiple modules: $(modname-multi)))
> > +endif
> > +
> > define rule_cc_o_c
> > $(call cmd_and_fixdep,cc_o_c)
> > $(call cmd,gen_ksymdeps)
> > @@ -231,6 +235,7 @@ define rule_cc_o_c
> > $(call cmd,gen_objtooldep)
> > $(call cmd,gen_symversions_c)
> > $(call cmd,record_mcount)
> > + $(call cmd,warn_shared_object)
> > endef
> >
> > define rule_as_o_S
> > @@ -239,6 +244,7 @@ define rule_as_o_S
> > $(call cmd,check_local_export)
> > $(call cmd,gen_objtooldep)
> > $(call cmd,gen_symversions_S)
> > + $(call cmd,warn_shared_object)
> > endef
> >
> > # Built-in and composite module parts
> > --
> > 2.34.1
>
> Thanks,
> Olek
>
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists