libpayload: Makefile.mk: Fix unrecognized option '--no-weak'

aarch64-elf nm doesn't support '--no-weak'. Replace the 'nm --no-weak'
call with 'grep' with "[TDRCB]" pattern to collect the non-weak
symbols.

Change-Id: I19195034b31f39086946b7e5ee15317d6f5dd880
Signed-off-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/91566
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Yu-Ping Wu 2026-03-05 16:51:05 +08:00
commit 82de37d171

View file

@ -111,8 +111,8 @@ includes-handler= \
$(obj)/libpayload.a: $(foreach class,$(libraries),$$($(class)-objs))
printf " AR $(subst $(CURDIR)/,,$(@))\n"
printf "create $@\n$(foreach objc,$(filter-out %.a,$^),addmod $(objc)\n)$(foreach lib,$(filter %.a,$^),addlib $(lib)\n)save\nend\n" | $(AR) -M
for func in $$($(NM) $@ | awk '/ (w|W) / { print $$NF }'); do \
if $(NM) --no-weak --defined-only $@ | grep -Eq " $$func$$"; then \
for func in $$($(NM) $@ | awk '/ [wW] / { print $$NF }'); do \
if $(NM) $@ 2>/dev/null | grep -Eq " [TDRCB] $${func}$$"; then \
printf "\nERROR: Function '$$func' appears as both weak and strong symbol in libpayload.\n"; \
printf " Weak symbol overrides don't work reliably from within the same library.\n\n"; \
rm $@; \