efi/libstub: avoid linking libstub/lib-ksyms.o into vmlinux
PATCH 1/1 efi/libstub: avoid linking libstub/lib-ksyms.o into vmlinux
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.
---
drivers/firmware/efi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/Makefile +1 -1
@@ -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/
Signature · 1 line
2.17.1
Ard Biesheuvel
maintainerQuoted 4 lines · Masahiro Yamada
drivers/firmware/efi/libstub/Makefileis supposed to create a static library, which is not directly linked to vmlinux.
This is not true for arm64. Does that matter?
Quoted 34 lines
Since commit
7f2084fa55e6("[kbuild] handle exports in lib-y objects reliably"), anyMakefileusing 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.oWe 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 <[email protected]>---
drivers/firmware/efi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/firmware/efi/Makefile +1
-2@@ -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
Quoted 8 lines · Ard Biesheuvel
Quoted 4 lines · Masahiro Yamada
drivers/firmware/efi/libstub/Makefileis 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.
Quoted 34 lines
Quoted 34 lines
Since commit
7f2084fa55e6("[kbuild] handle exports in lib-y objects reliably"), anyMakefileusing 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.oWe 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 <[email protected]>---
drivers/firmware/efi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/firmware/efi/Makefile +1
-2@@ -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
Signature · 2 lines
Best Regards Masahiro Yamada
Ard Biesheuvel
maintainerQuoted 19 lines · Masahiro Yamada
Quoted 8 lines · Ard Biesheuvel
Quoted 4 lines · Masahiro Yamada
drivers/firmware/efi/libstub/Makefileis 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?
Quoted 8 lines
drivers/firmware/efi/libstub/Makefileis 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]
"""
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Since commit
7f2084fa55e6("[kbuild] handle exports in lib-y objects reliably"), anyMakefileusing lib-y generates lib-ksyms.o which is linked into vmlinux.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
In this case, the following garbage object is linked into vmlinux.
drivers/firmware/efi/libstub/lib-ksyms.oWe 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
Quoted 31 lines
Quoted 9 lines
Quoted 9 lines
so using subdir-y instead of obj-y is the correct way to descend into this directory.
Signed-off-by Masahiro Yamada <[email protected]>---
drivers/firmware/efi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 16 lines
Quoted 14 lines
drivers/firmware/efi/Makefile +1
-2@@ -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/ --Quoted 2 lines
2.17.1
--
Best Regards
Masahiro Yamada
Hi Ard,
Quoted 3 lines · Ard Biesheuvel
If you agree, no need to resend, I'll fix it up when applying
I agree.
Please fix it up.
Thanks.
Signature · 2 lines
Best Regards Masahiro Yamada
Ard Biesheuvel
maintainerQuoted 4 lines · Masahiro Yamada
Hi Ard,
Quoted 9 lines
Quoted 3 lines · Ard Biesheuvel
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