Skip to content

Commit 5a4b5d3

Browse files
committed
rt: use naked_asm! to ensure the library builds under nightly 2024-10-07
This feature has been added recently in this pull request: rust-lang/rust#128651 After this pull, `core::arch::asm!` can no longer be used in #[naked] functions. We should use `core::arch::naked_asm!` instead. Tested rustc version: ``` rustc -vV rustc 1.83.0-nightly (3ae715c8c 2024-10-07) binary: rustc commit-hash: 3ae715c8c63f9aeac47cbf7d8d9dadb3fa32c638 commit-date: 2024-10-07 host: x86_64-pc-windows-msvc release: 1.83.0-nightly LLVM version: 19.1.1 ``` Signed-off-by: Zhouqi Jiang <[email protected]>
1 parent 26dbc93 commit 5a4b5d3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

allwinner-rt/src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! /* code */
1313
//! }
1414
//! ```
15-
#![feature(naked_functions, asm_const)]
15+
#![feature(naked_functions)]
1616
#![no_std]
1717

1818
#[macro_use]
@@ -26,8 +26,6 @@ pub use mctl::init as dram_init;
2626

2727
pub use allwinner_rt_macros::entry;
2828

29-
use core::arch::asm;
30-
3129
pub mod soc {
3230
pub mod d1;
3331
}
@@ -61,7 +59,7 @@ unsafe extern "C" fn start() -> ! {
6159
const STACK_SIZE: usize = 4 * 1024;
6260
#[link_section = ".bss.uninit"]
6361
static mut STACK: [u8; STACK_SIZE] = [0; STACK_SIZE];
64-
asm!(
62+
core::arch::naked_asm!(
6563
// Enable T-Head ISA extension
6664
"li t1, 1 << 22",
6765
"csrs 0x7C0, t1",
@@ -102,7 +100,6 @@ unsafe extern "C" fn start() -> ! {
102100
stack = sym STACK,
103101
stack_size = const STACK_SIZE,
104102
main = sym main,
105-
options(noreturn)
106103
)
107104
}
108105

0 commit comments

Comments
 (0)