* Best compiler/flags combination
@ 2000-01-28 20:06 Pavel Roskin
2000-01-30 23:21 ` Graham Stoney
0 siblings, 1 reply; 5+ messages in thread
From: Pavel Roskin @ 2000-01-28 20:06 UTC (permalink / raw)
To: linuxppc-embedded
Hello!
I'm compiling stuff for RPX/Lite on a PowerMac running LinuxPPC. It turns
out that programs compiled with -O2 work correctly on PowerMac but not on
RPX. For example, libcrypt.a compiled with -O2 and linked with tinylogin
crashes when it's run on RPX.
However, if I use -Os, all programs work correctly. The only exception was
ld.so that I had to recompile without optimization.
I'm using egcs-1.1.2 and glibc-2.1.1 with patches from LinuxPPC (i.e. I
use their source RPM's).
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.
Pavel Roskin
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Best compiler/flags combination
2000-01-28 20:06 Best compiler/flags combination Pavel Roskin
@ 2000-01-30 23:21 ` Graham Stoney
2000-01-31 4:55 ` Pavel Roskin
0 siblings, 1 reply; 5+ messages in thread
From: Graham Stoney @ 2000-01-30 23:21 UTC (permalink / raw)
To: Pavel Roskin; +Cc: linuxppc-embedded
Pavel Roskin writes:
> I'm using egcs-1.1.2 and glibc-2.1.1 with patches from LinuxPPC (i.e. I
> use their source RPM's).
>
> 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.
Regards,
Graham
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Best compiler/flags combination
2000-01-30 23:21 ` Graham Stoney
@ 2000-01-31 4:55 ` Pavel Roskin
2000-01-31 12:58 ` Marcus Sundberg
2000-01-31 23:10 ` Peter Allworth
0 siblings, 2 replies; 5+ messages in thread
From: Pavel Roskin @ 2000-01-31 4:55 UTC (permalink / raw)
To: Graham Stoney; +Cc: linuxppc-embedded
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/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Best compiler/flags combination
2000-01-31 4:55 ` Pavel Roskin
@ 2000-01-31 12:58 ` Marcus Sundberg
2000-01-31 23:10 ` Peter Allworth
1 sibling, 0 replies; 5+ messages in thread
From: Marcus Sundberg @ 2000-01-31 12:58 UTC (permalink / raw)
To: Pavel Roskin; +Cc: Graham Stoney, linuxppc-embedded
Pavel Roskin <pavel_roskin@geocities.com> writes:
> 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)
What you are seeing is most likely completely random behaviour depending
on how the code and data in the binary is layed out. You can not use a
standard glibc on 8xx or 4xx CPUs due to incorrect assumptions of
cache-line size. See
http://lists.linuxppc.org/listarcs/linuxppc-embedded/199909/msg00000.html
for a solution.
> Probably I'll still have to use
> -O2 -mcpu=860 -mmultiple -mstrings -mhard-float
If you don't have math emulation in the kernel you should use
-mcpu=860 -msoft-float
If you do have math emulation you don't have to use them. The important
thing is that all binaries and libraries on the system are compiled
with the same flags.
Level of optimization should not matter. If it does something is broken.
Also note that -mhard-float is ignored if -mcpu=860 is present on the
command line. With the layout of the specs file in current gcc you must
either use both "-mcpu=860 -msoft-float" or none of them, otherwise you
get broken binaries.
> Or should I understand your recommendation so that you don't specify -mcpu
> and gcc still produces code running on embedded systems?
If you have kernel math emu you don't need to specify -mcpu.
//Marcus
--
Signature under construction, please come back later.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Best compiler/flags combination
2000-01-31 4:55 ` Pavel Roskin
2000-01-31 12:58 ` Marcus Sundberg
@ 2000-01-31 23:10 ` Peter Allworth
1 sibling, 0 replies; 5+ messages in thread
From: Peter Allworth @ 2000-01-31 23:10 UTC (permalink / raw)
To: Pavel Roskin; +Cc: Graham Stoney, linuxppc-embedded
Pavel Roskin wrote:
>
<snip>
> 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)
Pavel,
I believe I have found the cause of the "internal error" in the compiler.
The source code of the compiler includes a file:
egcs-1.1.2/gcc/config/rs6000/rs6000.c
that defines a routine called "rs6000_override_options" which for -mcpu=860
will FORCE soft-float, irrespective of your command line flags.
(I think it's particularly thoughtful the way it doesn't tell you it's
doing this. ;)
By looking through the available list of cpu types, I've found an old
one that results in the compiler using the correct set of internal flags
to generate code for an MPC core with hardware (or emulated) floating point.
It's: -mcpu=505
With this flag I've been able to successfully compile and use glibc-2.1.1
on my Rev C iMac. I think the same code should run native on the iMac but
I haven't tried it.
> 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?
As far as I can tell, the only problem with using the compiler "as-is"
would be that the compiler's idea of how long each instruction takes
would be wrong in some cases and so the resulting code would be suboptimal.
'Hope that all helps,
PeterA.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2000-01-31 23:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-01-28 20:06 Best compiler/flags combination Pavel Roskin
2000-01-30 23:21 ` Graham Stoney
2000-01-31 4:55 ` Pavel Roskin
2000-01-31 12:58 ` Marcus Sundberg
2000-01-31 23:10 ` Peter Allworth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).