Skip to content

Conversation

@folkertdev
Copy link
Contributor

@folkertdev folkertdev commented Nov 9, 2025

tracking issue: #148767

#t-lang > C-variadic naked functions

This feature allows naked c-variadic function definitions with any ABI that is supported for foreign c-variadic functions.

#![feature(c_variadic, c_variadic_naked_functions)]

#[unsafe(naked)]
unsafe extern "win64" fn variadic_win64(_: u32, _: ...) -> u32 {
    core::arch::naked_asm!(
        r#"
        push    rax
        mov     qword ptr [rsp + 40], r9
        mov     qword ptr [rsp + 24], rdx
        mov     qword ptr [rsp + 32], r8
        lea     rax, [rsp + 40]
        mov     qword ptr [rsp], rax
        lea     eax, [rdx + rcx]
        add     eax, r8d
        pop     rcx
        ret
    "#,
    )
}

r? @workingjubilee

@folkertdev folkertdev added A-naked Area: `#[naked]`, prologue and epilogue-free, functions, https://git.io/vAzzS F-c_variadic `#![feature(c_variadic)]` labels Nov 9, 2025
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 9, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 9, 2025

workingjubilee is currently at their maximum review capacity.
They may take a while to respond.

@workingjubilee
Copy link
Member

ferris_aware

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

Labels

A-naked Area: `#[naked]`, prologue and epilogue-free, functions, https://git.io/vAzzS F-c_variadic `#![feature(c_variadic)]` S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants