[PATCH v4 12/19] efi/libstub: arm64: Use struct efi_image_info to access image properties
Ard Biesheuvel
ardb+git at google.com
Wed Nov 18 10:21:18 PST 2026
From: Ard Biesheuvel <ardb at kernel.org>
Instead of exposing individual symbols to the EFI stub explicitly via
the linker script, use the generic struct efi_image_info, which accesses
the original symbols via PC-relative references from the stub itself.
This improves code reuse across architectures, and makes it easier to
add new references in a generic manner.
Reviewed-by: Jason Gunthorpe <jgg at nvidia.com>
Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
---
arch/arm64/kernel/image-vars.h | 10 ----------
drivers/firmware/efi/libstub/arm64-stub.c | 8 +++++---
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/arch/arm64/kernel/image-vars.h b/arch/arm64/kernel/image-vars.h
index 19d602e45523..329d5e214b36 100644
--- a/arch/arm64/kernel/image-vars.h
+++ b/arch/arm64/kernel/image-vars.h
@@ -20,8 +20,6 @@
PROVIDE(pisym = sym); \
ASSERT((sym - KIMAGE_VADDR) < (__bss_start - KIMAGE_VADDR), #msg)
-PROVIDE(__efistub_primary_entry = primary_entry);
-
/*
* The EFI stub has its own symbol namespace prefixed by __efistub_, to
* isolate it from the kernel proper. The following symbols are legally
@@ -32,14 +30,6 @@ PROVIDE(__efistub_primary_entry = primary_entry);
* position independent manner
*/
PROVIDE(__efistub_caches_clean_inval_pou = __pi_caches_clean_inval_pou);
-
-PROVIDE(__efistub__text = _text);
-PROVIDE(__efistub__end = _end);
-PROVIDE(__efistub___inittext_end = __inittext_end);
-PROVIDE(__efistub__edata = _edata);
-#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
-PROVIDE(__efistub_sysfb_primary_display = sysfb_primary_display);
-#endif
PROVIDE(__efistub__ctype = _ctype);
PROVIDE(__pi___memcpy = __pi_memcpy);
diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c
index af38cf73cf01..351fcb4493e1 100644
--- a/drivers/firmware/efi/libstub/arm64-stub.c
+++ b/drivers/firmware/efi/libstub/arm64-stub.c
@@ -19,12 +19,14 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
efi_handle_t image_handle,
const struct efi_image_info **image_info)
{
- if (image->image_base != _text) {
+ unsigned long kernel_base = efistub_kernel_base(*image_info);
+
+ if (image->image_base != (void *)kernel_base) {
efi_err("FIRMWARE BUG: efi_loaded_image_t::image_base has bogus value\n");
- image->image_base = _text;
+ image->image_base = (void *)kernel_base;
}
- if (!IS_ALIGNED((u64)_text, SEGMENT_ALIGN))
+ if (!IS_ALIGNED(kernel_base, SEGMENT_ALIGN))
efi_err("FIRMWARE BUG: kernel image not aligned on %dk boundary\n",
SEGMENT_ALIGN >> 10);
--
2.56.1.708.g77570a6a1d-goog
More information about the linux-riscv
mailing list