All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Priyanka Jain <priyanka.jain@nxp.com>,
	Qiang Zhao <qiang.zhao@nxp.com>,
	Shengzhou Liu <Shengzhou.Liu@nxp.com>,
	Alexander Graf <agraf@csgraf.de>, Bin Meng <bmeng.cn@gmail.com>,
	Wolfgang Denk <wd@denx.de>, Sinan Akman <sinan@writeme.com>
Cc: u-boot@lists.denx.de
Subject: [PATCH 6/8] powerpc: mpc85xx: Define linker sections in ascending order
Date: Tue,  5 Apr 2022 15:12:35 +0200	[thread overview]
Message-ID: <20220405131237.405-7-pali@kernel.org> (raw)
In-Reply-To: <20220405131237.405-1-pali@kernel.org>

It is too confusing if sections are defined in non-ascending order.

Also linker has to go backward and then again forward when generating final
binary.

To make future changes easier, define all linker sections in ascending
order.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 20 +++++++++++---------
 arch/powerpc/cpu/mpc85xx/u-boot.lds     | 15 ++++++++-------
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds
index 27a5fe6306a3..1b4d1e05a4a3 100644
--- a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds
+++ b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds
@@ -18,6 +18,13 @@ PHDRS
 #endif
 SECTIONS
 {
+/* For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec */
+#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
+	.bootpg IMAGE_TEXT_BASE - 0x1000 :
+	{
+		KEEP(*(.bootpg))
+	} :text = 0xffff
+#endif
 	. = IMAGE_TEXT_BASE;
 	.text : {
 		*(.text*)
@@ -67,18 +74,13 @@ SECTIONS
 	__bss_end = .;
 #endif
 
-/* For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec */
-#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
-	.bootpg ADDR(.text) - 0x1000 :
-	{
-		KEEP(*(.bootpg))
-	} :text = 0xffff
-#else
+/* For nor and nand is needed the SPL with section .resetvec */
+#ifndef CONFIG_SYS_MPC85XX_NO_RESETVEC
 #if defined(CONFIG_FSL_IFC) /* Restrict bootpg at 4K boundry for IFC */
 #ifndef BOOT_PAGE_OFFSET
 #define BOOT_PAGE_OFFSET 0x1000
 #endif
-	.bootpg ADDR(.text) + BOOT_PAGE_OFFSET :
+	.bootpg IMAGE_TEXT_BASE + BOOT_PAGE_OFFSET :
 	{
 		arch/powerpc/cpu/mpc85xx/start.o (.bootpg)
 	}
@@ -90,7 +92,7 @@ SECTIONS
 #else
 #error unknown NAND controller
 #endif
-	.resetvec ADDR(.text) + RESET_VECTOR_OFFSET : {
+	.resetvec IMAGE_TEXT_BASE + RESET_VECTOR_OFFSET : {
 		KEEP(*(.resetvec))
 	} = 0xffff
 #endif
diff --git a/arch/powerpc/cpu/mpc85xx/u-boot.lds b/arch/powerpc/cpu/mpc85xx/u-boot.lds
index 9d0f0d58d804..e1bbee43bcb4 100644
--- a/arch/powerpc/cpu/mpc85xx/u-boot.lds
+++ b/arch/powerpc/cpu/mpc85xx/u-boot.lds
@@ -23,6 +23,13 @@ PHDRS
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
+#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
+  .bootpg CONFIG_SYS_TEXT_BASE - 0x1000 :
+  {
+    KEEP(arch/powerpc/cpu/mpc85xx/start.o (.bootpg))
+  } :text = 0xffff
+  . = CONFIG_SYS_TEXT_BASE;
+#endif
   .text      :
   {
     *(.text*)
@@ -77,13 +84,7 @@ SECTIONS
   __init_end = .;
   _end = .;
 
-#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
-  .bootpg ADDR(.text) - 0x1000 :
-  {
-    KEEP(arch/powerpc/cpu/mpc85xx/start.o (.bootpg))
-  } :text = 0xffff
-  . = _end;
-#else
+#ifndef CONFIG_SYS_MPC85XX_NO_RESETVEC
   .bootpg RESET_VECTOR_ADDRESS - 0xffc :
   {
     arch/powerpc/cpu/mpc85xx/start.o	(.bootpg)
-- 
2.20.1


  parent reply	other threads:[~2022-04-05 13:15 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05 13:12 [PATCH 0/8] powerpc: mpc85xx: Fix and cleanup mpc85xx code Pali Rohár
2022-04-05 13:12 ` [PATCH 1/8] powerpc: mpc85xx: Fix CONFIG_OF_SEPARATE support Pali Rohár
2022-04-08 11:04   ` Pali Rohár
2022-04-05 13:12 ` [PATCH 2/8] powerpc: mpc85xx: Remove duplicate u-boot-nand.lds Pali Rohár
2022-04-05 13:12 ` [PATCH 3/8] powerpc: mpc85xx: Remove u-boot-nand_spl.lds Pali Rohár
2022-04-05 13:12 ` [PATCH 4/8] powerpc: mpc85xx: Remove useless SIZEOF_HEADERS and .interp from ld script Pali Rohár
2022-04-05 13:12 ` [PATCH 5/8] powerpc: mpc85xx: Put bss after image when not including reset vector Pali Rohár
2022-04-05 13:12 ` Pali Rohár [this message]
2022-04-05 13:12 ` [PATCH 7/8] powerpc: mpc85xx: Set TEXT_BASE addresses to real base values Pali Rohár
2022-04-25  4:27   ` Priyanka Jain (OSS)
2022-04-25 12:31     ` Pali Rohár
2022-05-11 18:59       ` Pali Rohár
2022-05-18 10:51         ` Pali Rohár
2022-06-04 13:01           ` Pali Rohár
2022-04-25 12:29   ` [PATCH v2] " Pali Rohár
2022-06-16  8:57     ` Peng Fan (OSS)
2022-06-16  9:30       ` Pali Rohár
2022-06-16 12:19       ` [PATCH v3] " Pali Rohár
2022-06-23 11:29         ` Pali Rohár
2022-06-23 12:34           ` Tom Rini
2022-06-28  9:18             ` Pali Rohár
2022-06-28 13:42               ` Tom Rini
2022-06-28 14:52         ` Tom Rini
2022-06-28 17:43           ` Pali Rohár
2022-04-05 13:12 ` [PATCH 8/8] board: freescale: p1_p2_rdb_pc: Simplify SPL offset macros Pali Rohár
2022-06-28 17:53   ` [PATCH v2] " Pali Rohár
2022-06-28 18:17     ` Tom Rini
2022-06-28 18:22       ` Pali Rohár
2022-06-28 18:28         ` Tom Rini
2022-06-28 18:34           ` Pali Rohár
2022-06-28 18:39             ` Tom Rini
2022-06-28 18:41               ` Pali Rohár
2022-06-28 18:53                 ` Tom Rini
2022-06-28 18:58                   ` Pali Rohár
2022-06-28 19:08                     ` Tom Rini
2022-06-28 19:13                       ` Pali Rohár
2022-04-05 17:03 ` [PATCH 0/8] powerpc: mpc85xx: Fix and cleanup mpc85xx code Sinan Akman
2022-04-05 17:17   ` Pali Rohár
2022-04-05 18:10     ` Sinan Akman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220405131237.405-7-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=Shengzhou.Liu@nxp.com \
    --cc=agraf@csgraf.de \
    --cc=bmeng.cn@gmail.com \
    --cc=priyanka.jain@nxp.com \
    --cc=qiang.zhao@nxp.com \
    --cc=sinan@writeme.com \
    --cc=u-boot@lists.denx.de \
    --cc=wd@denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.