Skip to content

Commit 1de9995

Browse files
authored
Update origin for the `naked_asm1 change. (#148)
Update origin's nightly Rust support to the latest nightly Rust, renaming `asm` in naked functions to `naked_asm` and removing the options.
1 parent 18e86dd commit 1de9995

File tree

8 files changed

+13
-37
lines changed

8 files changed

+13
-37
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
matrix:
2525
build: [ubuntu, i686-linux, aarch64-linux, riscv64-linux]
26-
rust: [1.78, nightly-2024-10-06]
26+
rust: [1.78, nightly-2024-10-12]
2727
include:
2828
- build: ubuntu
2929
os: ubuntu-latest
@@ -51,7 +51,7 @@ jobs:
5151
qemu: qemu-riscv64 -L /usr/riscv64-linux-gnu
5252
qemu_target: riscv64-linux-user
5353
host_target: riscv64gc-unknown-linux-gnu
54-
- rust: nightly-2024-10-06
54+
- rust: nightly-2024-10-12
5555
features: nightly
5656
steps:
5757
- uses: actions/checkout@v4

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core
4242
alloc = { version = "1.0.0", optional = true, package = "rustc-std-workspace-alloc" }
4343

4444
[target.'cfg(not(target_arch = "arm"))'.dependencies.unwinding]
45-
version = "0.2.0"
45+
version = "0.2.3"
4646
default-features = false
4747
features = ["unwinder"]
4848
optional = true

src/arch/aarch64.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ naked_fn!(
3737
"mov x0, sp", // Pass the incoming `sp` as the arg to `entry`.
3838
"mov x30, xzr", // Set the return address to zero.
3939
"b {entry}"; // Jump to `entry`.
40-
entry = sym super::program::entry;
41-
options(noreturn)
40+
entry = sym super::program::entry
4241
);
4342

4443
/// Execute a trap instruction.
@@ -289,8 +288,6 @@ naked_fn!(
289288
"svc 0",
290289
"udf #16";
291290
//__NR_rt_sigreturn = const __NR_rt_sigreturn // TODO: Use this when `asm_const` is stabilized.
292-
;
293-
options(noreturn)
294291
);
295292
#[cfg(test)] // TODO: obviate this
296293
fn test_rt_sigreturn() {

src/arch/arm.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ naked_fn!(
3737
"mov r0, sp", // Pass the incoming `sp` as the arg to `entry`.
3838
"mov lr, #0", // Set the return address to zero.
3939
"b {entry}"; // Jump to `entry`.
40-
entry = sym super::program::entry;
41-
options(noreturn)
40+
entry = sym super::program::entry
4241
);
4342

4443
/// Execute a trap instruction.
@@ -303,8 +302,6 @@ naked_fn!(
303302
"swi 0",
304303
"udf #16";
305304
//__NR_rt_sigreturn = const __NR_rt_sigreturn // TODO: Use this when `asm_const` is stabilized.
306-
;
307-
options(noreturn)
308305
);
309306
#[cfg(test)] // TODO: obviate this
310307
fn test_rt_sigreturn() {
@@ -328,8 +325,6 @@ naked_fn!(
328325
"swi 0",
329326
"udf #16";
330327
//__NR_sigreturn = const __NR_sigreturn // TODO: Use this when `asm_const` is stabilized.
331-
;
332-
options(noreturn)
333328
);
334329
#[cfg(test)] // TODO: obviate this
335330
fn test_sigreturn() {

src/arch/riscv64.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ naked_fn!(
3636
"mv ra, zero", // Set the return address to zero.
3737
"mv fp, zero", // Set the frame address to zero.
3838
"tail {entry}"; // Jump to `entry`.
39-
entry = sym super::program::entry;
40-
options(noreturn)
39+
entry = sym super::program::entry
4140
);
4241

4342
/// Execute a trap instruction.

src/arch/x86.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ naked_fn!(
4747
"push eax", // Pass saved the incoming `esp` as the arg to `entry`.
4848
"push ebp", // Set the return address to zero.
4949
"jmp {entry}"; // Jump to `entry`.
50-
entry = sym super::program::entry;
51-
options(noreturn)
50+
entry = sym super::program::entry
5251
);
5352

5453
/// Execute a trap instruction.
@@ -393,8 +392,6 @@ naked_fn!(
393392
"int 0x80",
394393
"ud2";
395394
//__NR_rt_sigreturn = const __NR_rt_sigreturn // TODO: Use this when `asm_const` is stabilized.
396-
;
397-
options(noreturn)
398395
);
399396
#[cfg(feature = "signal")]
400397
#[cfg(test)] // TODO: obviate this
@@ -420,8 +417,6 @@ naked_fn!(
420417
"int 0x80",
421418
"ud2";
422419
//__NR_sigreturn = const __NR_sigreturn // TODO: Use this when `asm_const` is stabilized.
423-
;
424-
options(noreturn)
425420
);
426421
#[cfg(feature = "signal")]
427422
#[cfg(test)] // TODO: obviate this

src/arch/x86_64.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ naked_fn!(
3838
"mov rdi, rsp", // Pass the incoming `rsp` as the arg to `entry`.
3939
"push rbp", // Set the return address to zero.
4040
"jmp {entry}"; // Jump to `entry`.
41-
entry = sym super::program::entry;
42-
options(noreturn)
41+
entry = sym super::program::entry
4342
);
4443

4544
/// Execute a trap instruction.
@@ -298,8 +297,6 @@ naked_fn!(
298297
"syscall",
299298
"ud2";
300299
//__NR_rt_sigreturn = const __NR_rt_sigreturn // TODO: Use this when `asm_const` is stabilized.
301-
;
302-
options(noreturn)
303300
);
304301
#[cfg(test)] // TODO: obviate this
305302
fn test_rt_sigreturn() {

src/naked.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
//!
2323
//! // Provide symbols for use in the assembly code.
2424
//! symbols = sym path::to::symbols,
25-
//! this = sym path::to::this;
26-
//!
27-
//! // Add additional `asm` options.
28-
//! options(noreturn)
25+
//! this = sym path::to::this
2926
//! );
3027
//! ```
3128
@@ -40,17 +37,15 @@ macro_rules! naked_fn {
4037
$doc:literal;
4138
$vis:vis fn $name:ident $args:tt -> $ret:ty;
4239
$($code:literal),*;
43-
$($label:ident = $kind:ident $path:path),*;
44-
options($($option:ident),*)
40+
$($label:ident = $kind:ident $path:path),*
4541
) => {
4642
#[doc = $doc]
4743
#[naked]
4844
#[no_mangle]
4945
$vis unsafe extern "C" fn $name $args -> $ret {
50-
asm!(
46+
core::arch::naked_asm!(
5147
$($code),*,
52-
$($label = $kind $path,)*
53-
options($($option),*),
48+
$($label = $kind $path),*
5449
)
5550
}
5651
};
@@ -65,8 +60,7 @@ macro_rules! naked_fn {
6560
$doc:literal;
6661
$vis:vis fn $name:ident $args:tt -> $ret:ty;
6762
$($code:literal),*;
68-
$($label:ident = $kind:ident $path:path),*;
69-
options($($option:ident),*)
63+
$($label:ident = $kind:ident $path:path),*
7064
) => {
7165
extern "C" {
7266
#[doc = $doc]
@@ -79,7 +73,6 @@ macro_rules! naked_fn {
7973
$($code),*,
8074
concat!(".size ", stringify!($name), ", .-", stringify!($name)),
8175
$($label = $kind $path),*
82-
// Omit the options because this is a `global_asm`.
8376
);
8477
};
8578
}

0 commit comments

Comments
 (0)