efi: arm: Allow --gc-sections in the EFI app

This option is used on most other boards. Leaving it disabled creates
situations where the linker fails to build, due to symbols which are
referenced only it code that would have been garbage-collected.

To keep this disabled we would need to introduce #ifdefs not needed by
other platforms, which would be annoying.

The only current reason why this cannot be enabled is that the
linker lists are lost. Add a KEEP() around these, and enable the option.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-08-08 15:18:03 -06:00
parent 405986ff18
commit 70b5f8dc80
2 changed files with 1 additions and 3 deletions

View File

@@ -14,10 +14,8 @@ CFLAGS_NON_EFI := -fno-pic $(FIXED_REG) -ffunction-sections -fdata-sections \
CFLAGS_EFI := -fpic -fshort-wchar
ifneq ($(LTO_ENABLE)$(CONFIG_USE_PRIVATE_LIBGCC),yy)
ifndef CONFIG_EFI_APP
LDFLAGS_FINAL += --gc-sections
endif
endif
ifneq ($(LTO_ENABLE),y)
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections

View File

@@ -46,7 +46,7 @@ SECTIONS
*(.got)
/* U-Boot lists and device tree */
. = ALIGN(8);
*(SORT(__u_boot_list*));
KEEP(*(SORT(__u_boot_list*)));
. = ALIGN(8);
/*