* [RESEND PATCH] build: remove the variable NM in gen_ll_addressable_symbols.sh
@ 2021-07-21 7:56 Patrick Delaunay
2021-07-22 20:00 ` Marek Behun
2021-07-29 16:49 ` Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Patrick Delaunay @ 2021-07-21 7:56 UTC (permalink / raw)
To: u-boot
Cc: Marek Behún, Simon Glass, Patrick Delaunay, Andre Przywara,
Bin Meng, U-Boot STM32
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>
---
Resend with correct commit message for patman
s/Serie-cc/Series-cc/
Makefile | 2 +-
scripts/Makefile.spl | 2 +-
scripts/gen_ll_addressable_symbols.sh | 5 ++++-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index ca2432c8ce..140dea09f4 100644
--- a/Makefile
+++ b/Makefile
@@ -1736,7 +1736,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 = \
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 5be1a9ba1b..25a3e7fa52 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -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 = \
diff --git a/scripts/gen_ll_addressable_symbols.sh b/scripts/gen_ll_addressable_symbols.sh
index 3978a39d97..b8840dd011 100755
--- a/scripts/gen_ll_addressable_symbols.sh
+++ b/scripts/gen_ll_addressable_symbols.sh
@@ -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);/'
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RESEND PATCH] build: remove the variable NM in gen_ll_addressable_symbols.sh
2021-07-21 7:56 [RESEND PATCH] build: remove the variable NM in gen_ll_addressable_symbols.sh Patrick Delaunay
@ 2021-07-22 20:00 ` Marek Behun
2021-07-29 16:49 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Marek Behun @ 2021-07-22 20:00 UTC (permalink / raw)
To: Patrick Delaunay
Cc: u-boot, Simon Glass, Andre Przywara, Bin Meng, U-Boot STM32
On Wed, 21 Jul 2021 09:56:07 +0200
Patrick Delaunay <patrick.delaunay@foss.st.com> wrote:
> 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>
> ---
> Resend with correct commit message for patman
> s/Serie-cc/Series-cc/
>
>
> Makefile | 2 +-
> scripts/Makefile.spl | 2 +-
> scripts/gen_ll_addressable_symbols.sh | 5 ++++-
> 3 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index ca2432c8ce..140dea09f4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1736,7 +1736,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 = \
> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> index 5be1a9ba1b..25a3e7fa52 100644
> --- a/scripts/Makefile.spl
> +++ b/scripts/Makefile.spl
> @@ -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 = \
> diff --git a/scripts/gen_ll_addressable_symbols.sh b/scripts/gen_ll_addressable_symbols.sh
> index 3978a39d97..b8840dd011 100755
> --- a/scripts/gen_ll_addressable_symbols.sh
> +++ b/scripts/gen_ll_addressable_symbols.sh
> @@ -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);/'
Shouldn't we use "$@" ? In case the arguments contain spaces?
Marek
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RESEND PATCH] build: remove the variable NM in gen_ll_addressable_symbols.sh
2021-07-21 7:56 [RESEND PATCH] build: remove the variable NM in gen_ll_addressable_symbols.sh Patrick Delaunay
2021-07-22 20:00 ` Marek Behun
@ 2021-07-29 16:49 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2021-07-29 16:49 UTC (permalink / raw)
To: Patrick Delaunay
Cc: u-boot, Marek Behún, Simon Glass, Andre Przywara, Bin Meng,
U-Boot STM32
[-- Attachment #1: Type: text/plain, Size: 1237 bytes --]
On Wed, Jul 21, 2021 at 09:56:07AM +0200, Patrick Delaunay wrote:
> 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>
Applied to u-boot/master, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-29 16:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 7:56 [RESEND PATCH] build: remove the variable NM in gen_ll_addressable_symbols.sh Patrick Delaunay
2021-07-22 20:00 ` Marek Behun
2021-07-29 16:49 ` Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.