Repository navigation
infra: dev container + cross-arch toolchains - #12
Merged
Merged
Conversation
…n-out Reproducible environment for building/testing kuna and for building cross-architecture ELF test fixtures (with their linkers). Env-only image (repo mounted at runtime); base ubuntu:22.04 to keep vendored fixtures reproducible. The headline unblock: the host had no ARM linker, which blocked the documented ARM decode e2e — the container now links PT_LOAD ARM ELFs. Provided: - .devcontainer/Dockerfile — ubuntu:22.04; core build (build-essential, cmake, clang, lld); every cross toolchain WITH its binutils/linker (ARM32/Thumb, AArch64, RISC-V64, MIPS/MIPSel/MIPS64el, PPC64le, SPARC64); binutils-multiarch + file; Go/python3/git/etc; non-root `dev` (uid 1000) + passwordless sudo; Rust pinned to 1.90.0 via rustup as `dev`. Baked-in sanity gate (rustc 1.90.0 + arm-linux-gnueabihf-gcc). - .devcontainer/devcontainer.json — name kuna-dev, privileged + --privileged, remoteUser dev, workspaceFolder /workspaces/kuna, postCreate prints versions. - docs/devcontainer.md — build/use, gates, cross-arch fixture how-to, inventory. - docs/analysis-port-frontier.md — the live work-list / progress tracker for the analysis-port fan-out (this is item #1). Verified: image builds; `make binaries` builds the full workspace in-container (exit 0); linked ARM Thumb ELF readelf shows Type EXEC, Machine ARM, a LOAD segment (Thumb-bit entry 0x100d1). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb
mahaloz
added a commit
that referenced
this pull request
Sep 17, 2026
…e SUB41 intrinsic Review round 2 on boolbyte. `CastStrategyC::isSubpieceCast` (cast.cc:411-432) lists the destination metatypes a SUBPIECE may print as a cast and TYPE_BOOL is not among them, because upstream never puts one there. Once `boolbyte` does, a truncation into that byte fell to the functional arm and printed the raw `SUB41(x,0)` p-code intrinsic -- an undeclared identifier, and the class `subright` exists to keep out of the emitted C. `kuna_boolbyte::truncation_prints_as_cast`, consulted from `printc::subpiece_is_cast`, supplies the missing arm. It is part of the option, so `boolbyte off` is byte-for-byte what it was. Whole-binary counts of the intrinsic now go DOWN with the option on, never up: 7 -> 0 over the sixteen sweep binaries (tar -O2 4 -> 1, ls -O2 1 -> 0, du -O0 1 -> 0, find -O0 1 -> 0); three of those are cases a comparison alone had already made bool without this rule. Also in this commit: - tests/stages/kuna-boolbyte.xml gains `truncjoin` and assertions #11/#12: pass 1 (off) is the SUB41 the printer emits without the arm, pass 2 (on) is the cast. - docs/spec/05-types.md replaces the false "the declaration is all that changes; the body is untouched" with the measured surface: constant re-rendering, truncation re-rendering, and the speculative-merge splits that move a declaration count or which variable an expression names. - the three count ladders in kuna_phases/tests.rs get their missing "+1 for `boolbyte`" comment lines. - plan.md's change_kind corrected to type-inference; record.json's corpus block re-measured (100 functions change: 89 declaration-and-literal only, 6 declaration-count, 1 merge-shape, 4 SUBnn -> cast). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz
added a commit
that referenced
this pull request
Sep 17, 2026
…ation assertions Adds boolbyte #11/#12 and the reworded #3, and drops the stray trailing newline so the file is byte-for-byte what `kuna test --save-baseline` writes (main's copy has none either). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz
added a commit
that referenced
this pull request
Sep 18, 2026
A call argument narrower than int that the caller zero-extends kept no truncation in the printed C, so C's integer promotion handed the callee a different value than the binary passes (f: sink(a0 * 3) for a movzx'd 16-bit product). When subvariable flow trims a call argument and every dropped bit is known zero, the trim is recorded on the call, and emission casts that argument to the unsigned type of its width unless promotion already zero-extends it or the value provably fits. clang-forwarded narrow parameters (no zero-extension evidence) stay uncast. C output only; no option, since it restores a conversion the binary performed. Tests: tests/stages/kuna-truncarg.xml (12 assertions; #1-#4 and #8 fail on main, #11/#12 are clang forwarding guards). Round trip over 719 values: main 309 wrong, this change 0 new wrong under gcc and clang. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz
added a commit
that referenced
this pull request
Sep 25, 2026
… buffer; castternary reads a typed global's element; a stored counter keeps its sign - A negation (p * -1, the right-hand side of a pointer difference) is not a number use, and an add partner dereferenced through copies or a small literal offset is the base: put1(char *buf, size_t len, ...) keeps len a number (libedit keymacro__decode_str too). - A later type pass that finds a parameter or call return an earlier pass typed indexing another base blocks it and restarts the function. - castimplied reads the element type of dat_X[i] from the header declaration of an unnamed global typed a pointer, so castternary drops the (int) the conditional performs. - A value stored through a pointer elemptr typed keeps its own sign (an int counter stored into an unsigned table stays int). - Fixture gains w_put and w_ctr (stage test #12-#16, round trip line 3). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01V6bguCkPS65cu9ejj1fbpy
mahaloz
added a commit
that referenced
this pull request
Sep 27, 2026
…tion only for an integer operand The store and other-signedness destinations now require an operand that prints as a C integer (not bool, not a 6-byte undefined or a CONCAT) which C extends the way the widening does. DWARFVARIANTS #12 returns to main's dst->tag = (uint8)(x < 0xb). semhunks.py: a ring op (+ - * & | ^) at 64 bits is checked by the type its chain ends with; a destination of the cast's own type is verified; wide character literals parse. The spec prose states the shared, parenthesized and regrouped rules and the 8-byte destination scope. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01V6bguCkPS65cu9ejj1fbpy
mahaloz
added a commit
that referenced
this pull request
Oct 1, 2026
…-record the stages baseline Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ps66ZCFPLywq9AKHBuDXNU
mahaloz
added a commit
that referenced
this pull request
Oct 1, 2026
…-record the stages baseline Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ps66ZCFPLywq9AKHBuDXNU
mahaloz
added a commit
that referenced
this pull request
Oct 1, 2026
…-record the stages baseline Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ps66ZCFPLywq9AKHBuDXNU
mahaloz
added a commit
to thotypous/kuna
that referenced
this pull request
Oct 14, 2026
… at the global alias level only Below `option indexaliasguard global` nothing keeps a load's own variable when it is live across a store to a global (kuna_loadorder runs only at that level), so the kept COPY printed its single-use LOAD after such a store: d_mv in the globalloadguard fixture went from `gi = *a0; gj = 0;` to `gj = 0; gi = *a0;` at `load` and `off`, while the binary loads *p before the gj store and main() aims p at gj. The refusal now runs only at `global`. Keeping the COPY also moves correct output (storage comments drop the global, a stored value can print as its own variable, independent stores swap), so it is a named option, `globalcallstore`, default on: 0/675 datatest assertions move. `off` is byte-identical to main. The stage test gains an off pass that prints the write before the getter, and globalloadguard Noelo-Lab#12 pins the `load` output. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015sdZpNU5odw5dVyaxeSvvz
mahaloz
added a commit
that referenced
this pull request
Nov 18, 2026
…gains nothing Adds `outer` to the sharedpush fixture: `if (sel) free(p); else pair(guard_nop(), p);`, where p is pushed once for free and for pair's second argument, so guard_nop runs on the slot pair reads afterwards. The only-reader condition keeps guard_nop from taking p; without it guard_nop(p) is printed (stage assertion #12). The spec and module header now also say the rule does not read the undeclared callee's own arity. No code change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
mahaloz
added a commit
that referenced
this pull request
Nov 18, 2026
Two of the push-run readings for the frame a declared call leaves misread GCC/MinGW code, found on held-out builds: - The `mov [esp],x` local test took a push for a mov when the push landed on the stack pointer the declared call left after a raise (GCC's `call [Sleep]; add esp,12; push; push; push; push; call [f]` around a padded call): the run stopped at the third push and f was guessed to pop 12 bytes too few. The simplifier has already removed such a push's stack-pointer write, so the store's instruction bytes say whether it is a push; only a mov ends the run. - The entry-value test counted ECX's entry value written with MinGW's fixed frame `mov [esp],ebx` as an argument push, so a __cdecl callee was guessed to pop it and the function gained a phantom parameter. Only a pushed entry value counts now. The fixture gains land_push and acc_entry; stage asserts #12 and #13 fail without this change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
mahaloz
added a commit
that referenced
this pull request
Nov 22, 2026
Indexed stack-pointer discovery runs once, on the stack space's first
heritage pass, and stopped where a stack-pointer value was written to a
frame slot: the slot's reads are not linked to the write until that pass
renames the space. gcc -O0 keeps `p = &st[0]` in a local and reloads it for
each p[i]; Tigress pushes &locals[k] on its virtual stack for every access.
The LOAD through the reloaded pointer got no guard, a slot written directly
and read only through it had no reader, and ActionDeadCode deleted the
store, then redundbranch the branch around it. Tigress script_0_57 lost
`if (...) { swap halves of state[1]; state[1] |= (state[4] & 15) << 3; }`
before its `state[local1]` loop; native f_spill lost `if (a > 5) st[1] |= 0x78`.
Discovery now continues from the unlinked reads of a slot a path value was
spilled to and guards the LOADs it reaches (LoadGuard::through_spill);
STOREs stay with the rerun after renaming, as upstream. In the pass that
found it, an unbounded spill guard forces writes only below the lowest
pointer-spill slot above its base, so the spilled pointers themselves are
not kept as variables (dupptr #3/#5); later passes force the full window.
Tests: tests/stages/kuna-spillptr-loadguard.xml (native, one pass);
kuna-pushan-interp.xml #11/#12 on a new Tigress-style tg_indexed in the
pushan_interp_x86_64 fixture (both fail before, pass after). Stage
baseline re-recorded: 5032 -> 5037 passing keys, the five new assertions.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKQR2hseBprKvbvZRUv
mahaloz
added a commit
to sjkim1127/kuna
that referenced
this pull request
Nov 24, 2026
The alignment-pad exception read a store of the last argument register beneath a higher register anywhere in the entry as proof the function is not variadic. clang -Oz reserves stack by pushing dead registers and then saves the variadic registers: `sub sp, Noelo-Lab#12; push {r3, r4, lr}; stm r0!, {r1, r2, r3}` (or `str r3, [sp, Noelo-Lab#20]`). Its sqlite3_mprintf then handed sqlite3_vmprintf its save area and took r1-r3 as three more parameters. The entry walk now also records the register bytes a multi-register store writes as its highest register, and the pad counts only when the register is stored no other way (not alone, not as the highest of a store). The check is only ever narrower than before, so every call it changes returns to the output it had before the pad exception. Stage gh1922-pushpad-caller-readarg-thumb.xml gains #4, a clang -Oz shaped variadic caller (pad push plus stm save) that must still decline. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First PR of the analysis-port fan-out: a fully reproducible dev container for (a) building & testing kuna and (b) building cross-architecture ELF test fixtures including their linkers, plus Go and a pinned Rust toolchain. Env-only image (the repo is mounted at runtime, not COPYed); base
ubuntu:22.04to keep the vendored cross-arch fixtures reproducible.The unblock (before → after)
The build host has no ARM linker, which blocked the documented ARM decode end-to-end test (see
docs/analysis-port-log.md, Increment 17). The container fixes this.which arm-linux-gnueabihf-gcc→ empty (no ARM gcc/ld; aarch64/riscv linkers also absent).PT_LOAD,Type EXEC,Machine ARMThumb executable.A LINKED ARM Thumb ELF with an executable LOAD segment — the previously-blocked e2e fixture is now buildable in-env.
Toolchain inventory
build-essential make cmake pkg-config gcc g++ clang lld(ld.lld)decompiler/Cargo.toml),rustfmt+clippy, on thedevPATHgcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf→arm-linux-gnueabihf-{gcc,g++,ld}(GCC 11.4.0)gcc-aarch64-linux-gnu g++-aarch64-linux-gnu→aarch64-linux-gnu-{gcc,g++,ld}(11.4.0)gcc-riscv64-linux-gnu→riscv64-linux-gnu-{gcc,ld}(11.4.0)gcc-mips-linux-gnu gcc-mipsel-linux-gnu gcc-mips64el-linux-gnuabi64→mips[/el/64el]-…-{gcc,ld}(10.3.0)gcc-powerpc64le-linux-gnu→powerpc64le-linux-gnu-{gcc,ld}(11.4.0)gcc-sparc64-linux-gnu→sparc64-linux-gnu-{gcc,ld}(11.4.0)binutils-multiarch filegolang-go(Go 1.18)python3 python3-pip git curl wget ca-certificates gnupg unzip xz-utils gdb sudo less vimEvery
gcc-<triple>pullsbinutils-<triple>, so all 8 cross linkers are present (verified/usr/bin/<triple>-ldfor each). Non-ELF toolchains (mingw-w64 / osxcross) are intentionally out of scope; the container is privileged with passwordless sudo so an agent canapt-get installthem later. No package-name substitutions were needed — every requestedgcc-<triple>exists under its exact name on 22.04 (only note: the MIPS cross GCCs ship at 10.3.0 vs 11.4.0 for the others; stock packaging).Container policy
devcontainer.jsonsetsprivileged: true+runArgs: ["--privileged"],remoteUser: dev,workspaceFolder: /workspaces/kuna; thedevuser (uid 1000) has passwordless sudo. Privileged + sudo are intentional per project policy (always able to run privileged / install anything without rebuilding the image), noted inline in both files.Verification run + results
docker build -t kuna-dev -f .devcontainer/Dockerfile .devcontainerrustc 1.90.0,cargo 1.90.0,arm-linux-gnueabihf-gcc 11.4.0.docker run --rm -v "$(pwd)":/workspaces/kuna -w /workspaces/kuna kuna-dev bash -lc 'make binaries'kuna --helpruns. (Ran the fullmake binaries, not justkuna-cli.)Type EXEC,Machine ARM, LOAD segment (R E), Thumb-bit entry0x100d1.make test/make rust-testwere not run here (this is infra+docs only; no engine code changed) — they remain the gates later analysis-port PRs will run inside this container.Docs
docs/devcontainer.md— build/use, the three gates, cross-arch fixture how-to, full inventory, out-of-scope notes.docs/analysis-port-frontier.md— the live work-list / progress tracker for the fan-out (this is item ite-region-converter-missing-5db28e: strip -fstack-protector canary e… #1; Port to Rust #2–Stage reorg #5 are unblocked by these cross linkers).Scope: only
.devcontainer/+docs/; no code touched; no build artifacts committed (decompiler/target/is gitignored).🤖 Generated with Claude Code
https://claude.ai/code/session_01FvRnfTgYKoZvS2TEvdYpWb