glibc/sysdeps/generic
Maciej W. Rozycki 9c21573c02 MIPS: IEEE 754-2008 NaN encoding support
It has been a long practice for software using IEEE 754 floating-point
arithmetic run on MIPS processors to use an encoding of Not-a-Number
(NaN) data different to one used by software run on other processors.
And as of IEEE 754-2008 revision [1] this encoding does not follow one
recommended in the standard, as specified in section 6.2.1, where it
is stated that quiet NaNs should have the first bit (d1) of their
significand set to 1 while signalling NaNs should have that bit set to
0, but MIPS software interprets the two bits in the opposite manner.

As from revision 3.50 [2][3] the MIPS Architecture provides for
processors that support the IEEE 754-2008 preferred NaN encoding format.
As the two formats (further referred to as "legacy NaN" and "2008 NaN")
are incompatible to each other, tools have to provide support for the
two formats to help people avoid using incompatible binary modules.

The change is comprised of two functional groups of features, both of
which are required for correct support.

1. Dynamic linker support.

   To enforce the NaN encoding requirement in dynamic linking a new ELF
   file header flag has been defined.  This flag is set for 2008-NaN
   shared modules and executables and clear for legacy-NaN ones.  The
   dynamic linker silently ignores any incompatible modules it
   encounters in dependency processing.

   To avoid unnecessary processing of incompatible modules in the
   presence of a shared module cache, a set of new cache flags has been
   defined to mark 2008-NaN modules for the three ABIs supported.
   Changes to sysdeps/unix/sysv/linux/mips/readelflib.c have been made
   following an earlier code quality suggestion made here:

   http://sourceware.org/ml/libc-ports/2009-03/msg00036.html

   and are therefore a little bit more extensive than the minimum
   required.

   Finally a new name has been defined for the dynamic linker so that
   2008-NaN and legacy-NaN binaries can coexist on a single system that
   supports dual-mode operation and that a legacy dynamic linker that
   does not support verifying the 2008-NaN ELF file header flag is not
   chosen to interpret a 2008-NaN binary by accident.

2. Floating environment support.

   IEEE 754-2008 features are controlled in the Floating-Point Control
   and Status (FCSR) register and updates are needed to floating
   environment support so that the 2008-NaN flag is set correctly and
   the kernel default, inferred from the 2008-NaN ELF file header flag
   at the time an executable is loaded, respected.

As the NaN encoding format is a property of GCC code generation that is
both a user-selected GCC configuration default and can be overridden
with GCC options, code that needs to know what NaN encoding standard it
has been configured for checks for the __mips_nan2008 macro that is
defined internally by GCC whenever the 2008-NaN mode has been selected.
This mode is determined at the glibc configuration time and therefore a
few consistency checks have been added to catch cases where compilation
flags have been overridden by the user.

The 2008 NaN set of features relies on kernel support as the in-kernel
floating-point emulator needs to be aware of the NaN encoding used even
on hard-float processors and configure the FPU context according to the
value of the 2008 NaN ELF file header flag of the executable being
started.  As at this time work on kernel support is still in progress
and the relevant changes have not made their way yet to linux.org master
repository.

Therefore the minimum version supported has been artificially set to
10.0.0 so that 2008-NaN code is not accidentally run on a Linux kernel
that does not suppport it.  It is anticipated that the version is
adjusted later on to the actual initial linux.org kernel version to
support this feature.  Legacy NaN encoding support is unaffected, older
kernel versions remain supported.

[1] "IEEE Standard for Floating-Point Arithmetic", IEEE Computer
    Society, IEEE Std 754-2008, 29 August 2008

[2] "MIPS Architecture For Programmers, Volume I-A: Introduction to the
    MIPS32 Architecture", MIPS Technologies, Inc., Document Number:
    MD00082, Revision 3.50, September 20, 2012

[3] "MIPS Architecture For Programmers, Volume I-A: Introduction to the
    MIPS64 Architecture", MIPS Technologies, Inc., Document Number:
    MD00083, Revision 3.50, September 20, 2012
