From: Ard Biesheuvel <ardb+git@google.com>
To: linux-efi@vger.kernel.org
Cc: loongarch@lists.linux.dev, Ard Biesheuvel <ardb@kernel.org>,
Dmitry Antipov <dmantipov@yandex.ru>,
Huacai Chen <chenhuacai@kernel.org>,
WANG Xuerui <kernel@xen0n.name>,
kernel test robot <lkp@intel.com>
Subject: [PATCH 1/3] efi/libstub: loongarch: Provide 64-bit integer shift helpers for 32-bit
Date: Thu, 26 Nov 2026 16:50:19 +0100 [thread overview]
Message-ID: <20261126155017.2401147-6-ardb+git@google.com> (raw)
In-Reply-To: <20261126155017.2401147-5-ardb+git@google.com>
From: Ard Biesheuvel <ardb@kernel.org>
The EFI stub's copy of lib/cmdline.c performs 64-bit shifts in
memparse() [which is never actually called from the stub], and so it
needs library routines when running on 32-bit CPUs that lack native
instructions for this.
The LoongArch 32-bit EFI stub build already pulls in the library helpers
that are needed for this, but only when CONFIG_EFI_ZBOOT=y, which is not
sufficient, given that the same helpers will be needed in the vmlinux
build for the builtin copy of the EFI stub.
On other architectures, the builtin copy will call vmlinux's versions of
those routines, which are exposed to the stub via aliases in the linker
script. However, on LoongArch, those are C implementations that may be
instrumented and therefore unsuitable for use in the EFI stub.
Reported-by: Dmitry Antipov <dmantipov@yandex.ru>
Reported-by: kernel test robot <lkp@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: Ard Biesheuvel <ardb@kernel.org>
---
drivers/firmware/efi/libstub/Makefile | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index bbab12b8eb4b..ba6c9e763862 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -88,7 +88,9 @@ lib-$(CONFIG_ARM64) += kaslr.o arm64.o arm64-stub.o smbios.o
lib-$(CONFIG_X86) += x86-stub.o smbios.o
lib-$(CONFIG_X86_64) += x86-5lvl.o
lib-$(CONFIG_RISCV) += kaslr.o riscv.o riscv-stub.o
-lib-$(CONFIG_LOONGARCH) += loongarch.o loongarch-stub.o
+lib-loongarch-$(CONFIG_32BIT) += lib-ashldi3.o lib-lshrdi3.o
+lib-$(CONFIG_LOONGARCH) += loongarch.o loongarch-stub.o \
+ $(lib-loongarch-y)
CFLAGS_arm32-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
@@ -99,8 +101,7 @@ 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)
+zboot-obj-$(CONFIG_LOONGARCH) += lib-clz_ctz.o
lib-$(CONFIG_EFI_ZBOOT) += zboot.o $(zboot-obj-y)
lib-$(CONFIG_UNACCEPTED_MEMORY) += unaccepted_memory.o bitmap.o find.o
--
2.56.1.839.g22a8290db9-goog
next prev parent reply other threads:[~2026-11-26 15:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 15:50 [PATCH 0/3] efi/libstub: Fix library dependencies Ard Biesheuvel
2026-11-26 15:50 ` Ard Biesheuvel [this message]
2026-11-26 15:50 ` [PATCH 2/3] efi/zboot: Eliminate unused code from the zboot executable Ard Biesheuvel
2026-11-26 15:50 ` [PATCH 3/3] efi/libstub: Provide library helpers only where needed Ard Biesheuvel
2026-11-26 16:22 ` Dmitry Antipov
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=20261126155017.2401147-6-ardb+git@google.com \
--to=ardb+git@google.com \
--cc=ardb@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=dmantipov@yandex.ru \
--cc=kernel@xen0n.name \
--cc=linux-efi@vger.kernel.org \
--cc=lkp@intel.com \
--cc=loongarch@lists.linux.dev \
/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