interplane.Get Omega
Read in your language

omega-bridge

Omega-first language interoperability: checked conversion backends and native language bindings

Brought by drakestapleton

GitHub aien-dev/omega-bridge#27 (code only)

closed derived e93fb1b730e6daa7 #27

Imported from GitHub aien-dev/omega-bridge#27 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 7ffd79d45a7f9294c4b316e47f4deea93958c487 · Head 94ca2415bb57716b622b3d416a1939ac0ec830a9

Fetch it

A git bundle of the pull request's head, 31500 bytes.

curl -fsSL https://interplane.io/drakestapleton/omega-bridge/patches/e93fb1b730e6daa7.bundle -o e93fb1b730e6daa7.bundle
git fetch e93fb1b730e6daa7.bundle refs/pull/27/head

Raw bundle · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/omega-bridge
27
94ca2415bb57716b622b3d416a1939ac0ec830a9
{"kind":"github-import","owner":"aien-dev","repo":"omega-bridge","number":27,"url":"https://github.com/aien-dev/omega-bridge/pull/27","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:58Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/docs/NATIVE-ABI.md b/docs/NATIVE-ABI.md
index 5afad11..068a8e9 100644
--- a/docs/NATIVE-ABI.md
+++ b/docs/NATIVE-ABI.md
@@ -165,7 +165,15 @@ accepted AArch64 contract; later `src/native.om` changes keep AArch64 output
 byte-identical to it (the x86 suite's `aarch64_parity` check). The generator at
 `f637021^` still matches `0c4cb9ff` on every pre-#26 fixture and output, so the
 chain back to the pre-x86 generator is unbroken. The receipts retain the
-earlier failing emulator run rather than rewriting it as a pass.
+earlier failing emulator run rather than rewriting it as a pass. #27 respelled
+the assembler directives (`OMBR_*` macros in `pre`, `fp`, `fr`, `fv`, `xjmp`) and
+the Python loader's library name, so the check first applies those spellings to
+the baseline source: a `~`-separated piece of those texts that equals the same
+piece at `7af4d11` takes that piece of blob `5115113` (`src/native.om` as #27 left
+it), and the two `tb` loader literals take #27's text. Both sides are pinned
+objects, so any other change to those texts in the tree still fails parity.
+`tests/native/macos/` (the host-word unit, whose C output gains the intended
+macOS `#error`) is not a parity fixture.
 
 ## What Omega produces
 
@@ -427,6 +435,8 @@ native anchor and R14 runtime-table register. The separate advanced host-helper
 dispatcher `xhost` requires program mode and refuses bare units with compiler
 error 9. Do not generalize that advanced-helper refusal to legacy `read`/`write`.
 This is a compiler-source boundary, not exercised x86 syscall evidence.
+macOS numbers its system calls differently, so an AArch64 unit whose code holds an `svc` instruction
+word is Linux-only: the generator puts `#error` for that unit under `__APPLE__` (see Platforms).
 
 Signals: a call from a signal handler while a call is running on the same thread returns 33. A handler
 that leaves Omega code with `siglongjmp` abandons the call; every later call on that thread returns 33.
@@ -529,6 +539,43 @@ silently); the Go preamble including the header instead of repeating prototypes,
 run-time path; `tools/native` producing in a scratch folder, installing together, and naming the
 refused unit.
 
+## Platforms: macOS arm64 (`sh tests/native/macos/run.sh bundle|run DIR`)
+
+One generated AArch64 C file builds on Linux (ELF) and on macOS arm64 (Mach-O); any other object
+format stops at `#error`, and so does any other architecture than AArch64 (x86-64 has its own target,
+`--target x86linux`, ELF only). The freestanding object is ELF only. Only the assembler spelling
+differs, through the `OMBR_*` macros at the top of `omega_native.c`: on Mach-O, C names carry a leading
+underscore, the code goes in `__TEXT,__text`, there is no `.type`, `.size`, `.local` or `.hidden` (a
+symbol that is not `.globl` stays local to its object), and `ombr_trap`/`ombr_no_entry` are
+`.alt_entry` points of `ombr_enter` with the assembler-local label `Lombr_leave`, so the linker cannot
+split them from the shared exit path. On ELF the macros spell the directives the previous generator
+wrote: for the AArch64 v1, ABI v2, freestanding and x86-64 units, `tools/native` output from this
+generator and from 7af4d11's differs only in the text of `omega_native.c` and `omega_native.py`; the
+libraries, the freestanding object and the other declaration files are byte-identical.
+
+- x18 is reserved on macOS. The seeded compiler's code uses x0..x16, x29 and x30; the macOS runner
+  disassembles each embedded unit and refuses any `x18`/`w18` (with a control that writes x18).
+- `hint #34`/`hint #38` (BTI landing pads) execute as no-ops where BTI is not enforced.
+- The stack mapping uses `MAP_NORESERVE` and `MAP_ANONYMOUS`, both provided by macOS with `-std=gnu11`;
+  the pthread key destructor frees each thread's stack on thread exit on both systems.
+- Units with host words build on Linux only (see Host words).
+- The Python binding loads `libomega_native.dylib` when `sys.platform` is `darwin`, otherwise
+  `libomega_native.so`, from its own folder.
+
+Generating needs Linux AArch64, because the seeded compiler is a Linux AArch64 executable: run
+`tools/native OUTDIR unit.om ...` there and copy `omega_native.c`, `omega_native.h` and
+`omega_native.py` to the Mac. Build there with
+`clang -std=gnu11 -O2 -fPIC -shared -install_name @rpath/libomega_native.dylib -include omega_native.h -o libomega_native.dylib omega_native.c`.
+
+macOS qualification, in two steps: `OMEGA_NATIVE_OMC=<seed omc> sh tests/native/macos/run.sh bundle DIR`
+on Linux AArch64 runs `tools/native` on the seven test units and writes the bundle; `sh DIR/run.sh run
+DIR` on macOS arm64 needs only clang, its tools and python3. It builds the dylib, compares each unit's
+embedded bytes with the compiler's output, checks for x18, runs the C and Python callers, checks that
+the add -> sub mutant of `madd` is both embedded as generated and caught by the C caller, and checks
+that the host-word unit `tests/native/macos/hostw.om` is refused by the macOS build. Last line:
+`NATIVE-CALL-MACOS PASS`. The C++, Rust, Zig and Go callers, the BTI-enforced build, ABI v2 units and
+the measurements are exercised on Linux only.
+
 ## G1 sample (`OMEGA_NATIVE_OMC=<seed omc> sh tests/native/g1/run.sh`)
 
 omega-mv #624 milestone G1: `fn calc i0 ulong i1 ulong to ulong` computing `(i0 + i1) * (i0 - i1)` modulo
diff --git a/src/native.om b/src/native.om
index ab1e5b4..3eece7b 100644
--- a/src/native.om
+++ b/src/native.om
@@ -30,7 +30,7 @@ global ue ulong 256
 text hx "0123456789abcdef"
 global xt ulong 1
 text xtname "x86linux"
-text xjmp ":\\nendbr64\\njmp ombr_code_~:\\nendbr64\\njmp ombr2_code_"
+text xjmp ") \":\\nendbr64\\njmp \" OMBR_SYM(ombr_code_~) \":\\nendbr64\\njmp \" OMBR_SYM(ombr2_code_"
 text xasm "/* SysV AMD64 adapter to the pinned private Omega frame ABI. R12 anchors the native\n * stack, R14 the runtime table, R15 the owned-stack floor. Advanced host helpers\n * that clobber those registers are forbidden in function mode; legacy read/write preserve them.\n * CET shadow-stack enforcement is not supported by the nonlocal trap return. */\n__asm__(\".text\\n.balign 16\\n.local ombr_enter\\n.hidden ombr_enter\\n.type ombr_enter,@function\\nombr_enter:\\n\"\n        \"endbr64\\npush %rbx\\npush %rbp\\npush %r12\\npush %r13\\npush %r14\\npush %r15\\npush %rcx\\n\"\n        \"mov %rsp,%r12\\nmov %rdx,%r14\\nmov %r9,%r15\\nmov %rdi,%r10\\n\"\n        \"mov %r8,%rbp\\nmov %r8,%rsp\\nsub $256,%rsp\\n\"\n        \"mov 0(%rsi),%rax\\nmov %rax,-8(%rbp)\\nmov 8(%rsi),%rax\\nmov %rax,-16(%rbp)\\n\"\n        \"mov 16(%rsi),%rax\\nmov %rax,-24(%rbp)\\nmov 24(%rsi),%rax\\nmov %rax,-32(%rbp)\\n\"\n        \"mov 32(%rsi),%rax\\nmov %rax,-40(%rbp)\\nmov 40(%rsi),%rax\\nmov %rax,-48(%rbp)\\n\"\n        \"call *%r10\\nmov %r12,%rsp\\nmov (%rsp),%rcx\\nmov %rax,(%rcx)\\nxor %eax,%eax\\n\"\n        \"ombr_leave:\\nadd $8,%rsp\\npop %r15\\npop %r14\\npop %r13\\npop %r12\\npop %rbp\\npop %rbx\\nret\\n\"\n        \".size ombr_enter,.-ombr_enter\\n.local ombr_trap\\n.hidden ombr_trap\\n.type ombr_trap,@function\\nombr_trap:\\n\"\n        \"endbr64\\nmov %r12,%rsp\\nlea -1(%rsi),%eax\\ncmp $13,%eax\\nmov $34,%eax\\ncmovbe %esi,%eax\\njmp ombr_leave\\n\"\n        \".size ombr_trap,.-ombr_trap\\n.local ombr_no_entry\\n.hidden ombr_no_entry\\n.type ombr_no_entry,@function\\nombr_no_entry:\\n\"\n        \"endbr64\\nmov %r12,%rsp\\nmov $34,%eax\\njmp ombr_leave\\n.size ombr_no_entry,.-ombr_no_entry\\n\");\nuint32_t ombr_xenter(const void *code, const uint64_t *args, const ombr_rt *rt, uint64_t *out, void *top, void *floor) __asm__(\"ombr_enter\") __attribute__((visibility(\"hidden\")));\n/* The true mapping floor must not move when ABI-v2 out buffers lower top. */\n#define ombr_enter(code,args,rt,out,top) ombr_xenter(code,args,rt,out,top,ombr_stk - OMBR_STACK)\n"
 text xs "/* ombr_enter"
 text xe "static void ombr_free"
@@ -40,12 +40,12 @@ text xqd "\\n.quad "
 text xby "\\n.byte "
 text xfasm "/* SysV AMD64 adapter to the pinned private Omega frame ABI on the caller's stack. ombr_enter saves\n * the callee-saved registers there, keeps that stack pointer in R12, points R14 at the runtime table\n * and sets the owned-stack floor R15 to 0, so, as in the AArch64 binding, the pure scalar code runs on\n * the caller's stack with no bound check. A normal return stores RAX through out and returns 0. A\n * runtime entry restores the stack pointer from R12 and returns a status; out is not written.\n * CET shadow-stack enforcement is not supported by the nonlocal trap return. */\n__asm__(\".text\\n.balign 16\\n.local ombr_enter\\n.hidden ombr_enter\\n.type ombr_enter,@function\\nombr_enter:\\n\"\n        \"endbr64\\npush %rbx\\npush %rbp\\npush %r12\\npush %r13\\npush %r14\\npush %r15\\npush %rcx\\n\"\n        \"mov %rsp,%r12\\nmov %rdx,%r14\\nxor %r15d,%r15d\\nmov %rdi,%r10\\n\"\n        \"mov %rsp,%rbp\\nsub $256,%rsp\\n\"\n        \"mov 0(%rsi),%rax\\nmov %rax,-8(%rbp)\\nmov 8(%rsi),%rax\\nmov %rax,-16(%rbp)\\n\"\n        \"mov 16(%rsi),%rax\\nmov %rax,-24(%rbp)\\nmov 24(%rsi),%rax\\nmov %rax,-32(%rbp)\\n\"\n        \"mov 32(%rsi),%rax\\nmov %rax,-40(%rbp)\\nmov 40(%rsi),%rax\\nmov %rax,-48(%rbp)\\n\"\n        \"call *%r10\\nmov %r12,%rsp\\nmov (%rsp),%rcx\\nmov %rax,(%rcx)\\nxor %eax,%eax\\n\"\n        \"ombr_leave:\\nadd $8,%rsp\\npop %r15\\npop %r14\\npop %r13\\npop %r12\\npop %rbp\\npop %rbx\\nret\\n\"\n        \".size ombr_enter,.-ombr_enter\\n.local ombr_trap\\n.hidden ombr_trap\\n.type ombr_trap,@function\\nombr_trap:\\n\"\n        \"endbr64\\nmov %r12,%rsp\\nlea -1(%rsi),%eax\\ncmp $13,%eax\\nmov $34,%eax\\ncmovbe %esi,%eax\\njmp ombr_leave\\n\"\n        \".size ombr_trap,.-ombr_trap\\n.local ombr_no_entry\\n.hidden ombr_no_entry\\n.type ombr_no_entry,@function\\nombr_no_entry:\\n\"\n        \"endbr64\\nmov %r12,%rsp\\nmov $34,%eax\\njmp ombr_leave\\n.size ombr_no_entry,.-ombr_no_entry\\n\");\n"
 text kw "toeditviewulonglongucharvoidmainf32ushortconst"
-text fr "__asm__(\".section .text.omega_bridge,\\\"ax\\\",@progbits\\n.balign 4\\n.local ombr_code_~\\n.hidden ombr_code_~\\nombr_code_~:\\n.byte ~\\n.previous\\n\");\nextern const unsigned char ombr_entry_~[] __attribute__((visibility(\"hidden\")));\n__attribute__((visibility(\"default\"))) uint32_t omega_~(uint64_t *result~, uint64_t o_~, void *o_~, const void *o_~_len~)\n{\n    ombr_span sp[7];\n    unsigned ns = 0;\n    uint64_t a[6] = {0};\n    if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1))\n        return OMEGA_BAD_ARG;\n~    if (ombr_span_add(sp, &ns, o_~, o_~_len, ~u, ~))\n        return OMEGA_BAD_ARG;\n    a[~] = (uint64_t)(uintptr_t)o_~;\n~    a[~] = o_~    if (ombr_overlap(sp, ns))\n        return OMEGA_BAD_ARG;\n    return ombr_run(ombr_entry_~, a, result, ~);\n}\n~\\n.local ombr_entry_~\\n.hidden ombr_entry_~\\nombr_entry_~:\\nhint #34\\nb ombr_code_"
-text pre "/* Generated by omega-bridge src/native.om: native call ABI v1 (docs/NATIVE-ABI.md).\n * The Omega machine code below is embedded byte for byte as the seeded compiler wrote it.\n * This file only adapts the C calling convention to it. Regenerate it; do not edit it. */\n#include <pthread.h>\n#include <signal.h>\n#include <stdint.h>\n#include <sys/mman.h>\n#define OMEGA_OK 0u\n#define OMEGA_BAD_ARG 32u\n#define OMEGA_REENTRY 33u\n#define OMEGA_BAD_RT 34u\n#define OMEGA_NO_STACK 35u\n#define OMBR_STACK (8u << 20)\n#define OMBR_GUARD (8u << 20)\n/* entry[2] is the trap entry (OSC-1 section 7). */\ntypedef struct ombr_rt { const void *entry[32]; } ombr_rt;\ntypedef struct ombr_span { uintptr_t lo, hi; int w; } ombr_span;\nstatic _Thread_local volatile sig_atomic_t ombr_active;\nstatic _Thread_local unsigned char *ombr_stk;\nstatic pthread_key_t ombr_key;\nstatic int ombr_keyok;\nstatic pthread_once_t ombr_once = PTHREAD_ONCE_INIT;\nuint32_t ombr_enter(const void *code, const uint64_t *args, const ombr_rt *rt, uint64_t *out, void *top)\n    __attribute__((visibility(\"hidden\")));\nextern const unsigned char ombr_trap[] __attribute__((visibility(\"hidden\")));\nextern const unsigned char ombr_no_entry[] __attribute__((visibility(\"hidden\")));\n/* ombr_enter saves the callee-saved registers on the caller's stack, keeps that stack pointer in x19 and\n * runs the code on the binding's own stack. A normal return stores x0 through out and\n * returns 0. A runtime entry restores the stack pointer from x19 and returns a status; out is not\n * written. A unit's code must not write x18, x19 or x29 and must keep sp balanced; it may write x0..x17,\n * x20..x28 and v0..v31 (x20..x28 and d8..d15 are restored here). Runtime entries are reached by blr/br, so they start with bti jc. */\n__asm__(\".text\\n.balign 4\\n.local ombr_enter\\n.hidden ombr_enter\\n.type ombr_enter,%function\\nombr_enter:\\n\"\n        \"hint #34\\nstp x29,x30,[sp,#-176]!\\nmov x29,sp\\nstp x19,x20,[sp,#16]\\nstp x21,x22,[sp,#32]\\n\"\n        \"stp x23,x24,[sp,#48]\\nstp x25,x26,[sp,#64]\\nstp x27,x28,[sp,#80]\\nstp d8,d9,[sp,#96]\\n\"\n        \"stp d10,d11,[sp,#112]\\nstp d12,d13,[sp,#128]\\nstp d14,d15,[sp,#144]\\nstr x3,[sp,#160]\\n\"\n        \"mov x19,sp\\nmov x16,x0\\nmov x17,x1\\nmov x7,x2\\nmov sp,x4\\n\"\n        \"ldp x0,x1,[x17]\\nldp x2,x3,[x17,#16]\\nldp x4,x5,[x17,#32]\\nblr x16\\n\"\n        \"mov sp,x19\\nldr x9,[sp,#160]\\nstr x0,[x9]\\nmov w0,#0\\n\"\n        \"ombr_leave:\\nldp d14,d15,[sp,#144]\\nldp d12,d13,[sp,#128]\\nldp d10,d11,[sp,#112]\\n\"\n        \"ldp d8,d9,[sp,#96]\\nldp x27,x28,[sp,#80]\\nldp x25,x26,[sp,#64]\\nldp x23,x24,[sp,#48]\\n\"\n        \"ldp x21,x22,[sp,#32]\\nldp x19,x20,[sp,#16]\\nldp x29,x30,[sp],#176\\nret\\n.size ombr_enter,.-ombr_enter\\n\"\n        \".local ombr_trap\\n.hidden ombr_trap\\n.type ombr_trap,%function\\nombr_trap:\\nhint #38\\n\"\n        \"mov sp,x19\\nsub x2,x1,#1\\nmov w3,#34\\ncmp x2,#13\\ncsel w0,w1,w3,ls\\nb ombr_leave\\n\"\n        \".size ombr_trap,.-ombr_trap\\n\"\n        \".local ombr_no_entry\\n.hidden ombr_no_entry\\n.type ombr_no_entry,%function\\nombr_no_entry:\\nhint #38\\n\"\n        \"mov sp,x19\\nmov w0,#34\\nb ombr_leave\\n.size ombr_no_entry,.-ombr_no_entry\\n\");\nstatic void ombr_free(void *p)\n{\n    munmap(p, OMBR_STACK + OMBR_GUARD);\n}\nstatic void ombr_init(void)\n{\n    ombr_keyok = pthread_key_create(&ombr_key, ombr_free) == 0;\n}\n/* The thread's Omega stack: OMBR_STACK usable bytes above an OMBR_GUARD no-access region. A function-mode\n * unit has no call cycles and at most 4 MiB of local arrays per function (OMEGESE, local arrays), so a frame that\n * would pass the bottom starts inside the guard and faults there; nothing below the guard is touched. */\nstatic unsigned char *ombr_stack(void)\n{\n    if (ombr_stk)\n        return ombr_stk;\n    pthread_once(&ombr_once, ombr_init);\n    if (!ombr_keyok)\n        return 0;\n    unsigned char *p = mmap(0, OMBR_STACK + OMBR_GUARD, PROT_READ | PROT_WRITE,\n                            MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);\n    if (p == MAP_FAILED)\n        return 0;\n    if (mprotect(p, OMBR_GUARD, PROT_NONE) != 0 || pthread_setspecific(ombr_key, p) != 0) {\n        munmap(p, OMBR_STACK + OMBR_GUARD);\n        return 0;\n    }\n    ombr_stk = p + OMBR_GUARD + OMBR_STACK;\n    return ombr_stk;\n}\nstatic int ombr_span_add(ombr_span *sp, unsigned *ns, const void *p, uint64_t n, uint64_t want, uint64_t es, int w)\n{\n    uintptr_t lo = (uintptr_t)p;\n    if (!p || n != want || lo % es != 0u || n > (UINTPTR_MAX - lo) / es)\n        return 1;\n    sp[*ns].lo = lo;\n    sp[*ns].hi = lo + n * es;\n    sp[*ns].w = w;\n    (*ns)++;\n    return 0;\n}\nstatic int ombr_overlap(const ombr_span *sp, unsigned ns)\n{\n    for (unsigned i = 0; i < ns; i++)\n        for (unsigned j = i + 1; j < ns; j++)\n            if ((sp[i].w || sp[j].w) && sp[i].lo < sp[j].hi && sp[j].lo < sp[i].hi)\n                return 1;\n    return 0;\n}\n/* One read-only runtime table for every call and thread: the code only reads it (a write would fault). */\nstatic const ombr_rt ombr_rt_table = {{ ombr_no_entry, ombr_no_entry, ombr_trap, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry }};\nstatic uint32_t ombr_run(const void *code, const uint64_t *args, uint64_t *result, int has_value)\n{\n    if (ombr_active)\n        return OMEGA_REENTRY;\n    ombr_active = 1;\n    unsigned char *top = ombr_stack();\n    if (!top) {\n        ombr_active = 0;\n        return OMEGA_NO_STACK;\n    }\n    uint64_t v = 0;\n    uint32_t s = ombr_enter(code, args, &ombr_rt_table, &v, top);\n    ombr_active = 0;\n    if (s == OMEGA_OK)\n        *result = has_value ? v : 0u;\n    return s;\n}\n"
+text fr "__asm__(OMBR_CODE_SECTION \".balign 4\\n\" OMBR_LOCAL(ombr_code_~) OMBR_HIDDEN(ombr_code_~) OMBR_SYM(ombr_code_~) \":\\n.byte ~) \"\\n\" OMBR_PREVIOUS);\nextern const unsigned char ombr_entry_~[] __attribute__((visibility(\"hidden\")));\n__attribute__((visibility(\"default\"))) uint32_t omega_~(uint64_t *result~, uint64_t o_~, void *o_~, const void *o_~_len~)\n{\n    ombr_span sp[7];\n    unsigned ns = 0;\n    uint64_t a[6] = {0};\n    if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1))\n        return OMEGA_BAD_ARG;\n~    if (ombr_span_add(sp, &ns, o_~, o_~_len, ~u, ~))\n        return OMEGA_BAD_ARG;\n    a[~] = (uint64_t)(uintptr_t)o_~;\n~    a[~] = o_~    if (ombr_overlap(sp, ns))\n        return OMEGA_BAD_ARG;\n    return ombr_run(ombr_entry_~, a, result, ~);\n}\n~\\n\" OMBR_LOCAL(ombr_entry_~) OMBR_HIDDEN(ombr_entry_~) OMBR_SYM(ombr_entry_~) \":\\nhint #34\\nb \" OMBR_SYM(ombr_code_~#if defined(__APPLE__)\n#error \"omega-bridge native binding: unit ~ makes Linux system calls (Omega host words), which macOS does not run\"\n#endif\n"
+text pre "/* Generated by omega-bridge src/native.om: native call ABI v1 (docs/NATIVE-ABI.md).\n * The Omega machine code below is embedded byte for byte as the seeded compiler wrote it.\n * This file only adapts the C calling convention to it. Regenerate it; do not edit it. */\n#include <pthread.h>\n#include <signal.h>\n#include <stdint.h>\n#include <sys/mman.h>\n#define OMEGA_OK 0u\n#define OMEGA_BAD_ARG 32u\n#define OMEGA_REENTRY 33u\n#define OMEGA_BAD_RT 34u\n#define OMEGA_NO_STACK 35u\n#define OMBR_STACK (8u << 20)\n#define OMBR_GUARD (8u << 20)\n/* entry[2] is the trap entry (OSC-1 section 7). */\ntypedef struct ombr_rt { const void *entry[32]; } ombr_rt;\ntypedef struct ombr_span { uintptr_t lo, hi; int w; } ombr_span;\nstatic _Thread_local volatile sig_atomic_t ombr_active;\nstatic _Thread_local unsigned char *ombr_stk;\nstatic pthread_key_t ombr_key;\nstatic int ombr_keyok;\nstatic pthread_once_t ombr_once = PTHREAD_ONCE_INIT;\nuint32_t ombr_enter(const void *code, const uint64_t *args, const ombr_rt *rt, uint64_t *out, void *top)\n    __attribute__((visibility(\"hidden\")));\nextern const unsigned char ombr_trap[] __attribute__((visibility(\"hidden\")));\nextern const unsigned char ombr_no_entry[] __attribute__((visibility(\"hidden\")));\n/* The object format's spelling of the embedded code and runtime symbols. ELF keeps them local and hidden\n * in .text.omega_bridge. Mach-O (macOS) prefixes C symbol names with an underscore and keeps them local\n * by not declaring them .globl; .alt_entry keeps the runtime entries in ombr_enter's atom. */\n#if defined(__APPLE__) && defined(__MACH__)\n#define OMBR_SYM(n) \"_\" #n\n#define OMBR_LOCAL(n) \"\"\n#define OMBR_HIDDEN(n) \"\"\n#define OMBR_FUNC(n) \"\"\n#define OMBR_ALT(n) \".alt_entry _\" #n \"\\n\"\n#define OMBR_SIZE(n) \"\"\n#define OMBR_LEAVE \"Lombr_leave\"\n#define OMBR_CODE_SECTION \".section __TEXT,__text,regular,pure_instructions\\n\"\n#define OMBR_PREVIOUS \"\"\n#elif defined(__ELF__)\n#define OMBR_SYM(n) #n\n#define OMBR_LOCAL(n) \".local \" #n \"\\n\"\n#define OMBR_HIDDEN(n) \".hidden \" #n \"\\n\"\n#define OMBR_FUNC(n) \".type \" #n \",%function\\n\"\n#define OMBR_ALT(n) OMBR_FUNC(n)\n#define OMBR_SIZE(n) \".size \" #n \",.-\" #n \"\\n\"\n#define OMBR_LEAVE \"ombr_leave\"\n#define OMBR_CODE_SECTION \".section .text.omega_bridge,\\\"ax\\\",@progbits\\n\"\n#define OMBR_PREVIOUS \".previous\\n\"\n#else\n#error \"omega-bridge native binding: ELF or Mach-O objects only\"\n#endif\n/* ombr_enter saves the callee-saved registers on the caller's stack, keeps that stack pointer in x19 and\n * runs the code on the binding's own stack. A normal return stores x0 through out and\n * returns 0. A runtime entry restores the stack pointer from x19 and returns a status; out is not\n * written. A unit's code must not write x18, x19 or x29 and must keep sp balanced; it may write x0..x17,\n * x20..x28 and v0..v31 (x20..x28 and d8..d15 are restored here). Runtime entries are reached by blr/br, so they start with bti jc. */\n#if !defined(__aarch64__)\n#error \"omega-bridge native binding: the embedded code is AArch64\"\n#endif\n__asm__(\".text\\n.balign 4\\n\" OMBR_LOCAL(ombr_enter) OMBR_HIDDEN(ombr_enter) OMBR_FUNC(ombr_enter)\n        OMBR_SYM(ombr_enter) \":\\n\"\n        \"hint #34\\nstp x29,x30,[sp,#-176]!\\nmov x29,sp\\nstp x19,x20,[sp,#16]\\nstp x21,x22,[sp,#32]\\n\"\n        \"stp x23,x24,[sp,#48]\\nstp x25,x26,[sp,#64]\\nstp x27,x28,[sp,#80]\\nstp d8,d9,[sp,#96]\\n\"\n        \"stp d10,d11,[sp,#112]\\nstp d12,d13,[sp,#128]\\nstp d14,d15,[sp,#144]\\nstr x3,[sp,#160]\\n\"\n        \"mov x19,sp\\nmov x16,x0\\nmov x17,x1\\nmov x7,x2\\nmov sp,x4\\n\"\n        \"ldp x0,x1,[x17]\\nldp x2,x3,[x17,#16]\\nldp x4,x5,[x17,#32]\\nblr x16\\n\"\n        \"mov sp,x19\\nldr x9,[sp,#160]\\nstr x0,[x9]\\nmov w0,#0\\n\"\n        OMBR_LEAVE \":\\nldp d14,d15,[sp,#144]\\nldp d12,d13,[sp,#128]\\nldp d10,d11,[sp,#112]\\n\"\n        \"ldp d8,d9,[sp,#96]\\nldp x27,x28,[sp,#80]\\nldp x25,x26,[sp,#64]\\nldp x23,x24,[sp,#48]\\n\"\n        \"ldp x21,x22,[sp,#32]\\nldp x19,x20,[sp,#16]\\nldp x29,x30,[sp],#176\\nret\\n\" OMBR_SIZE(ombr_enter)\n        OMBR_LOCAL(ombr_trap) OMBR_HIDDEN(ombr_trap) OMBR_ALT(ombr_trap) OMBR_SYM(ombr_trap) \":\\nhint #38\\n\"\n        \"mov sp,x19\\nsub x2,x1,#1\\nmov w3,#34\\ncmp x2,#13\\ncsel w0,w1,w3,ls\\nb \" OMBR_LEAVE \"\\n\"\n        OMBR_SIZE(ombr_trap)\n        OMBR_LOCAL(ombr_no_entry) OMBR_HIDDEN(ombr_no_entry) OMBR_ALT(ombr_no_entry) OMBR_SYM(ombr_no_entry) \":\\nhint #38\\n\"\n        \"mov sp,x19\\nmov w0,#34\\nb \" OMBR_LEAVE \"\\n\" OMBR_SIZE(ombr_no_entry));\nstatic void ombr_free(void *p)\n{\n    munmap(p, OMBR_STACK + OMBR_GUARD);\n}\nstatic void ombr_init(void)\n{\n    ombr_keyok = pthread_key_create(&ombr_key, ombr_free) == 0;\n}\n/* The thread's Omega stack: OMBR_STACK usable bytes above an OMBR_GUARD no-access region. A function-mode\n * unit has no call cycles and at most 4 MiB of local arrays per function (OMEGESE, local arrays), so a frame that\n * would pass the bottom starts inside the guard and faults there; nothing below the guard is touched. */\nstatic unsigned char *ombr_stack(void)\n{\n    if (ombr_stk)\n        return ombr_stk;\n    pthread_once(&ombr_once, ombr_init);\n    if (!ombr_keyok)\n        return 0;\n    unsigned char *p = mmap(0, OMBR_STACK + OMBR_GUARD, PROT_READ | PROT_WRITE,\n                            MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);\n    if (p == MAP_FAILED)\n        return 0;\n    if (mprotect(p, OMBR_GUARD, PROT_NONE) != 0 || pthread_setspecific(ombr_key, p) != 0) {\n        munmap(p, OMBR_STACK + OMBR_GUARD);\n        return 0;\n    }\n    ombr_stk = p + OMBR_GUARD + OMBR_STACK;\n    return ombr_stk;\n}\nstatic int ombr_span_add(ombr_span *sp, unsigned *ns, const void *p, uint64_t n, uint64_t want, uint64_t es, int w)\n{\n    uintptr_t lo = (uintptr_t)p;\n    if (!p || n != want || lo % es != 0u || n > (UINTPTR_MAX - lo) / es)\n        return 1;\n    sp[*ns].lo = lo;\n    sp[*ns].hi = lo + n * es;\n    sp[*ns].w = w;\n    (*ns)++;\n    return 0;\n}\nstatic int ombr_overlap(const ombr_span *sp, unsigned ns)\n{\n    for (unsigned i = 0; i < ns; i++)\n        for (unsigned j = i + 1; j < ns; j++)\n            if ((sp[i].w || sp[j].w) && sp[i].lo < sp[j].hi && sp[j].lo < sp[i].hi)\n                return 1;\n    return 0;\n}\n/* One read-only runtime table for every call and thread: the code only reads it (a write would fault). */\nstatic const ombr_rt ombr_rt_table = {{ ombr_no_entry, ombr_no_entry, ombr_trap, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry }};\nstatic uint32_t ombr_run(const void *code, const uint64_t *args, uint64_t *result, int has_value)\n{\n    if (ombr_active)\n        return OMEGA_REENTRY;\n    ombr_active = 1;\n    unsigned char *top = ombr_stack();\n    if (!top) {\n        ombr_active = 0;\n        return OMEGA_NO_STACK;\n    }\n    uint64_t v = 0;\n    uint32_t s = ombr_enter(code, args, &ombr_rt_table, &v, top);\n    ombr_active = 0;\n    if (s == OMEGA_OK)\n        *result = has_value ? v : 0u;\n    return s;\n}\n"
 note mo: the output names; tb: the binding texts, fragments separated by ~ (byte 126): 0-11 h,
 note 12-21 python, 22-34 rust, 35-46 zig, 47-64 go (its C preamble includes the generated header).
 text mo "chpythonrustziggoapihapicfreestfapic"
-text tb "/* Generated by omega-bridge src/native.om: native call ABI v1 (docs/NATIVE-ABI.md).\n * C and C++ declarations for libomega_native. Regenerate it; do not edit it.\n * Status: 0 done; 1..14 the Omega trap code; 32 argument refused (null, wrong length, misaligned,\n * overlap); 33 reentry; 34 bad runtime entry; 35 no stack. The result is written only on status 0.\n * A long is its two's-complement bits; an array is its address then its element count.\n * Parameter names carry o_ so no language's reserved words collide. */\n#ifndef OMEGA_NATIVE_H\n#define OMEGA_NATIVE_H\n#include <stdint.h>\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n#define OMEGA_OK 0u\n#define OMEGA_BAD_ARG 32u\n#define OMEGA_REENTRY 33u\n#define OMEGA_BAD_RT 34u\n#define OMEGA_NO_STACK 35u\n~/* ~ */\nuint32_t omega_~(uint64_t *result~, uint64_t o_~, void *o_~, const void *o_~, void *o_~, const void *o_~_len~);\n~#ifdef __cplusplus\n}\n#endif\n#endif\n~# Generated by omega-bridge src/native.om: native call ABI v1 (docs/NATIVE-ABI.md).\n# ctypes declarations for libomega_native.so beside this file. Regenerate it; do not edit it.\n# Status: 0 done; 1..14 the Omega trap code; 32 argument refused (None, wrong length, misaligned,\n# overlap); 33 reentry; 34 bad runtime entry; 35 no stack. The result (a ctypes.c_uint64 passed with\n# ctypes.byref) is written only on status 0. A scalar is an int in 0 .. 2**64-1 (a long is passed as its\n# two's-complement bits); anything else raises ctypes.ArgumentError, nothing is truncated. An array is a\n# ctypes array of its element type (bytes for a view uchar, c_float for f32, c_uint16 for ushort) then its element count; an edit array must\n# be writable, so bytes are refused there.\nimport ctypes, os\nOMEGA_OK, OMEGA_BAD_ARG, OMEGA_REENTRY, OMEGA_BAD_RT, OMEGA_NO_STACK = 0, 32, 33, 34, 35\nlib = ctypes.CDLL(os.path.join(os.path.dirname(os.path.abspath(__file__)), \"libomega_native.so\"))\nclass _u64:\n    @classmethod\n    def from_param(cls, v):\n        if type(v) is not int or v < 0 or v > 18446744073709551615:\n            raise ValueError(\"omega scalar: an int in 0 .. 2**64-1 expected, got %r\" % (v,))\n        return ctypes.c_uint64(v)\n_res = ctypes.POINTER(ctypes.c_uint64)\n_a3 = ctypes.POINTER(ctypes.c_uint64)  # edit ulong: a writable ctypes array of c_uint64\n_a4 = ctypes.POINTER(ctypes.c_uint64)  # view ulong: a ctypes array of c_uint64\n_a5 = ctypes.POINTER(ctypes.c_ubyte)  # edit uchar: a writable ctypes array of c_ubyte\n_a6 = ctypes.c_char_p  # view uchar: bytes, or a ctypes array of c_char\n_a7 = ctypes.POINTER(ctypes.c_float)  # edit f32: a writable ctypes array of c_float\n_a8 = ctypes.POINTER(ctypes.c_float)  # view f32: a ctypes array of c_float\n_a9 = ctypes.POINTER(ctypes.c_uint16)  # edit ushort: a writable ctypes array of c_uint16\n_a10 = ctypes.POINTER(ctypes.c_uint16)  # view ushort: a ctypes array of c_uint16\n~# ~\nomega_~ = lib.omega_~\nomega_~.argtypes = [_res~, _u64~, _a~]\nomega_~.restype = ctypes.c_uint32\n~// Generated by omega-bridge src/native.om: native call ABI v1 (docs/NATIVE-ABI.md).\n// Declarations for libomega_native (build with -L <its directory>; Rust 1.82 or later). Regenerate it; do not edit it.\n// Status: 0 done; 1..14 the Omega trap code; 32 argument refused (null, wrong length, misaligned,\n// overlap); 33 reentry; 34 bad runtime entry; 35 no stack. The result is written only on status 0.\n// A long is its two's-complement bits (an i64 as u64); an array is its pointer then its element count.\n#[allow(dead_code)]\npub const OMEGA_OK: u32 = 0;\n#[allow(dead_code)]\npub const OMEGA_BAD_ARG: u32 = 32;\n#[allow(dead_code)]\npub const OMEGA_REENTRY: u32 = 33;\n#[allow(dead_code)]\npub const OMEGA_BAD_RT: u32 = 34;\n#[allow(dead_code)]\npub const OMEGA_NO_STACK: u32 = 35;\n#[allow(dead_code)]\n#[link(name = \"omega_native\")]\nunsafe extern \"C\" {\n~    // ~\n    pub fn omega_~(result: *mut u64~, o_~: u64~: *mut u64~: *const u64~: *mut u8~: *const u8~_len: u64~) -> u32;\n~}\n~// Generated by omega-bridge src/native.om: native call ABI v1 (docs/NATIVE-ABI.md).\n// Declarations for libomega_native (build with -L<its directory> -lomega_native -lc). Regenerate it; do not edit it.\n// Status: 0 done; 1..14 the Omega trap code; 32 argument refused (null, wrong length, misaligned,\n// overlap); 33 reentry; 34 bad runtime entry; 35 no stack. The result is written only on status 0.\n// A long is its two's-complement bits (@bitCast); an array is its pointer then its element count.\npub const OMEGA_OK: u32 = 0;\npub const OMEGA_BAD_ARG: u32 = 32;\npub const OMEGA_REENTRY: u32 = 33;\npub const OMEGA_BAD_RT: u32 = 34;\npub const OMEGA_NO_STACK: u32 = 35;\n~// ~\npub extern fn omega_~(result: ?*u64~, o_~: u64~: ?[*]u64~: ?[*]const u64~: ?[*]u8~: ?[*]const u8~_len: u64~) u32;\n~// Generated by omega-bridge src/native.om: native call ABI v1 (docs/NATIVE-ABI.md).\n// cgo package omeganative: this file, omega_native.h and libomega_native.so in one folder. Regenerate it;\n// do not edit it. No run-time path is baked in: the program's build names the folder (CGO_LDFLAGS set to\n// -Wl,-rpath,<folder>), or LD_LIBRARY_PATH does.\n// Status: 0 done; 1..14 the Omega trap code; 32 argument refused (nil, wrong length, misaligned,\n// overlap); 33 reentry; 34 bad runtime entry; 35 no stack. The result is written only on status 0.\n// A long is its two's-complement bits (an int64 as uint64); an array is an unsafe.Pointer to memory\n// holding no Go pointers, then its element count.\npackage omeganative\n\n/*\n#cgo CFLAGS: -I${SRCDIR}\n#cgo LDFLAGS: -L${SRCDIR} -lomega_native\n#include \"omega_native.h\"\n*/\nimport \"C\"\n\nimport \"unsafe\"\n\nconst (\n\tOmegaOK uint32 = 0\n\tOmegaBadArg uint32 = 32\n\tOmegaReentry uint32 = 33\n\tOmegaBadRt uint32 = 34\n\tOmegaNoStack uint32 = 35\n)\n~\n// ~\nfunc Omega_~(result *uint64~, o_~ uint64~ unsafe.Pointer~ unsafe.Pointer~ unsafe.Pointer~ unsafe.Pointer~_len uint64~) uint32 {\n\treturn uint32(C.omega_~((*C.uint64_t)(unsafe.Pointer(result))~, C.uint64_t(o_~)~, o_~_len)~))\n}\n"
+text tb "/* Generated by omega-bridge src/native.om: native call ABI v1 (docs/NATIVE-ABI.md).\n * C and C++ declarations for libomega_native. Regenerate it; do not edit it.\n * Status: 0 done; 1..14 the Omega trap code; 32 argument refused (null, wrong length, misaligned,\n * overlap); 33 reentry; 34 bad runtime entry; 35 no stack. The result is written only on status 0.\n * A long is its two's-complement bits; an array is its address then its element count.\n * Parameter names carry o_ so no language's reserved words collide. */\n#ifndef OMEGA_NATIVE_H\n#define OMEGA_NATIVE_H\n#include <stdint.h>\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n#define OMEGA_OK 0u\n#define OMEGA_BAD_ARG 32u\n#define OMEGA_REENTRY 33u\n#define OMEGA_BAD_RT 34u\n#define OMEGA_NO_STACK 35u\n~/* ~ */\nuint32_t omega_~(uint64_t *result~, uint64_t o_~, void *o_~, const void *o_~, void *o_~, const void *o_~_len~);\n~#ifdef __cplusplus\n}\n#endif\n#endif\n~# Generated by omega-bridge src/native.om: native call ABI v1 (docs/NATIVE-ABI.md).\n# ctypes declarations for libomega_native.so beside this file. Regenerate it; do not edit it.\n# Status: 0 done; 1..14 the Omega trap code; 32 argument refused (None, wrong length, misaligned,\n# overlap); 33 reentry; 34 bad runtime entry; 35 no stack. The result (a ctypes.c_uint64 passed with\n# ctypes.byref) is written only on status 0. A scalar is an int in 0 .. 2**64-1 (a long is passed as its\n# two's-complement bits); anything else raises ctypes.ArgumentError, nothing is truncated. An array is a\n# ctypes array of its element type (bytes for a view uchar, c_float for f32, c_uint16 for ushort) then its element count; an edit array must\n# be writable, so bytes are refused there.\nimport ctypes, os, sys\nOMEGA_OK, OMEGA_BAD_ARG, OMEGA_REENTRY, OMEGA_BAD_RT, OMEGA_NO_STACK = 0, 32, 33, 34, 35\nlib = ctypes.CDLL(os.path.join(os.path.dirname(os.path.abspath(__file__)),\n    \"libomega_native.dylib\" if sys.platform == \"darwin\" else \"libomega_native.so\"))\nclass _u64:\n    @classmethod\n    def from_param(cls, v):\n        if type(v) is not int or v < 0 or v > 18446744073709551615:\n            raise ValueError(\"omega scalar: an int in 0 .. 2**64-1 expected, got %r\" % (v,))\n        return ctypes.c_uint64(v)\n_res = ctypes.POINTER(ctypes.c_uint64)\n_a3 = ctypes.POINTER(ctypes.c_uint64)  # edit ulong: a writable ctypes array of c_uint64\n_a4 = ctypes.POINTER(ctypes.c_uint64)  # view ulong: a ctypes array of c_uint64\n_a5 = ctypes.POINTER(ctypes.c_ubyte)  # edit uchar: a writable ctypes array of c_ubyte\n_a6 = ctypes.c_char_p  # view uchar: bytes, or a ctypes array of c_char\n_a7 = ctypes.POINTER(ctypes.c_float)  # edit f32: a writable ctypes array of c_float\n_a8 = ctypes.POINTER(ctypes.c_float)  # view f32: a ctypes array of c_float\n_a9 = ctypes.POINTER(ctypes.c_uint16)  # edit ushort: a writable ctypes array of c_uint16\n_a10 = ctypes.POINTER(ctypes.c_uint16)  # view ushort: a ctypes array of c_uint16\n~# ~\nomega_~ = lib.omega_~\nomega_~.argtypes = [_res~, _u64~, _a~]\nomega_~.restype = ctypes.c_uint32\n~// Generated by omega-bridge src/native.om: native call ABI v1 (docs/NATIVE-ABI.md).\n// Declarations for libomega_native (build with -L <its directory>; Rust 1.82 or later). Regenerate it; do not edit it.\n// Status: 0 done; 1..14 the Omega trap code; 32 argument refused (null, wrong length, misaligned,\n// overlap); 33 reentry; 34 bad runtime entry; 35 no stack. The result is written only on status 0.\n// A long is its two's-complement bits (an i64 as u64); an array is its pointer then its element count.\n#[allow(dead_code)]\npub const OMEGA_OK: u32 = 0;\n#[allow(dead_code)]\npub const OMEGA_BAD_ARG: u32 = 32;\n#[allow(dead_code)]\npub const OMEGA_REENTRY: u32 = 33;\n#[allow(dead_code)]\npub const OMEGA_BAD_RT: u32 = 34;\n#[allow(dead_code)]\npub const OMEGA_NO_STACK: u32 = 35;\n#[allow(dead_code)]\n#[link(name = \"omega_native\")]\nunsafe extern \"C\" {\n~    // ~\n    pub fn omega_~(result: *mut u64~, o_~: u64~: *mut u64~: *const u64~: *mut u8~: *const u8~_len: u64~) -> u32;\n~}\n~// Generated by omega-bridge src/native.om: native call ABI v1 (docs/NATIVE-ABI.md).\n// Declarations for libomega_native (build with -L<its directory> -lomega_native -lc). Regenerate it; do not edit it.\n// Status: 0 done; 1..14 the Omega trap code; 32 argument refused (null, wrong length, misaligned,\n// overlap); 33 reentry; 34 bad runtime entry; 35 no stack. The result is written only on status 0.\n// A long is its two's-complement bits (@bitCast); an array is its pointer then its element count.\npub const OMEGA_OK: u32 = 0;\npub const OMEGA_BAD_ARG: u32 = 32;\npub const OMEGA_REENTRY: u32 = 33;\npub const OMEGA_BAD_RT: u32 = 34;\npub const OMEGA_NO_STACK: u32 = 35;\n~// ~\npub extern fn omega_~(result: ?*u64~, o_~: u64~: ?[*]u64~: ?[*]const u64~: ?[*]u8~: ?[*]const u8~_len: u64~) u32;\n~// Generated by omega-bridge src/native.om: native call ABI v1 (docs/NATIVE-ABI.md).\n// cgo package omeganative: this file, omega_native.h and libomega_native.so in one folder. Regenerate it;\n// do not edit it. No run-time path is baked in: the program's build names the folder (CGO_LDFLAGS set to\n// -Wl,-rpath,<folder>), or LD_LIBRARY_PATH does.\n// Status: 0 done; 1..14 the Omega trap code; 32 argument refused (nil, wrong length, misaligned,\n// overlap); 33 reentry; 34 bad runtime entry; 35 no stack. The result is written only on status 0.\n// A long is its two's-complement bits (an int64 as uint64); an array is an unsafe.Pointer to memory\n// holding no Go pointers, then its element count.\npackage omeganative\n\n/*\n#cgo CFLAGS: -I${SRCDIR}\n#cgo LDFLAGS: -L${SRCDIR} -lomega_native\n#include \"omega_native.h\"\n*/\nimport \"C\"\n\nimport \"unsafe\"\n\nconst (\n\tOmegaOK uint32 = 0\n\tOmegaBadArg uint32 = 32\n\tOmegaReentry uint32 = 33\n\tOmegaBadRt uint32 = 34\n\tOmegaNoStack uint32 = 35\n)\n~\n// ~\nfunc Omega_~(result *uint64~, o_~ uint64~ unsafe.Pointer~ unsafe.Pointer~ unsafe.Pointer~ unsafe.Pointer~_len uint64~) uint32 {\n\treturn uint32(C.omega_~((*C.uint64_t)(unsafe.Pointer(result))~, C.uint64_t(o_~)~, o_~_len)~))\n}\n"
 note Freestanding output (freest) accepts pure units only: no storage (global, text), host words, floats
 note or input; an OM-1 unit integer scalars only (no arrays). fw lists the words a pure unit may use; the
 note words after # are the OM-2 ones, allowed only in an OM-2 unit (fo2 1): views, layouts, out
@@ -55,7 +55,7 @@ global fne ulong 1024
 global fnc ulong 1
 global fo2 ulong 1
 text fw "|note|fn|to|ret|if|else|end|for|while|bound|break|continue|trap|requires|ensures|invariant|result|const|bool|uchar|ushort|uint|ulong|byte|short|int|long|true|false|add|sub|mul|div|rem|and|or|xor|shl|shr|neg|not|eq|ne|lt|le|gt|ge|bitcast|(|)|=|void|#|om2|export|layout|field|out|at|little|big|edit|view|fresh|get|put|len|new|part|unroll|inline|rotr|rotl|*|"
-text fp "/* Generated pure integer-scalar freestanding native ABI v1 binding. */\n#include <stdint.h>\n#define OMEGA_OK 0u\n#define OMEGA_BAD_ARG 32u\n#define OMEGA_BAD_RT 34u\ntypedef struct ombr_rt { const void *entry[32]; } ombr_rt;\nuint32_t ombr_enter(const void *code, const uint64_t *args, const ombr_rt *rt, uint64_t *out, void *top)\n    __attribute__((visibility(\"hidden\")));\nextern const unsigned char ombr_trap[] __attribute__((visibility(\"hidden\")));\nextern const unsigned char ombr_no_entry[] __attribute__((visibility(\"hidden\")));\n/* ombr_enter saves the callee-saved registers on the caller's stack, keeps that stack pointer in x19 and\n * runs the pure scalar code on the caller's stack. A normal return stores x0 through out and\n * returns 0. A runtime entry restores the stack pointer from x19 and returns a status; out is not\n * written. A unit's code must not write x18, x19 or x29 and must keep sp balanced; it may write\n * x0..x17, x20..x28 and v0..v31 (x20..x28 and d8..d15 are restored here). Runtime entries are reached by blr/br, so they\n * start with bti jc. */\n__asm__(\".text\\n.balign 4\\n.local ombr_enter\\n.hidden ombr_enter\\n.type ombr_enter,%function\\nombr_enter:\\n\"\n        \"hint #34\\nstp x29,x30,[sp,#-176]!\\nmov x29,sp\\nstp x19,x20,[sp,#16]\\nstp x21,x22,[sp,#32]\\n\"\n        \"stp x23,x24,[sp,#48]\\nstp x25,x26,[sp,#64]\\nstp x27,x28,[sp,#80]\\nstp d8,d9,[sp,#96]\\n\"\n        \"stp d10,d11,[sp,#112]\\nstp d12,d13,[sp,#128]\\nstp d14,d15,[sp,#144]\\nstr x3,[sp,#160]\\n\"\n        \"mov x19,sp\\nmov x16,x0\\nmov x17,x1\\nmov x7,x2\\n\"\n        \"ldp x0,x1,[x17]\\nldp x2,x3,[x17,#16]\\nldp x4,x5,[x17,#32]\\nblr x16\\n\"\n        \"mov sp,x19\\nldr x9,[sp,#160]\\nstr x0,[x9]\\nmov w0,#0\\n\"\n        \"ombr_leave:\\nldp d14,d15,[sp,#144]\\nldp d12,d13,[sp,#128]\\nldp d10,d11,[sp,#112]\\n\"\n        \"ldp d8,d9,[sp,#96]\\nldp x27,x28,[sp,#80]\\nldp x25,x26,[sp,#64]\\nldp x23,x24,[sp,#48]\\n\"\n        \"ldp x21,x22,[sp,#32]\\nldp x19,x20,[sp,#16]\\nldp x29,x30,[sp],#176\\nret\\n.size ombr_enter,.-ombr_enter\\n\"\n        \".local ombr_trap\\n.hidden ombr_trap\\n.type ombr_trap,%function\\nombr_trap:\\nhint #38\\n\"\n        \"mov sp,x19\\nsub x2,x1,#1\\nmov w3,#34\\ncmp x2,#13\\ncsel w0,w1,w3,ls\\nb ombr_leave\\n\"\n        \".size ombr_trap,.-ombr_trap\\n\"\n        \".local ombr_no_entry\\n.hidden ombr_no_entry\\n.type ombr_no_entry,%function\\nombr_no_entry:\\nhint #38\\n\"\n        \"mov sp,x19\\nmov w0,#34\\nb ombr_leave\\n.size ombr_no_entry,.-ombr_no_entry\\n\");\nstatic const ombr_rt ombr_rt_table = {{ ombr_no_entry, ombr_no_entry, ombr_trap, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry }};\nstatic uint32_t ombr_run(const void *code, const uint64_t *args, uint64_t *result, int has_value)\n{\n    uint64_t v = 0;\n    uint32_t status = ombr_enter(code, args, &ombr_rt_table, &v, 0);\n    if (status == OMEGA_OK)\n        *result = has_value ? v : 0u;\n    return status;\n}\n"
+text fp "/* Generated pure integer-scalar freestanding native ABI v1 binding. */\n#include <stdint.h>\n#if !defined(__ELF__)\n#error \"omega-bridge freestanding binding: ELF objects only\"\n#endif\n#define OMBR_SYM(n) #n\n#define OMBR_LOCAL(n) \".local \" #n \"\\n\"\n#define OMBR_HIDDEN(n) \".hidden \" #n \"\\n\"\n#define OMBR_CODE_SECTION \".section .text.omega_bridge,\\\"ax\\\",@progbits\\n\"\n#define OMBR_PREVIOUS \".previous\\n\"\n#define OMEGA_OK 0u\n#define OMEGA_BAD_ARG 32u\n#define OMEGA_BAD_RT 34u\ntypedef struct ombr_rt { const void *entry[32]; } ombr_rt;\nuint32_t ombr_enter(const void *code, const uint64_t *args, const ombr_rt *rt, uint64_t *out, void *top)\n    __attribute__((visibility(\"hidden\")));\nextern const unsigned char ombr_trap[] __attribute__((visibility(\"hidden\")));\nextern const unsigned char ombr_no_entry[] __attribute__((visibility(\"hidden\")));\n/* ombr_enter saves the callee-saved registers on the caller's stack, keeps that stack pointer in x19 and\n * runs the pure scalar code on the caller's stack. A normal return stores x0 through out and\n * returns 0. A runtime entry restores the stack pointer from x19 and returns a status; out is not\n * written. A unit's code must not write x18, x19 or x29 and must keep sp balanced; it may write\n * x0..x17, x20..x28 and v0..v31 (x20..x28 and d8..d15 are restored here). Runtime entries are reached by blr/br, so they\n * start with bti jc. */\n__asm__(\".text\\n.balign 4\\n.local ombr_enter\\n.hidden ombr_enter\\n.type ombr_enter,%function\\nombr_enter:\\n\"\n        \"hint #34\\nstp x29,x30,[sp,#-176]!\\nmov x29,sp\\nstp x19,x20,[sp,#16]\\nstp x21,x22,[sp,#32]\\n\"\n        \"stp x23,x24,[sp,#48]\\nstp x25,x26,[sp,#64]\\nstp x27,x28,[sp,#80]\\nstp d8,d9,[sp,#96]\\n\"\n        \"stp d10,d11,[sp,#112]\\nstp d12,d13,[sp,#128]\\nstp d14,d15,[sp,#144]\\nstr x3,[sp,#160]\\n\"\n        \"mov x19,sp\\nmov x16,x0\\nmov x17,x1\\nmov x7,x2\\n\"\n        \"ldp x0,x1,[x17]\\nldp x2,x3,[x17,#16]\\nldp x4,x5,[x17,#32]\\nblr x16\\n\"\n        \"mov sp,x19\\nldr x9,[sp,#160]\\nstr x0,[x9]\\nmov w0,#0\\n\"\n        \"ombr_leave:\\nldp d14,d15,[sp,#144]\\nldp d12,d13,[sp,#128]\\nldp d10,d11,[sp,#112]\\n\"\n        \"ldp d8,d9,[sp,#96]\\nldp x27,x28,[sp,#80]\\nldp x25,x26,[sp,#64]\\nldp x23,x24,[sp,#48]\\n\"\n        \"ldp x21,x22,[sp,#32]\\nldp x19,x20,[sp,#16]\\nldp x29,x30,[sp],#176\\nret\\n.size ombr_enter,.-ombr_enter\\n\"\n        \".local ombr_trap\\n.hidden ombr_trap\\n.type ombr_trap,%function\\nombr_trap:\\nhint #38\\n\"\n        \"mov sp,x19\\nsub x2,x1,#1\\nmov w3,#34\\ncmp x2,#13\\ncsel w0,w1,w3,ls\\nb ombr_leave\\n\"\n        \".size ombr_trap,.-ombr_trap\\n\"\n        \".local ombr_no_entry\\n.hidden ombr_no_entry\\n.type ombr_no_entry,%function\\nombr_no_entry:\\nhint #38\\n\"\n        \"mov sp,x19\\nmov w0,#34\\nb ombr_leave\\n.size ombr_no_entry,.-ombr_no_entry\\n\");\nstatic const ombr_rt ombr_rt_table = {{ ombr_no_entry, ombr_no_entry, ombr_trap, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry, ombr_no_entry }};\nstatic uint32_t ombr_run(const void *code, const uint64_t *args, uint64_t *result, int has_value)\n{\n    uint64_t v = 0;\n    uint32_t status = ombr_enter(code, args, &ombr_rt_table, &v, 0);\n    if (status == OMEGA_OK)\n        *result = has_value ? v : 0u;\n    return status;\n}\n"
 text fb ")\n{\n    uint64_t a[6] = {0};\n    if (!result || (uintptr_t)result % 8u != 0u || (uintptr_t)result > UINTPTR_MAX - 8u)\n        return OMEGA_BAD_ARG;\n~    return ombr_run(ombr_entry_"
 fn fword k ulong to ulong
 i = ulong 0
@@ -937,9 +937,12 @@ trap 10
 end
 ret cl
 end
-note xcode: x86linux code bytes as ":", then .quad words (byte 8q+7 is the high digit pair, so the
-note little-endian assembler lays down the compiler's bytes in order), then any tail as .byte.
+note xcode: x86linux code bytes as ") ":" (closing the OMBR_SYM label), then .quad words (byte 8q+7 is the high
+note digit pair, so the little-endian assembler lays down the compiler's bytes in order), then any tail as .byte.
 fn xcode c0 ulong cl ulong to void
+ob uchar 41
+ob uchar 32
+ob uchar 34
 ob uchar 58
 nq = div cl 8
 if gt nq 0
@@ -972,8 +975,32 @@ end
 ohex get inb add c0 add r j
 end
 end
+note hassvc: 1 when a code word is an svc (bytes x1 xx x0 d4 under the mask 1f 00 e0 ff): a host word's
+note Linux system call, which macOS numbers differently; the C file then refuses to build on macOS.
+fn hassvc c0 ulong cl ulong to ulong
+j = ulong 0
+while lt j cl
+p = add c0 j
+if eq get inb add p 3 212
+if eq and get inb add p 2 224 0
+if eq and get inb p 31 1
+ret 1
+end
+end
+end
+j = add j 4
+end
+ret 0
+end
 note ecode: the embedded machine code, unchanged (x86linux packs it as little-endian .quad words).
 fn ecode c0 ulong cl ulong to void
+if ne get xt 0 1
+if eq hassvc c0 cl 1
+ofr 28
+oname 1
+ofr 29
+end
+end
 ofr 0
 oname 1
 ofr 1
@@ -1258,7 +1285,7 @@ note fv: the v2 output fragments, separated by ~ (byte 126): 0 the C prelude, 1-
 note identity, 11-13 the identity text, 14-20 an entry stub, 21-24 the C function head, 25-30 a C
 note parameter, 31-50 the C body, 51-56 h, 57-75 and 155 python, 76-88 rust, 89-98 zig, 99-117 go,
 note 118-154 the api header. tn: the element type names, 8 per language: C, ctypes, rust and zig, cgo.
-text fv "/* ABI v2 (docs/NATIVE-ABI.md, ABI v2): OM-2 units, bound as omega2_<export>. An unsized view is its\n * pointer and its element count; a layout is a pointer to its fixed bytes; an out parameter is written\n * to a buffer the binding owns and copied to the caller only after status 0. */\n#include <string.h>\ntypedef struct ombr2_out { unsigned slot; uint64_t n; void *dst; } ombr2_out;\n/* A library of OM-2 units alone calls neither of the ABI v1 helpers. */\n__attribute__((unused)) static void ombr2_keep(void)\n{\n    (void)ombr_overlap;\n    (void)ombr_run;\n}\n/* An unsized view of n elements of es bytes. n == 0 is the empty view whatever the pointer (it adds no\n * range, so it overlaps nothing). Otherwise refused: a null pointer, a pointer not aligned to es,\n * n * es over 64 bits, or an end past the top of the address space. */\n__attribute__((unused)) static int ombr2_view(ombr_span *sp, unsigned *ns, const void *p, uint64_t n, uint64_t es, int w)\n{\n    uintptr_t lo = (uintptr_t)p;\n    if (n == 0u)\n        return 0;\n    if (!p || lo % es != 0u || n > UINT64_MAX / es || n * es > UINTPTR_MAX - lo)\n        return 1;\n    sp[*ns].lo = lo;\n    sp[*ns].hi = lo + n * es;\n    sp[*ns].w = w;\n    (*ns)++;\n    return 0;\n}\n/* A fixed range of nb > 0 bytes (a layout or an out parameter) aligned to es. */\n__attribute__((unused)) static int ombr2_fixed(ombr_span *sp, unsigned *ns, const void *p, uint64_t nb, uint64_t es,\n                                               int w)\n{\n    uintptr_t lo = (uintptr_t)p;\n    if (!p || lo % es != 0u || nb > UINTPTR_MAX - lo)\n        return 1;\n    sp[*ns].lo = lo;\n    sp[*ns].hi = lo + nb;\n    sp[*ns].w = w;\n    (*ns)++;\n    return 0;\n}\n/* w: 0 view, 1 edit or the result, 2 out. Refused: an edit or the result overlapping any other range,\n * or two out ranges overlapping. An out may overlap a view: it is written only after the code returns. */\nstatic int ombr2_overlap(const ombr_span *sp, unsigned ns)\n{\n    for (unsigned i = 0; i < ns; i++)\n        for (unsigned j = i + 1; j < ns; j++)\n            if ((sp[i].w == 1 || sp[j].w == 1 || (sp[i].w == 2 && sp[j].w == 2))\n                && sp[i].lo < sp[j].hi && sp[j].lo < sp[i].hi)\n                return 1;\n    return 0;\n}\n/* As ombr_run, and each out buffer is carved from the top of the thread's Omega stack (16-byte aligned,\n * zero-filled), passed in its slot and copied to the caller with memmove only after status 0. */\nstatic uint32_t ombr2_run(const void *code, uint64_t *args, uint64_t *result, int has_value, const ombr2_out *o,\n                          unsigned no)\n{\n    if (ombr_active)\n        return OMEGA_REENTRY;\n    ombr_active = 1;\n    unsigned char *top = ombr_stack();\n    if (!top) {\n        ombr_active = 0;\n        return OMEGA_NO_STACK;\n    }\n    unsigned char *buf[6] = {0};\n    for (unsigned i = 0; i < no; i++) {\n        top -= (o[i].n + 15u) / 16u * 16u;\n        memset(top, 0, o[i].n);\n        buf[i] = top;\n        args[o[i].slot] = (uint64_t)(uintptr_t)top;\n    }\n    uint64_t v = 0;\n    uint32_t s = ombr_enter(code, args, &ombr_rt_table, &v, top);\n    if (s == OMEGA_OK) {\n        for (unsigned i = 0; i < no; i++)\n            memmove(o[i].dst, buf[i], o[i].n);\n        *result = has_value ? v : 0u;\n    }\n    ombr_active = 0;\n    return s;\n}\n~__asm__(\".section .text.omega_bridge,\\\"ax\\\",@progbits\\n.balign 4\\n.local ombr2_code_~\\n.hidden ombr2_code_~\\nombr2_code_~:\\n.byte ~\\n.previous\\n\");\n~static const char ombr2_ident_~[] = \"~\";\n__attribute__((visibility(\"default\"))) const char *omega2_ident_~(void)\n{\n    return ombr2_ident_~;\n}\n~omega-ident 1 unit=~ abi=2 profile=OM-2 src=~ omc=~__asm__(\".section .text.omega_bridge,\\\"ax\\\",@progbits\\n.balign 4\\n.local ombr2_entry_~\\n.hidden ombr2_entry_~\\nombr2_entry_~:\\nhint #34\\nb ombr2_code_~+~\\n.previous\\n\");\nextern const unsigned char ombr2_entry_~[] __attribute__((visibility(\"hidden\")));\n~/* ~ */\n__attribute__((visibility(\"default\"))) uint32_t omega2_~(uint64_t *result~)\n{\n    ombr_span sp[7];\n    unsigned ns = 0;\n    uint64_t a[6] = {0};\n    ombr2_out ou[6] = {{0, 0, 0}};\n    unsigned no = 0;\n    if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1))\n        return OMEGA_BAD_ARG;\n~, uint64_t o_~, ~const ~ *o_~, uint64_t o_~_len~    if (ombr_span_add(sp, &ns, o_~, o_~_len, ~u, ~))\n        return OMEGA_BAD_ARG;\n~    a[~] = (uint64_t)(uintptr_t)o_~;\n~] = o_~    if (ombr2_view(sp, &ns, o_~    if (ombr2_fixed(sp, &ns, o_~_len;\n~2))\n        return OMEGA_BAD_ARG;\n    ou[no].slot = ~u;\n    ou[no].n = ~u;\n    ou[no].dst = o_~;\n    no++;\n~1u, ~    if (ombr2_overlap(sp, ns))\n        return OMEGA_BAD_ARG;\n    return ombr2_run(ombr2_entry_~, a, result, ~, ou, no);\n}\n~#define OMEGA2_IDENT_~ \"~\"\nconst char *omega2_ident_~(void);\n~ */\nuint32_t omega2_~);\n~# ~\nomega2_~ = lib.omega2_~.argtypes = [_res~]\nomega2_~.restype = ctypes.c_uint32\n~, _u64~, ctypes.c_char_p~, ctypes.POINTER(ctypes.~)~omega2_ident_~.argtypes = []\nomega2_ident_~.restype = ctypes.c_char_p\nOMEGA2_IDENT_~ = b\"~\"\nif omega2_ident_~() != OMEGA2_IDENT_~:\n    raise ImportError(\"libomega_native.so is not the library this binding was generated with: the identity of unit ~ differs\")\n~\n~    // ~\n    pub fn omega2_~(result: *mut u64~) -> u32;\n~, o_~: u64~: *const ~: *mut ~_len: u64~    pub fn omega2_ident_~() -> *const u8;\n}\n#[allow(dead_code, non_upper_case_globals)]\npub const OMEGA2_IDENT_~: &str = \"~\";\n#[allow(dead_code)]\n#[link(name = \"omega_native\")]\nunsafe extern \"C\" {\n~// ~\npub extern fn omega2_~(result: ?*u64~) u32;\n~: ?[*]const ~: ?[*]~pub const OMEGA2_IDENT_~ = \"~\";\npub extern fn omega2_ident_~() [*:0]const u8;\n~\n// ~\nfunc Omega2_~(result *uint64~) uint32 {\n\treturn uint32(C.omega2_~((*C.uint64_t)(unsafe.Pointer(result))~))\n}\n~ uint64~ unsafe.Pointer~_len uint64~, C.uint64_t(o_~)~, (*C.~)(o_~_len)~\nconst Omega2Ident_~ = \"~\"\n\nfunc Omega2_ident_~() string {\n\treturn C.GoString(C.omega2_ident_~())\n}\n~/* Generated by omega-bridge src/native.om: the C API of the ABI v2 units in libomega_native\n * (docs/NATIVE-ABI.md, ABI v2). Each function calls omega2_<name> and calls abort() on a nonzero status.\n * Regenerate it; do not edit it. */\n#ifndef OMEGA_API_H\n#define OMEGA_API_H\n#include <stddef.h>\n#include <stdint.h>\n#include <stdlib.h>\n#include \"omega_native.h\"\n#ifdef __cplusplus\n#define OMBR_ASSERT static_assert\nextern \"C\" {\n#else\n#define OMBR_ASSERT _Static_assert\n#endif\n~#ifdef __cplusplus\n}\n#endif\n#endif\n~#define ~ ~typedef struct {\n~} ~;\nOMBR_ASSERT(sizeof(~) == ~, \"layout ~ size\");\n~OMBR_ASSERT(offsetof(~, ~ field ~\");\n~    ~[~];\n~    uint8_t ombr_pad~ */\nstatic inline ~void~uint64_t~int64_t~(~)\n{\n    uint64_t r = 0;\n    if (omega2_~(&r~) != OMEGA_OK)\n        abort();\n~    (void)r;\n}\n~    return r;\n}\n~    return (int64_t)r;\n}\n~, ~ o_~ *o_~, size_t o_~, (uint8_t *)o_~, (const uint8_t *)o_~, (uint64_t)o_~]~ = lib."
+text fv "/* ABI v2 (docs/NATIVE-ABI.md, ABI v2): OM-2 units, bound as omega2_<export>. An unsized view is its\n * pointer and its element count; a layout is a pointer to its fixed bytes; an out parameter is written\n * to a buffer the binding owns and copied to the caller only after status 0. */\n#include <string.h>\ntypedef struct ombr2_out { unsigned slot; uint64_t n; void *dst; } ombr2_out;\n/* A library of OM-2 units alone calls neither of the ABI v1 helpers. */\n__attribute__((unused)) static void ombr2_keep(void)\n{\n    (void)ombr_overlap;\n    (void)ombr_run;\n}\n/* An unsized view of n elements of es bytes. n == 0 is the empty view whatever the pointer (it adds no\n * range, so it overlaps nothing). Otherwise refused: a null pointer, a pointer not aligned to es,\n * n * es over 64 bits, or an end past the top of the address space. */\n__attribute__((unused)) static int ombr2_view(ombr_span *sp, unsigned *ns, const void *p, uint64_t n, uint64_t es, int w)\n{\n    uintptr_t lo = (uintptr_t)p;\n    if (n == 0u)\n        return 0;\n    if (!p || lo % es != 0u || n > UINT64_MAX / es || n * es > UINTPTR_MAX - lo)\n        return 1;\n    sp[*ns].lo = lo;\n    sp[*ns].hi = lo + n * es;\n    sp[*ns].w = w;\n    (*ns)++;\n    return 0;\n}\n/* A fixed range of nb > 0 bytes (a layout or an out parameter) aligned to es. */\n__attribute__((unused)) static int ombr2_fixed(ombr_span *sp, unsigned *ns, const void *p, uint64_t nb, uint64_t es,\n                                               int w)\n{\n    uintptr_t lo = (uintptr_t)p;\n    if (!p || lo % es != 0u || nb > UINTPTR_MAX - lo)\n        return 1;\n    sp[*ns].lo = lo;\n    sp[*ns].hi = lo + nb;\n    sp[*ns].w = w;\n    (*ns)++;\n    return 0;\n}\n/* w: 0 view, 1 edit or the result, 2 out. Refused: an edit or the result overlapping any other range,\n * or two out ranges overlapping. An out may overlap a view: it is written only after the code returns. */\nstatic int ombr2_overlap(const ombr_span *sp, unsigned ns)\n{\n    for (unsigned i = 0; i < ns; i++)\n        for (unsigned j = i + 1; j < ns; j++)\n            if ((sp[i].w == 1 || sp[j].w == 1 || (sp[i].w == 2 && sp[j].w == 2))\n                && sp[i].lo < sp[j].hi && sp[j].lo < sp[i].hi)\n                return 1;\n    return 0;\n}\n/* As ombr_run, and each out buffer is carved from the top of the thread's Omega stack (16-byte aligned,\n * zero-filled), passed in its slot and copied to the caller with memmove only after status 0. */\nstatic uint32_t ombr2_run(const void *code, uint64_t *args, uint64_t *result, int has_value, const ombr2_out *o,\n                          unsigned no)\n{\n    if (ombr_active)\n        return OMEGA_REENTRY;\n    ombr_active = 1;\n    unsigned char *top = ombr_stack();\n    if (!top) {\n        ombr_active = 0;\n        return OMEGA_NO_STACK;\n    }\n    unsigned char *buf[6] = {0};\n    for (unsigned i = 0; i < no; i++) {\n        top -= (o[i].n + 15u) / 16u * 16u;\n        memset(top, 0, o[i].n);\n        buf[i] = top;\n        args[o[i].slot] = (uint64_t)(uintptr_t)top;\n    }\n    uint64_t v = 0;\n    uint32_t s = ombr_enter(code, args, &ombr_rt_table, &v, top);\n    if (s == OMEGA_OK) {\n        for (unsigned i = 0; i < no; i++)\n            memmove(o[i].dst, buf[i], o[i].n);\n        *result = has_value ? v : 0u;\n    }\n    ombr_active = 0;\n    return s;\n}\n~__asm__(OMBR_CODE_SECTION \".balign 4\\n\" OMBR_LOCAL(ombr2_code_~) OMBR_HIDDEN(ombr2_code_~) OMBR_SYM(ombr2_code_~) \":\\n.byte ~\\n\" OMBR_PREVIOUS);\n~static const char ombr2_ident_~[] = \"~\";\n__attribute__((visibility(\"default\"))) const char *omega2_ident_~(void)\n{\n    return ombr2_ident_~;\n}\n~omega-ident 1 unit=~ abi=2 profile=OM-2 src=~ omc=~__asm__(OMBR_CODE_SECTION \".balign 4\\n\" OMBR_LOCAL(ombr2_entry_~) OMBR_HIDDEN(ombr2_entry_~) OMBR_SYM(ombr2_entry_~) \":\\nhint #34\\nb \" OMBR_SYM(ombr2_code_~) \"+~\\n\" OMBR_PREVIOUS);\nextern const unsigned char ombr2_entry_~[] __attribute__((visibility(\"hidden\")));\n~/* ~ */\n__attribute__((visibility(\"default\"))) uint32_t omega2_~(uint64_t *result~)\n{\n    ombr_span sp[7];\n    unsigned ns = 0;\n    uint64_t a[6] = {0};\n    ombr2_out ou[6] = {{0, 0, 0}};\n    unsigned no = 0;\n    if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1))\n        return OMEGA_BAD_ARG;\n~, uint64_t o_~, ~const ~ *o_~, uint64_t o_~_len~    if (ombr_span_add(sp, &ns, o_~, o_~_len, ~u, ~))\n        return OMEGA_BAD_ARG;\n~    a[~] = (uint64_t)(uintptr_t)o_~;\n~] = o_~    if (ombr2_view(sp, &ns, o_~    if (ombr2_fixed(sp, &ns, o_~_len;\n~2))\n        return OMEGA_BAD_ARG;\n    ou[no].slot = ~u;\n    ou[no].n = ~u;\n    ou[no].dst = o_~;\n    no++;\n~1u, ~    if (ombr2_overlap(sp, ns))\n        return OMEGA_BAD_ARG;\n    return ombr2_run(ombr2_entry_~, a, result, ~, ou, no);\n}\n~#define OMEGA2_IDENT_~ \"~\"\nconst char *omega2_ident_~(void);\n~ */\nuint32_t omega2_~);\n~# ~\nomega2_~ = lib.omega2_~.argtypes = [_res~]\nomega2_~.restype = ctypes.c_uint32\n~, _u64~, ctypes.c_char_p~, ctypes.POINTER(ctypes.~)~omega2_ident_~.argtypes = []\nomega2_ident_~.restype = ctypes.c_char_p\nOMEGA2_IDENT_~ = b\"~\"\nif omega2_ident_~() != OMEGA2_IDENT_~:\n    raise ImportError(\"libomega_native.so is not the library this binding was generated with: the identity of unit ~ differs\")\n~\n~    // ~\n    pub fn omega2_~(result: *mut u64~) -> u32;\n~, o_~: u64~: *const ~: *mut ~_len: u64~    pub fn omega2_ident_~() -> *const u8;\n}\n#[allow(dead_code, non_upper_case_globals)]\npub const OMEGA2_IDENT_~: &str = \"~\";\n#[allow(dead_code)]\n#[link(name = \"omega_native\")]\nunsafe extern \"C\" {\n~// ~\npub extern fn omega2_~(result: ?*u64~) u32;\n~: ?[*]const ~: ?[*]~pub const OMEGA2_IDENT_~ = \"~\";\npub extern fn omega2_ident_~() [*:0]const u8;\n~\n// ~\nfunc Omega2_~(result *uint64~) uint32 {\n\treturn uint32(C.omega2_~((*C.uint64_t)(unsafe.Pointer(result))~))\n}\n~ uint64~ unsafe.Pointer~_len uint64~, C.uint64_t(o_~)~, (*C.~)(o_~_len)~\nconst Omega2Ident_~ = \"~\"\n\nfunc Omega2_ident_~() string {\n\treturn C.GoString(C.omega2_ident_~())\n}\n~/* Generated by omega-bridge src/native.om: the C API of the ABI v2 units in libomega_native\n * (docs/NATIVE-ABI.md, ABI v2). Each function calls omega2_<name> and calls abort() on a nonzero status.\n * Regenerate it; do not edit it. */\n#ifndef OMEGA_API_H\n#define OMEGA_API_H\n#include <stddef.h>\n#include <stdint.h>\n#include <stdlib.h>\n#include \"omega_native.h\"\n#ifdef __cplusplus\n#define OMBR_ASSERT static_assert\nextern \"C\" {\n#else\n#define OMBR_ASSERT _Static_assert\n#endif\n~#ifdef __cplusplus\n}\n#endif\n#endif\n~#define ~ ~typedef struct {\n~} ~;\nOMBR_ASSERT(sizeof(~) == ~, \"layout ~ size\");\n~OMBR_ASSERT(offsetof(~, ~ field ~\");\n~    ~[~];\n~    uint8_t ombr_pad~ */\nstatic inline ~void~uint64_t~int64_t~(~)\n{\n    uint64_t r = 0;\n    if (omega2_~(&r~) != OMEGA_OK)\n        abort();\n~    (void)r;\n}\n~    return r;\n}\n~    return (int64_t)r;\n}\n~, ~ o_~ *o_~, size_t o_~, (uint8_t *)o_~, (const uint8_t *)o_~, (uint64_t)o_~]~ = lib."
 text tn "uint8_t~uint16_t~uint32_t~uint64_t~int8_t~int16_t~int32_t~int64_t~c_uint8~c_uint16~c_uint32~c_uint64~c_int8~c_int16~c_int32~c_int64~u8~u16~u32~u64~i8~i16~i32~i64~uint8_t~uint16_t~uint32_t~uint64_t~int8_t~int16_t~int32_t~int64_t"
 note shx: SHA-256 (FIPS 180-4) K[0..63] then H0[0..7], 8 hex digits each.
 text shx "428a2f9871374491b5c0fbcfe9b5dba53956c25b59f111f1923f82a4ab1c5ed5d807aa9812835b01243185be550c7dc372be5d7480deb1fe9bdc06a7c19bf174e49b69c1efbe47860fc19dc6240ca1cc2de92c6f4a7484aa5cb0a9dc76f988da983e5152a831c66db00327c8bf597fc7c6e00bf3d5a7914706ca63511429296727b70a852e1b21384d2c6dfc53380d13650a7354766a0abb81c2c92e92722c85a2bfe8a1a81a664bc24b8b70c76c51a3d192e819d6990624f40e3585106aa07019a4c1161e376c082748774c34b0bcb5391c0cb34ed8aa4a5b9cca4f682e6ff3748f82ee78a5636f84c878148cc7020890befffaa4506cebbef9a3f7c67178f26a09e667bb67ae853c6ef372a54ff53a510e527f9b05688c1f83d9ab5be0cd19"
@@ -2034,6 +2061,13 @@ end
 end
 note ecode2: the unit's code, embedded unchanged, at ombr2_code_<unit>.
 fn ecode2 to void
+if ne get xt 0 1
+if eq hassvc get s2 13 get s2 14 1
+ofr 28
+oun
+ofr 29
+end
+end
 ofv 1
 oun
 ofv 2
diff --git a/tests/native/caller.c b/tests/native/caller.c
index c95b000..664a390 100644
--- a/tests/native/caller.c
+++ b/tests/native/caller.c
@@ -21,7 +21,14 @@ static void check(const char *name, int ok)
 /* ombr_probe(fn, result, a, b, c): set x19..x28 and d8..d15 to known values, call fn(result, a, b, c),
  * then return the status in the low 32 bits and the number of changed registers in the high 32 bits. */
 uint64_t ombr_probe(void *fn, uint64_t *result, uint64_t a, uint64_t b, uint64_t c);
-__asm__(".text\n.balign 4\n.globl ombr_probe\n.type ombr_probe,%function\nombr_probe:\nhint #34\n"
+#if defined(__APPLE__) /* Mach-O: C names carry a leading underscore; there is no .type or .size. */
+#define PROBE_BEGIN ".globl _ombr_probe\n_ombr_probe:\n"
+#define PROBE_END ""
+#else
+#define PROBE_BEGIN ".globl ombr_probe\n.type ombr_probe,%function\nombr_probe:\n"
+#define PROBE_END ".size ombr_probe,.-ombr_probe\n"
+#endif
+__asm__(".text\n.balign 4\n" PROBE_BEGIN "hint #34\n"
         "stp x29,x30,[sp,#-160]!\nmov x29,sp\nstp x19,x20,[sp,#16]\nstp x21,x22,[sp,#32]\nstp x23,x24,[sp,#48]\n"
         "stp x25,x26,[sp,#64]\nstp x27,x28,[sp,#80]\nstp d8,d9,[sp,#96]\nstp d10,d11,[sp,#112]\n"
         "stp d12,d13,[sp,#128]\nstp d14,d15,[sp,#144]\nmov x16,x0\nmov x0,x1\nmov x1,x2\nmov x2,x3\nmov x3,x4\n"
@@ -32,7 +39,7 @@ __asm__(".text\n.balign 4\n.globl ombr_probe\n.type ombr_probe,%function\nombr_p
         "fmov x10,d8\ncmp x10,#108\ncinc x9,x9,ne\nfmov x10,d9\ncmp x10,#109\ncinc x9,x9,ne\nfmov x10,d10\ncmp x10,#110\ncinc x9,x9,ne\nfmov x10,d11\ncmp x10,#111\ncinc x9,x9,ne\nfmov x10,d12\ncmp x10,#112\ncinc x9,x9,ne\nfmov x10,d13\ncmp x10,#113\ncinc x9,x9,ne\nfmov x10,d14\ncmp x10,#114\ncinc x9,x9,ne\nfmov x10,d15\ncmp x10,#115\ncinc x9,x9,ne\n"
         "orr x0,x0,x9,lsl #32\nldp d14,d15,[sp,#144]\nldp d12,d13,[sp,#128]\nldp d10,d11,[sp,#112]\nldp d8,d9,[sp,#96]\n"
         "ldp x27,x28,[sp,#80]\nldp x25,x26,[sp,#64]\nldp x23,x24,[sp,#48]\nldp x21,x22,[sp,#32]\nldp x19,x20,[sp,#16]\n"
-        "ldp x29,x30,[sp],#160\nret\n.size ombr_probe,.-ombr_probe\n");
+        "ldp x29,x30,[sp],#160\nret\n" PROBE_END);
 
 static void *big_thread(void *p)
 {
diff --git a/tests/native/macos/hostw.om b/tests/native/macos/hostw.om
new file mode 100644
index 0000000..5f09f6a
--- /dev/null
+++ b/tests/native/macos/hostw.om
@@ -0,0 +1,7 @@
+note A function-mode unit with a host word: its write is a Linux system call (svc) made by the code itself.
+note The generated C must refuse to build on macOS, which numbers system calls differently.
+fn hostw x ulong to ulong
+b = new uchar 4 65
+n = write 1 b 0 1
+ret add x ulong n
+end
diff --git a/tests/native/macos/run.sh b/tests/native/macos/run.sh
new file mode 100755
index 0000000..d20bf7d
--- /dev/null
+++ b/tests/native/macos/run.sh
@@ -0,0 +1,113 @@
+#!/bin/sh
+# Native call ABI v1 on macOS arm64 (docs/NATIVE-ABI.md, "Platforms"). Two steps, because the seeded
+# compiler is a Linux AArch64 executable and cannot run on macOS:
+#   1. On Linux AArch64:  OMEGA_NATIVE_OMC=<seeded omc> sh tests/native/macos/run.sh bundle DIR
+#      runs tools/native on the v1 suite's units and writes everything the Mac needs into DIR: the
+#      units' code (.bin), omega_native.c/.h/.py, the add -> sub mutant, the host-word control,
+#      the callers and this script.
+#   2. On macOS arm64:    sh DIR/run.sh run DIR
+#      builds the generated C with clang into libomega_native.dylib and runs the C and Python callers.
+# Step 2 needs only clang, the clang tools (nm, otool, llvm objdump) and python3's standard library.
+# The last line is NATIVE-CALL-MACOS PASS, FAIL or NOT_RUN; only PASS exits 0.
+set -eu
+U="madd smadd fill spin mix big hsum"
+PIN=734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61
+mode=${1-}; D=${2-}
+[ -n "$D" ] || { echo 'usage: run.sh bundle|run DIR' >&2; exit 64; }
+fails=0
+pass() { echo "PASS $1"; }
+fail() { echo "FAIL $1"; fails=$((fails + 1)); }
+case $mode in
+bundle)
+    ROOT=$(cd "$(dirname "$0")/../../.." && pwd)
+    T=$ROOT/tests/native
+    OMC=${OMEGA_NATIVE_OMC:?set OMEGA_NATIVE_OMC to the seeded omc (sha256 $PIN)}
+    rm -rf "$D"; mkdir -p "$D/mut" "$D/hostw"
+    # tools/native checks the compiler pin, compiles the units and generates the bindings (it also builds
+    # the Linux library, which the bundle does not carry).
+    G=$D/gen; OMEGA_NATIVE_OMC=$OMC "$ROOT/tools/native" "$G" $(for u in $U; do echo "$T/$u.om"; done) > /dev/null
+    cp "$G/omega_native.c" "$G/omega_native.h" "$G/omega_native.py" "$D/"
+    for u in $U; do cp "$G/work/$u.bin" "$D/"; done
+    # Negative control: madd's add turned into sub (the same mutant as run.sh), framed for the same generator.
+    frame() { cat "$T/$1.om"; printf '\0'; printf '%08d' "$(wc -c < "$2/$1.bin")"; cat "$2/$1.bin"; }
+    for u in $U; do [ $u = madd ] || cp "$D/$u.bin" "$D/mut/"; done
+    printf '\003\174\001\233\140\000\002\313\300\003\137\326' > "$D/mut/madd.bin"
+    for u in $U; do frame $u "$D/mut"; done | "$G/work/native-gen" c > "$D/mut/omega_native.c"
+    # Host-word control: a unit whose code makes a Linux system call; its binding must not build on macOS.
+    OMEGA_NATIVE_OMC=$OMC "$ROOT/tools/native" "$G/hostw" "$T/macos/hostw.om" > /dev/null
+    cp "$G/hostw/omega_native.c" "$G/hostw/omega_native.h" "$D/hostw/"
+    cp "$T/caller.c" "$T/caller.py" "$T/macos/run.sh" "$D/"
+    rm -rf "$G"
+    (cd "$D" && sha256sum *.bin omega_native.c omega_native.h omega_native.py mut/omega_native.c hostw/omega_native.c hostw/omega_native.h) > "$D/SHA256SUMS"
+    echo "BUNDLE $D (omc $PIN, generated on $(uname -sm))"
+    exit 0 ;;
+run) ;;
+*) echo 'usage: run.sh bundle|run DIR' >&2; exit 64 ;;
+esac
+D=$(cd "$D" && pwd)
+if [ "$(uname -s)" != Darwin ] || [ "$(uname -m)" != arm64 ]; then
+    echo "NATIVE-CALL-MACOS NOT_RUN (host is $(uname -sm), not Darwin arm64)"; exit 1
+fi
+for t in clang nm otool objdump python3; do
+    command -v $t > /dev/null || { echo "NATIVE-CALL-MACOS NOT_RUN ($t not installed)"; exit 1; }
+done
+echo "host $(uname -sm) $(sw_vers -productVersion 2> /dev/null || true); $(clang --version | head -n 1)"
+export LC_ALL=C
+(cd "$D" && shasum -a 256 -c SHA256SUMS > /dev/null) || { echo 'NATIVE-CALL-MACOS FAIL (bundle does not match SHA256SUMS)'; exit 1; }
+B=$D/macos; rm -rf "$B"; mkdir -p "$B/mut"
+lib() { clang -std=gnu11 -O2 -Wall -Wextra -Werror -fPIC -shared -install_name @rpath/libomega_native.dylib \
+    -include "$D/omega_native.h" -o "$2/libomega_native.dylib" "$1"; }
+caller() { clang -std=gnu11 -O2 -Wall -Wextra -Werror -pthread -I "$D" "$D/caller.c" -L"$1" -lomega_native \
+    -Wl,-rpath,"$1" -o "$1/caller_c"; }
+lib "$D/omega_native.c" "$B"
+pass "clang built libomega_native.dylib ($(otool -hv "$B/libomega_native.dylib" | awk 'END{print $2, $5}'))"
+# The embedded code must be the compiler's bytes, unchanged. embeq LIB UNIT BIN compares UNIT's bytes in
+# LIB with BIN, mapping the symbol address to a file offset through the __TEXT,__text section.
+embeq() {
+    sect=$(otool -l "$1" | awk '/sectname __text$/{t=1} t&&$1=="addr"{a=$2} t&&$1=="offset"{print a, $2; exit}')
+    s=$(nm "$1" | awk -v n="_ombr_code_$2" '$3==n{print $1}')
+    [ -n "$s" ] && [ -n "$sect" ] || return 1
+    off=$((0x$s - ${sect% *} + ${sect#* }))
+    dd if="$1" bs=1 skip="$off" count="$(wc -c < "$3")" 2> /dev/null > "$B/emb.bin"
+    cmp -s "$3" "$B/emb.bin"
+}
+ok=1
+for u in $U; do embeq "$B/libomega_native.dylib" $u "$D/$u.bin" || { ok=0; echo "  $u differs"; }; done
+if [ $ok = 1 ]; then pass "embedded code == omc output, per unit ($(cat $(for u in $U; do echo "$D/$u.bin"; done) | shasum -a 256 | cut -c1-16))"
+else fail "embedded code differs from omc output"; fi
+# macOS reserves x18 (the platform register); the embedded code must neither read nor write it.
+# x18dis FILE START LEN prints the instructions of [START, START+LEN) that name x18 or w18.
+x18dis() { objdump -d --no-show-raw-insn --start-address="$2" --stop-address=$(($2 + $3)) "$1" | grep -E '^ *[0-9a-f]+:' > "$B/dis.txt" || true
+    grep -wE '[xw]18' "$B/dis.txt" || true; }
+ok=1; n=0
+for u in $U; do
+    s=$(nm "$B/libomega_native.dylib" | awk -v n="_ombr_code_$u" '$3==n{print $1}')
+    hit=$(x18dis "$B/libomega_native.dylib" $((0x$s)) "$(wc -c < "$D/$u.bin")")
+    n=$((n + $(wc -l < "$B/dis.txt")))
+    [ -z "$hit" ] || { ok=0; echo "  $u: $hit"; }
+done
+# Control for the check itself: an instruction that writes x18 must be found.
+printf '.text\n.globl _x\n_x:\nmov x18, x0\nret\n' > "$B/x18.s"
+clang -c -o "$B/x18.o" "$B/x18.s"
+ctl=$(x18dis "$B/x18.o" 0 8)
+if [ $ok = 1 ] && [ -n "$ctl" ]; then pass "no x18/w18 in the embedded code ($n instructions; control found: $(echo $ctl | sed 's/^[0-9a-f]*: *//'))"
+else fail "x18 check (units clean: $ok; control found: ${ctl:-nothing})"; fi
+caller "$B"
+if "$B/caller_c" > "$B/c.log" 2>&1; then pass "c caller ($(grep -c '^PASS' "$B/c.log") lines)"; else fail "c caller"; cat "$B/c.log"; fi
+cp "$D/caller.py" "$D/omega_native.py" "$B/"
+if python3 -I "$B/caller.py" > "$B/python.log" 2>&1; then pass "python caller ($(grep -c '^PASS' "$B/python.log") lines)"
+else fail "python caller"; cat "$B/python.log"; fi
+# Negative control: madd's add turned into sub must be caught.
+lib "$D/mut/omega_native.c" "$B/mut"; caller "$B/mut"
+if embeq "$B/mut/libomega_native.dylib" madd "$D/madd.bin"; then fail "byte check missed the mutant madd"
+elif embeq "$B/mut/libomega_native.dylib" madd "$D/mut/madd.bin"; then pass "byte check: mutant library holds the mutant madd, not omc's"
+else fail "mutant madd not embedded as generated"; fi
+if "$B/mut/caller_c" > "$B/mut/c.log" 2>&1; then fail "mutant madd (add -> sub) not caught"
+else pass "mutant madd (add -> sub) caught ($(grep -c '^FAIL' "$B/mut/c.log") failing checks)"; fi
+# Host-word control: Linux system calls in a unit's code must stop the macOS build with the generator's reason.
+if clang -std=gnu11 -fPIC -shared -include "$D/hostw/omega_native.h" -o "$B/hostw.dylib" "$D/hostw/omega_native.c" 2> "$B/hostw.log"; then
+    fail "host-word unit built on macOS"
+elif grep -q 'unit hostw makes Linux system calls' "$B/hostw.log"; then pass "host-word unit refused on macOS (#error)"
+else fail "host-word unit failed for another reason"; cat "$B/hostw.log"; fi
+if [ "$fails" -ne 0 ]; then echo "NATIVE-CALL-MACOS FAIL $fails"; exit 1; fi
+echo "NATIVE-CALL-MACOS PASS"
diff --git a/tests/native/test_capacity.py b/tests/native/test_capacity.py
index 2e1fb7e..79e2645 100755
--- a/tests/native/test_capacity.py
+++ b/tests/native/test_capacity.py
@@ -48,7 +48,7 @@ def main():
         caller = tmp / "caller.c"
         # cap63's code is emitted past the first 16777216-byte output pool, i.e. from `outc`;
         # calling it executes bytes stored in the second pool.
-        assert result.stdout.find(b"ombr_code_cap63:") >= 16777216, "cap63 not in second output pool"
+        assert result.stdout.find(b'OMBR_SYM(ombr_code_cap63) ":') >= 16777216, "cap63 not in second output pool"
         caller.write_text("#include <stdint.h>\nuint32_t omega_cap00(uint64_t *, uint64_t);\nuint32_t omega_cap15(uint64_t *, uint64_t);\nuint32_t omega_cap63(uint64_t *, uint64_t);\nint main(void) { uint64_t r=0; if(omega_cap00(&r,0)!=0 || r!=7) return 1; r=0; if(omega_cap15(&r,0)!=0 || r!=7) return 1; r=0; return omega_cap63(&r,0)!=0 || r!=7; }\n")
         checked([os.environ.get("CC", "cc"), "-std=gnu11", "-O2", "-Wall", "-Wextra", "-Werror", "-pthread", str(cfile), str(caller), "-o", str(tmp / "caller")])
         checked([str(tmp / "caller")])
diff --git a/tests/native/test_private_symbols.py b/tests/native/test_private_symbols.py
index 8a98392..b0ee85d 100755
--- a/tests/native/test_private_symbols.py
+++ b/tests/native/test_private_symbols.py
@@ -61,9 +61,10 @@ def main():
                            "ombr_entry_" + name, "ombr_active", "ombr_stk", "ombr_rt_table"):
                 assert helper in private and private[helper].islower(), (helper, private)
         print(run([str(tmp / "normal/caller")], text=True).stdout, end="")
-        # Restore just the original defect, not arbitrary code or public wrappers.
-        mutant = source.replace(b".local ombr_enter", b".globl ombr_enter")
-        assert mutant != source, "missing local helper directive"
+        # Restore just the original defect, not arbitrary code or public wrappers: ombr_enter's ELF
+        # spelling OMBR_LOCAL(ombr_enter) becomes a literal .globl directive.
+        mutant = source.replace(b"OMBR_LOCAL(ombr_enter)", b'\\".globl ombr_enter\\\\n\\"')
+        assert source.count(b"OMBR_LOCAL(ombr_enter)") == 1 and mutant != source, "missing local helper directive"
         linked, _ = build(generator(mutant, tmp / "mutant"), tmp / "global")
         assert linked.returncode != 0 and b"multiple definition" in linked.stderr and b"ombr_enter" in linked.stderr, linked.stderr
         print("PRIVATE-SYMBOLS PASS: nm public ABI unchanged, private locals; .globl mutant rejected")
diff --git a/tests/native/v2/run.sh b/tests/native/v2/run.sh
index b96a8dd..b229954 100755
--- a/tests/native/v2/run.sh
+++ b/tests/native/v2/run.sh
@@ -31,9 +31,33 @@ W=$O/work; GEN=$W/native-gen
 # and declarations remain byte-compared. The REV is reachable on main: f637021 is #26 (f32 and
 # ushort kinds), the last intended change of the existing outputs. #26 changed the python output of
 # every unit and admitted fsum and halve, so the earlier baselines (5458684, 3d79d77) no longer apply.
+# The object-format spelling (#27: OMBR_* macros in fr/fv, and the Python loader's library name) is
+# normalized by piece: a "~"-separated piece of a historical fr or fv text that equals the same piece
+# of 7af4d11's (the last generator before #27) takes that piece of blob 5115113 (src/native.om as #27
+# left it). Both sides of that substitution are pinned objects, never this tree's src/native.om, so a
+# change to any fr/fv piece here still fails the byte comparison. The closing quote of a text is not
+# part of its last piece: #27's fr has two more pieces (the macOS host-word #error), which no
+# historical generator emits.
 basegen() {
   PRE=$(grep '^text pre ' "$ROOT/src/native.om"); export PRE
-  git -C "$ROOT" show "$1:src/native.om" | awk '/^text pre /{print ENVIRON["PRE"]; next} /^text fr |^text fv /{gsub(/[.]globl ombr_code_/, ".local ombr_code_"); gsub(/[.]globl ombr_entry_/, ".local ombr_entry_"); gsub(/[.]globl ombr2_code_/, ".local ombr2_code_"); gsub(/[.]globl ombr2_entry_/, ".local ombr2_entry_")} {print}' > "$O/native-$2.om"
+  NFR=$(git -C "$ROOT" cat-file blob 51151131855ee8c805bbc7a00dd60ceaf9f63a4d | grep -E '^text (fr|fv) '); export NFR
+  OFR=$(git -C "$ROOT" show 7af4d11:src/native.om | grep -E '^text (fr|fv) '); export OFR
+  OLOAD='import ctypes, os\n'; NLOAD='import ctypes, os, sys\n'; export OLOAD NLOAD
+  OLIB='os.path.abspath(__file__)), \"libomega_native.so\"))'; export OLIB
+  NLIB='os.path.abspath(__file__)),\n    \"libomega_native.dylib\" if sys.platform == \"darwin\" else \"libomega_native.so\"))'; export NLIB
+  git -C "$ROOT" show "$1:src/native.om" | awk '
+    function lrep(s, a, b,   i) { i = index(s, a); return i ? substr(s, 1, i - 1) b substr(s, i + length(a)) : s }
+    BEGIN { split(ENVIRON["NFR"], nl, "\n"); split(ENVIRON["OFR"], ol, "\n")
+            for (i in nl) { split(nl[i], w, " "); sub(/"$/, "", nl[i]); nt[w[2]] = nl[i] }
+            for (i in ol) { split(ol[i], w, " "); sub(/"$/, "", ol[i]); ot[w[2]] = ol[i] } }
+    /^text pre /{print ENVIRON["PRE"]; next}
+    /^text tb /{$0 = lrep(lrep($0, ENVIRON["OLOAD"], ENVIRON["NLOAD"]), ENVIRON["OLIB"], ENVIRON["NLIB"])}
+    /^text fr |^text fv /{gsub(/[.]globl ombr_code_/, ".local ombr_code_"); gsub(/[.]globl ombr_entry_/, ".local ombr_entry_"); gsub(/[.]globl ombr2_code_/, ".local ombr2_code_"); gsub(/[.]globl ombr2_entry_/, ".local ombr2_entry_")
+      t = $2; sub(/"$/, "")
+      n = split($0, h, "~"); split(ot[t], o, "~"); m = split(nt[t], c, "~"); s = ""
+      for (k = 1; k <= n; k++) { if (k <= m && h[k] == o[k]) h[k] = c[k]; s = s (k > 1 ? "~" : "") h[k] }
+      $0 = s "\""}
+    {print}' > "$O/native-$2.om"
   "$OMC" < "$O/native-$2.om" > "$O/gen-$2"; chmod +x "$O/gen-$2"
 }
 
diff --git a/tests/native/x86/.crumb b/tests/native/x86/.crumb
index 5f2e724..c638b39 100644
--- a/tests/native/x86/.crumb
+++ b/tests/native/x86/.crumb
@@ -3,14 +3,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-11-05T12:54:22Z",
+      "compiled_at": "2026-11-05T14:20:24Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:ff4d64b7c4ac5b68db86b51efaa0ccf31e95ef45da15faafd811805528253da7",
+      "digest": "sha256:2cd8f8f7f532e3b001e135e14b00845e66062248ccc85b3752895ca94c36701a",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 12,
-      "generated_at_commit": "79b2cce3663ac4e253e98b80488546a0b9a66017",
-      "source_tree": "sha256:5dbd3c1f0bd2e52abfad3629f822abffff5e19c1b2ca1fccbaf19889fe947930"
+      "generated_at_commit": "75ab06342564c69d744c03aa939e3c21828ab3a6",
+      "source_tree": "sha256:0809d99262b73e1ff6f3c943f3a873fdc5f4ef52aa15033bd4fcf2b3c2fe15b8"
     }
   },
   "layer": "tests",
diff --git a/tests/native/x86/suite.py b/tests/native/x86/suite.py
index ee07426..3e79423 100755
--- a/tests/native/x86/suite.py
+++ b/tests/native/x86/suite.py
@@ -40,12 +40,47 @@ REQUIRED = {"c", "cpp", "python", "rust", "zig", "go"}
 # The AArch64 parity baseline is the generator of the last intentional AArch64 output change:
 # f637021 (#26, f32 and ushort array kinds). Moving it requires a reviewed AArch64 output change.
 BASELINE = "f637021"
+# #27 respelled the object-format directives (OMBR_* macros in the texts pre, fp, fr, fv and xjmp)
+# and the Python loader's library name (tb); the AArch64 bytes they assemble to are unchanged. Before
+# the comparison, a "~"-separated piece of those baseline texts that equals the same piece of
+# PREOBJ's takes that piece of OBJFMT (blob of src/native.om as #27 left it), and tb's two loader
+# literals take #27's spelling. Both sides are pinned objects, never this tree's src/native.om, so any
+# other change to those texts still fails parity (tests/native/v2/run.sh basegen does the same for
+# fr, fv and tb). PREOBJ's texts equal BASELINE's for all six names.
+PREOBJ = "7af4d11"
+OBJFMT = "51151131855ee8c805bbc7a00dd60ceaf9f63a4d"
+SPELLED = (b"pre", b"fp", b"fr", b"fv", b"xjmp")
+LOADER = ((rb"import ctypes, os\n", rb"import ctypes, os, sys\n"),
+          (rb'os.path.abspath(__file__)), \"libomega_native.so\"))',
+           rb'os.path.abspath(__file__)),\n    \"libomega_native.dylib\" if sys.platform == \"darwin\" else \"libomega_native.so\"))'))
 
 
 def digest(data):
     return hashlib.sha256(data).hexdigest()
 
 
+def texts(source):
+    return {line.split(b" ", 2)[1]: line for line in source.split(b"\n") if line.startswith(b"text ")}
+
+
+def respell(source, old, new):
+    old, new = texts(old), texts(new)
+    lines = []
+    for line in source.split(b"\n"):
+        name = line.split(b" ", 2)[1] if line.startswith(b"text ") else b""
+        if name in SPELLED and name in old and name in new:
+            # The closing quote belongs to the text, not to its last piece: piece counts differ (fr).
+            h, o, c = (t.removesuffix(b'"').split(b"~") for t in (line, old[name], new[name]))
+            line = b"~".join(c[k] if k < len(o) and k < len(c) and h[k] == o[k] else h[k]
+                             for k in range(len(h))) + b'"'
+        elif name == b"tb":
+            for spelled, respelled in LOADER:
+                line = line.replace(spelled, respelled, 1)
+        lines.append(line)
+    return b"\n".join(lines)
+
+
+
 def command(key, default):
     return shlex.split(os.environ.get(key, default))
 
@@ -548,13 +583,17 @@ class Suite:
 
     def aarch64_parity(self):
         baseline = self.out / "baseline-native-gen"
-        source = self.must(["git", "-C", str(ROOT), "show", BASELINE + ":src/native.om"])
+        source = respell(self.must(["git", "-C", str(ROOT), "show", BASELINE + ":src/native.om"]),
+                         self.must(["git", "-C", str(ROOT), "show", PREOBJ + ":src/native.om"]),
+                         self.must(["git", "-C", str(ROOT), "cat-file", "blob", OBJFMT]))
         baseline.write_bytes(self.must([self.omc], data=source))
         baseline.chmod(0o755)
         frames = {}
         om2_frames = {"v2-set"}
         for path in sorted(N.rglob("*.om")):
-            if Path(__file__).parent in path.parents:
+            # tests/native/macos holds #27's host-word unit, whose C output gains the intended
+            # macOS #error; no baseline generator emits it, and tests/native/macos/run.sh covers it.
+            if Path(__file__).parent in path.parents or N / "macos" in path.parents:
                 continue
             text = path.read_bytes()
             # A note line is one whose first word is note (a bare `note` too), as src/native.om reads it.