Files
sx/examples/1802-concurrency-naked-asm-x86.sx
agra b97da83e8b fibers: commit the abi(.naked) example bodies (rename staging miss)
The .pure->.naked rename (a7fe165) git-mv'd examples 1800-1803 to their
naked names but the perl content edit (abi(.pure) -> abi(.naked) in the
bodies/comments) was never re-staged, so HEAD carried the renamed files
with stale abi(.pure) bodies — which the compiler now rejects ("unknown
ABI"). The working tree had the correct .naked bodies uncommitted; this
commits them so HEAD parses + builds clean.
2026-06-20 18:57:14 +03:00

20 lines
781 B
Plaintext

// Stream B1 (fibers) — x86_64 sibling of 1800: `abi(.naked)` emits a naked
// function whose body is raw x86_64 asm (returns 42 in eax, then its own `ret`).
//
// Lowered via LLVM's `naked` attribute (no prologue/epilogue/frame). x86_64-
// pinned via `.build`: ir-only on a non-x86 host — the `.ir` snapshot locks the
// `naked` attribute + the bare asm body (`movl $42, %eax` / `ret`) and the
// frame-pointer-free attribute set — and runs end-to-end (exit 42) on
// x86_64-linux. The IR text (the `naked` attribute, the `call void asm`) is
// target-independent; only the asm string differs from the aarch64 1800.
answer :: () -> i64 abi(.naked) {
asm volatile {
#string A
movl $42, %eax
ret
A
};
}
main :: () -> i64 { return answer(); }