3 ms·
> Theoretically, the compiler can form a complete "statically-linked" executable, and even sidestep libc to use kernel APIs. This isn't theoretical, it's exact
by titzer 5y ago
> Theoretically, the compiler can form a complete "statically-linked" executable, and even sidestep libc to use kernel APIs.
This isn't theoretical, it's exactly how Virgil generates binaries for x86-darwin, x86-linux, and x86-64-linux. The output is just one binary and no C environment. No C libraries for anything. Instead, the Virgil compiler knows the kernel ABI for the target and library code (written in Virgil) implements a thin portable layer directly in terms of syscalls using raw pointers.