This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Adding fenv.h for ARM and SPARC


On 14/08/17 15:04, Joel Sherrill wrote:
> That does leave the question of what happens to all of
> fenv.h when soft-float is enabled. But the first order
> of business was to move newlib libm from really not
> having any fenv.h support for the main architectures
> to using the *BSD support.

the standard specifies how fenv.h behaves if there
is no support for exceptions or rounding modes,
so soft-float should not be an issue.
(e.g. FE_* macros are not defined if there is no
support for them)

in principle soft-float can support exceptions and
rounding modes, but in multi-thread environment it
has to be thread local state which in practice means
there needs to be hw control/status registers that
are handled at a context switch (otherwise some
tls abi has to be introduced between the compiler
that provides the soft fp emulation and the libc
which manages tls, i think this was not done
historically since c99 implicitly also required that
fenv is as-safe so fp arithmetics works in signal
handlers which requires blocking signals in every
fp operation that may access the fenv or it needs
to be saved/restored around signal handlers by some
mechanism, this was changed in c11, fp arithmetics
is no longer as-safe so plain tls fenv would work
or if newlib does not provide threads for a target
then global fenv would work)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]