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=-19.7 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_GIT 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 22473C4338F for ; Sun, 8 Aug 2021 11:21:50 +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 E4E0960F39 for ; Sun, 8 Aug 2021 11:21:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E4E0960F39 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 3FFDE82051; Sun, 8 Aug 2021 13:21:46 +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="S4uo+jup"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EAC98821F0; Sun, 8 Aug 2021 13:21:44 +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 870CB82003 for ; Sun, 8 Aug 2021 13:21:37 +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 7FD0B60F39; Sun, 8 Aug 2021 11:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628421695; bh=f4nk+6FYeC/XYyR9l2CIWLu38OCZoIkhsmhdJKRy9JE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S4uo+jupgdWwZDcDYwOPb3MYWao2TmT6yUcd9iKz8HgHRdB+QEz7a7vAovq/fIO6s lPbZ6xugGxdvpF1oEsO+EySXbVX9u9ogjb5aq5taUGCRVzgqkmFHVFrur34mCzHv7s o3EVgEOiVg1ayaI2bg4SMahndftY79Zupuxk2hwf7FPxSQIlJoNvsLZ+008T7MKWRb +5X/OWrcnVz3iFISv/G4h7zNVBShpbrD4g0cLIkfe4FN3b3LwKBOFuRWKFOWz1UC2T JcuF5Hr6cpaaBo+SNORvsRTBDr+QqVtUXWKaBkfqZzYihS/tWWnUuUtH0JwVV90GSw JwhOQtaR9I3FA== Received: by pali.im (Postfix) id 1BB1B13DC; Sun, 8 Aug 2021 13:21:33 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Simon Glass , Heinrich Schuchardt , Alexander Graf , Huan Wang , Angelo Dureghello , Wolfgang Denk , Priyanka Jain , Christophe Leroy , Bin Meng , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Tom Rini Cc: u-boot@lists.denx.de Subject: [PATCH v2] powerpc: mpc: Put U-Boot version string at correct place by linker script Date: Sun, 8 Aug 2021 13:20:38 +0200 Message-Id: <20210808112038.7942-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210802131838.21097-8-pali@kernel.org> References: <20210802131838.21097-8-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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". 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/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S index 9da22ce486a9..87747f2b2275 100644 --- a/arch/powerpc/cpu/mpc83xx/start.S +++ b/arch/powerpc/cpu/mpc83xx/start.S @@ -13,7 +13,6 @@ #include #include #include -#include #define CONFIG_83XX 1 /* needed for Linux kernel header files*/ @@ -76,7 +75,7 @@ * times so the processor can fetch it out of flash whether the flash * is 8, 16, 32, or 64 bits wide (hardware trickery). */ - .text + .section .text_pre #define _HRCW_TABLE_ENTRY(w) \ .fill 8,1,(((w)>>24)&0xff); \ .fill 8,1,(((w)>>16)&0xff); \ @@ -92,12 +91,9 @@ */ .long 0x27051956 /* U-Boot Magic Number */ - .globl version_string -version_string: - .ascii U_BOOT_VERSION_STRING, "\0" - - .align 2 +/* U-Boot version string is filled at this place by linker script */ + .text .globl enable_addr_trans enable_addr_trans: /* enable address translation */ diff --git a/arch/powerpc/cpu/mpc83xx/u-boot.lds b/arch/powerpc/cpu/mpc83xx/u-boot.lds index d10f528da4c4..309082bc3df5 100644 --- a/arch/powerpc/cpu/mpc83xx/u-boot.lds +++ b/arch/powerpc/cpu/mpc83xx/u-boot.lds @@ -10,6 +10,9 @@ SECTIONS /* Read-only sections, merged into text segment: */ .text : { + arch/powerpc/cpu/mpc83xx/start.o (.text_pre) + *(.text_version_string) + . = ALIGN(2); arch/powerpc/cpu/mpc83xx/start.o (.text*) *(.text*) . = ALIGN(16); diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S index f41e82ad189f..5ba26d3c449b 100644 --- a/arch/powerpc/cpu/mpc85xx/start.S +++ b/arch/powerpc/cpu/mpc85xx/start.S @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -1134,15 +1133,14 @@ switch_as: blr #endif - .text + .section .text_pre .globl _start _start: .long 0x27051956 /* U-BOOT Magic Number */ - .globl version_string -version_string: - .ascii U_BOOT_VERSION_STRING, "\0" - .align 4 +/* U-Boot version string is filled at this place by linker script */ + + .text .globl _start_cont _start_cont: /* Setup the stack in initial RAM,could be L2-as-SRAM or L1 dcache*/ diff --git a/arch/powerpc/cpu/mpc85xx/u-boot-nand.lds b/arch/powerpc/cpu/mpc85xx/u-boot-nand.lds index 75b0285e4e51..6e48223380cb 100644 --- a/arch/powerpc/cpu/mpc85xx/u-boot-nand.lds +++ b/arch/powerpc/cpu/mpc85xx/u-boot-nand.lds @@ -25,6 +25,10 @@ SECTIONS .interp : { *(.interp) } .text : { + arch/powerpc/cpu/mpc85xx/start.o (.text_pre) + *(.text_version_string) + . = ALIGN(4); + arch/powerpc/cpu/mpc85xx/start.o (.text*) *(.text*) } :text _etext = .; diff --git a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds index 27a5fe6306a3..2312cd47f11d 100644 --- a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds +++ b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds @@ -20,6 +20,10 @@ SECTIONS { . = IMAGE_TEXT_BASE; .text : { + arch/powerpc/cpu/mpc85xx/start.o (.text_pre) + *(.text_version_string) + . = ALIGN(4); + arch/powerpc/cpu/mpc85xx/start.o (.text*) *(.text*) } _etext = .; diff --git a/arch/powerpc/cpu/mpc85xx/u-boot.lds b/arch/powerpc/cpu/mpc85xx/u-boot.lds index 22bbac51aa33..40d181ef2caa 100644 --- a/arch/powerpc/cpu/mpc85xx/u-boot.lds +++ b/arch/powerpc/cpu/mpc85xx/u-boot.lds @@ -31,6 +31,10 @@ SECTIONS .interp : { *(.interp) } .text : { + arch/powerpc/cpu/mpc85xx/start.o (.text_pre) + *(.text_version_string) + . = ALIGN(4); + arch/powerpc/cpu/mpc85xx/start.o (.text*) *(.text*) } :text _etext = .; 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 */ - .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*) -- 2.20.1