Awesome Open Source
Awesome Open Source

A small, fast C compiler suite.

NOTE - This project is not being actively developed. Please direct yourself to which is a successor that is more complete. I direct my own fixes to that project instead now.

Join the chat at

  • Small.
  • Fast.
  • Consistent.
  • High quality.
  • Low complexity.
  • No dependencies.
  • No fussy configuration.
  • Painless cross compiling.
  • Just work.

You should be able to get a C compiler, assembler, linker and libc for any supported target in less than 30 seconds.


Requires an external C compiler and gnu binutils (for now), and I have only tested it on linux 64 bit so far.

The code does use anonymous union extensions, so your compiler will need to support them too.

$ make


$ make test
$ make selfhost # self hosting


Stage 1.

Self hosting x86_64, dumb backend.

Stage 2.

Self hosting arm, something like raspberry pi/android.

Stage 3.

Build small clean C code bases like 8cc, tcc, sbase.

Stage 4.

Build musl libc.


  • Build more programs.
  • Replace gnu as with our own assembler.
  • Replace ld with our own static linker.
  • Build OS kernels.
  • SSA backend.


Pre stage 2. Self hosting with lots of missing common cases. Though technically these bugs can be fixed with the compiler itself :). It uses it's own stubbed out headers and cannot correctly process system headers yet (Help wanted).


Project on hold. See for a new compiler project that is more complete.

Code layout

  • Libraries are in src/*
  • Commands are in src/cmd/*

If you are unsure about the purpose of a library, check the header which should give a short description.

Code style

Follow Plan9 style conventions. Headers are not allowed to include other headers to eliminate circular dependencies and increase build speed. src/u.h is the only exception to this rule.

Bug fixes and issues

Try and attach a single source file which exibits your issue. If possible reduce the test case by hand until it is as small as possible.

Try and follow the general template changed where needed:

What are you trying to do:
What you expected to happen:
What actually hapened:

Try and add a small self contained file which reproduces the issue.

In general each bug fix or change should add a test file which triggers the bug.

Memory management

The compiler does not explicitly free memory. Peak memory usage while self hosting is approximately 2Mb, so it should not be an issue, even for planned targets/hosts like the raspberry pi.

This actually simplifies the code and probably makes it faster because allocations can be pointer bumps.

Useful Links

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
C (193,929
Compiler (15,746
Assembler (2,992
Linker (1,351
Libc (1,032