Better optimization between fast and small

Norman Urs Baier spiessli at gmx.net
Thu Oct 19 03:37:24 PDT 2006


Am Donnerstag, 19. Oktober 2006 08:20 schrieb Vince Greg:
> Without compilation my package 80mo
> With  -Os -s -fno-strict-aliasing my package 14mo
> With  -O3 -Os -s -fno-strict-aliasing my package 15,2mo
> I search to have fast programms and small programms


You cannot "combine" compiler optimisation flags. It is alway the last 
optimisation flag that counts. So in theory the final binaries should be 
equal when using either of
-Os -s -fno-strict-aliasing
or:
-O3 -Os -s -fno-strict-aliasing
In fact the optimisation flags are only aliases and turn on other more 
detailed flags.

So, what -Os in fact does is, it turns off:
          -falign-functions  -falign-jumps  -falign-loops 
          -falign-labels  -freorder-blocks  -freorder-blocks-and-partition 
          -fprefetch-loop-arrays  -ftree-vect-loop-version
All these pretty, but space consuming optimisation flags, which -O3 turned on 
just before.

There is extensive information on CFLAGS when just googling. For example:
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
http://gentoo-wiki.com/CFLAGS

Greets,

Norman

PS. Please be a bit more clear, when saying "the package x mo". What did you 
do to get these numbers?
 
-- 
http://www.normiboy.ch



More information about the lfs-support mailing list