- C compiler for XV6 (64bit)
- Also work on Linux
- Assembler
- Output ELF64 (x86-64) file format
- Register allocation (Linear scan)
- Self hosting
- Linux
- C compiler (gcc or clang)
- make
$ make
Generated files:
xcc
: Compiler entrycpp
: Preprocessorcc1
: C compileras
: Assemblerld
: Linker
$ ./xcc -o hello examples/hello.c
$ ./hello
-o <filename>
: Set output filename (default:a.out
)-I <path>
: Add include path-D <label>(=value)
: Define macro-S
: Output assembly code-E
: Preprocess only-c
: Output object file-nodefaultlibs
: Ignore libc-nostdlib
: Ignore libc and crt0
- Optimization
- Archiver
C compiler:
- Bit field
WCC: Compile C to WebAssembly.