Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Combine this with one of those tiny self-compiling C compilers that were the subject of a few HN articles recently (e.g. https://news.ycombinator.com/item?id=8576068, https://news.ycombinator.com/item?id=8558822) and this could be one of the more interesting minimal self-hosting OSs someone could understand the entirety of in a relatively short amount of time. I like how it supports multiprocessing too, and the entire kernel is <100 pages in the source code PDF.

However, I wish they'd use something other than GAS for the Asm parts... a minimal self-assembling assembler (and a C-subset compiler written in it, to bootstrap the whole thing) would be nice.



None of the tiny self-compiling C compilers could possibly used to compile xv6, as none of them implement structures (arguably the hardest part of compiling C code).


The guy who did the C4 compiler also has a more fully featured one that does support structures:

https://github.com/rswier/swieros/blob/master/root/bin/c.c

It's part of an OS he's building based on xv6


Very cool, although this implementation is significantly less trivial than C4. The difference is over a thousand lines!


LICE is a public-domain C99 compiler in about 10 KLOC:

http://gmqcc.qc.to/cgit/cgit.cgi/LICE.git/tree/README.md


There's also TCC which at one point was able to compile (a somewhat patched version of) the Linux kernel. Also c99, but I thibk it might be closer to 20kloc these days?


Also F.Bellard mentioned that even if the kernel can boot userspace, he never investigated if they were bugs but was pretty sure they exist.


Perhaps Bruce Evans' C compiler, linker and assembler?

It worked well enough to compile early Linux kernels.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: