linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] efi/libstub: avoid linking libstub/lib-ksyms.o into vmlinux
@ 2020-03-05  5:50 Masahiro Yamada
  2020-03-05  7:20 ` Ard Biesheuvel
  0 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2020-03-05  5:50 UTC (permalink / raw)
  To: Ard Biesheuvel, linux-efi; +Cc: linux-kernel, Ingo Molnar, Masahiro Yamada

drivers/firmware/efi/libstub/Makefile is supposed to create a static
library, which is not directly linked to vmlinux.

Since commit 7f2084fa55e6 ("[kbuild] handle exports in lib-y objects
reliably"), any Makefile using lib-y generates lib-ksyms.o which is
linked into vmlinux.

In this case, the following garbage object is linked into vmlinux.

  drivers/firmware/efi/libstub/lib-ksyms.o

We do not want to link anything from libstub/ directly to vmlinux,
so using subdir-y instead of obj-y is the correct way to descend into
this directory.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 drivers/firmware/efi/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
index 554d795270d9..4fd2fa02f549 100644
--- a/drivers/firmware/efi/Makefile
+++ b/drivers/firmware/efi/Makefile
@@ -19,7 +19,7 @@ obj-$(CONFIG_EFI_VARS_PSTORE)		+= efi-pstore.o
 obj-$(CONFIG_UEFI_CPER)			+= cper.o
 obj-$(CONFIG_EFI_RUNTIME_MAP)		+= runtime-map.o
 obj-$(CONFIG_EFI_RUNTIME_WRAPPERS)	+= runtime-wrappers.o
-obj-$(CONFIG_EFI_STUB)			+= libstub/
+subdir-$(CONFIG_EFI_STUB)		+= libstub
 obj-$(CONFIG_EFI_FAKE_MEMMAP)		+= fake_map.o
 obj-$(CONFIG_EFI_BOOTLOADER_CONTROL)	+= efibc.o
 obj-$(CONFIG_EFI_TEST)			+= test/
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] efi/libstub: avoid linking libstub/lib-ksyms.o into vmlinux
  2020-03-05  5:50 [PATCH] efi/libstub: avoid linking libstub/lib-ksyms.o into vmlinux Masahiro Yamada
@ 2020-03-05  7:20 ` Ard Biesheuvel
  2020-03-05  7:39   ` Masahiro Yamada
  0 siblings, 1 reply; 6+ messages in thread
From: Ard Biesheuvel @ 2020-03-05  7:20 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-efi, Linux Kernel Mailing List, Ingo Molnar

On Thu, 5 Mar 2020 at 06:50, Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> drivers/firmware/efi/libstub/Makefile is supposed to create a static
> library, which is not directly linked to vmlinux.
>

This is not true for arm64. Does that matter?

> Since commit 7f2084fa55e6 ("[kbuild] handle exports in lib-y objects
> reliably"), any Makefile using lib-y generates lib-ksyms.o which is
> linked into vmlinux.
>
> In this case, the following garbage object is linked into vmlinux.
>
>   drivers/firmware/efi/libstub/lib-ksyms.o
>
> We do not want to link anything from libstub/ directly to vmlinux,
> so using subdir-y instead of obj-y is the correct way to descend into
> this directory.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
>  drivers/firmware/efi/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
> index 554d795270d9..4fd2fa02f549 100644
> --- a/drivers/firmware/efi/Makefile
> +++ b/drivers/firmware/efi/Makefile
> @@ -19,7 +19,7 @@ obj-$(CONFIG_EFI_VARS_PSTORE)         += efi-pstore.o
>  obj-$(CONFIG_UEFI_CPER)                        += cper.o
>  obj-$(CONFIG_EFI_RUNTIME_MAP)          += runtime-map.o
>  obj-$(CONFIG_EFI_RUNTIME_WRAPPERS)     += runtime-wrappers.o
> -obj-$(CONFIG_EFI_STUB)                 += libstub/
> +subdir-$(CONFIG_EFI_STUB)              += libstub
>  obj-$(CONFIG_EFI_FAKE_MEMMAP)          += fake_map.o
>  obj-$(CONFIG_EFI_BOOTLOADER_CONTROL)   += efibc.o
>  obj-$(CONFIG_EFI_TEST)                 += test/
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] efi/libstub: avoid linking libstub/lib-ksyms.o into vmlinux
  2020-03-05  7:20 ` Ard Biesheuvel
@ 2020-03-05  7:39   ` Masahiro Yamada
  2020-03-05  7:47     ` Ard Biesheuvel
  0 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2020-03-05  7:39 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: linux-efi, Linux Kernel Mailing List, Ingo Molnar

On Thu, Mar 5, 2020 at 4:21 PM Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Thu, 5 Mar 2020 at 06:50, Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > drivers/firmware/efi/libstub/Makefile is supposed to create a static
> > library, which is not directly linked to vmlinux.
> >
>
> This is not true for arm64. Does that matter?



Yeah, I know.  arm64 vmlinux links it
(but in a different manner from normal lib.a )


Shall I rephrase this paragraph as follows?

drivers/firmware/efi/libstub/Makefile is supposed to create a static
library, which is not directly linked to vmlinux on ARCH=arm, x86.



This is just a matter of whether linking
unneeded lib-ksyms.o or not.





> > Since commit 7f2084fa55e6 ("[kbuild] handle exports in lib-y objects
> > reliably"), any Makefile using lib-y generates lib-ksyms.o which is
> > linked into vmlinux.
> >
> > In this case, the following garbage object is linked into vmlinux.
> >
> >   drivers/firmware/efi/libstub/lib-ksyms.o
> >
> > We do not want to link anything from libstub/ directly to vmlinux,
> > so using subdir-y instead of obj-y is the correct way to descend into
> > this directory.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >
> >  drivers/firmware/efi/Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
> > index 554d795270d9..4fd2fa02f549 100644
> > --- a/drivers/firmware/efi/Makefile
> > +++ b/drivers/firmware/efi/Makefile
> > @@ -19,7 +19,7 @@ obj-$(CONFIG_EFI_VARS_PSTORE)         += efi-pstore.o
> >  obj-$(CONFIG_UEFI_CPER)                        += cper.o
> >  obj-$(CONFIG_EFI_RUNTIME_MAP)          += runtime-map.o
> >  obj-$(CONFIG_EFI_RUNTIME_WRAPPERS)     += runtime-wrappers.o
> > -obj-$(CONFIG_EFI_STUB)                 += libstub/
> > +subdir-$(CONFIG_EFI_STUB)              += libstub
> >  obj-$(CONFIG_EFI_FAKE_MEMMAP)          += fake_map.o
> >  obj-$(CONFIG_EFI_BOOTLOADER_CONTROL)   += efibc.o
> >  obj-$(CONFIG_EFI_TEST)                 += test/
> > --
> > 2.17.1
> >



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] efi/libstub: avoid linking libstub/lib-ksyms.o into vmlinux
  2020-03-05  7:39   ` Masahiro Yamada
@ 2020-03-05  7:47     ` Ard Biesheuvel
  2020-03-05  8:15       ` Masahiro Yamada
  0 siblings, 1 reply; 6+ messages in thread
From: Ard Biesheuvel @ 2020-03-05  7:47 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-efi, Linux Kernel Mailing List, Ingo Molnar

On Thu, 5 Mar 2020 at 08:39, Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Thu, Mar 5, 2020 at 4:21 PM Ard Biesheuvel <ardb@kernel.org> wrote:
> >
> > On Thu, 5 Mar 2020 at 06:50, Masahiro Yamada <masahiroy@kernel.org> wrote:
> > >
> > > drivers/firmware/efi/libstub/Makefile is supposed to create a static
> > > library, which is not directly linked to vmlinux.
> > >
> >
> > This is not true for arm64. Does that matter?
>
>
>
> Yeah, I know.  arm64 vmlinux links it
> (but in a different manner from normal lib.a )
>
>
> Shall I rephrase this paragraph as follows?
>
> drivers/firmware/efi/libstub/Makefile is supposed to create a static
> library, which is not directly linked to vmlinux on ARCH=arm, x86.
>
>
>
> This is just a matter of whether linking
> unneeded lib-ksyms.o or not.
>

How about

"""
drivers/firmware/efi/libstub/Makefile builds a static library, which
is not linked into the main vmlinux target in the ordinary way
[arm64], or at all [ARM, x86]
"""



>
>
>
>
> > > Since commit 7f2084fa55e6 ("[kbuild] handle exports in lib-y objects
> > > reliably"), any Makefile using lib-y generates lib-ksyms.o which is
> > > linked into vmlinux.
> > >
> > > In this case, the following garbage object is linked into vmlinux.
> > >
> > >   drivers/firmware/efi/libstub/lib-ksyms.o
> > >
> > > We do not want to link anything from libstub/ directly to vmlinux,

and

"""
We do not want to follow the default linking rules for static
libraries built under libstub/
"""

If you agree, no need to resend, I'll fix it up when applying


> > > so using subdir-y instead of obj-y is the correct way to descend into
> > > this directory.
> > >
> > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > > ---
> > >
> > >  drivers/firmware/efi/Makefile | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
> > > index 554d795270d9..4fd2fa02f549 100644
> > > --- a/drivers/firmware/efi/Makefile
> > > +++ b/drivers/firmware/efi/Makefile
> > > @@ -19,7 +19,7 @@ obj-$(CONFIG_EFI_VARS_PSTORE)         += efi-pstore.o
> > >  obj-$(CONFIG_UEFI_CPER)                        += cper.o
> > >  obj-$(CONFIG_EFI_RUNTIME_MAP)          += runtime-map.o
> > >  obj-$(CONFIG_EFI_RUNTIME_WRAPPERS)     += runtime-wrappers.o
> > > -obj-$(CONFIG_EFI_STUB)                 += libstub/
> > > +subdir-$(CONFIG_EFI_STUB)              += libstub
> > >  obj-$(CONFIG_EFI_FAKE_MEMMAP)          += fake_map.o
> > >  obj-$(CONFIG_EFI_BOOTLOADER_CONTROL)   += efibc.o
> > >  obj-$(CONFIG_EFI_TEST)                 += test/
> > > --
> > > 2.17.1
> > >
>
>
>
> --
> Best Regards
> Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] efi/libstub: avoid linking libstub/lib-ksyms.o into vmlinux
  2020-03-05  7:47     ` Ard Biesheuvel
