Optimizations

Steve Crosby sneeble at paradise.net.nz
Wed Nov 27 13:59:35 PST 2002


adrians at aska.com.pl (Adrian Smarzewski) wrote in
news:20021127221451.56fe39cc.adrians at aska.com.pl: 

>> http://hints.us.linuxfromscratch.org/hints/crosscompiling-x86.txt
>> 
> 
> There is no answer for that questions there. For example:
> 
> 1) Does configure script detect my machine and let gcc optimize the
> code for my processor type? (i686 for example)

Yes.  And as a result, will use instructions that *will not run* on lower 
class machines (i.e. Pentium).  You must pass the host/target/build 
parameters to the applicaitons configure script in order to have it compile 
instructions that will run on Pentium and above machines.  The hint 
mentioned gives detailed instructions on how to accomplish this.

> 2) If the answer (1) is "yes" why should I specify additional
> CFLAGS="-march=processor_type" for optimization?

You only have to do this if the configure script does not support the 
host/build/target options

> 3) If the answer (1) is "yes" why should I specify -march for
> cross-compiling in addition to host/target argument to configure?

You don't have to.

> 4) Why optimized applications may not work correctly? optimization in
> gcc is buggy?

The compiler optimisations referred to are for -O flag (and some others), 
which cause gcc to miscompile some code.  the march/mcpu constructs 
*should* be *relatively* safe.

> 5) You say that for example glibc shouldn't be compiled
> with CFLAGS, but I must set it for cross-compiling!

This refers to the -O optimisation flag.  In the case of GLIBC/GCC, the 
host/target/build options are the only ones required.

I have successfully built and compiled for a Pentium class machine using my 
i686 processder based laptop by following the hints instructions.


So, in summary;

- follow the hint mentioned;
- for all applications in base LFS that are *not* listed in the hint, use 
the host/target/build options to configure
- for those that are listed, follow the instructions, setting the CFLAGS 
variable as indicated before each package is built, and *unsetting* 
afterwards.

Hope that helps...

- --
Steve Crosby
sneeble at paradise.net.nz
-- 
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