]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
build: remove the variable NM in gen_ll_addressable_symbols.sh
authorPatrick Delaunay <patrick.delaunay@foss.st.com>
Wed, 21 Jul 2021 07:56:07 +0000 (09:56 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 29 Jul 2021 00:46:34 +0000 (20:46 -0400)
With LTO activated, the buildman tools failed with an error on my
configuration (Ubuntu 20.04, stm32mp15_trusted_defconfig) with the error:

../arm-linux-gnueabi/bin/nm:
scripts/gen_ll_addressable_symbols.sh: file format not recognized

It seems the shell variable initialization NM=$(NM) is not correctly
interpreted when shell is started in the Makefile, but I have not this
issue when I compile the same target without buildman.

I don't found the root reason of the problem but I solve it by
providing $(NM) as script parameter instead using a shell variable.

The command executed is identical:

cmd_keep-syms-lto.c := NM=arm-none-linux-gnueabihf-gcc-nm \
u-boot/scripts/gen_ll_addressable_symbols.sh arch/arm/cpu/built-in.o \
.... net/built-in.o >keep-syms-lto.c

cmd_keep-syms-lto.c := u-boot/scripts/gen_ll_addressable_symbols.sh \
arm-none-linux-gnueabihf-gcc-nm arch/arm/cpu/built-in.o \
... net/built-in.o > keep-syms-lto.c

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Makefile
scripts/Makefile.spl
scripts/gen_ll_addressable_symbols.sh

index b4ae66b2014f0293547e19fe2eb5481e0c108f24..8c84c22b722bd121c733554123f05a129209560c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1735,7 +1735,7 @@ u-boot-keep-syms-lto_c := $(patsubst %.o,%.c,$(u-boot-keep-syms-lto))
 
 quiet_cmd_keep_syms_lto = KSL     $@
       cmd_keep_syms_lto = \
-       NM=$(NM) $(srctree)/scripts/gen_ll_addressable_symbols.sh $^ >$@
+       $(srctree)/scripts/gen_ll_addressable_symbols.sh $(NM) $^ > $@
 
 quiet_cmd_keep_syms_lto_cc = KSLCC   $@
       cmd_keep_syms_lto_cc = \
index 5be1a9ba1b11807e57bbc2f2f35442e3dbbf474d..25a3e7fa52e998b596558c3e81a0c41274e7d1b4 100644 (file)
@@ -459,7 +459,7 @@ u-boot-spl-keep-syms-lto_c := \
 
 quiet_cmd_keep_syms_lto = KSL     $@
       cmd_keep_syms_lto = \
-       NM=$(NM) $(srctree)/scripts/gen_ll_addressable_symbols.sh $^ >$@
+       $(srctree)/scripts/gen_ll_addressable_symbols.sh $(NM) $^ > $@
 
 quiet_cmd_keep_syms_lto_cc = KSLCC   $@
       cmd_keep_syms_lto_cc = \
index 3978a39d9709d1d00416b74d734398302400e1ee..b8840dd011351ca0ca6946f0426e495c8bd0c3a2 100755 (executable)
@@ -5,8 +5,11 @@
 # Generate __ADDRESSABLE(symbol) for every linker list entry symbol, so that LTO
 # does not optimize these symbols away
 
+# The expected parameter of this script is the command requested to have
+# the U-Boot symbols to parse, for example: $(NM) $(u-boot-main)
+
 set -e
 
 echo '#include <common.h>'
-$NM "$@" 2>/dev/null | grep -oe '_u_boot_list_2_[a-zA-Z0-9_]*_2_[a-zA-Z0-9_]*' | \
+$@ 2>/dev/null | grep -oe '_u_boot_list_2_[a-zA-Z0-9_]*_2_[a-zA-Z0-9_]*' | \
        sort -u | sed -e 's/^\(.*\)/extern char \1[];\n__ADDRESSABLE(\1);/'