← board

πŸ—Ό Lighthouse β€” boot a Linux tinyconfig kernel built with PXX's C frontend

The goal

PXX (as CC=pxx in the standard kernel make toolchain) compiles an x86-64 tinyconfig Linux kernel β€” mitigations off, frame-pointer unwinder, GNU as+ld doing assemble/link β€” and the resulting vmlinux/bzImage boots to init in qemu. The kernel is the hairiest GNU-C corpus in existence; the point is the same as the FPC lighthouse (goal-compile-fpc-compiler.md): conformance proven at industrial scale, this time on the C/GNU side.

Strategic decisions (settled in the 2026-07-18 gap analysis)

These shape everything below; they are why the scope is bounded:

  1. Be a .o producer in the standard toolchain, not a whole-program compiler. The kernel is thousands of separately-compiled TUs linked by GNU ld against vmlinux.lds. We do NOT reimplement that: emit object files (--emit-obj already exists), let the kernel's own Makefile, as, and ld -T do their jobs. Bonus: per-TU bisection β€” mix gcc-built and pxx-built .os to isolate miscompiles.
  2. Emit .s text and let GNU as assemble (at least for this target). Kernel inline-asm strings are full of assembler directives (.pushsection .altinstructions, .popsection, .long, macros). With a text-asm emission path, inline asm reduces to string paste + operand substitution + constraint-driven register choice β€” the directives are as's problem, we never parse AT&T ourselves.
  3. Config the hardening away. objtool/ORC, retpoline, kCFI, SLS, stack protector are all off-able (CONFIG_UNWINDER_FRAME_POINTER=y, CONFIG_MITIGATIONS=n, CONFIG_STACKPROTECTOR=n; kCFI is clang-only). A boot goal owes none of them.

Where the C frontend stands (2026-07-18)

Strong ISO-C + light-GNU base, proven on userspace corpora:

The gap β€” everything the kernel needs that we lack

Ordered roughly easy β†’ hard. Most items are legwork; one is a real subsystem.

Preprocessor (each ~an afternoon)

Builtins (mostly trivial)

Language / semantics (legwork, days each)

Attributes (mechanical once named sections exist)

Object emission / toolchain (Track A; legwork given decision #1)

THE wall β€” GNU inline asm constraint engine (weeks, the one subsystem)

asm/__asm__ is currently in the parser's statement skip list β€” zero support. The kernel is saturated with it. With decision #2 the AT&T/directive part vanishes; what remains is the genuinely hard core:

Kernel codegen gates (bounded, Track A)

Explicitly out of scope (config'd away, per decision #3)

Acceptance ladder

  1. Preprocess: one kernel TU survives pxx -E (preprocessor items).
  2. Compile one TU: an allnoconfig/tinyconfig TU compiles to .o (typeof, builtins, attributes, sections, relocs).
  3. Link: full tinyconfig build where pxx compiles a growing subset of TUs, gcc the rest β€” per-TU mix is the bisection tool, not a compromise.
  4. All TUs: CC=pxx for every C file; as/ld untouched.
  5. Boot: qemu + earlyprintk=serial,ttyS0 reaches init. THE bar.

Risk notes

Relationship to other lighthouses

Sibling of goal-compile-fpc-compiler.md β€” same "conformance at industrial scale" motive, C-side instead of Pascal-side. Several sub-goals here are independently valuable regardless of the kernel: .s emission, more reloc types, named sections, typeof, the preprocessor items, the forced inliner.