public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
From: Charlie Jenkins <thecharlesjenkins@gmail.com>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andy Shevchenko <andriy.shevchenko@intel.com>,
	David Laight <david.laight.linux@gmail.com>,
	Kees Cook <kees@kernel.org>,
	"Darrick J . Wong" <djwong@kernel.org>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Nathan Chancellor <nathan@kernel.org>,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-riscv@lists.infradead.org,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v9 6/6] riscv: export symbols needed for riscv32 EFI stub
Date: Wed, 8 Apr 2026 22:00:18 -0700	[thread overview]
Message-ID: <20260409050018.GA371560@inky.localdomain> (raw)
In-Reply-To: <20260403103338.1122415-7-dmantipov@yandex.ru>

On Fri, Apr 03, 2026 at 01:33:38PM +0300, Dmitry Antipov wrote:
> 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.

I attempted to boot this on riscv32 in qemu with u-boot. I used
CONFIG_EFI_ZBOOT to generate vmlinux.efi. With this option enabled,
there is the same undefined reference errors with this patch applied.
I have not found a good way to resolve this issue, so I resorted to
copying the __lshrdi3() implementation over into
drivers/firmware/efi/libstub/riscv.c and that successfully booted with
EFI.

- Charlie

> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202603041925.KLKqpK6N-lkp@intel.com
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Dmitry Antipov <dmantipov@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
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
> 

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2026-04-09  5:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03 10:33 [PATCH v9 0/6] lib and lib/cmdline enhancements Dmitry Antipov
2026-04-03 10:33 ` [PATCH v9 1/6] lib: fix _parse_integer_limit() to handle overflow Dmitry Antipov
2026-04-03 10:33 ` [PATCH v9 2/6] lib: fix memparse() " Dmitry Antipov
2026-04-03 10:33 ` [PATCH v9 3/6] lib: add more string to 64-bit integer conversion overflow tests Dmitry Antipov
2026-04-03 10:33 ` [PATCH v9 4/6] lib/cmdline_kunit: add test case for memparse() Dmitry Antipov
2026-04-03 10:33 ` [PATCH v9 5/6] lib/cmdline: adjust a few comments to fix kernel-doc -Wreturn warnings Dmitry Antipov
2026-04-03 10:33 ` [PATCH v9 6/6] riscv: export symbols needed for riscv32 EFI stub Dmitry Antipov
2026-04-09  5:00   ` Charlie Jenkins [this message]
2026-04-09  8:51     ` Andy Shevchenko
2026-04-03 17:09 ` [PATCH v9 0/6] lib and lib/cmdline enhancements Andrew Morton
2026-04-03 19:25 ` Andrew Morton
2026-04-05  9:13   ` Dmitry Antipov
2026-04-07 16:12     ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260409050018.GA371560@inky.localdomain \
    --to=thecharlesjenkins@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=ardb@kernel.org \
    --cc=david.laight.linux@gmail.com \
    --cc=djwong@kernel.org \
    --cc=dmantipov@yandex.ru \
    --cc=kees@kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=lkp@intel.com \
    --cc=nathan@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox