FW: wrong code generation in newlib 1.1.14 PPC ?!

Kai Ruottu karuottu@mbnet.fi
Thu Jan 12 10:52:00 GMT 2006

Frank Juergen-r58616 wrote:

>I generate my own version of gcc and newlib for the PowerPC.
Then you should know what you are doing... And not ask anything here :-)

>If I compile and link my program it looks good, but if I execute the code it crashes !! Ok I debug and find out that the compiler generate wrong opcodes but I compile and create everything with the same cpu option ( mcpu=603e ). So what kind of problem is this ... has anyone else similar effects ?
Is there a specific non-default multilib version triggered with the 
'-mcpu=603e' option? Or should the default code ('-mcpu=common') be 
fully compatible with your
603e ? The GCC 3.4 manual tells about this default code :

‘-mcpu=common’ selects a completely generic processor. Code generated under
this option will run on any POWER or PowerPC processor. GCC will use
only the instructions in the common subset of both architectures, and 
will not
use the MQ register. GCC assumes a generic processor model for scheduling

 > I see this problem only in the newlib functions not in my own program 
code ?!

Of course there should be a newlib variation compiled with the same 
'-mcpu=603e', or mixing code produced with the '-cpu=common' with code 
made with this
option should work... What if you don't use the '-mcpu=603e', but use 
the default, does the executable then crash?

Maybe you should change the GCC config settings and put the '-mcpu=603e' 
to trigger creating a special set of libraries for this option, then 
your 'lib' directory
would have for instance a 'm603e' subdir and in it everything compiled 
with this option, and being linked when using this option on the GCC 
command line.
Simply said a new multilib made for this case...

More information about the Gcc-help mailing list