Optimizations

Matthew Burgess ca9mbu at eos.sunderland.ac.uk
Wed Nov 27 13:56:59 PST 2002


"Adrian Smarzewski" <adrians at aska.com.pl> wrote in message
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)
> 2) If the answer (1) is "yes" why should I specify additional
CFLAGS="-march=processor_type"
> for optimization?
> 3) If the answer (1) is "yes" why should I specify -march for
cross-compiling in addition
> to host/target argument to configure?
> 4) Why optimized applications may not work correctly? optimization in gcc
is buggy?
> 5) You say that for example glibc shouldn't be compiled with CFLAGS, but I
must
> set it for cross-compiling!

I've not read the hint myself but there's been much discussion on the list
regarding such issues, so:

1) It detects your CPU type/class (e.g. i686, i586, etc).  It compiles apps
natively for that CPU (i.e. won't work on any CPU below that class).
2) I don't think you need to (remember previous versions of gcc defaulted to
i386 so this flag was always required for such optimizations to occur).
3) If you don't specify -march=<processor-type> then as mentioned by 1)
above the apps simply won't work on anything below the CPU that gcc compiled
it for
4) I don't think that it's neccessarily buggy gcc code, just that each app
has different code, so it's not possible to always get the optimization
right.
5) I believe that should be don't set optimization specific options in your
CFLAGS.  That is don't specify -Ox of the -f-omit-pointer, -f-unroll-loops
and such like.

I am willing to stand corrected on any or all of these issues by the more
knowledgable on the list, but I don't think that the above is wildly
incorrect.

Regards,

Matt.


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