Subject: Re: NetBSD 2.0 for non FPU macs
To: J. MacPhail <jrm@kw.igs.net>
From: Bruce ONeel <edoneel@sdf.lonestar.org>
List: port-mac68k
Date: 04/03/2004 12:04:25
Hi,
"J. MacPhail" <jrm@kw.igs.net> wrote:
<snip>
> >
> > You can't really compile anything since gcc randomly crashes, a
> > normal boot leaves a half dozen or so core files in /, etc. It was
> > kind of ugly and usable only if you were dedicated since the
> > solution to a random crash was try running the command again, and
> > again, and again, until it worked. Or, rebuild it from scratch.
> >
> > Oh, and X starts up only once in a while.
>
> So we can expect floating point operations to show up in libm.so,
> libc.so, at least one other library (libcrypt.so?), and other programs
> that would call these but are statically linked.
>
Well, and programs that use them internally.
Of the top of my head
top
tcsh
perl
> I don't understand this. The info for gcc-3.3.3, M680x0 Options, says
>
> `-msoft-float'
> Generate output containing library calls for floating point.
> *Warning:* the requisite libraries are not available for all m68k
> targets. Normally the facilities of the machine's usual C
> compiler are used, but this can't be done directly in
> cross-compilation. You must make your own arrangements to provide
> suitable library functions for cross-compilation. The embedded
> targets `m68k-*-aout' and `m68k-*-coff' do provide software
> floating point support.
My experience is that -msoft-float works fine in the compile step,
but, come ld time ld fails finding the proper routines to impliment
the functions that gcc has called.
I just tried on a 060 running 1.6.2 and got the following:
#include <stdio.h>
int main (int argc, char **argv)
{
double a=1.0;
double b=7.0;
double c;
c = a/b;
printf("%lf %lf %lf\n",a,b,c);
return 0;
}
lilith: {6} cc -msoft-float -o t1 t1.c
lilith: {7} ./t1
1.000000 7.000000 nan
lilith: {9} cc -o t1 t1.c
lilith: {10} ./t1
1.000000 7.000000 0.142857
So, ld worked but the -msoft-float produced unusable code.
>
> And that still leaves me uncertain whether or not native compilation
> with -msoft-float is supposed to just work.
On my system (040 with 1.6.2 with the -msoft-float option when built)
if I do not use -msoft-float I have an output with fmove, fdiv, etc
in it. OTOH, if I do use
-msoft-float the only fpu looking thing I see is a call to __divdf3.
So native compulation (with divdf3 et al in libc) does seem to work.
It also works as a cross compiler since I do my full builds
on a macppc system (thanks John Klos!). Of course this is 2.95.3.
>
>
> And surprises. Even if all your stuff is perfect, maybe the
> -msoftfloat option to gcc has some unexpected side-effect. (That
> could potentially make it hard to list all binaries containing
> floating point operations....)
That's correct, the code generated with -msoft-float, on the surface,
does not really look the code generated when -msoft-float is not
used.
Thanks!
cheers
bruce
>
>
> > I'll try to do the diff next time I build it.
>
> Great!
>
> --
> John