I need to optimize the size of my executable severely (ARM
development) and
I noticed that in my current build scheme (gcc
+ ld
) unuse
From the GCC 4.2.1 manual, section -fwhole-program
:
Assume that the current compilation unit represents whole program being compiled. All public functions and variables with the exception of
main
and those merged by attributeexternally_visible
become static functions and in a affect gets more aggressively optimized by interprocedural optimizers. While this option is equivalent to proper use ofstatic
keyword for programs consisting of single file, in combination with option--combine
this flag can be used to compile most of smaller scale C programs since the functions and variables become local for the whole combined compilation unit, not for the single source file itself.