U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yao Zi <ziyao@disroot.org>
To: Rick Chen <rick@andestech.com>, Leo <ycliang@andestech.com>,
	Tom Rini <trini@konsulko.com>,
	Chia-Wei Wang <chiawei_wang@aspeedtech.com>,
	Oliver Gaskell <Oliver.Gaskell@analog.com>,
	Nathan Barrett-Morrison <nathan.morrison@timesys.com>,
	Greg Malysa <greg.malysa@timesys.com>,
	Trevor Woerner <twoerner@gmail.com>, Peng Fan <peng.fan@nxp.com>,
	Marek Vasut <marex@denx.de>, Paul Kocialkowski <contact@paulk.fr>,
	Jerome Forissier <jerome.forissier@linaro.org>,
	Simon Glass <sjg@chromium.org>,
	Lukas Funke <lukas.funke@weidmueller.com>,
	u-boot@lists.denx.de
Cc: Yao Zi <ziyao@disroot.org>
Subject: [PATCH 2/2] riscv: Provide __image_copy_{start_end} symbols in linkerscript
Date: Mon,  7 Apr 2025 03:37:44 +0000	[thread overview]
Message-ID: <20250407033744.4025-3-ziyao@disroot.org> (raw)
In-Reply-To: <20250407033744.4025-1-ziyao@disroot.org>

Binman looks for __image_copy_start to determine the base address of an
entry if elf-base-sym isn't specified, which is missing in RISC-V port.
This causes binman skips RISC-V SPL entries without filling addresses
into its .binman_sym_table section.

This patch defines __image_copy_start in linkerscript of both SPL and
proper U-Boot to ensure binman_sym functions correctly with the default
binman.dtsi. The paired symbol, __image_copy_end, is introduced as well
for completeness.

Signed-off-by: Yao Zi <ziyao@disroot.org>
---
 arch/riscv/cpu/u-boot-spl.lds | 2 ++
 arch/riscv/cpu/u-boot.lds     | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/arch/riscv/cpu/u-boot-spl.lds b/arch/riscv/cpu/u-boot-spl.lds
index 907094620bd..18eb62c01c6 100644
--- a/arch/riscv/cpu/u-boot-spl.lds
+++ b/arch/riscv/cpu/u-boot-spl.lds
@@ -16,6 +16,7 @@ ENTRY(_start)
 SECTIONS
 {
 	. = ALIGN(4);
+	__image_copy_start = ADDR(.text);
 	.text : {
 		arch/riscv/cpu/start.o	(.text)
 		*(.text*)
@@ -46,6 +47,7 @@ SECTIONS
 
 	_end = .;
 	_image_binary_end = .;
+	_image_copy_end = .;
 
 	.bss : {
 		__bss_start = .;
diff --git a/arch/riscv/cpu/u-boot.lds b/arch/riscv/cpu/u-boot.lds
index 2ffe6ba3c8f..b11ea8b56d2 100644
--- a/arch/riscv/cpu/u-boot.lds
+++ b/arch/riscv/cpu/u-boot.lds
@@ -10,6 +10,7 @@ ENTRY(_start)
 SECTIONS
 {
 	. = ALIGN(4);
+	__image_copy_start = ADDR(.text);
 	.text : {
 		arch/riscv/cpu/start.o	(.text)
 	}
@@ -57,6 +58,8 @@ SECTIONS
 		__efi_runtime_rel_stop = .;
 	}
 
+	__image_copy_end = .;
+
 	/DISCARD/ : { *(.rela.plt*) }
 	.rela.dyn : {
 		__rel_dyn_start = .;
-- 
2.49.0


  parent reply	other threads:[~2025-04-07  3:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07  3:37 [PATCH 0/2] Fix binman_sym functionality on RISC-V port Yao Zi
2025-04-07  3:37 ` [PATCH 1/2] spl: riscv: Disable SPL_BINMAN_UBOOT_SYMBOLS by default Yao Zi
2025-04-07 10:50   ` Simon Glass
2025-04-08 16:21     ` Yao Zi
2025-04-07 11:22   ` Jonas Karlman
2025-04-09  4:27     ` Yao Zi
2025-04-07  3:37 ` Yao Zi [this message]
2025-04-07 10:49   ` [PATCH 2/2] riscv: Provide __image_copy_{start_end} symbols in linkerscript Simon Glass
2025-04-07 11:10   ` Jonas Karlman
2025-04-08  9:32     ` Yao Zi
2025-04-09 13:22       ` Simon Glass

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=20250407033744.4025-3-ziyao@disroot.org \
    --to=ziyao@disroot.org \
    --cc=Oliver.Gaskell@analog.com \
    --cc=chiawei_wang@aspeedtech.com \
    --cc=contact@paulk.fr \
    --cc=greg.malysa@timesys.com \
    --cc=jerome.forissier@linaro.org \
    --cc=lukas.funke@weidmueller.com \
    --cc=marex@denx.de \
    --cc=nathan.morrison@timesys.com \
    --cc=peng.fan@nxp.com \
    --cc=rick@andestech.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=twoerner@gmail.com \
    --cc=u-boot@lists.denx.de \
    --cc=ycliang@andestech.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox