Skip to content

Commit a87bd39

Browse files
committed
Use stable #[naked] instead of global_asm!() fallback
#[naked] is stable since Rust 1.79, and origin already requires 1.88. This removes the global_asm!() fallback which had platform-specific .type directive syntax issues (e.g., @function vs %function on ARM).
1 parent 10258f1 commit a87bd39

File tree

1 file changed

+3
-31
lines changed

1 file changed

+3
-31
lines changed

src/naked.rs

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Limited wrapper around and polyfill for the `#[naked]` attribute.
1+
//! Wrapper around the `#[naked]` attribute.
22
//!
33
//! # Example
44
//!
@@ -28,10 +28,8 @@
2828
2929
#![allow(unused_macros)]
3030

31-
/// `#[naked]` is nightly-only. We use it when we can, and fall back to
32-
/// `global_asm` otherwise. This macro supports a limited subset of the
33-
/// features of `#[naked]`.
34-
#[cfg(feature = "nightly")]
31+
/// Wrapper around `#[naked]` for defining naked functions.
32+
/// This macro supports a limited subset of `#[naked]` features.
3533
macro_rules! naked_fn {
3634
(
3735
$doc:literal;
@@ -50,29 +48,3 @@ macro_rules! naked_fn {
5048
}
5149
};
5250
}
53-
54-
/// `#[naked]` is nightly-only. We use it when we can, and fall back to
55-
/// `global_asm` otherwise. This macro supports a limited subset of the
56-
/// features of `#[naked]`.
57-
#[cfg(not(feature = "nightly"))]
58-
macro_rules! naked_fn {
59-
(
60-
$doc:literal;
61-
$vis:vis fn $name:ident $args:tt -> $ret:ty;
62-
$($code:literal),*;
63-
$($label:ident = $kind:ident $path:path),*
64-
) => {
65-
unsafe extern "C" {
66-
#[doc = $doc]
67-
$vis fn $name $args -> $ret;
68-
}
69-
core::arch::global_asm!(
70-
concat!(".global ", stringify!($name)),
71-
concat!(".type ", stringify!($name), ", @function"),
72-
concat!(stringify!($name), ":"),
73-
$($code),*,
74-
concat!(".size ", stringify!($name), ", .-", stringify!($name)),
75-
$($label = $kind $path),*
76-
);
77-
};
78-
}

0 commit comments

Comments
 (0)