Informations about gcc optimization

Ken Moffat ken at kenmoffat.uklinux.net
Fri Oct 11 17:10:00 PDT 2002


On Fri, 11 Oct 2002, Simon Comeau Martel wrote:

> I am running LFS 3.3 and I'll rebuild my system this weekend following the LFS CVS book.  When I built my current system, I didn't use any optimization at all.  But this time, I want to.  But I am not sure what I should use...  My processor is a Celeron 500 MHz.
> 
> Should I use something like
> 
> CFLAGS="-O3 -s -march=i686" OR
> CFLAGS="-O3 -s -march=pentium???"
>
 I'd be wary of using -O3 in the LFS system, but it might be useful for
any graphics programs and libraries you're planning to use. These days I
normally build LFS with -Os (on a K6-2/450) and I can't see that
fiddling with these flags makes a noticeable speed difference. The
possible problems with -O3 are that reputedly some of the packages such
as binutils and glibc don't get on with exotic CFLAGS, and ( more
likely ) you will bloat the size of everything.

 The -s sounds good. It might speed up the build too. However, be aware
that some packages will ignore your CFLAGS.

> Does adding the -mcpu option is of any use?  Most of the time, I saw both of them, but from the GCC site: "Moreover, specifying -march=cpu-type implies -mcpu=cpu-type"
> 
> If the pentium choice is "better", witch one fit my CPU?
> 
> pentium, pentium-mmx, pentiumpro, pentium2, pentium3 ??
> 
 I think you are using i686, this is possibly the same as pentiumpro and
pentium2. It might give you something like a 0.2% speed increase over
pentium (i586).

> Should I add someting else?
>
 Search the lfs archive (on the website). There have been several recent
postings about CFLAGS (good, and bad). 
> (I know that I have to do the same thing with CXXFLAGS)
> 

 My personal opinion is that the only machines that need to worry about
optimising for speed in the basic lfs system (486, slow 586) are those
which don't have any available optimisations.

Ken
-- 
 Out of the darkness a voice spake unto me, saying "smile, things could be
worse". So I smiled, and lo, things became worse.



-- 
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