mirror of
https://github.com/Fishwaldo/opensbi.git
synced 2025-06-24 15:18:37 +00:00
firmware: Fix placement of .align directives
Move the .align directives after switching the section. We want to align the start of the current section, not the end of the previous section. This also obsoletes the misguided workaround of disabling relaxation. Signed-off-by: Andreas Schwab <schwab@suse.de> Reviewed-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
parent
f95dd39ab6
commit
6ffe1bed09
5 changed files with 34 additions and 44 deletions
|
@ -41,8 +41,8 @@
|
||||||
999:
|
999:
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.globl _start
|
.globl _start
|
||||||
.globl _start_warm
|
.globl _start_warm
|
||||||
_start:
|
_start:
|
||||||
|
@ -405,8 +405,8 @@ _link_start:
|
||||||
_link_end:
|
_link_end:
|
||||||
RISCV_PTR _fw_reloc_end
|
RISCV_PTR _fw_reloc_end
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.globl _hartid_to_scratch
|
.globl _hartid_to_scratch
|
||||||
_hartid_to_scratch:
|
_hartid_to_scratch:
|
||||||
add sp, sp, -(3 * __SIZEOF_POINTER__)
|
add sp, sp, -(3 * __SIZEOF_POINTER__)
|
||||||
|
@ -440,15 +440,15 @@ _hartid_to_scratch:
|
||||||
add sp, sp, (3 * __SIZEOF_POINTER__)
|
add sp, sp, (3 * __SIZEOF_POINTER__)
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.globl _start_hang
|
.globl _start_hang
|
||||||
_start_hang:
|
_start_hang:
|
||||||
wfi
|
wfi
|
||||||
j _start_hang
|
j _start_hang
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.globl _trap_handler
|
.globl _trap_handler
|
||||||
_trap_handler:
|
_trap_handler:
|
||||||
/* Swap TP and MSCRATCH */
|
/* Swap TP and MSCRATCH */
|
||||||
|
@ -603,8 +603,8 @@ _skip_mstatush_restore:
|
||||||
|
|
||||||
mret
|
mret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.globl _reset_regs
|
.globl _reset_regs
|
||||||
_reset_regs:
|
_reset_regs:
|
||||||
|
|
||||||
|
|
|
@ -11,14 +11,14 @@
|
||||||
|
|
||||||
#include "fw_base.S"
|
#include "fw_base.S"
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
_bad_dynamic_info:
|
_bad_dynamic_info:
|
||||||
wfi
|
wfi
|
||||||
j _bad_dynamic_info
|
j _bad_dynamic_info
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_boot_hart
|
.global fw_boot_hart
|
||||||
/*
|
/*
|
||||||
* This function is called very early even before
|
* This function is called very early even before
|
||||||
|
@ -43,8 +43,8 @@ fw_boot_hart:
|
||||||
2: li a0, -1
|
2: li a0, -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_save_info
|
.global fw_save_info
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, a2, a3, and a4 registers here.
|
* We can only use a0, a1, a2, a3, and a4 registers here.
|
||||||
|
@ -86,8 +86,8 @@ fw_save_info:
|
||||||
2:
|
2:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_prev_arg1
|
.global fw_prev_arg1
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -99,8 +99,8 @@ fw_prev_arg1:
|
||||||
add a0, zero, zero
|
add a0, zero, zero
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_next_arg1
|
.global fw_next_arg1
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -113,8 +113,8 @@ fw_next_arg1:
|
||||||
REG_L a0, (a0)
|
REG_L a0, (a0)
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_next_addr
|
.global fw_next_addr
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -125,8 +125,8 @@ fw_next_addr:
|
||||||
REG_L a0, (a0)
|
REG_L a0, (a0)
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_next_mode
|
.global fw_next_mode
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -137,8 +137,8 @@ fw_next_mode:
|
||||||
REG_L a0, (a0)
|
REG_L a0, (a0)
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_options
|
.global fw_options
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -150,8 +150,8 @@ fw_options:
|
||||||
REG_L a0, (a0)
|
REG_L a0, (a0)
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
_dynamic_next_arg1:
|
_dynamic_next_arg1:
|
||||||
RISCV_PTR 0x0
|
RISCV_PTR 0x0
|
||||||
_dynamic_next_addr:
|
_dynamic_next_addr:
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
#include "fw_base.S"
|
#include "fw_base.S"
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_boot_hart
|
.global fw_boot_hart
|
||||||
/*
|
/*
|
||||||
* This function is called very early even before
|
* This function is called very early even before
|
||||||
|
@ -22,8 +22,8 @@ fw_boot_hart:
|
||||||
li a0, -1
|
li a0, -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_save_info
|
.global fw_save_info
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, a2, a3, and a4 registers here.
|
* We can only use a0, a1, a2, a3, and a4 registers here.
|
||||||
|
@ -34,8 +34,8 @@ fw_boot_hart:
|
||||||
fw_save_info:
|
fw_save_info:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_prev_arg1
|
.global fw_prev_arg1
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -47,8 +47,8 @@ fw_prev_arg1:
|
||||||
add a0, zero, zero
|
add a0, zero, zero
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_next_arg1
|
.global fw_next_arg1
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -64,8 +64,8 @@ fw_next_arg1:
|
||||||
#endif
|
#endif
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_next_addr
|
.global fw_next_addr
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -76,8 +76,8 @@ fw_next_addr:
|
||||||
REG_L a0, (a0)
|
REG_L a0, (a0)
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_next_mode
|
.global fw_next_mode
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -87,8 +87,8 @@ fw_next_mode:
|
||||||
li a0, PRV_S
|
li a0, PRV_S
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_options
|
.global fw_options
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -103,7 +103,7 @@ fw_options:
|
||||||
#error "Must define FW_JUMP_ADDR"
|
#error "Must define FW_JUMP_ADDR"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
_jump_addr:
|
_jump_addr:
|
||||||
RISCV_PTR FW_JUMP_ADDR
|
RISCV_PTR FW_JUMP_ADDR
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
#include "fw_base.S"
|
#include "fw_base.S"
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_boot_hart
|
.global fw_boot_hart
|
||||||
/*
|
/*
|
||||||
* This function is called very early even before
|
* This function is called very early even before
|
||||||
|
@ -22,8 +22,8 @@ fw_boot_hart:
|
||||||
li a0, -1
|
li a0, -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_save_info
|
.global fw_save_info
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, a2, a3, and a4 registers here.
|
* We can only use a0, a1, a2, a3, and a4 registers here.
|
||||||
|
@ -34,8 +34,8 @@ fw_boot_hart:
|
||||||
fw_save_info:
|
fw_save_info:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_prev_arg1
|
.global fw_prev_arg1
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -51,8 +51,8 @@ fw_prev_arg1:
|
||||||
#endif
|
#endif
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_next_arg1
|
.global fw_next_arg1
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -68,8 +68,8 @@ fw_next_arg1:
|
||||||
#endif
|
#endif
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_next_addr
|
.global fw_next_addr
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -79,8 +79,8 @@ fw_next_addr:
|
||||||
la a0, payload_bin
|
la a0, payload_bin
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_next_mode
|
.global fw_next_mode
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -90,8 +90,8 @@ fw_next_mode:
|
||||||
li a0, PRV_S
|
li a0, PRV_S
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.global fw_options
|
.global fw_options
|
||||||
/*
|
/*
|
||||||
* We can only use a0, a1, and a2 registers here.
|
* We can only use a0, a1, and a2 registers here.
|
||||||
|
@ -102,24 +102,16 @@ fw_options:
|
||||||
add a0, zero, zero
|
add a0, zero, zero
|
||||||
ret
|
ret
|
||||||
|
|
||||||
/*
|
|
||||||
* We disable relaxation because use of ".align"
|
|
||||||
* and ".balign" can potentially generate compile
|
|
||||||
* errors with latest RISC-V GCC Binutils.
|
|
||||||
*/
|
|
||||||
.option push
|
|
||||||
.option norelax
|
|
||||||
|
|
||||||
#ifdef FW_PAYLOAD_FDT_PATH
|
#ifdef FW_PAYLOAD_FDT_PATH
|
||||||
.align 4
|
|
||||||
.section .text, "ax", %progbits
|
.section .text, "ax", %progbits
|
||||||
|
.align 4
|
||||||
.globl fdt_bin
|
.globl fdt_bin
|
||||||
fdt_bin:
|
fdt_bin:
|
||||||
.incbin FW_PAYLOAD_FDT_PATH
|
.incbin FW_PAYLOAD_FDT_PATH
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
.align 4
|
|
||||||
.section .payload, "ax", %progbits
|
.section .payload, "ax", %progbits
|
||||||
|
.align 4
|
||||||
.globl payload_bin
|
.globl payload_bin
|
||||||
payload_bin:
|
payload_bin:
|
||||||
#ifndef FW_PAYLOAD_PATH
|
#ifndef FW_PAYLOAD_PATH
|
||||||
|
@ -128,5 +120,3 @@ payload_bin:
|
||||||
#else
|
#else
|
||||||
.incbin FW_PAYLOAD_PATH
|
.incbin FW_PAYLOAD_PATH
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
.option pop
|
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
#define REG_L __REG_SEL(ld, lw)
|
#define REG_L __REG_SEL(ld, lw)
|
||||||
#define REG_S __REG_SEL(sd, sw)
|
#define REG_S __REG_SEL(sd, sw)
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.globl _start
|
.globl _start
|
||||||
_start:
|
_start:
|
||||||
/* Pick one hart to run the main boot sequence */
|
/* Pick one hart to run the main boot sequence */
|
||||||
|
@ -71,15 +71,15 @@ _start_warm:
|
||||||
/* We don't expect to reach here hence just hang */
|
/* We don't expect to reach here hence just hang */
|
||||||
j _start_hang
|
j _start_hang
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
.globl _start_hang
|
.globl _start_hang
|
||||||
_start_hang:
|
_start_hang:
|
||||||
wfi
|
wfi
|
||||||
j _start_hang
|
j _start_hang
|
||||||
|
|
||||||
.align 3
|
|
||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
|
.align 3
|
||||||
_hart_lottery:
|
_hart_lottery:
|
||||||
RISCV_PTR 0
|
RISCV_PTR 0
|
||||||
_boot_a0:
|
_boot_a0:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue