Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-bridge/blob/main/docs/NATIVE-X86-PHYSICAL.md # omega-bridge Omega-first language interoperability: checked conversion backends and native language bindings Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-bridge / docs / NATIVE-X86-PHYSICAL.md` 194 lines · 9843 bytes Raw Blame History Source # Native x86-64 execution: runbook and receipt format Every x86 receipt so far (`evidence/native-x86-be8c5130.json`, `evidence/native-x86-pr44-merge/receipt.json`) is `EMULATED_PASS`: the callers ran under `qemu-x86_64` on an AArch64 host and `native_x86` is `NOT_RUN`. This page says how to run the same suite with the callers executing on an x86-64 CPU, and how to record the result. ## What the mode does `OMEGA_NATIVE_X86_EXEC=native` makes `tests/native/x86/suite.py` execute every target executable (the six callers, the saved-register and status oracles, the TLS and out-of-line API checks) directly instead of as `qemu-x86_64 -L SYSROOT [-E LD_LIBRARY_PATH=…] exe`. `OMEGA_NATIVE_X86_LIBPATH`, when set, becomes the executable's `LD_LIBRARY_PATH`. Nothing else changes: the same compilers, pins, sources, oracles and checks run, and AArch64 byte parity against `f637021` is still required. The default (`qemu`, or the variable unset) keeps the emulated run and its output unchanged. Any other value fails preflight before a caller is built. In native mode preflight: - fails unless `uname -m` is `x86_64` (`FAIL native execution host is x86-64 (uname -m aarch64)` on the Spark); - prints `INFO cpu model=`, `INFO cpu hypervisor flag=yes|no`, `INFO kernel=`, `INFO virtualization=` (from `systemd-detect-virt`; `unknown` if that is absent) and, if registered, `INFO binfmt qemu-aarch64 interpreter=`; - requires both pinned compilers to execute on the host. They are AArch64 executables (`file` reports `ELF 64-bit LSB executable, ARM aarch64`), so an x86 host needs binfmt_misc `qemu-aarch64`. QEMU here runs only the compilers. Their outputs are byte-compared against the AArch64 baseline by the suite's parity checks, and every target executable still runs on the host CPU. - does not use or probe `qemu-x86_64`. The QEMU oracle probes run only in `qemu` mode. Check names and the aggregate line say `NATIVE` instead of `EMULATED`. A successful run ends with ``` NATIVE-X86 NATIVE PASS (six languages built and run on the host x86-64 CPU; virtualization=) ``` The suite never prints `PHYSICAL`. A cloud VM or a container on a hypervisor is a native run on a virtual CPU, not a physical qualification; the receipt rule below decides the label. ## Host prerequisites An x86-64 Linux host with: Need Ubuntu 24.04 example Checked by C/C++ for x86-64 `gcc g++ binutils` (`x86_64-linux-gnu-gcc`, `-g++`, `-nm`, `-objdump` are the host tools) suite `CC`, `CXX`, `NM`, `OBJDUMP` Rust with the x86-64 std `rustc` (rustup stable is fine) suite `RUSTC` Zig 0.13 https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz , SHA256 `d45312e61ebcc48032b77bc4cf7fd6915c11fa16e4aad116b66c9468211230ea` (from ziglang.org `download/index.json`) suite `ZIG` Go with cgo any Go release with cgo enabled suite `GO` x86 Python 3 the host `python3` (`OMEGA_NATIVE_X86_PYTHON=$(command -v python3)`) suite `OMEGA_NATIVE_X86_PYTHON` AArch64 binfmt `qemu-user-binfmt` or `qemu-user-static` native preflight Full git clone of omega-bridge `git clone`, not `--depth 1` (the parity check reads `f637021`) parity checks Record the version of each tool (`gcc --version`, `rustc --version`, `zig version`, `go version`, `python3 --version`, the binfmt interpreter's `--version` and sha256) in the receipt. ## Compilers Both are pinned by sha256 in `tools/native` and checked by the suite before use: Variable sha256 Source `OMEGA_NATIVE_OMC` (generator) `734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61` `git -C omega-mv show e17039d9ceeb30e0637ef4145e37afc5821c3773:seed/out/omc` `OMEGA_NATIVE_X86_OMC` (x86 target) `be8c51301307555254fc59e351d281aae1aa096d91521777e33a41c8b446448a` `git -C omega-mv show 474197e4fa0207e0e2fb3c0494594a975f5031fa:seed/out/omc` ``` git -C omega-mv show e17039d9ceeb30e0637ef4145e37afc5821c3773:seed/out/omc > omc-gen git -C omega-mv show 474197e4fa0207e0e2fb3c0494594a975f5031fa:seed/out/omc > omc-x86 chmod +x omc-gen omc-x86 sha256sum omc-gen omc-x86 # must print the two pins above ``` These are `PIN` and `X86_PIN` in `tools/native`. The separate hosted pin `X86_HOST_PIN` (`c5ac9979…`, selected by `tools/native --host`) is not used by `tests/native/x86/run.sh`; a physical receipt names `X86_PIN`. ## Commands From the omega-bridge checkout at the commit under test, with fresh empty output directories: ``` export OMEGA_NATIVE_OMC=$PWD/../omc-gen OMEGA_NATIVE_X86_OMC=$PWD/../omc-x86 export ZIG=/opt/zig-linux-x86_64-0.13.0/zig GO=$(command -v go) export OMEGA_NATIVE_X86_PYTHON=$(command -v python3) export OMEGA_NATIVE_X86_EXEC=native # 1. The suite. sh tests/native/x86/run.sh build/x86-native 2>&1 | tee x86-native.log # 2. Controls: failed Zig/Go builds, missing Zig/Go and an unknown execution # mode must all refuse aggregate PASS; then the positive run must print NATIVE. # (The known-bad QEMU control is NOT_RUN in native mode.) python3 tests/native/x86/test_build_failures.py build/x86-native-controls \ 2>&1 | tee x86-native-controls.log # 3. Wrong-pin control: the generator compiler offered as the x86 compiler. OMEGA_NATIVE_X86_OMC=$OMEGA_NATIVE_OMC \ sh tests/native/x86/run.sh build/x86-native-wrongpin 2>&1 | tee x86-native-wrongpin.log # 4. Mutated-compiler control: tools/native must refuse a changed x86 compiler. cp "$OMEGA_NATIVE_X86_OMC" omc-x86-mut && printf '\0' >> omc-x86-mut OMEGA_NATIVE_X86_OMC=$PWD/omc-x86-mut \ sh tools/native --target x86linux build/x86-native-mut tests/native/x86/follow.om \ 2>&1 | tee x86-native-mut.log ``` Expected: 1 and 2 exit 0, ending with the `NATIVE PASS` line and `NATIVE-X86 CONTROLS PASS (NATIVE; …)`; 3 exits 1 with `NATIVE-X86 FAIL x86 compiler pin`; 4 exits 1 with `tools/native` reporting an x86 omc sha256 that differs from the pin. ## Receipt Write `evidence/native-x86-physical-.json` (for the current pin, `evidence/native-x86-physical-be8c5130.json`). It extends the schema-1 fields of `evidence/native-x86-be8c5130.json`: ``` { "schema": 1, "status": "NATIVE_PASS", "label": "PHYSICAL", "bridge_commit": "", "x86_omc_sha256": "be8c51301307555254fc59e351d281aae1aa096d91521777e33a41c8b446448a", "baseline_omc_sha256": "734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61", "native_x86": "PASS", "host": { "cpu_model": "", "hypervisor_flag": "no", "virtualization": "none", "kernel": "", "os": "", "binfmt_qemu_aarch64": {"interpreter": "", "version": "", "sha256": ""} }, "toolchains": {"gcc": "", "g++": "", "rustc": "", "zig": "", "go": "", "python": ""}, "commands": [ {"command": "OMEGA_NATIVE_X86_EXEC=native sh tests/native/x86/run.sh EMPTY_OUTPUT", "exit": 0, "result": " PASS, 0 FAIL; NATIVE-X86 NATIVE PASS"}, {"command": "OMEGA_NATIVE_X86_EXEC=native python3 tests/native/x86/test_build_failures.py EMPTY_OUTPUT", "exit": 0, "result": "NATIVE-X86 CONTROLS PASS (NATIVE)"}, {"command": "OMEGA_NATIVE_X86_EXEC=native OMEGA_NATIVE_X86_OMC=<734f0a39 omc> sh tests/native/x86/run.sh EMPTY_OUTPUT", "exit": 1, "result": "negative control: FAIL x86 compiler pin"}, {"command": "OMEGA_NATIVE_X86_OMC= sh tools/native --target x86linux OUTDIR tests/native/x86/follow.om", "exit": 1, "result": "negative control: tools/native refused"} ], "logs_sha256": {"x86-native.log": "", "x86-native-controls.log": "", "x86-native-wrongpin.log": "", "x86-native-mut.log": ""} } ``` Fill each field from the run's own output; copy no value from this template. Commit the four logs next to the receipt in `evidence/native-x86-physical-/` so `logs_sha256` can be rechecked. Label rule: - `PHYSICAL` only when the suite printed `virtualization=none` and `cpu hypervisor flag=no`, and the receipt names the machine. - Any other virtualization value, or the hypervisor flag set, is `VIRTUAL`. That run shows native-CPU execution on that virtual CPU; it is not physical qualification. - `status` is `NATIVE_PASS` only if all four commands gave their expected exit and result. Otherwise use `NATIVE_FAIL` and keep the failing logs. A physical receipt qualifies the ABI v2 boundary on that CPU model and kernel only. It says nothing about CPU timing, other microarchitectures, other kernels or other C libraries. ## Checking a receipt ``` omc < tests/native/x86/check_physical_receipt.om > check_physical_receipt chmod +x check_physical_receipt ./check_physical_receipt evidence/native-x86-physical-.json ``` `omc` is the seeded compiler (omega-mv `e5b32567`, sha256 `2c824805…`); run the checker from the repository root. It reads the receipt, the four logs in `evidence/native-x86-physical-/` and the pins in `tools/native`; it runs nothing. It exits 0 with `PHYSICAL-RECEIPT ACCEPTED` only if the receipt is `PHYSICAL`/`NATIVE_PASS` at the current `PIN` and `X86_PIN`, records host, binfmt and toolchain versions, lists the four commands with their expected exits and results, the log hashes match, and the suite log itself ends with `NATIVE-X86 NATIVE PASS … virtualization=none`, shows `INFO virtualization=none` and `INFO cpu hypervisor flag=no`, matches the receipt's CPU model and kernel, and never says `EMULATED`. Any other receipt, including every EMULATED receipt and an EMULATED log relabelled `PHYSICAL`, exits 1 with `PHYSICAL-RECEIPT REJECTED`. Acceptance is a consistency check of the receipt, not evidence by itself.