Message ID | 20240305103134.874444-1-wxjstz@126.com |
---|---|
State | Not Applicable |
Headers | show |
Series | firmware: Prevent _start from not being at the beginning | expand |
On Mär 05 2024, Xiang W wrote: > 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.
在 2024-03-05星期二的 11:43 +0100,Andreas Schwab写道: > On Mär 05 2024, Xiang W wrote: > > > 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
diff --git a/firmware/fw_base.S b/firmware/fw_base.S index 09894e6..7ade6a5 100644 --- a/firmware/fw_base.S +++ b/firmware/fw_base.S @@ -42,7 +42,7 @@ 999: .endm - .section .entry, "ax", %progbits + .section .entry0, "ax", %progbits .align 3 .globl _start .globl _start_warm diff --git a/firmware/fw_base.ldS b/firmware/fw_base.ldS index fb47984..c1dc743 100644 --- a/firmware/fw_base.ldS +++ b/firmware/fw_base.ldS @@ -18,6 +18,7 @@ .text : { PROVIDE(_text_start = .); + *(.entry0) *(.entry) *(.text) . = ALIGN(8);
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. Signed-off-by: Xiang W <wxjstz@126.com> --- firmware/fw_base.S | 2 +- firmware/fw_base.ldS | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)