How to tune gcc for different x86 host and target cpus?

Michael Roth mroth@nessie.de
Wed May 12 19:45:00 GMT 2004


Ian Lance Taylor wrote:

> Michael Roth <mroth@nessie.de> writes:
> 
>>But how can I tell the configure script that the compiler itself
>>should be optimized for a different cpu architecture?
> 
> 
> One way is to set CFLAGS when you compile.  The default value for
> CFLAGS is "-g -O2" (when compiling with gcc).
> 
> 
>>Example #1: Host and build are athlon-xp, target should be pentium.
> 
> 
> make CFLAGS="-g -O2 -march=athlon"

Thank you. This did the job.


> I think that if you set the environment variable CFLAGS when you run
> configure, it will be picked up and stored in the Makefile.  Try it by
> looking at the definition of CFLAGS in the top level Makefile after
> you run configure.

I'm not sure, I tried this before I posted to this list, and I think it 
didn't worked well. But I could be wrong.


Michael



More information about the Gcc-help mailing list