riscv: Provide __image_copy_{start_end} symbols in linkerscript
authorYao Zi <ziyao@disroot.org>
Wed, 16 Apr 2025 16:25:33 +0000 (16:25 +0000)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Fri, 25 Apr 2025 08:31:29 +0000 (16:31 +0800)
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>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/riscv/cpu/u-boot-spl.lds
arch/riscv/cpu/u-boot.lds

index 9070946..0717833 100644 (file)
@@ -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 = .;
index 2ffe6ba..b11ea8b 100644 (file)
@@ -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 = .;