kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

commit 4731c9a7ba1ca48dff25c99b8ecd0932e08cc4e3
parent 0969be734c0414dd30b53f179e370bb68a56f408
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Fri, 29 May 2026 14:05:40 -0700

doc: update native-arch completeness — Tier 0-1 done, most Tier 2-4 done

Remaining is the standalone-assembler encode path (GNU-as parity for
hand-written asm) + a few niche items; none affects codegen, disasm, link, or
dwarf correctness for compiler output.

Diffstat:
Mdoc/NATIVE_ARCH_COMPLETENESS.md | 54++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 38 insertions(+), 16 deletions(-)

diff --git a/doc/NATIVE_ARCH_COMPLETENESS.md b/doc/NATIVE_ARCH_COMPLETENESS.md @@ -61,24 +61,46 @@ whole-module link model). ## Tier 3 — minor correctness / robustness -- [ ] rv64 `needs_jit_call_stub` NULL — no far-call stub for >2GiB SK_ABS in JIT. -- [ ] CFI offset rules pinned to function-end PC, not post-prologue (one-shot - `cfi_set_next_pc_offset`; shared producer `src/arch/mc.c`). All archs. -- [ ] aa64 asm: `mov Rd,#bitmask-imm` via ORR alias (matches GNU as). -- [ ] rv64 asm: `call/tail/la/lla` pseudos + multi-word `li`. -- [ ] shared asm: `.comm/.lcomm` mint no symbol; `.uleb128/.sleb128` emit no bytes - (silent miscompile) — `src/asm/asm.c:902`. +- [x] rv64 `needs_jit_call_stub` — DONE (`rv64_is_branch_reloc`; reuses IPLT stub). +- [x] CFI offset rules pinned to function-end PC — DONE (sticky prologue-PC + override in `src/arch/mc.c`; all archs now pin rules to the post-prologue PC). +- [x] shared asm: `.comm/.lcomm`/`.uleb128/.sleb128` — DONE (were silent + miscompiles; LEB128 now matches llvm-mc byte-for-byte). +- [ ] aa64 asm: `mov Rd,#bitmask-imm` via ORR alias (matches GNU as). NICHE — + GNU as itself rejects most `mov #bigimm`; only the logical-bitmask form. +- [ ] rv64 asm: `call/tail/la/lla` pseudos + multi-word `li` (multi-word emit). - [ ] asm: no relocation-operator operand syntax (`@PLT/@GOTPCREL/:lo12:/%hi/%pcrel_hi`) - on any arch (large; overlaps the rv64 + x64 asm items). + on any arch (LARGE; the bulk of remaining T2-asm). - [ ] rv64 link: `R_RV_SET_ULEB128/SUB_ULEB128` mapped on read but unsized/unapplied - (blocks ingesting external rv64 objects with ULEB128 diff relocs). + (only blocks ingesting *external* rv64 objects with ULEB128 diff relocs; cfree + never emits them). ## Tier 4 — test coverage (no behavior change; lock in the above) -- [ ] x64 decode/ISA test (test-isa builds only aa64+rv64). -- [ ] x64 encode corpus never runs under default `make test` (gated on `CFREE_TEST_ARCH`). -- [ ] rv64 asm/codegen/link corpus only via opt-in targets; add no-exec default lanes. -- [ ] x64 ELF linker reloc application not run by default. -- [ ] `test/debug/cfi_unit.c` (.eh_frame roundtrip, aa64+rv64) wired to no target. -- [ ] add x64 case to `cfi_unit.c` (would catch the RBP bug). -- [ ] aa64/x64 FP decode test (would have caught the FP disasm holes). +- [x] x64 decode coverage — DONE (`test-asm-x64` HTL lane in default suite; + runs the SSE-decode corpus case). +- [x] x64 encode corpus in default `make test` — DONE (`test-asm-x64`). +- [x] rv64 asm corpus no-exec default lane — DONE (`test-asm-rv64` HT). +- [x] x64 ELF linker reloc application — DONE (opt-in `test-link-x64`, R+E). +- [x] `test/debug/cfi_unit.c` wired — DONE (`test-debug` builds + runs it). +- [x] x64 case in `cfi_unit.c` + hw→dwarf reg-map asserts — DONE. +- [x] FP decode tests — DONE (aa64 FP decode corpus runs by default; x64 SSE + decode corpus runs in the x64 lane). + +## Remaining (the large, lowest-severity slice — standalone `as` encode) + +The remaining gaps are all in the **text assembler's encode path** (the +`cfree as` tool and inline-`asm()` template handling). The compiler's codegen +emits machine code directly and never routes through the text assembler, and +the shipped runtime `.s`/`.S` files don't use these forms, so none of this +breaks any build — it is GNU-as parity for hand-written assembly: + +- aa64 asm encode: FP-scalar mnemonics, byte/half + pre/post-index ldr/str, + atomics/exclusive, bitfield/clz/rev (the **decode** side of all of these now + works; only the kTable parse rows are missing). +- x64 asm encode: SIB index/scale + `(%rip)` memory operands, ALU reg→mem / + imm→mem stores. +- Relocation-operator operand syntax (`:lo12:`/`%hi`/`@GOTPCREL`/…) on all archs. +- rv64 `call/tail/la/lla` pseudos, multi-word `li`. +- x64 debugger step-out RA recovery (needs a memory-reading unwind variant; also + blocked on the JIT debugger not populating `.eh_frame` for in-process images).