Re: [PATCH v2 2/2] efi/libstub: refactor Makefile to not use lib-y syntax

From: Ard Biesheuvel
Date: Mon Jun 15 2020 - 06:41:34 EST


On Mon, 15 Jun 2020 at 12:26, Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:
>
> On Thu, 4 Jun 2020 at 04:20, Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> >
> > Documentation/kbuild/makefiles.rst says:
> >
> > Use of lib-y is normally restricted to `lib/` and `arch/*/lib`.
> >
> > This is because lib-y is inteded to be hooked to KBUILD_VMLINUX_LIBS,
> > which is passed down to scripts/link-vmlinux.sh.
> >
> > Besides, lib-y is not so interesting because objects from lib-y are
> > mostly linked in normal usecases. For example, lib-y only saves 364
> > bytes for x86_64_defconfig. You can see the details in commit
> > 7273ad2b08f8 ("kbuild: link lib-y objects to vmlinux forcibly when
> > CONFIG_MODULES=y").
> >
> > I think we should consider to deprecate lib-y syntax at some point
> > because we should aim for better solution like dead code elimination
> > or LTO.
> >
> > Other than lib/ and arch/*/lib, this Makefile is the only user of
> > lib-y. Replace lib-y with a custom rule.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
>
> Series queued in efi/urgent.
>

Actually, I am seeing this now

/home/ard/linux/scripts/Makefile.build:421: warning: overriding recipe
for target 'drivers/firmware/efi/libstub/lib.a'
/home/ard/linux/drivers/firmware/efi/libstub/Makefile:131: warning:
ignoring old recipe for target 'drivers/firmware/efi/libstub/lib.a'