How do I build a.out programs?
Ld creates ELF programs by default. To make it create an a.out program, you need to use the -m flag to switch to a.out emulation. The a.out emulation is called i386bsdi. You must also add the -static flag to suppress dynamic linking, and you will almost always need the -e flag to provide an explicit entry point.