efi: Adjust condition for runtime relocation
Even if CONFIG_ULIB is enabled it may not actually be in use. If not, we still need the EFI-runtime relocation to happen. Adjust the condition in efi_runtime_relocate() to fix this. For static linking with ulib examples, provide weak symbol definitions for __efi_runtime_rel_start and __efi_runtime_rel_stop. These symbols are normally defined in linker scripts but need fallback definitions when linking statically against libu-boot.a. Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
@@ -41,7 +41,7 @@ obj-y += efi_image_loader.o
|
||||
obj-$(CONFIG_EFI_LOG) += efi_log.o
|
||||
obj-y += efi_memory.o
|
||||
obj-y += efi_root_node.o
|
||||
obj-y += efi_runtime.o
|
||||
obj-y += efi_runtime.o efi_runtime_stubs.o
|
||||
obj-y += efi_setup.o
|
||||
obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL2) += efi_unicode_collation.o
|
||||
obj-y += efi_var_common.o
|
||||
|
||||
@@ -717,8 +717,8 @@ static __efi_runtime void efi_relocate_runtime_table(ulong offset)
|
||||
/* Relocate EFI runtime to uboot_reloc_base = offset */
|
||||
void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map)
|
||||
{
|
||||
/* Skip EFI runtime relocation when building as a library */
|
||||
if (IS_ENABLED(CONFIG_ULIB))
|
||||
/* Skip EFI runtime relocation when running as a library */
|
||||
if (gd_ulib())
|
||||
return;
|
||||
|
||||
#ifdef IS_RELA
|
||||
|
||||
15
lib/efi_loader/efi_runtime_stubs.c
Normal file
15
lib/efi_loader/efi_runtime_stubs.c
Normal file
@@ -0,0 +1,15 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* EFI runtime symbols stubs for static linking
|
||||
*
|
||||
* Copyright 2025 Canonical Ltd.
|
||||
* Written by Simon Glass <simon.glass@canonical.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Provide weak symbols for EFI runtime relocation markers.
|
||||
* These are normally defined in linker scripts, but for static linking
|
||||
* (e.g., ulib examples) we need weak definitions that can be overridden.
|
||||
*/
|
||||
char __efi_runtime_rel_start[0] __attribute__((weak));
|
||||
char __efi_runtime_rel_stop[0] __attribute__((weak));
|
||||
Reference in New Issue
Block a user