about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* Update <sys/ptrace.h> for Linux 4.3.Joseph Myers2015-11-237-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch updates <sys/ptrace.h> for Linux 4.3, adding PTRACE_O_SUSPEND_SECCOMP and updating the value of PTRACE_O_MASK. Some architectures were missing the older PTRACE_O_EXITKILL, so that was added to the files missing it as well. Tested for x86_64 (testsuite, and that installed shared libraries are unchanged by the patch). * sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h (PTRACE_O_EXITKILL): New value in enum __ptrace_setoptions. (PTRACE_O_SUSPEND_SECCOMP): Likewise. (PTRACE_O_MASK): Update value. * sysdeps/unix/sysv/linux/ia64/sys/ptrace.h (PTRACE_O_EXITKILL): New value in enum __ptrace_setoptions. (PTRACE_O_SUSPEND_SECCOMP): Likewise. (PTRACE_O_MASK): Update value. * sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h (PTRACE_O_SUSPEND_SECCOMP): New value in enum __ptrace_setoptions. (PTRACE_O_MASK): Update value. * sysdeps/unix/sysv/linux/s390/sys/ptrace.h (PTRACE_O_SUSPEND_SECCOMP): New value in enum __ptrace_setoptions. (PTRACE_O_MASK): Update value. * sysdeps/unix/sysv/linux/sparc/sys/ptrace.h (PTRACE_O_SUSPEND_SECCOMP): New value in enum __ptrace_setoptions. (PTRACE_O_MASK): Update value. * sysdeps/unix/sysv/linux/sys/ptrace.h (PTRACE_O_SUSPEND_SECCOMP): New value in enum __ptrace_setoptions. (PTRACE_O_MASK): Update value. * sysdeps/unix/sysv/linux/tile/sys/ptrace.h (PTRACE_O_EXITKILL): New value in enum __ptrace_setoptions. (PTRACE_O_SUSPEND_SECCOMP): Likewise. (PTRACE_O_MASK): Update value.
* Update <netpacket/packet.h> for Linux 4.3.Joseph Myers2015-11-231-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the course of reviewing Linux 4.3 changes for any glibc header updates needed, I found that sysdeps/unix/sysv/linux/netpacket/packet.h was extremely out of date (last updated for Linux 2.3.15, it seems). This patch updates the sets of constants present in that header to include those added to those sets in newer kernels (include/uapi/linux/if_packet.h). Tested for x86_64 (testsuite, and that installed shared libraries are unchanged by the patch). * sysdeps/unix/sysv/linux/netpacket/packet.h (PACKET_COPY_THRESH): New macro. (PACKET_AUXDATA): Likewise. (PACKET_ORIGDEV): Likewise. (PACKET_VERSION): Likewise. (PACKET_HDRLEN): Likewise. (PACKET_RESERVE): Likewise. (PACKET_TX_RING): Likewise. (PACKET_LOSS): Likewise. (PACKET_VNET_HDR): Likewise. (PACKET_TX_TIMESTAMP): Likewise. (PACKET_TIMESTAMP): Likewise. (PACKET_FANOUT): Likewise. (PACKET_TX_HAS_OFF): Likewise. (PACKET_QDISC_BYPASS): Likewise. (PACKET_ROLLOVER_STATS): Likewise. (PACKET_FANOUT_DATA): Likewise. (PACKET_MR_UNICAST): Likewise.
* NaCl: Use allocate_code_data after dyncode_createRoland McGrath2015-11-201-1/+27
|
* Fix math_private.h multiple include guards.Joseph Myers2015-11-208-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Various math_private.h headers are guarded by "#ifndef _MATH_PRIVATE_H", but never define the macro. Nothing else defines the macro either (the generic math_private.h that they include defines a different macro, _MATH_PRIVATE_H_), so those guards are ineffective. With the recent inclusion of s_sin.c in s_sincos.c, this breaks the build for MIPS, since the build of s_sincos.c ends up including <math_private.h> twice and the MIPS version defines inline functions such as libc_feholdexcept_mips, without a separate fenv_private.h header with its own guards such as some architectures have. This patch fixes all the problem headers to use architecture-specific guard macro names, and to define those macros in the headers they guard, just as some architectures already do. Tested for x86 (testsuite, and that installed shared libraries are unchanged by the patch), and for mips64 (that it fixes the build). * sysdeps/arm/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!ARM_MATH_PRIVATE_H]. [!ARM_MATH_PRIVATE_H] (ARM_MATH_PRIVATE_H): Define macro. * sysdeps/hppa/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!HPPA_MATH_PRIVATE_H]. [!HPPA_MATH_PRIVATE_H] (HPPA_MATH_PRIVATE_H): Define macro. * sysdeps/i386/fpu/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!I386_MATH_PRIVATE_H]. [!I386_MATH_PRIVATE_H] (I386_MATH_PRIVATE_H): Define macro. * sysdeps/m68k/m680x0/fpu/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!M68K_MATH_PRIVATE_H]. [!M68K_MATH_PRIVATE_H] (M68K_MATH_PRIVATE_H): Define macro. * sysdeps/microblaze/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!MICROBLAZE_MATH_PRIVATE_H]. [!MICROBLAZE_MATH_PRIVATE_H] (MICROBLAZE_MATH_PRIVATE_H): Define macro. * sysdeps/mips/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!MIPS_MATH_PRIVATE_H]. [!MIPS_MATH_PRIVATE_H] (MIPS_MATH_PRIVATE_H): Define macro. * sysdeps/nios2/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!NIO2_MATH_PRIVATE_H]. [!NIO2_MATH_PRIVATE_H] (NIO2_MATH_PRIVATE_H): Define macro. * sysdeps/tile/math_private.h [!_MATH_PRIVATE_H]: Change guard to [!TILE_MATH_PRIVATE_H]. [!TILE_MATH_PRIVATE_H] (TILE_MATH_PRIVATE_H): Define macro.
* Fix lgamma setting signgam for ISO C (bug 15421).Joseph Myers2015-11-2036-62/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The lgamma (and likewise lgammaf, lgammal) function wrongly sets the signgam variable even when building for strict ISO C conformance (-std=c99 / -std=c11), although the user may define such a variable and it's only in the implementation namespace for POSIX with XSI extensions enabled. Following discussions starting at <https://sourceware.org/ml/libc-alpha/2013-04/msg00767.html> and <https://sourceware.org/ml/libc-alpha/2015-10/msg00844.html>, it seems that the safest approach for fixing this particular issue is for signgam to become a weak alias for a newly exported symbol __signgam, with the library functions only setting __signgam, at which point static linker magic will preserve the alias for newly linked binaries that refer to the library's signgam rather than defining their own, while breaking the alias for programs that define their own signgam, with new symbol versions for lgamma functions and with compat symbols for existing binaries that set both signgam and __signgam. This patch implements that approach for the fix. signgam is made into a weak alias. The four symbols __signgam, lgamma, lgammaf, lgammal get new symbol versions at version GLIBC_2.23, with the existing versions of lgamma, lgammaf and lgammal becoming compat symbols. When the compat versions are built, gamma, gammaf and gammal are aliases for the compat versions (i.e. always set signgam); this is OK as they are not ISO C functions, and avoids adding new symbol versions for them unnecessarily. When the compat versions are not built (i.e. for static linking and for future glibc ports), gamma, gammaf and gammal are aliases for the new versions that set __signgam. The ldbl-opt versions are updated accordingly. The lgamma wrappers are adjusted so that the same source files, included from different files with different definitions of USE_AS_COMPAT, can build either the new versions or the compat versions. Similar changes are made to the ia64 versions (untested). Tests are added that the lgamma functions do not interfere with a user variable called signgam for ISO C, with various choices for the size of that variable, whether it is initialized, and for static and dynamic linking. The conformtest whitelist entry is removed as well. Tested for x86_64, x86, mips64 and powerpc, including looking at objdump --dynamic-syms output to make sure the expected sets of symbols were aliases. Also spot-tested that a binary built with old glibc works properly (i.e. gets signgam set) when run with new glibc. [BZ #15421] * sysdeps/ieee754/s_signgam.c (signgam): Rename to __signgam, initialize with 0 and define as weak alias of __signgam. * include/math.h [!_ISOMAC] (__signgam): Declare. * math/Makefile (libm-calls): Add w_lgamma_compat. (tests): Add test-signgam-uchar, test-signgam-uchar-init, test-signgam-uint, test-signgam-uint-init, test-signgam-ullong and test-signgam-ullong-init. (tests-static): Add test-signgam-uchar-static, test-signgam-uchar-init-static, test-signgam-uint-static, test-signgam-uint-init-static, test-signgam-ullong-static and test-signgam-ullong-init-static. (CFLAGS-test-signgam-uchar.c): New variable. (CFLAGS-test-signgam-uchar-init.c): Likewise. (CFLAGS-test-signgam-uchar-static.c): Likewise. (CFLAGS-test-signgam-uchar-init-static.c): Likewise. (CFLAGS-test-signgam-uint.c): Likewise. (CFLAGS-test-signgam-uint-init.c): Likewise. (CFLAGS-test-signgam-uint-static.c): Likewise. (CFLAGS-test-signgam-uint-init-static.c): Likewise. (CFLAGS-test-signgam-ullong.c): Likewise. (CFLAGS-test-signgam-ullong-init.c): Likewise. (CFLAGS-test-signgam-ullong-static.c): Likewise. (CFLAGS-test-signgam-ullong-init-static.c): Likewise. * math/Versions (libm): Add GLIBC_2.23. * math/lgamma-compat.h: New file. * math/test-signgam-main.c: Likewise. * math/test-signgam-uchar-init-static.c: Likewise. * math/test-signgam-uchar-init.c: Likewise. * math/test-signgam-uchar-static.c: Likewise. * math/test-signgam-uchar.c: Likewise. * math/test-signgam-uint-init-static.c: Likewise. * math/test-signgam-uint-init.c: Likewise. * math/test-signgam-uint-static.c: Likewise. * math/test-signgam-uint.c: Likewise. * math/test-signgam-ullong-init-static.c: Likewise. * math/test-signgam-ullong-init.c: Likewise. * math/test-signgam-ullong-static.c: Likewise. * math/test-signgam-ullong.c: Likewise. * math/w_lgamma.c: Rename to w_lgamma_main.c and replace by wrapper of w_lgamma_main.c. * math/w_lgamma_compat.c: New file. * math/w_lgamma_compatf.c: Likewise. * math/w_lgamma_compatl.c: Likewise. * math/w_lgamma_main.c: New file. Based on w_lgamma.c. Include <lgamma-compat.h>. Condition contents on [BUILD_LGAMMA]. Support defining compatibility symbols. (__lgamma): Change to LGFUNC (__lgamma). Use CALL_LGAMMA. * math/w_lgammaf.c: Rename to w_lgammaf_main.c and replace by wrapper of w_lgammaf_main.c. * math/w_lgammaf_main.c: New file. Based on w_lgammaf.c. Include <lgamma-compat.h>. Condition contents on [BUILD_LGAMMA]. Support defining compatibility symbols. (__lgammaf): Change to LGFUNC (__lgammaf). Use CALL_LGAMMA. * math/w_lgammal.c: Rename to w_lgammal_main.c and replace by wrapper of w_lgammal_main.c. * math/w_lgammal_main.c: New file. Based on w_lgammal.c. Include <lgamma-compat.h>. Condition contents on [BUILD_LGAMMA]. Support defining compatibility symbols. (__lgammal): Change to LGFUNC (__lgammal). Use CALL_LGAMMA. * sysdeps/ia64/fpu/lgamma-compat.h: New file. * sysdeps/ia64/fpu/w_lgamma.c: Move to .... * sysdeps/ia64/fpu/w_lgamma_main.c: ...here. Include <lgamma-compat.h>. (__ieee754_lgamma): Change to LGFUNC (lgamma). Use CALL_LGAMMA. (__ieee754_gamma): Define as alias. * sysdeps/ia64/fpu/w_lgammaf.c: Move to .... * sysdeps/ia64/fpu/w_lgammaf_main.c: ...here. Include <lgamma-compat.h>. (__ieee754_lgammaf): Change to LGFUNC (lgammaf). Use CALL_LGAMMA. (__ieee754_gammaf): Define as alias. * sysdeps/ia64/fpu/w_lgammal.c: Move to .... * sysdeps/ia64/fpu/w_lgammal_main.c: ...here. Include <lgamma-compat.h>. (__ieee754_lgammal): Change to LGFUNC (lgammal). Use CALL_LGAMMA. (__ieee754_gammal): Define as alias. * sysdeps/ieee754/ldbl-opt/w_lgamma.c: Move to .... * sysdeps/ieee754/ldbl-opt/w_lgamma_compat.c: ...here. Include <math/w_lgamma_compat.c>. [LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (__lgammal_dbl_compat): Define as alias of __lgamma_compat and use in defining lgammal. * sysdeps/ieee754/ldbl-opt/w_lgammal.c: Move to .... * sysdeps/ieee754/ldbl-opt/w_lgamma_compatl.c: ...here. Include <math/lgamma-compat.h> and <math/w_lgamma_compatl.c>. (USE_AS_COMPAT): New macro. (LGAMMA_OLD_VER): Undefine and redefine. (lgammal): Do not define here. (gammal): Only define here if [GAMMA_ALIAS]. * conform/linknamespace.pl (@whitelist): Remove signgam. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Remove signal handling for nanosleep (bug 16364)Adhemerval Zanella2015-11-202-158/+0
| | | | | | | | | | | | | | | | | | | | | | Linux 2.6.32 and forward do not show the issue regarding SysV SIGCHLD vs. SIG_IGN for nanosleep which make it feasible to use it for sleep implementation without requiring any hacking to handle the spurious wake up. The issue is likely being fixed before 2.6 and git history [1] [2]. This patch simplifies the sleep code to call nanosleep directly by using the posix default version. It also removes the early cancellation tests for zero argument, since nanosleep will handle cancellation in this case. [1] https://lkml.org/lkml/2004/11/25/5 [2] https://lkml.org/lkml/2003/11/8/50 Checked on x86_64, ppc64le, and aarch64. [BZ #16364] * sysdeps/unix/sysv/linux/sleep.c: Remove file * sysdeps/posix/sleep.c (__sleep): Simplify cancellation handling.
* S390: Use __asm__ instead of asm.Stefan Liebler2015-11-2041-453/+453
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sysdeps/s390/fpu/bits/mathinline.h: Use __asm__ [__volatile__] instead of asm [volatile]. * sysdeps/s390/abort-instr.h: Likewise. * sysdeps/s390/atomic-machine.h: Likewise. * sysdeps/s390/bits/string.h: Likewise. * sysdeps/s390/dl-tls.h: Likewise. * sysdeps/s390/fpu/e_sqrt.c: Likewise. * sysdeps/s390/fpu/e_sqrtf.c: Likewise. * sysdeps/s390/fpu/e_sqrtl.c: Likewise. * sysdeps/s390/fpu/fesetround.c: Likewise. * sysdeps/s390/fpu/fpu_control.h: Likewise. * sysdeps/s390/fpu/s_fma.c: Likewise. * sysdeps/s390/fpu/s_fmaf.c: Likewise. * sysdeps/s390/memusage.h: Likewise. * sysdeps/s390/multiarch/ifunc-resolve.h: Likewise. * sysdeps/s390/nptl/pthread_spin_lock.c: Likewise. * sysdeps/s390/nptl/pthread_spin_trylock.c: Likewise. * sysdeps/s390/nptl/pthread_spin_unlock.c: Likewise. * sysdeps/s390/nptl/tls.h: Likewise. * sysdeps/s390/s390-32/__longjmp.c: Likewise. * sysdeps/s390/s390-32/backtrace.c: Likewise. * sysdeps/s390/s390-32/dl-machine.h: Likewise. * sysdeps/s390/s390-32/multiarch/memcmp.c: Likewise. * sysdeps/s390/s390-32/stackguard-macros.h: Likewise. * sysdeps/s390/s390-32/tls-macros.h: Likewise. * sysdeps/s390/s390-64/__longjmp.c: Likewise. * sysdeps/s390/s390-64/backtrace.c: Likewise. * sysdeps/s390/s390-64/dl-machine.h: Likewise. * sysdeps/s390/s390-64/iso-8859-1_cp037_z900.c: Likewise. * sysdeps/s390/s390-64/multiarch/memcmp.c: Likewise. * sysdeps/s390/s390-64/stackguard-macros.h: Likewise. * sysdeps/s390/s390-64/tls-macros.h: Likewise. * sysdeps/s390/s390-64/utf16-utf32-z9.c: Likewise. * sysdeps/s390/s390-64/utf8-utf16-z9.c: Likewise. * sysdeps/s390/s390-64/utf8-utf32-z9.c: Likewise. * sysdeps/unix/sysv/linux/s390/brk.c: Likewise. * sysdeps/unix/sysv/linux/s390/elision-trylock.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/sysconf.c: Likewise.
* powerpc: Spinlock optimization and cleanupPaul Murphy2015-11-193-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch optimizes powerpc spinlock implementation by: * Use the correct EH hint bit on the larx for supported ISA. For lock acquisition, the thread that acquired the lock with a successful stcx does not want to give away the write ownership on the cacheline. The idea is to make the load reservation "sticky" about retaining write authority to the line. That way, the store that must inevitably come to release the lock can succeed quickly and not contend with other threads issuing lwarx. If another thread does a store to the line (false sharing), the winning thread must give up write authority to the proper value of EH for the larx for a lock acquisition is 1. * Increase contented lock performance by up to 40%, and no measurable impact on uncontended locks on P8. Thanks to Adhemerval Zanella who did most of the work. I've run some tests, and addressed some minor feedback. * sysdeps/powerpc/nptl/pthread_spin_lock.c (pthread_spin_lock): Add lwarx hint, and use macro for acquire instruction. * sysdeps/powerpc/nptl/pthread_spin_trylock.c (pthread_spin_trylock): Likewise. * sysdep/unix/sysv/linux/powerpc/pthread_spin_unlock.c: Move to ... * sysdeps/powerpc/nptl/pthread_spin_unlock.c: ... here, and update to use new atomic macros.
* powerpc: More elision improvementsPaul Murphy2015-11-192-10/+13
| | | | | | | | | | | | | | | | | | | | | | | __lll_trylock_elision sets the adapt_count variable too aggressively, and incorrectly on persistent aborts. Taking a cue from s390, adapt_count is only updated if the lock is locked, or a persistent failure occurs. In addition, the abort codes have been renumbered and refactored for clarity. As it stands, glibc only cares if the abort is persistent or not. All aborts are now persistent, excepting a busy lock. This includes changing _ABORT_NESTED_TRYLOCK into a persistent abort. * sysdeps/unix/sysv/linux/powerpc/elision-trylock.c (__lll_trylock_elision): Fix setting of adapt_count. * sysdeps/unix/sysv/linux/powerpc/htm.h (_ABORT_PERSISTENT): Define to clarify persistent aborts. (_ABORT_NESTED_TRYLOCK): Renumber, and make persistent. (_ABORT_SYSCALL): Renumber, and clarify definition. (_ABORT_LOCK_BUSY): Renumber, make non-persistent.
* Shuffle includes in ldbl-128ibm/mpn2ldl.cPaul Murphy2015-11-191-2/+6
| | | | | | | | | | | Kind of hokey, but errno.h drags in misc/sys/param.h which defines MIN/MAX causing an error. Include system headers first to grab MIN/MAX definition in param.h, and define HAVE_ALLOCA to preserve existing behavior. * sysdeps/ieee754/ldbl-128ibm/mpn2ldl.c: Include gmp headers after system headers to prevent MIN/MAX redefinition. Define HAVE_ALLOCA to preserve builtin alloca usage.
* Include s_sin.c in s_sincos.cSiddhesh Poyarekar2015-11-172-19/+20
| | | | | | | | | | | | | | Include the __sin and __cos functions as local static copies to allow deper optimization of the functions. This change shows an improvement of about 17% in the min case and 12.5% in the mean case for the sincos microbenchmark on x86_64. * sysdeps/ieee754/dbl-64/s_sin.c (__sin)[IN_SINCOS]: Mark function static and don't set or restore rounding. (__cos)[IN_SINCOS]: Likewise. * sysdeps/ieee754/dbl-64/s_sincos.c: Include s_sin.c. (__sincos): Set and restore rounding mode. Remove check for infinite or NaN input.
* Remove redundant else clauses in s_sin.cSiddhesh Poyarekar2015-11-171-186/+158
| | | | | Makes the code easier to read due to the reduced nesting. The generated binary is unchanged.
* Run tst-prelink test for GLOB_DAT relocH.J. Lu2015-11-143-46/+0
| | | | | | | | | | | | | | | | | | | | | | | Run tst-prelink test on targets with GLOB_DAT relocaton. * config.make.in (have-glob-dat-reloc): New. * configure.ac (libc_cv_has_glob_dat): New. Set to yes if target supports GLOB_DAT relocaton. AC_SUBST. * configure: Regenerated. * elf/Makefile (tests): Add tst-prelink. (tests-special): Add $(objpfx)tst-prelink-cmp.out. (tst-prelink-ENV): New. ($(objpfx)tst-prelink-conflict.out): Likewise. ($(objpfx)tst-prelink-cmp.out): Likewise. * sysdeps/x86/tst-prelink.c: Moved to ... * elf/tst-prelink.c: Here. * sysdeps/x86/tst-prelink.exp: Moved to ... * elf/tst-prelink.exp: Here. * sysdeps/x86/Makefile (tests): Don't add tst-prelink. (tst-prelink-ENV): Removed. ($(objpfx)tst-prelink-conflict.out): Likewise. ($(objpfx)tst-prelink-cmp.out): Likewise. (tests-special): Don't add $(objpfx)tst-prelink-cmp.out.
* Fix ldbl-128ibm strtold overflow handling (bug 14551).Joseph Myers2015-11-133-0/+99
| | | | | | | | | | | | | | | | | | | | | | | | For ldbl-128ibm, if the result of strtold overflows in the final conversion from MPN to IBM long double (because the exponent for a 106-bit IEEE result is 1023 but the high part would end up as 0x1p1024, which overflows), that conversion code fails to handle this and produces an invalid long double value (high part infinite, low part not zero) without raising exceptions or setting errno. This patch adds an explicit check for this case to ensure an appropriate result is returned in a way that ensures the right exceptions are raised, with errno set. Tested for powerpc. [BZ #14551] * sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c: Include <errno.h>. (__mpn_construct_long_double): If high part overflows to infinity, set errno and recompute overflowed result of the correct sign. * sysdeps/ieee754/ldbl-128ibm/Makefile [$(subdir) = stdlib] (tests): Add tst-strtold-ldbl-128ibm. [$(subdir) = stdlib] ($(objpfx)tst-strtold-ldbl-128ibm): Depend on $(libm). * sysdeps/ieee754/ldbl-128ibm/tst-strtold-ldbl-128ibm.c: New file.
* Fix powerpc round, roundf spurious "inexact" (bug 19238).Joseph Myers2015-11-124-12/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The powerpc hard-float round and roundf functions, both 32-bit and 64-bit, raise spurious "inexact" exceptions for integer arguments from adding 0.5 and rounding to integer toward zero. Since these functions already save and restore the rounding mode, it's natural to make them restore the full floating-point state instead to fix this bug, which this patch does. The save of the state is moved after the first floating-point operation on the input so that any "invalid" exceptions from signaling NaN inputs are properly preserved. As a consequence of this approach to the fix, "inexact" for noninteger arguments (disallowed by TS 18661-1 but not by C99/C11, see bug 15479) is also avoided for these implementations; this is *not* a general fix for bug 15479 since plenty of other implementations of various functions still raise spurious "inexact" for noninteger arguments. This issue and fix do not apply to builds using power5+ versions of round and roundf, which use the frin instruction and avoid "inexact" exceptions that way. This patch should get hard-float powerpc32 and powerpc64 (default function implementations) back to a state where test-float and test-double will pass after ulps regeneration. Tested for powerpc32 and powerpc64. [BZ #15479] [BZ #19238] * sysdeps/powerpc/powerpc32/fpu/s_round.S (__round): Save floating-point state after first operation on input. Restore full state rather than just rounding mode. * sysdeps/powerpc/powerpc32/fpu/s_roundf.S (__roundf): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_round.S (__round): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_roundf.S (__roundf): Likewise.
* Fix powerpc64 lround, lroundf, llround, llroundf spurious "inexact" ↵Joseph Myers2015-11-122-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | exceptions (bug 19235). Similar to bug 19134 for powerpc32, the powerpc64 implementations of lround, lroundf, llround, llroundf can raise spurious "inexact" exceptions for integer arguments from adding 0.5 then converting to integer (this does not apply to the power5+ version for double, which uses the frin instruction which is defined never to raise "inexact"; I don't know why power5+ doesn't use that version for float as well). This patch fixes the bug in a similar way to the powerpc32 bug, by testing for integers (adding and subtracting 2^52 and comparing with the value before that addition and subtraction) and not adding 0.5 in that case. The powerpc maintainers may wish to look at making power5+ / power6x / power8 use frin for float lround / llround as well as for double, unless there's some reason I've missed that this isn't beneficial. Tested for powerpc64. [BZ #19235] * sysdeps/powerpc/powerpc64/fpu/s_llround.S (__llround): Do not add 0.5 to integer arguments. * sysdeps/powerpc/powerpc64/fpu/s_llroundf.S (__llroundf): Likewise. (.LC2): New object.
* NaCl: Use open_resource API for shared objectsRoland McGrath2015-11-103-1/+64
|
* Fix powerpc nearbyint wrongly clearing "inexact" and leaving traps disabled ↵Joseph Myers2015-11-114-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (bug 19228). Similar to bug 15491 recently fixed for x86_64 / x86, the powerpc (both powerpc32 and powerpc64) hard-float implementations of nearbyintf and nearbyint wrongly clear an "inexact" exception that was raised before the function was called; this shows up as failure of the test math/test-nearbyint-except added when that bug was fixed. They also wrongly leave traps on "inexact" disabled if they were enabled before the function was called. This patch fixes the bugs similar to how the x86 bug was fixed: saving and restoring the whole floating-point state, both to restore the original "inexact" flag state and to restore the original state of whether traps on "inexact" were enabled. Because there's a convenient point in the powerpc implementations to save state after any sNaN arguments will have raised "invalid" but before "inexact" traps need to be disabled, no special handling for "invalid" is needed as in the x86 version. Tested for powerpc64 and powerpc32, where it fixes the math/test-nearbyint-except failure as well as fixing the new test math/test-nearbyint-except-2 added by this patch. Also tested for x86_64 and x86 that the new test passes. If powerpc experts see a more efficient way of doing this (e.g. instruction positioning that's better for pipelines on typical processors) then of course followups optimizing the fix are welcome. [BZ #19228] * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S (__nearbyint): Save and restore full floating-point state. * sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S (__nearbyintf): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S (__nearbyint): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S (__nearbyintf): Likewise. * math/test-nearbyint-except-2.c: New file. * math/Makefile (tests): Add test-nearbyint-except-2.
* Add a test for prelink outputH.J. Lu2015-11-103-0/+46
| | | | | | | | | | | | | | This test applies to i386 and x86_64 which set R_386_GLOB_DAT and R_X86_64_GLOB_DAT to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA. [BZ #19178] * sysdeps/x86/Makefile (tests): Add tst-prelink. (tst-prelink-ENV): New. ($(objpfx)tst-prelink-conflict.out): Likewise. ($(objpfx)tst-prelink-cmp.out): Likewise. (tests-special): Add $(objpfx)tst-prelink-cmp.out. * sysdeps/x86/tst-prelink.c: New file. * sysdeps/x86/tst-prelink.exp: Likewise.
* Fix nearbyintl linkage for ia64 (bug 19219)Adhemerval Zanella2015-11-101-2/+3
| | | | | | | | | | | | | GLIBC fails to build for ia64 since commit d0d286d32dda654f8983e8fe77bca0a2cda2051b. It is because this commit uses the internal definition for nearbyintl, but ia64 specialized implementation (sysdeps/ia64/fpu/s_nearbyintl.S) does not define it. Tested with a ia64 build. [BZ #19219] * sysdeps/ia64/fpu/s_nearbyintl.S (__nearbyint): Define and weak_alias to nearbyintl.
* Enable _STRING_ARCH_unaligned on AArch64.Wilco Dijkstra2015-11-101-0/+24
| | | | | * sysdeps/aarch64/bits/string.h: New file. (_STRING_ARCH_unaligned): Define.
* Remove __signbit* from localplt.data as they are no longer called from ↵Wilco Dijkstra2015-11-105-17/+0
| | | | | | | | | | within GLIBC. * sysdeps/unix/sysv/linux/aarch64/localplt.data: Remove __signbit*. * sysdeps/unix/sysv/linux/arm/localplt.data: Likewise. * sysdeps/unix/sysv/linux/microblaze/localplt.data: Likewise. * sysdeps/unix/sysv/linux/nios2/localplt.data: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/localplt.data: Likewise.
* ld.so: Add original DSO name if overridden by audit module [BZ #18251]Florian Weimer2015-11-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * elf/dl-load.c (_dl_map_object_from_fd): Add additional parameter for original name of the DSO. Add it to the name list of the DSO if it is actually given. (_dl_map_object): Keep track of whether an audit module rewrote the file name. If yes, pass the original name to _dl_map_object_from_fd in a new parameter, otherwise NULL. When debugging is enabled, log the change of the file name. * sysdeps/mach/hur/dl-sysdep.c: Adjust commented-out call to _dl_map_object_from_fd. * elf/Makefile: Build and run tst-audit11 and tst-audit12. * elf/tst-audit11.c: New file * elf/tst-auditmod11.c: New file. * elf/tst-audit11mod1.c: New file. * elf/tst-audit11mod2.c: New file. * elf/tst-audit11mod2.map: New file. * elf/tst-audit12.c: New file * elf/tst-auditmod12.c: New file. * elf/tst-audit12mod1.c: New file. * elf/tst-audit12mod2.c: New file. * elf/tst-audit12mod2.map: New file. * elf/tst-audit12mod3.c: New file.
* S390: Clean setjmp, longjmp, getcontext symbols.Stefan Liebler2015-11-095-30/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For each function setjmp, longjmp, getcontext, there exist a symbol <func> and a default/versioned symbol <func>@@GLIBC_2.x in the build obj-files. This is wrong because it should only exist an unversioned or a default-versioned symbol with the same name in an obj-file. Glibc can't be build with recent binutils. See the already fixed linker bug https://sourceware.org/bugzilla/show_bug.cgi?id=19073. Nevertheless, this patch cleans this up. Furthermore the BSD entry points setjmp, _setjmp were marked as weak, but should be strong as on other architectures. (see https://sourceware.org/ml/libc-alpha/2014-07/msg00568.html for an older discussion with Andreas Schwab) Some whitespace issues are corrected in sysdeps/s390/s390-64/setjmp.S, too. But there is no change in the assembler code. ChangeLog: * sysdeps/s390/longjmp.c (longjmp, _longjmp, siglongjmp): Don't create weak aliases, because versioned symbols are created later. * sysdeps/s390/s390-32/setjmp.S (setjmp, _setjmp): Remove weak and rename to an unique name in SHARED case due to existing versioned symbols. * sysdeps/s390/s390-64/setjmp.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S (getcontext): Create weak alias only in non SHARED case. * sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S: Likewise.
* S390: Call direct system calls for socket operations.Stefan Liebler2015-11-095-19/+30
| | | | | | | | | | | | | | | | | | | | | this patch calls direct system calls for socket operations in the same way as power does. The system calls were introduced in kernel commit https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=977108f89c989b1eeb5c8d938e1e71913391eb5f. There are no direct recv, send, accept syscalls available on s390. Thus recvfrom, sendto, accept4 are called instead of the socketcall by defining __ASSUME_*_FOR_*_SYSCALL macros. See recv.c, send.c, accept.c in sysdeps/unix/sysv/linux/ folder. The socketcalls in syscalls.list for s390-64 are removed. They were never used on s390x. ChangeLog: * sysdeps/unix/sysv/linux/s390/kernel-features.h: (__ASSUME_*_SYSCALL) Define new macros. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list: Remove socketcall syscalls. * sysdeps/unix/sysv/linux/accept.c (__libc_accept): Use accept4 if defined __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL. * sysdeps/unix/sysv/linux/recv.c (__libc_recv): Use recvfrom if defined __ASSUME_RECVFROM_FOR_RECV_SYSCALL. * sysdeps/unix/sysv/linux/send.c (__libc_send): Use sendto if defined __ASSUME_SENDTO_FOR_SEND_SYSCALL.
* Terminate process on invalid netlink response from kernel [BZ #12926]Florian Weimer2015-11-097-1/+121
| | | | | | | | | | | | | | | | | | | | | | | | | The recvmsg system calls for netlink sockets have been particularly prone to picking up unrelated data after a file descriptor race (where the descriptor is closed and reopened concurrently in a multi-threaded process, as the result of a file descriptor management issue elsewhere). This commit adds additional error checking and aborts the process if a datagram of unexpected length (without the netlink header) is received, or an error code which cannot happen due to the way the netlink socket is used. [BZ #12926] Terminate process on invalid netlink response. * sysdeps/unix/sysv/linux/netlinkaccess.h (__netlink_assert_response): Declare. * sysdeps/unix/sysv/linux/netlink_assert_response.c: New file. * sysdeps/unix/sysv/linux/Makefile [$(subdir) == inet] (sysdep_routines): Add netlink_assert_response. * sysdeps/unix/sysv/linux/check_native.c (__check_native): Call __netlink_assert_response. * sysdeps/unix/sysv/linux/check_pf.c (make_request): Likewise. * sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Likewise. * sysdeps/unix/sysv/linux/Versions (GLIBC_PRIVATE): Add __netlink_assert_response.
* Simplify the abilist formatFlorian Weimer2015-11-06360-92535/+91052
| | | | | | | | | | | | | | | The new format lists the version on each line, as in: VERSION SYMBOL TYPE [VALUE] This makes it easier to process the files with line-oriented tools. The abilist files were converted with this awk script: /^[^ ]/ { version = $1 } /^ / { print version, substr($0, 2) } And sorted under the "C" locale with sort.
* Add LFS support for fts functions (bug 11460)Mark Wielaard2015-11-0634-0/+220
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fts didn't have large-file support yet and fts.h had an #error preventing usage when _FILE_OFFSET_BITS was set. This required nasty workarounds for programs using fts with LFS. This patch implements LFS support for fts by adding FTS64 and FTENT64 variants plus fts64 functions. Which are simple aliases for 64bit off_t arches. Also includes a simple testcase for some of the fts functions with or without LFS enabled. [BZ #11460] * io/Makefile (routines): Add fts64. (tests): Add tst-fts and tst-fts-lfs. (CFLAGS-fts64.c): New. * io/Versions (GLIBC_2.23): New. * io/fts.c: Replace FTS with FTSOBJ, FTSENT with FTSENTRY. Use function defines FTS_OPEN, FTS_CLOSE, FTS_READ, FTS_SET and FTS_CHILDREN. Define FTSOBJ, FTSENTRY, FTS_OPEN, FTS_CLOSE, FTS_READ, FTS_SET, FTS_CHILDREN, INO_T, STAT and LSTAT if necessary. * io/fts.h (FTS64): New if _USE_LARGEFILE64. (FTSENT64): Likewise. (fts64_children): Likewise. (fts64_close): Likewise. (fts64_open): Likewise. (fts64_read): Likewise. (fts64_set): Likewise. * io/fts64.c: New file. * io/tst-fts.c: New test. * io/tst-fts-lfs.c: Likewise. * sysdeps/unix/sysv/linux/aarch64/libc.abilist (GLIBC_2.23): Add GLIBC_2.23, fts64_children, fts64_close, fts64_open, fts64_read and fts64_set. * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise. * sysdeps/wordsize-64/fts.c: New file. * sysdeps/wordsize-64/fts64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/fts.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/fts64.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/fts.c: likewise. * sysdeps/unix/sysv/linux/x86_64/x32/fts64.c: likewise.
* Fix i386/x86_64 log* (1) zero sign for -ffinite-math-only (bug 19213).Joseph Myers2015-11-057-7/+49
| | | | | | | | | | | | | | | | | | | | | For the -ffinite-math-only versions of various x86_64 and x86 log* functions, a zero result from log* (1) is returned with incorrect sign in round-downward mode. This patch fixes this in a similar way to the previous fixes for the non-*_finite versions of the functions. Tested for x86_64 and x86 (including an i586 build), together with a patch that will be applied separately to enable the main libm-test.inc tests for the finite-math-only functions. [BZ #19213] * sysdeps/i386/fpu/e_log.S (__log_finite): Ensure +0 is always returned for argument 1. * sysdeps/i386/fpu/e_logf.S (__logf_finite): Likewise. * sysdeps/i386/fpu/e_logl.S (__logl_finite): Likewise. * sysdeps/i386/i686/fpu/e_logl.S (__logl_finite): Likewise. * sysdeps/x86_64/fpu/e_log10l.S (__log10l_finite): Likewise. * sysdeps/x86_64/fpu/e_log2l.S (__log2l_finite): Likewise. * sysdeps/x86_64/fpu/e_logl.S (__logl_finite): Likewise.
* Remove miscellaneous GCC >= 4.7 version conditionals.Joseph Myers2015-11-044-47/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes miscellaneous __GNUC_PREREQ (4, 7) conditionals that are now dead. Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by the patch). * sysdeps/arm/atomic-machine.h [__GNUC_PREREQ (4, 7) && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4]: Change conditional to [__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4]. [__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 && !__GNUC_PREREQ (4, 7)]: Remove conditional code. [!__GNUC_PREREQ (4, 7) || !__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4]: Change conditional to [!__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4]. * sysdeps/i386/sysdep.h [__ASSEMBLER__ && __GNUC_PREREQ (4, 7)]: Change conditional to [__ASSEMBLER__]. [__ASSEMBLER__ && !__GNUC_PREREQ (4, 7)]: Remove conditional code. [!__ASSEMBLER__ && __GNUC_PREREQ (4, 7)]: Change conditional to [!__ASSEMBLER__]. [!__ASSEMBLER__ && !__GNUC_PREREQ (4, 7)]: Remove conditional code. * sysdeps/unix/sysv/linux/sh/atomic-machine.h (rNOSP): Remove conditional macro definitions. (__arch_compare_and_exchange_val_8_acq): Use "u" instead of rNOSP. (__arch_compare_and_exchange_val_16_acq): Likewise. (__arch_compare_and_exchange_val_32_acq): Likewise. (atomic_exchange_and_add): Likewise. (atomic_add): Likewise. (atomic_add_negative): Likewise. (atomic_add_zero): Likewise. (atomic_bit_set): Likewise. (atomic_bit_test_set): Likewise. * sysdeps/x86_64/atomic-machine.h [__GNUC_PREREQ (4, 7)]: Make code unconditional. [!__GNUC_PREREQ (4, 7)]: Remove conditional code.
* Add more libm tests (scalb*, signbit, sin, sincos, sinh, sqrt, tan, tanh, ↵Joseph Myers2015-11-041-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | tgamma, y0, y1, yn, significand). This patch improves the libm test coverage for a few more functions. Tested for x86_64 and x86. * math/auto-libm-test-in: Add more tests of sin, sincos, sinh, sqrt, tan, tanh, y0, y1 and yn. * math/auto-libm-test-out: Regenerated. * math/libm-test.inc (scalb_test_data): Add more tests. (scalbn_test_data): Likewise. (scalbln_test_data): Likewise. (signbit_test_data): Likewise. (sin_test_data): Likewise. (sincos_test_data): Likewise. (sinh_test_data): Likewise. (sqrt_test_data): Likewise. (tan_test_data): Likewise. (tanh_test_data): Likewise. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Likewise. (significand_test_data): Likewise. * sysdeps/i386/fpu/libm-test-ulps: Update.
* Fix dbl-64 remainder sign of zero result (bug 19201).Joseph Myers2015-11-031-0/+2
| | | | | | | | | | | | | | | | | | For some large arguments, the dbl-64 implementation of remainder gives zero results with the wrong sign, resulting from a subtraction that is mathematically correct but does not guarantee that a zero result has the sign of the first argument to remainder. This patch adds an appropriate check for this case, similar to other implementations of remainder in the case of equality, and adds tests of remainder on inputs already used to test remquo. Tested for x86_64 and x86. [BZ #19201] * sysdeps/ieee754/dbl-64/e_remainder.c (__ieee754_remainder): Check for zero remainder in case of large exponents and ensure correct sign of result in that case. * math/libm-test.inc (remainder_test_data): Add more tests.
* Make nextafter, nexttoward set errno (bug 6799).Joseph Myers2015-11-0214-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nextafter and nexttoward fail to set errno on overflow and underflow. This patch makes them do so in cases that should include all the cases where such errno setting is required by glibc's goals for when to set errno (but not all cases of underflow where the result is nonzero and so glibc's goals do not require errno setting). Tested for x86_64, x86, mips64 and powerpc. [BZ #6799] * math/s_nextafter.c: Include <errno.h>. (__nextafter): Set errno on overflow and underflow. * math/s_nexttowardf.c: Include <errno.h>. (__nexttowardf): Set errno on overflow and underflow. * sysdeps/i386/fpu/s_nextafterl.c: Include <errno.h>. (__nextafterl): Set errno on overflow and underflow. * sysdeps/i386/fpu/s_nexttoward.c: Include <errno.h>. (__nexttoward): Set errno on overflow and underflow. * sysdeps/i386/fpu/s_nexttowardf.c: Include <errno.h>. (__nexttowardf): Set errno on overflow and underflow. * sysdeps/ieee754/flt-32/s_nextafterf.c: Include <errno.h>. (__nextafterf): Set errno on overflow and underflow. * sysdeps/ieee754/ldbl-128/s_nextafterl.c: Include <errno.h>. (__nextafterl): Set errno on overflow and underflow. * sysdeps/ieee754/ldbl-128/s_nexttoward.c: Include <errno.h>. (__nexttoward): Set errno on overflow and underflow. * sysdeps/ieee754/ldbl-128/s_nexttowardf.c: Include <errno.h>. (__nexttowardf): Set errno on overflow and underflow. * sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c: Include <errno.h>. (__nextafterl): Set errno on overflow and underflow. * sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c: Include <errno.h>. (__nexttoward): Set errno on overflow and underflow. * sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c: Include <errno.h>. (__nexttowardf): Set errno on overflow and underflow. * sysdeps/ieee754/ldbl-96/s_nexttoward.c: Include <errno.h>. (__nexttoward): Set errno on overflow and underflow. * sysdeps/ieee754/ldbl-96/s_nexttowardf.c: Include <errno.h>. (__nexttowardf): Set errno on overflow and underflow. * sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c: Include <errno.h>. (__nldbl_nexttowardf): Set errno on overflow and underflow. * sysdeps/m68k/m680x0/fpu/s_nextafterl.c: Include <errno.h>. (__nextafterl): Set errno on overflow and underflow. * math/libm-test.inc (nextafter_test_data): Do not allow errno setting to be missing on overflow. Add more tests. (nexttoward_test_data): Likewise.
* Fix ldbl-128 log1pl (-qNaN) spurious "invalid" exception (bug 19189).Joseph Myers2015-10-291-2/+2
| | | | | | | | | | | | | | | The ldbl-128 version of log1pl raises a spurious "invalid" exception for a -qNaN argument. This patch fixes this by making the initial check for infinities and NaNs handle arguments of both signs in such a way that NaNs result in a NaN being returned (quietly if the input NaN was quiet) while +Inf results in +Inf being returned and -Inf results in a qNaN being returned with "invalid" exception raised. Tested for mips64. [BZ #19189] * sysdeps/ieee754/ldbl-128/s_log1pl.c (__log1pl): Make check for non-finite argument handle arguments with negative sign.
* Make drem an alias of remainder (bug 16171).Joseph Myers2015-10-2910-21/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The libm drem functions just call the corresponding __remainder functions. This patch removes the unnecessary wrappers by making them into weak aliases at the ELF level. Tested for x86_64, x86, mips64 and powerpc. [BZ #16171] * math/w_remainder.c (drem): Define as weak alias of __remainder. [NO_LONG_DOUBLE] (dreml): Define as weak alias of __remainder. * math/w_remainderf.c (dremf): Define as weak alias of __remainderf. * math/w_remainderl.c (dreml): Define as weak alias of __remainderl. * sysdeps/ia64/fpu/e_remainder.S (drem): Define as weak alias of __remainder. * sysdeps/ia64/fpu/e_remainderf.S (dremf): Define as weak alias of __remainderf. * sysdeps/ia64/fpu/e_remainderl.S (dreml): Define as weak alias of __remainderl. * sysdeps/ieee754/ldbl-opt/nldbl-remainder.c (dreml): Define as weak alias of remainderl. * sysdeps/ieee754/ldbl-opt/w_remainder.c [LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (__drem): Define as strong alias of __remainder. [LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (dreml): Use compat_symbol. * sysdeps/ieee754/ldbl-opt/w_remainderl.c (__dreml): Define as strong alias of __remainderl. (dreml): Use long_double_symbol. * math/Makefile (libm-calls): Remove w_drem. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Remove drem. (CFLAGS-nldbl-drem.c): Remove variable. (CFLAGS-nldbl-remainder.c): Add -fno-builtin-dreml. * math/w_drem.c: Remove file. * math/w_dremf.c: Likewise. * math/w_dreml.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-drem.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_drem.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_dreml.c: Likewise.
* Remove cpuid.h configure tests.Joseph Myers2015-10-294-92/+0
| | | | | | | | | | | | | | There are configure tests for the cpuid.h header for x86 / x86_64. GCC 4.3 and later install this header, so those tests are obsolete. This patch removes them. Tested for x86_64 and x86 (testsuite, and that installed shared libraries are unchanged by the patch). * sysdeps/i386/configure.ac (cpuid.h): Do not test for header. * sysdeps/i386/configure: Regenerated. * sysdeps/x86_64/configure.ac (cpuid.h): Do not test for header. * sysdeps/x86_64/configure: Regenerated.
* Handle more state in i386/x86_64 fesetenv (bug 16068).Joseph Myers2015-10-285-21/+407
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fenv_t should include architecture-specific floating-point modes and status flags. i386 and x86_64 fesetenv limit which bits they use from the x87 status and control words, when using saved state, and limit which parts of the state they set to fixed values, when using FE_DFL_ENV / FE_NOMASK_ENV. The following should be included but are excluded in at least some cases: status and masking for the "denormal operand" exception (which isn't part of FE_ALL_EXCEPT); precision control (explicitly mentioned in Annex F as something that counts as part of the floating-point environment); MXCSR FZ and DAZ bits (for FE_DFL_ENV and FE_NOMASK_ENV). This patch arranges for this extra state to be handled by fesetenv (and thereby by feupdateenv, which calls fesetenv). (Note that glibc functions using floating point are not generally expected to work correctly with non-default values of this state, especially precision control, but it is still logically part of the floating-point environment and should be handled as such by fesetenv. Changes to the state relating to subnormals ought generally to work with libm functions when the arguments aren't subnormal and neither are the expected results; that's a consequence of functions avoiding spurious internal underflows.) A question arising from this is whether FE_NOMASK_ENV should or should not mask the "denormal operand" exception. I decided it should mask that exception. This is the status quo - previously that exception could only be unmasked by direct manipulation of control registers (possibly via <fpu_control.h>). In addition, it means that use of FE_NOMASK_ENV leaves a floating-point environment the same as could be obtained by fesetenv (FE_DFL_ENV); feenableexcept (FE_ALL_EXCEPT);, rather than an environment in which an exception is unmasked that could only be masked again by using fesetenv with FE_DFL_ENV (or a previously saved environment) - this exception not being usable with other <fenv.h> functions because it's outside FE_ALL_EXCEPT. Tested for x86_64 and x86. [BZ #16068] * sysdeps/i386/fpu/fesetenv.c: Include <fpu_control.h>. (FE_ALL_EXCEPT_X86): New macro. (__fesetenv): Use FE_ALL_EXCEPT_X86 in most places instead of FE_ALL_EXCEPT. Ensure precision control is included in floating-point state. Ensure that FE_DFL_ENV and FE_NOMASK_ENV handle "denormal operand exception" and clear FZ and DAZ bits. * sysdeps/x86_64/fpu/fesetenv.c: Include <fpu_control.h>. (FE_ALL_EXCEPT_X86): New macro. (__fesetenv): Use FE_ALL_EXCEPT_X86 in most places instead of FE_ALL_EXCEPT. Ensure precision control is included in floating-point state. Ensure that FE_DFL_ENV and FE_NOMASK_ENV handle "denormal operand exception" and clear FZ and DAZ bits. * sysdeps/x86/fpu/test-fenv-sse-2.c: New file. * sysdeps/x86/fpu/test-fenv-x87.c: Likewise. * sysdeps/x86/fpu/Makefile [$(subdir) = math] (tests): Add test-fenv-x87 and test-fenv-sse-2. [$(subdir) = math] (CFLAGS-test-fenv-sse-2.c): New variable.
* Use C11 *_TRUE_MIN macros where applicable.Joseph Myers2015-10-284-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | C11 defines standard <float.h> macros *_TRUE_MIN for the least positive subnormal value of a type. Now that we build with -std=gnu11, we can use these macros in glibc. This patch replaces previous uses of the GCC predefines __*_DENORM_MIN__ (used in <float.h> to define *_TRUE_MIN), as well as *_DENORM_MIN references in comments. Tested for x86_64 and x86 (testsuite, and that installed shared libraries are unchanged by the patch). Also tested for powerpc that installed stripped shared libraries are unchanged by the patch. * math/libm-test.inc (min_subnorm_value): Use LDBL_TRUE_MIN, DBL_TRUE_MIN and FLT_TRUE_MIN instead of __LDBL_DENORM_MIN__, __DBL_DENORM_MIN__ and __FLT_DENORM_MIN__. * sysdeps/ieee754/dbl-64/s_fma.c (__fma): Refer to DBL_TRUE_MIN instead of DBL_DENORM_MIN in comment. * sysdeps/ieee754/ldbl-128/s_fmal.c (__fmal): Refer to LDBL_TRUE_MIN instead of LDBL_DENORM_MIN in comment. * sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c: Include <float.h>. (__nextafterl): Use LDBL_TRUE_MIN instead of __LDBL_DENORM_MIN__. * sysdeps/ieee754/ldbl-96/s_fmal.c (__fmal): Refer to LDBL_TRUE_MIN instead of LDBL_DENORM_MIN in comment.
* Fix i386/x86_64 fesetenv SSE exception clearing (bug 19181).Joseph Myers2015-10-284-1/+55
| | | | | | | | | | | | | | | | | | | | | | | The i386 and x86_64 versions of fesetenv, when called with FE_DFL_ENV or FE_NOMASK_ENV as argument, do not clear SSE exceptions raised in MXCSR. These arguments should, like other fenv_t values, represent the whole of the floating-point state, so such exceptions should be cleared; this patch adds the required clearing. (Discovered while working on bug 16068.) Tested for x86_64 and x86. [BZ #19181] * sysdeps/i386/fpu/fesetenv.c (__fesetenv): Clear already-raised SSE exceptions when argument is FE_DFL_ENV or FE_NOMASK_ENV. * sysdeps/x86_64/fpu/fesetenv.c (__fesetenv): Likewise. * math/test-fenv-clear-main.c: New file. * math/test-fenv-clear.c: Likewise. * math/Makefile (tests): Add test-fenv-clear. * sysdeps/x86/fpu/test-fenv-clear-sse.c: New file. * sysdeps/x86/fpu/Makefile [$(subdir) = math] (tests): Add test-fenv-clear-sse. [$(subdir) = math] (CFLAGS-test-fenv-clear-sse.c): New variable.
* powerpc: Provide __tls_get_addr () in static libcCarlos Eduardo Seo2015-10-281-0/+32
| | | | | | | | | Since '--no-tls-optimize' is available for Power in ld, we need to provide __tls_get_addr () in static libc in order to avoid undefined references to this symbol when that flag is used. * sysdeps/powerpc/libc-tls.c: New file. Provides __tls_get_addr () in static libc.
* Remove -mavx2 configure tests.Joseph Myers2015-10-288-93/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | There are configure tests for the -mavx2 compiler option. AVX2 support was added in GCC 4.7, so these tests are now obsolete; this patch removes them. Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by the patch). * sysdeps/i386/configure.ac (libc_cv_cc_avx2): Remove configure test. * sysdeps/i386/configure: Regenerated. * sysdeps/x86_64/configure.ac (libc_cv_cc_avx2): Remove configure test. * sysdeps/x86_64/configure: Regenerated. * config.h.in (HAVE_AVX2_SUPPORT): Remove #undef. * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add memset-avx2 unconditionally instead of conditionally on [$(config-cflags-avx2) = yes]. * sysdeps/x86_64/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list) [HAVE_AVX2_SUPPORT]: Make code unconditional. * sysdeps/x86_64/multiarch/memset.S [HAVE_AVX2_SUPPORT]: Likewise. * sysdeps/x86_64/multiarch/memset_chk.S [IS_IN (libc) && SHARED && HAVE_AVX2_SUPPORT]: Change conditional to [IS_IN (libc) && SHARED].
* Remove configure test for ARM TLS descriptors support.Joseph Myers2015-10-273-49/+5
| | | | | | | | | | | | | | | | GCC 4.7 added support for ARM TLS descriptors. The binutils support is present in binutils 2.22. Thus, this patch removes the associated configure test as obsolete (leaving Makefile conditionals, as NaCl sets have-arm-tls-desc = no in its sysdeps fragment). Tested for ARM that installed shared libraries are unchanged by the patch. * sysdeps/arm/configure.ac (libc_cv_arm_tls_desc): Remove configure test. * sysdeps/arm/configure: Regenerated. * sysdeps/arm/Makefile [!have-arm-tls-desc] (have-arm-tls-desc): Define variable if not already defined.
* Remove MIPS16 atomics using __sync_* (bug 17404).Joseph Myers2015-10-271-26/+1
| | | | | | | | | | | | | | | MIPS16 atomics used __sync_* with GCC before 4.7, which as noted in bug 17404 is missing the required barrier semantics for atomic_exchange_rel. This patch removes the code in question as dead now GCC before 4.7 is no longer supported for building glibc. Sanity tested with builds for MIPS. [BZ #17404] * sysdeps/mips/atomic-machine.h [__GNUC_PREREQ (4, 8) || (__mips16 && __GNUC_PREREQ (4, 7))]: Change conditional to [__GNUC_PREREQ (4, 8) || __mips16]. [__mips16 && !__GNUC_PREREQ (4, 7)]: Remove conditional code.
* Remove GCC version conditionals on -Wmaybe-uninitialized pragmas.Joseph Myers2015-10-276-24/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One common case of __GNUC_PREREQ (4, 7) conditionals is use of diagnostic control pragmas for -Wmaybe-uninitialized, an option introduced in GCC 4.7 where older GCC needed -Wuninitialized to be controlled instead if the warning appeared with older GCC. This patch removes such conditionals. (There remain several older uses of -Wno-uninitialized in makefiles that still need to be converted to diagnostic control pragmas if the issue is still present with current sources and supported GCC versions, and it's likely that in most cases those pragmas also will end up controlling -Wmaybe-uninitialized.) Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by the patch, except for libresolv since res_send.c contains assertions whose line numbers are changed by the patch). * resolv/res_send.c (send_vc) [__GNUC_PREREQ (4, 7)]: Make code unconditional. * soft-fp/fmadf4.c [__GNUC_PREREQ (4, 7)]: Likewise. [!__GNUC_PREREQ (4, 7)]: Remove conditional code. * soft-fp/fmasf4.c [__GNUC_PREREQ (4, 7)]: Make code unconditional. [!__GNUC_PREREQ (4, 7)]: Remove conditional code. * soft-fp/fmatf4.c [__GNUC_PREREQ (4, 7)]: Make code unconditional. [!__GNUC_PREREQ (4, 7)]: Remove conditional code. * stdlib/setenv.c [((__GNUC__ << 16) + __GNUC_MINOR__) >= ((4 << 16) + 7)]: Make code unconditional. [!(((__GNUC__ << 16) + __GNUC_MINOR__) >= ((4 << 16) + 7))]: Remove conditional code. * sysdeps/ieee754/dbl-64/e_lgamma_r.c (__ieee754_lgamma_r) [__GNUC_PREREQ (4, 7)]: Make code unconditional. (__ieee754_lgamma_r) [!__GNUC_PREREQ (4, 7)]: Remove conditional code. * sysdeps/ieee754/flt-32/e_lgammaf_r.c (__ieee754_lgammaf_r) [__GNUC_PREREQ (4, 7)]: Make code unconditional. (__ieee754_lgammaf_r) [!__GNUC_PREREQ (4, 7)]: Remove conditional code. * sysdeps/ieee754/ldbl-128/k_tanl.c (__kernel_tanl) [__GNUC_PREREQ (4, 7)]: Make code unconditional. (__kernel_tanl) [!__GNUC_PREREQ (4, 7)]: Remove conditional code. * sysdeps/ieee754/ldbl-128ibm/k_tanl.c (__kernel_tanl) [__GNUC_PREREQ (4, 7)]: Make code unconditional. (__kernel_tanl) [!__GNUC_PREREQ (4, 7)]: Remove conditional code. * sysdeps/ieee754/ldbl-96/e_lgammal_r.c (__ieee754_lgammal_r) [__GNUC_PREREQ (4, 7)]: Make code unconditional. (__ieee754_lgammal_r) [!__GNUC_PREREQ (4, 7)]: Remove conditional code. * sysdeps/ieee754/ldbl-96/k_tanl.c (__kernel_tanl) [__GNUC_PREREQ (4, 7)]: Make code unconditional. (__kernel_tanl) [!__GNUC_PREREQ (4, 7)]: Remove conditional code.
* Remove sysdeps/nptl/configure.ac.Joseph Myers2015-10-273-117/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | sysdeps/nptl/configure.ac tests for forced unwind support and the C cleanup attribute, giving errors if either is unsupported. It does nothing beyond running those two tests. Both the attribute, and _Unwind_GetCFA which is used in the forced unwind test, were added in GCC 3.3. Thus these tests are long obsolete, and this patch removes the configure fragment running them, along with associated conditionals. Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by the patch). * sysdeps/nptl/configure.ac: Remove file. * sysdeps/nptl/configure: Remove generated file. * configure.ac (libc_cv_forced_unwind): Do not substitute. * configure: Regenerated. * config.h.in (HAVE_FORCED_UNWIND): Remove #undef. * config.make.in (have-forced-unwind): Remove variable. * nptl/Makefile [$(have-forced-unwind) = yes]: Make code unconditional. * nptl/descr.h [HAVE_FORCED_UNWIND]: Likewise. * nptl/unwind.c [HAVE_FORCED_UNWIND]: Likewise. (__pthread_unwind) [!HAVE_FORCED_UNWIND]: Remove conditional code. * nptl/version.c [HAVE_FORCED_UNWIND]: Make code unconditional. * sysdeps/nptl/Makefile [$(have-forced-unwind) = yes]: Make code unconditional.
* powerpc: Fix usage of elision transient failure adapt paramPaul Murphy2015-10-272-12/+9
| | | | | | | | | | | | | | The skip_lock_out_of_tbegin_retries adaptive parameter was not being used correctly, nor as described. This prevents a fallback for all users of the lock if a transient abort occurs within the accepted number of retries. [BZ #19174] * sysdeps/powerpc/nptl/elide.h (__elide_lock): Fix usage of .skip_lock_out_of_tbegin_retries. * sysdeps/unix/sysv/linux/powerpc/elision-lock.c (__lll_lock_elision): Likewise, and respect a value of try_tbegin <= 0.
* x86_64: Regenerate ulps [BZ #19168]Florian Weimer2015-10-261-6/+6
| | | | This comes from running “make regen-ulps” on AMD Opteron 6272 CPUs.
* Add more libm tests (ilogb, is*, j0, j1, jn, lgamma, log*).Joseph Myers2015-10-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch improves the libm test coverage for a few more functions. Tested for x86_64 and x86. * math/auto-libm-test-in: Add more tests of log, log10, log1p and log2. * math/auto-libm-test-out: Regenerated. * math/libm-test.inc (MAX_EXP): New macro. (ilogb_test_data): Add more tests. (isfinite_test_data): Likewise. (isgreater_test_data): Likewise. (isgreaterequal_test_data): Likewise. (isinf_test_data): Likewise. (isless_test_data): Likewise. (islessequal_test_data): Likewise. (islessgreater_test_data): Likewise. (isnan_test_data): Likewise. (isnormal_test_data): Likewise. (issignaling_test_data): Likewise. (isunordered_test_data): Likewise. (j0_test_data): Likewise. (j1_test_data): Likewise. (jn_test_data): Likewise. (lgamma_test_data): Likewise. (log_test_data): Likewise. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (logb_test_data): Likewise. * sysdeps/x86_64/fpu/libm-test-ulps: Update.
* Fix j1, jn missing errno setting on underflow (bug 18611).Joseph Myers2015-10-239-7/+32
| | | | | | | | | | | | | | | | | | | | | | | | j1 and jn can underflow for small arguments, but fail to set errno when underflowing to 0. This patch fixes them to set errno in that case. Tested for x86_64, x86, mips64 and powerpc. [BZ #18611] * sysdeps/ieee754/dbl-64/e_j1.c (__ieee754_j1): Set errno and avoid excess range and precision on underflow. * sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn): Likewise. * sysdeps/ieee754/flt-32/e_j1f.c (__ieee754_j1f): Likewise. * sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_jnf): Likewise. * sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_j1l): Set errno on underflow. * sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_jnl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Likewise. * sysdeps/ieee754/ldbl-96/e_j1l.c (__ieee754_j1l): Likewise. * sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl): Likewise. * math/auto-libm-test-in: Do not allow missing errno setting for tests of j1 and jn. * math/auto-libm-test-out: Regenerated.
* Fix i386 / x86_64 nearbyint exception clearing (bug 15491).Joseph Myers2015-10-224-48/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementations of nearbyint functions using x87 floating point (i386 all versions, x86_64 long double only) use the fclex instruction, which clears any exceptions that were raised before the function was called. These functions must not clear exceptions that were raised before they were called. This patch fixes these functions to save and restore the whole floating-point environment (fnstenv / fldenv) as the way of avoiding raising "inexact" (recall that there isn't an x87 instruction for loading just the status word, so the whole environment has to be saved and loaded instead - the code already saved and loaded the control word, which is now obtained from the saved environment after this patch, to disable traps on "inexact"). In the case of the long double functions, any "invalid" exception from frndint (applied to a signaling NaN) needs merging into the saved state; this issue doesn't apply to the float and double functions because that exception would have been raised when the argument is loaded, before the environment is saved. [BZ #15491] * sysdeps/i386/fpu/s_nearbyint.S (__nearbyint): Save and restore floating-point environment instead of clearing all exceptions. * sysdeps/i386/fpu/s_nearbyintf.S (__nearbyintf): Likewise. * sysdeps/i386/fpu/s_nearbyintl.S (__nearbyintl): Likewise, merging in "invalid" exceptions from frndint. * sysdeps/x86_64/fpu/s_nearbyintl.S (__nearbyintl): Likewise. * math/test-nearbyint-except.c: New file. * math/Makefile (tests): Add test-nearbyint-except.