Re: [PATCH 12/18] mtd: tests: fix object shared between several modules

From: Miquel Raynal
Date: Wed Nov 23 2022 - 11:59:14 EST


Hi,

masahiroy@xxxxxxxxxx wrote on Wed, 23 Nov 2022 22:11:49 +0900:

> On Sun, Nov 20, 2022 at 8:08 AM Alexander Lobakin <alobakin@xxxxx> wrote:
> >
> > mtd_test.o is linked to 8(!) different test modules:
> >
> > > scripts/Makefile.build:252: ./drivers/mtd/tests/Makefile: mtd_test.o
> > > is added to multiple modules: mtd_nandbiterrs mtd_oobtest mtd_pagetest
> > > mtd_readtest mtd_speedtest mtd_stresstest mtd_subpagetest mtd_torturetest
> >
> > Although all of them share one Kconfig option
> > (CONFIG_MTD_TESTS), it's better to not link one object file into
> > several modules (and/or vmlinux).
> > Under certain circumstances, such can lead to the situation fixed by
> > commit 637a642f5ca5 ("zstd: Fixing mixed module-builtin objects").
> > In this particular case, there's also no need to duplicate the very
> > same object code 8 times.
> >
> > Convert mtd_test.o to a standalone module which will export its
> > functions to the rest.
> >
> > Fixes: a995c792280d ("mtd: tests: rename sources in order to link a helper object")
> > Suggested-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
>
> IMHO, Reported-by might be a better fit.
>
>
> I think they can become static inline functions in mtd_test.h
> (at least, mtdtest_relax() is a static inline there), but I am not sure.
>
> Please send this to the MTD list, and consult the maintainer(s).

TBH I don't really mind. These are test modules that you insert to
harden and profile the stack, so whatever makes the robots happy is
fine. Anyway, they are being slowly replaced by userspace tools so we
might eventually get rid of them.

Thanks,
Miquèl