On Thu, Dec 23, 2021 at 12:55 AM Jason A. Donenfeld <Jason@xxxxxxxxx> wrote: > > On Wed, Dec 22, 2021 at 4:49 PM Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote: > > If lib-y ignores (drops) an object file (usually because it is not used), > > the usual way to force it to be included is to add it to obj-y instead > > of lib-y (see many examples in lib/Makefile). > > This is not a problem with lib-y. This is a problem with libs-y. Note > the 's'. The former is working as expected. The latter controls > whether a directory's lib.a is picked up. For whatever reason, the > build system isn't respecting a libs-y declaration added to > lib/Makefile like it respects for one added to arch/*/Makefile. > > > However, this may cause problems with weak symbols. I don't recall it being > > used in that scenario. > > The reason we're using lib-y is so that unused code is pruned in the > case that the weak symbol isn't used. IOW, a usual use for lib-y. And > it works just fine. As mentioned, the issue is just with libs-y not > finding that lib.a file. lib-y does not work like that. See commit 7273ad2b08f8ac9563579d16a3cf528857b26f49 When CONFIG_MODULES=y (this is true for most of usecases), there is not much difference between obj-y and lib-y. So, weak functions will remain in vmlinux even if they are unused. -- Best Regards Masahiro Yamada