journal 2026-05-05

P82 chip-side C compiler

P82 tried the obvious TinyCC route first. The available TCC source in the local Nix store has riscv64 backend files, not a riscv32 code generator, and the direct pkgsCross.riscv32.tinycc build failed while trying to execute a target-built helper on the x86 host. That made TinyCC the wrong thing to claim for this step.

The project still proves the shape we wanted. We added chipcc, a tiny C subset compiler that runs as a normal static RV32 Linux program inside the guest. It accepts a source file containing a print call, emits a static RV32 Linux ELF, and relies on direct Linux syscalls in the generated code.

The smoke packages this source in the initramfs:

int main(void) {
    puts("P82-COMPILED-ON-CHIP");
    return 0;
}

Inside BusyBox ash, the test runs:

chipcc -o /tmp/p82_hello /usr/share/p82/hello.c
chmod +x /tmp/p82_hello
/tmp/p82_hello

The passing run printed chipcc: wrote 456-byte RV32 Linux ELF to /tmp/p82_hello, then the generated program printed P82-COMPILED-ON-CHIP, then the harness stopped on P82-FILE-OK.

Verification:

make -C projects/82_chip_side_c_compiler/userspace
cd /mnt/MediaVolume/home/jadams/src/linux-rv32-build/linux-6.12.85
./scripts/config --set-str INITRAMFS_SOURCE /mnt/MediaVolume/home/jadams/src/gitlab.daringbit.com/josh/librelane-playground/projects/82_chip_side_c_compiler/userspace/initramfs.cpio
make ARCH=riscv olddefconfig
make ARCH=riscv -j$(nproc) Image
cd /mnt/MediaVolume/home/jadams/src/gitlab.daringbit.com/josh/librelane-playground
make -C projects/82_chip_side_c_compiler/test tty-smoke KERNEL_IMAGE=/mnt/MediaVolume/home/jadams/src/linux-rv32-build/linux-6.12.85/arch/riscv/boot/Image

Honest status: tty-smoke is PASS. TinyCC RV32 codegen with the local package is FAIL. LibreLane hardening is NOT RUN.