From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B11BAC4338F for ; Thu, 22 Jul 2021 20:00:42 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CCA6A60ED8 for ; Thu, 22 Jul 2021 20:00:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CCA6A60ED8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nic.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 86CE782C19; Thu, 22 Jul 2021 22:00:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=nic.cz header.i=@nic.cz header.b="ctEmWRKu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B4A0E82C44; Thu, 22 Jul 2021 22:00:37 +0200 (CEST) Received: from mail.nic.cz (mail.nic.cz [217.31.204.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8566982BDF for ; Thu, 22 Jul 2021 22:00:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.behun@nic.cz Received: from thinkpad (unknown [172.20.6.87]) by mail.nic.cz (Postfix) with ESMTPSA id E96D013FD0A; Thu, 22 Jul 2021 22:00:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1626984034; bh=qHWZ4M0Cbme2nk82HUd8BAYVGtZTGBwM3i+B9UX122U=; h=Date:From:To; b=ctEmWRKufD28WSC5K7DnTVsBupyYep1KP+u2QMxqftuchVxcjxBwx4c9vuAIXbtgt n0lDo73YLkMTnzYaMiaxxlq1gppiKVZo40lEgEAwAFr7yNhHNDbSyzXJdRF3MXbA2+ 1z+HjGHXJD8XpxZpJmmzrcued7OiOK1K/zXt2Ebw= Date: Thu, 22 Jul 2021 22:00:33 +0200 From: Marek Behun To: Patrick Delaunay Cc: , Simon Glass , Andre Przywara , Bin Meng , U-Boot STM32 Subject: Re: [RESEND PATCH] build: remove the variable NM in gen_ll_addressable_symbols.sh Message-ID: <20210722220033.585757c9@thinkpad> In-Reply-To: <20210721095553.RESEND.1.I550b95f6d12d59aeef5b744d837dbb360037d39e@changeid> References: <20210721095553.RESEND.1.I550b95f6d12d59aeef5b744d837dbb360037d39e@changeid> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Wed, 21 Jul 2021 09:56:07 +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 > Signed-off-by: Patrick Delaunay > --- > 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 ' > -$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