optimization flags

Joerg W Mittag Joerg.Mittag at Web.De
Tue Jan 14 11:20:32 PST 2003

Tushar Teredesai wrote:
> Eric Miller wrote:
>> If someone should endeavor to experiment with this, what are the
>> used CFLAGS options (besides arch and cpu) to test?
> -O2

You could also try -Os (optimize for size), this turns on all
optimizations of -O2 except those that make the code larger.

The resulting binaries should be smaller than with -O2 which means
they are loaded faster from harddisk though they *might* run slower.
(However, they could even run faster for example if they fit in the
CPU cache.)

So, I suppose (Anyone more knowledgeable want to comment?) this is
feasible for programs that are
 - quite big AND
 - seldom used (otherwise they would in the filesystem cache anyway)
 - not computing intensive.

Hmm ... what would that be? OpenOffice?

> -march=
> -fomit-frame-pointer
> -fexpensive-optimizations (only for packages that run most of the
> like moz). Haven't tested it to see if it does make a difference:)

-O2 turns on -fexpensive-optimizations anyway (-;

The corresponding paragraph in the GCC manual has not been very clear
about this but recently it has been rewritten for GCC 3.4 and now
clearly lists which -Ox turns on/off which -ffoo.


Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-support' in the subject header of the message

More information about the lfs-support mailing list