[PATCH v9 6/6] riscv: export symbols needed for riscv32 EFI stub
Dmitry Antipov
dmantipov at yandex.ru
Fri Apr 3 03:33:38 PDT 2026
Fix the following link error observed when building EFI-enabled
kernel with CONFIG_EFI_STUB=y and CONFIG_EFI_GENERIC_STUB=y:
riscv32-linux-gnu-ld: ./drivers/firmware/efi/libstub/lib-cmdline.stub.o: in function `__efistub_.L49':
__efistub_cmdline.c:(.init.text+0x1f2): undefined reference to `__efistub___ashldi3'
riscv32-linux-gnu-ld: __efistub_cmdline.c:(.init.text+0x202): undefined reference to `__efistub___lshrdi3'
Note: compile (gcc 15.2.1 and clang 21.1.8) tested only.
Reported-by: kernel test robot <lkp at intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202603041925.KLKqpK6N-lkp@intel.com
Suggested-by: Ard Biesheuvel <ardb at kernel.org>
Signed-off-by: Dmitry Antipov <dmantipov at yandex.ru>
---
v9: initial version to join the series
---
arch/riscv/kernel/image-vars.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/riscv/kernel/image-vars.h b/arch/riscv/kernel/image-vars.h
index 3bd9d06a8b8f..888bb1ddf945 100644
--- a/arch/riscv/kernel/image-vars.h
+++ b/arch/riscv/kernel/image-vars.h
@@ -32,6 +32,15 @@ __efistub___init_text_end = __init_text_end;
__efistub_sysfb_primary_display = sysfb_primary_display;
#endif
+#ifdef CONFIG_CC_IS_GCC
+/*
+ * Double-word integer shifts are used by the library code and so EFI stub as
+ * well. Not needed for clang and please let me know if anyone understands why.
+ */
+PROVIDE(__efistub___lshrdi3 = __lshrdi3);
+PROVIDE(__efistub___ashldi3 = __ashldi3);
+#endif /* CONFIG_CC_IS_GCC */
+
#endif
#endif /* __RISCV_KERNEL_IMAGE_VARS_H */
--
2.53.0
More information about the linux-riscv
mailing list