[Concept,09/17] ulib: efi: Use ulib_has_main() in efi_main()

Message ID 20260216013511.4079770-10-sjg@u-boot.org
State New
Headers
Series ulib: Add multi-arch demo and EFI app support |

Commit Message

Simon Glass Feb. 16, 2026, 1:34 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

The EFI entry point currently hardcodes is_ulib to false when calling
efi_startup(). This means EFI app builds cannot run ulib demo binaries,
since the GD_FLG_ULIB flag is never set.

Use ulib_has_main() instead, which returns false by default (weak
symbol) but returns true when a demo's strong version is linked in. This
allows the same efi_main.o to work for both normal U-Boot and ulib demo
EFI binaries without needing a separate source file.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 lib/efi_client/efi_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/lib/efi_client/efi_main.c b/lib/efi_client/efi_main.c
index e94460c86e1..dfd44695227 100644
--- a/lib/efi_client/efi_main.c
+++ b/lib/efi_client/efi_main.c
@@ -8,13 +8,14 @@ 
 
 #include <efi.h>
 #include <efi_api.h>
+#include <init.h>
 
 efi_status_t EFIAPI efi_main(efi_handle_t image,
 			     struct efi_system_table *sys_table)
 {
 	efi_status_t ret;
 
-	ret = efi_startup(image, sys_table, false);
+	ret = efi_startup(image, sys_table, ulib_has_main());
 	if (ret)
 		return ret;