Skip to content

Commit 61b4953

Browse files
committed
[platforms] only keep _start in .text section
Specifically, it moves `_start_primary` and `_start_secondary` from the `.text.boot` section to the `.text` section to prevent the linker from placing them before `_start`. Fix #25
1 parent 9e93b28 commit 61b4953

File tree

6 files changed

+9
-9
lines changed
  • platforms
    • axplat-aarch64-bsta1000b/src
    • axplat-aarch64-phytium-pi/src
    • axplat-aarch64-qemu-virt/src
    • axplat-aarch64-raspi/src
    • axplat-loongarch64-qemu-virt/src
    • axplat-riscv64-qemu-virt/src

6 files changed

+9
-9
lines changed

platforms/axplat-aarch64-bsta1000b/src/boot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ unsafe extern "C" fn _start() -> ! {
7979

8080
/// The earliest entry point for the primary CPU.
8181
#[unsafe(naked)]
82-
#[unsafe(link_section = ".text.boot")]
82+
#[unsafe(link_section = ".text")]
8383
unsafe extern "C" fn _start_primary() -> ! {
8484
// X0 = dtb
8585
core::arch::naked_asm!("
@@ -120,7 +120,7 @@ unsafe extern "C" fn _start_primary() -> ! {
120120
/// The earliest entry point for the secondary CPUs.
121121
#[cfg(feature = "smp")]
122122
#[unsafe(naked)]
123-
#[unsafe(link_section = ".text.boot")]
123+
#[unsafe(link_section = ".text")]
124124
pub(crate) unsafe extern "C" fn _start_secondary() -> ! {
125125
// X0 = stack pointer
126126
core::arch::naked_asm!("

platforms/axplat-aarch64-phytium-pi/src/boot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ unsafe extern "C" fn _start() -> ! {
8080

8181
/// The earliest entry point for the primary CPU.
8282
#[unsafe(naked)]
83-
#[unsafe(link_section = ".text.boot")]
83+
#[unsafe(link_section = ".text")]
8484
unsafe extern "C" fn _start_primary() -> ! {
8585
// X0 = dtb
8686
core::arch::naked_asm!("
@@ -123,7 +123,7 @@ unsafe extern "C" fn _start_primary() -> ! {
123123
/// The earliest entry point for the secondary CPUs.
124124
#[cfg(feature = "smp")]
125125
#[unsafe(naked)]
126-
#[unsafe(link_section = ".text.boot")]
126+
#[unsafe(link_section = ".text")]
127127
pub(crate) unsafe extern "C" fn _start_secondary() -> ! {
128128
// X0 = stack pointer
129129
core::arch::naked_asm!("

platforms/axplat-aarch64-qemu-virt/src/boot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ unsafe extern "C" fn _start() -> ! {
7373

7474
/// The earliest entry point for the primary CPU.
7575
#[unsafe(naked)]
76-
#[unsafe(link_section = ".text.boot")]
76+
#[unsafe(link_section = ".text")]
7777
unsafe extern "C" fn _start_primary() -> ! {
7878
// X0 = dtb
7979
core::arch::naked_asm!("
@@ -114,7 +114,7 @@ unsafe extern "C" fn _start_primary() -> ! {
114114
/// The earliest entry point for the secondary CPUs.
115115
#[cfg(feature = "smp")]
116116
#[unsafe(naked)]
117-
#[unsafe(link_section = ".text.boot")]
117+
#[unsafe(link_section = ".text")]
118118
pub(crate) unsafe extern "C" fn _start_secondary() -> ! {
119119
// X0 = stack pointer
120120
core::arch::naked_asm!("

platforms/axplat-aarch64-raspi/src/boot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ unsafe extern "C" fn _start() -> ! {
9595
/// The earliest entry point for the secondary CPUs.
9696
#[cfg(feature = "smp")]
9797
#[unsafe(naked)]
98-
#[unsafe(link_section = ".text.boot")]
98+
#[unsafe(link_section = ".text")]
9999
pub(crate) unsafe extern "C" fn _start_secondary() -> ! {
100100
// X0 = stack pointer
101101
core::arch::naked_asm!("

platforms/axplat-loongarch64-qemu-virt/src/boot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ unsafe extern "C" fn _start() -> ! {
9292
#[cfg(feature = "smp")]
9393
#[unsafe(naked)]
9494
#[unsafe(no_mangle)]
95-
#[unsafe(link_section = ".text.boot")]
95+
#[unsafe(link_section = ".text")]
9696
unsafe extern "C" fn _start_secondary() -> ! {
9797
core::arch::naked_asm!("
9898
ori $t0, $zero, 0x1 # CSR_DMW1_PLV0

platforms/axplat-riscv64-qemu-virt/src/boot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ unsafe extern "C" fn _start() -> ! {
6868
#[cfg(feature = "smp")]
6969
#[unsafe(naked)]
7070
#[unsafe(no_mangle)]
71-
#[unsafe(link_section = ".text.boot")]
71+
#[unsafe(link_section = ".text")]
7272
unsafe extern "C" fn _start_secondary() -> ! {
7373
// a0 = hartid
7474
// a1 = SP

0 commit comments

Comments
 (0)