[PATCH, ARMEL, FPA] revert-arm-ieee-word-endian.patch - correct newlib-1.18.0 soft FP breakage

Pavel Pisa ppisa4lists@pikron.com
Thu Jun 17 15:09:00 GMT 2010

Hello Sebastian,

I think, that my patch corrects the base problem
for correct FPA words access. Do you think, that
there is some other fundamental problem in GCC
code generator or gcc-4.4/gcc/config/arm/lib1funcs.asm.
I believe, that these has been tested enough on Linux.

If these are right, than it is only NewLib problem.
For long time FPA has been only standard for FP
on ARM. This seems as horror, that newlib has been
broken for years for ARMEL.

According to my investigation the libm implementation
uses macros to access the double components and these
macros seems to be controlled reasonably by
The toolchain with my patch applied produces reasonable
results for sin/cos/log on doubles. I have some doubts
for printf when tested in memory limited and hacked
LPC2xxx test, but on our PiMX1 ARM9 board doubles print
OK as well and strtod works as expected. It is possible,
that there is some other hackery in libm or elesewhere
in NewLib. 

I am little nervous from defines like next

#define IEEE_8087

#define IEEE_MC68k

But they come to play even when both native endians are used,
so I hope, that they do not enable something horrible.

Have you some suspicion?

I should find time to run paranoia FP test probably.
I will report results, when i find time.

Best wishes,

                Pavel Pisa

PS: your feeling, that strange memory is access
can be caused by very non-deterministic behavior,
when some fundamental decision (in sin, log etc.)
are done from least significant word. Result is,
that sometimes series computation done in doubles
returns correct results, but sometimes initial
decision from exponent, sign and false MSB part
result in taking incorrect path and result is
  sin results 1.0033, -1 for value near to 0
  printf is catch in some loop forever and overwrites memory

 PiKRON s.r.o.       Phone/Fax: +420 2 84684676
 Kankovskeho 1235    Phone:     +420 2 84684676
 182 00 Praha 8      WWW:   http://www.pikron.com/
 Czech Republic      e-mail:  pikron@pikron.com

On Thursday 17 June 2010 11:10:23 Sebastian Huber wrote:
> Hello Pavel,
> please have a look at:
> http://www.rtems.com/ml/rtems-users/2009/september/msg00072.html
> From my point of view Newlib will only work with FPA on ARMLE after some
> fundamental changes.  I don't think its worth to do this.  This hardware
> model is totally broken.
> On 06/16/2010 03:24 PM, Pavel Pisa wrote:
> [...]
> > ../../../src/gcc-4.4/configure -v \
> >          --enable-languages=c,c++ \
> >          --prefix=/usr \
> >          --enable-interwork \
> >          --enable-multilib \
> >          --with-system-zlib \
> >          --without-included-gettext \
> >          --disable-nls \
> >          --with-gnu-ld \
> >          --with-gnu-as \
> >          --with-newlib \
> >          --enable-checking=release \
> >          --build=x86_64-linux-gnu \
> >          --host=x86_64-linux-gnu \
> >          --target=arm-elf \
> >          --enable-version-specific-runtime-libs \
> >          --with-float=soft \
> >          --enable-target-optspace
> [...]
> You should be careful with --enable-target-optspace, see also
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38644
> Have a nice day!

More information about the Newlib mailing list