[PATCH] efi/libstub: fix building loongarch32 without zboot enabled
Dmitry Antipov
dmantipov at yandex.ru
Thu Nov 26 02:14:52 PST 2026
Kernel test robot has reported the following error observed on loongarch:
loongarch64-linux-ld: ./drivers/firmware/efi/libstub/lib-cmdline.stub.o: in function `__efistub_.L47':
__efistub_cmdline.c:(.init.text+0x258): undefined reference to `__efistub___ashldi3'
loongarch64-linux-ld: __efistub_cmdline.c:(.init.text+0x268): undefined reference to `__efistub___lshrdi3'
Since this happens with CONFIG_EFI_GENERIC_STUB enabled but
CONFIG_EFI_ZBOOT disabled, tweak loongarch32 build to hook
extra library objects on the former rather than latter. And
this quirk seems no longer neeeded on riscv32 because it has
architecture-specific implementations of ashldi3() and lsrdi3()
which are aliased to corresponding EFI stubs via
arch/riscv/kernel/image-vars.h.
Reported-by: kernel test robot <lkp at intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/20261122125352.gAcg5yLx-lkp@intel.com/
Fixes: 442082297e3d ("riscv: fix building compressed EFI image")
Signed-off-by: Dmitry Antipov <dmantipov at yandex.ru>
---
drivers/firmware/efi/libstub/Makefile | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index bbab12b8eb4b..77f0d3047b95 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -97,11 +97,11 @@ CFLAGS_zboot-decompress-gzip.o += -I$(srctree)/lib/zlib_inflate
zboot-obj-$(CONFIG_KERNEL_ZSTD) := zboot-decompress-zstd.o lib-xxhash.o
CFLAGS_zboot-decompress-zstd.o += -I$(srctree)/lib/zstd
-zboot-riscv-obj-$(CONFIG_32BIT) := lib-ashldi3.o lib-lshrdi3.o
-zboot-obj-$(CONFIG_RISCV) += lib-clz_ctz.o $(zboot-riscv-obj-y)
-zboot-loongarch-obj-$(CONFIG_32BIT) := lib-ashldi3.o lib-lshrdi3.o
-zboot-obj-$(CONFIG_LOONGARCH) += lib-clz_ctz.o $(zboot-loongarch-obj-y)
-lib-$(CONFIG_EFI_ZBOOT) += zboot.o $(zboot-obj-y)
+extra-loongarch-obj-$(CONFIG_32BIT) := lib-ashldi3.o lib-lshrdi3.o
+extra-obj-$(CONFIG_LOONGARCH) += $(extra-loongarch-obj-y)
+lib-$(CONFIG_EFI_GENERIC_STUB) += $(extra-obj-y)
+
+lib-$(CONFIG_EFI_ZBOOT) += zboot.o
lib-$(CONFIG_UNACCEPTED_MEMORY) += unaccepted_memory.o bitmap.o find.o
--
2.56.1
More information about the linux-riscv
mailing list