2013-09-18 21:33:50 +01:00
..
bits Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
net Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
netinet Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
nfs Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
sys Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
_G_config.h Remove _G_OPEN64, _G_LSEEK64, _G_MMAP64, _G_FSTAT64 from _G_config.h. 2012-10-18 18:50:43 +00:00
_itoa.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
a.out.h
abort-instr.h
aio_misc.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
allocalim.h
asm-syntax.h
confstr.h
device-nrs.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dirstream.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-cache.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-dtprocnum.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-fptr.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-hash.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-irel.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-librecon.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-lookupcfg.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-machine.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-osinfo.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-procinfo.c
dl-procinfo.h Add GLRO(dl_hwcap2) for new AT_HWCAP2 auxv_t a_type. 2013-06-28 16:50:48 -05:00
dl-sysdep.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dl-tls.h
dwarf2.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
eloop-threshold.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
entry.h
errqueue.h
fd_to_filename.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
fips-private.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
fork.h
fpu_control.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
frame.h Remove __ptrvalue, __bounded and __unbounded. 2013-02-13 23:30:40 +00:00
framestate.c Fix leading whitespaces. 2013-06-06 20:36:07 +02:00
gccframe.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
get-rounding-mode.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
gmp-mparam.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
hp-timing.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
ifreq.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
ifunc-sel.h Move sysdeps/generic/elf/* to sysdeps/generic 2012-03-19 21:04:21 +01:00
intr-msg.h
inttypes.h Get rid of __STDC_FORMAT_MACROS, __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS 2013-04-25 11:08:31 -07:00
ldconfig.h MIPS: IEEE 754-2008 NaN encoding support 2013-09-18 21:33:50 +01:00
ldsodefs.h Add GLRO(dl_hwcap2) for new AT_HWCAP2 auxv_t a_type. 2013-06-28 16:50:48 -05:00
libc-mmap.h [BZ #10283] localedef: align fixed maps to SHMLBA 2013-06-24 20:26:58 -04:00
libcidn.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libm-test-ulps
libnss_compat.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_db.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_dns.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_files.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_hesiod.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_nis.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_nisplus.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
local-setxid.h
localplt.data Move localplt baselines to sysdeps directories. 2012-07-20 19:20:34 +00:00
machine-gmon.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
machine-lock.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
machine-sp.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Makefile Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
malloc-machine.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
malloc-sysdep.h Add missing includes to sysdeps/generic/malloc-sysdep.h. 2013-02-05 11:34:06 -08:00
math_ldbl_opt.h
math_ldbl.h
math_private.h Set/restore rounding mode only when needed 2013-06-12 10:36:48 +05:30
math-tests.h Add exception information to math-tests.h and use it in libm-test.inc. 2013-06-11 15:44:31 +00:00
memcopy.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
memusage.h Add #include <stdint.h> for uint[32|64]_t usage (except installed headers). 2013-05-16 11:32:54 -05:00
not-cancel.h Flesh out stub not-cancel.h file. 2013-05-06 16:03:35 -07:00
nscd-types.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
pagecopy.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
paths.h generic paths.h: remove old paths from _PATH_STDPATH 2012-11-04 10:11:39 +01:00
profil-counter.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
pty-private.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
register-dump.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
rtld-lowlevel.h Jakub Jelinek <jakub@redhat.com> 2006-10-10 00:51:29 +00:00
sigcontextinfo.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
siglist.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
sigset-cvt-mask.h Avoid use of "register" as optimization hint. 2013-06-07 22:24:35 +00:00
stackguard-macros.h Split up stackguard-macros.h into sysdeps directories. 2012-05-15 23:34:30 +00:00
stackinfo.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
stdint.h Get rid of __STDC_FORMAT_MACROS, __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS 2013-04-25 11:08:31 -07:00
symbol-hacks.h Fix unsafe compiler optimization 2013-06-12 10:21:22 -05:00
sysdep-cancel.h * elf/dl-sym.c (do_sym): Use RTLD_SINGLE_THREAD_P. 2006-10-29 21:46:32 +00:00
sysdep.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
testrtsig.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
thread_state.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tininess.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tls-macros.h
tls.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tst-audit.h Move testsuite audit definitions to sysdeps tst-audit.h files. 2012-07-26 11:29:07 +00:00
tst-stack-align.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
unsecvars.h * malloc/malloc.c (_int_malloc): Remove unused any_larger variable. 2006-10-11 16:29:13 +00:00
unwind-dw2-fde-glibc.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
unwind-dw2-fde.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
unwind-dw2-fde.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
unwind-dw2.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
unwind-pe.c
unwind-pe.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
unwind.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
utmp-equal.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00