[PATCH 1/2] arm: Fix fenv support

Keith Packard keithp@keithp.com
Thu Jul 30 22:51:43 GMT 2020


Sebastian Huber <sebastian.huber@embedded-brains.de> writes:

> The previous fenv support for ARM used the soft-float implementation of
> FreeBSD.  Newlib uses the one from libgcc by default.  They are not
> compatible.  Having an GCC incompatible soft-float fenv support in
> Newlib makes no sense.  A long-term solution could be to provide a
> libgcc compatible soft-float support.  This likely requires changes in
> the GCC configuration.  For now, provide a stub implementation for
> soft-float multilibs similar to RISC-V.

Thanks for cleaning this up.

One thing I think we're still missing is the setting of
math_errhandling. That value is currently set to MATH_ERRNO in math.h,
which indicates that the underlying system will set errno, but that it
won't raise any exceptions. I think we should figure out when exceptions
will be raised and set math_errhandling to match. That can be decided at
compile time -- platforms with HW floats and exception support should
make math_errhandling include MATH_ERREXCEPT.

This does leave me a bit confused about how this should work on a
processor with HW float and SW double support though. In that case,
operations involving single-precision arithmetic may offer exceptions
and rounding mode support while double-precision operations will
not. The C99 spec doesn't appear to have any guidance for this case,
which means we need to come up with some kind of answer.

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/newlib/attachments/20200730/3f37b2f3/attachment.sig>


More information about the Newlib mailing list