Re:How Fat Does a Fat Binary Need to Be?
by lhorie on Thursday February 11, 2021 @03:14PM
(#26106525)
Very exciting stuff! I'll try to take it for a spin tonight :)
Here's something you can paste into your Linux terminal to get started:
git clone https://github.com/jart/cosmopolitan
cd cosmopolitan
make -j8
o/third_party/chibicc/chibicc.com -include libc/integral/normalize.inc -o hello.com.dbg examples/hello.c o/cosmopolitan.a
o/third_party/gcc/bin/x86_64-linux-musl-objcopy -SO binary hello.com.dbg hello.com
./hello.com
Keep in mind this compiler doesn't optimize. So if you're OK taking a 2x performance hit, you're going to find that your code compiles significantly faster than GCC or Clang and you're going to have the convenience of the fact that the whole toolchain will be a single .com file that you can just scp on any server for a fully deterministic reproducible build experience. It's also the most readable and hackable compiler codebase I've ever seen, so if you've ever wanted to pull out the dragon book at try your hand at optimizing, you'll find that chibicc is fertile ground to do it.