[PATCH] efi/libstub: fix building loongarch32 without zboot enabled

Ard Biesheuvel ardb at kernel.org
Thu Nov 26 02:27:39 PST 2026



On Thu, 26 Nov 2026, at 11:14, Dmitry Antipov wrote:
> 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(-)
>

Would this work as well?

--- a/arch/loongarch/kernel/image-vars.h
+++ b/arch/loongarch/kernel/image-vars.h
@@ -8,7 +8,8 @@
 #ifdef CONFIG_EFI_STUB
 
 __efistub_strcmp               = strcmp;
-
+__efistub___lshrdi3            = __lshrdi3;
+__efistub___ashldi3            = __ashldi3;
 #endif
 
 #endif /* __LOONGARCH_KERNEL_IMAGE_VARS_H */



More information about the linux-riscv mailing list