[uClibc] Re: Is there a workaround for this floating point bug?

Erik Andersen andersen at codepoet.org
Sun Aug 10 05:17:51 UTC 2003


On Sat Aug 09, 2003 at 09:32:42PM -0700, David Wuertele wrote:
> Since I'm using the stock RH9, I did not compile it myself.  I must
> admit the possibility that my kernel or compiler may be broken.  If I
> can't find another explanation I'll run some experiments in that
> direction.  But I always thought that since we build gcc by having it
> compile itself, that the only way to get it wrong was by
> misconfiguring gcc.  I'm using buildroot's makefiles as-is and
> uClibc-0.9.20 with UCLIBC_HAS_FLOATS=y and UCLIBC_HAS_SOFT_FLOAT=y.

Hmm.  I built with UCLIBC_HAS_SOFT_FLOAT=n, so that is likely
the main cause of differences/problems.

> Erik> The last test is run inside the uClibc development system for
> Erik> mips, available from the uClibc website.
> 
> That is a good test.  I just downloaded the uClibc development system
> for mips and tried it:
> 
>   sh-2.05b# gcc -o test-kernemu test.cpp
>   sh-2.05b# ./test-kernemu
>   if 0.100000 and 0.100000 don't both equal 0.100000,suspect fprintf
>   if 120.000000 and 120.000000 aren't close to 120, suspect float operations

all good so far.

>   sh-2.05b# gcc -msoft-float -o test-soft test.cpp
>   sh-2.05b# ./test-soft
>   doubles are hosed!
>   sh-2.05b# 

This test cannot work.  When you use -msoft-float, everything
linked into the app must be 100% soft-float.  In this test 
you are using a hard-float uClibc and trying to do soft-float
which just won't work.

> Interesting, the first test succeeded, which indicates there is
> nothing wrong with my kernel's floating point emulation.  I wonder
> what is different between your system and mine.  In any case, the
> second test failed.  Is -msoft-float supported on this development
> system?

If you would like, ask me privately and I can give you a login on
the box in question so you can poke and prod all you want.  But
it sounds like you already have a servicable mips box.  Mine is
terribly slow, which makes testing a bit painful.  :-(

> Erik> $ /usr/mipsel-linux-uclibc/bin/mipsel-uclibc-gcc -Wall -Os
> Erik> test.c -o test
> 
> I was actually using mipsel-uclibc-g++, but just now I tried with
> mipsel-uclibc-gcc and got the same errors as with g++.
> 
> Would you mind testing with -msoft-float?

Ok.  Will do, after I recompile uClibc with UCLIBC_HAS_SOFT_FLOAT
enabled, which is gonna take a little while.  I just started
uClibc recompiling.  Did I mention how slow my mips test box is?

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list