Using TinyCC to Build XV6 part 01
In my previous post Learning TinyCC, I tried to use tcc to compile xv6
The c compiler part works fine, and some asm code; the boot related code compiling, linking and objdump&objcopy jobs have to be done by gcc
So, in other to use tcc to build the whole xv6, below changes are required:
- assembler change to address below issues
- mnemonics instructions like
pushal,popal,ljmplnot supported by tcc .commpysedo instruction support or workaround
- mnemonics instructions like
-
compiler builtin functions like
_sync_synchronize() - special handling for boot:
- linker support for
-N -e start -Ttext 0x7C00 - when
entry.S,entryother.Sare compiled by tcc with minor change, qemu won’t boot xv6.img - utility functions for
objdump,objcopy,sign.pl, etc … - make sure
bootblocksize is less than 510 bytes, otherwise it won’t fit bootsector
- linker support for
Last updated: December 3, 2025