View Articles

Reducing size of executables produced by gcc

Author: Saulot - Published 07-12-2011 08:00
Article explains how to remove libc/libc++ dependencies in m68k gcc compiler. It reduces binary size dramatically. For example the smallest 'Hello world' linked against libc takes ~55kb, which is alot, for c++ file is even bigger (~380kb). With custom startup code which is provided, executable size drops to ~2k (it can be improved for sure).
Article might be useful for people writing games/demos "near bare metal" (close to the hardware) and with standard system calls (BIOS/XBIOS and so on). It's now possible to use gcc even for producing binaries targetted at lower spec machines like Atari ST (512kb RAM), where every byte is precious.

Credits go to Sqward/MSB for providing first version of C++ startup.