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=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 1BA30C4338F for ; Tue, 24 Aug 2021 11:28:46 +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 06CB161184 for ; Tue, 24 Aug 2021 11:28:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 06CB161184 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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 66EB480A22; Tue, 24 Aug 2021 13:28:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="NeI461LR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0C11681F74; Tue, 24 Aug 2021 13:28:40 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (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 70310805DF for ; Tue, 24 Aug 2021 13:28:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 141EC6135F; Tue, 24 Aug 2021 11:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629804512; bh=Hao+ktQA4AIHQ4jz7MaRkCTZybLO1+sU6o0AebSTH08=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NeI461LRc3yZO30eHwucFUyixZPzDt7P7LJoPIg2berJjOEPjhZ2Ub8FxgndUPWmJ dqTs4fi8lgfsgFqXeMJIMPeXS06yANwb9HuFHMAVUfuoD5DbmwHKa+l8ysAIVkJq+N aj5zs5KJFfg7PG+6xhwjjLOwjfFjirm0sapnHjcE6bz7wrDahuT2Vos0MldO/rnDop zbk5dZvvcgX2MQusD9g+6nZEzmb5FbMrbxGwpb1cePYGE+OKG7M89Lfig2khhpNkOc 52kCCnMAo+sh46AhwMBvSLg3xcWcvovU/Pe7hKbmWZPcVhmTgnj+0VJjIXIlIlnjOJ kgIz8ntXIyA1g== Received: by pali.im (Postfix) id A97597A5; Tue, 24 Aug 2021 13:28:29 +0200 (CEST) Date: Tue, 24 Aug 2021 13:28:29 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Christophe Leroy Cc: Simon Glass , Heinrich Schuchardt , Alexander Graf , Huan Wang , Angelo Dureghello , Wolfgang Denk , Priyanka Jain , Christophe Leroy , Bin Meng , Marek =?utf-8?B?QmVow7pu?= , Tom Rini , u-boot@lists.denx.de Subject: Re: [PATCH v2] powerpc: mpc: Put U-Boot version string at correct place by linker script Message-ID: <20210824112829.57mwhdceeuhmvlpx@pali> References: <20210802131838.21097-8-pali@kernel.org> <20210808112038.7942-1-pali@kernel.org> <9d6a7672-7ef4-1349-f859-060ca6345e13@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9d6a7672-7ef4-1349-f859-060ca6345e13@csgroup.eu> User-Agent: NeoMutt/20180716 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 Tuesday 24 August 2021 07:28:07 Christophe Leroy wrote: > Le 08/08/2021 à 13:20, Pali Rohár a écrit : > > It is unknown why version string is placed at specific position on these > > powerpc mpc platforms. But there is no need to overload version_string > > symbol. Just use common definition of version_string and modify linker > > script to put it at "correct place". > > What's the benefit of this change ? Removal of the _weak_ property of version_string symbol to cleanup U-Boot code, which allows U-Boot build system on second build run to recompile only files which were really changed. > I see more insertions than deletions, it > doesn't remove any redundancy either it seems. And it provides a strange > look to u-boot.lds It is only to ensure that version_string is defined only at one place in U-Boot sources. And for this kind of things it is required to use linker hacks. > I think we should probably investigate the reason for the version at that > specific place if other architectures don't do the same. I agree. This is really the only platform which has version_string at specific place. > > > > Signed-off-by: Pali Rohár > > > > --- > > Changes in v2: > > * Put explicit ".section" keyword before declaring ".text_pre" section as > > some gcc versions cannot recognize specifying custom section without it. > > * Tested compilation for: > > $ make CROSS_COMPILE=powerpc-linux-gnu- MCR3000_defconfig u-boot.bin > > and checked that u-boot.bin header is same with and without this patch > > --- > > arch/powerpc/cpu/mpc83xx/start.S | 10 +++------- > > arch/powerpc/cpu/mpc83xx/u-boot.lds | 3 +++ > > arch/powerpc/cpu/mpc85xx/start.S | 10 ++++------ > > arch/powerpc/cpu/mpc85xx/u-boot-nand.lds | 4 ++++ > > arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 4 ++++ > > arch/powerpc/cpu/mpc85xx/u-boot.lds | 4 ++++ > > arch/powerpc/cpu/mpc8xx/start.S | 9 ++++----- > > board/cssi/MCR3000/u-boot.lds | 2 ++ > > 8 files changed, 28 insertions(+), 18 deletions(-) > > > > diff --git a/arch/powerpc/cpu/mpc8xx/start.S b/arch/powerpc/cpu/mpc8xx/start.S > > index ed735cdee005..09628a0d60f0 100644 > > --- a/arch/powerpc/cpu/mpc8xx/start.S > > +++ b/arch/powerpc/cpu/mpc8xx/start.S > > @@ -23,7 +23,6 @@ > > #include > > #include > > #include > > -#include > > #include > > #include > > @@ -60,12 +59,12 @@ > > * r3 - 1st arg to board_init(): IMMP pointer > > * r4 - 2nd arg to board_init(): boot flag > > */ > > - .text > > + .section .text_pre > > .long 0x27051956 /* U-Boot Magic Number */ > > Instead of creating a new artificial section, maybe you can add the magic > number in front of the version string directly in u-boot.lds ? Well, this patch series is about version_string. I do not want to touch other parts, like magic numbers in this patch series as it is not related to version string in build system. > > - .globl version_string > > -version_string: > > - .ascii U_BOOT_VERSION_STRING, "\0" > > +/* U-Boot version string is filled at this place by linker script */ > > + > > + .text > > . = EXC_OFF_SYS_RESET > > .globl _start > > _start: > > diff --git a/board/cssi/MCR3000/u-boot.lds b/board/cssi/MCR3000/u-boot.lds > > index 70aef3241c8e..9b2ead29b4a5 100644 > > --- a/board/cssi/MCR3000/u-boot.lds > > +++ b/board/cssi/MCR3000/u-boot.lds > > @@ -16,6 +16,8 @@ SECTIONS > > . = + SIZEOF_HEADERS; > > .text : > > { > > + arch/powerpc/cpu/mpc8xx/start.o (.text_pre) > > + *(.text_version_string) > > arch/powerpc/cpu/mpc8xx/start.o (.text) > > arch/powerpc/cpu/mpc8xx/traps.o (.text*) > > arch/powerpc/lib/built-in.o (.text*) > >