Makefile: Move PLATFORM_LIBS outside the the whole-archive region
PATCH v2 1/1 Makefile: Move PLATFORM_LIBS outside the the whole-archive region
The LTO link passes $(PLATFORM_LIBS) (-lgcc) inside the --whole-archive region, forcing every libgcc.a member to be linked. On AArch64 this pulls in members needing libc symbols U-Boot lacks (__getauxval, abort, stderr), so the link fails, e.g. on p3450-0000. Place $(PLATFORM_LIBS) after --no-whole-archive, as the non-LTO link already does, on both the main Makefile and the XPL Makefile as they both exhibit the same issue.
Signed-off-by Peter Robinson <[email protected]>
---
v2:
- Also Update Makefile.xpl
Makefile | 2 +- scripts/Makefile.xpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
@@ -2093,8 +2093,8 @@ quiet_cmd_u-boot__ ?= LTO $@ -Wl,--whole-archive \ $(u-boot-main) \ $(u-boot-keep-syms-lto) \ - $(PLATFORM_LIBS) \ -Wl,--no-whole-archive \ + $(PLATFORM_LIBS) \ -Wl,-Map,u-boot.map; \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) else
scripts/Makefile.xpl +1 -1
@@ -521,8 +521,8 @@ quiet_cmd_u-boot-spl ?= LTO $@ $(patsubst $(obj)/%,%,$(u-boot-spl-main)) \ $(patsubst $(obj)/%,%,$(u-boot-spl-platdata)) \ $(patsubst $(obj)/%,%,$(u-boot-spl-keep-syms-lto)) \ - $(PLATFORM_LIBS) \ -Wl,--no-whole-archive \ + $(PLATFORM_LIBS) \ -Wl,-Map,$(SPL_BIN).map -o $(SPL_BIN) \ ) else
Signature · 1 line
2.56.1