Skip to contentSkip to conversation

firmware: Prevent _start from not being at the beginning

PATCH New Xiang W 2 participants 3 messages Mar 5, 2024

lore
Share & tools
lore

Xiang W

author
#0 lore raw

PATCH 1/1 firmware: Prevent _start from not being at the beginning

There are multiple .entry sections in opensbi, and _start may be put after other .entry sections, which may cause problems. The patch fix this issue.

---
 firmware/fw_base.S   | 2 +-
 firmware/fw_base.ldS | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
firmware/fw_base.S +1 -1
index 09894e6..7ade6a5 100644
@@ -42,7 +42,7 @@
 999:
 .endm
 
-	.section .entry, "ax", %progbits
+	.section .entry0, "ax", %progbits
 	.align 3
 	.globl _start
 	.globl _start_warm
firmware/fw_base.ldS +1 -0
index fb47984..c1dc743 100644
@@ -18,6 +18,7 @@
 	.text :
  	{
 		PROVIDE(_text_start = .);
+		*(.entry0)
 		*(.entry)
 		*(.text)
 		. = ALIGN(8);
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/1 firmware: Prevent _start from not being at the beginning

Quoted 3 lines · Xiang W

There are multiple .entry sections in opensbi, and _start may be put after other .entry sections, which may cause problems. The patch fix this issue.

That should not be a problem. Since it is passed as the first object file to the linker it is guaranteed to be placed first.

Signature · 3 lines
Andreas Schwab, SUSE Labs, schwab at suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
author
#2 lore raw

PATCH 1/1 firmware: Prevent _start from not being at the beginning

? 2024-03-05???? 11:43 +0100?Andreas Schwab???

Quoted 9 lines · Xiang W
Quoted 4 lines

There are multiple .entry sections in opensbi, and _start may be put after other .entry sections, which may cause problems. The patch fix this issue.

That should not be a problem.? Since it is passed as the first object file to the linker it is guaranteed to be placed first.

Thank you for your reply

Is this the default behavior of the linker or is there any standard provision? If there are no standards, modifications will still be? needed.

Regards,
Xiang W