kit Code Size
Line counts per functional component, broken down so per-format and per-target
code is separated from shared core. Counts are code lines only (C +
headers, excluding comments and blanks), via cloc.
Snapshot: 2026-06-03. Regenerate with make code-size (or
scripts/code_size.sh); these numbers drift as the tree changes.
Arch backends — src/arch/ (38,578)
| Component |
Lines |
aarch64 (aa64, reference backend) |
9,344 |
x86-64 (x64) |
8,424 |
riscv64 (rv64) |
8,489 |
WebAssembly (wasm) |
6,256 |
C-source backend (c_target) |
3,962 |
| shared core (ArchImpl, MCEmitter, disasm, dwarf, registry) |
2,103 |
Object model — src/obj/ (13,999)
| Component |
Lines |
| ELF |
4,209 |
| Mach-O |
3,756 |
| COFF/PE |
3,235 |
| Wasm object |
187 |
| core (format-neutral model, registry, reloc apply, TLS) |
2,612 |
Linker — src/link/ (6,588)
Entirely format-neutral — no per-format files; emits through the obj/
format writers above. Covers resolve, layout, relocation, linker scripts,
incremental linking, and the JIT image mapper.
Frontends — lang/
| Frontend |
Lines |
C compiler (lang/c: parse/type/decl/ABI-lower) |
12,342 |
| toy (CG-API exercise frontend) |
9,096 |
cpp (C lexer + preprocessor; shared by C frontend & cpp) |
3,672 |
| wasm/WAT |
3,711 |
The full C compiler ≈ lang/c + lang/cpp, driving the shared
cg/abi/opt infrastructure below.
Other subsystems — src/
| Subsystem |
Lines |
optimizer (opt, -O1 SSA/regalloc) |
16,476 |
codegen (cg, public CG API + IR) |
11,454 |
| api (composition layer) |
6,935 |
debug/DWARF (debug) |
6,026 |
dist (CAS + .kpkg) |
4,773 |
| interp (bytecode interpreter) |
2,547 |
| emu (guest-ELF emulator) |
2,335 |
| asm (standalone + inline assembler) |
1,962 |
| core (arenas/maps/bufs/diag/hash) |
1,416 |
| abi (calling conventions) |
1,185 |
| dbg (debugger) |
1,098 |
| os (emu syscall personality) |
806 |
jit (stub; real mapper lives in link) |
12 |
dist split — src/dist/ (4,773)
| Component |
Lines |
| packaging (manifest/kpkg/tar/trust) |
1,658 |
| vendored compression (deflate/lz4) |
1,976 |
| CAS store (blob/tree/cas) |
749 |
| vendored crypto (blake2b/ed25519/b64/minisig) |
390 |
Driver — driver/ (23,447)
| Area |
Lines |
| cmd (per-subcommand) |
16,485 |
| env (host adapters) |
3,834 |
| lib (shared support) |
2,607 |
*.c (main + dispatch) |
521 |
driver/cmd per-subcommand
| Subcommand |
Lines |
| dbg.c |
3,000 |
| cc.c |
2,652 |
| objdump.c |
1,716 |
| ld.c |
1,169 |
| run.c |
909 |
| objcopy.c |
669 |
| strip.c |
579 |
| pkg.c |
575 |
| ar.c |
546 |
| compile.c |
514 |
| xxd.c |
428 |
| nm.c |
341 |
| size.c |
327 |
| emu.c |
292 |
| cas.c |
289 |
| mc.c |
279 |
| disas.c |
270 |
| cmp.c |
237 |
| as.c |
235 |
| compress.c |
232 |
| strings.c |
226 |
| cpp.c |
204 |
| ranlib.c |
203 |
| install.c |
202 |
| addr2line.c |
199 |
| hash.c |
192 |
Outside src/
| Area |
Lines |
| rt/ (freestanding runtime) |
5,167 |
| vendor/ (monocypher, lz4) |
9,077 |
| include/kit (public headers) |
2,768 |
Binary code size (release kit)
Live __TEXT+__DATA symbol bytes attributed to each component from the
release binary's linker map (-Wl,-map, after -dead_strip). Total
attributed: 2,303,837 bytes across 14,947 symbols' worth of objects. This is
compiled machine code + data, so the shape differs from source lines —
optimizer/codegen-heavy components weigh more here than their line counts suggest.
Arch backends
| Component |
Bytes |
aarch64 (aa64) |
147,694 |
x86-64 (x64) |
113,823 |
riscv64 (rv64) |
126,704 |
WebAssembly (wasm) |
91,382 |
C-source backend (c_target) |
65,010 |
| shared core |
9,848 |
Object formats
| Component |
Bytes |
| ELF |
43,011 |
| Mach-O |
57,123 |
| COFF/PE |
30,166 |
| Wasm object |
1,883 |
| core (format-neutral) |
19,941 |
Linker
| Component |
Bytes |
linker (src/link) |
89,526 |
Frontends
| Component |
Bytes |
C compiler (lang/c) |
153,731 |
| toy |
106,475 |
| cpp (lexer + preprocessor) |
56,485 |
| wasm/WAT |
60,951 |
Other subsystems
| Component |
Bytes |
optimizer (opt) |
171,192 |
codegen (cg) |
150,023 |
| api (composition) |
70,399 |
debug/DWARF (debug) |
54,619 |
| interp (bytecode) |
31,727 |
| emu (guest-ELF) |
22,224 |
| asm (assembler) |
33,509 |
| core (arenas/maps/…) |
7,509 |
| abi (calling conv) |
8,671 |
| dbg (debugger) |
8,160 |
| os (emu syscalls) |
5,487 |
| jit |
224 |
dist split
| Component |
Bytes |
| packaging (manifest/kpkg/tar/trust) |
21,304 |
| vendored compression (deflate/lz4) |
111,648 |
| CAS store (blob/tree/cas) |
9,677 |
| vendored crypto (blake2b/ed25519/b64/minisig) |
4,619 |
Driver
| Component |
Bytes |
| cmd (all subcommands) |
223,117 |
| env (host adapters) |
22,238 |
| lib (shared support) |
30,676 |
main.c (dispatch) |
5,101 |
driver/cmd per-subcommand
| Component |
Bytes |
| dbg |
45,085 |
| cc |
30,987 |
| objdump |
26,053 |
| ld |
15,752 |
| run |
12,122 |
| pkg |
9,181 |
| xxd |
8,255 |
| objcopy |
7,887 |
| ar |
7,814 |
| compile |
6,507 |
| strip |
5,962 |
| size |
3,917 |
| emu |
3,777 |
| nm |
3,741 |
| cas |
3,696 |
| mc |
3,641 |
| disas |
3,515 |
| as |
3,367 |
| install |
3,365 |
| compress |
3,108 |
| cmp |
2,912 |
| strings |
2,828 |
| cpp |
2,508 |
| ranlib |
2,503 |
| addr2line |
2,361 |
| hash |
2,273 |
Vendor & unattributed
| Component |
Bytes |
| vendor/ (monocypher, lz4) |
34,348 |
| (unattributed / linker synthesized) |
103,612 |