@ 2020-03-05  8:15       ` Masahiro Yamada
  2020-03-05  8:21         ` Ard Biesheuvel
  0 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2020-03-05  8:15 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: linux-efi, Linux Kernel Mailing List, Ingo Molnar

Hi Ard,


On Thu, Mar 5, 2020 at 4:47 PM Ard Biesheuvel <ardb@kernel.org> wrote:
>
> If you agree, no need to resend, I'll fix it up when applying
>


I agree.
Please fix it up.

Thanks.

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] efi/libstub: avoid linking libstub/lib-ksyms.o into vmlinux
  2020-03-05  8:15       ` Masahiro Yamada
@ 2020-03-05  8:21         ` Ard Biesheuvel
  0 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2020-03-05  8:21 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-efi, Linux Kernel Mailing List, Ingo Molnar

On Thu, 5 Mar 2020 at 09:16, Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> Hi Ard,
>
>
> On Thu, Mar 5, 2020 at 4:47 PM Ard Biesheuvel <ardb@kernel.org> wrote:
> >
> > If you agree, no need to resend, I'll fix it up when applying
> >
>
>
> I agree.
> Please fix it up.
>

Thank you,

Queued in efi/next

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-05  8:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-05  5:50 [PATCH] efi/libstub: avoid linking libstub/lib-ksyms.o into vmlinux Masahiro Yamada
2020-03-05  7:20 ` Ard Biesheuvel
2020-03-05  7:39   ` Masahiro Yamada
2020-03-05  7:47     ` Ard Biesheuvel
2020-03-05  8:15       ` Masahiro Yamada
2020-03-05  8:21         ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).