Skip to content

Conversation

@vak-leon
Copy link

@vak-leon vak-leon commented Jan 12, 2026

Since #[naked] is stable now (1.79) and origin already requires 1.88, we can drop the global_asm!() fallback entirely.

This sidesteps the whole @function vs %function platform-specific syntax mess that #168 was trying to fix.

Per @bjorn3's suggestion - this supersedes #168.

src/naked.rs Outdated
#[cfg(feature = "nightly")]
/// Wrapper around `#[naked]` for defining naked functions.
/// This macro supports a limited subset of `#[naked]` features.
macro_rules! naked_fn {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This macro can be inlined now.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you're right. On it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine for my code now.

#[naked] is stable since Rust 1.79, and origin already requires 1.88.
This removes the global_asm!() fallback and the naked_fn! macro entirely,
inlining #[naked] directly at each call site.
Copy link
Contributor

@bjorn3 bjorn3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good.

__NR_rt_sigreturn = const __NR_rt_sigreturn
);
#[unsafe(naked)]
#[unsafe(no_mangle)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually need to be no_mangle?


#[unsafe(naked)]
#[unsafe(no_mangle)]
pub(super) unsafe extern "C" fn _start() -> ! {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extern "custom" would make sense here, but that isn't stable yet and it is not worth it to keep the macro just for that IMHO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants