Skip to contentSkip to conversation

firmware: Rename __rel_dyn_start/end to __rela_dyn_start/end

PATCH Applied Jessica Clarke 3 participants 3 messages Jul 10, 2025 – Jul 21, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firmware: Rename __rel_dyn_start/end to __rela_dyn_start/end

We are using and expecting the RELA format, not the REL format, and this is the conventional linker-generated name for the start/end symbols, so use it rather than confusing things by making it look like we're accessing .rel.dyn, which would be in the REL format with no explicit addend.

---
 firmware/fw_base.S   | 4 ++--
 firmware/fw_base.ldS | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
firmware/fw_base.S +2 -2
index aa8e264..b675c9e 100644
@@ -76,8 +76,8 @@ _sc_fail:
 	li	t0, FW_TEXT_START	/* link start */
 	lla	t1, _fw_start		/* load start */
 	sub	t2, t1, t0		/* load offset */
-	lla	t0, __rel_dyn_start
-	lla	t1, __rel_dyn_end
+	lla	t0, __rela_dyn_start
+	lla	t1, __rela_dyn_end
 	beq	t0, t1, _relocate_done
 2:
 	REG_L	t5, __SIZEOF_LONG__(t0)	/* t5 <-- relocation info:type */
firmware/fw_base.ldS +2 -2
index a33746a..12c7a84 100644
@@ -47,9 +47,9 @@
 	. = ALIGN(0x1000); /* Ensure next section is page aligned */
 
 	.rela.dyn : {
-		PROVIDE(__rel_dyn_start = .);
+		PROVIDE(__rela_dyn_start = .);
 		*(.rela*)
-		PROVIDE(__rel_dyn_end = .);
+		PROVIDE(__rela_dyn_end = .);
 	}
 
 	PROVIDE(_rodata_end = .);
Signature · 7 lines
2.34.1


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 11 lines · Jessica Clarke

We are using and expecting the RELA format, not the REL format, and this is the conventional linker-generated name for the start/end symbols, so use it rather than confusing things by making it look like we're accessing .rel.dyn, which would be in the REL format with no explicit addend.

---
 firmware/fw_base.S   | 4 ++--
 firmware/fw_base.ldS | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
Signature · 3 lines
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
Applied
#2 lore raw
In reply to Jessica Clarke
Quoted 8 lines · Jessica Clarke

We are using and expecting the RELA format, not the REL format, and this is the conventional linker-generated name for the start/end symbols, so use it rather than confusing things by making it look like we're accessing .rel.dyn, which would be in the REL format with no explicit addend.

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 44 lines
---
 firmware/fw_base.S   | 4 ++--
 firmware/fw_base.ldS | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
firmware/fw_base.S +2 -2
index aa8e264..b675c9e 100644
@@ -76,8 +76,8 @@ _sc_fail:
        li      t0, FW_TEXT_START       /* link start */
        lla     t1, _fw_start           /* load start */
        sub     t2, t1, t0              /* load offset */
-       lla     t0, __rel_dyn_start
-       lla     t1, __rel_dyn_end
+       lla     t0, __rela_dyn_start
+       lla     t1, __rela_dyn_end
        beq     t0, t1, _relocate_done
 2:
        REG_L   t5, __SIZEOF_LONG__(t0) /* t5 <-- relocation info:type */
firmware/fw_base.ldS +2 -3
index a33746a..12c7a84 100644
@@ -47,9 +47,9 @@
        . = ALIGN(0x1000); /* Ensure next section is page aligned */
 
        .rela.dyn : {
-               PROVIDE(__rel_dyn_start = .);
+               PROVIDE(__rela_dyn_start = .);
                *(.rela*)
-               PROVIDE(__rel_dyn_end = .);
+               PROVIDE(__rela_dyn_end = .);
        }
 
        PROVIDE(_rodata_end = .);
--

2.34.1

--
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi

Signature · 3 lines
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi