In the same vein as my post yesterday, I was very impressed by this description of how small you can make a simple ELF binary.

Starting with the generic output of compiling one of the simplest possible C programs from gcc at 3998 bytes, the article outlines how you can slim it down. The first steps are using the features in gcc to optimize the size. That gets it down to 2616 bytes.

After that, the story moves to asm programming which doesn’t save much over optimized C compilation. Then we turn to the real voodoo and hack together some asm that calls the system library directly without including the stdlib. Very cool.

The final result is a mere 45 bytes after stripping out all of the padding and short-circuiting the ELF standard. At the beginning, I was thinking they might be able to get it down to a tenth of the size but this result is pretty remarkable.

linux