[PATCH v2] efi/libstub: fix building loongarch32 without zboot enabled
Dmitry Antipov
dmantipov at yandex.ru
Thu Nov 26 04:41:45 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'
Following the approach introduced in commit a354b8de9ad6
("riscv: add platform-specific double word shifts for riscv32"),
define EFI stub aliases for __ashldi3() and __lshrdi3() for
loongarch32 as well, thus making the related EFI stub's Makefile
quirks redundant.
Suggested-by: Ard Biesheuvel <ardb at kernel.org>
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>
---
v2: define relevant EFI stubs in image-vars.h (Ard)
---
arch/loongarch/kernel/image-vars.h | 2 ++
drivers/firmware/efi/libstub/Makefile | 7 +------
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/loongarch/kernel/image-vars.h b/arch/loongarch/kernel/image-vars.h
index e557ebd46c2b..19202f4f84c2 100644
--- a/arch/loongarch/kernel/image-vars.h
+++ b/arch/loongarch/kernel/image-vars.h
@@ -8,6 +8,8 @@
#ifdef CONFIG_EFI_STUB
__efistub_strcmp = strcmp;
+__efistub___lshrdi3 = __lshrdi3;
+__efistub___ashldi3 = __ashldi3;
__efistub_kernel_entry = kernel_entry;
__efistub_kernel_asize = kernel_asize;
__efistub_kernel_fsize = kernel_fsize;
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index bbab12b8eb4b..bcf2a5981678 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -96,12 +96,7 @@ zboot-obj-y := zboot-decompress-gzip.o
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)
+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