Best compiler/flags combination

Pavel Roskin pavel_roskin at geocities.com
Mon Jan 31 15:55:50 EST 2000


Hello, Graham!

> > The question is, what compiler is known to produce good code for embedded
> > PPC boards and what flags should be used? It is desireable that the
> > binaries still run on PowerPC.
>
> My general approach when starting out is to always use the latest official
> released versions, and move to a newer snapshot if you encounter problems.
> In particular, the latest official gcc release (gcc-2.95.2) is a better
> starting point than the old egcs releases.

Thank you. I'll try it.

This approach works particularily well when you are using the same OS as
the developers (which is probably {i386,alpha}-linux) or when you (or
other people) have time to keep support for your configuration is a good
shape.

You did not mention flags. Maybe my results will be of some interest. I'm
using egcs-1.1.2 native for PowerMAC

-O2                bad code almost everywhere (libcrypt, depmod, bash)
-Os                bad code in tinylogin
-Os -fno-inline    good code (not extensively tested),
                   but it doesn't look like a clean solution
-O2 -mcpu=860 -mmultiple -mstrings -mhard-float
                   good code so far, but libm cannot be compiled
                   (internal error in the compiler)

Probably I'll still have to use
-O2 -mcpu=860 -mmultiple -mstrings -mhard-float

Or should I understand your recommendation so that you don't specify -mcpu
and gcc still produces code running on embedded systems?

Pavel Roskin


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-embedded mailing list