This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PowerPC gcc drops incorrect code


Hi

I'm new to this list so forgive me if there's an obvious answer to this. 
I've searched the archives and googled and found only vieled references 
to this problem.

I built gcc-3.4.3-glibc-2.3.2 for powerpc-8540-linux-gnu using 
crosstools 0.35 and I just tried 0.38 too.

I did the crosstool build with:

    TARGET=powerpc-8540-linux-gnu
    TARGET_CFLAGS="-O -mcpu=8540"
    GCC_EXTRA_CONFIG="--with-cpu=8540 --enable-cxx-flags=-mcpu=8540"
    GLIBC_EXTRA_CONFIG="--without-fp"

I built a kernel using my new shiny crosstool gcc and it worked great. I 
then built busybox and got "Illegal instruction" errors on doing an nfs 
mount.

Basically, the compiler will generate lswi and stswi (string word 
instructions) when compiling with the -Os (optimise for space) flag. 
These instructions are not supported on various powerpc platforms 
(including mine - an mpc8560 which uses the e500 core, like the 8540). 
You can stop gcc doing this by issuing the -mno-string flag. However, 
the manpage for gcc clearly states that for powerpc architectures, this 
flag is set by default (i.e. -mstring is off). So, you shouldn't have 
to do this. Setting -mno-string manually in target build scripts works, 
but is a gross hack and a pain in the back side when building a whole 
bunch of stuff. 

My question is, has anyone encountered this before, and do they know if 
it's a gcc bug or a crosstool bug, or just a dumb-ass mistake on my 
part ?

I couldn't find any relevant patches to fix this, but that might just be 
because I haven't yet looked hard enough.

I think the key to this lies in gcc-3.4.3/gcc/configs/rs6000/rs6000.[ch] 
but I'd be interested if anyone can shed any light on this before I 
delve too much deeper.

Cheers,
James.
--
James Macfarlane

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]