kit - a compilation multi-tool
Kit Is a Toolchain.
Kit is a compilation multi-tool written in C11, featuring a C11 compiler along with many other tools one may need to compile, link, run, and distribute code.
Its inspirations are TCC, MIR, and LLVM.
It features:
- A C11 preprocessor
- A single-pass C11 parser and code generator
- A JIT compiler, linker, and in-process executor
- An IR interpreter (
run --no-jit) - A user-mode ELF emulator (per-basic-block JIT translation)
- A lightweight optimizer (
-O1) with SSA construction, register allocation, and local cleanup - Cross-compiling backends for aarch64, x86-64, and riscv64, plus WebAssembly and a portable C-source backend
- Support for object files and executables (PE/COFF, ELF, Mach-O)
- Primary tested targets: x86_64-linux, aarch64-linux, x86_64-macos, aarch64-macos, x86_64-windows, aarch64-windows, riscv64-linux, plus freestanding variants of the same architectures.
- An assembler, standalone and inline, with basic linker-script support
- A disassembler and object/image inspection
- Object and binary utilities: ar, ranlib, nm, size, strip, objcopy, objdump, addr2line, strings
- Standalone gzip and LZ4-frame compression (
compress), interoperable with stockgzip/lz4 - Content hashing (
hash: SHA-256, BLAKE2b-256, CRC-32) - Drop-in standard names for the above:
sha256sum,b2sum,crc32,gzip,gunzip,lz4,lz4c - A single multi-call binary, with an
installcommand that drops per-tool symlinks (hard links on Windows) into a directory for drop-in toolchain use - Debug info generation and consumption (DWARF)
- An interactive debugger
- Header dependency generation
- Reproducible builds
- Signed, content-addressed code distribution (
.kpkg) - Bootstrap from hex0-seed
- A C library providing access to all of the above
kit also provides these headers beyond the freestanding set:
- stdatomic.h
- assert.h
- setjmp.h
And kit-specific extensions:
- kit/syscall.h
- kit/baremetal.h
- kit/coro.h
Documentation
Start with doc/DESIGN.md — the entrypoint that covers kit's
design principles, layered architecture, and primary data flows, and indexes a
design doc for every major subsystem (frontends, codegen, IR, optimizer, arch
backends, object formats, linker, JIT, emulator, debug info, debugger, runtime,
driver, packaging, …). Forward-looking roadmaps live in doc/plan/.
Code-interface detail lives in the public headers under include/kit/.