summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-09-25 14:42:18 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-09-25 14:42:18 +0000
commitaeb5b827c5f7ed858a5b15101d1a3893356cc6ba (patch)
tree5d8e4382197847df3cf875caac4994390b6f1094
parent598804b7d4191eddbaf24784c3b25a6c4d6f33cd (diff)
downloadeglibc2-aeb5b827c5f7ed858a5b15101d1a3893356cc6ba.tar.gz
Merge changes between r20391 and r20863 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@20864 7b3dc134-2b1b-0410-93df-9e9f96275f8d
-rw-r--r--libc/ChangeLog599
-rw-r--r--libc/Makeconfig59
-rw-r--r--libc/Makefile4
-rw-r--r--libc/NEWS14
-rw-r--r--libc/bits/libc-lock.h1
-rw-r--r--libc/catgets/Makefile4
-rwxr-xr-xlibc/catgets/test-gencat.sh5
-rw-r--r--libc/config.make.in1
-rwxr-xr-xlibc/configure120
-rw-r--r--libc/configure.in15
-rw-r--r--libc/crypt/md5test-giant.c2
-rw-r--r--libc/csu/libc-tls.c20
-rw-r--r--libc/debug/Makefile12
-rw-r--r--libc/elf/Makefile7
-rw-r--r--libc/elf/dl-tls.c7
-rw-r--r--libc/elf/elf.h9
-rw-r--r--libc/elf/rtld.c3
-rwxr-xr-xlibc/elf/tst-pathopt.sh5
-rwxr-xr-xlibc/elf/tst-rtld-load-self.sh46
-rw-r--r--libc/grp/Makefile2
-rw-r--r--libc/grp/tst_fgetgrent.sh5
-rw-r--r--libc/iconv/gconv_db.c12
-rw-r--r--libc/iconvdata/Makefile4
-rwxr-xr-xlibc/iconvdata/run-iconv-test.sh5
-rw-r--r--libc/include/rounding-mode.h65
-rw-r--r--libc/intl/Makefile12
-rwxr-xr-xlibc/intl/tst-gettext.sh5
-rw-r--r--libc/intl/tst-gettext2.sh5
-rwxr-xr-xlibc/intl/tst-gettext4.sh5
-rw-r--r--libc/intl/tst-gettext6.sh5
-rwxr-xr-xlibc/intl/tst-translit.sh5
-rw-r--r--libc/io/Makefile4
-rw-r--r--libc/io/ftwtest-sh19
-rw-r--r--libc/libio/Makefile19
-rw-r--r--libc/libio/fileops.c6
-rw-r--r--libc/libio/iogetdelim.c3
-rw-r--r--libc/libio/iogetline.c4
-rw-r--r--libc/libio/iogetwline.c4
-rw-r--r--libc/libio/iopopen.c11
-rw-r--r--libc/libio/libio.h30
-rw-r--r--libc/libio/libioP.h70
-rw-r--r--libc/libio/oldfileops.c6
-rw-r--r--libc/libio/oldiopopen.c11
-rwxr-xr-xlibc/libio/test-freopen.sh5
-rw-r--r--libc/libio/wfileops.c2
-rw-r--r--libc/localedata/ChangeLog30
-rw-r--r--libc/localedata/Makefile25
-rw-r--r--libc/localedata/gen-locale.sh5
-rw-r--r--libc/localedata/locales/es_DO4
-rw-r--r--libc/localedata/locales/es_GT4
-rw-r--r--libc/localedata/locales/es_HN4
-rw-r--r--libc/localedata/locales/es_MX4
-rw-r--r--libc/localedata/locales/es_NI4
-rw-r--r--libc/localedata/locales/es_PA4
-rw-r--r--libc/localedata/locales/es_PR4
-rw-r--r--libc/localedata/locales/es_SV4
-rw-r--r--libc/localedata/sort-test.sh19
-rwxr-xr-xlibc/localedata/tst-ctype.sh5
-rwxr-xr-xlibc/localedata/tst-fmon.sh5
-rwxr-xr-xlibc/localedata/tst-langinfo.sh5
-rwxr-xr-xlibc/localedata/tst-locale.sh5
-rwxr-xr-xlibc/localedata/tst-mbswcs.sh5
-rw-r--r--libc/localedata/tst-numeric.sh5
-rwxr-xr-xlibc/localedata/tst-rpmatch.sh4
-rwxr-xr-xlibc/localedata/tst-trans.sh5
-rwxr-xr-xlibc/localedata/tst-wctype.sh5
-rw-r--r--libc/malloc/Makefile8
-rw-r--r--libc/malloc/arena.c43
-rw-r--r--libc/malloc/hooks.c31
-rw-r--r--libc/malloc/malloc.c101
-rw-r--r--libc/malloc/mcheck.c5
-rw-r--r--libc/malloc/memusage.c8
-rw-r--r--libc/malloc/tst-malloc-usable.c49
-rwxr-xr-xlibc/malloc/tst-mtrace.sh5
-rw-r--r--libc/manual/arith.texi6
-rw-r--r--libc/manual/contrib.texi5
-rw-r--r--libc/manual/examples/inetcli.c2
-rw-r--r--libc/manual/memory.texi2
-rw-r--r--libc/manual/socket.texi2
-rw-r--r--libc/math/libm-test.inc21
-rw-r--r--libc/nptl/ChangeLog59
-rw-r--r--libc/nptl/Makefile13
-rw-r--r--libc/nptl/sysdeps/i386/tls.h4
-rw-r--r--libc/nptl/sysdeps/pthread/bits/libc-lockP.h12
-rw-r--r--libc/nptl/sysdeps/pthread/pthread.h2
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/pthread_getcpuclockid.c53
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/sem_post.c4
-rw-r--r--libc/nptl/sysdeps/x86_64/tls.h4
-rw-r--r--libc/nptl/tst-cancel21-static.c1
-rw-r--r--libc/nptl/tst-sem14.c91
-rwxr-xr-xlibc/nptl/tst-tls6.sh21
-rw-r--r--libc/ports/ChangeLog.alpha18
-rw-r--r--libc/ports/ChangeLog.arm10
-rw-r--r--libc/ports/ChangeLog.hppa13
-rw-r--r--libc/ports/ChangeLog.ia6410
-rw-r--r--libc/ports/ChangeLog.powerpc4
-rw-r--r--libc/ports/ChangeLog.tile11
-rw-r--r--libc/ports/sysdeps/alpha/fpu/get-rounding-mode.h35
-rw-r--r--libc/ports/sysdeps/alpha/fpu/libm-test-ulps575
-rw-r--r--libc/ports/sysdeps/alpha/fpu/s_isnan.c12
-rw-r--r--libc/ports/sysdeps/arm/bits/atomic.h2
-rw-r--r--libc/ports/sysdeps/arm/get-rounding-mode.h42
-rw-r--r--libc/ports/sysdeps/ia64/Makeconfig2
-rw-r--r--libc/ports/sysdeps/ia64/fpu/fegetround.c10
-rw-r--r--libc/ports/sysdeps/ia64/fpu/get-rounding-mode.h37
-rw-r--r--libc/ports/sysdeps/powerpc/nofpu/get-rounding-mode.h35
-rw-r--r--libc/ports/sysdeps/tile/__tls_get_addr.S2
-rw-r--r--libc/ports/sysdeps/tile/libm-test-ulps93
-rw-r--r--libc/ports/sysdeps/tile/sysdep.h4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/localplt.data6
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/setfpucw.c88
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/hppa/Versions2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/hppa/bits/errno.h10
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/hppa/syscalls.list2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/sys/procfs.h2
-rw-r--r--libc/posix/Makefile8
-rwxr-xr-xlibc/posix/globtest.sh19
-rw-r--r--libc/posix/tst-getconf.sh19
-rwxr-xr-xlibc/posix/wordexp-tst.sh21
-rwxr-xr-xlibc/scripts/check-local-headers.sh5
-rwxr-xr-xlibc/scripts/test-installation.pl7
-rw-r--r--libc/stdio-common/Makefile20
-rw-r--r--libc/stdio-common/printf_fp.c53
-rw-r--r--libc/stdio-common/printf_fphex.c40
-rw-r--r--libc/stdio-common/tst-printf-round.c234
-rw-r--r--libc/stdio-common/tst-printf.sh5
-rwxr-xr-xlibc/stdio-common/tst-unbputc.sh5
-rw-r--r--libc/stdlib/Makefile5
-rw-r--r--libc/stdlib/gen-tst-strtod-round.c24
-rw-r--r--libc/stdlib/strtod_l.c70
-rwxr-xr-xlibc/stdlib/tst-fmtmsg.sh5
-rw-r--r--libc/stdlib/tst-secure-getenv.c13
-rw-r--r--libc/stdlib/tst-strtod-overflow.c1
-rw-r--r--libc/stdlib/tst-strtod-round.c626
-rw-r--r--libc/sysdeps/generic/_G_config.h26
-rw-r--r--libc/sysdeps/generic/get-rounding-mode.h124
-rw-r--r--libc/sysdeps/generic/malloc-sysdep.h25
-rw-r--r--libc/sysdeps/gnu/_G_config.h28
-rw-r--r--libc/sysdeps/i386/fpu/libm-test-ulps11
-rw-r--r--libc/sysdeps/i386/i686/fpu/multiarch/Makefile2
-rw-r--r--libc/sysdeps/i386/i686/fpu/multiarch/e_expf.c18
-rw-r--r--libc/sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S553
-rw-r--r--libc/sysdeps/i386/i686/fpu/multiarch/s_cosf.c29
-rw-r--r--libc/sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S566
-rw-r--r--libc/sysdeps/i386/i686/fpu/multiarch/s_sinf.c28
-rw-r--r--libc/sysdeps/ieee754/flt-32/s_cosf.c11
-rw-r--r--libc/sysdeps/ieee754/flt-32/s_sinf.c11
-rw-r--r--libc/sysdeps/mach/bits/libc-lock.h1
-rw-r--r--libc/sysdeps/mach/hurd/_G_config.h28
-rw-r--r--libc/sysdeps/mach/hurd/bits/libc-lock.h2
-rw-r--r--libc/sysdeps/s390/fpu/get-rounding-mode.h37
-rw-r--r--libc/sysdeps/s390/s390-32/multiarch/Makefile6
-rw-r--r--libc/sysdeps/s390/s390-32/multiarch/ifunc-resolve.c11
-rw-r--r--libc/sysdeps/s390/s390-32/multiarch/memcmp.S2
-rw-r--r--libc/sysdeps/s390/s390-32/multiarch/memcpy.S2
-rw-r--r--libc/sysdeps/s390/s390-32/multiarch/memset.S2
-rw-r--r--libc/sysdeps/s390/s390-64/multiarch/ifunc-resolve.c8
-rw-r--r--libc/sysdeps/sparc/bits/hwcap.h3
-rw-r--r--libc/sysdeps/sparc/dl-procinfo.c4
-rw-r--r--libc/sysdeps/sparc/dl-procinfo.h2
-rw-r--r--libc/sysdeps/sparc/fpu/libm-test-ulps12
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/addmul_1.S1
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/mul_1.S1
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/submul_1.S1
-rw-r--r--libc/sysdeps/unix/sysv/linux/clock_getcpuclockid.c56
-rw-r--r--libc/sysdeps/unix/sysv/linux/clock_getres.c86
-rw-r--r--libc/sysdeps/unix/sysv/linux/clock_gettime.c94
-rw-r--r--libc/sysdeps/unix/sysv/linux/clock_settime.c54
-rw-r--r--libc/sysdeps/unix/sysv/linux/kernel-features.h3
-rw-r--r--libc/sysdeps/unix/sysv/linux/malloc-sysdep.h57
-rw-r--r--libc/sysdeps/unix/sysv/linux/ttyname.c6
-rw-r--r--libc/sysdeps/unix/sysv/linux/ttyname_r.c6
-rw-r--r--libc/sysdeps/wordsize-64/Makefile3
-rw-r--r--libc/sysdeps/wordsize-64/tst-writev.c5
-rw-r--r--libc/sysdeps/x86_64/Makefile2
-rw-r--r--libc/sysdeps/x86_64/dl-machine.h40
-rw-r--r--libc/sysdeps/x86_64/fpu/libm-test-ulps41
-rw-r--r--libc/sysdeps/x86_64/fpu/s_cosf.S527
-rw-r--r--libc/sysdeps/x86_64/fpu/s_sinf.S553
-rwxr-xr-xlibc/sysdeps/x86_64/tst-xmmymm.sh20
180 files changed, 6127 insertions, 1150 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog
index f72f4b41b..cea98d16a 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,602 @@
+2012-09-25 Joseph Myers <joseph@codesourcery.com>
+
+ * libio/libio.h (_IO_size_t): Define to size_t, not _G_size_t.
+ (_IO_ssize_t): Define to __ssize_t, not _G_ssize_t.
+ (_IO_off_t): Define to __off_t, not _G_off_t.
+ (_IO_pid_t): Define to __pid_t, not _G_pid_t.
+ (_IO_uid_t): Define to __uid_t, not _G_uid_t.
+ (_IO_wint_t): Define to wint_t, not _G_wint_t.
+ * libio/libioP.h (struct _IO_jump_t): Use size_t not _G_size_t as
+ type of __dummy and __dummy2 fields.
+ * sysdeps/generic/_G_config.h (_G_size_t): Remove.
+ (_G_ssize_t): Likewise.
+ (_G_off_t): Likewise.
+ (_G_pid_t): Likewise.
+ (_G_uid_t): Likewise.
+ (_G_wchar_t): Likewise.
+ (_G_wint_t): Likewise.
+ * sysdeps/gnu/_G_config.h (_G_size_t): Remove.
+ (_G_ssize_t): Likewise.
+ (_G_off_t): Likewise.
+ (_G_pid_t): Likewise.
+ (_G_uid_t): Likewise.
+ (_G_wchar_t): Likewise.
+ (_G_wint_t): Likewise.
+ * sysdeps/mach/hurd/_G_config.h (_G_size_t): Remove.
+ (_G_ssize_t): Likewise.
+ (_G_off_t): Likewise.
+ (_G_pid_t): Likewise.
+ (_G_uid_t): Likewise.
+ (_G_wchar_t): Likewise.
+ (_G_wint_t): Likewise.
+
+2012-09-25 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * malloc/arena.c: Include malloc-sysdep.h.
+ (shrink_heap): Use check_may_shrink_heap to decide if madvise
+ is sufficient to shrink the heap or an unmap is needed.
+ * sysdeps/generic/malloc-sysdep.h: New file. Define
+ new function check_may_shrink_heap.
+ * sysdeps/unix/sysv/linux/malloc-sysdep.h: New file. Define
+ new function check_may_shrink_heap.
+
+2012-09-25 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * libio/fileops.c (_IO_new_file_seekoff): Fix typos in
+ comments.
+
+2012-09-24 Dmitry V. Levin <ldv@altlinux.org>
+
+ * catgets/test-gencat.sh: Add "set -e".
+ * elf/tst-pathopt.sh: Likewise.
+ * grp/tst_fgetgrent.sh: Likewise.
+ * iconvdata/run-iconv-test.sh: Likewise.
+ * intl/tst-gettext.sh: Likewise.
+ * intl/tst-gettext2.sh: Likewise.
+ * intl/tst-gettext4.sh: Likewise.
+ * intl/tst-gettext6.sh: Likewise.
+ * intl/tst-translit.sh: Likewise.
+ * io/ftwtest-sh: Likewise.
+ * libio/test-freopen.sh: Likewise.
+ * malloc/tst-mtrace.sh: Likewise.
+ * posix/globtest.sh: Likewise.
+ * posix/tst-getconf.sh: Likewise.
+ * posix/wordexp-tst.sh: Likewise.
+ * stdio-common/tst-printf.sh: Likewise.
+ * stdio-common/tst-unbputc.sh: Likewise.
+ * stdlib/tst-fmtmsg.sh: Likewise.
+ * sysdeps/x86_64/tst-xmmymm.sh: Likewise.
+ * catgets/Makefile: Do not specify -e option when running
+ testsuite shell scripts.
+ * elf/Makefile: Likewise.
+ * grp/Makefile: Likewise.
+ * iconvdata/Makefile: Likewise.
+ * intl/Makefile: Likewise.
+ * io/Makefile: Likewise.
+ * libio/Makefile: Likewise.
+ * malloc/Makefile: Likewise.
+ * posix/Makefile: Likewise.
+ * stdio-common/Makefile: Likewise.
+ * stdlib/Makefile: Likewise.
+ * sysdeps/x86_64/Makefile: Likewise.
+
+ * io/ftwtest-sh: Add copyright header.
+ * posix/globtest.sh: Likewise.
+ * posix/tst-getconf.sh: Likewise.
+ * posix/wordexp-tst.sh: Likewise.
+ * sysdeps/x86_64/tst-xmmymm.sh: Likewise.
+
+2012-09-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #13679]
+ * Makeconfig (+link): Defined as $(+link-static) if
+ $(build-shared) isn't yes.
+ (link-tests): Defined as $(+link-static-tests) if $(build-shared)
+ isn't yes.
+ (static-gnulib): Add -lgcc_eh if $(build-shared) isn't yes.
+
+ * Makeconfig (+postctorT): Replace crtendS.o with crtend.o.
+
+ [BZ #14562]
+ * malloc/arena.c (heap_trim): Properly get fencepost and adjust
+ new chunk size with MALLOC_ALIGN_MASK.
+
+2012-09-24 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #5044]
+ * stdio-common/printf_fphex.c: Include <stdbool.h> and
+ <rounding-mode.h>.
+ (__printf_fphex): Determine rounding using get_rounding_mode and
+ round_away.
+ * stdio-common/tst-printf-round.c (struct hex_test): New
+ structure.
+ (hex_tests): New variable.
+ (test_hex_in_one_mode): New function.
+ (do_test): Also run tests for hex float output.
+
+2012-09-21 Joseph Myers <joseph@codesourcery.com>
+
+ * libio/iopopen.c [_IO_HAVE_SYS_WAIT]: Make code unconditional.
+ [!_IO_HAVE_SYS_WAIT]: Remove conditional code.
+ * libio/libio.h (_IO_HAVE_SYS_WAIT): Remove.
+ * libio/oldiopopen.c [_IO_HAVE_SYS_WAIT]: Make code unconditional.
+ [!_IO_HAVE_SYS_WAIT]: Remove conditional code.
+ * sysdeps/generic/_G_config.h (_G_HAVE_SYS_WAIT): Remove.
+ * sysdeps/gnu/_G_config.h (_G_HAVE_SYS_WAIT): Likewise.
+ * sysdeps/mach/hurd/_G_config.h (_G_HAVE_SYS_WAIT): Likewise.
+
+2012-09-20 Joseph Myers <joseph@codesourcery.com>
+
+ * libio/libio.h [_G_NEED_STDARG_H]: Make code unconditional.
+ * sysdeps/generic/_G_config.h (_G_NEED_STDARG_H): Remove.
+ * sysdeps/gnu/_G_config.h (_G_NEED_STDARG_H): Remove.
+ * sysdeps/mach/hurd/_G_config.h (_G_NEED_STDARG_H): Remove.
+
+2012-09-19 Dmitry V. Levin <ldv@altlinux.org>
+
+ [BZ #14579]
+ * elf/rtld.c (dl_main): Limit the check for self loading to normal
+ mode only.
+ * elf/tst-rtld-load-self.sh: New test.
+ * elf/Makefile: Run it.
+
+2012-09-18 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/wordsize-64/Makefile [$(subdir) = misc]
+ (tst-writev-ENV): Remove.
+ * sysdeps/wordsize-64/tst-writev.c (TIMEOUT): Define.
+
+2012-09-17 Chris Metcalf <cmetcalf@tilera.com>
+
+ * crypt/md5test-giant.c (TIMEOUT): Increase to 8 minutes for tilegx.
+
+2012-09-17 Joseph Myers <joseph@codesourcery.com>
+
+ * libio/iogetline.c [_LIBC || !_G_HAVE_IO_GETLINE_INFO]: Make code
+ unconditional.
+ * libio/iogetwline.c [_LIBC || !_G_HAVE_IO_GETLINE_INFO]:
+ Likewise.
+ * sysdeps/generic/_G_config.h (_G_HAVE_IO_GETLINE_INFO): Remove.
+ * sysdeps/gnu/_G_config.h (_G_HAVE_IO_GETLINE_INFO): Likewise.
+ * sysdeps/mach/hurd/_G_config.h (_G_HAVE_IO_GETLINE_INFO):
+ Likewise.
+
+2012-09-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14587]
+ * Makeconfig (ASFLAGS): Remove $(have-cpp-asm-debuginfo) check.
+ * config.make.in (have-cpp-asm-debuginfo): Removed.
+ * configure.in: Don't substitute libc_cv_cpp_asm_debuginfo.
+ * configure: Regenerated.
+
+2012-09-14 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #5044]
+ * stdio-common/printf_fp.c: Include <stdbool.h> and
+ <rounding-mode.h>.
+ (___printf_fp): Determine rounding using get_rounding_mode and
+ round_away.
+ * stdio-common/tst-printf-round.c: New file.
+ * stdio-common/Makefile (tests): Add tst-printf-round.
+ (link-libm): New variable.
+ ($(objpfx)tst-printf-round): Depend in $(link-libm).
+
+2012-09-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14576]
+ * bits/libc-lock.h (__rtld_lock_init_recursive): Removed.
+ * sysdeps/mach/bits/libc-lock.h (__rtld_lock_init_recursive):
+ Likewise.
+ * sysdeps/mach/hurd/bits/libc-lock.h (__rtld_lock_init_recursive):
+ Likewise.
+
+2012-09-13 Joseph Myers <joseph@codesourcery.com>
+
+ * libio/libio.h [!_G_HAVE_PRINTF_FP] (_IO_USE_DTOA): Remove.
+ * sysdeps/generic/_G_config.h (_G_HAVE_PRINTF_FP): Likewise.
+ * sysdeps/gnu/_G_config.h (_G_HAVE_PRINTF_FP): Likewise.
+ * sysdeps/mach/hurd/_G_config.h (_G_HAVE_PRINTF_FP): Likewise.
+
+2012-09-12 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #14518]
+ * include/rounding-mode.h: New file.
+ * sysdeps/generic/get-rounding-mode.h: Likewise.
+ * sysdeps/s390/fpu/get-rounding-mode.h: Likewise.
+ * stdlib/strtod_l.c: Include <rounding-mode.h>.
+ (MAX_VALUE): New macro.
+ (MIN_VALUE): Likewise.
+ (overflow_value): New function.
+ (underflow_value): Likewise.
+ (round_and_return): Use overflow_value and underflow_value to
+ determine return values in overflow and underflow cases. Use
+ round_away to determine rounding depending on rounding mode.
+ (____STRTOF_INTERNAL): Use overflow_value and underflow_value to
+ determine return values in overflow and underflow cases.
+ * stdlib/tst-strtod-round.c: Include <fenv.h>.
+ (struct test_results): New structure.
+ (struct test): Use struct test_results to store expected results
+ for all rounding modes.
+ (TEST): Include expected results for all rounding modes.
+ (test_in_one_mode): New function.
+ (do_test): Use test_in_one_mode to compute and check results.
+ Check results for all rounding modes.
+ * stdlib/Makefile ($(objpfx)tst-strtod-round): Depend on
+ $(link-libm).
+
+2012-12-09 Allan McRae <allan@archlinux.org>
+
+ * sysdeps/i386/fpu/libm-test-ulps: Update
+
+2012-09-11 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/generic/_G_config.h (_G_int16_t): Remove.
+ (_G_int32_t): Likewise.
+ (_G_uint16_t): Likewise.
+ (_G_uint32_t): Likewise.
+ (_G_HAVE_BOOL): Likewise.
+ (_G_HAVE_ATEXIT): Likewise.
+ (_G_HAVE_LONG_DOUBLE_IO): Likewise.
+ (_G_HAVE_IO_FILE_OPEN): Likewise.
+ * sysdeps/gnu/_G_config.h (_G_int16_t): Remove.
+ (_G_int32_t): Likewise.
+ (_G_uint16_t): Likewise.
+ (_G_uint32_t): Likewise.
+ (_G_HAVE_BOOL): Likewise.
+ (_G_HAVE_ATEXIT): Likewise.
+ (_G_HAVE_LONG_DOUBLE_IO): Likewise.
+ (_G_HAVE_IO_FILE_OPEN): Likewise.
+ * sysdeps/mach/hurd/_G_config.h (_G_int16_t): Remove.
+ (_G_int32_t): Likewise.
+ (_G_uint16_t): Likewise.
+ (_G_uint32_t): Likewise.
+ (_G_HAVE_BOOL): Likewise.
+ (_G_HAVE_ATEXIT): Likewise.
+ (_G_HAVE_LONG_DOUBLE_IO): Likewise.
+ (_G_HAVE_IO_FILE_OPEN): Likewise.
+
+2012-09-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ * csu/libc-tls.c: Update copyright years.
+
+2012-09-10 Joseph Myers <joseph@codesourcery.com>
+
+ * libioP.h [_G_USING_THUNKS]: Make code unconditional.
+ [!_G_USING_THUNKS]: Remove conditional code.
+ * sysdeps/gnu/_G_config.h (_G_USING_THUNKS): Remove.
+ * sysdeps/mach/hurd/_G_config.h (_G_USING_THUNKS): Likewise.
+
+ * libio/libioP.h [__GNUC__] (VTABLE_LABEL): Remove.
+ [!builtinbuf_vtable && __cplusplus] (builtinbuf_vtable): Likewise.
+ * sysdeps/generic/_G_config.h (_G_NAMES_HAVE_UNDERSCORE): Remove.
+ (_G_VTABLE_LABEL_PREFIX): Likewise.
+ (_G_VTABLE_LABEL_HAS_LENGTH): Likewise.
+ * sysdeps/gnu/_G_config.h (_G_NAMES_HAVE_UNDERSCORE): Remove.
+ (_G_VTABLE_LABEL_HAS_LENGTH): Likewise.
+ (_G_VTABLE_LABEL_PREFIX): Likewise.
+ (_G_VTABLE_LABEL_PREFIX_ID): Likewise.
+ * sysdeps/mach/hurd/_G_config.h (_G_NAMES_HAVE_UNDERSCORE): Remove.
+ (_G_VTABLE_LABEL_HAS_LENGTH): Likewise.
+ (_G_VTABLE_LABEL_PREFIX): Likewise.
+ (_G_VTABLE_LABEL_PREFIX_ID): Likewise.
+
+2012-09-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ * libio/Makefile: Include ../Makeconfig before tests.
+ (tests): Add tst-fopenloc and depend on $(objpfx)tst-fopenloc.check
+ only if $(build-shared) is yes.
+
+ * iconv/gconv_db.c: Update copyright years.
+
+2012-09-10 Liubov Dmitrieva <liubov.dmitrieva@gmail.com>
+
+ * sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S: Fix
+ unwind info if defined PIC. Fix special cases description.
+ * sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S: Likewise.
+
+ * sysdeps/x86_64/fpu/s_sinf.S: Fix special cases description, fix
+ DP_HI_MASK entry.
+ * sysdeps/x86_64/fpu/s_cosf.S: Likewise.
+
+2012-09-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ * scripts/check-local-headers.sh: Add "shopt -s nullglob".
+
+ * iconv/gconv_db.c (free_derivation): Check if deriv->steps
+ is NULL.
+
+ * debug/Makefile (LDFLAGS-tst-chk4): Renamed to ...
+ (LDLIBS-tst-chk4): This.
+ (LDFLAGS-tst-chk5): Renamed to ...
+ (LDLIBS-tst-chk5): This.
+ (LDFLAGS-tst-chk6): Renamed to ...
+ (LDLIBS-tst-chk6): This.
+ (LDFLAGS-tst-lfschk4): Renamed to ...
+ (LDLIBS-tst-lfschk4): This.
+ (LDFLAGS-tst-lfschk5): Renamed to ...
+ (LDLIBS-tst-lfschk5): This.
+ (LDFLAGS-tst-lfschk6): Renamed to ...
+ (LDLIBS-tst-lfschk6): This.
+
+ * Makefile ($(inst_includedir)/gnu/stubs.h): Remove dependency
+ on $(common-objpfx)soversions.mk.
+
+2012-09-07 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #10014]
+ * manual/examples/inetcli.c (SERVERHOST): Use www.gnu.org as
+ example host name.
+
+2012-09-07 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * malloc/arena.c (arena_get_retry): New function that gets
+ another arena for the caller to try its request on.
+ * malloc/malloc.c (__libc_malloc): Use get_another_arena if the
+ current arena cannot fulfill the request.
+ (__libc_memalign): Likewise.
+ (__libc_memalign): Likewise.
+ (__libc_pvalloc): Likewise.
+ (__libc_calloc): Likewise.
+
+2012-09-05 John Tobey <john.tobey@gmail.com>
+
+ [BZ #13542]
+ * manual/arith.texi (Operations on Complex): Fix description
+ of carg branch cut.
+
+2012-09-06 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #10014]
+ * manual/socket.texi (Host Addresses): Use www.gnu.org as example
+ host name.
+
+ [BZ #10038]
+ * manual/memory.texi (Memory): Make order of menu items match
+ order of sections.
+
+2012-09-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf/dl-tls.c (DL_INITIAL_DTV): Removed.
+ (_dl_initial_dtv): New. Defined if SHARED isn't defined.
+ (_dl_deallocate_tls): Restore GL(dl_initial_dtv).
+
+2012-09-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ * csu/libc-tls.c (static_dtv): Renamed to ...
+ (_dl_static_dtv): This. Make it global.
+ (_dl_initial_dtv): Removed.
+ (__libc_setup_tls): Updated.
+ * elf/dl-tls.c (DL_INITIAL_DTV): New macro.
+ (_dl_deallocate_tls): Replace GL(dl_initial_dtv) with
+ DL_INITIAL_DTV.
+
+2012-09-06 Petr Machata <pmachata@redhat.com>
+
+ * elf/elf.h (NT_S390_HIGH_GPRS): New macro.
+ (NT_S390_TIMER, NT_S390_TODCMP, NT_S390_TODPREG): Likewise.
+ (NT_S390_CTRS, NT_S390_PREFIX, NT_S390_LAST_BREAK): Likewise.
+ (NT_S390_SYSTEM_CALL, NT_ARM_VFP): Likewise.
+
+2012-09-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14545]
+ * csu/libc-tls.c (_dl_initial_dtv): New variable.
+ * elf/dl-tls.c (_dl_deallocate_tls): Always check dtv before
+ freeing dtv[-1].
+
+2012-09-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14544]
+ * Makeconfig (link-static-before-libc): Replace $(+prector)
+ with $(+prectorT).
+ (link-static-after-libc): Replace $(+postctor) with
+ $(+postctorT).
+ (link-bounded): Replace $(+prector)/$(+postctor) with
+ $(+prectorT)/$(+postctorT).
+ (+prectorT): New macro.
+ (+postctorT): Likewise.
+
+2012-09-06 Joseph Myers <joseph@codesourcery.com>
+
+ * stdlib/gen-tst-strtod-round.c: Include <assert.h>.
+ (round_str): Handle values above the maximum for IBM long double
+ as inexact.
+ * stdlib/tst-strtod-round.c (tests): Regenerated.
+
+2012-09-06 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * sysdeps/s390/s390-32/multiarch/Makefile: Remove -mzarch
+ assembler flag.
+ * sysdeps/s390/s390-32/multiarch/memcmp.S: Use .machinemode
+ zarch_nohighgprs around the zarch optimized routines.
+ * sysdeps/s390/s390-32/multiarch/memcpy.S: Likewise.
+ * sysdeps/s390/s390-32/multiarch/memset.S: Likewise.
+ * sysdeps/s390/s390-32/multiarch/ifunc-resolve.c: Explicitly check
+ for zarch.
+
+2012-09-05 David S. Miller <davem@davemloft.net>
+
+ * sysdeps/sparc/fpu/libm-test-ulps: Update.
+
+ * sysdeps/sparc/bits/hwcap.h (HWCAP_SPARC_PAUSE,
+ HWCAP_SPARC_CBCOND, HWCAP_SPARC_CRYPTO): Define.
+ * sysdeps/sparc/dl-procinfo.h (_DL_HWCAP_COUNT): Increase to 27.
+ * sysdeps/sparc/dl-procinfo.c (_dl_sparc_cap_flags): Add new
+ entries.
+
+2012-09-05 Alexandre Oliva <aoliva@redhat.com>
+
+ * malloc/arena.c: Fold copyright years.
+ * malloc/mcheck.c, malloc/memusage.c: Likewise.
+
+2012-09-05 Alexandre Oliva <aoliva@redhat.com>
+
+ * malloc/malloc.c (__libc_mallopt) <M_MMAP_MAX>: Fix indentation.
+
+2012-09-05 Alexandre Oliva <aoliva@redhat.com>
+
+ * manual/contrib.texi (Contributors): Fix typo. Complete entry.
+
+2012-09-05 Alexandre Oliva <aoliva@redhat.com>
+
+ * malloc/malloc.c (__libc_mallopt) <M_MMAP_THRESHOLD>: Do not
+ change internal state upon failure.
+
+2012-09-05 Alexandre Oliva <aoliva@redhat.com>
+
+ * malloc/mcheck.c (mcheck_check_all): Fix typo.
+ * malloc/memusage.c (mmap): Likewise.
+ (mmap64, mremap): Likewise. Adjust name in comment.
+
+2012-09-05 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * libio/fileops.c: Fix typos in comments.
+ * libio/oldfileops.c: Likewise.
+ * libio/wfileops.c: Likewise.
+
+2012-09-05 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ [BZ #1349]
+ * malloc/Makefile (tests): Add tst-malloc-usable test case.
+ (tst-malloc-usable-ENV): Set environment for test case.
+ * malloc/hooks.c (malloc_check_get_size): New function to get
+ requested size.
+ * malloc/malloc.c (musable): Use malloc_check_get_size.
+ * malloc/tst-malloc-usable.c: New test case.
+
+2012-09-05 Andreas Schwab <schwab@linux-m68k.org>
+
+ * stdlib/tst-strtod-overflow.c (TIMEOUT): Define.
+
+2012-09-05 Allan McRae <allan@archlinux.org>
+
+ [BZ #13966]
+ * configure.in (CXX_SYSINCLUDES): Use compiler output to
+ determine header location.
+ * configure: Regenerated.
+
+2012-09-05 Andreas Schwab <schwab@linux-m68k.org>
+
+ * stdlib/gen-tst-strtod-round.c (formats): Add Motorola extended
+ float format.
+ * stdlib/tst-strtod-round.c (TEST) [LDBL_MANT_DIG == 64 &&
+ LDBL_MAX_EXP == 16384]: Add case for Motorola extended float
+ format.
+ (test): Regenerate.
+
+2012-09-04 David S. Miller <davem@davemloft.net>
+
+ * sysdeps/sparc/sparc32/sparcv9/addmul_1.S: New file.
+ * sysdeps/sparc/sparc32/sparcv9/submul_1.S: New file.
+ * sysdeps/sparc/sparc32/sparcv9/mul_1.S: New file.
+
+2012-09-04 Florian Weimer <fweimer@redhat.com>
+
+ * stdlib/tst-secure-getenv.c (alternative_main): Only warn on SGID
+ failures.
+
+ * stdlib/tst-secure-getenv.c: Fix whitespace in comments.
+
+2012-09-04 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #9914]
+ * libio/iogetdelim.c: Include <limits.h>.
+ (_IO_getdelim): Avoid integer overflow in testing whether cur_len
+ + len + 1 would overflow.
+
+2012-09-03 Andreas Jaeger <aj@suse.de>
+
+ * sysdeps/x86_64/fpu/libm-test-ulps: Update.
+ * sysdeps/i386/fpu/libm-test-ulps: Update.
+
+2012-09-03 Liubov Dmitrieva <liubov.dmitrieva@gmail.com>
+
+ * sysdeps/i386/i686/fpu/multiarch/Makefile (sysdep_routines):
+ Add s_sinf-sse2, s_conf-sse2.
+
+ * sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S: New file.
+ * sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S: New file.
+ * sysdeps/i386/i686/fpu/multiarch/s_sinf.c: New file.
+ * sysdeps/i386/i686/fpu/multiarch/s_cosf.c: New file.
+
+ * sysdeps/ieee754/flt-32/s_sinf.c (SINF, SINF_FUNC): Add macros
+ for using routine as __sinf_ia32.
+ Use macro for function declaration and weak_alias.
+ * sysdeps/ieee754/flt-32/s_cosf.c (COSF, COSF_FUNC): Add macros
+ for using routine as __cosf_ia32.
+ Use macro for function declaration and weak_alias.
+
+ * sysdeps/i386/i686/fpu/multiarch/e_expf-sse2.S: Fix Copyright.
+ * sysdeps/i386/i686/fpu/multiarch/e_expf.c: Fix Copyright.
+
+ * sysdeps/x86_64/fpu/s_sinf.S: New file.
+ * sysdeps/x86_64/fpu/s_cosf.S: New file.
+ * sysdeps/x86_64/fpu/libm-test-ulps: Update.
+
+ * math/libm-test.inc (cos_test): Add more test cases.
+ (sin_test): Likewise.
+ (sincos_test): Likewise.
+
+2012-09-03 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * sysdeps/s390/s390-32/multiarch/ifunc-resolve.c
+ (IFUNC_RESOLVE): Make pointers to the specialized implementations
+ hidden.
+ * sysdeps/s390/s390-64/multiarch/ifunc-resolve.c: Likewise.
+
+2012-09-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14538]
+ * sysdeps/x86_64/dl-machine.h (elf_machine_dynamic): Use the
+ first element of the GOT.
+ (elf_machine_load_address): Return the difference between
+ the runtime address of _DYNAMIC and elf_machine_dynamic ().
+
+2012-09-01 Allan McRae <allan@archlinux.org>
+
+ [BZ #13412]
+ * configure.in (AWK): Require gawk version 3.0 or later.
+ * configure: Regenerated.
+
+2012-09-01 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h
+ (__ASSUME_POSIX_CPU_TIMERS): Remove.
+ * sysdeps/unix/sysv/linux/clock_getcpuclockid.c
+ [__NR_clock_getres]: Make code unconditional.
+ [!__ASSUME_POSIX_CPU_TIMERS]: Remoce conditional code.
+ (clock_getcpuclockid): Remove code left unreachable by removal of
+ conditionals.
+ * sysdeps/unix/sysv/linux/clock_getres.c [__NR_clock_getres]: Make
+ code unconditional.
+ [__ASSUME_POSIX_CPU_TIMERS]: Likewise.
+ [!__ASSUME_POSIX_CPU_TIMERS]: Remove conditional code.
+ * sysdeps/unix/sysv/linux/clock_gettime.c [__NR_clock_gettime]:
+ Make code unconditional.
+ [__ASSUME_POSIX_CPU_TIMERS]: Likewise.
+ [!__ASSUME_POSIX_CPU_TIMERS]: Remove conditional code.
+ * sysdeps/unix/sysv/linux/clock_settime.c
+ [__ASSUME_POSIX_CPU_TIMERS <= 0 && __NR_clock_settime]: Remove
+ conditional code.
+ [__ASSUME_POSIX_CPU_TIMERS]: Make code unconditional.
+ [!__ASSUME_POSIX_CPU_TIMERS]: Remove conditional code.
+
+2012-08-29 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14476]
+ * Makefile (install): Also pass LD_SO=$(ld.so-version) to
+ scripts/test-installation.pl.
+
+ * scripts/test-installation.pl: Use LD_SO to get $ld_so_name
+ and $ld_so_version if it is set.
+
+2012-08-29 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ [BZ #14516]
+ * sysdeps/unix/sysv/linux/ttyname.c (ttyname): Don't return
+ failure if reading from procfs failed.
+ * sysdeps/unix/sysv/linux/ttyname_r.c (ttyname_r): Likewise.
+
2012-08-27 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/kernel-features.h
diff --git a/libc/Makeconfig b/libc/Makeconfig
index e02680c09..d3b2cffe6 100644
--- a/libc/Makeconfig
+++ b/libc/Makeconfig
@@ -411,22 +411,6 @@ LDFLAGS.so += $(hashstyle-LDFLAGS)
LDFLAGS-rtld += $(hashstyle-LDFLAGS)
endif
-# Commands for linking programs with the C library.
-ifndef +link
-+link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
- $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
- $(addprefix $(csu-objpfx),$(start-installed-name)) \
- $(+preinit) $(+prector) \
- $(filter-out $(addprefix $(csu-objpfx),start.o \
- $(start-installed-name))\
- $(+preinit) $(link-extra-libs) \
- $(common-objpfx)libc% $(+postinit),$^) \
- $(link-extra-libs)
-+link-after-libc = $(+postctor) $(+postinit)
-+link = $(+link-before-libc) $(link-libc) $(+link-after-libc)
-+link-tests = $(+link-before-libc) $(link-libc-tests) $(+link-after-libc)
-endif
# Command for linking PIE programs with the C library.
ifndef +link-pie
+link-pie = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
@@ -445,29 +429,50 @@ ifndef +link-static
+link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \
$(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
$(addprefix $(csu-objpfx),$(static-start-installed-name)) \
- $(+preinit) $(+prector) \
+ $(+preinit) $(+prectorT) \
$(filter-out $(addprefix $(csu-objpfx),start.o \
$(start-installed-name))\
$(+preinit) $(link-extra-libs-static) \
$(common-objpfx)libc% $(+postinit),$^) \
$(link-extra-libs-static) $(link-libc-static)
-+link-static-after-libc = $(+postctor) $(+postinit)
++link-static-after-libc = $(+postctorT) $(+postinit)
+link-static = $(+link-static-before-libc) $(link-libc-static) \
$(+link-static-after-libc)
+link-static-tests = $(+link-static-before-libc) $(link-libc-static-tests) \
$(+link-static-after-libc)
endif
+# Commands for linking programs with the C library.
+ifndef +link
+ifeq (yes,$(build-shared))
++link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \
+ $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
+ $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
+ $(addprefix $(csu-objpfx),$(start-installed-name)) \
+ $(+preinit) $(+prector) \
+ $(filter-out $(addprefix $(csu-objpfx),start.o \
+ $(start-installed-name))\
+ $(+preinit) $(link-extra-libs) \
+ $(common-objpfx)libc% $(+postinit),$^) \
+ $(link-extra-libs)
++link-after-libc = $(+postctor) $(+postinit)
++link = $(+link-before-libc) $(link-libc) $(+link-after-libc)
++link-tests = $(+link-before-libc) $(link-libc-tests) $(+link-after-libc)
+else
++link = $(+link-static)
++link-tests = $(+link-static-tests)
+endif
+endif
# Command for statically linking bounded-pointer programs with the C library.
ifndef +link-bounded
+link-bounded = $(CC) -nostdlib -nostartfiles -static -fbounded-pointers -o $@ \
$(sysdep-LDFLAGS) $(LDFLAGS) \
$(addprefix $(csu-objpfx),b$(static-start-installed-name)) \
- $(+preinit) $(+prector) \
+ $(+preinit) $(+prectorT) \
$(filter-out $(addprefix $(csu-objpfx),start.ob \
$(start-installed-name))\
$(+preinit) $(link-extra-libs-bounded) \
$(common-objpfx)libc% $(+postinit),$^) \
- $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit)
+ $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctorT) $(+postinit)
endif
ifndef config-LDFLAGS
ifeq (yes,$(build-shared))
@@ -568,7 +573,14 @@ gnulib-arch =
gnulib = -lgcc $(gnulib-arch)
gnulib-tests := -lgcc $(libgcc_eh)
static-gnulib-arch =
+# By default, elf/static-stubs.o, instead of -lgcc_eh, is used to
+# statically link programs. When --disable-shared is used, we use
+# -lgcc_eh since elf/static-stubs.o isn't sufficient.
+ifeq (yes,$(build-shared))
static-gnulib = -lgcc $(static-gnulib-arch)
+else
+static-gnulib = -lgcc -lgcc_eh $(static-gnulib-arch)
+endif
static-gnulib-tests := -lgcc -lgcc_eh $(libunwind)
libc.so-gnulib := -lgcc
endif
@@ -579,6 +591,9 @@ endif
# Variants of the two previous definitions for linking PIE programs.
+prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o`
+postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
+# Variants of the two previous definitions for statically linking programs.
++prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o`
++postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
+interp = $(addprefix $(elf-objpfx),interp.os)
csu-objpfx = $(common-objpfx)csu/
elf-objpfx = $(common-objpfx)elf/
@@ -806,11 +821,7 @@ endif
# The assembler can generate debug information too.
ifndef ASFLAGS
-ifeq ($(have-cpp-asm-debuginfo),yes)
ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS))
-else
-ASFLAGS :=
-endif
endif
ASFLAGS += $(ASFLAGS-config) $(asflags-cpu)
diff --git a/libc/Makefile b/libc/Makefile
index 133c31596..c449b44b0 100644
--- a/libc/Makefile
+++ b/libc/Makefile
@@ -120,7 +120,7 @@ install:
ifneq (no,$(PERL))
ifeq (/usr,$(prefix))
ifeq (,$(install_root))
- CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
+ LD_SO=$(ld.so-version) CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
endif
endif
endif
@@ -194,7 +194,7 @@ installed-stubs = $(inst_includedir)/gnu/stubs.h
else
installed-stubs = $(inst_includedir)/gnu/stubs-$(default-abi).h
-$(inst_includedir)/gnu/stubs.h: $(common-objpfx)soversions.mk $(+force)
+$(inst_includedir)/gnu/stubs.h: $(+force)
$(make-target-directory)
{ \
echo '/* This file is automatically generated.';\
diff --git a/libc/NEWS b/libc/NEWS
index 247139018..0933b30a7 100644
--- a/libc/NEWS
+++ b/libc/NEWS
@@ -9,10 +9,12 @@ Version 2.17
* The following bugs are resolved with this release:
- 3479, 5400, 6778, 6808, 9685, 11607, 13717, 13696, 13939, 14042, 14090,
- 14166, 14150, 14151, 14154, 14157, 14166, 14173, 14195, 14252, 14283,
+ 1349, 3479, 5044, 5400, 6778, 6808, 9685, 9914, 10014, 10038, 11607,
+ 13412, 13542, 13679, 13717, 13696, 13939, 13966, 14042, 14090, 14166,
+ 14150, 14151, 14154, 14157, 14166, 14173, 14195, 14237, 14252, 14283,
14298, 14303, 14307, 14328, 14331, 14336, 14337, 14347, 14349, 14459,
- 14505, 14519
+ 14476, 14505, 14510, 14516, 14518, 14519, 14532, 14538, 14544, 14545,
+ 14562, 14576, 14579, 14583, 14587.
* Support for STT_GNU_IFUNC symbols added for s390 and s390x.
Optimized versions of memcpy, memset, and memcmp added for System z10 and
@@ -40,6 +42,10 @@ Version 2.17
New configure option --disable-build-nscd avoids building nscd itself;
this is the default if --disable-nscd is used.
+* The ttyname and ttyname_r functions on Linux now fall back to searching for
+ the tty file descriptor in /dev/pts or /dev if /proc is not available. This
+ allows creation of chroots without the procfs mounted on /proc.
+
Version 2.16
@@ -67,7 +73,7 @@ Version 2.16
14043, 14044, 14048, 14049, 14050, 14053, 14055, 14059, 14064, 14075,
14080, 14083, 14103, 14104, 14109, 14112, 14117, 14122, 14123, 14134,
14153, 14183, 14188, 14199, 14210, 14218, 14229, 14241, 14273, 14277,
- 14278
+ 14278,
* Support for the x32 ABI on x86-64 added. The x32 target is selected by
configuring glibc with:
diff --git a/libc/bits/libc-lock.h b/libc/bits/libc-lock.h
index 6b215c575..d372722b9 100644
--- a/libc/bits/libc-lock.h
+++ b/libc/bits/libc-lock.h
@@ -49,7 +49,6 @@
/* Same as last but this time we initialize a recursive mutex. */
#define __libc_lock_init_recursive(NAME)
-#define __rtld_lock_init_recursive(NAME)
/* Finalize the named lock variable, which must be locked. It cannot be
used again until __libc_lock_init is called again on it. This must be
diff --git a/libc/catgets/Makefile b/libc/catgets/Makefile
index b6d6a69f8..2f3bcb3a9 100644
--- a/libc/catgets/Makefile
+++ b/libc/catgets/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1996-2000, 2002-2004, 2012 Free Software Foundation, Inc.
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -79,7 +79,7 @@ $(objpfx)de.msg: xopen-msg.awk $(..)po/de.po
$(objpfx)test-gencat.out: test-gencat.sh $(objpfx)test-gencat \
$(objpfx)sample.SJIS.cat
- $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
+ $(SHELL) $< $(common-objpfx) '$(built-program-cmd)'
$(objpfx)sample.SJIS.cat: sample.SJIS $(objpfx)gencat
GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
diff --git a/libc/catgets/test-gencat.sh b/libc/catgets/test-gencat.sh
index 50594bc35..c884b8f20 100755
--- a/libc/catgets/test-gencat.sh
+++ b/libc/catgets/test-gencat.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Test escape character handling in gencat.
-# Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
run_program_prefix=$2
diff --git a/libc/config.make.in b/libc/config.make.in
index 940c8c0d5..7f1bbb51d 100644
--- a/libc/config.make.in
+++ b/libc/config.make.in
@@ -55,7 +55,6 @@ have-Bgroup = @libc_cv_Bgroup@
with-fp = @with_fp@
old-glibc-headers = @old_glibc_headers@
unwind-find-fde = @libc_cv_gcc_unwind_find_fde@
-have-cpp-asm-debuginfo = @libc_cv_cpp_asm_debuginfo@
have-forced-unwind = @libc_cv_forced_unwind@
have-fpie = @libc_cv_fpie@
have-mfma4 = @libc_cv_cc_fma4@
diff --git a/libc/configure b/libc/configure
index f635bf3e2..6e30b1701 100755
--- a/libc/configure
+++ b/libc/configure
@@ -589,7 +589,6 @@ libc_cv_cc_novzeroupper
libc_cv_cc_sse2avx
libc_cv_cc_avx
libc_cv_cc_sse4
-libc_cv_cpp_asm_debuginfo
libc_cv_forced_unwind
libc_cv_rootsbindir
libc_cv_localstatedir
@@ -623,7 +622,6 @@ VERSIONING
BISON
INSTALL_INFO
PERL
-AWK
libc_cv_have_ksh
KSH
libc_cv_have_bash2
@@ -633,6 +631,7 @@ CXX_SYSINCLUDES
SYSINCLUDES
AUTOCONF
READELF
+AWK
SED
MAKEINFO
MSGFMT
@@ -5093,6 +5092,69 @@ if test $ac_verc_fail = yes; then
SED=: aux_missing="$aux_missing sed"
fi
+for ac_prog in gawk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+if test -z "$AWK"; then
+ ac_verc_fail=yes
+else
+ # Found it, now check the version.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $AWK" >&5
+$as_echo_n "checking version of $AWK... " >&6; }
+ ac_prog_version=`$AWK --version 2>&1 | sed -n 's/^.*GNU Awk[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+ [3-9].*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5
+$as_echo "$ac_prog_version" >&6; }
+fi
+if test $ac_verc_fail = yes; then
+ critic_missing="$critic_missing gawk"
+fi
+
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
@@ -5373,13 +5435,11 @@ if test -n "$sysheaders"; then
CXX_SYSINCLUDES=
cxxversion=`$CXX -dumpversion 2>&5` &&
cxxmachine=`$CXX -dumpmachine 2>&5` &&
- for d in include "$cxxmachine/include"; do
- i=../../../../$d/c++/$cxxversion
- cxxheaders=`$CXX -print-file-name="$i"` &&
- test "x$cxxheaders" != x && test "x$i" != "x$cxxheaders" &&
- CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders \
+ cxxplus=`$CXX -print-prog-name=cc1plus`
+ cxxheaders=`$cxxplus -v /dev/null 2>&1 | sed -n '/ \//{p;q;}' | sed 's/ //'`
+ test "x$cxxheaders" != x && test "x$i" != "x$cxxheaders" &&
+ CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders \
-isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward"
- done
fi
fi
@@ -5530,48 +5590,6 @@ else
fi
-for ac_prog in gawk mawk nawk awk
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AWK+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$AWK"; then
- ac_cv_prog_AWK="$AWK" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_AWK="$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
-$as_echo "$AWK" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$AWK" && break
-done
-
if test "x$AWK" != "xgawk"; then
as_fn_error $? "GLIBC requires GNU awk." "$LINENO" 5
fi
@@ -7576,7 +7594,6 @@ fi
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fPIC is default" >&5
$as_echo_n "checking whether -fPIC is default... " >&6; }
if ${libc_cv_pic_default+:} false; then :
@@ -8216,7 +8233,6 @@ gives unlimited permission to copy, distribute and modify it."
ac_pwd='$ac_pwd'
srcdir='$srcdir'
INSTALL='$INSTALL'
-AWK='$AWK'
test -n "\$AWK" || AWK=awk
_ACEOF
diff --git a/libc/configure.in b/libc/configure.in
index 895868dc3..bf2cb5412 100644
--- a/libc/configure.in
+++ b/libc/configure.in
@@ -954,6 +954,9 @@ AC_CHECK_PROG_VER(SED, sed, --version,
[GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
[3.0[2-9]*|3.[1-9]*|[4-9]*],
SED=: aux_missing="$aux_missing sed")
+AC_CHECK_PROG_VER(AWK, gawk, --version,
+ [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
+ [[3-9].*], critic_missing="$critic_missing gawk")
AC_CHECK_TOOL(READELF, readelf, false)
AC_CHECK_TOOL(NM, nm, false)
@@ -1000,13 +1003,11 @@ if test -n "$sysheaders"; then
CXX_SYSINCLUDES=
cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` &&
cxxmachine=`$CXX -dumpmachine 2>&AS_MESSAGE_LOG_FD` &&
- for d in include "$cxxmachine/include"; do
- i=../../../../$d/c++/$cxxversion
- cxxheaders=`$CXX -print-file-name="$i"` &&
- test "x$cxxheaders" != x && test "x$i" != "x$cxxheaders" &&
- CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders \
+ cxxplus=`$CXX -print-prog-name=cc1plus`
+ cxxheaders=`$cxxplus -v /dev/null 2>&1 | sed -n '/ \//{p;q;}' | sed 's/ //'`
+ test "x$cxxheaders" != x && test "x$i" != "x$cxxheaders" &&
+ CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders \
-isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward"
- done
fi
fi
AC_SUBST(SYSINCLUDES)
@@ -1071,7 +1072,6 @@ else
fi
AC_SUBST(libc_cv_have_ksh)
-AC_PROG_AWK
dnl We need gawk for at least gen-sorted.awk and option-groups.awk.
if test "x$AWK" != "xgawk"; then
AC_MSG_ERROR([GLIBC requires GNU awk.])
@@ -2180,7 +2180,6 @@ AC_SUBST(libc_cv_rootsbindir)
AC_SUBST(libc_cv_forced_unwind)
dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests
-AC_SUBST(libc_cv_cpp_asm_debuginfo)
AC_SUBST(libc_cv_cc_sse4)
AC_SUBST(libc_cv_cc_avx)
AC_SUBST(libc_cv_cc_sse2avx)
diff --git a/libc/crypt/md5test-giant.c b/libc/crypt/md5test-giant.c
index 6751a2a4f..63a9c3a79 100644
--- a/libc/crypt/md5test-giant.c
+++ b/libc/crypt/md5test-giant.c
@@ -132,6 +132,6 @@ do_test (void)
#endif
/* This needs on a fast machine 90s. */
-#define TIMEOUT 180
+#define TIMEOUT 480
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
diff --git a/libc/csu/libc-tls.c b/libc/csu/libc-tls.c
index b00a5ccb9..6c52262ba 100644
--- a/libc/csu/libc-tls.c
+++ b/libc/csu/libc-tls.c
@@ -1,5 +1,5 @@
/* Initialization code for TLS in statically linked application.
- Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -32,7 +32,7 @@ extern ElfW(Phdr) *_dl_phdr;
extern size_t _dl_phnum;
-static dtv_t static_dtv[2 + TLS_SLOTINFO_SURPLUS];
+dtv_t _dl_static_dtv[2 + TLS_SLOTINFO_SURPLUS];
static struct
@@ -163,33 +163,33 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
& ~(max_align - 1));
/* Initialize the dtv. [0] is the length, [1] the generation counter. */
- static_dtv[0].counter = (sizeof (static_dtv) / sizeof (static_dtv[0])) - 2;
- // static_dtv[1].counter = 0; would be needed if not already done
+ _dl_static_dtv[0].counter = (sizeof (_dl_static_dtv) / sizeof (_dl_static_dtv[0])) - 2;
+ // _dl_static_dtv[1].counter = 0; would be needed if not already done
/* Initialize the TLS block. */
#if TLS_TCB_AT_TP
- static_dtv[2].pointer.val = ((char *) tlsblock + tcb_offset
+ _dl_static_dtv[2].pointer.val = ((char *) tlsblock + tcb_offset
- roundup (memsz, align ?: 1));
static_map.l_tls_offset = roundup (memsz, align ?: 1);
#elif TLS_DTV_AT_TP
- static_dtv[2].pointer.val = (char *) tlsblock + tcb_offset;
+ _dl_static_dtv[2].pointer.val = (char *) tlsblock + tcb_offset;
static_map.l_tls_offset = tcb_offset;
#else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
- static_dtv[2].pointer.is_static = true;
+ _dl_static_dtv[2].pointer.is_static = true;
/* sbrk gives us zero'd memory, so we don't need to clear the remainder. */
- memcpy (static_dtv[2].pointer.val, initimage, filesz);
+ memcpy (_dl_static_dtv[2].pointer.val, initimage, filesz);
/* Install the pointer to the dtv. */
/* Initialize the thread pointer. */
#if TLS_TCB_AT_TP
- INSTALL_DTV ((char *) tlsblock + tcb_offset, static_dtv);
+ INSTALL_DTV ((char *) tlsblock + tcb_offset, _dl_static_dtv);
const char *lossage = TLS_INIT_TP ((char *) tlsblock + tcb_offset, 0);
#elif TLS_DTV_AT_TP
- INSTALL_DTV (tlsblock, static_dtv);
+ INSTALL_DTV (tlsblock, _dl_static_dtv);
const char *lossage = TLS_INIT_TP (tlsblock, 0);
#else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
diff --git a/libc/debug/Makefile b/libc/debug/Makefile
index 106d61ff2..0f86d9b0b 100644
--- a/libc/debug/Makefile
+++ b/libc/debug/Makefile
@@ -124,12 +124,12 @@ tst-lfschk3-ENV = LOCPATH=$(common-objpfx)localedata
tst-lfschk4-ENV = LOCPATH=$(common-objpfx)localedata
tst-lfschk5-ENV = LOCPATH=$(common-objpfx)localedata
tst-lfschk6-ENV = LOCPATH=$(common-objpfx)localedata
-LDFLAGS-tst-chk4 = -lstdc++
-LDFLAGS-tst-chk5 = -lstdc++
-LDFLAGS-tst-chk6 = -lstdc++
-LDFLAGS-tst-lfschk4 = -lstdc++
-LDFLAGS-tst-lfschk5 = -lstdc++
-LDFLAGS-tst-lfschk6 = -lstdc++
+LDLIBS-tst-chk4 = -lstdc++
+LDLIBS-tst-chk5 = -lstdc++
+LDLIBS-tst-chk6 = -lstdc++
+LDLIBS-tst-lfschk4 = -lstdc++
+LDLIBS-tst-lfschk5 = -lstdc++
+LDLIBS-tst-lfschk6 = -lstdc++
# backtrace_symbols only works if we link with -rdynamic.
LDFLAGS-tst-backtrace2 = -rdynamic
diff --git a/libc/elf/Makefile b/libc/elf/Makefile
index b8ff4f3c2..b3b950be4 100644
--- a/libc/elf/Makefile
+++ b/libc/elf/Makefile
@@ -440,7 +440,7 @@ generated += $(addsuffix .so,$(strip $(modules-names)))
ifeq (yes,$(build-shared))
# eglibc: ifeq ($(cross-compiling),no)
-tests: $(objpfx)tst-pathopt.out
+tests: $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out
# eglibc: endif
endif
@@ -714,9 +714,12 @@ $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
$(objpfx)tst-pathopt: $(libdl)
$(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
$(objpfx)pathoptobj.so
- $(SHELL) -e $< $(common-objpfx) "$(cross-test-wrapper)" \
+ $(SHELL) $< $(common-objpfx) "$(cross-test-wrapper)" \
$(..)scripts/run-with-env.sh
+$(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
+ $(SHELL) $^ > $@
+
$(objpfx)initfirst: $(libdl)
$(objpfx)initfirst.out: $(objpfx)firstobj.so
diff --git a/libc/elf/dl-tls.c b/libc/elf/dl-tls.c
index 4138312b9..c3a3d68f9 100644
--- a/libc/elf/dl-tls.c
+++ b/libc/elf/dl-tls.c
@@ -464,6 +464,11 @@ _dl_allocate_tls (void *mem)
rtld_hidden_def (_dl_allocate_tls)
+#ifndef SHARED
+extern dtv_t _dl_static_dtv[];
+# define _dl_initial_dtv (&_dl_static_dtv[1])
+#endif
+
void
internal_function
_dl_deallocate_tls (void *tcb, bool dealloc_tcb)
@@ -477,9 +482,7 @@ _dl_deallocate_tls (void *tcb, bool dealloc_tcb)
free (dtv[1 + cnt].pointer.val);
/* The array starts with dtv[-1]. */
-#ifdef SHARED
if (dtv != GL(dl_initial_dtv))
-#endif
free (dtv - 1);
if (dealloc_tcb)
diff --git a/libc/elf/elf.h b/libc/elf/elf.h
index 6c85f9219..41fc3bd4f 100644
--- a/libc/elf/elf.h
+++ b/libc/elf/elf.h
@@ -622,6 +622,15 @@ typedef struct
#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
+#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
+#define NT_S390_TIMER 0x301 /* s390 timer register */
+#define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */
+#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
+#define NT_S390_CTRS 0x304 /* s390 control registers */
+#define NT_S390_PREFIX 0x305 /* s390 prefix register */
+#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
+#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
+#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
/* Legal values for the note segment descriptor types for object files. */
diff --git a/libc/elf/rtld.c b/libc/elf/rtld.c
index f77bc7ce1..1ba35321b 100644
--- a/libc/elf/rtld.c
+++ b/libc/elf/rtld.c
@@ -1094,7 +1094,8 @@ of this helper program; chances are you did not intend to run this program.\n\
/* Now the map for the main executable is available. */
main_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
- if (GL(dl_rtld_map).l_info[DT_SONAME] != NULL
+ if (__builtin_expect (mode, normal) == normal
+ && GL(dl_rtld_map).l_info[DT_SONAME] != NULL
&& main_map->l_info[DT_SONAME] != NULL
&& strcmp ((const char *) D_PTR (&GL(dl_rtld_map), l_info[DT_STRTAB])
+ GL(dl_rtld_map).l_info[DT_SONAME]->d_un.d_val,
diff --git a/libc/elf/tst-pathopt.sh b/libc/elf/tst-pathopt.sh
index eaed77867..5e1e00d68 100755
--- a/libc/elf/tst-pathopt.sh
+++ b/libc/elf/tst-pathopt.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Test lookup path optimization.
-# Copyright (C) 2000 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
cross_test_wrapper="$2"
run_with_env="$3"
diff --git a/libc/elf/tst-rtld-load-self.sh b/libc/elf/tst-rtld-load-self.sh
new file mode 100755
index 000000000..f4c5dea23
--- /dev/null
+++ b/libc/elf/tst-rtld-load-self.sh
@@ -0,0 +1,46 @@
+#! /bin/sh
+# Test how rtld loads itself.
+# Copyright (C) 2012 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+#
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+set -e
+
+rtld=$1
+result=0
+
+echo '# normal mode'
+$rtld $rtld 2>&1 && rc=0 || rc=$?
+echo "# exit status $rc"
+test $rc -le 127 || result=1
+
+echo '# list mode'
+$rtld --list $rtld 2>&1 && rc=0 || rc=$?
+echo "# exit status $rc"
+test $rc -eq 0 || result=1
+
+echo '# verify mode'
+$rtld --verify $rtld 2>&1 && rc=0 || rc=$?
+echo "# exit status $rc"
+test $rc -eq 2 || result=1
+
+echo '# trace mode'
+LD_TRACE_LOADED_OBJECTS=1 $rtld $rtld 2>&1 && rc=0 || rc=$?
+echo "# exit status $rc"
+test $rc -eq 0 || result=1
+
+exit $result
diff --git a/libc/grp/Makefile b/libc/grp/Makefile
index 08baa04b9..a37846bf7 100644
--- a/libc/grp/Makefile
+++ b/libc/grp/Makefile
@@ -60,7 +60,7 @@ endif
ifeq (yes,$(build-shared))
tests: $(objpfx)tst_fgetgrent.out
$(objpfx)tst_fgetgrent.out: tst_fgetgrent.sh $(objpfx)tst_fgetgrent
- $(SHELL) -e tst_fgetgrent.sh $(common-objpfx) $(elf-objpfx) \
+ $(SHELL) $< $(common-objpfx) $(elf-objpfx) \
$(rtld-installed-name) "$(cross-test-wrapper)"
endif
diff --git a/libc/grp/tst_fgetgrent.sh b/libc/grp/tst_fgetgrent.sh
index dcec1adb5..5d14ab11c 100644
--- a/libc/grp/tst_fgetgrent.sh
+++ b/libc/grp/tst_fgetgrent.sh
@@ -1,8 +1,7 @@
#! /bin/sh
-# Copyright (C) 1999 Free Software Foundation, Inc.
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1999.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1; shift
elf_objpfx=$1; shift
rtld_installed_name=$1; shift
diff --git a/libc/iconv/gconv_db.c b/libc/iconv/gconv_db.c
index 9f37a3872..50892cce6 100644
--- a/libc/iconv/gconv_db.c
+++ b/libc/iconv/gconv_db.c
@@ -1,6 +1,5 @@
/* Provide access to the collection of available transformation modules.
- Copyright (C) 1997-2003, 2004, 2005, 2006, 2007
- Free Software Foundation, Inc.
+ Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -194,10 +193,13 @@ free_derivation (void *p)
}
/* Free the name strings. */
- free ((char *) deriv->steps[0].__from_name);
- free ((char *) deriv->steps[deriv->nsteps - 1].__to_name);
+ if (deriv->steps != NULL)
+ {
+ free ((char *) deriv->steps[0].__from_name);
+ free ((char *) deriv->steps[deriv->nsteps - 1].__to_name);
+ free ((struct __gconv_step *) deriv->steps);
+ }
- free ((struct __gconv_step *) deriv->steps);
free (deriv);
}
diff --git a/libc/iconvdata/Makefile b/libc/iconvdata/Makefile
index edb868967..73048a0fd 100644
--- a/libc/iconvdata/Makefile
+++ b/libc/iconvdata/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1997-2008, 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 1997-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -303,7 +303,7 @@ $(objpfx)tst-iconv7.out: $(objpfx)gconv-modules \
$(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \
$(addprefix $(objpfx),$(modules.so)) \
$(common-objdir)/iconv/iconv_prog TESTS
- $(SHELL) -e $< $(common-objdir) '$(cross-test-wrapper)' > $@
+ $(SHELL) $< $(common-objdir) '$(cross-test-wrapper)' > $@
$(objpfx)tst-tables.out: tst-tables.sh $(objpfx)gconv-modules \
$(addprefix $(objpfx),$(modules.so)) \
diff --git a/libc/iconvdata/run-iconv-test.sh b/libc/iconvdata/run-iconv-test.sh
index 74e78378d..71e635e35 100755
--- a/libc/iconvdata/run-iconv-test.sh
+++ b/libc/iconvdata/run-iconv-test.sh
@@ -1,9 +1,8 @@
#! /bin/sh -f
# Run available iconv(1) tests.
-# Copyright (C) 1998-2002, 2005, 2006, 2008 Free Software Foundation, Inc.
+# Copyright (C) 1998-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -19,6 +18,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
codir=$1
cross_test_wrapper="$2"
diff --git a/libc/include/rounding-mode.h b/libc/include/rounding-mode.h
new file mode 100644
index 000000000..bde41e7b1
--- /dev/null
+++ b/libc/include/rounding-mode.h
@@ -0,0 +1,65 @@
+/* Handle floating-point rounding mode within libc.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _ROUNDING_MODE_H
+#define _ROUNDING_MODE_H 1
+
+#include <fenv.h>
+#include <stdbool.h>
+#include <stdlib.h>
+
+/* Get the architecture-specific definition of how to determine the
+ rounding mode in libc. This header must also define the FE_*
+ macros for any standard rounding modes the architecture does not
+ have in <fenv.h>, to arbitrary distinct values. */
+#include <get-rounding-mode.h>
+
+/* Return true if a number should be rounded away from zero in
+ rounding mode MODE, false otherwise. NEGATIVE is true if the
+ number is negative, false otherwise. LAST_DIGIT_ODD is true if the
+ last digit of the truncated value (last bit for binary) is odd,
+ false otherwise. HALF_BIT is true if the number is at least half
+ way from the truncated value to the next value with the
+ least-significant digit in the same place, false otherwise.
+ MORE_BITS is true if the number is not exactly equal to the
+ truncated value or the half-way value, false otherwise. */
+
+static inline bool
+round_away (bool negative, bool last_digit_odd, bool half_bit, bool more_bits,
+ int mode)
+{
+ switch (mode)
+ {
+ case FE_DOWNWARD:
+ return negative && (half_bit || more_bits);
+
+ case FE_TONEAREST:
+ return half_bit && (last_digit_odd || more_bits);
+
+ case FE_TOWARDZERO:
+ return false;
+
+ case FE_UPWARD:
+ return !negative && (half_bit || more_bits);
+
+ default:
+ abort ();
+ }
+}
+
+#endif /* rounding-mode.h */
diff --git a/libc/intl/Makefile b/libc/intl/Makefile
index b70f0d0fa..c408120eb 100644
--- a/libc/intl/Makefile
+++ b/libc/intl/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2003,2005,2008,2011,2012 Free Software Foundation, Inc.
+# Copyright (C) 1995-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -75,18 +75,18 @@ $(codeset_mo): tstcodeset.po
$(objpfx)mtrace-tst-gettext: $(objpfx)tst-gettext.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-gettext.mtrace > $@
$(objpfx)tst-gettext.out: tst-gettext.sh $(objpfx)tst-gettext
- $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ \
+ $(SHELL) $< $(common-objpfx) $(common-objpfx)intl/ \
$(objpfx)tst-gettext.mtrace '$(cross-test-wrapper)'
$(objpfx)tst-translit.out: tst-translit.sh $(objpfx)tst-translit
- $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ \
+ $(SHELL) $< $(common-objpfx) $(common-objpfx)intl/ \
'$(cross-test-wrapper)'
$(objpfx)tst-gettext2.out: tst-gettext2.sh $(objpfx)tst-gettext2
- $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ \
+ $(SHELL) $< $(common-objpfx) $(common-objpfx)intl/ \
'$(cross-test-wrapper)'
$(objpfx)tst-gettext4.out: tst-gettext4.sh $(objpfx)tst-gettext4
- $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
$(objpfx)tst-gettext6.out: tst-gettext6.sh $(objpfx)tst-gettext6
- $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
$(objpfx)tst-codeset.out: $(codeset_mo)
$(objpfx)tst-gettext3.out: $(codeset_mo)
diff --git a/libc/intl/tst-gettext.sh b/libc/intl/tst-gettext.sh
index 8529ba997..fd36191d3 100755
--- a/libc/intl/tst-gettext.sh
+++ b/libc/intl/tst-gettext.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Test of gettext functions.
-# Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
objpfx=$2
malloc_trace=$3
diff --git a/libc/intl/tst-gettext2.sh b/libc/intl/tst-gettext2.sh
index a9c36aad0..b6f439daf 100644
--- a/libc/intl/tst-gettext2.sh
+++ b/libc/intl/tst-gettext2.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Test of gettext functions.
-# Copyright (C) 2000, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
objpfx=$2
cross_test_wrapper=$3
diff --git a/libc/intl/tst-gettext4.sh b/libc/intl/tst-gettext4.sh
index ac95be197..4067071c7 100755
--- a/libc/intl/tst-gettext4.sh
+++ b/libc/intl/tst-gettext4.sh
@@ -1,9 +1,8 @@
#! /bin/sh
# Test that gettext() in multithreaded applications works correctly if
# different threads operate in different locales with the same encoding.
-# Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -19,6 +18,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
run_program_prefix=$2
objpfx=$3
diff --git a/libc/intl/tst-gettext6.sh b/libc/intl/tst-gettext6.sh
index b83678ed0..2db0cd653 100644
--- a/libc/intl/tst-gettext6.sh
+++ b/libc/intl/tst-gettext6.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Test that gettext() in multithreaded applications works correctly.
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
run_program_prefix=$2
objpfx=$3
diff --git a/libc/intl/tst-translit.sh b/libc/intl/tst-translit.sh
index c5d4bc95c..ba88928a6 100755
--- a/libc/intl/tst-translit.sh
+++ b/libc/intl/tst-translit.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Test of transliteration in gettext functions.
-# Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
objpfx=$2
cross_test_wrapper=$3
diff --git a/libc/io/Makefile b/libc/io/Makefile
index 7162b7867..72377016f 100644
--- a/libc/io/Makefile
+++ b/libc/io/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-2003,2005-2008,2011,2012 Free Software Foundation, Inc.
+# Copyright (C) 1992-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -118,7 +118,7 @@ endif
$(objpfx)ftwtest.out: $(objpfx)ftwtest
$(ftwtest-tmpdir) \
- $(SHELL) -e ftwtest-sh $(shell cd $(common-objpfx). && pwd)/ \
+ $(SHELL) ftwtest-sh $(shell cd $(common-objpfx). && pwd)/ \
'$(cross-test-wrapper)' \
$(shell cd $(..)scripts && pwd)/run-with-env.sh \
$(shell cd $(<D) && pwd)/$(<F) > $@
diff --git a/libc/io/ftwtest-sh b/libc/io/ftwtest-sh
index 2036294df..311c4019f 100644
--- a/libc/io/ftwtest-sh
+++ b/libc/io/ftwtest-sh
@@ -1,4 +1,23 @@
#! /bin/sh
+# Test for nftw(3).
+# Copyright (C) 1997-2012 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+set -e
# The common objpfx, used to find libraries and the dynamic loader.
objpfx=$1
diff --git a/libc/libio/Makefile b/libc/libio/Makefile
index ba2466076..d66e090e6 100644
--- a/libc/libio/Makefile
+++ b/libc/libio/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2004,2006-2009,2011,2012 Free Software Foundation, Inc.
+# Copyright (C) 1995-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -59,6 +59,8 @@ routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += \
wprintf wscanf fwscanf vwscanf \
fwide
+include ../Makeconfig
+
tests = test-fmemopen tst-ext tst-ext2 \
tst-mmap-setvbuf tst-atime tst-eof \
tst-freopen bug-ungetc bug-fseek \
@@ -68,7 +70,7 @@ tests = test-fmemopen tst-ext tst-ext2 \
tst-memstream1 tst-memstream2 \
bug-memstream1 tst-popen1 bug-fclose1
tests-$(OPTION_EGLIBC_LOCALE_CODE) \
- += tst-swscanf tst-fgetws tst-fopenloc tst-setvbuf1 \
+ += tst-swscanf tst-fgetws tst-setvbuf1 \
tst-ungetwc1 tst-ungetwc2 bug-ftell bug-ungetwc2 \
tst-widetext
tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
@@ -80,12 +82,15 @@ tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
+= tst_swprintf tst_swscanf \
tst-sscanf \
tst-wmemstream1 tst-wmemstream2
+ifeq (yes,$(build-shared))
+# Add test-fopenloc only if shared library is enabled since it depends on
+# shared localedata objects.
+tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-fopenloc
+endif
test-srcs = test-freopen
all: # Make this the default target; it will be defined in Rules.
-include ../Makeconfig
-
ifeq ($(versioning),yes)
routines += oldiofopen oldiofdopen oldiofclose oldiopopen oldpclose \
oldtmpfile oldiofgetpos oldiofgetpos64 oldiofsetpos \
@@ -194,12 +199,16 @@ include ../Rules
ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO))
tests: $(objpfx)test-freopen.out
$(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen
- $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' \
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
$(common-objpfx)libio/
endif
ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
+ifeq (yes,$(build-shared))
+# Run tst-fopenloc.check only if shared library is enabled since it
+# depends on tst-fopenloc.out.
tests: $(objpfx)tst-fopenloc.check
+endif
$(objpfx)tst-fopenloc.check: $(objpfx)tst-fopenloc.out
cmp ../iconvdata/testdata/ISO-8859-1..UTF8 $(objpfx)tst-fopenloc.out \
> $@
diff --git a/libc/libio/fileops.c b/libc/libio/fileops.c
index 9a6e51885..a65f0afbc 100644
--- a/libc/libio/fileops.c
+++ b/libc/libio/fileops.c
@@ -102,7 +102,7 @@ extern struct __gconv_trans_data __libio_translit attribute_hidden;
to _IO_buf_base, though not necessarily if we have switched from
get mode to put mode. (The reason is to maintain the invariant
that _IO_read_end corresponds to the external file position.)
- _IO_write_base is non-NULL and usually equal to _IO_base_base.
+ _IO_write_base is non-NULL and usually equal to _IO_buf_base.
We also have _IO_write_end == _IO_buf_end, but only in fully buffered mode.
The un-flushed character are those between _IO_write_base and _IO_write_ptr.
@@ -992,10 +992,10 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
/* Flush unwritten characters.
(This may do an unneeded write if we seek within the buffer.
But to be able to switch to reading, we would need to set
- egptr to ptr. That can't be done in the current design,
+ egptr to pptr. That can't be done in the current design,
which assumes file_ptr() is eGptr. Anyway, since we probably
end up flushing when we close(), it doesn't make much difference.)
- FIXME: simulate mem-papped files. */
+ FIXME: simulate mem-mapped files. */
if (fp->_IO_write_ptr > fp->_IO_write_base || _IO_in_put_mode (fp))
if (_IO_switch_to_get_mode (fp))
diff --git a/libc/libio/iogetdelim.c b/libc/libio/iogetdelim.c
index 405b65f1e..bf4b0f776 100644
--- a/libc/libio/iogetdelim.c
+++ b/libc/libio/iogetdelim.c
@@ -29,6 +29,7 @@
#include "libioP.h"
#include <string.h>
#include <errno.h>
+#include <limits.h>
/* Read up to (and including) a TERMINATOR from FP into *LINEPTR
(and null-terminate it). *LINEPTR is a pointer returned from malloc (or
@@ -89,7 +90,7 @@ _IO_getdelim (lineptr, n, delimiter, fp)
t = (char *) memchr ((void *) fp->_IO_read_ptr, delimiter, len);
if (t != NULL)
len = (t - fp->_IO_read_ptr) + 1;
- if (__builtin_expect (cur_len + len + 1 < 0, 0))
+ if (__builtin_expect (len >= SSIZE_MAX - cur_len, 0))
{
__set_errno (EOVERFLOW);
result = -1;
diff --git a/libc/libio/iogetline.c b/libc/libio/iogetline.c
index f097f8002..bdb35b30f 100644
--- a/libc/libio/iogetline.c
+++ b/libc/libio/iogetline.c
@@ -27,8 +27,6 @@
#include "libioP.h"
#include <string.h>
-#if defined _LIBC || !_G_HAVE_IO_GETLINE_INFO
-
_IO_size_t
_IO_getline (fp, buf, n, delim, extract_delim)
_IO_FILE *fp;
@@ -117,5 +115,3 @@ _IO_getline_info (fp, buf, n, delim, extract_delim, eof)
return ptr - buf;
}
libc_hidden_def (_IO_getline_info)
-
-#endif /* Defined _LIBC || !_G_HAVE_IO_GETLINE_INFO */
diff --git a/libc/libio/iogetwline.c b/libc/libio/iogetwline.c
index 598ece173..63b7da672 100644
--- a/libc/libio/iogetwline.c
+++ b/libc/libio/iogetwline.c
@@ -32,8 +32,6 @@
# define wmemcpy __wmemcpy
#endif
-#if defined _LIBC || !_G_HAVE_IO_GETLINE_INFO
-
_IO_size_t
_IO_getwline (fp, buf, n, delim, extract_delim)
_IO_FILE *fp;
@@ -122,5 +120,3 @@ _IO_getwline_info (fp, buf, n, delim, extract_delim, eof)
}
return ptr - buf;
}
-
-#endif /* Defined _LIBC || !_G_HAVE_IO_GETLINE_INFO */
diff --git a/libc/libio/iopopen.c b/libc/libio/iopopen.c
index 4f67e8cca..716395804 100644
--- a/libc/libio/iopopen.c
+++ b/libc/libio/iopopen.c
@@ -29,7 +29,6 @@
# define _POSIX_SOURCE
#endif
#include "libioP.h"
-#if _IO_HAVE_SYS_WAIT
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
@@ -51,8 +50,6 @@
extern _IO_pid_t _IO_fork (void) __THROW;
#endif
-#endif /* _IO_HAVE_SYS_WAIT */
-
#ifndef _IO_dup2
#ifdef _LIBC
#define _IO_dup2 __dup2
@@ -114,7 +111,6 @@ _IO_new_proc_open (fp, command, mode)
const char *command;
const char *mode;
{
-#if _IO_HAVE_SYS_WAIT
int read_or_write;
int parent_end, child_end;
int pipe_fds[2];
@@ -273,9 +269,6 @@ _IO_new_proc_open (fp, command, mode)
_IO_mask_flags (fp, read_or_write, _IO_NO_READS|_IO_NO_WRITES);
return fp;
-#else /* !_IO_HAVE_SYS_WAIT */
- return NULL;
-#endif
}
_IO_FILE *
@@ -317,7 +310,6 @@ _IO_new_proc_close (fp)
_IO_FILE *fp;
{
/* This is not name-space clean. FIXME! */
-#if _IO_HAVE_SYS_WAIT
int wstatus;
_IO_proc_file **ptr = &proc_file_chain;
_IO_pid_t wait_pid;
@@ -356,9 +348,6 @@ _IO_new_proc_close (fp)
if (wait_pid == -1)
return -1;
return wstatus;
-#else /* !_IO_HAVE_SYS_WAIT */
- return -1;
-#endif
}
static const struct _IO_jump_t _IO_proc_jumps = {
diff --git a/libc/libio/libio.h b/libc/libio/libio.h
index bbfdd9d32..f093a93e9 100644
--- a/libc/libio/libio.h
+++ b/libc/libio/libio.h
@@ -34,37 +34,31 @@
#define _IO_pos_t _G_fpos_t /* obsolete */
#define _IO_fpos_t _G_fpos_t
#define _IO_fpos64_t _G_fpos64_t
-#define _IO_size_t _G_size_t
-#define _IO_ssize_t _G_ssize_t
-#define _IO_off_t _G_off_t
+#define _IO_size_t size_t
+#define _IO_ssize_t __ssize_t
+#define _IO_off_t __off_t
#define _IO_off64_t _G_off64_t
-#define _IO_pid_t _G_pid_t
-#define _IO_uid_t _G_uid_t
+#define _IO_pid_t __pid_t
+#define _IO_uid_t __uid_t
#define _IO_iconv_t _G_iconv_t
-#define _IO_HAVE_SYS_WAIT _G_HAVE_SYS_WAIT
#define _IO_HAVE_ST_BLKSIZE _G_HAVE_ST_BLKSIZE
#define _IO_BUFSIZ _G_BUFSIZ
#define _IO_va_list _G_va_list
-#define _IO_wint_t _G_wint_t
+#define _IO_wint_t wint_t
-#ifdef _G_NEED_STDARG_H
/* This define avoids name pollution if we're using GNU stdarg.h */
-# define __need___va_list
-# include <stdarg.h>
-# ifdef __GNUC_VA_LIST
-# undef _IO_va_list
-# define _IO_va_list __gnuc_va_list
-# endif /* __GNUC_VA_LIST */
-#endif
+#define __need___va_list
+#include <stdarg.h>
+#ifdef __GNUC_VA_LIST
+# undef _IO_va_list
+# define _IO_va_list __gnuc_va_list
+#endif /* __GNUC_VA_LIST */
#ifndef __P
# include <sys/cdefs.h>
#endif /*!__P*/
#define _IO_UNIFIED_JUMPTABLES 1
-#ifndef _G_HAVE_PRINTF_FP
-# define _IO_USE_DTOA 1
-#endif
#ifndef EOF
# define EOF (-1)
diff --git a/libc/libio/libioP.h b/libc/libio/libioP.h
index f55a84ba2..9bbf2a741 100644
--- a/libc/libio/libioP.h
+++ b/libc/libio/libioP.h
@@ -113,34 +113,18 @@ extern "C" {
# define _IO_vtable_offset(THIS) 0
#endif
#define _IO_WIDE_JUMPS_FUNC(THIS) _IO_WIDE_JUMPS(THIS)
-#ifdef _G_USING_THUNKS
-# define JUMP_FIELD(TYPE, NAME) TYPE NAME
-# define JUMP0(FUNC, THIS) (_IO_JUMPS_FUNC(THIS)->FUNC) (THIS)
-# define JUMP1(FUNC, THIS, X1) (_IO_JUMPS_FUNC(THIS)->FUNC) (THIS, X1)
-# define JUMP2(FUNC, THIS, X1, X2) (_IO_JUMPS_FUNC(THIS)->FUNC) (THIS, X1, X2)
-# define JUMP3(FUNC, THIS, X1,X2,X3) (_IO_JUMPS_FUNC(THIS)->FUNC) (THIS, X1,X2, X3)
-# define JUMP_INIT(NAME, VALUE) VALUE
-# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0), JUMP_INIT (dummy2, 0)
-
-# define WJUMP0(FUNC, THIS) (_IO_WIDE_JUMPS_FUNC(THIS)->FUNC) (THIS)
-# define WJUMP1(FUNC, THIS, X1) (_IO_WIDE_JUMPS_FUNC(THIS)->FUNC) (THIS, X1)
-# define WJUMP2(FUNC, THIS, X1, X2) (_IO_WIDE_JUMPS_FUNC(THIS)->FUNC) (THIS, X1, X2)
-# define WJUMP3(FUNC, THIS, X1,X2,X3) (_IO_WIDE_JUMPS_FUNC(THIS)->FUNC) (THIS, X1,X2, X3)
-#else
-/* These macros will change when we re-implement vtables to use "thunks"! */
-# define JUMP_FIELD(TYPE, NAME) struct { short delta1, delta2; TYPE pfn; } NAME
-# define JUMP0(FUNC, THIS) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS)
-# define JUMP1(FUNC, THIS, X1) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1)
-# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1, X2)
-# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1,X2,X3)
-# define JUMP_INIT(NAME, VALUE) {0, 0, VALUE}
-# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0)
-
-# define WJUMP0(FUNC, THIS) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS)
-# define WJUMP1(FUNC, THIS, X1) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1)
-# define WJUMP2(FUNC, THIS, X1, X2) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1, X2)
-# define WJUMP3(FUNC, THIS, X1,X2,X3) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1,X2,X3)
-#endif
+#define JUMP_FIELD(TYPE, NAME) TYPE NAME
+#define JUMP0(FUNC, THIS) (_IO_JUMPS_FUNC(THIS)->FUNC) (THIS)
+#define JUMP1(FUNC, THIS, X1) (_IO_JUMPS_FUNC(THIS)->FUNC) (THIS, X1)
+#define JUMP2(FUNC, THIS, X1, X2) (_IO_JUMPS_FUNC(THIS)->FUNC) (THIS, X1, X2)
+#define JUMP3(FUNC, THIS, X1,X2,X3) (_IO_JUMPS_FUNC(THIS)->FUNC) (THIS, X1,X2, X3)
+#define JUMP_INIT(NAME, VALUE) VALUE
+#define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0), JUMP_INIT (dummy2, 0)
+
+#define WJUMP0(FUNC, THIS) (_IO_WIDE_JUMPS_FUNC(THIS)->FUNC) (THIS)
+#define WJUMP1(FUNC, THIS, X1) (_IO_WIDE_JUMPS_FUNC(THIS)->FUNC) (THIS, X1)
+#define WJUMP2(FUNC, THIS, X1, X2) (_IO_WIDE_JUMPS_FUNC(THIS)->FUNC) (THIS, X1, X2)
+#define WJUMP3(FUNC, THIS, X1,X2,X3) (_IO_WIDE_JUMPS_FUNC(THIS)->FUNC) (THIS, X1,X2, X3)
/* The 'finish' function does any final cleaning up of an _IO_FILE object.
It does not delete (free) it, but does everything else to finalize it.
@@ -302,10 +286,8 @@ typedef void (*_IO_imbue_t) (_IO_FILE *, void *);
struct _IO_jump_t
{
- JUMP_FIELD(_G_size_t, __dummy);
-#ifdef _G_USING_THUNKS
- JUMP_FIELD(_G_size_t, __dummy2);
-#endif
+ JUMP_FIELD(size_t, __dummy);
+ JUMP_FIELD(size_t, __dummy2);
JUMP_FIELD(_IO_finish_t, __finish);
JUMP_FIELD(_IO_overflow_t, __overflow);
JUMP_FIELD(_IO_underflow_t, __underflow);
@@ -878,30 +860,6 @@ extern int _IO_vscanf (const char *, _IO_va_list) __THROW;
# endif
#endif
-/* VTABLE_LABEL defines NAME as of the CLASS class.
- CNLENGTH is strlen(#CLASS). */
-#ifdef __GNUC__
-# if _G_VTABLE_LABEL_HAS_LENGTH
-# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
- extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CNLENGTH #CLASS);
-# else
-# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
- extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CLASS);
-# endif
-#endif /* __GNUC__ */
-
-#if !defined(builtinbuf_vtable) && defined(__cplusplus)
-# ifdef __GNUC__
-VTABLE_LABEL(builtinbuf_vtable, builtinbuf, 10)
-# else
-# if _G_VTABLE_LABEL_HAS_LENGTH
-# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##10builtinbuf
-# else
-# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##builtinbuf
-# endif
-# endif
-#endif /* !defined(builtinbuf_vtable) && defined(__cplusplus) */
-
#define _IO_va_start(args, last) va_start(args, last)
extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
diff --git a/libc/libio/oldfileops.c b/libc/libio/oldfileops.c
index c68ca6a76..8fda0484a 100644
--- a/libc/libio/oldfileops.c
+++ b/libc/libio/oldfileops.c
@@ -76,7 +76,7 @@ extern int errno;
to _IO_buf_base, though not necessarily if we have switched from
get mode to put mode. (The reason is to maintain the invariant
that _IO_read_end corresponds to the external file position.)
- _IO_write_base is non-NULL and usually equal to _IO_base_base.
+ _IO_write_base is non-NULL and usually equal to _IO_buf_base.
We also have _IO_write_end == _IO_buf_end, but only in fully buffered mode.
The un-flushed character are those between _IO_write_base and _IO_write_ptr.
@@ -492,10 +492,10 @@ _IO_old_file_seekoff (fp, offset, dir, mode)
/* Flush unwritten characters.
(This may do an unneeded write if we seek within the buffer.
But to be able to switch to reading, we would need to set
- egptr to ptr. That can't be done in the current design,
+ egptr to pptr. That can't be done in the current design,
which assumes file_ptr() is eGptr. Anyway, since we probably
end up flushing when we close(), it doesn't make much difference.)
- FIXME: simulate mem-papped files. */
+ FIXME: simulate mem-mapped files. */
if (fp->_IO_write_ptr > fp->_IO_write_base || _IO_in_put_mode (fp))
if (_IO_switch_to_get_mode (fp))
diff --git a/libc/libio/oldiopopen.c b/libc/libio/oldiopopen.c
index e14961ad8..4965a732b 100644
--- a/libc/libio/oldiopopen.c
+++ b/libc/libio/oldiopopen.c
@@ -30,7 +30,6 @@
# define _POSIX_SOURCE
#endif
#include "libioP.h"
-#if _IO_HAVE_SYS_WAIT
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
@@ -49,8 +48,6 @@
extern _IO_pid_t _IO_fork (void) __THROW;
#endif
-#endif /* _IO_HAVE_SYS_WAIT */
-
#include <shlib-compat.h>
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
@@ -123,7 +120,6 @@ _IO_old_proc_open (fp, command, mode)
const char *command;
const char *mode;
{
-#if _IO_HAVE_SYS_WAIT
volatile int read_or_write;
volatile int parent_end, child_end;
int pipe_fds[2];
@@ -194,9 +190,6 @@ _IO_old_proc_open (fp, command, mode)
_IO_mask_flags (fp, read_or_write, _IO_NO_READS|_IO_NO_WRITES);
return fp;
-#else /* !_IO_HAVE_SYS_WAIT */
- return NULL;
-#endif
}
_IO_FILE *
@@ -240,7 +233,6 @@ _IO_old_proc_close (fp)
_IO_FILE *fp;
{
/* This is not name-space clean. FIXME! */
-#if _IO_HAVE_SYS_WAIT
int wstatus;
_IO_proc_file **ptr = &old_proc_file_chain;
_IO_pid_t wait_pid;
@@ -279,9 +271,6 @@ _IO_old_proc_close (fp)
if (wait_pid == -1)
return -1;
return wstatus;
-#else /* !_IO_HAVE_SYS_WAIT */
- return -1;
-#endif
}
const struct _IO_jump_t _IO_old_proc_jumps = {
diff --git a/libc/libio/test-freopen.sh b/libc/libio/test-freopen.sh
index 07b4cf68d..9ee453087 100755
--- a/libc/libio/test-freopen.sh
+++ b/libc/libio/test-freopen.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Test of freopen.
-# Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
run_program_prefix=$2
objpfx=$3
diff --git a/libc/libio/wfileops.c b/libc/libio/wfileops.c
index 3f628bfd1..b790029ff 100644
--- a/libc/libio/wfileops.c
+++ b/libc/libio/wfileops.c
@@ -589,7 +589,7 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
/* Flush unwritten characters.
(This may do an unneeded write if we seek within the buffer.
But to be able to switch to reading, we would need to set
- egptr to ptr. That can't be done in the current design,
+ egptr to pptr. That can't be done in the current design,
which assumes file_ptr() is eGptr. Anyway, since we probably
end up flushing when we close(), it doesn't make much difference.)
FIXME: simulate mem-mapped files. */
diff --git a/libc/localedata/ChangeLog b/libc/localedata/ChangeLog
index 248b0092a..cd790c6e8 100644
--- a/libc/localedata/ChangeLog
+++ b/libc/localedata/ChangeLog
@@ -1,3 +1,33 @@
+2012-09-24 Dmitry V. Levin <ldv@altlinux.org>
+
+ * gen-locale.sh: Add "set -e".
+ * sort-test.sh: Likewise.
+ * tst-ctype.sh: Likewise.
+ * tst-fmon.sh: Likewise.
+ * tst-langinfo.sh: Likewise.
+ * tst-locale.sh: Likewise.
+ * tst-mbswcs.sh: Likewise.
+ * tst-numeric.sh: Likewise.
+ * tst-rpmatch.sh: Likewise.
+ * tst-trans.sh: Likewise.
+ * tst-wctype.sh: Likewise.
+ * Makefile: Do not specify -e option when running testsuite
+ shell scripts.
+
+ * sort-test.sh: Add copyright header.
+
+2012-09-05 Jeff Law <law@redhat.com>
+
+ [BZ#14510]
+ * locales/es_DO: Fix LC_NUMERIC decimal_point and thousands_sep.
+ * locales/es_GT: Likewise.
+ * locales/es_HN: Likewise.
+ * locales/es_MX: Likewise.
+ * locales/es_NI: Likewise.
+ * locales/es_PA: Likewise.
+ * locales/es_PR: Likewise.
+ * locales/es_SV: Likewise.
+
2012-06-20 Petr Baudis <pasky@ucw.cz>
* locales/mag_IN: Fix comment character.
diff --git a/libc/localedata/Makefile b/libc/localedata/Makefile
index 5e40e0fca..96079ce6a 100644
--- a/libc/localedata/Makefile
+++ b/libc/localedata/Makefile
@@ -1,5 +1,4 @@
-# Copyright (C) 1996-2003,2005,2007-2009,2011,2012
-# Free Software Foundation, Inc.
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -148,7 +147,7 @@ generated-dirs += $(LOCALES)
$(addprefix $(objpfx),$(CTYPE_FILES)): %: \
gen-locale.sh $(common-objpfx)locale/localedef Makefile \
$(addprefix charmaps/,$(CHARMAPS)) $(addprefix locales/,$(LOCALE_SRCS))
- @$(SHELL) -e gen-locale.sh $(common-objpfx) \
+ @$(SHELL) gen-locale.sh $(common-objpfx) \
'$(if $(cross-localedef), \
$(cross-localedef), \
$(built-program-cmd))' \
@@ -169,45 +168,45 @@ endif
$(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
$(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(test-input) \
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' $(test-input) \
> $@
$(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \
$(objpfx)sort-test.out \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' tst-fmon.data \
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' tst-fmon.data \
> $@
$(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
$(objpfx)sort-test.out \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' tst-numeric.data \
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' tst-numeric.data \
> $@
$(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
$(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)' > $@
+ $(SHELL) $< $(common-objpfx) '$(built-program-cmd)' > $@
$(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
$(objpfx)tst-fmon.out \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)' > $@
+ $(SHELL) $< $(common-objpfx) '$(built-program-cmd)' > $@
$(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)'
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
$(objpfx)tst-mbswcs.out: tst-mbswcs.sh $(objpfx)tst-mbswcs1 \
$(objpfx)tst-mbswcs2 $(objpfx)tst-mbswcs3 \
$(objpfx)tst-mbswcs4 $(objpfx)tst-mbswcs5 \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)'
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
$(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
$(objpfx)sort-test.out \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
+ $(SHELL) $< $(common-objpfx) '$(built-program-cmd)'
$(objpfx)tst-wctype.out: tst-wctype.sh $(objpfx)tst-wctype \
$(objpfx)sort-test.out tst-wctype.input \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
+ $(SHELL) $< $(common-objpfx) '$(built-program-cmd)'
$(objpfx)tst-langinfo.out: tst-langinfo.sh $(objpfx)tst-langinfo \
$(objpfx)sort-test.out \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
+ $(SHELL) $< $(common-objpfx) '$(built-program-cmd)'
$(objpfx)tst-digits.out: $(objpfx)tst-locale.out
$(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
# eglibc: endif
diff --git a/libc/localedata/gen-locale.sh b/libc/localedata/gen-locale.sh
index 89a9e06ee..6dfa7caca 100644
--- a/libc/localedata/gen-locale.sh
+++ b/libc/localedata/gen-locale.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Generate test locale files.
-# Copyright (C) 2000,01,02 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx="$1"; shift
localedef="$1"; shift
locfile="$1"; shift
diff --git a/libc/localedata/locales/es_DO b/libc/localedata/locales/es_DO
index 7cf54cf3a..4753ecfdd 100644
--- a/libc/localedata/locales/es_DO
+++ b/libc/localedata/locales/es_DO
@@ -78,7 +78,9 @@ n_sign_posn 1
END LC_MONETARY
LC_NUMERIC
-copy "es_ES"
+decimal_point "<U002E>"
+thousands_sep "<U002C>"
+grouping 3;3
END LC_NUMERIC
LC_TIME
diff --git a/libc/localedata/locales/es_GT b/libc/localedata/locales/es_GT
index 49d369f74..0889d44c4 100644
--- a/libc/localedata/locales/es_GT
+++ b/libc/localedata/locales/es_GT
@@ -77,7 +77,9 @@ n_sign_posn 1
END LC_MONETARY
LC_NUMERIC
-copy "es_ES"
+decimal_point "<U002E>"
+thousands_sep "<U002C>"
+grouping 3;3
END LC_NUMERIC
LC_TIME
diff --git a/libc/localedata/locales/es_HN b/libc/localedata/locales/es_HN
index a80918846..febab6bbe 100644
--- a/libc/localedata/locales/es_HN
+++ b/libc/localedata/locales/es_HN
@@ -78,7 +78,9 @@ n_sign_posn 1
END LC_MONETARY
LC_NUMERIC
-copy "es_ES"
+decimal_point "<U002E>"
+thousands_sep "<U002C>"
+grouping 3;3
END LC_NUMERIC
LC_TIME
diff --git a/libc/localedata/locales/es_MX b/libc/localedata/locales/es_MX
index 7a1cccc96..a201f0bbb 100644
--- a/libc/localedata/locales/es_MX
+++ b/libc/localedata/locales/es_MX
@@ -78,7 +78,9 @@ n_sign_posn 1
END LC_MONETARY
LC_NUMERIC
-copy "es_ES"
+decimal_point "<U002E>"
+thousands_sep "<U2009>"
+grouping 3;3
END LC_NUMERIC
LC_TIME
diff --git a/libc/localedata/locales/es_NI b/libc/localedata/locales/es_NI
index 737153207..384ebaa07 100644
--- a/libc/localedata/locales/es_NI
+++ b/libc/localedata/locales/es_NI
@@ -69,7 +69,9 @@ n_sign_posn 1
END LC_MONETARY
LC_NUMERIC
-copy "es_ES"
+decimal_point "<U002E>"
+thousands_sep "<U002C>"
+grouping 3;3
END LC_NUMERIC
LC_TIME
diff --git a/libc/localedata/locales/es_PA b/libc/localedata/locales/es_PA
index ae5cd3a4f..7f22166f3 100644
--- a/libc/localedata/locales/es_PA
+++ b/libc/localedata/locales/es_PA
@@ -78,7 +78,9 @@ n_sign_posn 1
END LC_MONETARY
LC_NUMERIC
-copy "es_ES"
+decimal_point "<U002E>"
+thousands_sep "<U002c>"
+grouping 3;3
END LC_NUMERIC
LC_TIME
diff --git a/libc/localedata/locales/es_PR b/libc/localedata/locales/es_PR
index b15ca4522..93d7d21c2 100644
--- a/libc/localedata/locales/es_PR
+++ b/libc/localedata/locales/es_PR
@@ -69,7 +69,9 @@ n_sign_posn 1
END LC_MONETARY
LC_NUMERIC
-copy "es_ES"
+decimal_point "<U002E>"
+thousands_sep "<U002C>"
+grouping 3;3
END LC_NUMERIC
LC_TIME
diff --git a/libc/localedata/locales/es_SV b/libc/localedata/locales/es_SV
index d99b6cff6..fa5e5805c 100644
--- a/libc/localedata/locales/es_SV
+++ b/libc/localedata/locales/es_SV
@@ -78,7 +78,9 @@ n_sign_posn 1
END LC_MONETARY
LC_NUMERIC
-copy "es_ES"
+decimal_point "<U002E>"
+thousands_sep "<U002C>"
+grouping 3;3
END LC_NUMERIC
LC_TIME
diff --git a/libc/localedata/sort-test.sh b/libc/localedata/sort-test.sh
index 67de72eef..8f8be8f67 100644
--- a/libc/localedata/sort-test.sh
+++ b/libc/localedata/sort-test.sh
@@ -1,4 +1,23 @@
#! /bin/sh
+# Test collation using xfrm-test.
+# Copyright (C) 1997-2012 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+set -e
common_objpfx=$1; shift
run_program_prefix=$1; shift
diff --git a/libc/localedata/tst-ctype.sh b/libc/localedata/tst-ctype.sh
index 61f8cae62..16420a89b 100755
--- a/libc/localedata/tst-ctype.sh
+++ b/libc/localedata/tst-ctype.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Testing the implementation of the isxxx() and toxxx() functions.
-# Copyright (C) 2000 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1; shift
tst_ctype=$1; shift
status=0
diff --git a/libc/localedata/tst-fmon.sh b/libc/localedata/tst-fmon.sh
index fc0110a6a..7e6d7f1d6 100755
--- a/libc/localedata/tst-fmon.sh
+++ b/libc/localedata/tst-fmon.sh
@@ -1,9 +1,8 @@
#! /bin/sh
# Testing the implementation of strfmon(3).
-# Copyright (C) 1996-1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Jochen Hein <jochen.hein@delphi.central.de>, 1997.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -19,6 +18,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
run_program_prefix=$2
datafile=$3
diff --git a/libc/localedata/tst-langinfo.sh b/libc/localedata/tst-langinfo.sh
index 567361c23..04771cb02 100755
--- a/libc/localedata/tst-langinfo.sh
+++ b/libc/localedata/tst-langinfo.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Test nl_langinfo.
-# Copyright (C) 2000, 2001, 2003, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
run_program_prefix=$2
diff --git a/libc/localedata/tst-locale.sh b/libc/localedata/tst-locale.sh
index 96c26a750..96eddc118 100755
--- a/libc/localedata/tst-locale.sh
+++ b/libc/localedata/tst-locale.sh
@@ -1,9 +1,8 @@
#! /bin/sh
# Testing the implementation of localedata.
-# Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+# Copyright (C) 1998-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Andreas Jaeger, <aj@arthur.rhein-neckar.de>, 1998.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -19,6 +18,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1; shift
localedef=$1; shift
diff --git a/libc/localedata/tst-mbswcs.sh b/libc/localedata/tst-mbswcs.sh
index 30667890c..5a067ec0d 100755
--- a/libc/localedata/tst-mbswcs.sh
+++ b/libc/localedata/tst-mbswcs.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Testing the implementation of the mb*towc*() and wc*tomb*() functions.
-# Copyright (C) 2000 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1; shift
run_program_prefix=$1; shift
diff --git a/libc/localedata/tst-numeric.sh b/libc/localedata/tst-numeric.sh
index ca4b4fe25..a6758477e 100644
--- a/libc/localedata/tst-numeric.sh
+++ b/libc/localedata/tst-numeric.sh
@@ -1,9 +1,8 @@
#! /bin/sh
# Testing the implementation of LC_NUMERIC and snprintf(3).
-# Copyright (C) 1996, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Jochen Hein <jochen.hein@delphi.central.de>, 1997.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -19,6 +18,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
run_program_prefix=$2
datafile=$3
diff --git a/libc/localedata/tst-rpmatch.sh b/libc/localedata/tst-rpmatch.sh
index c5e905ef3..b71416e91 100755
--- a/libc/localedata/tst-rpmatch.sh
+++ b/libc/localedata/tst-rpmatch.sh
@@ -1,6 +1,6 @@
#! /bin/sh -f
#
-# Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+# Copyright (C) 1998-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library and contains tests for
# the rpmatch(3)-implementation.
# contributed by Jochen Hein <jochen.hein@delphi.central.de>
@@ -18,6 +18,8 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
tst_rpmatch=$2
diff --git a/libc/localedata/tst-trans.sh b/libc/localedata/tst-trans.sh
index 5155a3585..e90b653ed 100755
--- a/libc/localedata/tst-trans.sh
+++ b/libc/localedata/tst-trans.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Test character mapping definitions.
-# Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
run_program_prefix=$2
diff --git a/libc/localedata/tst-wctype.sh b/libc/localedata/tst-wctype.sh
index 027fd8267..8cb34b857 100755
--- a/libc/localedata/tst-wctype.sh
+++ b/libc/localedata/tst-wctype.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Test locale-define character classes.
-# Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
tst_wctype=$2
diff --git a/libc/malloc/Makefile b/libc/malloc/Makefile
index e3be2544e..b1141f732 100644
--- a/libc/malloc/Makefile
+++ b/libc/malloc/Makefile
@@ -1,5 +1,4 @@
-# Copyright (C) 1991-2003, 2005, 2006, 2007, 2009, 2011, 2012
-# Free Software Foundation, Inc.
+# Copyright (C) 1991-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -28,7 +27,7 @@ all:
dist-headers := malloc.h
headers := $(dist-headers) obstack.h mcheck.h
tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
- tst-mallocstate tst-mcheck tst-mallocfork tst-trim1
+ tst-mallocstate tst-mcheck tst-mallocfork tst-trim1 tst-malloc-usable
test-srcs = tst-mtrace
routines = malloc morecore mcheck mtrace obstack
@@ -118,12 +117,13 @@ ifeq (yes,$(build-shared))
ifneq ($(PERL),no)
tests: $(objpfx)tst-mtrace.out
$(objpfx)tst-mtrace.out: tst-mtrace.sh $(objpfx)tst-mtrace
- $(SHELL) -e $< $(common-objpfx) '$(cross-test-wrapper)'
+ $(SHELL) $< $(common-objpfx) '$(cross-test-wrapper)'
endif
endif
# eglibc: endif
tst-mcheck-ENV = MALLOC_CHECK_=3
+tst-malloc-usable-ENV = MALLOC_CHECK_=3
CPPFLAGS-malloc.c += -DPER_THREAD
# Uncomment this for test releases. For public releases it is too expensive.
diff --git a/libc/malloc/arena.c b/libc/malloc/arena.c
index 9e5e33202..b209e3b7c 100644
--- a/libc/malloc/arena.c
+++ b/libc/malloc/arena.c
@@ -1,6 +1,5 @@
/* Malloc implementation for multiple threads without lock contention.
- Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2009,2010,2011,2012
- Free Software Foundation, Inc.
+ Copyright (C) 2001-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
@@ -20,6 +19,9 @@
#include <stdbool.h>
+/* Get the implementation for check_may_shrink_heap. */
+#include <malloc-sysdep.h>
+
/* Compile-time constants. */
#define HEAP_MIN_SIZE (32*1024)
@@ -622,9 +624,9 @@ shrink_heap(heap_info *h, long diff)
new_size = (long)h->size - diff;
if(new_size < (long)sizeof(*h))
return -1;
- /* Try to re-map the extra heap space freshly to save memory, and
- make it inaccessible. */
- if (__builtin_expect (__libc_enable_secure, 0))
+ /* Try to re-map the extra heap space freshly to save memory, and make it
+ inaccessible. See malloc-sysdep.h to know when this is true. */
+ if (__builtin_expect (check_may_shrink_heap (), 0))
{
if((char *)MMAP((char *)h + new_size, diff, PROT_NONE,
MAP_FIXED) == (char *) MAP_FAILED)
@@ -656,15 +658,19 @@ heap_trim(heap_info *heap, size_t pad)
unsigned long pagesz = GLRO(dl_pagesize);
mchunkptr top_chunk = top(ar_ptr), p, bck, fwd;
heap_info *prev_heap;
- long new_size, top_size, extra;
+ long new_size, top_size, extra, prev_size, misalign;
/* Can this heap go away completely? */
while(top_chunk == chunk_at_offset(heap, sizeof(*heap))) {
prev_heap = heap->prev;
- p = chunk_at_offset(prev_heap, prev_heap->size - (MINSIZE-2*SIZE_SZ));
+ prev_size = prev_heap->size - (MINSIZE-2*SIZE_SZ);
+ p = chunk_at_offset(prev_heap, prev_size);
+ /* fencepost must be properly aligned. */
+ misalign = ((long) p) & MALLOC_ALIGN_MASK;
+ p = chunk_at_offset(prev_heap, prev_size - misalign);
assert(p->size == (0|PREV_INUSE)); /* must be fencepost */
p = prev_chunk(p);
- new_size = chunksize(p) + (MINSIZE-2*SIZE_SZ);
+ new_size = chunksize(p) + (MINSIZE-2*SIZE_SZ) + misalign;
assert(new_size>0 && new_size<(long)(2*MINSIZE));
if(!prev_inuse(p))
new_size += p->prev_size;
@@ -918,6 +924,27 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
return a;
}
+/* If we don't have the main arena, then maybe the failure is due to running
+ out of mmapped areas, so we can try allocating on the main arena.
+ Otherwise, it is likely that sbrk() has failed and there is still a chance
+ to mmap(), so try one of the other arenas. */
+static mstate
+arena_get_retry (mstate ar_ptr, size_t bytes)
+{
+ if(ar_ptr != &main_arena) {
+ (void)mutex_unlock(&ar_ptr->mutex);
+ ar_ptr = &main_arena;
+ (void)mutex_lock(&ar_ptr->mutex);
+ } else {
+ /* Grab ar_ptr->next prior to releasing its lock. */
+ mstate prev = ar_ptr->next ? ar_ptr : 0;
+ (void)mutex_unlock(&ar_ptr->mutex);
+ ar_ptr = arena_get2(prev, bytes, ar_ptr);
+ }
+
+ return ar_ptr;
+}
+
#ifdef PER_THREAD
static void __attribute__ ((section ("__libc_thread_freeres_fn")))
arena_thread_freeres (void)
diff --git a/libc/malloc/hooks.c b/libc/malloc/hooks.c
index 8a34c7848..b38dffbdf 100644
--- a/libc/malloc/hooks.c
+++ b/libc/malloc/hooks.c
@@ -1,5 +1,5 @@
/* Malloc implementation for multiple threads without lock contention.
- Copyright (C) 2001-2009, 2011, 2012 Free Software Foundation, Inc.
+ Copyright (C) 2001-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
@@ -89,6 +89,35 @@ __malloc_check_init()
#define MAGICBYTE(p) ( ( ((size_t)p >> 3) ^ ((size_t)p >> 11)) & 0xFF )
+/* Visualize the chunk as being partitioned into blocks of 256 bytes from the
+ highest address of the chunk, downwards. The beginning of each block tells
+ us the size of the previous block, up to the actual size of the requested
+ memory. Our magic byte is right at the end of the requested size, so we
+ must reach it with this iteration, otherwise we have witnessed a memory
+ corruption. */
+static size_t
+malloc_check_get_size(mchunkptr p)
+{
+ size_t size;
+ unsigned char c;
+ unsigned char magic = MAGICBYTE(p);
+
+ assert(using_malloc_checking == 1);
+
+ for (size = chunksize(p) - 1 + (chunk_is_mmapped(p) ? 0 : SIZE_SZ);
+ (c = ((unsigned char*)p)[size]) != magic;
+ size -= c) {
+ if(c<=0 || size<(c+2*SIZE_SZ)) {
+ malloc_printerr(check_action, "malloc_check_get_size: memory corruption",
+ chunk2mem(p));
+ return 0;
+ }
+ }
+
+ /* chunk2mem size. */
+ return size - 2*SIZE_SZ;
+}
+
/* Instrument a chunk with overrun detector byte(s) and convert it
into a user pointer with requested size sz. */
diff --git a/libc/malloc/malloc.c b/libc/malloc/malloc.c
index 0f1796c91..ca1d73f87 100644
--- a/libc/malloc/malloc.c
+++ b/libc/malloc/malloc.c
@@ -1,5 +1,5 @@
/* Malloc implementation for multiple threads without lock contention.
- Copyright (C) 1996-2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+ Copyright (C) 1996-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wg@malloc.de>
and Doug Lea <dl@cs.oswego.edu>, 2001.
@@ -2858,23 +2858,10 @@ __libc_malloc(size_t bytes)
return 0;
victim = _int_malloc(ar_ptr, bytes);
if(!victim) {
- /* Maybe the failure is due to running out of mmapped areas. */
- if(ar_ptr != &main_arena) {
- (void)mutex_unlock(&ar_ptr->mutex);
- ar_ptr = &main_arena;
- (void)mutex_lock(&ar_ptr->mutex);
+ ar_ptr = arena_get_retry(ar_ptr, bytes);
+ if (__builtin_expect(ar_ptr != NULL, 1)) {
victim = _int_malloc(ar_ptr, bytes);
(void)mutex_unlock(&ar_ptr->mutex);
- } else {
- /* ... or sbrk() has failed and there is still a chance to mmap()
- Grab ar_ptr->next prior to releasing its lock. */
- mstate prev = ar_ptr->next ? ar_ptr : 0;
- (void)mutex_unlock(&ar_ptr->mutex);
- ar_ptr = arena_get2(prev, bytes, ar_ptr);
- if(ar_ptr) {
- victim = _int_malloc(ar_ptr, bytes);
- (void)mutex_unlock(&ar_ptr->mutex);
- }
}
} else
(void)mutex_unlock(&ar_ptr->mutex);
@@ -3038,23 +3025,10 @@ __libc_memalign(size_t alignment, size_t bytes)
return 0;
p = _int_memalign(ar_ptr, alignment, bytes);
if(!p) {
- /* Maybe the failure is due to running out of mmapped areas. */
- if(ar_ptr != &main_arena) {
- (void)mutex_unlock(&ar_ptr->mutex);
- ar_ptr = &main_arena;
- (void)mutex_lock(&ar_ptr->mutex);
+ ar_ptr = arena_get_retry (ar_ptr, bytes);
+ if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, alignment, bytes);
(void)mutex_unlock(&ar_ptr->mutex);
- } else {
- /* ... or sbrk() has failed and there is still a chance to mmap()
- Grab ar_ptr->next prior to releasing its lock. */
- mstate prev = ar_ptr->next ? ar_ptr : 0;
- (void)mutex_unlock(&ar_ptr->mutex);
- ar_ptr = arena_get2(prev, bytes, ar_ptr);
- if(ar_ptr) {
- p = _int_memalign(ar_ptr, alignment, bytes);
- (void)mutex_unlock(&ar_ptr->mutex);
- }
}
} else
(void)mutex_unlock(&ar_ptr->mutex);
@@ -3088,23 +3062,10 @@ __libc_valloc(size_t bytes)
return 0;
p = _int_valloc(ar_ptr, bytes);
if(!p) {
- /* Maybe the failure is due to running out of mmapped areas. */
- if(ar_ptr != &main_arena) {
- (void)mutex_unlock(&ar_ptr->mutex);
- ar_ptr = &main_arena;
- (void)mutex_lock(&ar_ptr->mutex);
+ ar_ptr = arena_get_retry (ar_ptr, bytes);
+ if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, bytes);
(void)mutex_unlock(&ar_ptr->mutex);
- } else {
- /* ... or sbrk() has failed and there is still a chance to mmap()
- Grab ar_ptr->next prior to releasing its lock. */
- mstate prev = ar_ptr->next ? ar_ptr : 0;
- (void)mutex_unlock(&ar_ptr->mutex);
- ar_ptr = arena_get2(prev, bytes, ar_ptr);
- if(ar_ptr) {
- p = _int_memalign(ar_ptr, pagesz, bytes);
- (void)mutex_unlock(&ar_ptr->mutex);
- }
}
} else
(void)mutex_unlock (&ar_ptr->mutex);
@@ -3136,23 +3097,10 @@ __libc_pvalloc(size_t bytes)
arena_get(ar_ptr, bytes + 2*pagesz + MINSIZE);
p = _int_pvalloc(ar_ptr, bytes);
if(!p) {
- /* Maybe the failure is due to running out of mmapped areas. */
- if(ar_ptr != &main_arena) {
- (void)mutex_unlock(&ar_ptr->mutex);
- ar_ptr = &main_arena;
- (void)mutex_lock(&ar_ptr->mutex);
+ ar_ptr = arena_get_retry (ar_ptr, bytes + 2*pagesz + MINSIZE);
+ if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
(void)mutex_unlock(&ar_ptr->mutex);
- } else {
- /* ... or sbrk() has failed and there is still a chance to mmap()
- Grab ar_ptr->next prior to releasing its lock. */
- mstate prev = ar_ptr->next ? ar_ptr : 0;
- (void)mutex_unlock(&ar_ptr->mutex);
- ar_ptr = arena_get2(prev, bytes + 2*pagesz + MINSIZE, ar_ptr);
- if(ar_ptr) {
- p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
- (void)mutex_unlock(&ar_ptr->mutex);
- }
}
} else
(void)mutex_unlock(&ar_ptr->mutex);
@@ -3225,22 +3173,10 @@ __libc_calloc(size_t n, size_t elem_size)
av == arena_for_chunk(mem2chunk(mem)));
if (mem == 0) {
- /* Maybe the failure is due to running out of mmapped areas. */
- if(av != &main_arena) {
- (void)mutex_unlock(&av->mutex);
- (void)mutex_lock(&main_arena.mutex);
- mem = _int_malloc(&main_arena, sz);
- (void)mutex_unlock(&main_arena.mutex);
- } else {
- /* ... or sbrk() has failed and there is still a chance to mmap()
- Grab av->next prior to releasing its lock. */
- mstate prev = av->next ? av : 0;
+ av = arena_get_retry (av, sz);
+ if (__builtin_expect(av != NULL, 1)) {
+ mem = _int_malloc(av, sz);
(void)mutex_unlock(&av->mutex);
- av = arena_get2(prev, sz, av);
- if(av) {
- mem = _int_malloc(av, sz);
- (void)mutex_unlock(&av->mutex);
- }
}
if (mem == 0) return 0;
} else
@@ -4563,6 +4499,9 @@ musable(void* mem)
mchunkptr p;
if (mem != 0) {
p = mem2chunk(mem);
+
+ if (__builtin_expect(using_malloc_checking == 1, 0))
+ return malloc_check_get_size(p);
if (chunk_is_mmapped(p))
return chunksize(p) - 2*SIZE_SZ;
else if (inuse(p))
@@ -4766,13 +4705,15 @@ int __libc_mallopt(int param_number, int value)
if((unsigned long)value > HEAP_MAX_SIZE/2)
res = 0;
else
- mp_.mmap_threshold = value;
- mp_.no_dyn_threshold = 1;
+ {
+ mp_.mmap_threshold = value;
+ mp_.no_dyn_threshold = 1;
+ }
break;
case M_MMAP_MAX:
- mp_.n_mmaps_max = value;
- mp_.no_dyn_threshold = 1;
+ mp_.n_mmaps_max = value;
+ mp_.no_dyn_threshold = 1;
break;
case M_CHECK_ACTION:
diff --git a/libc/malloc/mcheck.c b/libc/malloc/mcheck.c
index 9d8a41467..c5addc55a 100644
--- a/libc/malloc/mcheck.c
+++ b/libc/malloc/mcheck.c
@@ -1,6 +1,5 @@
/* Standard debugging hooks for `malloc'.
- Copyright (C) 1990-1997,1999,2000-2002,2007,2010,2012
- Free Software Foundation, Inc.
+ Copyright (C) 1990-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written May 1989 by Mike Haertel.
@@ -122,7 +121,7 @@ checkhdr (const struct hdr *hdr)
void
mcheck_check_all (void)
{
- /* Walk through all the active blocks and test whether they were tempered
+ /* Walk through all the active blocks and test whether they were tampered
with. */
struct hdr *runp = root;
diff --git a/libc/malloc/memusage.c b/libc/malloc/memusage.c
index b3a96dcff..c01d7db1d 100644
--- a/libc/malloc/memusage.c
+++ b/libc/malloc/memusage.c
@@ -1,5 +1,5 @@
/* Profile heap and stack memory usage of running program.
- Copyright (C) 1998-2002, 2004-2006, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1998-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -570,7 +570,7 @@ free (void *ptr)
}
-/* `mmap' replacement. We do not have to keep track of the sizesince
+/* `mmap' replacement. We do not have to keep track of the size since
`munmap' will get it as a parameter. */
void *
mmap (void *start, size_t len, int prot, int flags, int fd, off_t offset)
@@ -622,7 +622,7 @@ mmap (void *start, size_t len, int prot, int flags, int fd, off_t offset)
}
-/* `mmap' replacement. We do not have to keep track of the sizesince
+/* `mmap64' replacement. We do not have to keep track of the size since
`munmap' will get it as a parameter. */
void *
mmap64 (void *start, size_t len, int prot, int flags, int fd, off64_t offset)
@@ -674,7 +674,7 @@ mmap64 (void *start, size_t len, int prot, int flags, int fd, off64_t offset)
}
-/* `mmap' replacement. We do not have to keep track of the sizesince
+/* `mremap' replacement. We do not have to keep track of the size since
`munmap' will get it as a parameter. */
void *
mremap (void *start, size_t old_len, size_t len, int flags, ...)
diff --git a/libc/malloc/tst-malloc-usable.c b/libc/malloc/tst-malloc-usable.c
new file mode 100644
index 000000000..18decd852
--- /dev/null
+++ b/libc/malloc/tst-malloc-usable.c
@@ -0,0 +1,49 @@
+/* Ensure that malloc_usable_size returns the request size with
+ MALLOC_CHECK_ exported to a positive value.
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <malloc.h>
+#include <string.h>
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+ size_t usable_size;
+ void *p = malloc (7);
+ if (!p)
+ {
+ printf ("memory allocation failed\n");
+ return 1;
+ }
+
+ usable_size = malloc_usable_size (p);
+ if (usable_size != 7)
+ {
+ printf ("malloc_usable_size: expected 7 but got %zu\n", usable_size);
+ return 1;
+ }
+
+ memset (p, 0, usable_size);
+ free (p);
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/malloc/tst-mtrace.sh b/libc/malloc/tst-mtrace.sh
index 8f78a4882..90e44c5c3 100755
--- a/libc/malloc/tst-mtrace.sh
+++ b/libc/malloc/tst-mtrace.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Testing the mtrace function.
-# Copyright (C) 2000, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1; shift
cross_test_wrapper="$1"; shift
diff --git a/libc/manual/arith.texi b/libc/manual/arith.texi
index 572808c89..3f4e56a6e 100644
--- a/libc/manual/arith.texi
+++ b/libc/manual/arith.texi
@@ -1966,10 +1966,10 @@ negated imaginary part. In other words, @samp{conj(a + bi) = a + -bi}.
These functions return the argument of the complex number @var{z}.
The argument of a complex number is the angle in the complex plane
between the positive real axis and a line passing through zero and the
-number. This angle is measured in the usual fashion and ranges from @math{0}
-to @math{2@pi{}}.
+number. This angle is measured in the usual fashion and ranges from
+@math{-@pi{}} to @math{@pi{}}.
-@code{carg} has a branch cut along the positive real axis.
+@code{carg} has a branch cut along the negative real axis.
@end deftypefun
@comment complex.h
diff --git a/libc/manual/contrib.texi b/libc/manual/contrib.texi
index e28e2f251..3052fc11a 100644
--- a/libc/manual/contrib.texi
+++ b/libc/manual/contrib.texi
@@ -223,8 +223,9 @@ Carlos O'Donell for his maintainership of the HPPA architecture and
maintaining @theglibc{} web pages.
@item
-Alexandra Oliva for adding TLS descriptors for LD and GD on x86 and
-x86-64.
+Alexandre Oliva for adding TLS descriptors for LD and GD on x86 and
+x86-64, for the am33 port, for completing the MIPS n64/n32/o32 multilib
+port, and for various fixes.
@item
Paul Pluzhnikov for various fixes.
diff --git a/libc/manual/examples/inetcli.c b/libc/manual/examples/inetcli.c
index afd4a91a6..cd981b1c6 100644
--- a/libc/manual/examples/inetcli.c
+++ b/libc/manual/examples/inetcli.c
@@ -26,7 +26,7 @@
#define PORT 5555
#define MESSAGE "Yow!!! Are we having fun yet?!?"
-#define SERVERHOST "mescaline.gnu.org"
+#define SERVERHOST "www.gnu.org"
void
write_to_server (int filedes)
diff --git a/libc/manual/memory.texi b/libc/manual/memory.texi
index 35fed23c7..fba3a2cff 100644
--- a/libc/manual/memory.texi
+++ b/libc/manual/memory.texi
@@ -16,8 +16,8 @@ and allocation of real memory.
@menu
* Memory Concepts:: An introduction to concepts and terminology.
* Memory Allocation:: Allocating storage for your program data
-* Locking Pages:: Preventing page faults
* Resizing the Data Segment:: @code{brk}, @code{sbrk}
+* Locking Pages:: Preventing page faults
@end menu
Memory mapped I/O is not discussed in this chapter. @xref{Memory-mapped I/O}.
diff --git a/libc/manual/socket.texi b/libc/manual/socket.texi
index a08ac4c67..b12c59131 100644
--- a/libc/manual/socket.texi
+++ b/libc/manual/socket.texi
@@ -809,7 +809,7 @@ numeric host addresses as sequences of up to eight numbers separated by
colons, as in @samp{5f03:1200:836f:c100::1}.
Each computer also has one or more @dfn{host names}, which are strings
-of words separated by periods, as in @samp{mescaline.gnu.org}.
+of words separated by periods, as in @samp{www.gnu.org}.
Programs that let the user specify a host typically accept both numeric
addresses and host names. To open a connection a program needs a
diff --git a/libc/math/libm-test.inc b/libc/math/libm-test.inc
index 5609903fe..83d58998f 100644
--- a/libc/math/libm-test.inc
+++ b/libc/math/libm-test.inc
@@ -2760,6 +2760,13 @@ cos_test (void)
TEST_f_f (cos, 0x1p16383L, 0.9210843909921906206874509522505756251609L);
#endif
+ TEST_f_f (cos, 0x1p+120, -9.25879022854837867303861764107414946730833e-01L);
+ TEST_f_f (cos, 0x1p+127, 7.81914638714960072263910298466369236613162e-01L);
+ TEST_f_f (cos, 0x1.fffff8p+127, 9.98819362551949040703862043664101081064641e-01L);
+ TEST_f_f (cos, 0x1.fffffep+127, 8.53021039830304158051791467692161107353094e-01L);
+ TEST_f_f (cos, 0x1p+50, 8.68095904660550604334592502063501320395739e-01L);
+ TEST_f_f (cos, 0x1p+28, -1.65568979490578758865468278195361551113358e-01L);
+
END (cos);
}
@@ -8192,6 +8199,13 @@ sin_test (void)
TEST_f_f (sin, 0x1p16383L, 0.3893629985894208126948115852610595405563L);
#endif
+ TEST_f_f (sin, 0x1p+120, 3.77820109360752022655548470056922991960587e-01L);
+ TEST_f_f (sin, 0x1p+127, 6.23385512955870240370428801097126489001833e-01L);
+ TEST_f_f (sin, 0x1.fffff8p+127, 4.85786063130487339701113680434728152037092e-02L);
+ TEST_f_f (sin, 0x1.fffffep+127, -5.21876523333658540551505357019806722935726e-01L);
+ TEST_f_f (sin, 0x1p+50, 4.96396515208940840876821859865411368093356e-01L);
+ TEST_f_f (sin, 0x1p+28, -9.86198211836975655703110310527108292055548e-01L);
+
END (sin);
}
@@ -8375,6 +8389,13 @@ sincos_test (void)
TEST_extra (sincos, 0x1p16383L, 0.3893629985894208126948115852610595405563L, 0.9210843909921906206874509522505756251609L);
#endif
+ TEST_extra (sincos, 0x1p+120, 3.77820109360752022655548470056922991960587e-01L, -9.25879022854837867303861764107414946730833e-01L);
+ TEST_extra (sincos, 0x1p+127, 6.23385512955870240370428801097126489001833e-01L, 7.81914638714960072263910298466369236613162e-01L);
+ TEST_extra (sincos, 0x1.fffff8p+127, 4.85786063130487339701113680434728152037092e-02L, 9.98819362551949040703862043664101081064641e-01L);
+ TEST_extra (sincos, 0x1.fffffep+127, -5.21876523333658540551505357019806722935726e-01L, 8.53021039830304158051791467692161107353094e-01L);
+ TEST_extra (sincos, 0x1p+50, 4.96396515208940840876821859865411368093356e-01L, 8.68095904660550604334592502063501320395739e-01L);
+ TEST_extra (sincos, 0x1p+28, -9.86198211836975655703110310527108292055548e-01L, -1.65568979490578758865468278195361551113358e-01L);
+
END (sincos);
}
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog
index eb8486358..217693250 100644
--- a/libc/nptl/ChangeLog
+++ b/libc/nptl/ChangeLog
@@ -1,6 +1,61 @@
-2012-08-15 Roland McGrath <roland@hack.frob.com>
+2012-09-24 Dmitry V. Levin <ldv@altlinux.org>
-2012-08-15 Roland McGrath <roland@hack.frob.com>
+ * tst-tls6.sh: Add "set -e".
+ * Makefile: Do not specify -e option when running testsuite
+ shell scripts.
+
+ * tst-tls6.sh: Add copyright header.
+
+2012-09-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/x86_64/tls.h (THREAD_SETMEM): Add "()" when casting
+ to uint64_t for 64-bit store.
+ (THREAD_SETMEM_NC): Likewise.
+
+2012-09-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/i386/tls.h (THREAD_SETMEM): Cast to uint64_t for
+ 64-bit store.
+ (THREAD_SETMEM_NC): Likewise.
+
+2012-09-14 Jeff Law <law@redhat.com>
+
+ [BZ #14583]
+ * sysdeps/pthread/pthread.h: Fix prototype of __sigsetjmp.
+
+2012-09-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14576]
+ * sysdeps/pthread/bits/libc-lockP.h (__rtld_lock_init_recursive):
+ Removed.
+
+2012-09-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile (LDFLAGS-tst-cancel24): Renamed to ...
+ (LDLIBS-tst-cancel24): This.
+
+2012-09-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14545]
+ * Makefile (tests-static): Add tst-cancel21-static.
+ (tests): Likewise.
+ * tst-cancel21-static.c: New file.
+
+2012-09-01 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/pthread_getcpuclockid.c
+ [!__ASSUME_POSIX_CPU_TIMERS]: Remove conditional code.
+ [__NR_clock_getres]: Make code unconditional.
+ (pthread_getcpuclockid): Remove code left unreachable by removal
+ of conditionals.
+
+2012-08-31 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #14532]
+ * sysdeps/unix/sysv/linux/sem_post.c (__new_sem_post): Use
+ atomic_compare_and_exchange_bool_rel.
+ * tst-sem14.c: New file.
+ * Makefile (tests): Add tst-sem14.
2012-08-15 Roland McGrath <roland@hack.frob.com>
diff --git a/libc/nptl/Makefile b/libc/nptl/Makefile
index deb83170c..5d781e206 100644
--- a/libc/nptl/Makefile
+++ b/libc/nptl/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2008,2009,2010,2012 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -221,7 +221,7 @@ tests = tst-typesizes \
tst-once1 tst-once2 tst-once3 tst-once4 \
tst-key1 tst-key2 tst-key3 tst-key4 \
tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \
- tst-sem8 tst-sem9 tst-sem10 tst-sem11 tst-sem12 tst-sem13 \
+ tst-sem8 tst-sem9 tst-sem10 tst-sem11 tst-sem12 tst-sem13 tst-sem14 \
tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \
tst-align tst-align2 tst-align3 \
tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \
@@ -367,8 +367,9 @@ CFLAGS-funlockfile.c = $(libio-mtsafe)
link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
$(common-objpfx)libc.a
-tests-static += tst-locale1 tst-locale2 tst-stackguard1-static
-tests += tst-stackguard1-static
+tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \
+ tst-cancel21-static
+tests += tst-stackguard1-static tst-cancel21-static
xtests-static += tst-setuid1-static
# These tests are linked with libc before libpthread
@@ -490,7 +491,7 @@ $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
$(objpfx)tst-tls5moda.so $(objpfx)tst-tls5modb.so \
$(objpfx)tst-tls5modc.so $(objpfx)tst-tls5modd.so \
$(objpfx)tst-tls5mode.so $(objpfx)tst-tls5modf.so
- $(SHELL) -e tst-tls6.sh $(common-objpfx) $(elf-objpfx) \
+ $(SHELL) $< $(common-objpfx) $(elf-objpfx) \
$(rtld-installed-name) '$(cross-test-wrapper)' \
$(..)scripts/run-with-env.sh
endif
@@ -526,7 +527,7 @@ $(objpfx)tst-clock2: $(common-objpfx)rt/librt.a
$(objpfx)tst-rwlock14: $(common-objpfx)rt/librt.a
endif
-LDFLAGS-tst-cancel24 = $(no-as-needed) -lstdc++
+LDLIBS-tst-cancel24 = $(no-as-needed) -lstdc++
extra-B-pthread.so = -B$(common-objpfx)nptl/
$(objpfx)libpthread.so: $(addprefix $(objpfx),$(crti-objs) $(crtn-objs))
diff --git a/libc/nptl/sysdeps/i386/tls.h b/libc/nptl/sysdeps/i386/tls.h
index ab4270832..65497cf92 100644
--- a/libc/nptl/sysdeps/i386/tls.h
+++ b/libc/nptl/sysdeps/i386/tls.h
@@ -343,7 +343,7 @@ union user_desc_init
\
asm volatile ("movl %%eax,%%gs:%P1\n\t" \
"movl %%edx,%%gs:%P2" : \
- : "A" (value), \
+ : "A" ((uint64_t) (value)), \
"i" (offsetof (struct pthread, member)), \
"i" (offsetof (struct pthread, member) + 4)); \
}})
@@ -370,7 +370,7 @@ union user_desc_init
\
asm volatile ("movl %%eax,%%gs:%P1(,%2,8)\n\t" \
"movl %%edx,%%gs:4+%P1(,%2,8)" : \
- : "A" (value), \
+ : "A" ((uint64_t) (value)), \
"i" (offsetof (struct pthread, member)), \
"r" (idx)); \
}})
diff --git a/libc/nptl/sysdeps/pthread/bits/libc-lockP.h b/libc/nptl/sysdeps/pthread/bits/libc-lockP.h
index 9175f719c..46f7939fd 100644
--- a/libc/nptl/sysdeps/pthread/bits/libc-lockP.h
+++ b/libc/nptl/sysdeps/pthread/bits/libc-lockP.h
@@ -148,18 +148,6 @@ typedef pthread_key_t __libc_key_t;
__libc_maybe_call (__pthread_rwlock_init, (&(NAME), NULL), 0)
#endif
-#define __rtld_lock_init_recursive(NAME) \
- do { \
- if (__pthread_mutex_init != NULL) \
- { \
- pthread_mutexattr_t __attr; \
- __pthread_mutexattr_init (&__attr); \
- __pthread_mutexattr_settype (&__attr, PTHREAD_MUTEX_RECURSIVE_NP); \
- __pthread_mutex_init (&(NAME).mutex, &__attr); \
- __pthread_mutexattr_destroy (&__attr); \
- } \
- } while (0)
-
/* Finalize the named lock variable, which must be locked. It cannot be
used again until __libc_lock_init is called again on it. This must be
called on a lock variable before the containing storage is reused. */
diff --git a/libc/nptl/sysdeps/pthread/pthread.h b/libc/nptl/sysdeps/pthread/pthread.h
index 246c1a0cd..00cc7e854 100644
--- a/libc/nptl/sysdeps/pthread/pthread.h
+++ b/libc/nptl/sysdeps/pthread/pthread.h
@@ -731,7 +731,7 @@ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
/* Function used in the macros. */
struct __jmp_buf_tag;
-extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROW;
+extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
/* Mutex handling. */
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/pthread_getcpuclockid.c b/libc/nptl/sysdeps/unix/sysv/linux/pthread_getcpuclockid.c
index 7d7287b4b..368f2c460 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/pthread_getcpuclockid.c
+++ b/libc/nptl/sysdeps/unix/sysv/linux/pthread_getcpuclockid.c
@@ -24,10 +24,6 @@
#include <kernel-posix-cpu-timers.h>
-#if !(__ASSUME_POSIX_CPU_TIMERS > 0)
-int __libc_missing_posix_cpu_timers attribute_hidden;
-#endif
-
int
pthread_getcpuclockid (threadid, clockid)
pthread_t threadid;
@@ -40,55 +36,10 @@ pthread_getcpuclockid (threadid, clockid)
/* Not a valid thread handle. */
return ESRCH;
-#ifdef __NR_clock_getres
- /* The clockid_t value is a simple computation from the TID.
- But we do a clock_getres call to validate it if we aren't
- yet sure we have the kernel support. */
+ /* The clockid_t value is a simple computation from the TID. */
const clockid_t tidclock = MAKE_THREAD_CPUCLOCK (pd->tid, CPUCLOCK_SCHED);
-# if !(__ASSUME_POSIX_CPU_TIMERS > 0)
- if (!__libc_missing_posix_cpu_timers)
- {
- INTERNAL_SYSCALL_DECL (err);
- int r = INTERNAL_SYSCALL (clock_getres, err, 2, tidclock, NULL);
- if (!INTERNAL_SYSCALL_ERROR_P (r, err))
-# endif
- {
- *clockid = tidclock;
- return 0;
- }
-
-# if !(__ASSUME_POSIX_CPU_TIMERS > 0)
- if (INTERNAL_SYSCALL_ERRNO (r, err) == EINVAL)
- {
- /* The kernel doesn't support these clocks at all. */
- __libc_missing_posix_cpu_timers = 1;
- }
- else
- return INTERNAL_SYSCALL_ERRNO (r, err);
- }
-# endif
-#endif
-
-#ifdef CLOCK_THREAD_CPUTIME_ID
- /* We need to store the thread ID in the CLOCKID variable together
- with a number identifying the clock. We reserve the low 3 bits
- for the clock ID and the rest for the thread ID. This is
- problematic if the thread ID is too large. But 29 bits should be
- fine.
-
- If some day more clock IDs are needed the ID part can be
- enlarged. The IDs are entirely internal. */
- if (pd->tid >= 1 << (8 * sizeof (*clockid) - CLOCK_IDFIELD_SIZE))
- return ERANGE;
-
- /* Store the number. */
- *clockid = CLOCK_THREAD_CPUTIME_ID | (pd->tid << CLOCK_IDFIELD_SIZE);
-
+ *clockid = tidclock;
return 0;
-#else
- /* We don't have a timer for that. */
- return ENOENT;
-#endif
}
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sem_post.c b/libc/nptl/sysdeps/unix/sysv/linux/sem_post.c
index 56f27e977..67e8cc542 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/sem_post.c
+++ b/libc/nptl/sysdeps/unix/sysv/linux/sem_post.c
@@ -1,5 +1,5 @@
/* sem_post -- post to a POSIX semaphore. Generic futex-using version.
- Copyright (C) 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2003-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -40,7 +40,7 @@ __new_sem_post (sem_t *sem)
return -1;
}
}
- while (atomic_compare_and_exchange_bool_acq (&isem->value, cur + 1, cur));
+ while (atomic_compare_and_exchange_bool_rel (&isem->value, cur + 1, cur));
atomic_full_barrier ();
if (isem->nwaiters > 0)
diff --git a/libc/nptl/sysdeps/x86_64/tls.h b/libc/nptl/sysdeps/x86_64/tls.h
index f83891605..b651d1cfa 100644
--- a/libc/nptl/sysdeps/x86_64/tls.h
+++ b/libc/nptl/sysdeps/x86_64/tls.h
@@ -256,7 +256,7 @@ typedef struct
abort (); \
\
asm volatile ("movq %q0,%%fs:%P1" : \
- : IMM_MODE ((uint64_t) value), \
+ : IMM_MODE ((uint64_t) (value)), \
"i" (offsetof (struct pthread, member))); \
}})
@@ -281,7 +281,7 @@ typedef struct
abort (); \
\
asm volatile ("movq %q0,%%fs:%P1(,%q2,8)" : \
- : IMM_MODE ((uint64_t) value), \
+ : IMM_MODE ((uint64_t) (value)), \
"i" (offsetof (struct pthread, member[0])), \
"r" (idx)); \
}})
diff --git a/libc/nptl/tst-cancel21-static.c b/libc/nptl/tst-cancel21-static.c
new file mode 100644
index 000000000..2a01061ea
--- /dev/null
+++ b/libc/nptl/tst-cancel21-static.c
@@ -0,0 +1 @@
+#include "tst-cancel21.c"
diff --git a/libc/nptl/tst-sem14.c b/libc/nptl/tst-sem14.c
new file mode 100644
index 000000000..949c03fcc
--- /dev/null
+++ b/libc/nptl/tst-sem14.c
@@ -0,0 +1,91 @@
+/* Test for sem_post race: bug 14532.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <pthread.h>
+#include <semaphore.h>
+#include <stdio.h>
+
+#define NTHREADS 10
+#define NITER 100000
+
+sem_t sem;
+int c;
+volatile int thread_fail;
+
+static void *
+tf (void *arg)
+{
+ for (int i = 0; i < NITER; i++)
+ {
+ if (sem_wait (&sem) != 0)
+ {
+ perror ("sem_wait");
+ thread_fail = 1;
+ }
+ ++c;
+ if (sem_post (&sem) != 0)
+ {
+ perror ("sem_post");
+ thread_fail = 1;
+ }
+ }
+ return NULL;
+}
+
+static int
+do_test (void)
+{
+ if (sem_init (&sem, 0, 0) != 0)
+ {
+ perror ("sem_init");
+ return 1;
+ }
+
+ pthread_t th[NTHREADS];
+ for (int i = 0; i < NTHREADS; i++)
+ {
+ if (pthread_create (&th[i], NULL, tf, NULL) != 0)
+ {
+ puts ("pthread_create failed");
+ return 1;
+ }
+ }
+
+ if (sem_post (&sem) != 0)
+ {
+ perror ("sem_post");
+ return 1;
+ }
+
+ for (int i = 0; i < NTHREADS; i++)
+ if (pthread_join (th[i], NULL) != 0)
+ {
+ puts ("pthread_join failed");
+ return 1;
+ }
+
+ if (c != NTHREADS * NITER)
+ {
+ printf ("c = %d, should be %d\n", c, NTHREADS * NITER);
+ return 1;
+ }
+ return thread_fail;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/nptl/tst-tls6.sh b/libc/nptl/tst-tls6.sh
index f1243da9c..89f8244e1 100755
--- a/libc/nptl/tst-tls6.sh
+++ b/libc/nptl/tst-tls6.sh
@@ -1,4 +1,23 @@
-#!/bin/sh
+#! /bin/sh
+# A tls test.
+# Copyright (C) 2003-2012 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+set -e
common_objpfx=$1; shift
elf_objpfx=$1; shift
diff --git a/libc/ports/ChangeLog.alpha b/libc/ports/ChangeLog.alpha
index 19edf6f13..ab807f7d4 100644
--- a/libc/ports/ChangeLog.alpha
+++ b/libc/ports/ChangeLog.alpha
@@ -1,3 +1,21 @@
+2012-12-13 Richard Henderson <rth@redhat.com>
+
+ * sysdeps/unix/sysv/linux/alpha/setfpucw.c (__setfpucw): Rewrite
+ with the assumption of being used at program startup only.
+
+ * sysdeps/unix/sysv/linux/alpha/nptl/localplt.data: Add optional
+ entries for _OtsConvertFloatTX, _OtsCvtQUX, _OtsCvtXQ, _OtsGtrX,
+ _OtsLeqX, _OtsNintXQ.
+
+ * sysdeps/alpha/fpu/libm-test-ulps: Regenerate.
+
+ * sysdeps/alpha/fpu/get-rounding-mode.h: New file.
+
+2012-08-30 Richard Henderson <rth@redhat.com>
+
+ * sysdeps/alpha/fpu/s_isnan.c: Define all aliases in terms of
+ the original __isnan symbol.
+
2012-08-27 Mike Frysinger <vapier@gentoo.org>
[BZ #5400]
diff --git a/libc/ports/ChangeLog.arm b/libc/ports/ChangeLog.arm
index 1fae5f72f..b6c022516 100644
--- a/libc/ports/ChangeLog.arm
+++ b/libc/ports/ChangeLog.arm
@@ -1,3 +1,13 @@
+2012-09-21 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/arm/bits/atomic.h [!__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4]
+ (__arch_compare_and_exchange_val_32_acq): Correct order of
+ arguments of __arm_assisted_compare_and_exchange_val_32_acq.
+
+2012-09-12 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/arm/get-rounding-mode.h: New file.
+
2012-08-27 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/arm/kernel-features.h
diff --git a/libc/ports/ChangeLog.hppa b/libc/ports/ChangeLog.hppa
index 2de923a32..d34d9c2d2 100644
--- a/libc/ports/ChangeLog.hppa
+++ b/libc/ports/ChangeLog.hppa
@@ -1,3 +1,16 @@
+2012-09-20 Carlos O'Donell <carlos@systemhalted.org>
+
+ * sysdeps/unix/sysv/linux/hppa/syscalls.list: Use __prlimit64 as
+ the strong name.
+
+2012-09-20 Carlos O'Donell <carlos@systemhalted.org>
+ Andreas Schwab <schwab@linux-m68k.org>
+
+ * sysdeps/unix/sysv/linux/hppa/Versions: Add new errlist-compat
+ entry value of 260 for GLIBC_2.17.
+ * sysdeps/unix/sysv/linux/hppa/bits/errno.h (EHWPOISON): Define if
+ not defined.
+
2012-08-27 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/hppa/kernel-features.h
diff --git a/libc/ports/ChangeLog.ia64 b/libc/ports/ChangeLog.ia64
index abc246364..39ec5ffe7 100644
--- a/libc/ports/ChangeLog.ia64
+++ b/libc/ports/ChangeLog.ia64
@@ -1,3 +1,13 @@
+2012-09-24 Mike Frysinger <vapier@gentoo.org>
+
+ * ports/sysdeps/ia64/fpu/fegetround.c (fegetround): Move contents
+ of function to ...
+ * ports/sysdeps/ia64/fpu/get-rounding-mode.h: ... here.
+
+2012-09-24 Mike Frysinger <vapier@gentoo.org>
+
+ * sysdeps/ia64/Makeconfig: New file.
+
2012-08-16 Carlos O'Donell <carlos_odonell@mentor.com>
* sysdeps/ia64/ldsodefs.h (ARCH_PLTENTER_MEMBERS)
diff --git a/libc/ports/ChangeLog.powerpc b/libc/ports/ChangeLog.powerpc
index c8a858400..af98f828e 100644
--- a/libc/ports/ChangeLog.powerpc
+++ b/libc/ports/ChangeLog.powerpc
@@ -1,3 +1,7 @@
+2012-09-12 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/powerpc/nofpu/get-rounding-mode.h: New file.
+
2012-07-25 Florian Weimer <fweimer@redhat.com>
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist:
diff --git a/libc/ports/ChangeLog.tile b/libc/ports/ChangeLog.tile
index 0be61921e..e1d4c3c76 100644
--- a/libc/ports/ChangeLog.tile
+++ b/libc/ports/ChangeLog.tile
@@ -1,3 +1,14 @@
+2012-09-17 Chris Metcalf <cmetcalf@tilera.com>
+
+ * sysdeps/tile/libm-test-ulps: Account for new tests.
+
+2012-09-06 Chris Metcalf <cmetcalf@tilera.com>
+
+ * sysdeps/unix/sysv/linux/tile/sys/procfs.h: Fix type of prfpregset_t.
+
+ [BZ #14237]
+ * sysdeps/tile/__tls_get_addr.S: Fix TLS module initialization bug.
+
2012-08-27 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/tile/kernel-features.h
diff --git a/libc/ports/sysdeps/alpha/fpu/get-rounding-mode.h b/libc/ports/sysdeps/alpha/fpu/get-rounding-mode.h
new file mode 100644
index 000000000..9d5b7246a
--- /dev/null
+++ b/libc/ports/sysdeps/alpha/fpu/get-rounding-mode.h
@@ -0,0 +1,35 @@
+/* Determine floating-point rounding mode within libc. Alpha version.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef ALPHA_GET_ROUNDING_MODE_H
+#define ALPHA_GET_ROUNDING_MODE_H 1
+
+#include <fenv.h>
+#include <fenv_libc.h>
+
+/* Return the floating-point rounding mode. */
+
+static inline int
+get_rounding_mode (void)
+{
+ unsigned long fpcr;
+ __asm__ __volatile__("excb; mf_fpcr %0" : "=f"(fpcr));
+ return (fpcr >> FPCR_ROUND_SHIFT) & 3;
+}
+
+#endif /* get-rounding-mode.h */
diff --git a/libc/ports/sysdeps/alpha/fpu/libm-test-ulps b/libc/ports/sysdeps/alpha/fpu/libm-test-ulps
index bc3d8281d..a5d29412c 100644
--- a/libc/ports/sysdeps/alpha/fpu/libm-test-ulps
+++ b/libc/ports/sysdeps/alpha/fpu/libm-test-ulps
@@ -820,20 +820,116 @@ ildouble: 1
ldouble: 1
# clog
+Test "Real part of: clog (-0x1.0000000123456p0 + 0x1.2345678p-1000 i) == 2.649094276923003995420209214900915462737e-10 + 3.141592653589793238462643383279502884197 i":
+double: 1
+idouble: 1
+Test "Real part of: clog (-0x1.0000000123456p0 + 0x1.2345678p-30 i) == 2.649094282537168795982991778475646793277e-10 + 3.141592652530155111500161671113150737892 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog (-0x1.234566p-40 - 1.0 i) == 5.354083939753840089583620652120903838944e-25 - 1.570796326795931422008642456283782656359 i":
+float: 1
+ifloat: 1
+Test "Real part of: clog (-0x1.fp+127 + 0x1p-149 i) == 88.69109041335841930424871526389807508374 + pi i":
+float: 1
+ifloat: 1
+Test "Real part of: clog (-0x1.fp+127 - 0x1p-149 i) == 88.69109041335841930424871526389807508374 - pi i":
+float: 1
+ifloat: 1
+Test "Real part of: clog (-0x1.fp+16383 + 0x1p-16445 i) == 11356.49165759582936919077408168801636572 + pi i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1.fp+16383 + 0x1p-16494 i) == 11356.49165759582936919077408168801636572 + pi i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1.fp+16383 - 0x1p-16445 i) == 11356.49165759582936919077408168801636572 - pi i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1.fp+16383 - 0x1p-16494 i) == 11356.49165759582936919077408168801636572 - pi i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1p-149 + 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 + pi/2 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog (-0x1p-149 + 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 + pi/2 i":
+float: 1
+ifloat: 1
+Test "Real part of: clog (-0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog (-0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i":
+float: 1
+ifloat: 1
+Test "Real part of: clog (-0x1p-16445 + 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 + pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1p-16445 - 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 - pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1p-16494 + 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 + pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1p-16494 - 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 - pi/2 i":
+ildouble: 1
+ldouble: 1
Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
float: 1
ifloat: 1
ildouble: 1
ldouble: 1
+Test "Real part of: clog (0x1.000566p0 + 0x1.234p-10 i) == 8.298731898331237038231468223024422855654e-5 + 1.110938609507128729312743251313024793990e-3 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog (0x1.000566p0 + 0x1.234p-10 i) == 8.298731898331237038231468223024422855654e-5 + 1.110938609507128729312743251313024793990e-3 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1.fp+127 + 0x1p-149 i) == 88.69109041335841930424871526389807508374 + +0 i":
+float: 1
+ifloat: 1
+Test "Real part of: clog (0x1.fp+127 - 0x1p-149 i) == 88.69109041335841930424871526389807508374 - 0 i":
+float: 1
+ifloat: 1
Test "Real part of: clog (0x1.fp+16383 + 0x1.fp+16383 i) == 11356.83823118610934184548269774874545400 + pi/4 i":
ildouble: 1
ldouble: 1
+Test "Real part of: clog (0x1.fp+16383 + 0x1p-16445 i) == 11356.49165759582936919077408168801636572 + +0 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1.fp+16383 + 0x1p-16494 i) == 11356.49165759582936919077408168801636572 + +0 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1.fp+16383 - 0x1p-16445 i) == 11356.49165759582936919077408168801636572 - 0 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1.fp+16383 - 0x1p-16494 i) == 11356.49165759582936919077408168801636572 - 0 i":
+ildouble: 1
+ldouble: 1
Test "Real part of: clog (0x1p-1074 + 0x1p-1074 i) == -744.0934983311012896593986823853525458290 + pi/4 i":
double: 1
idouble: 1
Test "Real part of: clog (0x1p-147 + 0x1p-147 i) == -101.5460619520319878296245057936228672231 + pi/4 i":
float: 1
ifloat: 1
+Test "Real part of: clog (0x1p-149 + 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 + pi/2 i":
+float: 1
+ifloat: 1
+Test "Real part of: clog (0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i":
+float: 1
+ifloat: 1
+Test "Real part of: clog (0x1p-16445 + 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 + pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1p-16445 - 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 - pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1p-16494 + 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 + pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1p-16494 - 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 - pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (1.0 + 0x1.234566p-10 i) == 6.172834701221959432440126967147726538097e-7 + 1.111110564353742042376451655136933182201e-3 i":
+float: 1
+ifloat: 1
# clog10
Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
@@ -846,6 +942,53 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+Test "Real part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-1000 i) == 1.150487026509145544402795327729455391948e-10 + 1.364376353841841347485783625431355770210 i":
+double: 2
+idouble: 2
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-1000 i) == 1.150487026509145544402795327729455391948e-10 + 1.364376353841841347485783625431355770210 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-30 i) == 1.150487028947346337782682105935961875822e-10 + 1.364376353381646356131680448946397884147 i":
+double: 2
+idouble: 2
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-30 i) == 1.150487028947346337782682105935961875822e-10 + 1.364376353381646356131680448946397884147 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-0x1.fp+1023 + 0x1p-1074 i) == 308.2409272754311106024666378243768099991 + 1.364376353841841347485783625431355770210 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-0x1.fp+1023 - 0x1p-1074 i) == 308.2409272754311106024666378243768099991 - 1.364376353841841347485783625431355770210 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-0x1.fp+127 + 0x1p-149 i) == 38.51805116050395969095658815123105801479 + 1.364376353841841347485783625431355770210 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-0x1.fp+127 - 0x1p-149 i) == 38.51805116050395969095658815123105801479 - 1.364376353841841347485783625431355770210 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-0x1p-1074 + 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 + 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-0x1p-1074 - 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 - 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-1.0 + 0x1.234566p-20 i) == 2.556638434669064077889576526006849923281e-13 + 1.364375882602207106407956770293808181427 i":
+double: 1
+idouble: 1
Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
ildouble: 1
ldouble: 1
@@ -903,6 +1046,46 @@ ifloat: 1
Test "Imaginary part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
ildouble: 1
ldouble: 1
+Test "Real part of: clog10 (0x1.00000000000000123456789abcp0 + 0x1.23456789p-1000 i) == 4.285899851347756186652871946325962330640e-19 + 4.611541215247321502041995872887317363241e-302 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1.00000000000000123456789abcp0 + 0x1.23456789p-1000 i) == 4.285899851347756186652871946325962330640e-19 + 4.611541215247321502041995872887317363241e-302 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1.00000000000000123456789abcp0 + 0x1.23456789p-60 i) == 4.285899851347756188767674032946882584784e-19 + 4.285899850759344225805480528847018395861e-19 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x1.000566p0 + 0x1.234p-10 i) == 3.604093470239754109961125085078190708674e-5 + 4.824745078422174667425851670822596859720e-4 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x1.000566p0 + 0x1.234p-10 i) == 3.604093470239754109961125085078190708674e-5 + 4.824745078422174667425851670822596859720e-4 i":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+Test "Real part of: clog10 (0x1.000566p0 + 0x1.234p-100 i) == 3.577293486783822178310971763308187385546e-5 + 3.897399639875661463735636919790792140598e-31 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x1.000566p0 + 0x1.234p-100 i) == 3.577293486783822178310971763308187385546e-5 + 3.897399639875661463735636919790792140598e-31 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1.234566p-30 + 1.0 i) == 2.438200411482400072282924063740535840474e-19 + 6.821881764607257184291586401763604544928e-1 i":
+float: 1
+ifloat: 1
+Test "Real part of: clog10 (0x1.234566p-50 + 1.0 i) == 2.217530356103816369479108963807448194409e-31 + 6.821881769209202348667823902864283966959e-1 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1.234566p-50 + 1.0 i) == 2.217530356103816369479108963807448194409e-31 + 6.821881769209202348667823902864283966959e-1 i":
+float: 1
+ifloat: 1
+Test "Real part of: clog10 (0x1.234566p-60 + 1.0 i) == 2.114801746467415208319767917450504756866e-37 + 6.821881769209206733143018621078368211515e-1 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1.234566p-60 + 1.0 i) == 2.114801746467415208319767917450504756866e-37 + 6.821881769209206733143018621078368211515e-1 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
Test "Imaginary part of: clog10 (0x1.fffffep+127 + 0x1.fffffep+127 i) == 38.68235441693561449174780668781319348761 + pi/4*log10(e) i":
double: 1
float: 1
@@ -923,22 +1106,65 @@ ldouble: 1
Test "Imaginary part of: clog10 (0x1p-1073 + 0x1p-1073 i) == -322.8546703496198318667349645920187712089 + pi/4*log10(e) i":
double: 1
idouble: 1
+Test "Imaginary part of: clog10 (0x1p-1074 + 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 + 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
Test "Real part of: clog10 (0x1p-1074 + 0x1p-1074 i) == -323.1557003452838130619487034867432642357 + pi/4*log10(e) i":
double: 1
idouble: 1
Test "Imaginary part of: clog10 (0x1p-1074 + 0x1p-1074 i) == -323.1557003452838130619487034867432642357 + pi/4*log10(e) i":
double: 1
idouble: 1
+Test "Imaginary part of: clog10 (0x1p-1074 - 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 - 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
Test "Imaginary part of: clog10 (0x1p-147 + 0x1p-147 i) == -44.10089436477324509881274807713822842154 + pi/4*log10(e) i":
double: 1
float: 1
idouble: 1
ifloat: 1
+Test "Imaginary part of: clog10 (0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
Test "Imaginary part of: clog10 (0x1p-149 + 0x1p-149 i) == -44.70295435610120748924022586658721447508 + pi/4*log10(e) i":
double: 1
float: 1
idouble: 1
ifloat: 1
+Test "Imaginary part of: clog10 (0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x1p-509 + 1.0 i) == 7.730698388614835910296270976605350994446e-308 + 6.821881769209206737428918127156778851051e-1 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1p-510 + 1.0 i) == 1.932674597153708977574067744151337748612e-308 + 6.821881769209206737428918127156778851051e-1 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1p-511 + 1.0 i) == 4.831686492884272443935169360378344371529e-309 + 6.821881769209206737428918127156778851051e-1 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1p-61 + 1.0 i) == 4.084085680564517578238994467153626207224e-38 + 6.821881769209206735545466044044889962925e-1 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x1p-62 + 1.0 i) == 1.021021420141129394559748616788406551878e-38 + 6.821881769209206736487192085600834406988e-1 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x1p-63 + 1.0 i) == 2.552553550352823486399371541971016379740e-39 + 6.821881769209206736958055106378806629019e-1 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (1.0 + 0x1.234566p-10 i) == 2.680828048441605163181684680300513080769e-7 + 4.825491868832381486767558728169977751564e-4 i":
+double: 1
+idouble: 1
Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
double: 1
float: 1
@@ -961,6 +1187,12 @@ idouble: 1
ifloat: 1
# cos
+Test "cos (0x1p+120) == -9.25879022854837867303861764107414946730833e-01":
+float: 1
+ifloat: 1
+Test "cos (0x1p+127) == 7.81914638714960072263910298466369236613162e-01":
+float: 1
+ifloat: 1
Test "cos (M_PI_6l * 2.0) == 0.5":
double: 1
idouble: 1
@@ -1128,6 +1360,8 @@ ifloat: 1
Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
double: 1
float: 4
@@ -1329,6 +1563,20 @@ ildouble: 1
ldouble: 1
# csqrt
+Test "Real part of: csqrt (-0x1.0000000000000000000000000001p-16382 - 0x1.0000000000000000000000000001p-16382 i) == 8.344545284118961663847948339519226074126e-2467 - 2.014551439675644900022606748976158925145e-2466 i":
+ldouble: 1
+Test "Real part of: csqrt (-0x1.0000000000000002p-16382 - 0x1.0000000000000002p-16382 i) == 8.344545284118961664300307045791497724440e-2467 - 2.014551439675644900131815801350165472778e-2466 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (-0x1.0000000000000002p-16382 - 0x1.0000000000000002p-16382 i) == 8.344545284118961664300307045791497724440e-2467 - 2.014551439675644900131815801350165472778e-2466 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: csqrt (-0x1.0000000000001p-1022 - 0x1.0000000000001p-1022 i) == 6.788430486774966350907249113759995429568e-155 - 1.638872094839911521020410942677082920935e-154 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: csqrt (-0x1.000002p-126 - 0x1.000002p-126 i) == 4.934094449071842328766868579214125217132e-20 - 1.191195773697904627170323731331667740087e-19 i":
+double: 1
+idouble: 1
Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
float: 1
ifloat: 1
@@ -1342,6 +1590,20 @@ ldouble: 1
Test "Imaginary part of: csqrt (0.75 + 1.25 i) == 1.05065169626078392338656675760808326 + 0.594868882070379067881984030639932657 i":
ildouble: 1
ldouble: 1
+Test "Imaginary part of: csqrt (0x1.0000000000000000000000000001p-16382 + 0x1.0000000000000000000000000001p-16382 i) == 2.014551439675644900022606748976158925145e-2466 + 8.344545284118961663847948339519226074126e-2":
+ldouble: 1
+Test "Real part of: csqrt (0x1.0000000000000002p-16382 + 0x1.0000000000000002p-16382 i) == 2.014551439675644900131815801350165472778e-2466 + 8.344545284118961664300307045791497724440e-2467 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0x1.0000000000000002p-16382 + 0x1.0000000000000002p-16382 i) == 2.014551439675644900131815801350165472778e-2466 + 8.344545284118961664300307045791497724440e-2467 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0x1.0000000000001p-1022 + 0x1.0000000000001p-1022 i) == 1.638872094839911521020410942677082920935e-154 + 6.788430486774966350907249113759995429568e-155 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0x1.000002p-126 + 0x1.000002p-126 i) == 1.191195773697904627170323731331667740087e-19 + 4.934094449071842328766868579214125217132e-20 i":
+double: 1
+idouble: 1
Test "Imaginary part of: csqrt (0x1.fffffep+127 + 1.0 i) == 1.844674352395372953599975585936590505260e+19 + 2.710505511993121390769065968615872097053e-20 i":
float: 1
ifloat: 1
@@ -1426,6 +1688,97 @@ Test "Real part of: ctan (1 + 47 i) == 2.729321264492904590777293425576722354636
ildouble: 1
ldouble: 1
+# ctan_downward
+Test "Real part of: ctan_downward (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i":
+ildouble: 2
+ldouble: 2
+Test "Real part of: ctan_downward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i":
+ildouble: 4
+ldouble: 4
+Test "Imaginary part of: ctan_downward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i":
+ildouble: 3
+ldouble: 3
+Test "Real part of: ctan_downward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: ctan_downward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i":
+float: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+# ctan_tonearest
+Test "Imaginary part of: ctan_tonearest (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: ctan_tonearest (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i":
+ildouble: 3
+ldouble: 3
+Test "Imaginary part of: ctan_tonearest (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i":
+ildouble: 3
+ldouble: 3
+Test "Real part of: ctan_tonearest (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan_tonearest (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+# ctan_towardzero
+Test "Real part of: ctan_towardzero (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: ctan_towardzero (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan_towardzero (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i":
+ildouble: 2
+ldouble: 2
+Test "Real part of: ctan_towardzero (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: ctan_towardzero (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i":
+float: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+# ctan_upward
+Test "Real part of: ctan_upward (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan_upward (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: ctan_upward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: ctan_upward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i":
+ildouble: 3
+ldouble: 3
+Test "Real part of: ctan_upward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: ctan_upward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
# ctanh
Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
double: 1
@@ -1490,6 +1843,97 @@ Test "Imaginary part of: ctanh (47 + 1 i) == 1.0 + 2.729321264492904590777293425
ildouble: 1
ldouble: 1
+# ctanh_downward
+Test "Real part of: ctanh_downward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i":
+ildouble: 3
+ldouble: 3
+Test "Imaginary part of: ctanh_downward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i":
+ildouble: 4
+ldouble: 4
+Test "Real part of: ctanh_downward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i":
+float: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+Test "Imaginary part of: ctanh_downward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: ctanh_downward (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i":
+ildouble: 2
+ldouble: 2
+
+# ctanh_tonearest
+Test "Real part of: ctanh_tonearest (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i":
+ildouble: 3
+ldouble: 3
+Test "Imaginary part of: ctanh_tonearest (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i":
+ildouble: 3
+ldouble: 3
+Test "Real part of: ctanh_tonearest (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: ctanh_tonearest (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ctanh_tonearest (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i":
+ildouble: 1
+ldouble: 1
+
+# ctanh_towardzero
+Test "Real part of: ctanh_towardzero (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i":
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: ctanh_towardzero (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: ctanh_towardzero (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i":
+float: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+Test "Imaginary part of: ctanh_towardzero (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: ctanh_towardzero (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i":
+ildouble: 1
+ldouble: 1
+
+# ctanh_upward
+Test "Real part of: ctanh_upward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i":
+ildouble: 3
+ldouble: 3
+Test "Imaginary part of: ctanh_upward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+Test "Real part of: ctanh_upward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "Imaginary part of: ctanh_upward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Real part of: ctanh_upward (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctanh_upward (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i":
+ildouble: 1
+ldouble: 1
+
# erf
Test "erf (1.25) == 0.922900128256458230136523481197281140":
double: 1
@@ -1576,6 +2020,9 @@ ildouble: 1
ldouble: 1
# expm1
+Test "expm1 (-79.0) == -0.9999999999999999999999999999999999509391":
+ildouble: 1
+ldouble: 1
Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
double: 1
idouble: 1
@@ -2026,6 +2473,12 @@ float: 1
ifloat: 1
# sincos
+Test "sincos (0x1p+120, &sin_res, &cos_res) puts -9.25879022854837867303861764107414946730833e-01 in cos_res":
+float: 1
+ifloat: 1
+Test "sincos (0x1p+127, &sin_res, &cos_res) puts 7.81914638714960072263910298466369236613162e-01 in cos_res":
+float: 1
+ifloat: 1
Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
double: 1
idouble: 1
@@ -2567,10 +3020,16 @@ ifloat: 1
ildouble: 1
ldouble: 1
+Function: Imaginary part of "clog":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
Function: Real part of "clog10":
-double: 1
+double: 2
float: 1
-idouble: 1
+idouble: 2
ifloat: 1
ildouble: 1
ldouble: 1
@@ -2580,8 +3039,8 @@ double: 1
float: 1
idouble: 1
ifloat: 1
-ildouble: 1
-ldouble: 1
+ildouble: 2
+ldouble: 2
Function: "cos":
double: 2
@@ -2705,6 +3164,60 @@ idouble: 1
ildouble: 2
ldouble: 2
+Function: Real part of "ctan_downward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Imaginary part of "ctan_downward":
+float: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: Real part of "ctan_tonearest":
+float: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "ctan_tonearest":
+float: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "ctan_towardzero":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ctan_towardzero":
+float: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: Real part of "ctan_upward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "ctan_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
Function: Real part of "ctanh":
double: 1
float: 1
@@ -2721,6 +3234,60 @@ ifloat: 2
ildouble: 2
ldouble: 2
+Function: Real part of "ctanh_downward":
+float: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "ctanh_downward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Real part of "ctanh_tonearest":
+float: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "ctanh_tonearest":
+float: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "ctanh_towardzero":
+float: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "ctanh_towardzero":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ctanh_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "ctanh_upward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
Function: "erf":
double: 1
idouble: 1
diff --git a/libc/ports/sysdeps/alpha/fpu/s_isnan.c b/libc/ports/sysdeps/alpha/fpu/s_isnan.c
index b18c7bb5f..1f239ac24 100644
--- a/libc/ports/sysdeps/alpha/fpu/s_isnan.c
+++ b/libc/ports/sysdeps/alpha/fpu/s_isnan.c
@@ -28,11 +28,6 @@
#undef isnanf
#undef __GI___isnanf
-/* The hidden_proto in include/math.h was obscured by the macro hackery. */
-__typeof (__isnan) __isnanf;
-hidden_proto (__isnanf)
-
-
int
__isnan (double x)
{
@@ -45,8 +40,11 @@ weak_alias (__isnan, isnan)
/* It turns out that the 'double' version will also always work for
single-precision. */
strong_alias (__isnan, __isnanf)
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
+weak_alias (__isnan, isnanf)
+
+/* ??? GCC 4.8 fails to look through chains of aliases with asm names
+ attached. Work around this for now. */
+hidden_ver (__isnan, __isnanf)
#ifdef NO_LONG_DOUBLE
strong_alias (__isnan, __isnanl)
diff --git a/libc/ports/sysdeps/arm/bits/atomic.h b/libc/ports/sysdeps/arm/bits/atomic.h
index 99842105c..39e276f09 100644
--- a/libc/ports/sysdeps/arm/bits/atomic.h
+++ b/libc/ports/sysdeps/arm/bits/atomic.h
@@ -58,7 +58,7 @@ void __arm_link_error (void);
__sync_val_compare_and_swap ((mem), (oldval), (newval))
#else
# define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
- __arm_assisted_compare_and_exchange_val_32_acq ((mem), (oldval), (newval))
+ __arm_assisted_compare_and_exchange_val_32_acq ((mem), (newval), (oldval))
#endif
/* We don't support atomic operations on any non-word types.
diff --git a/libc/ports/sysdeps/arm/get-rounding-mode.h b/libc/ports/sysdeps/arm/get-rounding-mode.h
new file mode 100644
index 000000000..a614fe43f
--- /dev/null
+++ b/libc/ports/sysdeps/arm/get-rounding-mode.h
@@ -0,0 +1,42 @@
+/* Determine floating-point rounding mode within libc. ARM version.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _ARM_GET_ROUNDING_MODE_H
+#define _ARM_GET_ROUNDING_MODE_H 1
+
+#include <arm-features.h>
+#include <fenv.h>
+#include <fpu_control.h>
+
+/* Return the floating-point rounding mode. */
+
+static inline int
+get_rounding_mode (void)
+{
+ if (ARM_HAVE_VFP)
+ {
+ fpu_control_t fc;
+
+ _FPU_GETCW (fc);
+ return fc & FE_TOWARDZERO;
+ }
+ else
+ return FE_TONEAREST;
+}
+
+#endif /* get-rounding-mode.h */
diff --git a/libc/ports/sysdeps/ia64/Makeconfig b/libc/ports/sysdeps/ia64/Makeconfig
new file mode 100644
index 000000000..d1d3f6c95
--- /dev/null
+++ b/libc/ports/sysdeps/ia64/Makeconfig
@@ -0,0 +1,2 @@
+# ia64 does not provide crtbeginT.o, so use crtbegin.o.
++prectorT = $(+prector)
diff --git a/libc/ports/sysdeps/ia64/fpu/fegetround.c b/libc/ports/sysdeps/ia64/fpu/fegetround.c
index e672f6192..403aadb41 100644
--- a/libc/ports/sysdeps/ia64/fpu/fegetround.c
+++ b/libc/ports/sysdeps/ia64/fpu/fegetround.c
@@ -1,5 +1,5 @@
/* Return current rounding direction.
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999.
@@ -17,14 +17,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <fenv.h>
+#include <get-rounding-mode.h>
int
fegetround (void)
{
- fenv_t fpsr;
-
- __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr));
-
- return (fpsr >> 10) & 3;
+ return get_rounding_mode ();
}
diff --git a/libc/ports/sysdeps/ia64/fpu/get-rounding-mode.h b/libc/ports/sysdeps/ia64/fpu/get-rounding-mode.h
new file mode 100644
index 000000000..1e184730e
--- /dev/null
+++ b/libc/ports/sysdeps/ia64/fpu/get-rounding-mode.h
@@ -0,0 +1,37 @@
+/* Return current rounding direction within libc. IA64 version.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef IA64_GET_ROUNDING_MODE_H
+#define IA64_GET_ROUNDING_MODE_H 1
+
+#include <fenv.h>
+
+/* Return the floating-point rounding mode. */
+
+static inline int
+get_rounding_mode (void)
+{
+ fenv_t fpsr;
+
+ __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr));
+
+ return (fpsr >> 10) & 3;
+}
+
+#endif /* get-rounding-mode.h */
diff --git a/libc/ports/sysdeps/powerpc/nofpu/get-rounding-mode.h b/libc/ports/sysdeps/powerpc/nofpu/get-rounding-mode.h
new file mode 100644
index 000000000..14be20f7b
--- /dev/null
+++ b/libc/ports/sysdeps/powerpc/nofpu/get-rounding-mode.h
@@ -0,0 +1,35 @@
+/* Determine floating-point rounding mode within libc. PowerPC
+ soft-float version.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _POWERPC_NOFPU_GET_ROUNDING_MODE_H
+#define _POWERPC_NOFPU_GET_ROUNDING_MODE_H 1
+
+#include <fenv.h>
+
+#include "soft-supp.h"
+
+/* Return the floating-point rounding mode. */
+
+static inline int
+get_rounding_mode (void)
+{
+ return __sim_round_mode;
+}
+
+#endif /* get-rounding-mode.h */
diff --git a/libc/ports/sysdeps/tile/__tls_get_addr.S b/libc/ports/sysdeps/tile/__tls_get_addr.S
index 74e4fa2c2..6de79ba53 100644
--- a/libc/ports/sysdeps/tile/__tls_get_addr.S
+++ b/libc/ports/sysdeps/tile/__tls_get_addr.S
@@ -76,6 +76,8 @@ ENTRY (__tls_get_addr)
ADD_PTR r28, r28, r27 /* pointer into module array */
}
LD_PTR r26, r28 /* r26 = module TLS pointer */
+ CMPEQI r25, r26, -1 /* check r26 == TLS_DTV_UNALLOCATED */
+ BNEZ r25, .Lslowpath
{
ADD_PTR r0, r26, r29
jrp lr
diff --git a/libc/ports/sysdeps/tile/libm-test-ulps b/libc/ports/sysdeps/tile/libm-test-ulps
index 9f5d08559..43d1e99d3 100644
--- a/libc/ports/sysdeps/tile/libm-test-ulps
+++ b/libc/ports/sysdeps/tile/libm-test-ulps
@@ -460,6 +460,15 @@ float: 2
ifloat: 2
# clog
+Test "Real part of: clog (-0x1.0000000123456p0 + 0x1.2345678p-1000 i) == 2.649094276923003995420209214900915462737e-10 + 3.141592653589793238462643383279502884197 i":
+double: 1
+idouble: 1
+Test "Real part of: clog (-0x1.0000000123456p0 + 0x1.2345678p-30 i) == 2.649094282537168795982991778475646793277e-10 + 3.141592652530155111500161671113150737892 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog (-0x1.234566p-40 - 1.0 i) == 5.354083939753840089583620652120903838944e-25 - 1.570796326795931422008642456283782656359 i":
+float: 1
+ifloat: 1
Test "Real part of: clog (-0x1.fp+127 + 0x1p-149 i) == 88.69109041335841930424871526389807508374 + pi i":
float: 1
ifloat: 1
@@ -481,6 +490,9 @@ ifloat: 1
Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
float: 1
ifloat: 1
+Test "Real part of: clog (0x1.000566p0 + 0x1.234p-10 i) == 8.298731898331237038231468223024422855654e-5 + 1.110938609507128729312743251313024793990e-3 i":
+float: 1
+ifloat: 1
Test "Real part of: clog (0x1.fp+127 + 0x1p-149 i) == 88.69109041335841930424871526389807508374 + +0 i":
float: 1
ifloat: 1
@@ -499,6 +511,9 @@ ifloat: 1
Test "Real part of: clog (0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i":
float: 1
ifloat: 1
+Test "Real part of: clog (1.0 + 0x1.234566p-10 i) == 6.172834701221959432440126967147726538097e-7 + 1.111110564353742042376451655136933182201e-3 i":
+float: 1
+ifloat: 1
# clog10
Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
@@ -507,6 +522,18 @@ ifloat: 1
Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
float: 1
ifloat: 1
+Test "Real part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-1000 i) == 1.150487026509145544402795327729455391948e-10 + 1.364376353841841347485783625431355770210 i":
+double: 2
+idouble: 2
+Test "Imaginary part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-1000 i) == 1.150487026509145544402795327729455391948e-10 + 1.364376353841841347485783625431355770210 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-30 i) == 1.150487028947346337782682105935961875822e-10 + 1.364376353381646356131680448946397884147 i":
+double: 2
+idouble: 2
+Test "Imaginary part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-30 i) == 1.150487028947346337782682105935961875822e-10 + 1.364376353381646356131680448946397884147 i":
+double: 1
+idouble: 1
Test "Imaginary part of: clog10 (-0x1.fp+1023 + 0x1p-1074 i) == 308.2409272754311106024666378243768099991 + 1.364376353841841347485783625431355770210 i":
double: 1
idouble: 1
@@ -535,6 +562,9 @@ idouble: 1
Test "Imaginary part of: clog10 (-0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i":
double: 1
idouble: 1
+Test "Imaginary part of: clog10 (-1.0 + 0x1.234566p-20 i) == 2.556638434669064077889576526006849923281e-13 + 1.364375882602207106407956770293808181427 i":
+double: 1
+idouble: 1
Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
double: 1
idouble: 1
@@ -565,6 +595,26 @@ ifloat: 1
Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
float: 1
ifloat: 1
+Test "Real part of: clog10 (0x1.000566p0 + 0x1.234p-10 i) == 3.604093470239754109961125085078190708674e-5 + 4.824745078422174667425851670822596859720e-4 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x1.000566p0 + 0x1.234p-10 i) == 3.604093470239754109961125085078190708674e-5 + 4.824745078422174667425851670822596859720e-4 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0x1.000566p0 + 0x1.234p-100 i) == 3.577293486783822178310971763308187385546e-5 + 3.897399639875661463735636919790792140598e-31 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x1.234566p-30 + 1.0 i) == 2.438200411482400072282924063740535840474e-19 + 6.821881764607257184291586401763604544928e-1 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x1.234566p-50 + 1.0 i) == 2.217530356103816369479108963807448194409e-31 + 6.821881769209202348667823902864283966959e-1 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x1.234566p-60 + 1.0 i) == 2.114801746467415208319767917450504756866e-37 + 6.821881769209206733143018621078368211515e-1 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
Test "Imaginary part of: clog10 (0x1.fffffep+127 + 0x1.fffffep+127 i) == 38.68235441693561449174780668781319348761 + pi/4*log10(e) i":
float: 1
ifloat: 1
@@ -596,6 +646,33 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+Test "Imaginary part of: clog10 (0x1p-509 + 1.0 i) == 7.730698388614835910296270976605350994446e-308 + 6.821881769209206737428918127156778851051e-1 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1p-510 + 1.0 i) == 1.932674597153708977574067744151337748612e-308 + 6.821881769209206737428918127156778851051e-1 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1p-511 + 1.0 i) == 4.831686492884272443935169360378344371529e-309 + 6.821881769209206737428918127156778851051e-1 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1p-61 + 1.0 i) == 4.084085680564517578238994467153626207224e-38 + 6.821881769209206735545466044044889962925e-1 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x1p-62 + 1.0 i) == 1.021021420141129394559748616788406551878e-38 + 6.821881769209206736487192085600834406988e-1 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x1p-63 + 1.0 i) == 2.552553550352823486399371541971016379740e-39 + 6.821881769209206736958055106378806629019e-1 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (1.0 + 0x1.234566p-10 i) == 2.680828048441605163181684680300513080769e-7 + 4.825491868832381486767558728169977751564e-4 i":
+double: 1
+idouble: 1
Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
float: 1
ifloat: 1
@@ -610,6 +687,12 @@ float: 1
ifloat: 1
# cos
+Test "cos (0x1p+120) == -9.25879022854837867303861764107414946730833e-01":
+float: 1
+ifloat: 1
+Test "cos (0x1p+127) == 7.81914638714960072263910298466369236613162e-01":
+float: 1
+ifloat: 1
Test "cos (M_PI_6l * 2.0) == 0.5":
double: 1
idouble: 1
@@ -1121,6 +1204,12 @@ float: 1
ifloat: 1
# sincos
+Test "sincos (0x1p+120, &sin_res, &cos_res) puts -9.25879022854837867303861764107414946730833e-01 in cos_res":
+float: 1
+ifloat: 1
+Test "sincos (0x1p+127, &sin_res, &cos_res) puts 7.81914638714960072263910298466369236613162e-01 in cos_res":
+float: 1
+ifloat: 1
Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
double: 1
idouble: 1
@@ -1392,9 +1481,9 @@ float: 1
ifloat: 1
Function: Real part of "clog10":
-double: 1
+double: 2
float: 1
-idouble: 1
+idouble: 2
ifloat: 1
Function: Imaginary part of "clog10":
diff --git a/libc/ports/sysdeps/tile/sysdep.h b/libc/ports/sysdeps/tile/sysdep.h
index 4f27cb2be..4db70836e 100644
--- a/libc/ports/sysdeps/tile/sysdep.h
+++ b/libc/ports/sysdeps/tile/sysdep.h
@@ -66,7 +66,7 @@
#define REGSIZE 4
#endif
-/* Support a limited form of shared assembly between tile and tilegx.
+/* Support a limited form of shared assembly between tilepro and tilegx.
The presumption is that LD/ST are used for manipulating registers.
Since opcode parsing is case-insensitive, we don't need to provide
definitions for these on tilegx. */
@@ -86,7 +86,7 @@
#endif
/* Provide "pointer-oriented" instruction variants. These differ not
- just for tile vs tilegx, but also for tilegx -m64 vs -m32. */
+ just for tilepro vs tilegx, but also for tilegx -m64 vs -m32. */
#if defined __tilegx__ && __WORDSIZE == 32
#define ADD_PTR addx
#define ADDI_PTR addxi
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/localplt.data b/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/localplt.data
index 00700d1e0..6b2e51599 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/localplt.data
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/localplt.data
@@ -1,12 +1,18 @@
libc.so: _OtsAddX ?
+libc.so: _OtsConvertFloatTX ?
libc.so: _OtsConvertFloatXT ?
+libc.so: _OtsCvtQUX ?
libc.so: _OtsCvtQX ?
+libc.so: _OtsCvtXQ ?
libc.so: _OtsDivX ?
libc.so: _OtsEqlX ?
libc.so: _OtsGeqX ?
+libc.so: _OtsGtrX ?
+libc.so: _OtsLeqX ?
libc.so: _OtsLssX ?
libc.so: _OtsMulX ?
libc.so: _OtsNeqX ?
+libc.so: _OtsNintXQ ?
libc.so: _OtsSubX ?
libc.so: _Unwind_Find_FDE
libc.so: calloc ?
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/setfpucw.c b/libc/ports/sysdeps/unix/sysv/linux/alpha/setfpucw.c
index becc11f94..99ffd06fa 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/setfpucw.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/setfpucw.c
@@ -1,5 +1,5 @@
/* Set FP exception mask and rounding mode.
- Copyright (C) 1996, 1997, 1998, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1996-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,63 +17,45 @@
<http://www.gnu.org/licenses/>. */
#include <fpu_control.h>
-#include <asm/fpu.h>
+#include <fenv_libc.h>
-extern void __ieee_set_fp_control (unsigned long);
-libc_hidden_proto(__ieee_set_fp_control)
-extern unsigned long __ieee_get_fp_control (void);
-libc_hidden_proto(__ieee_get_fp_control)
-
-static inline unsigned long
-rdfpcr (void)
-{
- unsigned long fpcr;
- asm ("excb; mf_fpcr %0" : "=f"(fpcr));
- return fpcr;
-}
-
-
-static inline void
-wrfpcr (unsigned long fpcr)
-{
- asm volatile ("mt_fpcr %0; excb" : : "f"(fpcr));
-}
+#define convert_bit(M, F, T) \
+ ((T) < (F) \
+ ? ((M) / ((F) / (T))) & (T) \
+ : ((M) & (F)) * ((T) / (F)))
void
__setfpucw (fpu_control_t fpu_control)
{
- unsigned long fpcr = 0, fpcw = 0;
-
- if (!fpu_control)
- fpu_control = _FPU_DEFAULT;
-
- /* first, set dynamic rounding mode: */
-
- fpcr = rdfpcr();
- fpcr &= ~FPCR_DYN_MASK;
- switch (fpu_control & 0xc00)
- {
- case _FPU_RC_NEAREST: fpcr |= FPCR_DYN_NORMAL; break;
- case _FPU_RC_DOWN: fpcr |= FPCR_DYN_MINUS; break;
- case _FPU_RC_UP: fpcr |= FPCR_DYN_PLUS; break;
- case _FPU_RC_ZERO: fpcr |= FPCR_DYN_CHOPPED; break;
- }
- wrfpcr(fpcr);
-
- /* now tell kernel about traps that we like to hear about: */
-
- fpcw = __ieee_get_fp_control();
- fpcw &= ~IEEE_TRAP_ENABLE_MASK;
-
- if (!(fpu_control & _FPU_MASK_IM)) fpcw |= IEEE_TRAP_ENABLE_INV;
- if (!(fpu_control & _FPU_MASK_DM)) fpcw |= IEEE_TRAP_ENABLE_UNF;
- if (!(fpu_control & _FPU_MASK_ZM)) fpcw |= IEEE_TRAP_ENABLE_DZE;
- if (!(fpu_control & _FPU_MASK_OM)) fpcw |= IEEE_TRAP_ENABLE_OVF;
- if (!(fpu_control & _FPU_MASK_PM)) fpcw |= IEEE_TRAP_ENABLE_INE;
-
- __fpu_control = fpu_control; /* update global copy */
-
- __ieee_set_fp_control(fpcw);
+ unsigned long fpcr, swcr, fc = (int)fpu_control;
+
+ /* ??? If this was a real external interface we'd want to read the current
+ exception state with __ieee_get_fp_control. But this is an internal
+ function only called at process startup, so there's no point in trying
+ to preserve exceptions that cannot have been raised yet. Indeed, this
+ entire function is likely to be one big nop unless the user overrides
+ the default __fpu_control variable. */
+
+ /* Convert the rounding mode from fpu_control.h format. */
+ const unsigned long conv_rnd
+ = ( (FE_TOWARDZERO << (_FPU_RC_ZERO >> 8))
+ | (FE_DOWNWARD << (_FPU_RC_DOWN >> 8))
+ | (FE_TONEAREST << (_FPU_RC_NEAREST >> 8))
+ | (FE_UPWARD << (_FPU_RC_UP >> 8)));
+
+ fpcr = ((conv_rnd >> ((fc >> 8) & 3)) & 3) << FPCR_ROUND_SHIFT;
+
+ /* Convert the exception mask from fpu_control.h format. */
+ swcr = convert_bit (~fc, _FPU_MASK_IM, FE_INVALID >> SWCR_ENABLE_SHIFT);
+ swcr |= convert_bit (~fc, _FPU_MASK_DM, FE_UNDERFLOW >> SWCR_ENABLE_SHIFT);
+ swcr |= convert_bit (~fc, _FPU_MASK_ZM, FE_DIVBYZERO >> SWCR_ENABLE_SHIFT);
+ swcr |= convert_bit (~fc, _FPU_MASK_OM, FE_OVERFLOW >> SWCR_ENABLE_SHIFT);
+ swcr |= convert_bit (~fc, _FPU_MASK_PM, FE_INEXACT >> SWCR_ENABLE_SHIFT);
+
+ /* Install everything. */
+ __fpu_control = fc;
+ asm volatile ("mt_fpcr %0" : : "f"(fpcr));
+ __ieee_set_fp_control(swcr);
}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/Versions b/libc/ports/sysdeps/unix/sysv/linux/hppa/Versions
index 1e2e320c0..a62ef195a 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/hppa/Versions
+++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/Versions
@@ -28,6 +28,8 @@ libc {
_sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
}
GLIBC_2.17 {
+ #errlist-compat 260
+ _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
prlimit64;
}
}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/errno.h b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/errno.h
index 2487739e3..86a173a66 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/errno.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/errno.h
@@ -1,5 +1,5 @@
/* Error constants. Linux/HPPA specific version.
- Copyright (C) 1996,1997,1998,1999,2000,2002 Free Software Foundation, Inc.
+ Copyright (C) 1996-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -33,12 +33,16 @@
# define EOWNERDEAD 254
# endif
-# ifndef ENOTRECOVERABLE
+# ifndef ENOTRECOVERABLE
# define ENOTRECOVERABLE 255
# endif
# ifndef ERFKILL
-# define ERFKILL 256
+# define ERFKILL 256
+# endif
+
+# ifndef EHWPOISON
+# define EHWPOISON 257
# endif
# ifndef __ASSEMBLER__
diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/syscalls.list b/libc/ports/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 78e6568b7..f3ff3e7d7 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -35,4 +35,4 @@ socketpair - socketpair i:iiif __socketpair socketpair
setrlimit - setrlimit i:ip __setrlimit setrlimit
getrlimit - getrlimit i:ip __getrlimit getrlimit
-prlimit64 EXTRA prlimit64 i:iipp prlimit64 prlimit64@@GLIBC_2.17
+prlimit64 EXTRA prlimit64 i:iipp __prlimit64 prlimit64@@GLIBC_2.17
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/sys/procfs.h b/libc/ports/sysdeps/unix/sysv/linux/tile/sys/procfs.h
index 295ae50aa..f533eb1f1 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/tile/sys/procfs.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/sys/procfs.h
@@ -113,7 +113,7 @@ typedef void *psaddr_t;
typedef elf_gregset_t prgregset_t;
/* Provide dummy declaration here; we don't have FP registers. */
-typedef int prfpregset_t;
+typedef elf_fpregset_t prfpregset_t;
/* We don't have any differences between processes and threads,
therefore have only one PID type. */
diff --git a/libc/posix/Makefile b/libc/posix/Makefile
index 23480ec3f..89f86bacf 100644
--- a/libc/posix/Makefile
+++ b/libc/posix/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2007,2009,2010,2011,2012 Free Software Foundation, Inc.
+# Copyright (C) 1991-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -143,13 +143,13 @@ include ../Rules
ifeq (yes,$(build-shared))
tests: $(objpfx)globtest.out
$(objpfx)globtest.out: globtest.sh $(objpfx)globtest
- $(SHELL) -e globtest.sh $(common-objpfx) $(elf-objpfx) \
+ $(SHELL) $< $(common-objpfx) $(elf-objpfx) \
$(rtld-installed-name) '$(cross-test-wrapper)'
LDLIBS-globtest += $(shell cat $(common-objpfx)nss/fixed-nsswitch-libs)
ifeq (y,$(OPTION_EGLIBC_WORDEXP))
tests: $(objpfx)wordexp-tst.out
$(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
- $(SHELL) -e wordexp-tst.sh $(common-objpfx) $(elf-objpfx) \
+ $(SHELL) $< $(common-objpfx) $(elf-objpfx) \
$(rtld-installed-name) '$(cross-test-wrapper)'
endif
endif
@@ -314,7 +314,7 @@ $(objpfx)tst-boost-mem: $(objpfx)tst-boost.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-boost.mtrace > $@
$(objpfx)tst-getconf.out: tst-getconf.sh $(objpfx)getconf
- $(SHELL) -e $< $(common-objpfx) $(elf-objpfx) \
+ $(SHELL) $< $(common-objpfx) $(elf-objpfx) \
'$(cross-test-wrapper)' $(rtld-installed-name)
ifeq (yes,$(build-shared))
diff --git a/libc/posix/globtest.sh b/libc/posix/globtest.sh
index 9025c049e..1df0ef720 100755
--- a/libc/posix/globtest.sh
+++ b/libc/posix/globtest.sh
@@ -1,4 +1,23 @@
#! /bin/bash
+# Test for glob(3).
+# Copyright (C) 1997-2012 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+set -e
common_objpfx=$1; shift
elf_objpfx=$1; shift
diff --git a/libc/posix/tst-getconf.sh b/libc/posix/tst-getconf.sh
index 796685b68..a9a222b1e 100644
--- a/libc/posix/tst-getconf.sh
+++ b/libc/posix/tst-getconf.sh
@@ -1,4 +1,23 @@
#! /bin/sh
+# Test for getconf(1).
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+set -e
common_objpfx=$1; shift
elf_objpfx=$1; shift
diff --git a/libc/posix/wordexp-tst.sh b/libc/posix/wordexp-tst.sh
index c6de4f8fb..55116aa4a 100755
--- a/libc/posix/wordexp-tst.sh
+++ b/libc/posix/wordexp-tst.sh
@@ -1,4 +1,23 @@
-#!/bin/sh
+#! /bin/sh
+# Test for wordexp(3).
+# Copyright (C) 1998-2012 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+set -e
# Some of these tests may look a little weird.
# The first parameter to wordexp-test is what it gives to wordexp.
diff --git a/libc/scripts/check-local-headers.sh b/libc/scripts/check-local-headers.sh
index 08ed880c5..cacb842de 100755
--- a/libc/scripts/check-local-headers.sh
+++ b/libc/scripts/check-local-headers.sh
@@ -1,5 +1,5 @@
#! /bin/bash
-# Copyright (C) 2005,2007,2009,2011 Free Software Foundation, Inc.
+# Copyright (C) 2005-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,9 @@ objpfx="$2"
# To avoid long paths.
cd "$objpfx"
+# OK if *.os is missing.
+shopt -s nullglob
+
# Search all dependency files for file names in the include directory.
# There are a few system headers we are known to use.
exec ${AWK} -v includedir="$includedir" '
diff --git a/libc/scripts/test-installation.pl b/libc/scripts/test-installation.pl
index 1b22086bf..070077085 100755
--- a/libc/scripts/test-installation.pl
+++ b/libc/scripts/test-installation.pl
@@ -25,6 +25,11 @@ if ($ENV{CC}) {
} else {
$CC= "gcc";
}
+if ($ENV{LD_SO}) {
+ $LD_SO = $ENV{LD_SO};
+} else {
+ $LD_SO = "";
+}
sub usage {
print "Usage: test-installation [soversions.mk]\n";
@@ -112,6 +117,8 @@ while (<SOVERSIONS>) {
$link_libs .= " -l$name";
$versions{$name} = $version;
}
+ } elsif ($LD_SO ne "") {
+ ($ld_so_name, $ld_so_version) = split ('\.so\.', $LD_SO);
} else {
if (/^ld\.so/) {
($ld_so_name, $ld_so_version)= /=(.*)\.so\.(.*)$/;
diff --git a/libc/stdio-common/Makefile b/libc/stdio-common/Makefile
index bef5db9db..1e2c2b1cc 100644
--- a/libc/stdio-common/Makefile
+++ b/libc/stdio-common/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2009, 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 1991-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -63,7 +63,8 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
tst-fwrite bug16 bug17 tst-sprintf2 bug18 \
bug19 tst-popen2 scanf14 scanf15 bug21 bug22 scanf16 scanf17 \
- tst-setvbuf1 bug23 bug24 bug-vfprintf-nargs tst-sprintf3 bug25
+ tst-setvbuf1 bug23 bug24 bug-vfprintf-nargs tst-sprintf3 bug25 \
+ tst-printf-round
tests-$(OPTION_EGLIBC_LOCALE_CODE) \
+= tst-sscanf tst-swprintf test-vfprintf bug14 scanf13 tst-grouping
tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
@@ -80,12 +81,12 @@ include ../Rules
tests: do-tst-unbputc do-tst-printf
do-tst-unbputc: $(objpfx)tst-unbputc.out
-$(objpfx)tst-unbputc.out: $(objpfx)tst-unbputc tst-unbputc.sh
- $(SHELL) -e tst-unbputc.sh $(common-objpfx) '$(run-program-prefix)'
+$(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
do-tst-printf: $(objpfx)tst-printf.out
-$(objpfx)tst-printf.out: $(objpfx)tst-printf tst-printf.sh
- $(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
+$(objpfx)tst-printf.out: tst-printf.sh $(objpfx)tst-printf
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
# eglibc: endif
CFLAGS-vfprintf.c = -Wno-uninitialized
@@ -140,3 +141,10 @@ CPPFLAGS += $(libio-mtsafe)
$(objpfx)tst-setvbuf1.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1
$(built-program-cmd) > $@ 2>&1
cmp tst-setvbuf1.expect $@
+
+ifeq ($(build-shared),yes)
+link-libm = $(common-objpfx)math/libm.so
+else
+link-libm = $(common-objpfx)math/libm.a
+endif
+$(objpfx)tst-printf-round: $(link-libm)
diff --git a/libc/stdio-common/printf_fp.c b/libc/stdio-common/printf_fp.c
index 5bb77f99f..fab9f0952 100644
--- a/libc/stdio-common/printf_fp.c
+++ b/libc/stdio-common/printf_fp.c
@@ -40,6 +40,8 @@
#include <stdlib.h>
#include <wchar.h>
#include <gnu/option-groups.h>
+#include <stdbool.h>
+#include <rounding-mode.h>
#ifdef COMPILE_WPRINTF
# define CHAR_T wchar_t
@@ -202,9 +204,6 @@ ___printf_fp (FILE *fp,
/* Temporary bignum value. */
MPN_VAR(tmp);
- /* Digit which is result of last hack_digit() call. */
- wchar_t digit;
-
/* The type of output format that will be used: 'e'/'E' or 'f'. */
int type;
@@ -977,34 +976,31 @@ ___printf_fp (FILE *fp,
}
/* Do rounding. */
- digit = hack_digit ();
- if (digit > L'4')
+ wchar_t last_digit = wcp[-1] != decimalwc ? wcp[-1] : wcp[-2];
+ wchar_t next_digit = hack_digit ();
+ bool more_bits;
+ if (next_digit != L'0' && next_digit != L'5')
+ more_bits = true;
+ else if (fracsize == 1 && frac[0] == 0)
+ /* Rest of the number is zero. */
+ more_bits = false;
+ else if (scalesize == 0)
+ {
+ /* Here we have to see whether all limbs are zero since no
+ normalization happened. */
+ size_t lcnt = fracsize;
+ while (lcnt >= 1 && frac[lcnt - 1] == 0)
+ --lcnt;
+ more_bits = lcnt > 0;
+ }
+ else
+ more_bits = true;
+ int rounding_mode = get_rounding_mode ();
+ if (round_away (is_neg, (last_digit - L'0') & 1, next_digit >= L'5',
+ more_bits, rounding_mode))
{
wchar_t *wtp = wcp;
- if (digit == L'5'
- && ((*(wcp - 1) != decimalwc && (*(wcp - 1) & 1) == 0)
- || ((*(wcp - 1) == decimalwc && (*(wcp - 2) & 1) == 0))))
- {
- /* This is the critical case. */
- if (fracsize == 1 && frac[0] == 0)
- /* Rest of the number is zero -> round to even.
- (IEEE 754-1985 4.1 says this is the default rounding.) */
- goto do_expo;
- else if (scalesize == 0)
- {
- /* Here we have to see whether all limbs are zero since no
- normalization happened. */
- size_t lcnt = fracsize;
- while (lcnt >= 1 && frac[lcnt - 1] == 0)
- --lcnt;
- if (lcnt == 0)
- /* Rest of the number is zero -> round to even.
- (IEEE 754-1985 4.1 says this is the default rounding.) */
- goto do_expo;
- }
- }
-
if (fracdig_no > 0)
{
/* Process fractional digits. Terminate if not rounded or
@@ -1098,7 +1094,6 @@ ___printf_fp (FILE *fp,
}
}
- do_expo:
/* Now remove unnecessary '0' at the end of the string. */
while (fracdig_no > fracdig_min + added_zeros && *(wcp - 1) == L'0')
{
diff --git a/libc/stdio-common/printf_fphex.c b/libc/stdio-common/printf_fphex.c
index cd8a1f972..db01d053d 100644
--- a/libc/stdio-common/printf_fphex.c
+++ b/libc/stdio-common/printf_fphex.c
@@ -29,6 +29,8 @@
#include <_itowa.h>
#include <locale/localeinfo.h>
#include <gnu/option-groups.h>
+#include <stdbool.h>
+#include <rounding-mode.h>
/* #define NDEBUG 1*/ /* Undefine this for debugging assertions. */
#include <assert.h>
@@ -356,21 +358,33 @@ __printf_fphex (FILE *fp,
--numend;
}
+ bool do_round_away = false;
+
+ if (precision != -1 && precision < numend - numstr)
+ {
+ char last_digit = precision > 0 ? numstr[precision - 1] : leading;
+ char next_digit = numstr[precision];
+ int last_digit_value = (last_digit >= 'A' && last_digit <= 'F'
+ ? last_digit - 'A' + 10
+ : (last_digit >= 'a' && last_digit <= 'f'
+ ? last_digit - 'a' + 10
+ : last_digit - '0'));
+ int next_digit_value = (next_digit >= 'A' && next_digit <= 'F'
+ ? next_digit - 'A' + 10
+ : (next_digit >= 'a' && next_digit <= 'f'
+ ? next_digit - 'a' + 10
+ : next_digit - '0'));
+ bool more_bits = ((next_digit_value & 7) != 0
+ || precision + 1 < numend - numstr);
+ int rounding_mode = get_rounding_mode ();
+ do_round_away = round_away (negative, last_digit_value & 1,
+ next_digit_value >= 8, more_bits,
+ rounding_mode);
+ }
+
if (precision == -1)
precision = numend - numstr;
- else if (precision < numend - numstr
- && (numstr[precision] > '8'
- || (('A' < '0' || 'a' < '0')
- && numstr[precision] < '0')
- || (numstr[precision] == '8'
- && (precision + 1 < numend - numstr
- /* Round to even. */
- || (precision > 0
- && ((numstr[precision - 1] & 1)
- ^ (isdigit (numstr[precision - 1]) == 0)))
- || (precision == 0
- && ((leading & 1)
- ^ (isdigit (leading) == 0)))))))
+ else if (do_round_away)
{
/* Round up. */
int cnt = precision;
diff --git a/libc/stdio-common/tst-printf-round.c b/libc/stdio-common/tst-printf-round.c
new file mode 100644
index 000000000..7cc19c564
--- /dev/null
+++ b/libc/stdio-common/tst-printf-round.c
@@ -0,0 +1,234 @@
+/* Test for correct rounding of printf floating-point output.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv.h>
+#include <stdio.h>
+#include <string.h>
+
+struct dec_test {
+ double d;
+ const char *fmt;
+ const char *rd, *rn, *rz, *ru;
+};
+
+static const struct dec_test dec_tests[] = {
+ { 1.5, "%.0f", "1", "2", "1", "2" },
+ { -1.5, "%.0f", "-2", "-2", "-1", "-1" },
+ { 2.5, "%.0f", "2", "2", "2", "3" },
+ { -2.5, "%.0f", "-3", "-2", "-2", "-2" },
+ { 1.4999, "%.0f", "1", "1", "1", "2" },
+ { -1.4999, "%.0f", "-2", "-1", "-1", "-1" },
+ { 1.5001, "%.0f", "1", "2", "1", "2" },
+ { -1.5001, "%.0f", "-2", "-2", "-1", "-1" },
+ { 2.4999, "%.0f", "2", "2", "2", "3" },
+ { -2.4999, "%.0f", "-3", "-2", "-2", "-2" },
+ { 2.5001, "%.0f", "2", "3", "2", "3" },
+ { -2.5001, "%.0f", "-3", "-3", "-2", "-2" },
+ { 1.0 / 3.0, "%f", "0.333333", "0.333333", "0.333333", "0.333334" },
+ { -1.0 / 3.0, "%f", "-0.333334", "-0.333333", "-0.333333", "-0.333333" },
+ { 0.2500001, "%.2e", "2.50e-01", "2.50e-01", "2.50e-01", "2.51e-01" },
+ { -0.2500001, "%.2e", "-2.51e-01", "-2.50e-01", "-2.50e-01", "-2.50e-01" },
+ { 1000001.0, "%.1e", "1.0e+06", "1.0e+06", "1.0e+06", "1.1e+06" },
+ { -1000001.0, "%.1e", "-1.1e+06", "-1.0e+06", "-1.0e+06", "-1.0e+06" },
+};
+
+static int
+test_dec_in_one_mode (double d, const char *fmt, const char *expected,
+ const char *mode_name)
+{
+ char buf[100];
+ int ret = snprintf (buf, sizeof buf, fmt, d);
+ if (ret <= 0 || ret >= (int) sizeof buf)
+ {
+ printf ("snprintf for %a returned %d\n", d, ret);
+ return 1;
+ }
+ if (strcmp (buf, expected) == 0)
+ return 0;
+ else
+ {
+ printf ("snprintf (\"%s\", %a) returned \"%s\" not \"%s\" (%s)\n",
+ fmt, d, buf, expected, mode_name);
+ return 1;
+ }
+}
+
+struct hex_test
+{
+ double d;
+ const char *fmt;
+ const char *rd[4], *rn[4], *rz[4], *ru[4];
+};
+
+static const struct hex_test hex_tests[] =
+ {
+ {
+ 0x1.fffffp+4, "%.1a",
+ { "0x1.fp+4", "0x3.fp+3", "0x7.fp+2", "0xf.fp+1" },
+ { "0x2.0p+4", "0x4.0p+3", "0x8.0p+2", "0x1.0p+5" },
+ { "0x1.fp+4", "0x3.fp+3", "0x7.fp+2", "0xf.fp+1" },
+ { "0x2.0p+4", "0x4.0p+3", "0x8.0p+2", "0x1.0p+5" }
+ },
+ {
+ -0x1.fffffp+4, "%.1a",
+ { "-0x2.0p+4", "-0x4.0p+3", "-0x8.0p+2", "-0x1.0p+5" },
+ { "-0x2.0p+4", "-0x4.0p+3", "-0x8.0p+2", "-0x1.0p+5" },
+ { "-0x1.fp+4", "-0x3.fp+3", "-0x7.fp+2", "-0xf.fp+1" },
+ { "-0x1.fp+4", "-0x3.fp+3", "-0x7.fp+2", "-0xf.fp+1" }
+ },
+ {
+ 0x1.88p+4, "%.1a",
+ { "0x1.8p+4", "0x3.1p+3", "0x6.2p+2", "0xc.4p+1" },
+ { "0x1.8p+4", "0x3.1p+3", "0x6.2p+2", "0xc.4p+1" },
+ { "0x1.8p+4", "0x3.1p+3", "0x6.2p+2", "0xc.4p+1" },
+ { "0x1.9p+4", "0x3.1p+3", "0x6.2p+2", "0xc.4p+1" }
+ },
+ {
+ -0x1.88p+4, "%.1a",
+ { "-0x1.9p+4", "-0x3.1p+3", "-0x6.2p+2", "-0xc.4p+1" },
+ { "-0x1.8p+4", "-0x3.1p+3", "-0x6.2p+2", "-0xc.4p+1" },
+ { "-0x1.8p+4", "-0x3.1p+3", "-0x6.2p+2", "-0xc.4p+1" },
+ { "-0x1.8p+4", "-0x3.1p+3", "-0x6.2p+2", "-0xc.4p+1" }
+ },
+ {
+ 0x1.78p+4, "%.1a",
+ { "0x1.7p+4", "0x2.fp+3", "0x5.ep+2", "0xb.cp+1" },
+ { "0x1.8p+4", "0x2.fp+3", "0x5.ep+2", "0xb.cp+1" },
+ { "0x1.7p+4", "0x2.fp+3", "0x5.ep+2", "0xb.cp+1" },
+ { "0x1.8p+4", "0x2.fp+3", "0x5.ep+2", "0xb.cp+1" }
+ },
+ {
+ -0x1.78p+4, "%.1a",
+ { "-0x1.8p+4", "-0x2.fp+3", "-0x5.ep+2", "-0xb.cp+1" },
+ { "-0x1.8p+4", "-0x2.fp+3", "-0x5.ep+2", "-0xb.cp+1" },
+ { "-0x1.7p+4", "-0x2.fp+3", "-0x5.ep+2", "-0xb.cp+1" },
+ { "-0x1.7p+4", "-0x2.fp+3", "-0x5.ep+2", "-0xb.cp+1" }
+ },
+ {
+ 64.0 / 3.0, "%.1a",
+ { "0x1.5p+4", "0x2.ap+3", "0x5.5p+2", "0xa.ap+1" },
+ { "0x1.5p+4", "0x2.bp+3", "0x5.5p+2", "0xa.bp+1" },
+ { "0x1.5p+4", "0x2.ap+3", "0x5.5p+2", "0xa.ap+1" },
+ { "0x1.6p+4", "0x2.bp+3", "0x5.6p+2", "0xa.bp+1" }
+ },
+ {
+ -64.0 / 3.0, "%.1a",
+ { "-0x1.6p+4", "-0x2.bp+3", "-0x5.6p+2", "-0xa.bp+1" },
+ { "-0x1.5p+4", "-0x2.bp+3", "-0x5.5p+2", "-0xa.bp+1" },
+ { "-0x1.5p+4", "-0x2.ap+3", "-0x5.5p+2", "-0xa.ap+1" },
+ { "-0x1.5p+4", "-0x2.ap+3", "-0x5.5p+2", "-0xa.ap+1" }
+ },
+ };
+
+static int
+test_hex_in_one_mode (double d, const char *fmt, const char *expected[4],
+ const char *mode_name)
+{
+ char buf[100];
+ int ret = snprintf (buf, sizeof buf, fmt, d);
+ if (ret <= 0 || ret >= (int) sizeof buf)
+ {
+ printf ("snprintf for %a returned %d\n", d, ret);
+ return 1;
+ }
+ if (strcmp (buf, expected[0]) == 0
+ || strcmp (buf, expected[1]) == 0
+ || strcmp (buf, expected[2]) == 0
+ || strcmp (buf, expected[3]) == 0)
+ return 0;
+ else
+ {
+ printf ("snprintf (\"%s\", %a) returned \"%s\" not "
+ "\"%s\" or \"%s\" or \"%s\" or \"%s\" (%s)\n",
+ fmt, d, buf, expected[0], expected[1], expected[2], expected[3],
+ mode_name);
+ return 1;
+ }
+}
+
+static int
+do_test (void)
+{
+ int save_round_mode = fegetround ();
+ int result = 0;
+
+ for (size_t i = 0; i < sizeof (dec_tests) / sizeof (dec_tests[0]); i++)
+ {
+ result |= test_dec_in_one_mode (dec_tests[i].d, dec_tests[i].fmt,
+ dec_tests[i].rn, "default rounding mode");
+#ifdef FE_DOWNWARD
+ if (!fesetround (FE_DOWNWARD))
+ {
+ result |= test_dec_in_one_mode (dec_tests[i].d, dec_tests[i].fmt,
+ dec_tests[i].rd, "FE_DOWNWARD");
+ fesetround (save_round_mode);
+ }
+#endif
+#ifdef FE_TOWARDZERO
+ if (!fesetround (FE_TOWARDZERO))
+ {
+ result |= test_dec_in_one_mode (dec_tests[i].d, dec_tests[i].fmt,
+ dec_tests[i].rz, "FE_TOWARDZERO");
+ fesetround (save_round_mode);
+ }
+#endif
+#ifdef FE_UPWARD
+ if (!fesetround (FE_UPWARD))
+ {
+ result |= test_dec_in_one_mode (dec_tests[i].d, dec_tests[i].fmt,
+ dec_tests[i].ru, "FE_UPWARD");
+ fesetround (save_round_mode);
+ }
+#endif
+ }
+
+ for (size_t i = 0; i < sizeof (hex_tests) / sizeof (hex_tests[0]); i++)
+ {
+ result |= test_hex_in_one_mode (hex_tests[i].d, hex_tests[i].fmt,
+ hex_tests[i].rn, "default rounding mode");
+#ifdef FE_DOWNWARD
+ if (!fesetround (FE_DOWNWARD))
+ {
+ result |= test_hex_in_one_mode (hex_tests[i].d, hex_tests[i].fmt,
+ hex_tests[i].rd, "FE_DOWNWARD");
+ fesetround (save_round_mode);
+ }
+#endif
+#ifdef FE_TOWARDZERO
+ if (!fesetround (FE_TOWARDZERO))
+ {
+ result |= test_hex_in_one_mode (hex_tests[i].d, hex_tests[i].fmt,
+ hex_tests[i].rz, "FE_TOWARDZERO");
+ fesetround (save_round_mode);
+ }
+#endif
+#ifdef FE_UPWARD
+ if (!fesetround (FE_UPWARD))
+ {
+ result |= test_hex_in_one_mode (hex_tests[i].d, hex_tests[i].fmt,
+ hex_tests[i].ru, "FE_UPWARD");
+ fesetround (save_round_mode);
+ }
+#endif
+ }
+
+ return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/stdio-common/tst-printf.sh b/libc/stdio-common/tst-printf.sh
index 43e42a8fd..d39b55179 100644
--- a/libc/stdio-common/tst-printf.sh
+++ b/libc/stdio-common/tst-printf.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Testing of printf.
-# Copyright (C) 2000, 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1; shift
run_program_prefix=$1; shift
diff --git a/libc/stdio-common/tst-unbputc.sh b/libc/stdio-common/tst-unbputc.sh
index fd650d483..1f28d4d24 100755
--- a/libc/stdio-common/tst-unbputc.sh
+++ b/libc/stdio-common/tst-unbputc.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Testing the stdio implementation
-# Copyright (C) 2000 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1; shift
run_program_prefix=$1; shift
diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile
index 4479a5f33..a8eb60813 100644
--- a/libc/stdlib/Makefile
+++ b/libc/stdlib/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2009, 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 1991-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -149,7 +149,7 @@ $(objpfx)isomac: isomac.c
$(native-compile)
$(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg
- $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)stdlib/
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)stdlib/
$(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
LDFLAGS-tst-putenv = $(no-as-needed)
@@ -164,3 +164,4 @@ else
link-libm = $(common-objpfx)math/libm.a
endif
$(objpfx)bug-getcontext: $(link-libm)
+$(objpfx)tst-strtod-round: $(link-libm)
diff --git a/libc/stdlib/gen-tst-strtod-round.c b/libc/stdlib/gen-tst-strtod-round.c
index 0a89ff71a..56aafab02 100644
--- a/libc/stdlib/gen-tst-strtod-round.c
+++ b/libc/stdlib/gen-tst-strtod-round.c
@@ -18,6 +18,7 @@
<http://www.gnu.org/licenses/>. */
#define _GNU_SOURCE
+#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -65,7 +66,19 @@ round_str (const char *s, const char *suffix,
mpfr_init (f);
int r = string_to_fp (f, s, MPFR_RNDD);
if (need_exact)
- mpfr_printf ("\t%s,\n", r ? "false" : "true");
+ {
+ assert (prec == 106 && emin == -1073 && emax == 1024);
+ /* The maximum value in IBM long double has discontiguous
+ mantissa bits. */
+ mpfr_t max_value;
+ mpfr_init2 (max_value, 107);
+ mpfr_set_str (max_value, "0x1.fffffffffffff7ffffffffffffcp+1023", 0,
+ MPFR_RNDN);
+ if (mpfr_cmpabs (f, max_value) > 0)
+ r = 1;
+ mpfr_printf ("\t%s,\n", r ? "false" : "true");
+ mpfr_clear (max_value);
+ }
print_fp (f, suffix, ",\n");
string_to_fp (f, s, MPFR_RNDN);
print_fp (f, suffix, ",\n");
@@ -85,11 +98,14 @@ round_for_all (const char *s)
int emin;
int emax;
bool need_exact;
- } formats[6] = {
+ } formats[7] = {
{ "f", 24, -148, 128, false },
{ "", 53, -1073, 1024, false },
{ "L", 53, -1073, 1024, false },
+ /* This is the Intel extended float format. */
{ "L", 64, -16444, 16384, false },
+ /* This is the Motorola extended float format. */
+ { "L", 64, -16445, 16384, false },
{ "L", 106, -1073, 1024, true },
{ "L", 113, -16493, 16384, false },
};
@@ -103,11 +119,11 @@ round_for_all (const char *s)
}
mpfr_printf ("\",\n");
int i;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < 7; i++)
{
round_str (s, formats[i].suffix, formats[i].prec,
formats[i].emin, formats[i].emax, formats[i].need_exact);
- if (i < 5)
+ if (i < 6)
mpfr_printf (",\n");
}
mpfr_printf ("),\n");
diff --git a/libc/stdlib/strtod_l.c b/libc/stdlib/strtod_l.c
index f60091fb6..12bbbc419 100644
--- a/libc/stdlib/strtod_l.c
+++ b/libc/stdlib/strtod_l.c
@@ -62,6 +62,7 @@ extern unsigned long long int ____strtoull_l_internal (const char *, char **,
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
+#include <rounding-mode.h>
/* The gmp headers need some configuration frobs. */
#define HAVE_ALLOCA 1
@@ -127,6 +128,8 @@ extern unsigned long long int ____strtoull_l_internal (const char *, char **,
#define MIN_EXP PASTE(FLT,_MIN_EXP)
#define MAX_10_EXP PASTE(FLT,_MAX_10_EXP)
#define MIN_10_EXP PASTE(FLT,_MIN_10_EXP)
+#define MAX_VALUE PASTE(FLT,_MAX)
+#define MIN_VALUE PASTE(FLT,_MIN)
/* Extra macros required to get FLT expanded before the pasting. */
#define PASTE(a,b) PASTE1(a,b)
@@ -173,6 +176,34 @@ extern const mp_limb_t _tens_in_limb[MAX_DIG_PER_LIMB + 1];
memcpy (dst, src, (dst##size = src##size) * sizeof (mp_limb_t))
+/* Set errno and return an overflowing value with sign specified by
+ NEGATIVE. */
+static FLOAT
+overflow_value (int negative)
+{
+ __set_errno (ERANGE);
+#if FLT_EVAL_METHOD != 0
+ volatile
+#endif
+ FLOAT result = (negative ? -MAX_VALUE : MAX_VALUE) * MAX_VALUE;
+ return result;
+}
+
+
+/* Set errno and return an underflowing value with sign specified by
+ NEGATIVE. */
+static FLOAT
+underflow_value (int negative)
+{
+ __set_errno (ERANGE);
+#if FLT_EVAL_METHOD != 0
+ volatile
+#endif
+ FLOAT result = (negative ? -MIN_VALUE : MIN_VALUE) * MIN_VALUE;
+ return result;
+}
+
+
/* Return a floating point number of the needed type according to the given
multi-precision number after possible rounding. */
static FLOAT
@@ -182,10 +213,7 @@ round_and_return (mp_limb_t *retval, intmax_t exponent, int negative,
if (exponent < MIN_EXP - 1)
{
if (exponent < MIN_EXP - 1 - MANT_DIG)
- {
- __set_errno (ERANGE);
- return negative ? -0.0 : 0.0;
- }
+ return underflow_value (negative);
mp_size_t shift = MIN_EXP - 1 - exponent;
@@ -238,9 +266,14 @@ round_and_return (mp_limb_t *retval, intmax_t exponent, int negative,
if (exponent > MAX_EXP)
goto overflow;
- if ((round_limb & (((mp_limb_t) 1) << round_bit)) != 0
- && (more_bits || (retval[0] & 1) != 0
- || (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0))
+ int mode = get_rounding_mode ();
+
+ if (round_away (negative,
+ (retval[0] & 1) != 0,
+ (round_limb & (((mp_limb_t) 1) << round_bit)) != 0,
+ (more_bits
+ || (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0),
+ mode))
{
mp_limb_t cy = __mpn_add_1 (retval, retval, RETURN_LIMB_SIZE, 1);
@@ -264,7 +297,7 @@ round_and_return (mp_limb_t *retval, intmax_t exponent, int negative,
if (exponent > MAX_EXP)
overflow:
- return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
+ return overflow_value (negative);
return MPN2FLOAT (retval, exponent, negative);
}
@@ -927,9 +960,9 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
else
{
/* Overflow or underflow. */
- __set_errno (ERANGE);
- result = (exp_negative ? (negative ? -0.0 : 0.0) :
- negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL);
+ result = (exp_negative
+ ? underflow_value (negative)
+ : overflow_value (negative));
}
/* Accept all following digits as part of the exponent. */
@@ -1125,16 +1158,10 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
}
if (__builtin_expect (exponent > MAX_10_EXP + 1 - (intmax_t) int_no, 0))
- {
- __set_errno (ERANGE);
- return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
- }
+ return overflow_value (negative);
if (__builtin_expect (exponent < MIN_10_EXP - (DIG + 1), 0))
- {
- __set_errno (ERANGE);
- return negative ? -0.0 : 0.0;
- }
+ return underflow_value (negative);
if (int_no > 0)
{
@@ -1195,10 +1222,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
/* Now we know the exponent of the number in base two.
Check it against the maximum possible exponent. */
if (__builtin_expect (bits > MAX_EXP, 0))
- {
- __set_errno (ERANGE);
- return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
- }
+ return overflow_value (negative);
/* We have already the first BITS bits of the result. Together with
the information whether more non-zero bits follow this is enough
diff --git a/libc/stdlib/tst-fmtmsg.sh b/libc/stdlib/tst-fmtmsg.sh
index abde254e0..868292eba 100755
--- a/libc/stdlib/tst-fmtmsg.sh
+++ b/libc/stdlib/tst-fmtmsg.sh
@@ -1,8 +1,7 @@
#! /bin/sh
# Test of fmtmsg function family.
-# Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
-#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,6 +17,8 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+set -e
+
common_objpfx=$1
run_program_prefix=$2
objpfx=$3
diff --git a/libc/stdlib/tst-secure-getenv.c b/libc/stdlib/tst-secure-getenv.c
index 276b0aff7..7a6930b5a 100644
--- a/libc/stdlib/tst-secure-getenv.c
+++ b/libc/stdlib/tst-secure-getenv.c
@@ -18,7 +18,7 @@
/* Test that secure_getenv works by invoking the test as a SGID
program with a group ID from the supplementary group list. This
test can fail spuriously if the user is not a member of a suitable
- supplementary group. */
+ supplementary group. */
#include <errno.h>
#include <fcntl.h>
@@ -36,7 +36,7 @@ static char MAGIC_ARGUMENT[] = "run-actual-test";
static const char *test_dir;
/* Return a GID which is not our current GID, but is present in the
- supplementary group list. */
+ supplementary group list. */
static gid_t
choose_gid (void)
{
@@ -60,7 +60,7 @@ choose_gid (void)
/* Copies the executable into a restricted directory, so that we can
safely make it SGID with the TARGET group ID. Then runs the
- executable. */
+ executable. */
static int
run_executable_sgid (gid_t target)
{
@@ -152,7 +152,7 @@ run_executable_sgid (gid_t target)
}
if (kid == 0)
{
- /* Child process. */
+ /* Child process. */
char *args[] = { execname, MAGIC_ARGUMENT, NULL };
execve (execname, args, environ);
printf ("execve (%s): %m\n", execname);
@@ -228,9 +228,10 @@ alternative_main (int argc, char **argv)
{
if (getgid () == getegid ())
{
- printf ("SGID failed: GID and EGID match (%jd)\n",
+ /* This can happen if the file system is mounted nosuid. */
+ fprintf (stderr, "SGID failed: GID and EGID match (%jd)\n",
(intmax_t) getgid ());
- exit (2);
+ exit (MAGIC_STATUS);
}
if (getenv ("PATH") == NULL)
{
diff --git a/libc/stdlib/tst-strtod-overflow.c b/libc/stdlib/tst-strtod-overflow.c
index 668d55ba1..6c5b28285 100644
--- a/libc/stdlib/tst-strtod-overflow.c
+++ b/libc/stdlib/tst-strtod-overflow.c
@@ -45,4 +45,5 @@ do_test (void)
}
#define TEST_FUNCTION do_test ()
+#define TIMEOUT 5
#include "../test-skeleton.c"
diff --git a/libc/stdlib/tst-strtod-round.c b/libc/stdlib/tst-strtod-round.c
index 07881e33e..76385a94d 100644
--- a/libc/stdlib/tst-strtod-round.c
+++ b/libc/stdlib/tst-strtod-round.c
@@ -17,6 +17,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <fenv.h>
#include <float.h>
#include <math.h>
#include <stdbool.h>
@@ -24,38 +25,90 @@
#include <stdlib.h>
#include <string.h>
-struct test {
- const char *s;
+struct test_results {
float f;
double d;
- bool ld_ok;
long double ld;
};
+struct test {
+ const char *s;
+ bool ld_ok;
+ struct test_results rd, rn, rz, ru;
+};
+
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
-# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
- ld64d, ld64n, ld64z, ld64u, ld106exact, \
- ld106d, ld106n, ld106z, ld106u, \
- ld113d, ld113n, ld113z, ld113u) \
- { s, fn, dn, true, ld53n }
-#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384
-# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
- ld64d, ld64n, ld64z, ld64u, ld106exact, \
- ld106d, ld106n, ld106z, ld106u, \
- ld113d, ld113n, ld113z, ld113u) \
- { s, fn, dn, true, ld64n }
+# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
+ ld64id, ld64in, ld64iz, ld64iu, \
+ ld64md, ld64mn, ld64mz, ld64mu, \
+ ld106exact, ld106d, ld106n, ld106z, ld106u, \
+ ld113d, ld113n, ld113z, ld113u) \
+ { \
+ s, \
+ true, \
+ { fd, dd, ld53d }, \
+ { fn, dn, ld53n }, \
+ { fz, dz, ld53z }, \
+ { fu, du, ld53u } \
+ }
+#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 && LDBL_MIN_EXP == -16381
+/* This is for the Intel extended float format. */
+# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
+ ld64id, ld64in, ld64iz, ld64iu, \
+ ld64md, ld64mn, ld64mz, ld64mu, \
+ ld106exact, ld106d, ld106n, ld106z, ld106u, \
+ ld113d, ld113n, ld113z, ld113u) \
+ { \
+ s, \
+ true, \
+ { fd, dd, ld64id }, \
+ { fn, dn, ld64in }, \
+ { fz, dz, ld64iz }, \
+ { fu, du, ld64iu } \
+ }
+#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 && LDBL_MIN_EXP == -16382
+/* This is for the Motorola extended float format. */
+# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
+ ld64id, ld64in, ld64iz, ld64iu, \
+ ld64md, ld64mn, ld64mz, ld64mu, \
+ ld106exact, ld106d, ld106n, ld106z, ld106u, \
+ ld113d, ld113n, ld113z, ld113u) \
+ { \
+ s, \
+ true, \
+ { fd, dd, ld64md }, \
+ { fn, dn, ld64mn }, \
+ { fz, dz, ld64mz }, \
+ { fu, du, ld64mu } \
+ }
#elif LDBL_MANT_DIG == 106 && LDBL_MAX_EXP == 1024
-# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
- ld64d, ld64n, ld64z, ld64u, ld106exact, \
- ld106d, ld106n, ld106z, ld106u, \
- ld113d, ld113n, ld113z, ld113u) \
- { s, fn, dn, ld106exact, ld106n }
+# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
+ ld64id, ld64in, ld64iz, ld64iu, \
+ ld64md, ld64mn, ld64mz, ld64mu, \
+ ld106exact, ld106d, ld106n, ld106z, ld106u, \
+ ld113d, ld113n, ld113z, ld113u) \
+ { \
+ s, \
+ ld106exact, \
+ { fd, dd, ld106d }, \
+ { fn, dn, ld106n }, \
+ { fz, dz, ld106z }, \
+ { fu, du, ld106u } \
+ }
#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
-# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
- ld64d, ld64n, ld64z, ld64u, ld106exact, \
- ld106d, ld106n, ld106z, ld106u, \
- ld113d, ld113n, ld113z, ld113u) \
- { s, fn, dn, true, ld113n }
+# define TEST(s, fd, fn, fz, fu, dd, dn, dz, du, ld53d, ld53n, ld53z, ld53u, \
+ ld64id, ld64in, ld64iz, ld64iu, \
+ ld64md, ld64mn, ld64mz, ld64mu, \
+ ld106exact, ld106d, ld106n, ld106z, ld106u, \
+ ld113d, ld113n, ld113z, ld113u) \
+ { \
+ s, \
+ true, \
+ { fd, dd, ld113d }, \
+ { fn, dn, ld113n }, \
+ { fz, dz, ld113z }, \
+ { fu, du, ld113u } \
+ }
#else
# error "unknown long double format"
#endif
@@ -81,6 +134,10 @@ static const struct test tests[] = {
0x2.0000000000003p+44L,
0x2.0000000000003p+44L,
0x2.0000000000003p+44L,
+ 0x2.0000000000003p+44L,
+ 0x2.0000000000003p+44L,
+ 0x2.0000000000003p+44L,
+ 0x2.0000000000003p+44L,
true,
0x2.0000000000003p+44L,
0x2.0000000000003p+44L,
@@ -107,6 +164,10 @@ static const struct test tests[] = {
0x1.0000010000000002p+0L,
0x1.0000010000000002p+0L,
0x1.0000010000000004p+0L,
+ 0x1.0000010000000002p+0L,
+ 0x1.0000010000000002p+0L,
+ 0x1.0000010000000002p+0L,
+ 0x1.0000010000000004p+0L,
false,
0x1.0000010000000002048242f2ffp+0L,
0x1.0000010000000002048242f2ff8p+0L,
@@ -133,6 +194,10 @@ static const struct test tests[] = {
0x1.0000010000000002p+0L,
0x1.0000010000000002p+0L,
0x1.0000010000000004p+0L,
+ 0x1.0000010000000002p+0L,
+ 0x1.0000010000000002p+0L,
+ 0x1.0000010000000002p+0L,
+ 0x1.0000010000000004p+0L,
false,
0x1.0000010000000002048242f2ffp+0L,
0x1.0000010000000002048242f2ff8p+0L,
@@ -159,6 +224,10 @@ static const struct test tests[] = {
0x1.000001000000000cp+0L,
0x1.000001000000000ap+0L,
0x1.000001000000000cp+0L,
+ 0x1.000001000000000ap+0L,
+ 0x1.000001000000000cp+0L,
+ 0x1.000001000000000ap+0L,
+ 0x1.000001000000000cp+0L,
false,
0x1.000001000000000b3db12bdc21p+0L,
0x1.000001000000000b3db12bdc21p+0L,
@@ -185,6 +254,10 @@ static const struct test tests[] = {
0x1.000000fffffffff8p+0L,
0x1.000000fffffffff8p+0L,
0x1.000000fffffffffap+0L,
+ 0x1.000000fffffffff8p+0L,
+ 0x1.000000fffffffff8p+0L,
+ 0x1.000000fffffffff8p+0L,
+ 0x1.000000fffffffffap+0L,
false,
0x1.000000fffffffff8cb535a09dd8p+0L,
0x1.000000fffffffff8cb535a09dd8p+0L,
@@ -211,6 +284,10 @@ static const struct test tests[] = {
0x1.0000010000000056p+0L,
0x1.0000010000000054p+0L,
0x1.0000010000000056p+0L,
+ 0x1.0000010000000054p+0L,
+ 0x1.0000010000000056p+0L,
+ 0x1.0000010000000054p+0L,
+ 0x1.0000010000000056p+0L,
false,
0x1.0000010000000055072873252f8p+0L,
0x1.0000010000000055072873253p+0L,
@@ -237,6 +314,10 @@ static const struct test tests[] = {
0x1.00000100000001c6p+0L,
0x1.00000100000001c4p+0L,
0x1.00000100000001c6p+0L,
+ 0x1.00000100000001c4p+0L,
+ 0x1.00000100000001c6p+0L,
+ 0x1.00000100000001c4p+0L,
+ 0x1.00000100000001c6p+0L,
false,
0x1.00000100000001c5f67cd79279p+0L,
0x1.00000100000001c5f67cd792798p+0L,
@@ -263,6 +344,10 @@ static const struct test tests[] = {
0x1.000001000000103p+0L,
0x1.000001000000102ep+0L,
0x1.000001000000103p+0L,
+ 0x1.000001000000102ep+0L,
+ 0x1.000001000000103p+0L,
+ 0x1.000001000000102ep+0L,
+ 0x1.000001000000103p+0L,
false,
0x1.000001000000102f4fc8c3d757p+0L,
0x1.000001000000102f4fc8c3d7578p+0L,
@@ -289,6 +374,10 @@ static const struct test tests[] = {
0x1.000000fffffea7e6p+0L,
0x1.000000fffffea7e4p+0L,
0x1.000000fffffea7e6p+0L,
+ 0x1.000000fffffea7e4p+0L,
+ 0x1.000000fffffea7e6p+0L,
+ 0x1.000000fffffea7e4p+0L,
+ 0x1.000000fffffea7e6p+0L,
false,
0x1.000000fffffea7e5975eb11da7p+0L,
0x1.000000fffffea7e5975eb11da78p+0L,
@@ -315,6 +404,10 @@ static const struct test tests[] = {
0x1.000000fffff36598p+0L,
0x1.000000fffff36596p+0L,
0x1.000000fffff36598p+0L,
+ 0x1.000000fffff36596p+0L,
+ 0x1.000000fffff36598p+0L,
+ 0x1.000000fffff36596p+0L,
+ 0x1.000000fffff36598p+0L,
false,
0x1.000000fffff36597d40e1b5026p+0L,
0x1.000000fffff36597d40e1b50268p+0L,
@@ -341,6 +434,10 @@ static const struct test tests[] = {
0x1.000001000063fca2p+0L,
0x1.000001000063fcap+0L,
0x1.000001000063fca2p+0L,
+ 0x1.000001000063fcap+0L,
+ 0x1.000001000063fca2p+0L,
+ 0x1.000001000063fcap+0L,
+ 0x1.000001000063fca2p+0L,
false,
0x1.000001000063fca17533f5572f8p+0L,
0x1.000001000063fca17533f5573p+0L,
@@ -367,6 +464,10 @@ static const struct test tests[] = {
0x1.000000fffae49caap+0L,
0x1.000000fffae49ca8p+0L,
0x1.000000fffae49caap+0L,
+ 0x1.000000fffae49ca8p+0L,
+ 0x1.000000fffae49caap+0L,
+ 0x1.000000fffae49ca8p+0L,
+ 0x1.000000fffae49caap+0L,
false,
0x1.000000fffae49ca916dacfff38p+0L,
0x1.000000fffae49ca916dacfff38p+0L,
@@ -393,6 +494,10 @@ static const struct test tests[] = {
0x1.000000fffae49caap+0L,
0x1.000000fffae49ca8p+0L,
0x1.000000fffae49caap+0L,
+ 0x1.000000fffae49ca8p+0L,
+ 0x1.000000fffae49caap+0L,
+ 0x1.000000fffae49ca8p+0L,
+ 0x1.000000fffae49caap+0L,
false,
0x1.000000fffae49ca916dacfff38p+0L,
0x1.000000fffae49ca916dacfff38p+0L,
@@ -419,6 +524,10 @@ static const struct test tests[] = {
0x1.00000101b2b29a46p+0L,
0x1.00000101b2b29a46p+0L,
0x1.00000101b2b29a48p+0L,
+ 0x1.00000101b2b29a46p+0L,
+ 0x1.00000101b2b29a46p+0L,
+ 0x1.00000101b2b29a46p+0L,
+ 0x1.00000101b2b29a48p+0L,
false,
0x1.00000101b2b29a4692b67b7ca3p+0L,
0x1.00000101b2b29a4692b67b7ca3p+0L,
@@ -445,6 +554,10 @@ static const struct test tests[] = {
0x1.00000101b2b29a46p+0L,
0x1.00000101b2b29a46p+0L,
0x1.00000101b2b29a48p+0L,
+ 0x1.00000101b2b29a46p+0L,
+ 0x1.00000101b2b29a46p+0L,
+ 0x1.00000101b2b29a46p+0L,
+ 0x1.00000101b2b29a48p+0L,
false,
0x1.00000101b2b29a4692b67b7ca3p+0L,
0x1.00000101b2b29a4692b67b7ca3p+0L,
@@ -471,6 +584,10 @@ static const struct test tests[] = {
0x1.000001ad7f29abcap+0L,
0x1.000001ad7f29abcap+0L,
0x1.000001ad7f29abccp+0L,
+ 0x1.000001ad7f29abcap+0L,
+ 0x1.000001ad7f29abcap+0L,
+ 0x1.000001ad7f29abcap+0L,
+ 0x1.000001ad7f29abccp+0L,
false,
0x1.000001ad7f29abcaf485787a65p+0L,
0x1.000001ad7f29abcaf485787a65p+0L,
@@ -497,6 +614,10 @@ static const struct test tests[] = {
0x1p+0L,
0x1p+0L,
0x1p+0L,
+ 0x1p+0L,
+ 0x1p+0L,
+ 0x1p+0L,
+ 0x1p+0L,
true,
0x1p+0L,
0x1p+0L,
@@ -523,6 +644,10 @@ static const struct test tests[] = {
0x1.0000000000000802p+0L,
0x1.00000000000008p+0L,
0x1.0000000000000802p+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.0000000000000802p+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.0000000000000802p+0L,
false,
0x1.0000000000000801fc96557232p+0L,
0x1.0000000000000801fc96557232p+0L,
@@ -549,6 +674,10 @@ static const struct test tests[] = {
0x1.00000000000008p+0L,
0x1.00000000000008p+0L,
0x1.0000000000000802p+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.0000000000000802p+0L,
false,
0x1.00000000000008002459c076c48p+0L,
0x1.00000000000008002459c076c5p+0L,
@@ -575,6 +704,10 @@ static const struct test tests[] = {
0x1.00000000000008p+0L,
0x1.00000000000007fep+0L,
0x1.00000000000008p+0L,
+ 0x1.00000000000007fep+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.00000000000007fep+0L,
+ 0x1.00000000000008p+0L,
false,
0x1.00000000000007fff5207e5dap+0L,
0x1.00000000000007fff5207e5da08p+0L,
@@ -601,6 +734,10 @@ static const struct test tests[] = {
0x1.00000000000008p+0L,
0x1.00000000000007fep+0L,
0x1.00000000000008p+0L,
+ 0x1.00000000000007fep+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.00000000000007fep+0L,
+ 0x1.00000000000008p+0L,
false,
0x1.00000000000007ffc5e73c447b8p+0L,
0x1.00000000000007ffc5e73c447cp+0L,
@@ -627,6 +764,10 @@ static const struct test tests[] = {
0x1.0000000000000802p+0L,
0x1.00000000000008p+0L,
0x1.0000000000000802p+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.0000000000000802p+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.0000000000000802p+0L,
false,
0x1.00000000000008016eea8f26c48p+0L,
0x1.00000000000008016eea8f26c48p+0L,
@@ -653,6 +794,10 @@ static const struct test tests[] = {
0x1.00000000000008p+0L,
0x1.00000000000007fep+0L,
0x1.00000000000008p+0L,
+ 0x1.00000000000007fep+0L,
+ 0x1.00000000000008p+0L,
+ 0x1.00000000000007fep+0L,
+ 0x1.00000000000008p+0L,
false,
0x1.00000000000007ff96adfa2b57p+0L,
0x1.00000000000007ff96adfa2b578p+0L,
@@ -679,6 +824,10 @@ static const struct test tests[] = {
0x1.00000000000007eep+0L,
0x1.00000000000007ecp+0L,
0x1.00000000000007eep+0L,
+ 0x1.00000000000007ecp+0L,
+ 0x1.00000000000007eep+0L,
+ 0x1.00000000000007ecp+0L,
+ 0x1.00000000000007eep+0L,
false,
0x1.00000000000007ed24502859138p+0L,
0x1.00000000000007ed24502859138p+0L,
@@ -705,6 +854,10 @@ static const struct test tests[] = {
0x1.0000000000000734p+0L,
0x1.0000000000000734p+0L,
0x1.0000000000000736p+0L,
+ 0x1.0000000000000734p+0L,
+ 0x1.0000000000000734p+0L,
+ 0x1.0000000000000734p+0L,
+ 0x1.0000000000000736p+0L,
false,
0x1.0000000000000734aca5f6226fp+0L,
0x1.0000000000000734aca5f6226fp+0L,
@@ -731,6 +884,10 @@ static const struct test tests[] = {
0x1.b005314e2421e8p-32L,
0x1.b005314e2421e7fep-32L,
0x1.b005314e2421e8p-32L,
+ 0x1.b005314e2421e7fep-32L,
+ 0x1.b005314e2421e8p-32L,
+ 0x1.b005314e2421e7fep-32L,
+ 0x1.b005314e2421e8p-32L,
false,
0x1.b005314e2421e7ffb472840c5ap-32L,
0x1.b005314e2421e7ffb472840c5a8p-32L,
@@ -759,6 +916,10 @@ static const struct test tests[] = {
0xcp-152L,
0xcp-152L,
0xcp-152L,
+ 0xcp-152L,
+ 0xcp-152L,
+ 0xcp-152L,
+ 0xcp-152L,
true,
0xcp-152L,
0xcp-152L,
@@ -785,6 +946,10 @@ static const struct test tests[] = {
0x1.000001p+0L,
0x1.000000fffffffffep+0L,
0x1.000001p+0L,
+ 0x1.000000fffffffffep+0L,
+ 0x1.000001p+0L,
+ 0x1.000000fffffffffep+0L,
+ 0x1.000001p+0L,
false,
0x1.000000fffffffffffffffce7b78p+0L,
0x1.000000fffffffffffffffce7b8p+0L,
@@ -811,6 +976,10 @@ static const struct test tests[] = {
0x1.000001p+0L,
0x1.000001p+0L,
0x1.000001p+0L,
+ 0x1.000001p+0L,
+ 0x1.000001p+0L,
+ 0x1.000001p+0L,
+ 0x1.000001p+0L,
true,
0x1.000001p+0L,
0x1.000001p+0L,
@@ -837,6 +1006,10 @@ static const struct test tests[] = {
0x1.000001p+0L,
0x1.000001p+0L,
0x1.0000010000000002p+0L,
+ 0x1.000001p+0L,
+ 0x1.000001p+0L,
+ 0x1.000001p+0L,
+ 0x1.0000010000000002p+0L,
false,
0x1.00000100000000000000031848p+0L,
0x1.00000100000000000000031848p+0L,
@@ -863,6 +1036,10 @@ static const struct test tests[] = {
0x1.000002p+0L,
0x1.000002p+0L,
0x1.000002p+0L,
+ 0x1.000002p+0L,
+ 0x1.000002p+0L,
+ 0x1.000002p+0L,
+ 0x1.000002p+0L,
true,
0x1.000002p+0L,
0x1.000002p+0L,
@@ -889,6 +1066,10 @@ static const struct test tests[] = {
0x1.000003p+0L,
0x1.000002fffffffffep+0L,
0x1.000003p+0L,
+ 0x1.000002fffffffffep+0L,
+ 0x1.000003p+0L,
+ 0x1.000002fffffffffep+0L,
+ 0x1.000003p+0L,
false,
0x1.000002fffffffffffffffce7b78p+0L,
0x1.000002fffffffffffffffce7b8p+0L,
@@ -915,6 +1096,10 @@ static const struct test tests[] = {
0x1.000003p+0L,
0x1.000003p+0L,
0x1.000003p+0L,
+ 0x1.000003p+0L,
+ 0x1.000003p+0L,
+ 0x1.000003p+0L,
+ 0x1.000003p+0L,
true,
0x1.000003p+0L,
0x1.000003p+0L,
@@ -941,6 +1126,10 @@ static const struct test tests[] = {
0x1.000003p+0L,
0x1.000003p+0L,
0x1.0000030000000002p+0L,
+ 0x1.000003p+0L,
+ 0x1.000003p+0L,
+ 0x1.000003p+0L,
+ 0x1.0000030000000002p+0L,
false,
0x1.00000300000000000000031848p+0L,
0x1.00000300000000000000031848p+0L,
@@ -967,6 +1156,10 @@ static const struct test tests[] = {
0x1.000004p+0L,
0x1.000004p+0L,
0x1.000004p+0L,
+ 0x1.000004p+0L,
+ 0x1.000004p+0L,
+ 0x1.000004p+0L,
+ 0x1.000004p+0L,
true,
0x1.000004p+0L,
0x1.000004p+0L,
@@ -993,6 +1186,10 @@ static const struct test tests[] = {
0x2p-64L,
0x2p-64L,
0x2p-64L,
+ 0x2p-64L,
+ 0x2p-64L,
+ 0x2p-64L,
+ 0x2p-64L,
true,
0x2p-64L,
0x2p-64L,
@@ -1020,6 +1217,10 @@ static const struct test tests[] = {
0x2.000002p-64L,
0x2.000001fffffffffcp-64L,
0x2.000002p-64L,
+ 0x2.000001fffffffffcp-64L,
+ 0x2.000002p-64L,
+ 0x2.000001fffffffffcp-64L,
+ 0x2.000002p-64L,
false,
0x2.000001ffffffffffffffffffffp-64L,
0x2.000002p-64L,
@@ -1047,6 +1248,10 @@ static const struct test tests[] = {
0x2.000002p-64L,
0x2.000002p-64L,
0x2.000002p-64L,
+ 0x2.000002p-64L,
+ 0x2.000002p-64L,
+ 0x2.000002p-64L,
+ 0x2.000002p-64L,
true,
0x2.000002p-64L,
0x2.000002p-64L,
@@ -1074,6 +1279,10 @@ static const struct test tests[] = {
0x2.000002p-64L,
0x2.000002p-64L,
0x2.0000020000000004p-64L,
+ 0x2.000002p-64L,
+ 0x2.000002p-64L,
+ 0x2.000002p-64L,
+ 0x2.0000020000000004p-64L,
false,
0x2.000002p-64L,
0x2.000002p-64L,
@@ -1101,6 +1310,10 @@ static const struct test tests[] = {
0x2.000004p-64L,
0x2.000004p-64L,
0x2.000004p-64L,
+ 0x2.000004p-64L,
+ 0x2.000004p-64L,
+ 0x2.000004p-64L,
+ 0x2.000004p-64L,
true,
0x2.000004p-64L,
0x2.000004p-64L,
@@ -1128,6 +1341,10 @@ static const struct test tests[] = {
0x2.000006p-64L,
0x2.000005fffffffffcp-64L,
0x2.000006p-64L,
+ 0x2.000005fffffffffcp-64L,
+ 0x2.000006p-64L,
+ 0x2.000005fffffffffcp-64L,
+ 0x2.000006p-64L,
false,
0x2.000005ffffffffffffffffffffp-64L,
0x2.000006p-64L,
@@ -1155,6 +1372,10 @@ static const struct test tests[] = {
0x2.000006p-64L,
0x2.000006p-64L,
0x2.000006p-64L,
+ 0x2.000006p-64L,
+ 0x2.000006p-64L,
+ 0x2.000006p-64L,
+ 0x2.000006p-64L,
true,
0x2.000006p-64L,
0x2.000006p-64L,
@@ -1182,6 +1403,10 @@ static const struct test tests[] = {
0x2.000006p-64L,
0x2.000006p-64L,
0x2.0000060000000004p-64L,
+ 0x2.000006p-64L,
+ 0x2.000006p-64L,
+ 0x2.000006p-64L,
+ 0x2.0000060000000004p-64L,
false,
0x2.000006p-64L,
0x2.000006p-64L,
@@ -1209,6 +1434,10 @@ static const struct test tests[] = {
0x2.000008p-64L,
0x2.000008p-64L,
0x2.000008p-64L,
+ 0x2.000008p-64L,
+ 0x2.000008p-64L,
+ 0x2.000008p-64L,
+ 0x2.000008p-64L,
true,
0x2.000008p-64L,
0x2.000008p-64L,
@@ -1236,6 +1465,10 @@ static const struct test tests[] = {
0x1p-120L,
0x1p-120L,
0x1p-120L,
+ 0x1p-120L,
+ 0x1p-120L,
+ 0x1p-120L,
+ 0x1p-120L,
true,
0x1p-120L,
0x1p-120L,
@@ -1263,6 +1496,10 @@ static const struct test tests[] = {
0x1.000001p-120L,
0x1.000000fffffffffep-120L,
0x1.000001p-120L,
+ 0x1.000000fffffffffep-120L,
+ 0x1.000001p-120L,
+ 0x1.000000fffffffffep-120L,
+ 0x1.000001p-120L,
false,
0x1.000000ffffffffffffffffffff8p-120L,
0x1.000001p-120L,
@@ -1290,6 +1527,10 @@ static const struct test tests[] = {
0x1.000001p-120L,
0x1.000001p-120L,
0x1.000001p-120L,
+ 0x1.000001p-120L,
+ 0x1.000001p-120L,
+ 0x1.000001p-120L,
+ 0x1.000001p-120L,
true,
0x1.000001p-120L,
0x1.000001p-120L,
@@ -1317,6 +1558,10 @@ static const struct test tests[] = {
0x1.000001p-120L,
0x1.000001p-120L,
0x1.0000010000000002p-120L,
+ 0x1.000001p-120L,
+ 0x1.000001p-120L,
+ 0x1.000001p-120L,
+ 0x1.0000010000000002p-120L,
false,
0x1.000001p-120L,
0x1.000001p-120L,
@@ -1344,6 +1589,10 @@ static const struct test tests[] = {
0x1.000002p-120L,
0x1.000002p-120L,
0x1.000002p-120L,
+ 0x1.000002p-120L,
+ 0x1.000002p-120L,
+ 0x1.000002p-120L,
+ 0x1.000002p-120L,
true,
0x1.000002p-120L,
0x1.000002p-120L,
@@ -1371,6 +1620,10 @@ static const struct test tests[] = {
0x1.000003p-120L,
0x1.000002fffffffffep-120L,
0x1.000003p-120L,
+ 0x1.000002fffffffffep-120L,
+ 0x1.000003p-120L,
+ 0x1.000002fffffffffep-120L,
+ 0x1.000003p-120L,
false,
0x1.000002ffffffffffffffffffff8p-120L,
0x1.000003p-120L,
@@ -1398,6 +1651,10 @@ static const struct test tests[] = {
0x1.000003p-120L,
0x1.000003p-120L,
0x1.000003p-120L,
+ 0x1.000003p-120L,
+ 0x1.000003p-120L,
+ 0x1.000003p-120L,
+ 0x1.000003p-120L,
true,
0x1.000003p-120L,
0x1.000003p-120L,
@@ -1425,6 +1682,10 @@ static const struct test tests[] = {
0x1.000003p-120L,
0x1.000003p-120L,
0x1.0000030000000002p-120L,
+ 0x1.000003p-120L,
+ 0x1.000003p-120L,
+ 0x1.000003p-120L,
+ 0x1.0000030000000002p-120L,
false,
0x1.000003p-120L,
0x1.000003p-120L,
@@ -1452,6 +1713,10 @@ static const struct test tests[] = {
0x1.000004p-120L,
0x1.000004p-120L,
0x1.000004p-120L,
+ 0x1.000004p-120L,
+ 0x1.000004p-120L,
+ 0x1.000004p-120L,
+ 0x1.000004p-120L,
true,
0x1.000004p-120L,
0x1.000004p-120L,
@@ -1478,6 +1743,10 @@ static const struct test tests[] = {
0xf.fffff8p+124L,
0xf.fffff7fffffffffp+124L,
0xf.fffff8p+124L,
+ 0xf.fffff7fffffffffp+124L,
+ 0xf.fffff8p+124L,
+ 0xf.fffff7fffffffffp+124L,
+ 0xf.fffff8p+124L,
false,
0xf.fffff7fffffffffffffffffffcp+124L,
0xf.fffff8p+124L,
@@ -1504,6 +1773,10 @@ static const struct test tests[] = {
0xf.fffff8p+124L,
0xf.fffff8p+124L,
0xf.fffff8p+124L,
+ 0xf.fffff8p+124L,
+ 0xf.fffff8p+124L,
+ 0xf.fffff8p+124L,
+ 0xf.fffff8p+124L,
true,
0xf.fffff8p+124L,
0xf.fffff8p+124L,
@@ -1530,6 +1803,10 @@ static const struct test tests[] = {
0xf.fffff8p+124L,
0xf.fffff8p+124L,
0xf.fffff8000000001p+124L,
+ 0xf.fffff8p+124L,
+ 0xf.fffff8p+124L,
+ 0xf.fffff8p+124L,
+ 0xf.fffff8000000001p+124L,
false,
0xf.fffff8p+124L,
0xf.fffff8p+124L,
@@ -1556,6 +1833,10 @@ static const struct test tests[] = {
-0xf.fffff8p+124L,
-0xf.fffff7fffffffffp+124L,
-0xf.fffff7fffffffffp+124L,
+ -0xf.fffff8p+124L,
+ -0xf.fffff8p+124L,
+ -0xf.fffff7fffffffffp+124L,
+ -0xf.fffff7fffffffffp+124L,
false,
-0xf.fffff8p+124L,
-0xf.fffff8p+124L,
@@ -1582,6 +1863,10 @@ static const struct test tests[] = {
-0xf.fffff8p+124L,
-0xf.fffff8p+124L,
-0xf.fffff8p+124L,
+ -0xf.fffff8p+124L,
+ -0xf.fffff8p+124L,
+ -0xf.fffff8p+124L,
+ -0xf.fffff8p+124L,
true,
-0xf.fffff8p+124L,
-0xf.fffff8p+124L,
@@ -1608,6 +1893,10 @@ static const struct test tests[] = {
-0xf.fffff8p+124L,
-0xf.fffff8p+124L,
-0xf.fffff8p+124L,
+ -0xf.fffff8000000001p+124L,
+ -0xf.fffff8p+124L,
+ -0xf.fffff8p+124L,
+ -0xf.fffff8p+124L,
false,
-0xf.fffff800000000000000000004p+124L,
-0xf.fffff8p+124L,
@@ -1639,6 +1928,10 @@ static const struct test tests[] = {
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffbffp+1020L,
0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffbffp+1020L,
+ 0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffbffp+1020L,
+ 0xf.ffffffffffffcp+1020L,
false,
0xf.ffffffffffffbffffffffffffcp+1020L,
0xf.ffffffffffffcp+1020L,
@@ -1670,7 +1963,11 @@ static const struct test tests[] = {
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffcp+1020L,
- true,
+ 0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffcp+1020L,
+ false,
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffcp+1020L,
@@ -1701,6 +1998,10 @@ static const struct test tests[] = {
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffc01p+1020L,
+ 0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffcp+1020L,
+ 0xf.ffffffffffffc01p+1020L,
false,
0xf.ffffffffffffcp+1020L,
0xf.ffffffffffffcp+1020L,
@@ -1732,6 +2033,10 @@ static const struct test tests[] = {
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffbffp+1020L,
-0xf.ffffffffffffbffp+1020L,
+ -0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffbffp+1020L,
+ -0xf.ffffffffffffbffp+1020L,
false,
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffcp+1020L,
@@ -1763,7 +2068,11 @@ static const struct test tests[] = {
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffcp+1020L,
- true,
+ -0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffcp+1020L,
+ false,
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffcp+1020L,
@@ -1794,6 +2103,10 @@ static const struct test tests[] = {
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffcp+1020L,
-0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffc01p+1020L,
+ -0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffcp+1020L,
+ -0xf.ffffffffffffcp+1020L,
false,
-0xf.ffffffffffffc0000000000004p+1020L,
-0xf.ffffffffffffcp+1020L,
@@ -1902,6 +2215,10 @@ static const struct test tests[] = {
0xf.fffffffffffffffp+16380L,
0xf.fffffffffffffffp+16380L,
INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ 0xf.fffffffffffffffp+16380L,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
false,
0xf.fffffffffffffffffffffffffcp+1020L,
INFINITY,
@@ -2010,6 +2327,10 @@ static const struct test tests[] = {
INFINITY,
0xf.fffffffffffffffp+16380L,
INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
false,
0xf.fffffffffffffffffffffffffcp+1020L,
INFINITY,
@@ -2118,6 +2439,10 @@ static const struct test tests[] = {
INFINITY,
0xf.fffffffffffffffp+16380L,
INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
false,
0xf.fffffffffffffffffffffffffcp+1020L,
INFINITY,
@@ -2226,6 +2551,10 @@ static const struct test tests[] = {
-0xf.fffffffffffffffp+16380L,
-0xf.fffffffffffffffp+16380L,
-0xf.fffffffffffffffp+16380L,
+ -INFINITY,
+ -0xf.fffffffffffffffp+16380L,
+ -0xf.fffffffffffffffp+16380L,
+ -0xf.fffffffffffffffp+16380L,
false,
-INFINITY,
-INFINITY,
@@ -2334,6 +2663,10 @@ static const struct test tests[] = {
-INFINITY,
-0xf.fffffffffffffffp+16380L,
-0xf.fffffffffffffffp+16380L,
+ -INFINITY,
+ -INFINITY,
+ -0xf.fffffffffffffffp+16380L,
+ -0xf.fffffffffffffffp+16380L,
false,
-INFINITY,
-INFINITY,
@@ -2442,6 +2775,10 @@ static const struct test tests[] = {
-INFINITY,
-0xf.fffffffffffffffp+16380L,
-0xf.fffffffffffffffp+16380L,
+ -INFINITY,
+ -INFINITY,
+ -0xf.fffffffffffffffp+16380L,
+ -0xf.fffffffffffffffp+16380L,
false,
-INFINITY,
-INFINITY,
@@ -2550,6 +2887,10 @@ static const struct test tests[] = {
INFINITY,
0xf.fffffffffffffffp+16380L,
INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
false,
0xf.fffffffffffffffffffffffffcp+1020L,
INFINITY,
@@ -2658,6 +2999,10 @@ static const struct test tests[] = {
INFINITY,
0xf.fffffffffffffffp+16380L,
INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
false,
0xf.fffffffffffffffffffffffffcp+1020L,
INFINITY,
@@ -2766,6 +3111,10 @@ static const struct test tests[] = {
INFINITY,
0xf.fffffffffffffffp+16380L,
INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
+ 0xf.fffffffffffffffp+16380L,
+ INFINITY,
false,
0xf.fffffffffffffffffffffffffcp+1020L,
INFINITY,
@@ -2874,6 +3223,10 @@ static const struct test tests[] = {
-INFINITY,
-0xf.fffffffffffffffp+16380L,
-0xf.fffffffffffffffp+16380L,
+ -INFINITY,
+ -INFINITY,
+ -0xf.fffffffffffffffp+16380L,
+ -0xf.fffffffffffffffp+16380L,
false,
-INFINITY,
-INFINITY,
@@ -2982,6 +3335,10 @@ static const struct test tests[] = {
-INFINITY,
-0xf.fffffffffffffffp+16380L,
-0xf.fffffffffffffffp+16380L,
+ -INFINITY,
+ -INFINITY,
+ -0xf.fffffffffffffffp+16380L,
+ -0xf.fffffffffffffffp+16380L,
false,
-INFINITY,
-INFINITY,
@@ -3090,6 +3447,10 @@ static const struct test tests[] = {
-INFINITY,
-0xf.fffffffffffffffp+16380L,
-0xf.fffffffffffffffp+16380L,
+ -INFINITY,
+ -INFINITY,
+ -0xf.fffffffffffffffp+16380L,
+ -0xf.fffffffffffffffp+16380L,
false,
-INFINITY,
-INFINITY,
@@ -3117,6 +3478,10 @@ static const struct test tests[] = {
0xcp-152L,
0xb.fffffffffffffffp-152L,
0xcp-152L,
+ 0xb.fffffffffffffffp-152L,
+ 0xcp-152L,
+ 0xb.fffffffffffffffp-152L,
+ 0xcp-152L,
false,
0xb.fffffffffffffffffffffffffcp-152L,
0xcp-152L,
@@ -3144,6 +3509,10 @@ static const struct test tests[] = {
0xcp-152L,
0xcp-152L,
0xcp-152L,
+ 0xcp-152L,
+ 0xcp-152L,
+ 0xcp-152L,
+ 0xcp-152L,
true,
0xcp-152L,
0xcp-152L,
@@ -3171,6 +3540,10 @@ static const struct test tests[] = {
0xcp-152L,
0xcp-152L,
0xc.000000000000001p-152L,
+ 0xcp-152L,
+ 0xcp-152L,
+ 0xcp-152L,
+ 0xc.000000000000001p-152L,
false,
0xcp-152L,
0xcp-152L,
@@ -3198,6 +3571,10 @@ static const struct test tests[] = {
-0xcp-152L,
-0xb.fffffffffffffffp-152L,
-0xb.fffffffffffffffp-152L,
+ -0xcp-152L,
+ -0xcp-152L,
+ -0xb.fffffffffffffffp-152L,
+ -0xb.fffffffffffffffp-152L,
false,
-0xcp-152L,
-0xcp-152L,
@@ -3225,6 +3602,10 @@ static const struct test tests[] = {
-0xcp-152L,
-0xcp-152L,
-0xcp-152L,
+ -0xcp-152L,
+ -0xcp-152L,
+ -0xcp-152L,
+ -0xcp-152L,
true,
-0xcp-152L,
-0xcp-152L,
@@ -3252,6 +3633,10 @@ static const struct test tests[] = {
-0xcp-152L,
-0xcp-152L,
-0xcp-152L,
+ -0xc.000000000000001p-152L,
+ -0xcp-152L,
+ -0xcp-152L,
+ -0xcp-152L,
false,
-0xc.00000000000000000000000004p-152L,
-0xcp-152L,
@@ -3279,6 +3664,10 @@ static const struct test tests[] = {
0x1.4p-148L,
0x1.3ffffffffffffffep-148L,
0x1.4p-148L,
+ 0x1.3ffffffffffffffep-148L,
+ 0x1.4p-148L,
+ 0x1.3ffffffffffffffep-148L,
+ 0x1.4p-148L,
false,
0x1.3fffffffffffffffffffffffff8p-148L,
0x1.4p-148L,
@@ -3306,6 +3695,10 @@ static const struct test tests[] = {
0x1.4p-148L,
0x1.4p-148L,
0x1.4p-148L,
+ 0x1.4p-148L,
+ 0x1.4p-148L,
+ 0x1.4p-148L,
+ 0x1.4p-148L,
true,
0x1.4p-148L,
0x1.4p-148L,
@@ -3333,6 +3726,10 @@ static const struct test tests[] = {
0x1.4p-148L,
0x1.4p-148L,
0x1.4000000000000002p-148L,
+ 0x1.4p-148L,
+ 0x1.4p-148L,
+ 0x1.4p-148L,
+ 0x1.4000000000000002p-148L,
false,
0x1.4p-148L,
0x1.4p-148L,
@@ -3360,6 +3757,10 @@ static const struct test tests[] = {
-0x1.4p-148L,
-0x1.3ffffffffffffffep-148L,
-0x1.3ffffffffffffffep-148L,
+ -0x1.4p-148L,
+ -0x1.4p-148L,
+ -0x1.3ffffffffffffffep-148L,
+ -0x1.3ffffffffffffffep-148L,
false,
-0x1.4p-148L,
-0x1.4p-148L,
@@ -3387,6 +3788,10 @@ static const struct test tests[] = {
-0x1.4p-148L,
-0x1.4p-148L,
-0x1.4p-148L,
+ -0x1.4p-148L,
+ -0x1.4p-148L,
+ -0x1.4p-148L,
+ -0x1.4p-148L,
true,
-0x1.4p-148L,
-0x1.4p-148L,
@@ -3414,6 +3819,10 @@ static const struct test tests[] = {
-0x1.4p-148L,
-0x1.4p-148L,
-0x1.4p-148L,
+ -0x1.4000000000000002p-148L,
+ -0x1.4p-148L,
+ -0x1.4p-148L,
+ -0x1.4p-148L,
false,
-0x1.400000000000000000000000008p-148L,
-0x1.4p-148L,
@@ -3452,6 +3861,10 @@ static const struct test tests[] = {
0x6p-1076L,
0x5.fffffffffffffff8p-1076L,
0x6p-1076L,
+ 0x5.fffffffffffffff8p-1076L,
+ 0x6p-1076L,
+ 0x5.fffffffffffffff8p-1076L,
+ 0x6p-1076L,
false,
0x4p-1076L,
0x4p-1076L,
@@ -3490,6 +3903,10 @@ static const struct test tests[] = {
0x6p-1076L,
0x6p-1076L,
0x6p-1076L,
+ 0x6p-1076L,
+ 0x6p-1076L,
+ 0x6p-1076L,
+ 0x6p-1076L,
true,
0x4p-1076L,
0x8p-1076L,
@@ -3528,6 +3945,10 @@ static const struct test tests[] = {
0x6p-1076L,
0x6p-1076L,
0x6.0000000000000008p-1076L,
+ 0x6p-1076L,
+ 0x6p-1076L,
+ 0x6p-1076L,
+ 0x6.0000000000000008p-1076L,
false,
0x4p-1076L,
0x8p-1076L,
@@ -3566,6 +3987,10 @@ static const struct test tests[] = {
-0x6p-1076L,
-0x5.fffffffffffffff8p-1076L,
-0x5.fffffffffffffff8p-1076L,
+ -0x6p-1076L,
+ -0x6p-1076L,
+ -0x5.fffffffffffffff8p-1076L,
+ -0x5.fffffffffffffff8p-1076L,
false,
-0x8p-1076L,
-0x4p-1076L,
@@ -3604,6 +4029,10 @@ static const struct test tests[] = {
-0x6p-1076L,
-0x6p-1076L,
-0x6p-1076L,
+ -0x6p-1076L,
+ -0x6p-1076L,
+ -0x6p-1076L,
+ -0x6p-1076L,
true,
-0x8p-1076L,
-0x8p-1076L,
@@ -3642,6 +4071,10 @@ static const struct test tests[] = {
-0x6p-1076L,
-0x6p-1076L,
-0x6p-1076L,
+ -0x6.0000000000000008p-1076L,
+ -0x6p-1076L,
+ -0x6p-1076L,
+ -0x6p-1076L,
false,
-0x8p-1076L,
-0x8p-1076L,
@@ -3859,6 +4292,10 @@ static const struct test tests[] = {
0x8p-16448L,
0x8p-16448L,
0x1p-16444L,
+ 0x8p-16448L,
+ 0xcp-16448L,
+ 0x8p-16448L,
+ 0xcp-16448L,
false,
0x0p+0L,
0x0p+0L,
@@ -4076,6 +4513,10 @@ static const struct test tests[] = {
0x1p-16444L,
0x8p-16448L,
0x1p-16444L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0xcp-16448L,
false,
0x0p+0L,
0x0p+0L,
@@ -4293,6 +4734,10 @@ static const struct test tests[] = {
0x1p-16444L,
0x8p-16448L,
0x1p-16444L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0x1p-16444L,
false,
0x0p+0L,
0x0p+0L,
@@ -4510,6 +4955,10 @@ static const struct test tests[] = {
-0x8p-16448L,
-0x8p-16448L,
-0x8p-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0x8p-16448L,
+ -0x8p-16448L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -4727,6 +5176,10 @@ static const struct test tests[] = {
-0x1p-16444L,
-0x8p-16448L,
-0x8p-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -4944,6 +5397,10 @@ static const struct test tests[] = {
-0x1p-16444L,
-0x8p-16448L,
-0x8p-16448L,
+ -0x1p-16444L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -5161,6 +5618,10 @@ static const struct test tests[] = {
0x8p-16448L,
0x8p-16448L,
0x1p-16444L,
+ 0x8p-16448L,
+ 0xcp-16448L,
+ 0x8p-16448L,
+ 0xcp-16448L,
false,
0x0p+0L,
0x0p+0L,
@@ -5378,6 +5839,10 @@ static const struct test tests[] = {
0x1p-16444L,
0x8p-16448L,
0x1p-16444L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0xcp-16448L,
false,
0x0p+0L,
0x0p+0L,
@@ -5595,6 +6060,10 @@ static const struct test tests[] = {
0x1p-16444L,
0x8p-16448L,
0x1p-16444L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0xcp-16448L,
+ 0x1p-16444L,
false,
0x0p+0L,
0x0p+0L,
@@ -5812,6 +6281,10 @@ static const struct test tests[] = {
-0x8p-16448L,
-0x8p-16448L,
-0x8p-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0x8p-16448L,
+ -0x8p-16448L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -6029,6 +6502,10 @@ static const struct test tests[] = {
-0x1p-16444L,
-0x8p-16448L,
-0x8p-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -6246,6 +6723,10 @@ static const struct test tests[] = {
-0x1p-16444L,
-0x8p-16448L,
-0x8p-16448L,
+ -0x1p-16444L,
+ -0xcp-16448L,
+ -0xcp-16448L,
+ -0xcp-16448L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -6272,6 +6753,10 @@ static const struct test tests[] = {
-0x3.8p-152L,
-0x3.8p-152L,
-0x3.8p-152L,
+ -0x3.8p-152L,
+ -0x3.8p-152L,
+ -0x3.8p-152L,
+ -0x3.8p-152L,
true,
-0x3.8p-152L,
-0x3.8p-152L,
@@ -6298,6 +6783,10 @@ static const struct test tests[] = {
-0x1.cp-1076L,
-0x1.cp-1076L,
-0x1.cp-1076L,
+ -0x1.cp-1076L,
+ -0x1.cp-1076L,
+ -0x1.cp-1076L,
+ -0x1.cp-1076L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -6324,6 +6813,10 @@ static const struct test tests[] = {
-0x0p+0L,
-0x0p+0L,
-0x0p+0L,
+ -0x4p-16448L,
+ -0x4p-16448L,
+ -0x0p+0L,
+ -0x0p+0L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -6350,6 +6843,10 @@ static const struct test tests[] = {
-0x0p+0L,
-0x0p+0L,
-0x0p+0L,
+ -0x4p-16448L,
+ -0x0p+0L,
+ -0x0p+0L,
+ -0x0p+0L,
false,
-0x4p-1076L,
-0x0p+0L,
@@ -6362,38 +6859,73 @@ static const struct test tests[] = {
};
static int
+test_in_one_mode (const char *s, const struct test_results *expected,
+ bool ld_ok, const char *mode_name)
+{
+ int result = 0;
+ float f = strtof (s, NULL);
+ double d = strtod (s, NULL);
+ long double ld = strtold (s, NULL);
+ if (f != expected->f
+ || copysignf (1.0f, f) != copysignf (1.0f, expected->f))
+ {
+ printf ("strtof (%s) returned %a not %a (%s)\n", s, f,
+ expected->f, mode_name);
+ result = 1;
+ }
+ if (d != expected->d
+ || copysign (1.0, d) != copysign (1.0, expected->d))
+ {
+ printf ("strtod (%s) returned %a not %a (%s)\n", s, d,
+ expected->d, mode_name);
+ result = 1;
+ }
+ if (ld != expected->ld
+ || copysignl (1.0L, ld) != copysignl (1.0L, expected->ld))
+ {
+ printf ("strtold (%s) returned %La not %La (%s)\n", s, ld,
+ expected->ld, mode_name);
+ if (ld_ok)
+ result = 1;
+ else
+ printf ("ignoring this inexact long double result\n");
+ }
+ return result;
+}
+
+static int
do_test (void)
{
+ int save_round_mode = fegetround ();
int result = 0;
for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++)
{
- float f = strtof (tests[i].s, NULL);
- double d = strtod (tests[i].s, NULL);
- long double ld = strtold (tests[i].s, NULL);
- if (f != tests[i].f
- || copysignf (1.0f, f) != copysignf (1.0f, tests[i].f))
+ result |= test_in_one_mode (tests[i].s, &tests[i].rn, tests[i].ld_ok,
+ "default rounding mode");
+#ifdef FE_DOWNWARD
+ if (!fesetround (FE_DOWNWARD))
{
- printf ("strtof (%s) returned %a not %a\n", tests[i].s, f,
- tests[i].f);
- result = 1;
+ result |= test_in_one_mode (tests[i].s, &tests[i].rd, tests[i].ld_ok,
+ "FE_DOWNWARD");
+ fesetround (save_round_mode);
}
- if (d != tests[i].d
- || copysign (1.0, d) != copysign (1.0, tests[i].d))
+#endif
+#ifdef FE_TOWARDZERO
+ if (!fesetround (FE_TOWARDZERO))
{
- printf ("strtod (%s) returned %a not %a\n", tests[i].s, d,
- tests[i].d);
- result = 1;
+ result |= test_in_one_mode (tests[i].s, &tests[i].rz, tests[i].ld_ok,
+ "FE_TOWARDZERO");
+ fesetround (save_round_mode);
}
- if (ld != tests[i].ld
- || copysignl (1.0L, ld) != copysignl (1.0L, tests[i].ld))
+#endif
+#ifdef FE_UPWARD
+ if (!fesetround (FE_UPWARD))
{
- printf ("strtold (%s) returned %La not %La\n", tests[i].s, ld,
- tests[i].ld);
- if (tests[i].ld_ok)
- result = 1;
- else
- printf ("ignoring this inexact long double result\n");
+ result |= test_in_one_mode (tests[i].s, &tests[i].ru, tests[i].ld_ok,
+ "FE_UPWARD");
+ fesetround (save_round_mode);
}
+#endif
}
return result;
}
diff --git a/libc/sysdeps/generic/_G_config.h b/libc/sysdeps/generic/_G_config.h
index 6f756829e..fc83565b9 100644
--- a/libc/sysdeps/generic/_G_config.h
+++ b/libc/sysdeps/generic/_G_config.h
@@ -18,7 +18,6 @@
# define __need_wint_t
#endif
#include <wchar.h>
-#define _G_size_t size_t
typedef struct
{
__off_t __pos;
@@ -29,13 +28,7 @@ typedef struct
__off64_t __pos;
__mbstate_t __state;
} _G_fpos64_t;
-#define _G_ssize_t __ssize_t
-#define _G_off_t __off_t
#define _G_off64_t __off_t
-#define _G_pid_t __pid_t
-#define _G_uid_t __uid_t
-#define _G_wchar_t wchar_t
-#define _G_wint_t wint_t
#define _G_stat64 stat
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# include <gconv.h>
@@ -50,25 +43,11 @@ typedef union
} _G_iconv_t;
#endif
-typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
-typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
-typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
-typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
-
-#define _G_HAVE_BOOL 1
-
/* These library features are always available in the GNU C library. */
-#define _G_HAVE_ATEXIT 1
-#define _G_HAVE_SYS_WAIT 1
-#define _G_NEED_STDARG_H 1
#define _G_va_list __gnuc_va_list
-#define _G_HAVE_PRINTF_FP 1
#define _G_HAVE_MMAP 1
-#define _G_HAVE_LONG_DOUBLE_IO 1
-#define _G_HAVE_IO_FILE_OPEN 1
-#define _G_HAVE_IO_GETLINE_INFO 1
#define _G_IO_IO_FILE_VERSION 0x20001
@@ -77,9 +56,4 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
#define _G_BUFSIZ 8192
-/* These are the vtbl details for ELF. */
-#define _G_NAMES_HAVE_UNDERSCORE 0
-#define _G_VTABLE_LABEL_PREFIX "_vt."
-#define _G_VTABLE_LABEL_HAS_LENGTH 1
-
#endif /* _G_config.h */
diff --git a/libc/sysdeps/generic/get-rounding-mode.h b/libc/sysdeps/generic/get-rounding-mode.h
new file mode 100644
index 000000000..0ecaddd7b
--- /dev/null
+++ b/libc/sysdeps/generic/get-rounding-mode.h
@@ -0,0 +1,124 @@
+/* Determine floating-point rounding mode within libc. Generic version.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _GET_ROUNDING_MODE_H
+#define _GET_ROUNDING_MODE_H 1
+
+#include <fpu_control.h>
+
+/* Define values for FE_* modes not defined for this architecture. */
+#ifdef FE_DOWNWARD
+# define ORIG_FE_DOWNWARD FE_DOWNWARD
+#else
+# define ORIG_FE_DOWNWARD 0
+#endif
+#ifdef FE_TONEAREST
+# define ORIG_FE_TONEAREST FE_TONEAREST
+#else
+# define ORIG_FE_TONEAREST 0
+#endif
+#ifdef FE_TOWARDZERO
+# define ORIG_FE_TOWARDZERO FE_TOWARDZERO
+#else
+# define ORIG_FE_TOWARDZERO 0
+#endif
+#ifdef FE_UPWARD
+# define ORIG_FE_UPWARD FE_UPWARD
+#else
+# define ORIG_FE_UPWARD 0
+#endif
+#define FE_CONSTRUCT_DISTINCT_VALUE(X, Y, Z) \
+ ((((X) & 1) | ((Y) & 2) | ((Z) & 4)) ^ 7)
+#ifndef FE_DOWNWARD
+# define FE_DOWNWARD FE_CONSTRUCT_DISTINCT_VALUE (ORIG_FE_TONEAREST, \
+ ORIG_FE_TOWARDZERO, \
+ ORIG_FE_UPWARD)
+#endif
+#ifndef FE_TONEAREST
+# define FE_TONEAREST FE_CONSTRUCT_DISTINCT_VALUE (FE_DOWNWARD, \
+ ORIG_FE_TOWARDZERO, \
+ ORIG_FE_UPWARD)
+#endif
+#ifndef FE_TOWARDZERO
+# define FE_TOWARDZERO FE_CONSTRUCT_DISTINCT_VALUE (FE_DOWNWARD, \
+ FE_TONEAREST, \
+ ORIG_FE_UPWARD)
+#endif
+#ifndef FE_UPWARD
+# define FE_UPWARD FE_CONSTRUCT_DISTINCT_VALUE (FE_DOWNWARD, \
+ FE_TONEAREST, \
+ FE_TOWARDZERO)
+#endif
+
+/* Return the floating-point rounding mode. */
+
+static inline int
+get_rounding_mode (void)
+{
+#if (defined _FPU_RC_DOWN \
+ || defined _FPU_RC_NEAREST \
+ || defined _FPU_RC_ZERO \
+ || defined _FPU_RC_UP)
+ fpu_control_t fc;
+ const fpu_control_t mask = (0
+# ifdef _FPU_RC_DOWN
+ | _FPU_RC_DOWN
+# endif
+# ifdef _FPU_RC_NEAREST
+ | _FPU_RC_NEAREST
+# endif
+# ifdef _FPU_RC_ZERO
+ | _FPU_RC_ZERO
+# endif
+# ifdef _FPU_RC_UP
+ | _FPU_RC_UP
+# endif
+ );
+
+ _FPU_GETCW (fc);
+ switch (fc & mask)
+ {
+# ifdef _FPU_RC_DOWN
+ case _FPU_RC_DOWN:
+ return FE_DOWNWARD;
+# endif
+
+# ifdef _FPU_RC_NEAREST
+ case _FPU_RC_NEAREST:
+ return FE_TONEAREST;
+# endif
+
+# ifdef _FPU_RC_ZERO
+ case _FPU_RC_ZERO:
+ return FE_TOWARDZERO;
+# endif
+
+# ifdef _FPU_RC_UP
+ case _FPU_RC_UP:
+ return FE_UPWARD;
+# endif
+
+ default:
+ abort ();
+ }
+#else
+ return FE_TONEAREST;
+#endif
+}
+
+#endif /* get-rounding-mode.h */
diff --git a/libc/sysdeps/generic/malloc-sysdep.h b/libc/sysdeps/generic/malloc-sysdep.h
new file mode 100644
index 000000000..bbc48c04f
--- /dev/null
+++ b/libc/sysdeps/generic/malloc-sysdep.h
@@ -0,0 +1,25 @@
+/* System-specific malloc support functions. Generic version.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Force an unmap when the heap shrinks in a secure exec. This ensures that
+ the old data pages immediately cease to be accessible. */
+static inline bool
+check_may_shrink_heap (void)
+{
+ return __libc_enable_secure;
+}
diff --git a/libc/sysdeps/gnu/_G_config.h b/libc/sysdeps/gnu/_G_config.h
index 9d6e23bb4..4d3ae36c4 100644
--- a/libc/sysdeps/gnu/_G_config.h
+++ b/libc/sysdeps/gnu/_G_config.h
@@ -18,7 +18,6 @@
# define __need_wint_t
#endif
#include <wchar.h>
-#define _G_size_t size_t
typedef struct
{
__off_t __pos;
@@ -29,13 +28,7 @@ typedef struct
__off64_t __pos;
__mbstate_t __state;
} _G_fpos64_t;
-#define _G_ssize_t __ssize_t
-#define _G_off_t __off_t
#define _G_off64_t __off64_t
-#define _G_pid_t __pid_t
-#define _G_uid_t __uid_t
-#define _G_wchar_t wchar_t
-#define _G_wint_t wint_t
#define _G_stat64 stat64
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# include <gconv.h>
@@ -50,26 +43,12 @@ typedef union
} _G_iconv_t;
#endif
-typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
-typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
-typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
-typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
-
-#define _G_HAVE_BOOL 1
-
/* These library features are always available in the GNU C library. */
-#define _G_HAVE_ATEXIT 1
-#define _G_HAVE_SYS_WAIT 1
-#define _G_NEED_STDARG_H 1
#define _G_va_list __gnuc_va_list
-#define _G_HAVE_PRINTF_FP 1
#define _G_HAVE_MMAP 1
#define _G_HAVE_MREMAP 1
-#define _G_HAVE_LONG_DOUBLE_IO 1
-#define _G_HAVE_IO_FILE_OPEN 1
-#define _G_HAVE_IO_GETLINE_INFO 1
#define _G_IO_IO_FILE_VERSION 0x20001
@@ -83,11 +62,4 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
#define _G_BUFSIZ 8192
-/* These are the vtbl details for ELF. */
-#define _G_NAMES_HAVE_UNDERSCORE 0
-#define _G_VTABLE_LABEL_HAS_LENGTH 1
-#define _G_USING_THUNKS 1
-#define _G_VTABLE_LABEL_PREFIX "__vt_"
-#define _G_VTABLE_LABEL_PREFIX_ID __vt_
-
#endif /* _G_config.h */
diff --git a/libc/sysdeps/i386/fpu/libm-test-ulps b/libc/sysdeps/i386/fpu/libm-test-ulps
index abd98a295..d35635ce0 100644
--- a/libc/sysdeps/i386/fpu/libm-test-ulps
+++ b/libc/sysdeps/i386/fpu/libm-test-ulps
@@ -2398,6 +2398,10 @@ ldouble: 1
Test "sin (-0x1p65) == 0.047183876212354673805106149805700013943218":
float: 1
ifloat: 1
+Test "sin (0x1.fffff8p+127) == 4.85786063130487339701113680434728152037092e-02":
+float: 1
+Test "sin (0x1p+127) == 6.23385512955870240370428801097126489001833e-01":
+float: 1
Test "sin (0x1p65) == -0.047183876212354673805106149805700013943218":
float: 1
ifloat: 1
@@ -2556,6 +2560,13 @@ ifloat: 1
Test "sincos (-0x1p65, &sin_res, &cos_res) puts 0.047183876212354673805106149805700013943218 in sin_res":
float: 1
ifloat: 1
+Test "sincos (0x1.fffff8p+127, &sin_res, &cos_res) puts 4.85786063130487339701113680434728152037092e-02 in sin_res":
+float: 1
+Test "sincos (0x1p+127, &sin_res, &cos_res) puts 6.23385512955870240370428801097126489001833e-01 in sin_res":
+float: 1
+Test "sincos (0x1p+50, &sin_res, &cos_res) puts 8.68095904660550604334592502063501320395739e-01 in cos_res":
+float: 1
+ifloat: 1
Test "sincos (0x1p65, &sin_res, &cos_res) puts -0.047183876212354673805106149805700013943218 in sin_res":
float: 1
ifloat: 1
diff --git a/libc/sysdeps/i386/i686/fpu/multiarch/Makefile b/libc/sysdeps/i386/i686/fpu/multiarch/Makefile
index 1de37fe4a..aa28f7284 100644
--- a/libc/sysdeps/i386/i686/fpu/multiarch/Makefile
+++ b/libc/sysdeps/i386/i686/fpu/multiarch/Makefile
@@ -1,3 +1,3 @@
ifeq ($(subdir),math)
-libm-sysdep_routines += e_expf-sse2 e_expf-ia32
+libm-sysdep_routines += e_expf-sse2 e_expf-ia32 s_sinf-sse2 s_cosf-sse2
endif
diff --git a/libc/sysdeps/i386/i686/fpu/multiarch/e_expf.c b/libc/sysdeps/i386/i686/fpu/multiarch/e_expf.c
index 65858a311..1966400d1 100644
--- a/libc/sysdeps/i386/i686/fpu/multiarch/e_expf.c
+++ b/libc/sysdeps/i386/i686/fpu/multiarch/e_expf.c
@@ -1,3 +1,21 @@
+/* Multiple versions of expf
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
#include <init-arch.h>
extern double __ieee754_expf_sse2 (double);
diff --git a/libc/sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S b/libc/sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S
new file mode 100644
index 000000000..405c6ea4c
--- /dev/null
+++ b/libc/sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S
@@ -0,0 +1,553 @@
+/* Optimized with sse2 version of cosf
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#define __need_Emath
+#include <bits/errno.h>
+
+/* Short algorithm description:
+ *
+ * 1) if |x| == 0: return 1.0-|x|.
+ * 2) if |x| < 2^-27: return 1.0-|x|.
+ * 3) if |x| < 2^-5 : return 1.0+x^2*DP_COS2_0+x^5*DP_COS2_1.
+ * 4) if |x| < Pi/4: return 1.0+x^2*(C0+x^2*(C1+x^2*(C2+x^2*(C3+x^2*C4)))).
+ * 5) if |x| < 9*Pi/4:
+ * 5.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0x0e, n=k+3,
+ * t=|x|-j*Pi/4.
+ * 5.2) Reconstruction:
+ * s = (-1.0)^((n>>2)&1)
+ * if(n&2 != 0) {
+ * using cos(t) polynomial for |t|<Pi/4, result is
+ * s * (1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4))))).
+ * } else {
+ * using sin(t) polynomial for |t|<Pi/4, result is
+ * s * t * (1.0+t^2*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4))))).
+ * }
+ * 6) if |x| < 2^23, large args:
+ * 6.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0xfffffffe, n=k+3,
+ * t=|x|-j*Pi/4.
+ * 6.2) Reconstruction same as (5.2).
+ * 7) if |x| >= 2^23, very large args:
+ * 7.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0xfffffffe, n=k+3,
+ * t=|x|-j*Pi/4.
+ * 7.2) Reconstruction same as (5.2).
+ * 8) if x is Inf, return x-x, and set errno=EDOM.
+ * 9) if x is NaN, return x-x.
+ *
+ * Special cases:
+ * cos(+-0) = 1 not raising inexact,
+ * cos(subnormal) raises inexact,
+ * cos(min_normalized) raises inexact,
+ * cos(normalized) raises inexact,
+ * cos(Inf) = NaN, raises invalid, sets errno to EDOM,
+ * cos(NaN) = NaN.
+ */
+
+#ifdef PIC
+# define MO1(symbol) L(symbol)##@GOTOFF(%ebx)
+# define MO2(symbol,reg2,_scale) L(symbol)##@GOTOFF(%ebx,reg2,_scale)
+# define CFI_PUSH(REG) cfi_adjust_cfa_offset(4); cfi_rel_offset(REG,0)
+# define CFI_POP(REG) cfi_adjust_cfa_offset(-4); cfi_restore(REG)
+# define PUSH(REG) pushl REG; CFI_PUSH(REG)
+# define POP(REG) popl REG; CFI_POP(REG)
+# define ENTRANCE PUSH(%ebx); LOAD_PIC_REG(bx)
+# define RETURN POP(%ebx); ret; CFI_PUSH(%ebx)
+# define ARG_X 8(%esp)
+#else
+# define MO1(symbol) L(symbol)
+# define MO2(symbol,reg2,_scale) L(symbol)(,reg2,_scale)
+# define ENTRANCE
+# define RETURN ret
+# define ARG_X 4(%esp)
+#endif
+
+ .text
+ENTRY(__cosf_sse2)
+ /* Input: single precision x on stack at address ARG_X */
+
+ ENTRANCE
+ movl ARG_X, %eax /* Bits of x */
+ cvtss2sd ARG_X, %xmm0 /* DP x */
+ andl $0x7fffffff, %eax /* |x| */
+
+ cmpl $0x3f490fdb, %eax /* |x|<Pi/4? */
+ jb L(arg_less_pio4)
+
+ /* Here if |x|>=Pi/4 */
+ movd %eax, %xmm3 /* SP |x| */
+ andpd MO1(DP_ABS_MASK),%xmm0 /* DP |x| */
+ movss MO1(SP_INVPIO4), %xmm2 /* SP 1/(Pi/4) */
+
+ cmpl $0x40e231d6, %eax /* |x|<9*Pi/4? */
+ jae L(large_args)
+
+ /* Here if Pi/4<=|x|<9*Pi/4 */
+ mulss %xmm3, %xmm2 /* SP |x|/(Pi/4) */
+ cvttss2si %xmm2, %eax /* k, number of Pi/4 in x */
+ addl $1, %eax /* k+1 */
+ movl $0x0e, %edx
+ andl %eax, %edx /* j = (k+1)&0x0e */
+ addl $2, %eax /* n */
+ subsd MO2(PIO4J,%edx,8), %xmm0 /* t = |x| - j * Pi/4 */
+
+L(reconstruction):
+ /* Input: %eax=n, %xmm0=t */
+ testl $2, %eax /* n&2 != 0? */
+ jz L(sin_poly)
+
+/*L(cos_poly):*/
+ /* Here if cos(x) calculated using cos(t) polynomial for |t|<Pi/4:
+ * y = t*t; z = y*y;
+ * s = sign(x) * (-1.0)^((n>>2)&1)
+ * result = s * (1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4)))))
+ */
+ shrl $2, %eax /* n>>2 */
+ mulsd %xmm0, %xmm0 /* y=t^2 */
+ andl $1, %eax /* (n>>2)&1 */
+ movaps %xmm0, %xmm1 /* y */
+ mulsd %xmm0, %xmm0 /* z=t^4 */
+
+ movsd MO1(DP_C4), %xmm4 /* C4 */
+ mulsd %xmm0, %xmm4 /* z*C4 */
+ movsd MO1(DP_C3), %xmm3 /* C3 */
+ mulsd %xmm0, %xmm3 /* z*C3 */
+ addsd MO1(DP_C2), %xmm4 /* C2+z*C4 */
+ mulsd %xmm0, %xmm4 /* z*(C2+z*C4) */
+ lea -8(%esp), %esp /* Borrow 4 bytes of stack frame */
+ addsd MO1(DP_C1), %xmm3 /* C1+z*C3 */
+ mulsd %xmm0, %xmm3 /* z*(C1+z*C3) */
+ addsd MO1(DP_C0), %xmm4 /* C0+z*(C2+z*C4) */
+ mulsd %xmm1, %xmm4 /* y*(C0+z*(C2+z*C4)) */
+
+ addsd %xmm4, %xmm3 /* y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+ /* 1.0+y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+ addsd MO1(DP_ONES), %xmm3
+
+ mulsd MO2(DP_ONES,%eax,8), %xmm3 /* DP result */
+ movsd %xmm3, 0(%esp) /* Move result from sse... */
+ fldl 0(%esp) /* ...to FPU. */
+ /* Return back 4 bytes of stack frame */
+ lea 8(%esp), %esp
+ RETURN
+
+ .p2align 4
+L(sin_poly):
+ /* Here if cos(x) calculated using sin(t) polynomial for |t|<Pi/4:
+ * y = t*t; z = y*y;
+ * s = sign(x) * (-1.0)^((n>>2)&1)
+ * result = s * t * (1.0+t^2*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4)))))
+ */
+
+ movaps %xmm0, %xmm4 /* t */
+ shrl $2, %eax /* n>>2 */
+ mulsd %xmm0, %xmm0 /* y=t^2 */
+ andl $1, %eax /* (n>>2)&1 */
+ movaps %xmm0, %xmm1 /* y */
+ mulsd %xmm0, %xmm0 /* z=t^4 */
+
+ movsd MO1(DP_S4), %xmm2 /* S4 */
+ mulsd %xmm0, %xmm2 /* z*S4 */
+ movsd MO1(DP_S3), %xmm3 /* S3 */
+ mulsd %xmm0, %xmm3 /* z*S3 */
+ lea -8(%esp), %esp /* Borrow 4 bytes of stack frame */
+ addsd MO1(DP_S2), %xmm2 /* S2+z*S4 */
+ mulsd %xmm0, %xmm2 /* z*(S2+z*S4) */
+ addsd MO1(DP_S1), %xmm3 /* S1+z*S3 */
+ mulsd %xmm0, %xmm3 /* z*(S1+z*S3) */
+ addsd MO1(DP_S0), %xmm2 /* S0+z*(S2+z*S4) */
+ mulsd %xmm1, %xmm2 /* y*(S0+z*(S2+z*S4)) */
+ /* t*s, where s = sign(x) * (-1.0)^((n>>2)&1) */
+ mulsd MO2(DP_ONES,%eax,8), %xmm4
+ addsd %xmm2, %xmm3 /* y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ /* t*s*y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ mulsd %xmm4, %xmm3
+ /* t*s*(1.0+y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ addsd %xmm4, %xmm3
+ movsd %xmm3, 0(%esp) /* Move result from sse... */
+ fldl 0(%esp) /* ...to FPU. */
+ /* Return back 4 bytes of stack frame */
+ lea 8(%esp), %esp
+ RETURN
+
+ .p2align 4
+L(large_args):
+ /* Here if |x|>=9*Pi/4 */
+ cmpl $0x7f800000, %eax /* x is Inf or NaN? */
+ jae L(arg_inf_or_nan)
+
+ /* Here if finite |x|>=9*Pi/4 */
+ cmpl $0x4b000000, %eax /* |x|<2^23? */
+ jae L(very_large_args)
+
+ /* Here if 9*Pi/4<=|x|<2^23 */
+ movsd MO1(DP_INVPIO4), %xmm1 /* 1/(Pi/4) */
+ mulsd %xmm0, %xmm1 /* |x|/(Pi/4) */
+ cvttsd2si %xmm1, %eax /* k=trunc(|x|/(Pi/4)) */
+ addl $1, %eax /* k+1 */
+ movl %eax, %edx
+ andl $0xfffffffe, %edx /* j=(k+1)&0xfffffffe */
+ cvtsi2sdl %edx, %xmm4 /* DP j */
+ movsd MO1(DP_PIO4HI), %xmm2 /* -PIO4HI = high part of -Pi/4 */
+ mulsd %xmm4, %xmm2 /* -j*PIO4HI */
+ movsd MO1(DP_PIO4LO), %xmm3 /* -PIO4LO = low part of -Pi/4 */
+ addsd %xmm2, %xmm0 /* |x| - j*PIO4HI */
+ addl $2, %eax /* n */
+ mulsd %xmm3, %xmm4 /* j*PIO4LO */
+ addsd %xmm4, %xmm0 /* t = |x| - j*PIO4HI - j*PIO4LO */
+ jmp L(reconstruction)
+
+ .p2align 4
+L(very_large_args):
+ /* Here if finite |x|>=2^23 */
+
+ /* bitpos = (ix>>23) - BIAS_32 + 59; */
+ shrl $23, %eax /* eb = biased exponent of x */
+ /* bitpos = eb - 0x7f + 59, where 0x7f is exponent bias */
+ subl $68, %eax
+ movl $28, %ecx /* %cl=28 */
+ movl %eax, %edx /* bitpos copy */
+
+ /* j = bitpos/28; */
+ div %cl /* j in register %al=%ax/%cl */
+ movapd %xmm0, %xmm3 /* |x| */
+ /* clear unneeded remainder from %ah */
+ andl $0xff, %eax
+
+ imull $28, %eax, %ecx /* j*28 */
+ movsd MO1(DP_HI_MASK), %xmm4 /* DP_HI_MASK */
+ movapd %xmm0, %xmm5 /* |x| */
+ mulsd -2*8+MO2(_FPI,%eax,8), %xmm3 /* tmp3 = FPI[j-2]*|x| */
+ movapd %xmm0, %xmm1 /* |x| */
+ mulsd -1*8+MO2(_FPI,%eax,8), %xmm5 /* tmp2 = FPI[j-1]*|x| */
+ mulsd 0*8+MO2(_FPI,%eax,8), %xmm0 /* tmp0 = FPI[j]*|x| */
+ addl $19, %ecx /* j*28+19 */
+ mulsd 1*8+MO2(_FPI,%eax,8), %xmm1 /* tmp1 = FPI[j+1]*|x| */
+ cmpl %ecx, %edx /* bitpos>=j*28+19? */
+ jl L(very_large_skip1)
+
+ /* Here if bitpos>=j*28+19 */
+ andpd %xmm3, %xmm4 /* HI(tmp3) */
+ subsd %xmm4, %xmm3 /* tmp3 = tmp3 - HI(tmp3) */
+L(very_large_skip1):
+
+ movsd MO1(DP_2POW52), %xmm6
+ movapd %xmm5, %xmm2 /* tmp2 copy */
+ addsd %xmm3, %xmm5 /* tmp5 = tmp3 + tmp2 */
+ movl $1, %edx
+ addsd %xmm5, %xmm6 /* tmp6 = tmp5 + 2^52 */
+ movsd 8+MO1(DP_2POW52), %xmm4
+ movd %xmm6, %eax /* k = I64_LO(tmp6); */
+ addsd %xmm6, %xmm4 /* tmp4 = tmp6 - 2^52 */
+ comisd %xmm5, %xmm4 /* tmp4 > tmp5? */
+ jbe L(very_large_skip2)
+
+ /* Here if tmp4 > tmp5 */
+ subl $1, %eax /* k-- */
+ addsd 8+MO1(DP_ONES), %xmm4 /* tmp4 -= 1.0 */
+L(very_large_skip2):
+
+ andl %eax, %edx /* k&1 */
+ subsd %xmm4, %xmm3 /* tmp3 -= tmp4 */
+ addsd MO2(DP_ZERONE,%edx,8), %xmm3 /* t = DP_ZERONE[k&1] + tmp3 */
+ addsd %xmm2, %xmm3 /* t += tmp2 */
+ addsd %xmm3, %xmm0 /* t += tmp0 */
+ addl $3, %eax /* n=k+3 */
+ addsd %xmm1, %xmm0 /* t += tmp1 */
+ mulsd MO1(DP_PIO4), %xmm0 /* t *= PI04 */
+
+ jmp L(reconstruction) /* end of very_large_args peth */
+
+ .p2align 4
+L(arg_less_pio4):
+ /* Here if |x|<Pi/4 */
+ cmpl $0x3d000000, %eax /* |x|<2^-5? */
+ jl L(arg_less_2pn5)
+
+ /* Here if 2^-5<=|x|<Pi/4 */
+ mulsd %xmm0, %xmm0 /* y=x^2 */
+ movaps %xmm0, %xmm1 /* y */
+ mulsd %xmm0, %xmm0 /* z=x^4 */
+ movsd MO1(DP_C4), %xmm3 /* C4 */
+ mulsd %xmm0, %xmm3 /* z*C4 */
+ movsd MO1(DP_C3), %xmm5 /* C3 */
+ mulsd %xmm0, %xmm5 /* z*C3 */
+ addsd MO1(DP_C2), %xmm3 /* C2+z*C4 */
+ mulsd %xmm0, %xmm3 /* z*(C2+z*C4) */
+ addsd MO1(DP_C1), %xmm5 /* C1+z*C3 */
+ mulsd %xmm0, %xmm5 /* z*(C1+z*C3) */
+ addsd MO1(DP_C0), %xmm3 /* C0+z*(C2+z*C4) */
+ mulsd %xmm1, %xmm3 /* y*(C0+z*(C2+z*C4)) */
+ addsd %xmm5, %xmm3 /* y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+ /* 1.0 + y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+ addsd MO1(DP_ONES), %xmm3
+ cvtsd2ss %xmm3, %xmm3 /* SP result */
+
+L(epilogue):
+ lea -4(%esp), %esp /* Borrow 4 bytes of stack frame */
+ movss %xmm3, 0(%esp) /* Move result from sse... */
+ flds 0(%esp) /* ...to FPU. */
+ /* Return back 4 bytes of stack frame */
+ lea 4(%esp), %esp
+ RETURN
+
+ .p2align 4
+L(arg_less_2pn5):
+ /* Here if |x|<2^-5 */
+ cmpl $0x32000000, %eax /* |x|<2^-27? */
+ jl L(arg_less_2pn27)
+
+ /* Here if 2^-27<=|x|<2^-5 */
+ mulsd %xmm0, %xmm0 /* DP x^2 */
+ movsd MO1(DP_COS2_1), %xmm3 /* DP DP_COS2_1 */
+ mulsd %xmm0, %xmm3 /* DP x^2*DP_COS2_1 */
+ addsd MO1(DP_COS2_0), %xmm3 /* DP DP_COS2_0+x^2*DP_COS2_1 */
+ mulsd %xmm0, %xmm3 /* DP x^2*DP_COS2_0+x^4*DP_COS2_1 */
+ /* DP 1.0+x^2*DP_COS2_0+x^4*DP_COS2_1 */
+ addsd MO1(DP_ONES), %xmm3
+ cvtsd2ss %xmm3, %xmm3 /* SP result */
+ jmp L(epilogue)
+
+ .p2align 4
+L(arg_less_2pn27):
+ /* Here if |x|<2^-27 */
+ movss ARG_X, %xmm0 /* x */
+ andps MO1(SP_ABS_MASK),%xmm0 /* |x| */
+ movss MO1(SP_ONE), %xmm3 /* 1.0 */
+ subss %xmm0, %xmm3 /* result is 1.0-|x| */
+ jmp L(epilogue)
+
+ .p2align 4
+L(arg_inf_or_nan):
+ /* Here if |x| is Inf or NAN */
+ jne L(skip_errno_setting) /* in case of x is NaN */
+
+ /* Here if x is Inf. Set errno to EDOM. */
+ call JUMPTARGET(__errno_location)
+ movl $EDOM, (%eax)
+
+ .p2align 4
+L(skip_errno_setting):
+ /* Here if |x| is Inf or NAN. Continued. */
+ movss ARG_X, %xmm3 /* load x */
+ subss %xmm3, %xmm3 /* Result is NaN */
+ jmp L(epilogue)
+END(__cosf_sse2)
+
+ .section .rodata, "a"
+ .p2align 3
+L(PIO4J): /* Table of j*Pi/4, for j=0,1,..,10 */
+ .long 0x00000000,0x00000000
+ .long 0x54442d18,0x3fe921fb
+ .long 0x54442d18,0x3ff921fb
+ .long 0x7f3321d2,0x4002d97c
+ .long 0x54442d18,0x400921fb
+ .long 0x2955385e,0x400f6a7a
+ .long 0x7f3321d2,0x4012d97c
+ .long 0xe9bba775,0x4015fdbb
+ .long 0x54442d18,0x401921fb
+ .long 0xbeccb2bb,0x401c463a
+ .long 0x2955385e,0x401f6a7a
+ .type L(PIO4J), @object
+ ASM_SIZE_DIRECTIVE(L(PIO4J))
+
+ .p2align 3
+L(_FPI): /* 4/Pi broken into sum of positive DP values */
+ .long 0x00000000,0x00000000
+ .long 0x6c000000,0x3ff45f30
+ .long 0x2a000000,0x3e3c9c88
+ .long 0xa8000000,0x3c54fe13
+ .long 0xd0000000,0x3aaf47d4
+ .long 0x6c000000,0x38fbb81b
+ .long 0xe0000000,0x3714acc9
+ .long 0x7c000000,0x3560e410
+ .long 0x56000000,0x33bca2c7
+ .long 0xac000000,0x31fbd778
+ .long 0xe0000000,0x300b7246
+ .long 0xe8000000,0x2e5d2126
+ .long 0x48000000,0x2c970032
+ .long 0xe8000000,0x2ad77504
+ .long 0xe0000000,0x290921cf
+ .long 0xb0000000,0x274deb1c
+ .long 0xe0000000,0x25829a73
+ .long 0xbe000000,0x23fd1046
+ .long 0x10000000,0x2224baed
+ .long 0x8e000000,0x20709d33
+ .long 0x80000000,0x1e535a2f
+ .long 0x64000000,0x1cef904e
+ .long 0x30000000,0x1b0d6398
+ .long 0x24000000,0x1964ce7d
+ .long 0x16000000,0x17b908bf
+ .type L(_FPI), @object
+ ASM_SIZE_DIRECTIVE(L(_FPI))
+
+/* Coefficients of polynomial
+ for cos(x)~=1.0+x^2*DP_COS2_0+x^4*DP_COS2_1, |x|<2^-5. */
+ .p2align 3
+L(DP_COS2_0):
+ .long 0xff5cc6fd,0xbfdfffff
+ .type L(DP_COS2_0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_COS2_0))
+
+ .p2align 3
+L(DP_COS2_1):
+ .long 0xb178dac5,0x3fa55514
+ .type L(DP_COS2_1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_COS2_1))
+
+ .p2align 3
+L(DP_ZERONE):
+ .long 0x00000000,0x00000000 /* 0.0 */
+ .long 0x00000000,0xbff00000 /* 1.0 */
+ .type L(DP_ZERONE),@object
+ ASM_SIZE_DIRECTIVE(L(DP_ZERONE))
+
+ .p2align 3
+L(DP_ONES):
+ .long 0x00000000,0x3ff00000 /* +1.0 */
+ .long 0x00000000,0xbff00000 /* -1.0 */
+ .type L(DP_ONES), @object
+ ASM_SIZE_DIRECTIVE(L(DP_ONES))
+
+/* Coefficients of polynomial
+ for sin(t)~=t+t^3*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4)))), |t|<Pi/4. */
+ .p2align 3
+L(DP_S3):
+ .long 0x64e6b5b4,0x3ec71d72
+ .type L(DP_S3), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S3))
+
+ .p2align 3
+L(DP_S1):
+ .long 0x10c2688b,0x3f811111
+ .type L(DP_S1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S1))
+
+ .p2align 3
+L(DP_S4):
+ .long 0x1674b58a,0xbe5a947e
+ .type L(DP_S4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S4))
+
+ .p2align 3
+L(DP_S2):
+ .long 0x8b4bd1f9,0xbf2a019f
+ .type L(DP_S2), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S2))
+
+ .p2align 3
+L(DP_S0):
+ .long 0x55551cd9,0xbfc55555
+ .type L(DP_S0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S0))
+
+/* Coefficients of polynomial
+ for cos(t)~=1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4)))), |t|<Pi/4. */
+ .p2align 3
+L(DP_C3):
+ .long 0x9ac43cc0,0x3efa00eb
+ .type L(DP_C3), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C3))
+
+ .p2align 3
+L(DP_C1):
+ .long 0x545c50c7,0x3fa55555
+ .type L(DP_C1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C1))
+
+ .p2align 3
+L(DP_C4):
+ .long 0xdd8844d7,0xbe923c97
+ .type L(DP_C4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C4))
+
+ .p2align 3
+L(DP_C2):
+ .long 0x348b6874,0xbf56c16b
+ .type L(DP_C2), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C2))
+
+ .p2align 3
+L(DP_C0):
+ .long 0xfffe98ae,0xbfdfffff
+ .type L(DP_C0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C0))
+
+ .p2align 3
+L(DP_PIO4):
+ .long 0x54442d18,0x3fe921fb /* Pi/4 */
+ .type L(DP_PIO4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4))
+
+ .p2align 3
+L(DP_2POW52):
+ .long 0x00000000,0x43300000 /* +2^52 */
+ .long 0x00000000,0xc3300000 /* -2^52 */
+ .type L(DP_2POW52), @object
+ ASM_SIZE_DIRECTIVE(L(DP_2POW52))
+
+ .p2align 3
+L(DP_INVPIO4):
+ .long 0x6dc9c883,0x3ff45f30 /* 4/Pi */
+ .type L(DP_INVPIO4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_INVPIO4))
+
+ .p2align 3
+L(DP_PIO4HI):
+ .long 0x54000000,0xbfe921fb /* High part of Pi/4 */
+ .type L(DP_PIO4HI), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4HI))
+
+ .p2align 3
+L(DP_PIO4LO):
+ .long 0x11A62633,0xbe010b46 /* Low part of Pi/4 */
+ .type L(DP_PIO4LO), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4LO))
+
+ .p2align 2
+L(SP_INVPIO4):
+ .long 0x3fa2f983 /* 4/Pi */
+ .type L(SP_INVPIO4), @object
+ ASM_SIZE_DIRECTIVE(L(SP_INVPIO4))
+
+ .p2align 4
+L(DP_ABS_MASK): /* Mask for getting DP absolute value */
+ .long 0xffffffff,0x7fffffff
+ .long 0xffffffff,0x7fffffff
+ .type L(DP_ABS_MASK), @object
+ ASM_SIZE_DIRECTIVE(L(DP_ABS_MASK))
+
+ .p2align 3
+L(DP_HI_MASK): /* Mask for getting high 21 bits of DP value */
+ .long 0x00000000,0xffffffff
+ .type L(DP_HI_MASK), @object
+ ASM_SIZE_DIRECTIVE(L(DP_HI_MASK))
+
+ .p2align 4
+L(SP_ABS_MASK): /* Mask for getting SP absolute value */
+ .long 0x7fffffff,0x7fffffff
+ .long 0x7fffffff,0x7fffffff
+ .type L(SP_ABS_MASK), @object
+ ASM_SIZE_DIRECTIVE(L(SP_ABS_MASK))
+
+ .p2align 2
+L(SP_ONE):
+ .long 0x3f800000 /* 1.0 */
+ .type L(SP_ONE), @object
+ ASM_SIZE_DIRECTIVE(L(SP_ONE))
+
+weak_alias (__cosf, cosf)
diff --git a/libc/sysdeps/i386/i686/fpu/multiarch/s_cosf.c b/libc/sysdeps/i386/i686/fpu/multiarch/s_cosf.c
new file mode 100644
index 000000000..f07c3e510
--- /dev/null
+++ b/libc/sysdeps/i386/i686/fpu/multiarch/s_cosf.c
@@ -0,0 +1,29 @@
+/* Multiple versions of cosf
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <init-arch.h>
+
+extern float __cosf_sse2 (float);
+extern float __cosf_ia32 (float);
+float __cosf (float);
+
+libm_ifunc (__cosf, HAS_SSE2 ? __cosf_sse2 : __cosf_ia32);
+weak_alias (__cosf, cosf);
+
+#define COSF __cosf_ia32
+#include <sysdeps/ieee754/flt-32/s_cosf.c>
diff --git a/libc/sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S b/libc/sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S
new file mode 100644
index 000000000..49d59b597
--- /dev/null
+++ b/libc/sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S
@@ -0,0 +1,566 @@
+/* Optimized with sse2 version of sinf
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#define __need_Emath
+#include <bits/errno.h>
+
+/* Short algorithm description:
+ *
+ * 1) if |x| == 0: return x.
+ * 2) if |x| < 2^-27: return x-x*DP_SMALL, raise underflow only when needed.
+ * 3) if |x| < 2^-5 : return x+x^3*DP_SIN2_0+x^5*DP_SIN2_1.
+ * 4) if |x| < Pi/4: return x+x^3*(S0+x^2*(S1+x^2*(S2+x^2*(S3+x^2*S4)))).
+ * 5) if |x| < 9*Pi/4:
+ * 5.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0x0e, n=k+1,
+ * t=|x|-j*Pi/4.
+ * 5.2) Reconstruction:
+ * s = sign(x) * (-1.0)^((n>>2)&1)
+ * if(n&2 != 0) {
+ * using cos(t) polynomial for |t|<Pi/4, result is
+ * s * (1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4))))).
+ * } else {
+ * using sin(t) polynomial for |t|<Pi/4, result is
+ * s * t * (1.0+t^2*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4))))).
+ * }
+ * 6) if |x| < 2^23, large args:
+ * 6.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0xfffffffe, n=k+1,
+ * t=|x|-j*Pi/4.
+ * 6.2) Reconstruction same as (5.2).
+ * 7) if |x| >= 2^23, very large args:
+ * 7.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0xfffffffe, n=k+1,
+ * t=|x|-j*Pi/4.
+ * 7.2) Reconstruction same as (5.2).
+ * 8) if x is Inf, return x-x, and set errno=EDOM.
+ * 9) if x is NaN, return x-x.
+ *
+ * Special cases:
+ * sin(+-0) = +-0 not raising inexact/underflow,
+ * sin(subnormal) raises inexact/underflow,
+ * sin(min_normalized) raises inexact/underflow,
+ * sin(normalized) raises inexact,
+ * sin(Inf) = NaN, raises invalid, sets errno to EDOM,
+ * sin(NaN) = NaN.
+ */
+
+#ifdef PIC
+# define MO1(symbol) L(symbol)##@GOTOFF(%ebx)
+# define MO2(symbol,reg2,_scale) L(symbol)##@GOTOFF(%ebx,reg2,_scale)
+# define CFI_PUSH(REG) cfi_adjust_cfa_offset(4); cfi_rel_offset(REG,0)
+# define CFI_POP(REG) cfi_adjust_cfa_offset(-4); cfi_restore(REG)
+# define PUSH(REG) pushl REG; CFI_PUSH(REG)
+# define POP(REG) popl REG; CFI_POP(REG)
+# define ENTRANCE PUSH(%ebx); LOAD_PIC_REG(bx)
+# define RETURN POP(%ebx); ret; CFI_PUSH(%ebx)
+# define ARG_X 8(%esp)
+#else
+# define MO1(symbol) L(symbol)
+# define MO2(symbol,reg2,_scale) L(symbol)(,reg2,_scale)
+# define ENTRANCE
+# define RETURN ret
+# define ARG_X 4(%esp)
+#endif
+
+ .text
+ENTRY(__sinf_sse2)
+ /* Input: single precision x on stack at address ARG_X */
+
+ ENTRANCE
+ movl ARG_X, %eax /* Bits of x */
+ cvtss2sd ARG_X, %xmm0 /* DP x */
+ andl $0x7fffffff, %eax /* |x| */
+
+ cmpl $0x3f490fdb, %eax /* |x|<Pi/4? */
+ jb L(arg_less_pio4)
+
+ /* Here if |x|>=Pi/4 */
+ movd %eax, %xmm3 /* SP |x| */
+ andpd MO1(DP_ABS_MASK),%xmm0 /* DP |x| */
+ movss MO1(SP_INVPIO4), %xmm2 /* SP 1/(Pi/4) */
+
+ cmpl $0x40e231d6, %eax /* |x|<9*Pi/4? */
+ jae L(large_args)
+
+ /* Here if Pi/4<=|x|<9*Pi/4 */
+ mulss %xmm3, %xmm2 /* SP |x|/(Pi/4) */
+ movl ARG_X, %ecx /* Load x */
+ cvttss2si %xmm2, %eax /* k, number of Pi/4 in x */
+ shrl $31, %ecx /* sign of x */
+ addl $1, %eax /* k+1 */
+ movl $0x0e, %edx
+ andl %eax, %edx /* j = (k+1)&0x0e */
+ subsd MO2(PIO4J,%edx,8), %xmm0 /* t = |x| - j * Pi/4 */
+
+L(reconstruction):
+ /* Input: %eax=n, %xmm0=t, %ecx=sign(x) */
+ testl $2, %eax /* n&2 != 0? */
+ jz L(sin_poly)
+
+/*L(cos_poly):*/
+ /* Here if sin(x) calculated using cos(t) polynomial for |t|<Pi/4:
+ * y = t*t; z = y*y;
+ * s = sign(x) * (-1.0)^((n>>2)&1)
+ * result = s * (1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4)))))
+ */
+ shrl $2, %eax /* n>>2 */
+ mulsd %xmm0, %xmm0 /* y=t^2 */
+ andl $1, %eax /* (n>>2)&1 */
+ movaps %xmm0, %xmm1 /* y */
+ mulsd %xmm0, %xmm0 /* z=t^4 */
+
+ movsd MO1(DP_C4), %xmm4 /* C4 */
+ mulsd %xmm0, %xmm4 /* z*C4 */
+ xorl %eax, %ecx /* (-1.0)^((n>>2)&1) XOR sign(x) */
+ movsd MO1(DP_C3), %xmm3 /* C3 */
+ mulsd %xmm0, %xmm3 /* z*C3 */
+ addsd MO1(DP_C2), %xmm4 /* C2+z*C4 */
+ mulsd %xmm0, %xmm4 /* z*(C2+z*C4) */
+ lea -8(%esp), %esp /* Borrow 4 bytes of stack frame */
+ addsd MO1(DP_C1), %xmm3 /* C1+z*C3 */
+ mulsd %xmm0, %xmm3 /* z*(C1+z*C3) */
+ addsd MO1(DP_C0), %xmm4 /* C0+z*(C2+z*C4) */
+ mulsd %xmm1, %xmm4 /* y*(C0+z*(C2+z*C4)) */
+
+ addsd %xmm4, %xmm3 /* y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+ /* 1.0+y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+ addsd MO1(DP_ONES), %xmm3
+
+ mulsd MO2(DP_ONES,%ecx,8), %xmm3 /* DP result */
+ movsd %xmm3, 0(%esp) /* Move result from sse... */
+ fldl 0(%esp) /* ...to FPU. */
+ /* Return back 4 bytes of stack frame */
+ lea 8(%esp), %esp
+ RETURN
+
+ .p2align 4
+L(sin_poly):
+ /* Here if sin(x) calculated using sin(t) polynomial for |t|<Pi/4:
+ * y = t*t; z = y*y;
+ * s = sign(x) * (-1.0)^((n>>2)&1)
+ * result = s * t * (1.0+t^2*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4)))))
+ */
+
+ movaps %xmm0, %xmm4 /* t */
+ shrl $2, %eax /* n>>2 */
+ mulsd %xmm0, %xmm0 /* y=t^2 */
+ andl $1, %eax /* (n>>2)&1 */
+ movaps %xmm0, %xmm1 /* y */
+ xorl %eax, %ecx /* (-1.0)^((n>>2)&1) XOR sign(x) */
+ mulsd %xmm0, %xmm0 /* z=t^4 */
+
+ movsd MO1(DP_S4), %xmm2 /* S4 */
+ mulsd %xmm0, %xmm2 /* z*S4 */
+ movsd MO1(DP_S3), %xmm3 /* S3 */
+ mulsd %xmm0, %xmm3 /* z*S3 */
+ lea -8(%esp), %esp /* Borrow 4 bytes of stack frame */
+ addsd MO1(DP_S2), %xmm2 /* S2+z*S4 */
+ mulsd %xmm0, %xmm2 /* z*(S2+z*S4) */
+ addsd MO1(DP_S1), %xmm3 /* S1+z*S3 */
+ mulsd %xmm0, %xmm3 /* z*(S1+z*S3) */
+ addsd MO1(DP_S0), %xmm2 /* S0+z*(S2+z*S4) */
+ mulsd %xmm1, %xmm2 /* y*(S0+z*(S2+z*S4)) */
+ /* t*s, where s = sign(x) * (-1.0)^((n>>2)&1) */
+ mulsd MO2(DP_ONES,%ecx,8), %xmm4
+ addsd %xmm2, %xmm3 /* y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ /* t*s*y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ mulsd %xmm4, %xmm3
+ /* t*s*(1.0+y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ addsd %xmm4, %xmm3
+ movsd %xmm3, 0(%esp) /* Move result from sse... */
+ fldl 0(%esp) /* ...to FPU. */
+ /* Return back 4 bytes of stack frame */
+ lea 8(%esp), %esp
+ RETURN
+
+ .p2align 4
+L(large_args):
+ /* Here if |x|>=9*Pi/4 */
+ cmpl $0x7f800000, %eax /* x is Inf or NaN? */
+ jae L(arg_inf_or_nan)
+
+ /* Here if finite |x|>=9*Pi/4 */
+ cmpl $0x4b000000, %eax /* |x|<2^23? */
+ jae L(very_large_args)
+
+ /* Here if 9*Pi/4<=|x|<2^23 */
+ movsd MO1(DP_INVPIO4), %xmm1 /* 1/(Pi/4) */
+ mulsd %xmm0, %xmm1 /* |x|/(Pi/4) */
+ cvttsd2si %xmm1, %eax /* k=trunc(|x|/(Pi/4)) */
+ addl $1, %eax /* k+1 */
+ movl %eax, %edx
+ andl $0xfffffffe, %edx /* j=(k+1)&0xfffffffe */
+ cvtsi2sdl %edx, %xmm4 /* DP j */
+ movl ARG_X, %ecx /* Load x */
+ movsd MO1(DP_PIO4HI), %xmm2 /* -PIO4HI = high part of -Pi/4 */
+ shrl $31, %ecx /* sign bit of x */
+ mulsd %xmm4, %xmm2 /* -j*PIO4HI */
+ movsd MO1(DP_PIO4LO), %xmm3 /* -PIO4LO = low part of -Pi/4 */
+ addsd %xmm2, %xmm0 /* |x| - j*PIO4HI */
+ mulsd %xmm3, %xmm4 /* j*PIO4LO */
+ addsd %xmm4, %xmm0 /* t = |x| - j*PIO4HI - j*PIO4LO */
+ jmp L(reconstruction)
+
+ .p2align 4
+L(very_large_args):
+ /* Here if finite |x|>=2^23 */
+
+ /* bitpos = (ix>>23) - BIAS_32 + 59; */
+ shrl $23, %eax /* eb = biased exponent of x */
+ /* bitpos = eb - 0x7f + 59, where 0x7f is exponent bias */
+ subl $68, %eax
+ movl $28, %ecx /* %cl=28 */
+ movl %eax, %edx /* bitpos copy */
+
+ /* j = bitpos/28; */
+ div %cl /* j in register %al=%ax/%cl */
+ movapd %xmm0, %xmm3 /* |x| */
+ /* clear unneeded remainder from %ah */
+ andl $0xff, %eax
+
+ imull $28, %eax, %ecx /* j*28 */
+ movsd MO1(DP_HI_MASK), %xmm4 /* DP_HI_MASK */
+ movapd %xmm0, %xmm5 /* |x| */
+ mulsd -2*8+MO2(_FPI,%eax,8), %xmm3 /* tmp3 = FPI[j-2]*|x| */
+ movapd %xmm0, %xmm1 /* |x| */
+ mulsd -1*8+MO2(_FPI,%eax,8), %xmm5 /* tmp2 = FPI[j-1]*|x| */
+ mulsd 0*8+MO2(_FPI,%eax,8), %xmm0 /* tmp0 = FPI[j]*|x| */
+ addl $19, %ecx /* j*28+19 */
+ mulsd 1*8+MO2(_FPI,%eax,8), %xmm1 /* tmp1 = FPI[j+1]*|x| */
+ cmpl %ecx, %edx /* bitpos>=j*28+19? */
+ jl L(very_large_skip1)
+
+ /* Here if bitpos>=j*28+19 */
+ andpd %xmm3, %xmm4 /* HI(tmp3) */
+ subsd %xmm4, %xmm3 /* tmp3 = tmp3 - HI(tmp3) */
+L(very_large_skip1):
+
+ movsd MO1(DP_2POW52), %xmm6
+ movapd %xmm5, %xmm2 /* tmp2 copy */
+ addsd %xmm3, %xmm5 /* tmp5 = tmp3 + tmp2 */
+ movl $1, %edx
+ addsd %xmm5, %xmm6 /* tmp6 = tmp5 + 2^52 */
+ movsd 8+MO1(DP_2POW52), %xmm4
+ movd %xmm6, %eax /* k = I64_LO(tmp6); */
+ addsd %xmm6, %xmm4 /* tmp4 = tmp6 - 2^52 */
+ movl ARG_X, %ecx /* Load x */
+ comisd %xmm5, %xmm4 /* tmp4 > tmp5? */
+ jbe L(very_large_skip2)
+
+ /* Here if tmp4 > tmp5 */
+ subl $1, %eax /* k-- */
+ addsd 8+MO1(DP_ONES), %xmm4 /* tmp4 -= 1.0 */
+L(very_large_skip2):
+
+ andl %eax, %edx /* k&1 */
+ subsd %xmm4, %xmm3 /* tmp3 -= tmp4 */
+ addsd MO2(DP_ZERONE,%edx,8), %xmm3 /* t = DP_ZERONE[k&1] + tmp3 */
+ addsd %xmm2, %xmm3 /* t += tmp2 */
+ shrl $31, %ecx /* sign of x */
+ addsd %xmm3, %xmm0 /* t += tmp0 */
+ addl $1, %eax /* n=k+1 */
+ addsd %xmm1, %xmm0 /* t += tmp1 */
+ mulsd MO1(DP_PIO4), %xmm0 /* t *= PI04 */
+
+ jmp L(reconstruction) /* end of very_large_args peth */
+
+ .p2align 4
+L(arg_less_pio4):
+ /* Here if |x|<Pi/4 */
+ cmpl $0x3d000000, %eax /* |x|<2^-5? */
+ jl L(arg_less_2pn5)
+
+ /* Here if 2^-5<=|x|<Pi/4 */
+ movaps %xmm0, %xmm3 /* x */
+ mulsd %xmm0, %xmm0 /* y=x^2 */
+ movaps %xmm0, %xmm1 /* y */
+ mulsd %xmm0, %xmm0 /* z=x^4 */
+ movsd MO1(DP_S4), %xmm4 /* S4 */
+ mulsd %xmm0, %xmm4 /* z*S4 */
+ movsd MO1(DP_S3), %xmm5 /* S3 */
+ mulsd %xmm0, %xmm5 /* z*S3 */
+ addsd MO1(DP_S2), %xmm4 /* S2+z*S4 */
+ mulsd %xmm0, %xmm4 /* z*(S2+z*S4) */
+ addsd MO1(DP_S1), %xmm5 /* S1+z*S3 */
+ mulsd %xmm0, %xmm5 /* z*(S1+z*S3) */
+ addsd MO1(DP_S0), %xmm4 /* S0+z*(S2+z*S4) */
+ mulsd %xmm1, %xmm4 /* y*(S0+z*(S2+z*S4)) */
+ mulsd %xmm3, %xmm5 /* x*z*(S1+z*S3) */
+ mulsd %xmm3, %xmm4 /* x*y*(S0+z*(S2+z*S4)) */
+ /* x*y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ addsd %xmm5, %xmm4
+ /* x + x*y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ addsd %xmm4, %xmm3
+ cvtsd2ss %xmm3, %xmm3 /* SP result */
+
+L(epilogue):
+ lea -4(%esp), %esp /* Borrow 4 bytes of stack frame */
+ movss %xmm3, 0(%esp) /* Move result from sse... */
+ flds 0(%esp) /* ...to FPU. */
+ /* Return back 4 bytes of stack frame */
+ lea 4(%esp), %esp
+ RETURN
+
+ .p2align 4
+L(arg_less_2pn5):
+ /* Here if |x|<2^-5 */
+ cmpl $0x32000000, %eax /* |x|<2^-27? */
+ jl L(arg_less_2pn27)
+
+ /* Here if 2^-27<=|x|<2^-5 */
+ movaps %xmm0, %xmm1 /* DP x */
+ mulsd %xmm0, %xmm0 /* DP x^2 */
+ movsd MO1(DP_SIN2_1), %xmm3 /* DP DP_SIN2_1 */
+ mulsd %xmm0, %xmm3 /* DP x^2*DP_SIN2_1 */
+ addsd MO1(DP_SIN2_0), %xmm3 /* DP DP_SIN2_0+x^2*DP_SIN2_1 */
+ mulsd %xmm0, %xmm3 /* DP x^2*DP_SIN2_0+x^4*DP_SIN2_1 */
+ mulsd %xmm1, %xmm3 /* DP x^3*DP_SIN2_0+x^5*DP_SIN2_1 */
+ addsd %xmm1, %xmm3 /* DP x+x^3*DP_SIN2_0+x^5*DP_SIN2_1 */
+ cvtsd2ss %xmm3, %xmm3 /* SP result */
+ jmp L(epilogue)
+
+ .p2align 4
+L(arg_less_2pn27):
+ movss ARG_X, %xmm3 /* SP x */
+ cmpl $0, %eax /* x=0? */
+ je L(epilogue) /* in case x=0 return sin(+-0)==+-0 */
+ /* Here if |x|<2^-27 */
+ /*
+ * Special cases here:
+ * sin(subnormal) raises inexact/underflow
+ * sin(min_normalized) raises inexact/underflow
+ * sin(normalized) raises inexact
+ */
+ movaps %xmm0, %xmm3 /* Copy of DP x */
+ mulsd MO1(DP_SMALL), %xmm0 /* x*DP_SMALL */
+ subsd %xmm0, %xmm3 /* Result is x-x*DP_SMALL */
+ cvtsd2ss %xmm3, %xmm3 /* Result converted to SP */
+ jmp L(epilogue)
+
+ .p2align 4
+L(arg_inf_or_nan):
+ /* Here if |x| is Inf or NAN */
+ jne L(skip_errno_setting) /* in case of x is NaN */
+
+ /* Here if x is Inf. Set errno to EDOM. */
+ call JUMPTARGET(__errno_location)
+ movl $EDOM, (%eax)
+
+ .p2align 4
+L(skip_errno_setting):
+ /* Here if |x| is Inf or NAN. Continued. */
+ movss ARG_X, %xmm3 /* load x */
+ subss %xmm3, %xmm3 /* Result is NaN */
+ jmp L(epilogue)
+END(__sinf_sse2)
+
+ .section .rodata, "a"
+ .p2align 3
+L(PIO4J): /* Table of j*Pi/4, for j=0,1,..,10 */
+ .long 0x00000000,0x00000000
+ .long 0x54442d18,0x3fe921fb
+ .long 0x54442d18,0x3ff921fb
+ .long 0x7f3321d2,0x4002d97c
+ .long 0x54442d18,0x400921fb
+ .long 0x2955385e,0x400f6a7a
+ .long 0x7f3321d2,0x4012d97c
+ .long 0xe9bba775,0x4015fdbb
+ .long 0x54442d18,0x401921fb
+ .long 0xbeccb2bb,0x401c463a
+ .long 0x2955385e,0x401f6a7a
+ .type L(PIO4J), @object
+ ASM_SIZE_DIRECTIVE(L(PIO4J))
+
+ .p2align 3
+L(_FPI): /* 4/Pi broken into sum of positive DP values */
+ .long 0x00000000,0x00000000
+ .long 0x6c000000,0x3ff45f30
+ .long 0x2a000000,0x3e3c9c88
+ .long 0xa8000000,0x3c54fe13
+ .long 0xd0000000,0x3aaf47d4
+ .long 0x6c000000,0x38fbb81b
+ .long 0xe0000000,0x3714acc9
+ .long 0x7c000000,0x3560e410
+ .long 0x56000000,0x33bca2c7
+ .long 0xac000000,0x31fbd778
+ .long 0xe0000000,0x300b7246
+ .long 0xe8000000,0x2e5d2126
+ .long 0x48000000,0x2c970032
+ .long 0xe8000000,0x2ad77504
+ .long 0xe0000000,0x290921cf
+ .long 0xb0000000,0x274deb1c
+ .long 0xe0000000,0x25829a73
+ .long 0xbe000000,0x23fd1046
+ .long 0x10000000,0x2224baed
+ .long 0x8e000000,0x20709d33
+ .long 0x80000000,0x1e535a2f
+ .long 0x64000000,0x1cef904e
+ .long 0x30000000,0x1b0d6398
+ .long 0x24000000,0x1964ce7d
+ .long 0x16000000,0x17b908bf
+ .type L(_FPI), @object
+ ASM_SIZE_DIRECTIVE(L(_FPI))
+
+/* Coefficients of polynomial
+ for sin(x)~=x+x^3*DP_SIN2_0+x^5*DP_SIN2_1, |x|<2^-5. */
+ .p2align 3
+L(DP_SIN2_0):
+ .long 0x5543d49d,0xbfc55555
+ .type L(DP_SIN2_0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_SIN2_0))
+
+ .p2align 3
+L(DP_SIN2_1):
+ .long 0x75cec8c5,0x3f8110f4
+ .type L(DP_SIN2_1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_SIN2_1))
+
+ .p2align 3
+L(DP_ZERONE):
+ .long 0x00000000,0x00000000 /* 0.0 */
+ .long 0x00000000,0xbff00000 /* 1.0 */
+ .type L(DP_ZERONE), @object
+ ASM_SIZE_DIRECTIVE(L(DP_ZERONE))
+
+ .p2align 3
+L(DP_ONES):
+ .long 0x00000000,0x3ff00000 /* +1.0 */
+ .long 0x00000000,0xbff00000 /* -1.0 */
+ .type L(DP_ONES), @object
+ ASM_SIZE_DIRECTIVE(L(DP_ONES))
+
+/* Coefficients of polynomial
+ for sin(t)~=t+t^3*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4)))), |t|<Pi/4. */
+ .p2align 3
+L(DP_S3):
+ .long 0x64e6b5b4,0x3ec71d72
+ .type L(DP_S3), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S3))
+
+ .p2align 3
+L(DP_S1):
+ .long 0x10c2688b,0x3f811111
+ .type L(DP_S1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S1))
+
+ .p2align 3
+L(DP_S4):
+ .long 0x1674b58a,0xbe5a947e
+ .type L(DP_S4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S4))
+
+ .p2align 3
+L(DP_S2):
+ .long 0x8b4bd1f9,0xbf2a019f
+ .type L(DP_S2), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S2))
+
+ .p2align 3
+L(DP_S0):
+ .long 0x55551cd9,0xbfc55555
+ .type L(DP_S0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S0))
+
+ .p2align 3
+L(DP_SMALL):
+ .long 0x00000000,0x3cd00000 /* 2^(-50) */
+ .type L(DP_SMALL), @object
+ ASM_SIZE_DIRECTIVE(L(DP_SMALL))
+
+/* Coefficients of polynomial
+ for cos(t)~=1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4)))), |t|<Pi/4. */
+ .p2align 3
+L(DP_C3):
+ .long 0x9ac43cc0,0x3efa00eb
+ .type L(DP_C3), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C3))
+
+ .p2align 3
+L(DP_C1):
+ .long 0x545c50c7,0x3fa55555
+ .type L(DP_C1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C1))
+
+ .p2align 3
+L(DP_C4):
+ .long 0xdd8844d7,0xbe923c97
+ .type L(DP_C4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C4))
+
+ .p2align 3
+L(DP_C2):
+ .long 0x348b6874,0xbf56c16b
+ .type L(DP_C2), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C2))
+
+ .p2align 3
+L(DP_C0):
+ .long 0xfffe98ae,0xbfdfffff
+ .type L(DP_C0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C0))
+
+ .p2align 3
+L(DP_PIO4):
+ .long 0x54442d18,0x3fe921fb /* Pi/4 */
+ .type L(DP_PIO4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4))
+
+ .p2align 3
+L(DP_2POW52):
+ .long 0x00000000,0x43300000 /* +2^52 */
+ .long 0x00000000,0xc3300000 /* -2^52 */
+ .type L(DP_2POW52), @object
+ ASM_SIZE_DIRECTIVE(L(DP_2POW52))
+
+ .p2align 3
+L(DP_INVPIO4):
+ .long 0x6dc9c883,0x3ff45f30 /* 4/Pi */
+ .type L(DP_INVPIO4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_INVPIO4))
+
+ .p2align 3
+L(DP_PIO4HI):
+ .long 0x54000000,0xbfe921fb /* High part of Pi/4 */
+ .type L(DP_PIO4HI), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4HI))
+
+ .p2align 3
+L(DP_PIO4LO):
+ .long 0x11A62633,0xbe010b46 /* Low part of Pi/4 */
+ .type L(DP_PIO4LO), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4LO))
+
+ .p2align 2
+L(SP_INVPIO4):
+ .long 0x3fa2f983 /* 4/Pi */
+ .type L(SP_INVPIO4), @object
+ ASM_SIZE_DIRECTIVE(L(SP_INVPIO4))
+
+ .p2align 4
+L(DP_ABS_MASK): /* Mask for getting DP absolute value */
+ .long 0xffffffff,0x7fffffff
+ .long 0xffffffff,0x7fffffff
+ .type L(DP_ABS_MASK), @object
+ ASM_SIZE_DIRECTIVE(L(DP_ABS_MASK))
+
+ .p2align 3
+L(DP_HI_MASK): /* Mask for getting high 21 bits of DP value */
+ .long 0x00000000,0xffffffff
+ .type L(DP_HI_MASK), @object
+ ASM_SIZE_DIRECTIVE(L(DP_HI_MASK))
+
+weak_alias (__sinf, sinf)
diff --git a/libc/sysdeps/i386/i686/fpu/multiarch/s_sinf.c b/libc/sysdeps/i386/i686/fpu/multiarch/s_sinf.c
new file mode 100644
index 000000000..80b2fd687
--- /dev/null
+++ b/libc/sysdeps/i386/i686/fpu/multiarch/s_sinf.c
@@ -0,0 +1,28 @@
+/* Multiple versions of sinf
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <init-arch.h>
+
+extern float __sinf_sse2 (float);
+extern float __sinf_ia32 (float);
+float __sinf (float);
+
+libm_ifunc (__sinf, HAS_SSE2 ? __sinf_sse2 : __sinf_ia32);
+weak_alias (__sinf, sinf);
+#define SINF __sinf_ia32
+#include <sysdeps/ieee754/flt-32/s_sinf.c>
diff --git a/libc/sysdeps/ieee754/flt-32/s_cosf.c b/libc/sysdeps/ieee754/flt-32/s_cosf.c
index f4bd81904..864ab27a4 100644
--- a/libc/sysdeps/ieee754/flt-32/s_cosf.c
+++ b/libc/sysdeps/ieee754/flt-32/s_cosf.c
@@ -23,7 +23,13 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
static const float one=1.0;
-float __cosf(float x)
+#ifndef COSF
+# define COSF_FUNC __cosf
+#else
+# define COSF_FUNC COSF
+#endif
+
+float COSF_FUNC(float x)
{
float y[2],z=0.0;
int32_t n,ix;
@@ -53,4 +59,7 @@ float __cosf(float x)
}
}
}
+
+#ifndef COSF
weak_alias (__cosf, cosf)
+#endif
diff --git a/libc/sysdeps/ieee754/flt-32/s_sinf.c b/libc/sysdeps/ieee754/flt-32/s_sinf.c
index 02fa29f23..916e34557 100644
--- a/libc/sysdeps/ieee754/flt-32/s_sinf.c
+++ b/libc/sysdeps/ieee754/flt-32/s_sinf.c
@@ -21,7 +21,13 @@ static char rcsid[] = "$NetBSD: s_sinf.c,v 1.4 1995/05/10 20:48:16 jtc Exp $";
#include <math.h>
#include <math_private.h>
-float __sinf(float x)
+#ifndef SINF
+# define SINF_FUNC __sinf
+#else
+# define SINF_FUNC SINF
+#endif
+
+float SINF_FUNC(float x)
{
float y[2],z=0.0;
int32_t n, ix;
@@ -51,4 +57,7 @@ float __sinf(float x)
}
}
}
+
+#ifndef SINF
weak_alias (__sinf, sinf)
+#endif
diff --git a/libc/sysdeps/mach/bits/libc-lock.h b/libc/sysdeps/mach/bits/libc-lock.h
index 110e25e96..94877e0ea 100644
--- a/libc/sysdeps/mach/bits/libc-lock.h
+++ b/libc/sysdeps/mach/bits/libc-lock.h
@@ -137,7 +137,6 @@ void *__libc_getspecific (__libc_key_t key);
#define __libc_lock_lock_recursive __libc_lock_lock
#define __rtld_lock_define_initialized_recursive __libc_lock_define_initialized
-#define __rtld_lock_init_recursive __libc_lock_init
#define __rtld_lock_fini_recursive __libc_lock_fini
#define __rtld_lock_trylock_recursive __libc_lock_trylock
#define __rtld_lock_unlock_recursive __libc_lock_unlock
diff --git a/libc/sysdeps/mach/hurd/_G_config.h b/libc/sysdeps/mach/hurd/_G_config.h
index 9ecd4aad3..b3a7db72a 100644
--- a/libc/sysdeps/mach/hurd/_G_config.h
+++ b/libc/sysdeps/mach/hurd/_G_config.h
@@ -18,7 +18,6 @@
# define __need_wint_t
#endif
#include <wchar.h>
-#define _G_size_t size_t
typedef struct
{
__off_t __pos;
@@ -29,13 +28,7 @@ typedef struct
__off64_t __pos;
__mbstate_t __state;
} _G_fpos64_t;
-#define _G_ssize_t __ssize_t
-#define _G_off_t __off_t
#define _G_off64_t __off64_t
-#define _G_pid_t __pid_t
-#define _G_uid_t __uid_t
-#define _G_wchar_t wchar_t
-#define _G_wint_t wint_t
#define _G_stat64 stat64
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# include <gconv.h>
@@ -50,25 +43,11 @@ typedef union
} _G_iconv_t;
#endif
-typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
-typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
-typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
-typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
-
-#define _G_HAVE_BOOL 1
-
/* These library features are always available in the GNU C library. */
-#define _G_HAVE_ATEXIT 1
-#define _G_HAVE_SYS_WAIT 1
-#define _G_NEED_STDARG_H 1
#define _G_va_list __gnuc_va_list
-#define _G_HAVE_PRINTF_FP 1
#define _G_HAVE_MMAP 1
-#define _G_HAVE_LONG_DOUBLE_IO 1
-#define _G_HAVE_IO_FILE_OPEN 1
-#define _G_HAVE_IO_GETLINE_INFO 1
#define _G_IO_IO_FILE_VERSION 0x20001
@@ -82,11 +61,4 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
#define _G_BUFSIZ 8192
-/* These are the vtbl details for ELF. */
-#define _G_NAMES_HAVE_UNDERSCORE 0
-#define _G_VTABLE_LABEL_HAS_LENGTH 1
-#define _G_USING_THUNKS 1
-#define _G_VTABLE_LABEL_PREFIX "__vt_"
-#define _G_VTABLE_LABEL_PREFIX_ID __vt_
-
#endif /* _G_config.h */
diff --git a/libc/sysdeps/mach/hurd/bits/libc-lock.h b/libc/sysdeps/mach/hurd/bits/libc-lock.h
index d18a10c45..e8cb71bfd 100644
--- a/libc/sysdeps/mach/hurd/bits/libc-lock.h
+++ b/libc/sysdeps/mach/hurd/bits/libc-lock.h
@@ -119,8 +119,6 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
})
-#define __rtld_lock_init_recursive(NAME) \
- __libc_lock_init_recursive (NAME)
#define __rtld_lock_initialize(NAME) \
(void) ((NAME) = (__rtld_lock_recursive_t) _RTLD_LOCK_RECURSIVE_INITIALIZER)
#define __rtld_lock_trylock_recursive(NAME) \
diff --git a/libc/sysdeps/s390/fpu/get-rounding-mode.h b/libc/sysdeps/s390/fpu/get-rounding-mode.h
new file mode 100644
index 000000000..3e427eca2
--- /dev/null
+++ b/libc/sysdeps/s390/fpu/get-rounding-mode.h
@@ -0,0 +1,37 @@
+/* Determine floating-point rounding mode within libc. S/390 version.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _S390_GET_ROUNDING_MODE_H
+#define _S390_GET_ROUNDING_MODE_H 1
+
+#include <fenv.h>
+#include <fenv_libc.h>
+#include <fpu_control.h>
+
+/* Return the floating-point rounding mode. */
+
+static inline int
+get_rounding_mode (void)
+{
+ fpu_control_t fc;
+
+ _FPU_GETCW (fc);
+ return fc & FPC_RM_MASK;
+}
+
+#endif /* get-rounding-mode.h */
diff --git a/libc/sysdeps/s390/s390-32/multiarch/Makefile b/libc/sysdeps/s390/s390-32/multiarch/Makefile
index 5b0cd49c7..9baeecda6 100644
--- a/libc/sysdeps/s390/s390-32/multiarch/Makefile
+++ b/libc/sysdeps/s390/s390-32/multiarch/Makefile
@@ -1,9 +1,3 @@
-ASFLAGS-.o += -Wa,-mzarch
-ASFLAGS-.os += -Wa,-mzarch
-ASFLAGS-.op += -Wa,-mzarch
-ASFLAGS-.og += -Wa,-mzarch
-ASFLAGS-.ob += -Wa,-mzarch
-ASFLAGS-.oS += -Wa,-mzarch
ifeq ($(subdir),string)
sysdep_routines += ifunc-resolve memset memcpy memcmp
endif
diff --git a/libc/sysdeps/s390/s390-32/multiarch/ifunc-resolve.c b/libc/sysdeps/s390/s390-32/multiarch/ifunc-resolve.c
index fd6e36706..f1bf8a3dc 100644
--- a/libc/sysdeps/s390/s390-32/multiarch/ifunc-resolve.c
+++ b/libc/sysdeps/s390/s390-32/multiarch/ifunc-resolve.c
@@ -32,14 +32,17 @@
".globl __GI_" #FUNC "\n\t" \
".set __GI_" #FUNC "," #FUNC "\n"); \
\
- extern void *FUNC##_z10; \
- extern void *FUNC##_z196; \
- extern void *FUNC##_g5; \
+ /* Make the declarations of the optimized functions hidden in order
+ to prevent GOT slots being generated for them. */ \
+ extern __attribute__((visibility("hidden"))) void *FUNC##_z196; \
+ extern __attribute__((visibility("hidden"))) void *FUNC##_z10; \
+ extern __attribute__((visibility("hidden"))) void *FUNC##_g5; \
\
void *resolve_##FUNC (unsigned long int dl_hwcap) \
{ \
if ((dl_hwcap & HWCAP_S390_STFLE) \
- && (dl_hwcap & HWCAP_S390_HIGH_GPRS)) /* Implies zarch */ \
+ && (dl_hwcap & HWCAP_S390_ZARCH) \
+ && (dl_hwcap & HWCAP_S390_HIGH_GPRS)) \
{ \
/* We want just 1 double word to be returned. */ \
register unsigned long reg0 asm("0") = 0; \
diff --git a/libc/sysdeps/s390/s390-32/multiarch/memcmp.S b/libc/sysdeps/s390/s390-32/multiarch/memcmp.S
index cd8ea86b0..9ca88911c 100644
--- a/libc/sysdeps/s390/s390-32/multiarch/memcmp.S
+++ b/libc/sysdeps/s390/s390-32/multiarch/memcmp.S
@@ -31,6 +31,7 @@
ENTRY(memcmp_z196)
.machine "z196"
+ .machinemode "zarch_nohighgprs"
ltr %r4,%r4
je .L_Z196_4
ahi %r4,-1
@@ -64,6 +65,7 @@ END(memcmp_z196)
ENTRY(memcmp_z10)
.machine "z10"
+ .machinemode "zarch_nohighgprs"
ltr %r4,%r4
je .L_Z10_4
ahi %r4,-1
diff --git a/libc/sysdeps/s390/s390-32/multiarch/memcpy.S b/libc/sysdeps/s390/s390-32/multiarch/memcpy.S
index 40f4acfbb..7b85602aa 100644
--- a/libc/sysdeps/s390/s390-32/multiarch/memcpy.S
+++ b/libc/sysdeps/s390/s390-32/multiarch/memcpy.S
@@ -31,6 +31,7 @@
ENTRY(memcpy_z196)
.machine "z196"
+ .machinemode "zarch_nohighgprs"
llgfr %r4,%r4
ltgr %r4,%r4
je .L_Z196_4
@@ -61,6 +62,7 @@ END(memcpy_z196)
ENTRY(memcpy_z10)
.machine "z10"
+ .machinemode "zarch_nohighgprs"
llgfr %r4,%r4
cgije %r4,0,.L_Z10_4
aghi %r4,-1
diff --git a/libc/sysdeps/s390/s390-32/multiarch/memset.S b/libc/sysdeps/s390/s390-32/multiarch/memset.S
index 5ce7b4de8..ba43d671c 100644
--- a/libc/sysdeps/s390/s390-32/multiarch/memset.S
+++ b/libc/sysdeps/s390/s390-32/multiarch/memset.S
@@ -31,6 +31,7 @@
ENTRY(memset_z196)
.machine "z196"
+ .machinemode "zarch_nohighgprs"
llgfr %r4,%r4
ltgr %r4,%r4
je .L_Z196_4
@@ -62,6 +63,7 @@ END(memset_z196)
ENTRY(memset_z10)
.machine "z10"
+ .machinemode "zarch_nohighgprs"
llgfr %r4,%r4
cgije %r4,0,.L_Z10_4
stc %r3,0(%r2)
diff --git a/libc/sysdeps/s390/s390-64/multiarch/ifunc-resolve.c b/libc/sysdeps/s390/s390-64/multiarch/ifunc-resolve.c
index f980bc939..5f5676490 100644
--- a/libc/sysdeps/s390/s390-64/multiarch/ifunc-resolve.c
+++ b/libc/sysdeps/s390/s390-64/multiarch/ifunc-resolve.c
@@ -32,9 +32,11 @@
".globl __GI_" #FUNC "\n\t" \
".set __GI_" #FUNC "," #FUNC "\n"); \
\
- extern void *FUNC##_z10; \
- extern void *FUNC##_z196; \
- extern void *FUNC##_z900; \
+ /* Make the declarations of the optimized functions hidden in order
+ to prevent GOT slots being generated for them. */ \
+ extern __attribute__((visibility("hidden"))) void *FUNC##_z196; \
+ extern __attribute__((visibility("hidden"))) void *FUNC##_z10; \
+ extern __attribute__((visibility("hidden"))) void *FUNC##_z900; \
\
void *resolve_##FUNC (unsigned long int dl_hwcap) \
{ \
diff --git a/libc/sysdeps/sparc/bits/hwcap.h b/libc/sysdeps/sparc/bits/hwcap.h
index d922d7b0e..74ca130bb 100644
--- a/libc/sysdeps/sparc/bits/hwcap.h
+++ b/libc/sysdeps/sparc/bits/hwcap.h
@@ -45,3 +45,6 @@
#define HWCAP_SPARC_IMA 0x00400000
#define HWCAP_SPARC_ASI_CACHE_SPARING \
0x00800000
+#define HWCAP_SPARC_PAUSE 0x01000000
+#define HWCAP_SPARC_CBCOND 0x02000000
+#define HWCAP_SPARC_CRYPTO 0x04000000
diff --git a/libc/sysdeps/sparc/dl-procinfo.c b/libc/sysdeps/sparc/dl-procinfo.c
index 6e107dd1d..8280e0179 100644
--- a/libc/sysdeps/sparc/dl-procinfo.c
+++ b/libc/sysdeps/sparc/dl-procinfo.c
@@ -46,13 +46,13 @@
#if !defined PROCINFO_DECL && defined SHARED
._dl_sparc_cap_flags
#else
-PROCINFO_CLASS const char _dl_sparc_cap_flags[24][11]
+PROCINFO_CLASS const char _dl_sparc_cap_flags[27][11]
#endif
#ifndef PROCINFO_DECL
= { "flush", "stbar", "swap", "muldiv", "v9", "ultra3", "v9v", "v9v2",
"mul32", "div32", "fsmuld", "v8plus", "popc", "vis", "vis2",
"ASIBlkInit", "fmaf", "vis3", "hpc", "random", "trans", "fjfmau",
- "ima", "cspare" }
+ "ima", "cspare", "pause", "cbcond", "crypto" }
#endif
#if !defined SHARED || defined PROCINFO_DECL
;
diff --git a/libc/sysdeps/sparc/dl-procinfo.h b/libc/sysdeps/sparc/dl-procinfo.h
index 8ceb83072..6ae876828 100644
--- a/libc/sysdeps/sparc/dl-procinfo.h
+++ b/libc/sysdeps/sparc/dl-procinfo.h
@@ -24,7 +24,7 @@
#include <ldsodefs.h>
#include <sysdep.h>
-#define _DL_HWCAP_COUNT 24
+#define _DL_HWCAP_COUNT 27
static inline int
__attribute__ ((unused))
diff --git a/libc/sysdeps/sparc/fpu/libm-test-ulps b/libc/sysdeps/sparc/fpu/libm-test-ulps
index 74af9d571..b7dc3b483 100644
--- a/libc/sysdeps/sparc/fpu/libm-test-ulps
+++ b/libc/sysdeps/sparc/fpu/libm-test-ulps
@@ -1187,6 +1187,12 @@ idouble: 1
ifloat: 1
# cos
+Test "cos (0x1p+120) == -9.25879022854837867303861764107414946730833e-01":
+float: 1
+ifloat: 1
+Test "cos (0x1p+127) == 7.81914638714960072263910298466369236613162e-01":
+float: 1
+ifloat: 1
Test "cos (M_PI_6l * 2.0) == 0.5":
double: 1
idouble: 1
@@ -2490,6 +2496,12 @@ float: 1
ifloat: 1
# sincos
+Test "sincos (0x1p+120, &sin_res, &cos_res) puts -9.25879022854837867303861764107414946730833e-01 in cos_res":
+float: 1
+ifloat: 1
+Test "sincos (0x1p+127, &sin_res, &cos_res) puts 7.81914638714960072263910298466369236613162e-01 in cos_res":
+float: 1
+ifloat: 1
Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
double: 1
idouble: 1
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/addmul_1.S b/libc/sysdeps/sparc/sparc32/sparcv9/addmul_1.S
new file mode 100644
index 000000000..563bfb1c0
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/addmul_1.S
@@ -0,0 +1 @@
+#include <sparcv8/addmul_1.S>
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/mul_1.S b/libc/sysdeps/sparc/sparc32/sparcv9/mul_1.S
new file mode 100644
index 000000000..42284eada
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/mul_1.S
@@ -0,0 +1 @@
+#include <sparcv8/mul_1.S>
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/submul_1.S b/libc/sysdeps/sparc/sparc32/sparcv9/submul_1.S
new file mode 100644
index 000000000..de69533f6
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/submul_1.S
@@ -0,0 +1 @@
+#include <sparcv8/submul_1.S>
diff --git a/libc/sysdeps/unix/sysv/linux/clock_getcpuclockid.c b/libc/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
index 1cfdf3489..8700354a9 100644
--- a/libc/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
+++ b/libc/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
@@ -29,60 +29,24 @@
int
clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
{
-#ifdef __NR_clock_getres
/* The clockid_t value is a simple computation from the PID.
But we do a clock_getres call to validate it. */
const clockid_t pidclock = MAKE_PROCESS_CPUCLOCK (pid, CPUCLOCK_SCHED);
-# if !(__ASSUME_POSIX_CPU_TIMERS > 0)
- extern int __libc_missing_posix_cpu_timers attribute_hidden;
- if (!__libc_missing_posix_cpu_timers)
-# endif
+ INTERNAL_SYSCALL_DECL (err);
+ int r = INTERNAL_SYSCALL (clock_getres, err, 2, pidclock, NULL);
+ if (!INTERNAL_SYSCALL_ERROR_P (r, err))
{
- INTERNAL_SYSCALL_DECL (err);
- int r = INTERNAL_SYSCALL (clock_getres, err, 2, pidclock, NULL);
- if (!INTERNAL_SYSCALL_ERROR_P (r, err))
- {
- *clock_id = pidclock;
- return 0;
- }
-
- if (INTERNAL_SYSCALL_ERRNO (r, err) == EINVAL)
- {
-# if !(__ASSUME_POSIX_CPU_TIMERS > 0)
- if (pidclock == MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED)
- || INTERNAL_SYSCALL_ERROR_P (INTERNAL_SYSCALL
- (clock_getres, err, 2,
- MAKE_PROCESS_CPUCLOCK
- (0, CPUCLOCK_SCHED), NULL),
- err))
- /* The kernel doesn't support these clocks at all. */
- __libc_missing_posix_cpu_timers = 1;
- else
-# endif
- /* The clock_getres system call checked the PID for us. */
- return ESRCH;
- }
- else
- return INTERNAL_SYSCALL_ERRNO (r, err);
+ *clock_id = pidclock;
+ return 0;
}
-#endif
-
- /* We don't allow any process ID but our own. */
- if (pid != 0 && pid != getpid ())
- return EPERM;
-#ifdef CLOCK_PROCESS_CPUTIME_ID
- if (HAS_CPUCLOCK)
+ if (INTERNAL_SYSCALL_ERRNO (r, err) == EINVAL)
{
- /* Store the number. */
- *clock_id = CLOCK_PROCESS_CPUTIME_ID;
-
- return 0;
+ /* The clock_getres system call checked the PID for us. */
+ return ESRCH;
}
-#endif
-
- /* We don't have a timer for that. */
- return ENOENT;
+ else
+ return INTERNAL_SYSCALL_ERRNO (r, err);
}
diff --git a/libc/sysdeps/unix/sysv/linux/clock_getres.c b/libc/sysdeps/unix/sysv/linux/clock_getres.c
index 2bada33b4..1e87dd9a8 100644
--- a/libc/sysdeps/unix/sysv/linux/clock_getres.c
+++ b/libc/sysdeps/unix/sysv/linux/clock_getres.c
@@ -46,89 +46,11 @@
case CLOCK_MONOTONIC_COARSE: \
SYSCALL_GETRES
-#ifdef __NR_clock_getres
/* We handled the REALTIME clock here. */
-# define HANDLED_REALTIME 1
-# define HANDLED_CPUTIME 1
+#define HANDLED_REALTIME 1
+#define HANDLED_CPUTIME 1
-# if __ASSUME_POSIX_CPU_TIMERS > 0
-
-# define SYSDEP_GETRES_CPU SYSCALL_GETRES
-# define SYSDEP_GETRES_CPUTIME /* Default catches them too. */
-
-# else
-
-extern int __libc_missing_posix_cpu_timers attribute_hidden;
-
-static int
-maybe_syscall_getres_cpu (clockid_t clock_id, struct timespec *res)
-{
- int e = EINVAL;
-
- if (!__libc_missing_posix_cpu_timers)
- {
- INTERNAL_SYSCALL_DECL (err);
- int r = INTERNAL_VSYSCALL (clock_getres, err, 2, clock_id, res);
- if (!INTERNAL_SYSCALL_ERROR_P (r, err))
- return 0;
-
- e = INTERNAL_SYSCALL_ERRNO (r, err);
- if (e == EINVAL)
- {
- /* Check whether the kernel supports CPU clocks at all.
- If not, record it for the future. */
- r = INTERNAL_VSYSCALL (clock_getres, err, 2,
- MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
- NULL);
- if (INTERNAL_SYSCALL_ERROR_P (r, err))
- __libc_missing_posix_cpu_timers = 1;
- }
- }
-
- return e;
-}
-
-# define SYSDEP_GETRES_CPU \
- retval = maybe_syscall_getres_cpu (clock_id, res); \
- if (retval == 0) \
- break; \
- if (retval != EINVAL || !__libc_missing_posix_cpu_timers) \
- { \
- __set_errno (retval); \
- retval = -1; \
- break; \
- } \
- retval = -1 /* Otherwise continue on to the HP_TIMING version. */;
-
-static inline int
-maybe_syscall_getres_cputime (clockid_t clock_id, struct timespec *res)
-{
- return maybe_syscall_getres_cpu
- (clock_id == CLOCK_THREAD_CPUTIME_ID
- ? MAKE_THREAD_CPUCLOCK (0, CPUCLOCK_SCHED)
- : MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
- res);
-}
-
-# define SYSDEP_GETRES_CPUTIME \
- case CLOCK_PROCESS_CPUTIME_ID: \
- case CLOCK_THREAD_CPUTIME_ID: \
- retval = maybe_syscall_getres_cputime (clock_id, res); \
- if (retval == 0) \
- break; \
- if (retval != EINVAL || !__libc_missing_posix_cpu_timers) \
- { \
- __set_errno (retval); \
- retval = -1; \
- break; \
- } \
- retval = hp_timing_getres (res); \
- break;
-# if !HP_TIMING_AVAIL
-# define hp_timing_getres(res) (__set_errno (EINVAL), -1)
-# endif
-
-# endif
-#endif
+#define SYSDEP_GETRES_CPU SYSCALL_GETRES
+#define SYSDEP_GETRES_CPUTIME /* Default catches them too. */
#include <sysdeps/posix/clock_getres.c>
diff --git a/libc/sysdeps/unix/sysv/linux/clock_gettime.c b/libc/sysdeps/unix/sysv/linux/clock_gettime.c
index e333d8d9e..05dfb9d09 100644
--- a/libc/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/libc/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -49,99 +49,13 @@
retval = SYSCALL_GETTIME (clock_id, tp); \
break
-#ifdef __NR_clock_gettime
/* We handled the REALTIME clock here. */
-# define HANDLED_REALTIME 1
-# define HANDLED_CPUTIME 1
+#define HANDLED_REALTIME 1
+#define HANDLED_CPUTIME 1
-# if __ASSUME_POSIX_CPU_TIMERS > 0
-
-# define SYSDEP_GETTIME_CPU(clock_id, tp) \
+#define SYSDEP_GETTIME_CPU(clock_id, tp) \
retval = SYSCALL_GETTIME (clock_id, tp); \
break
-# define SYSDEP_GETTIME_CPUTIME /* Default catches them too. */
-
-# else
-
-int __libc_missing_posix_cpu_timers attribute_hidden;
-
-static int
-maybe_syscall_gettime_cpu (clockid_t clock_id, struct timespec *tp)
-{
- int e = EINVAL;
-
- if (!__libc_missing_posix_cpu_timers)
- {
- INTERNAL_SYSCALL_DECL (err);
- int r = INTERNAL_GETTIME (clock_id, tp);
- if (!INTERNAL_SYSCALL_ERROR_P (r, err))
- return 0;
-
- e = INTERNAL_SYSCALL_ERRNO (r, err);
- if (e == EINVAL)
- {
-# ifdef HAVE_CLOCK_GETRES_VSYSCALL
- /* Check whether the kernel supports CPU clocks at all.
- If not, record it for the future. */
- r = INTERNAL_VSYSCALL (clock_getres, err, 2,
- MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
- NULL);
-# else
- /* Check whether the kernel supports CPU clocks at all.
- If not, record it for the future. */
- r = INTERNAL_SYSCALL (clock_getres, err, 2,
- MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
- NULL);
-# endif
- if (INTERNAL_SYSCALL_ERROR_P (r, err))
- __libc_missing_posix_cpu_timers = 1;
- }
- }
-
- return e;
-}
-
-# define SYSDEP_GETTIME_CPU(clock_id, tp) \
- retval = maybe_syscall_gettime_cpu (clock_id, tp); \
- if (retval == 0) \
- break; \
- if (retval != EINVAL || !__libc_missing_posix_cpu_timers) \
- { \
- __set_errno (retval); \
- retval = -1; \
- break; \
- } \
- retval = -1 /* Otherwise continue on to the HP_TIMING version. */;
-
-static inline int
-maybe_syscall_gettime_cputime (clockid_t clock_id, struct timespec *tp)
-{
- return maybe_syscall_gettime_cpu
- (clock_id == CLOCK_THREAD_CPUTIME_ID
- ? MAKE_THREAD_CPUCLOCK (0, CPUCLOCK_SCHED)
- : MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
- tp);
-}
-
-# define SYSDEP_GETTIME_CPUTIME \
- case CLOCK_PROCESS_CPUTIME_ID: \
- case CLOCK_THREAD_CPUTIME_ID: \
- retval = maybe_syscall_gettime_cputime (clock_id, tp); \
- if (retval == 0) \
- break; \
- if (retval != EINVAL || !__libc_missing_posix_cpu_timers) \
- { \
- __set_errno (retval); \
- retval = -1; \
- break; \
- } \
- retval = hp_timing_gettime (clock_id, tp); \
- break
-# if !HP_TIMING_AVAIL
-# define hp_timing_gettime(clock_id, tp) (__set_errno (EINVAL), -1)
-# endif
-
-# endif
-#endif
+#define SYSDEP_GETTIME_CPUTIME /* Default catches them too. */
#include <sysdeps/unix/clock_gettime.c>
diff --git a/libc/sysdeps/unix/sysv/linux/clock_settime.c b/libc/sysdeps/unix/sysv/linux/clock_settime.c
index f75ceca24..fde662177 100644
--- a/libc/sysdeps/unix/sysv/linux/clock_settime.c
+++ b/libc/sysdeps/unix/sysv/linux/clock_settime.c
@@ -31,38 +31,6 @@
# include <bits/libc-vdso.h>
#endif
-#if __ASSUME_POSIX_CPU_TIMERS <= 0 && defined __NR_clock_settime
-extern int __libc_missing_posix_cpu_timers attribute_hidden;
-
-static int
-maybe_syscall_settime_cpu (clockid_t clock_id, const struct timespec *tp)
-{
- int e = EINVAL;
-
- if (!__libc_missing_posix_cpu_timers)
- {
- INTERNAL_SYSCALL_DECL (err);
- int r = INTERNAL_SYSCALL (clock_settime, err, 2, clock_id, tp);
- if (!INTERNAL_SYSCALL_ERROR_P (r, err))
- return 0;
-
- e = INTERNAL_SYSCALL_ERRNO (r, err);
- if (e == EINVAL)
- {
- /* Check whether the kernel supports CPU clocks at all.
- If not, record it for the future. */
- r = INTERNAL_VSYSCALL (clock_getres, err, 2,
- MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
- NULL);
- if (INTERNAL_SYSCALL_ERROR_P (r, err))
- __libc_missing_posix_cpu_timers = 1;
- }
- }
-
- return e;
-}
-#endif
-
/* The REALTIME clock is definitely supported in the kernel. */
#define SYSDEP_SETTIME \
@@ -70,27 +38,11 @@ maybe_syscall_settime_cpu (clockid_t clock_id, const struct timespec *tp)
retval = INLINE_SYSCALL (clock_settime, 2, clock_id, tp); \
break
-#ifdef __NR_clock_settime
/* We handled the REALTIME clock here. */
-# define HANDLED_REALTIME 1
-#endif
+#define HANDLED_REALTIME 1
-#if __ASSUME_POSIX_CPU_TIMERS > 0
-# define HANDLED_CPUTIME 1
-# define SYSDEP_SETTIME_CPU \
+#define HANDLED_CPUTIME 1
+#define SYSDEP_SETTIME_CPU \
retval = INLINE_SYSCALL (clock_settime, 2, clock_id, tp)
-#elif defined __NR_clock_settime
-# define SYSDEP_SETTIME_CPU \
- retval = maybe_syscall_settime_cpu (clock_id, tp); \
- if (retval == 0) \
- break; \
- if (retval != EINVAL || !__libc_missing_posix_cpu_timers) \
- { \
- __set_errno (retval); \
- retval = -1; \
- break; \
- } \
- do { } while (0)
-#endif
#include <sysdeps/unix/clock_settime.c>
diff --git a/libc/sysdeps/unix/sysv/linux/kernel-features.h b/libc/sysdeps/unix/sysv/linux/kernel-features.h
index 33fca5c4f..61bf32d1b 100644
--- a/libc/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/libc/sysdeps/unix/sysv/linux/kernel-features.h
@@ -57,9 +57,6 @@
MIPS n32). */
#define __ASSUME_GETDENTS64_SYSCALL 1
-/* Beginning with 2.6.12 the clock and timer supports CPU clocks. */
-#define __ASSUME_POSIX_CPU_TIMERS 1
-
/* The statfs64 syscalls are available in 2.5.74 (but not for alpha). */
#define __ASSUME_STATFS64 1
diff --git a/libc/sysdeps/unix/sysv/linux/malloc-sysdep.h b/libc/sysdeps/unix/sysv/linux/malloc-sysdep.h
new file mode 100644
index 000000000..f926aeaff
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/malloc-sysdep.h
@@ -0,0 +1,57 @@
+/* System-specific malloc support functions. Linux version.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fcntl.h>
+#include <not-cancel.h>
+
+/* The Linux kernel overcommits address space by default and if there is not
+ enough memory available, it uses various parameters to decide the process to
+ kill. It is however possible to disable or curb this overcommit behavior
+ by setting the proc sysctl vm.overcommit_memory to the value '2' and with
+ that, a process is only allowed to use the maximum of a pre-determined
+ fraction of the total address space. In such a case, we want to make sure
+ that we are judicious with our heap usage as well, and explicitly give away
+ the freed top of the heap to reduce our commit charge. See the proc(5) man
+ page to know more about overcommit behavior.
+
+ Other than that, we also force an unmap in a secure exec. */
+static inline bool
+check_may_shrink_heap (void)
+{
+ static int may_shrink_heap = -1;
+
+ if (__builtin_expect (may_shrink_heap >= 0, 1))
+ return may_shrink_heap;
+
+ may_shrink_heap = __libc_enable_secure;
+
+ if (__builtin_expect (may_shrink_heap == 0, 1))
+ {
+ int fd = open_not_cancel_2 ("/proc/sys/vm/overcommit_memory",
+ O_RDONLY | O_CLOEXEC);
+ if (fd >= 0)
+ {
+ char val;
+ ssize_t n = read_not_cancel (fd, &val, 1);
+ may_shrink_heap = n > 0 && val == '2';
+ close_not_cancel_no_status (fd);
+ }
+ }
+
+ return may_shrink_heap;
+}
diff --git a/libc/sysdeps/unix/sysv/linux/ttyname.c b/libc/sysdeps/unix/sysv/linux/ttyname.c
index 3dacd40c2..d3070c3ba 100644
--- a/libc/sysdeps/unix/sysv/linux/ttyname.c
+++ b/libc/sysdeps/unix/sysv/linux/ttyname.c
@@ -148,12 +148,6 @@ ttyname (int fd)
}
ssize_t len = __readlink (procname, ttyname_buf, buflen);
- if (__builtin_expect (len == -1 && errno == ENOENT, 0))
- {
- __set_errno (EBADF);
- return NULL;
- }
-
if (__builtin_expect (len != -1, 1))
{
if ((size_t) len >= buflen)
diff --git a/libc/sysdeps/unix/sysv/linux/ttyname_r.c b/libc/sysdeps/unix/sysv/linux/ttyname_r.c
index 2dd678134..211ed189b 100644
--- a/libc/sysdeps/unix/sysv/linux/ttyname_r.c
+++ b/libc/sysdeps/unix/sysv/linux/ttyname_r.c
@@ -128,12 +128,6 @@ __ttyname_r (int fd, char *buf, size_t buflen)
*_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
ssize_t ret = __readlink (procname, buf, buflen - 1);
- if (__builtin_expect (ret == -1 && errno == ENOENT, 0))
- {
- __set_errno (EBADF);
- return EBADF;
- }
-
if (__builtin_expect (ret == -1 && errno == ENAMETOOLONG, 0))
{
__set_errno (ERANGE);
diff --git a/libc/sysdeps/wordsize-64/Makefile b/libc/sysdeps/wordsize-64/Makefile
index 9903f51f9..2fa934751 100644
--- a/libc/sysdeps/wordsize-64/Makefile
+++ b/libc/sysdeps/wordsize-64/Makefile
@@ -1,6 +1,3 @@
ifeq ($(subdir),misc)
tests += tst-writev
-
-# Time enough for a large writev syscall to complete.
-tst-writev-ENV = TIMEOUTFACTOR="10"
endif
diff --git a/libc/sysdeps/wordsize-64/tst-writev.c b/libc/sysdeps/wordsize-64/tst-writev.c
index 49a809cfa..0bc2f70b6 100644
--- a/libc/sysdeps/wordsize-64/tst-writev.c
+++ b/libc/sysdeps/wordsize-64/tst-writev.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ryan S. Arnold <rsa@us.ibm.com>, 2011.
@@ -108,5 +108,8 @@ do_test (void)
return 0;
}
+/* Time enough for a large writev syscall to complete. */
+#define TIMEOUT 20
+
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
diff --git a/libc/sysdeps/x86_64/Makefile b/libc/sysdeps/x86_64/Makefile
index d4525bc7c..0acb69a17 100644
--- a/libc/sysdeps/x86_64/Makefile
+++ b/libc/sysdeps/x86_64/Makefile
@@ -41,7 +41,7 @@ $(objpfx)tst-quad2pie: $(objpfx)tst-quadmod2pie.o
tests: $(objpfx)tst-xmmymm.out
$(objpfx)tst-xmmymm.out: ../sysdeps/x86_64/tst-xmmymm.sh $(objpfx)ld.so
@echo "Checking ld.so for SSE register use. This will take a few seconds..."
- $(SHELL) -e $< $(objpfx) > $@
+ $(SHELL) $< $(objpfx) > $@
endif
ifeq ($(subdir),csu)
diff --git a/libc/sysdeps/x86_64/dl-machine.h b/libc/sysdeps/x86_64/dl-machine.h
index 9c27ecffd..d2654aa04 100644
--- a/libc/sysdeps/x86_64/dl-machine.h
+++ b/libc/sysdeps/x86_64/dl-machine.h
@@ -41,13 +41,9 @@ elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
static inline ElfW(Addr) __attribute__ ((unused))
elf_machine_dynamic (void)
{
- ElfW(Addr) addr;
-
- /* This works because we have our GOT address available in the small PIC
- model. */
- addr = (ElfW(Addr)) &_DYNAMIC;
-
- return addr;
+ /* This produces an IP-relative reloc which is resolved at link time. */
+ extern const ElfW(Addr) _GLOBAL_OFFSET_TABLE_[] attribute_hidden;
+ return _GLOBAL_OFFSET_TABLE_[0];
}
@@ -55,31 +51,11 @@ elf_machine_dynamic (void)
static inline ElfW(Addr) __attribute__ ((unused))
elf_machine_load_address (void)
{
- ElfW(Addr) addr;
-
- /* The easy way is just the same as on x86:
- leaq _dl_start, %0
- leaq _dl_start(%%rip), %1
- subq %0, %1
- but this does not work with binutils since we then have
- a R_X86_64_32S relocation in a shared lib.
-
- Instead we store the address of _dl_start in the data section
- and compare it with the current value that we can get via
- an RIP relative addressing mode. Note that this is the address
- of _dl_start before any relocation performed at runtime. In case
- the binary is prelinked the resulting "address" is actually a
- load offset which is zero if the binary was loaded at the address
- it is prelinked for. */
-
- asm ("lea _dl_start(%%rip), %0\n\t"
- "sub 1f(%%rip), %0\n\t"
- ".section\t.data.rel.ro\n"
- "1:\t" ASM_ADDR " _dl_start\n\t"
- ".previous\n\t"
- : "=r" (addr) : : "cc");
-
- return addr;
+ /* Compute the difference between the runtime address of _DYNAMIC as seen
+ by an IP-relative reference, and the link-time address found in the
+ special unrelocated first GOT entry. */
+ extern ElfW(Dyn) _DYNAMIC[] attribute_hidden;
+ return (ElfW(Addr)) &_DYNAMIC - elf_machine_dynamic ();
}
/* Set up the loaded object described by L so its unrelocated PLT
diff --git a/libc/sysdeps/x86_64/fpu/libm-test-ulps b/libc/sysdeps/x86_64/fpu/libm-test-ulps
index 8a3822113..b02b9e6ba 100644
--- a/libc/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/libc/sysdeps/x86_64/fpu/libm-test-ulps
@@ -1208,6 +1208,8 @@ ifloat: 1
ildouble: 1
ldouble: 1
Test "cos_downward (10) == -0.8390715290764524522588639478240648345199":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "cos_downward (2) == -0.4161468365471423869975682295007621897660":
@@ -1239,6 +1241,8 @@ ifloat: 1
ildouble: 1
ldouble: 1
Test "cos_downward (9) == -0.9111302618846769883682947111811653112463":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
@@ -1285,15 +1289,22 @@ ildouble: 1
ldouble: 1
# cos_upward
+Test "cos_upward (1) == 0.5403023058681397174009366074429766037323":
+float: 1
+ifloat: 1
Test "cos_upward (10) == -0.8390715290764524522588639478240648345199":
float: 1
ifloat: 1
ildouble: 1
ldouble: 1
Test "cos_upward (2) == -0.4161468365471423869975682295007621897660":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "cos_upward (3) == -0.9899924966004454572715727947312613023937":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "cos_upward (4) == -0.6536436208636119146391681830977503814241":
@@ -1311,6 +1322,8 @@ Test "cos_upward (7) == 0.7539022543433046381411975217191820122183":
float: 1
ifloat: 1
Test "cos_upward (8) == -0.1455000338086135258688413818311946826093":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "cos_upward (9) == -0.9111302618846769883682947111811653112463":
@@ -2319,6 +2332,8 @@ Test "sin_downward (8) == 0.9893582466233817778081235982452886721164":
ildouble: 1
ldouble: 1
Test "sin_downward (9) == 0.4121184852417565697562725663524351793439":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
@@ -2374,6 +2389,8 @@ Test "sin_upward (1) == 0.8414709848078965066525023216302989996226":
float: 1
ifloat: 1
Test "sin_upward (10) == -0.5440211108893698134047476618513772816836":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "sin_upward (2) == 0.9092974268256816953960198659117448427023":
@@ -2382,6 +2399,8 @@ ifloat: 2
ildouble: 1
ldouble: 1
Test "sin_upward (3) == 0.1411200080598672221007448028081102798469":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "sin_upward (4) == -0.7568024953079282513726390945118290941359":
@@ -2390,11 +2409,19 @@ ifloat: 1
ildouble: 1
ldouble: 1
Test "sin_upward (5) == -0.9589242746631384688931544061559939733525":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "sin_upward (6) == -0.2794154981989258728115554466118947596280":
ildouble: 1
ldouble: 1
+Test "sin_upward (7) == 0.6569865987187890903969990915936351779369":
+float: 1
+ifloat: 1
+Test "sin_upward (8) == 0.9893582466233817778081235982452886721164":
+float: 1
+ifloat: 1
Test "sin_upward (9) == 0.4121184852417565697562725663524351793439":
float: 1
ifloat: 1
@@ -2403,6 +2430,12 @@ ifloat: 1
Test "sincos (0.80190127184058835, &sin_res, &cos_res) puts 0.69534156199418473 in cos_res":
double: 1
idouble: 1
+Test "sincos (0x1p+120, &sin_res, &cos_res) puts -9.25879022854837867303861764107414946730833e-01 in cos_res":
+float: 1
+ifloat: 1
+Test "sincos (0x1p+127, &sin_res, &cos_res) puts 7.81914638714960072263910298466369236613162e-01 in cos_res":
+float: 1
+ifloat: 1
Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
double: 1
float: 1
@@ -3052,8 +3085,8 @@ ildouble: 1
ldouble: 1
Function: "cos_upward":
-float: 2
-ifloat: 2
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
@@ -3412,8 +3445,8 @@ ildouble: 1
ldouble: 1
Function: "sin_upward":
-float: 2
-ifloat: 2
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
diff --git a/libc/sysdeps/x86_64/fpu/s_cosf.S b/libc/sysdeps/x86_64/fpu/s_cosf.S
new file mode 100644
index 000000000..dc8c76a13
--- /dev/null
+++ b/libc/sysdeps/x86_64/fpu/s_cosf.S
@@ -0,0 +1,527 @@
+/* Optimized cosf function.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#define __need_Emath
+#include <bits/errno.h>
+
+/* Short algorithm description:
+ *
+ * 1) if |x| == 0: return 1.0-|x|.
+ * 2) if |x| < 2^-27: return 1.0-|x|.
+ * 3) if |x| < 2^-5 : return 1.0+x^2*DP_COS2_0+x^5*DP_COS2_1.
+ * 4) if |x| < Pi/4: return 1.0+x^2*(C0+x^2*(C1+x^2*(C2+x^2*(C3+x^2*C4)))).
+ * 5) if |x| < 9*Pi/4:
+ * 5.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0x0e, n=k+3,
+ * t=|x|-j*Pi/4.
+ * 5.2) Reconstruction:
+ * s = (-1.0)^((n>>2)&1)
+ * if(n&2 != 0) {
+ * using cos(t) polynomial for |t|<Pi/4, result is
+ * s * (1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4))))).
+ * } else {
+ * using sin(t) polynomial for |t|<Pi/4, result is
+ * s * t * (1.0+t^2*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4))))).
+ * }
+ * 6) if |x| < 2^23, large args:
+ * 6.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0xfffffffe, n=k+3,
+ * t=|x|-j*Pi/4.
+ * 6.2) Reconstruction same as (5.2).
+ * 7) if |x| >= 2^23, very large args:
+ * 7.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0xfffffffe, n=k+3,
+ * t=|x|-j*Pi/4.
+ * 7.2) Reconstruction same as (5.2).
+ * 8) if x is Inf, return x-x, and set errno=EDOM.
+ * 9) if x is NaN, return x-x.
+ *
+ * Special cases:
+ * cos(+-0) = 1 not raising inexact,
+ * cos(subnormal) raises inexact,
+ * cos(min_normalized) raises inexact,
+ * cos(normalized) raises inexact,
+ * cos(Inf) = NaN, raises invalid, sets errno to EDOM,
+ * cos(NaN) = NaN.
+ */
+
+ .text
+ENTRY(__cosf)
+ /* Input: single precision x in %xmm0 */
+
+ movd %xmm0, %eax /* Bits of x */
+ movaps %xmm0, %xmm7 /* Copy of x */
+ cvtss2sd %xmm0, %xmm0 /* DP x */
+ movss L(SP_ABS_MASK)(%rip), %xmm3
+ andl $0x7fffffff, %eax /* |x| */
+
+ cmpl $0x3f490fdb, %eax /* |x|<Pi/4? */
+ jb L(arg_less_pio4)
+
+ /* Here if |x|>=Pi/4 */
+ andps %xmm7, %xmm3 /* SP |x| */
+ andpd L(DP_ABS_MASK)(%rip), %xmm0 /* DP |x| */
+ movss L(SP_INVPIO4)(%rip), %xmm2 /* SP 1/(Pi/4) */
+
+ cmpl $0x40e231d6, %eax /* |x|<9*Pi/4? */
+ jae L(large_args)
+
+ /* Here if Pi/4<=|x|<9*Pi/4 */
+ mulss %xmm3, %xmm2 /* SP |x|/(Pi/4) */
+ cvttss2si %xmm2, %eax /* k, number of Pi/4 in x */
+ lea L(PIO4J)(%rip), %rsi
+ addl $1, %eax /* k+1 */
+ movl $0x0e, %edx
+ andl %eax, %edx /* j = (k+1)&0x0e */
+ addl $2, %eax /* n */
+ subsd (%rsi,%rdx,8), %xmm0 /* t = |x| - j * Pi/4 */
+
+L(reconstruction):
+ /* Input: %eax=n, %xmm0=t */
+ testl $2, %eax /* n&2 != 0? */
+ jz L(sin_poly)
+
+/*L(cos_poly):*/
+ /* Here if cos(x) calculated using cos(t) polynomial for |t|<Pi/4:
+ * y = t*t; z = y*y;
+ * s = sign(x) * (-1.0)^((n>>2)&1)
+ * result = s * (1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4)))))
+ */
+ shrl $2, %eax /* n>>2 */
+ mulsd %xmm0, %xmm0 /* y=t^2 */
+ andl $1, %eax /* (n>>2)&1 */
+ movaps %xmm0, %xmm1 /* y */
+ mulsd %xmm0, %xmm0 /* z=t^4 */
+
+ movsd L(DP_C4)(%rip), %xmm4 /* C4 */
+ mulsd %xmm0, %xmm4 /* z*C4 */
+ movsd L(DP_C3)(%rip), %xmm3 /* C3 */
+ mulsd %xmm0, %xmm3 /* z*C3 */
+ lea L(DP_ONES)(%rip), %rsi
+ addsd L(DP_C2)(%rip), %xmm4 /* C2+z*C4 */
+ mulsd %xmm0, %xmm4 /* z*(C2+z*C4) */
+ addsd L(DP_C1)(%rip), %xmm3 /* C1+z*C3 */
+ mulsd %xmm0, %xmm3 /* z*(C1+z*C3) */
+ addsd L(DP_C0)(%rip), %xmm4 /* C0+z*(C2+z*C4) */
+ mulsd %xmm1, %xmm4 /* y*(C0+z*(C2+z*C4)) */
+
+ addsd %xmm4, %xmm3 /* y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+ /* 1.0+y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+ addsd L(DP_ONES)(%rip), %xmm3
+
+ mulsd (%rsi,%rax,8), %xmm3 /* DP result */
+ cvtsd2ss %xmm3, %xmm0 /* SP result */
+ ret
+
+ .p2align 4
+L(sin_poly):
+ /* Here if cos(x) calculated using sin(t) polynomial for |t|<Pi/4:
+ * y = t*t; z = y*y;
+ * s = sign(x) * (-1.0)^((n>>2)&1)
+ * result = s * t * (1.0+t^2*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4)))))
+ */
+
+ movaps %xmm0, %xmm4 /* t */
+ shrl $2, %eax /* n>>2 */
+ mulsd %xmm0, %xmm0 /* y=t^2 */
+ andl $1, %eax /* (n>>2)&1 */
+ movaps %xmm0, %xmm1 /* y */
+ mulsd %xmm0, %xmm0 /* z=t^4 */
+
+ movsd L(DP_S4)(%rip), %xmm2 /* S4 */
+ mulsd %xmm0, %xmm2 /* z*S4 */
+ movsd L(DP_S3)(%rip), %xmm3 /* S3 */
+ mulsd %xmm0, %xmm3 /* z*S3 */
+ lea L(DP_ONES)(%rip), %rsi
+ addsd L(DP_S2)(%rip), %xmm2 /* S2+z*S4 */
+ mulsd %xmm0, %xmm2 /* z*(S2+z*S4) */
+ addsd L(DP_S1)(%rip), %xmm3 /* S1+z*S3 */
+ mulsd %xmm0, %xmm3 /* z*(S1+z*S3) */
+ addsd L(DP_S0)(%rip), %xmm2 /* S0+z*(S2+z*S4) */
+ mulsd %xmm1, %xmm2 /* y*(S0+z*(S2+z*S4)) */
+ /* t*s, where s = sign(x) * (-1.0)^((n>>2)&1) */
+ mulsd (%rsi,%rax,8), %xmm4
+ /* y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ addsd %xmm2, %xmm3
+ /* t*s*y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ mulsd %xmm4, %xmm3
+ /* t*s*(1.0+y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ addsd %xmm4, %xmm3
+ cvtsd2ss %xmm3, %xmm0 /* SP result */
+ ret
+
+ .p2align 4
+L(large_args):
+ /* Here if |x|>=9*Pi/4 */
+ cmpl $0x7f800000, %eax /* x is Inf or NaN? */
+ jae L(arg_inf_or_nan)
+
+ /* Here if finite |x|>=9*Pi/4 */
+ cmpl $0x4b000000, %eax /* |x|<2^23? */
+ jae L(very_large_args)
+
+ /* Here if 9*Pi/4<=|x|<2^23 */
+ movsd L(DP_INVPIO4)(%rip), %xmm1 /* 1/(Pi/4) */
+ mulsd %xmm0, %xmm1 /* |x|/(Pi/4) */
+ cvttsd2si %xmm1, %eax /* k=trunc(|x|/(Pi/4)) */
+ addl $1, %eax /* k+1 */
+ movl %eax, %edx
+ andl $0xfffffffe, %edx /* j=(k+1)&0xfffffffe */
+ cvtsi2sdl %edx, %xmm4 /* DP j */
+ movsd L(DP_PIO4HI)(%rip), %xmm2 /* -PIO4HI = high part of -Pi/4 */
+ mulsd %xmm4, %xmm2 /* -j*PIO4HI */
+ movsd L(DP_PIO4LO)(%rip), %xmm3 /* -PIO4LO = low part of -Pi/4 */
+ addsd %xmm2, %xmm0 /* |x| - j*PIO4HI */
+ addl $2, %eax /* n */
+ mulsd %xmm3, %xmm4 /* j*PIO4LO */
+ addsd %xmm4, %xmm0 /* t = |x| - j*PIO4HI - j*PIO4LO */
+ jmp L(reconstruction)
+
+ .p2align 4
+L(very_large_args):
+ /* Here if finite |x|>=2^23 */
+
+ /* bitpos = (ix>>23) - BIAS_32 + 59; */
+ shrl $23, %eax /* eb = biased exponent of x */
+ /* bitpos = eb - 0x7f + 59, where 0x7f is exponent bias */
+ subl $68, %eax
+ movl $28, %ecx /* %cl=28 */
+ movl %eax, %edx /* bitpos copy */
+
+ /* j = bitpos/28; */
+ div %cl /* j in register %al=%ax/%cl */
+ movapd %xmm0, %xmm3 /* |x| */
+ /* clear unneeded remainder from %ah */
+ andl $0xff, %eax
+
+ imull $28, %eax, %ecx /* j*28 */
+ lea L(_FPI)(%rip), %rsi
+ movsd L(DP_HI_MASK)(%rip), %xmm4 /* DP_HI_MASK */
+ movapd %xmm0, %xmm5 /* |x| */
+ mulsd -16(%rsi,%rax,8), %xmm3 /* tmp3 = FPI[j-2]*|x| */
+ movapd %xmm0, %xmm1 /* |x| */
+ mulsd -8(%rsi,%rax,8), %xmm5 /* tmp2 = FPI[j-1]*|x| */
+ mulsd (%rsi,%rax,8), %xmm0 /* tmp0 = FPI[j]*|x| */
+ addl $19, %ecx /* j*28+19 */
+ mulsd 8(%rsi,%rax,8), %xmm1 /* tmp1 = FPI[j+1]*|x| */
+ cmpl %ecx, %edx /* bitpos>=j*28+19? */
+ jl L(very_large_skip1)
+
+ /* Here if bitpos>=j*28+19 */
+ andpd %xmm3, %xmm4 /* HI(tmp3) */
+ subsd %xmm4, %xmm3 /* tmp3 = tmp3 - HI(tmp3) */
+L(very_large_skip1):
+
+ movsd L(DP_2POW52)(%rip), %xmm6
+ movapd %xmm5, %xmm2 /* tmp2 copy */
+ addsd %xmm3, %xmm5 /* tmp5 = tmp3 + tmp2 */
+ movl $1, %edx
+ addsd %xmm5, %xmm6 /* tmp6 = tmp5 + 2^52 */
+ movsd 8+L(DP_2POW52)(%rip), %xmm4
+ movd %xmm6, %eax /* k = I64_LO(tmp6); */
+ addsd %xmm6, %xmm4 /* tmp4 = tmp6 - 2^52 */
+ comisd %xmm5, %xmm4 /* tmp4 > tmp5? */
+ jbe L(very_large_skip2)
+
+ /* Here if tmp4 > tmp5 */
+ subl $1, %eax /* k-- */
+ addsd 8+L(DP_ONES)(%rip), %xmm4 /* tmp4 -= 1.0 */
+L(very_large_skip2):
+
+ andl %eax, %edx /* k&1 */
+ lea L(DP_ZERONE)(%rip), %rsi
+ subsd %xmm4, %xmm3 /* tmp3 -= tmp4 */
+ addsd (%rsi,%rdx,8), %xmm3 /* t = DP_ZERONE[k&1] + tmp3 */
+ addsd %xmm2, %xmm3 /* t += tmp2 */
+ addsd %xmm3, %xmm0 /* t += tmp0 */
+ addl $3, %eax /* n=k+3 */
+ addsd %xmm1, %xmm0 /* t += tmp1 */
+ mulsd L(DP_PIO4)(%rip), %xmm0 /* t *= PI04 */
+
+ jmp L(reconstruction) /* end of very_large_args peth */
+
+ .p2align 4
+L(arg_less_pio4):
+ /* Here if |x|<Pi/4 */
+ cmpl $0x3d000000, %eax /* |x|<2^-5? */
+ jl L(arg_less_2pn5)
+
+ /* Here if 2^-5<=|x|<Pi/4 */
+ mulsd %xmm0, %xmm0 /* y=x^2 */
+ movaps %xmm0, %xmm1 /* y */
+ mulsd %xmm0, %xmm0 /* z=x^4 */
+ movsd L(DP_C4)(%rip), %xmm3 /* C4 */
+ mulsd %xmm0, %xmm3 /* z*C4 */
+ movsd L(DP_C3)(%rip), %xmm5 /* C3 */
+ mulsd %xmm0, %xmm5 /* z*C3 */
+ addsd L(DP_C2)(%rip), %xmm3 /* C2+z*C4 */
+ mulsd %xmm0, %xmm3 /* z*(C2+z*C4) */
+ addsd L(DP_C1)(%rip), %xmm5 /* C1+z*C3 */
+ mulsd %xmm0, %xmm5 /* z*(C1+z*C3) */
+ addsd L(DP_C0)(%rip), %xmm3 /* C0+z*(C2+z*C4) */
+ mulsd %xmm1, %xmm3 /* y*(C0+z*(C2+z*C4)) */
+ /* y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+ addsd %xmm5, %xmm3
+ /* 1.0 + y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+ addsd L(DP_ONES)(%rip), %xmm3
+ cvtsd2ss %xmm3, %xmm0 /* SP result */
+ ret
+
+ .p2align 4
+L(arg_less_2pn5):
+ /* Here if |x|<2^-5 */
+ cmpl $0x32000000, %eax /* |x|<2^-27? */
+ jl L(arg_less_2pn27)
+
+ /* Here if 2^-27<=|x|<2^-5 */
+ mulsd %xmm0, %xmm0 /* DP x^2 */
+ movsd L(DP_COS2_1)(%rip), %xmm3 /* DP DP_COS2_1 */
+ mulsd %xmm0, %xmm3 /* DP x^2*DP_COS2_1 */
+ addsd L(DP_COS2_0)(%rip), %xmm3 /* DP DP_COS2_0+x^2*DP_COS2_1 */
+ mulsd %xmm0, %xmm3 /* DP x^2*DP_COS2_0+x^4*DP_COS2_1 */
+ /* DP 1.0+x^2*DP_COS2_0+x^4*DP_COS2_1 */
+ addsd L(DP_ONES)(%rip), %xmm3
+ cvtsd2ss %xmm3, %xmm0 /* SP result */
+ ret
+
+ .p2align 4
+L(arg_less_2pn27):
+ /* Here if |x|<2^-27 */
+ andps L(SP_ABS_MASK)(%rip),%xmm7 /* |x| */
+ movss L(SP_ONE)(%rip), %xmm0 /* 1.0 */
+ subss %xmm7, %xmm0 /* result is 1.0-|x| */
+ ret
+
+ .p2align 4
+L(arg_inf_or_nan):
+ /* Here if |x| is Inf or NAN */
+ jne L(skip_errno_setting) /* in case of x is NaN */
+
+ /* Here if x is Inf. Set errno to EDOM. */
+ call JUMPTARGET(__errno_location)
+ movl $EDOM, (%rax)
+
+ .p2align 4
+L(skip_errno_setting):
+ /* Here if |x| is Inf or NAN. Continued. */
+ movaps %xmm7, %xmm0 /* load x */
+ subss %xmm0, %xmm0 /* Result is NaN */
+ ret
+END(__cosf)
+
+ .section .rodata, "a"
+ .p2align 3
+L(PIO4J): /* Table of j*Pi/4, for j=0,1,..,10 */
+ .long 0x00000000,0x00000000
+ .long 0x54442d18,0x3fe921fb
+ .long 0x54442d18,0x3ff921fb
+ .long 0x7f3321d2,0x4002d97c
+ .long 0x54442d18,0x400921fb
+ .long 0x2955385e,0x400f6a7a
+ .long 0x7f3321d2,0x4012d97c
+ .long 0xe9bba775,0x4015fdbb
+ .long 0x54442d18,0x401921fb
+ .long 0xbeccb2bb,0x401c463a
+ .long 0x2955385e,0x401f6a7a
+ .type L(PIO4J), @object
+ ASM_SIZE_DIRECTIVE(L(PIO4J))
+
+ .p2align 3
+L(_FPI): /* 4/Pi broken into sum of positive DP values */
+ .long 0x00000000,0x00000000
+ .long 0x6c000000,0x3ff45f30
+ .long 0x2a000000,0x3e3c9c88
+ .long 0xa8000000,0x3c54fe13
+ .long 0xd0000000,0x3aaf47d4
+ .long 0x6c000000,0x38fbb81b
+ .long 0xe0000000,0x3714acc9
+ .long 0x7c000000,0x3560e410
+ .long 0x56000000,0x33bca2c7
+ .long 0xac000000,0x31fbd778
+ .long 0xe0000000,0x300b7246
+ .long 0xe8000000,0x2e5d2126
+ .long 0x48000000,0x2c970032
+ .long 0xe8000000,0x2ad77504
+ .long 0xe0000000,0x290921cf
+ .long 0xb0000000,0x274deb1c
+ .long 0xe0000000,0x25829a73
+ .long 0xbe000000,0x23fd1046
+ .long 0x10000000,0x2224baed
+ .long 0x8e000000,0x20709d33
+ .long 0x80000000,0x1e535a2f
+ .long 0x64000000,0x1cef904e
+ .long 0x30000000,0x1b0d6398
+ .long 0x24000000,0x1964ce7d
+ .long 0x16000000,0x17b908bf
+ .type L(_FPI), @object
+ ASM_SIZE_DIRECTIVE(L(_FPI))
+
+/* Coefficients of polynomial
+ for cos(x)~=1.0+x^2*DP_COS2_0+x^4*DP_COS2_1, |x|<2^-5. */
+ .p2align 3
+L(DP_COS2_0):
+ .long 0xff5cc6fd,0xbfdfffff
+ .type L(DP_COS2_0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_COS2_0))
+
+ .p2align 3
+L(DP_COS2_1):
+ .long 0xb178dac5,0x3fa55514
+ .type L(DP_COS2_1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_COS2_1))
+
+ .p2align 3
+L(DP_ZERONE):
+ .long 0x00000000,0x00000000 /* 0.0 */
+ .long 0x00000000,0xbff00000 /* 1.0 */
+ .type L(DP_ZERONE), @object
+ ASM_SIZE_DIRECTIVE(L(DP_ZERONE))
+
+ .p2align 3
+L(DP_ONES):
+ .long 0x00000000,0x3ff00000 /* +1.0 */
+ .long 0x00000000,0xbff00000 /* -1.0 */
+ .type L(DP_ONES), @object
+ ASM_SIZE_DIRECTIVE(L(DP_ONES))
+
+/* Coefficients of polynomial
+ for sin(t)~=t+t^3*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4)))), |t|<Pi/4. */
+ .p2align 3
+L(DP_S3):
+ .long 0x64e6b5b4,0x3ec71d72
+ .type L(DP_S3), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S3))
+
+ .p2align 3
+L(DP_S1):
+ .long 0x10c2688b,0x3f811111
+ .type L(DP_S1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S1))
+
+ .p2align 3
+L(DP_S4):
+ .long 0x1674b58a,0xbe5a947e
+ .type L(DP_S4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S4))
+
+ .p2align 3
+L(DP_S2):
+ .long 0x8b4bd1f9,0xbf2a019f
+ .type L(DP_S2),@object
+ ASM_SIZE_DIRECTIVE(L(DP_S2))
+
+ .p2align 3
+L(DP_S0):
+ .long 0x55551cd9,0xbfc55555
+ .type L(DP_S0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S0))
+
+/* Coefficients of polynomial
+ for cos(t)~=1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4)))), |t|<Pi/4. */
+ .p2align 3
+L(DP_C3):
+ .long 0x9ac43cc0,0x3efa00eb
+ .type L(DP_C3), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C3))
+
+ .p2align 3
+L(DP_C1):
+ .long 0x545c50c7,0x3fa55555
+ .type L(DP_C1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C1))
+
+ .p2align 3
+L(DP_C4):
+ .long 0xdd8844d7,0xbe923c97
+ .type L(DP_C4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C4))
+
+ .p2align 3
+L(DP_C2):
+ .long 0x348b6874,0xbf56c16b
+ .type L(DP_C2), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C2))
+
+ .p2align 3
+L(DP_C0):
+ .long 0xfffe98ae,0xbfdfffff
+ .type L(DP_C0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C0))
+
+ .p2align 3
+L(DP_PIO4):
+ .long 0x54442d18,0x3fe921fb /* Pi/4 */
+ .type L(DP_PIO4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4))
+
+ .p2align 3
+L(DP_2POW52):
+ .long 0x00000000,0x43300000 /* +2^52 */
+ .long 0x00000000,0xc3300000 /* -2^52 */
+ .type L(DP_2POW52), @object
+ ASM_SIZE_DIRECTIVE(L(DP_2POW52))
+
+ .p2align 3
+L(DP_INVPIO4):
+ .long 0x6dc9c883,0x3ff45f30 /* 4/Pi */
+ .type L(DP_INVPIO4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_INVPIO4))
+
+ .p2align 3
+L(DP_PIO4HI):
+ .long 0x54000000,0xbfe921fb /* High part of Pi/4 */
+ .type L(DP_PIO4HI), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4HI))
+
+ .p2align 3
+L(DP_PIO4LO):
+ .long 0x11A62633,0xbe010b46 /* Low part of Pi/4 */
+ .type L(DP_PIO4LO), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4LO))
+
+ .p2align 2
+L(SP_INVPIO4):
+ .long 0x3fa2f983 /* 4/Pi */
+ .type L(SP_INVPIO4), @object
+ ASM_SIZE_DIRECTIVE(L(SP_INVPIO4))
+
+ .p2align 4
+L(DP_ABS_MASK): /* Mask for getting DP absolute value */
+ .long 0xffffffff,0x7fffffff
+ .long 0xffffffff,0x7fffffff
+ .type L(DP_ABS_MASK), @object
+ ASM_SIZE_DIRECTIVE(L(DP_ABS_MASK))
+
+ .p2align 3
+L(DP_HI_MASK): /* Mask for getting high 21 bits of DP value */
+ .long 0x00000000,0xffffffff
+ .type L(DP_HI_MASK), @object
+ ASM_SIZE_DIRECTIVE(L(DP_HI_MASK))
+
+ .p2align 4
+L(SP_ABS_MASK): /* Mask for getting SP absolute value */
+ .long 0x7fffffff,0x7fffffff
+ .long 0x7fffffff,0x7fffffff
+ .type L(SP_ABS_MASK), @object
+ ASM_SIZE_DIRECTIVE(L(SP_ABS_MASK))
+
+ .p2align 2
+L(SP_ONE):
+ .long 0x3f800000 /* 1.0 */
+ .type L(SP_ONE), @object
+ ASM_SIZE_DIRECTIVE(L(SP_ONE))
+
+weak_alias(__cosf, cosf)
diff --git a/libc/sysdeps/x86_64/fpu/s_sinf.S b/libc/sysdeps/x86_64/fpu/s_sinf.S
new file mode 100644
index 000000000..9a6c87ff7
--- /dev/null
+++ b/libc/sysdeps/x86_64/fpu/s_sinf.S
@@ -0,0 +1,553 @@
+/* Optimized sinf function.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#define __need_Emath
+#include <bits/errno.h>
+
+/* Short algorithm description:
+ *
+ * 1) if |x| == 0: return x.
+ * 2) if |x| < 2^-27: return x-x*DP_SMALL, raise underflow only when needed.
+ * 3) if |x| < 2^-5 : return x+x^3*DP_SIN2_0+x^5*DP_SIN2_1.
+ * 4) if |x| < Pi/4: return x+x^3*(S0+x^2*(S1+x^2*(S2+x^2*(S3+x^2*S4)))).
+ * 5) if |x| < 9*Pi/4:
+ * 5.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0x0e, n=k+1,
+ * t=|x|-j*Pi/4.
+ * 5.2) Reconstruction:
+ * s = sign(x) * (-1.0)^((n>>2)&1)
+ * if(n&2 != 0) {
+ * using cos(t) polynomial for |t|<Pi/4, result is
+ * s * (1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4))))).
+ * } else {
+ * using sin(t) polynomial for |t|<Pi/4, result is
+ * s * t * (1.0+t^2*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4))))).
+ * }
+ * 6) if |x| < 2^23, large args:
+ * 6.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0xfffffffe, n=k+1,
+ * t=|x|-j*Pi/4.
+ * 6.2) Reconstruction same as (5.2).
+ * 7) if |x| >= 2^23, very large args:
+ * 7.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0xfffffffe, n=k+1,
+ * t=|x|-j*Pi/4.
+ * 7.2) Reconstruction same as (5.2).
+ * 8) if x is Inf, return x-x, and set errno=EDOM.
+ * 9) if x is NaN, return x-x.
+ *
+ * Special cases:
+ * sin(+-0) = +-0 not raising inexact/underflow,
+ * sin(subnormal) raises inexact/underflow,
+ * sin(min_normalized) raises inexact/underflow,
+ * sin(normalized) raises inexact,
+ * sin(Inf) = NaN, raises invalid, sets errno to EDOM,
+ * sin(NaN) = NaN.
+ */
+
+ .text
+ENTRY(__sinf)
+ /* Input: single precision x in %xmm0 */
+
+ movd %xmm0, %eax /* Bits of x */
+ movaps %xmm0, %xmm7 /* Copy of x */
+ cvtss2sd %xmm0, %xmm0 /* DP x */
+ movss L(SP_ABS_MASK)(%rip), %xmm3
+ movl %eax, %edi /* Copy of x bits */
+ andl $0x7fffffff, %eax /* |x| */
+
+ cmpl $0x3f490fdb, %eax /* |x|<Pi/4? */
+ jb L(arg_less_pio4)
+
+ /* Here if |x|>=Pi/4 */
+ andps %xmm7, %xmm3 /* SP |x| */
+ andpd L(DP_ABS_MASK)(%rip),%xmm0 /* DP |x| */
+ movss L(SP_INVPIO4)(%rip), %xmm2 /* SP 1/(Pi/4) */
+
+ cmpl $0x40e231d6, %eax /* |x|<9*Pi/4? */
+ jae L(large_args)
+
+ /* Here if Pi/4<=|x|<9*Pi/4 */
+ mulss %xmm3, %xmm2 /* SP |x|/(Pi/4) */
+ movl %edi, %ecx /* Load x */
+ cvttss2si %xmm2, %eax /* k, number of Pi/4 in x */
+ lea L(PIO4J)(%rip), %rsi
+ shrl $31, %ecx /* sign of x */
+ addl $1, %eax /* k+1 */
+ movl $0x0e, %edx
+ andl %eax, %edx /* j = (k+1)&0x0e */
+ subsd (%rsi,%rdx,8), %xmm0 /* t = |x| - j * Pi/4 */
+
+L(reconstruction):
+ /* Input: %eax=n, %xmm0=t, %ecx=sign(x) */
+ testl $2, %eax /* n&2 != 0? */
+ jz L(sin_poly)
+
+/*L(cos_poly):*/
+ /* Here if sin(x) calculated using cos(t) polynomial for |t|<Pi/4:
+ * y = t*t; z = y*y;
+ * s = sign(x) * (-1.0)^((n>>2)&1)
+ * result = s * (1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4)))))
+ */
+ shrl $2, %eax /* n>>2 */
+ mulsd %xmm0, %xmm0 /* y=t^2 */
+ andl $1, %eax /* (n>>2)&1 */
+ movaps %xmm0, %xmm1 /* y */
+ mulsd %xmm0, %xmm0 /* z=t^4 */
+
+ movsd L(DP_C4)(%rip), %xmm4 /* C4 */
+ mulsd %xmm0, %xmm4 /* z*C4 */
+ xorl %eax, %ecx /* (-1.0)^((n>>2)&1) XOR sign(x) */
+ movsd L(DP_C3)(%rip), %xmm3 /* C3 */
+ mulsd %xmm0, %xmm3 /* z*C3 */
+ lea L(DP_ONES)(%rip), %rsi
+ addsd L(DP_C2)(%rip), %xmm4 /* C2+z*C4 */
+ mulsd %xmm0, %xmm4 /* z*(C2+z*C4) */
+ addsd L(DP_C1)(%rip), %xmm3 /* C1+z*C3 */
+ mulsd %xmm0, %xmm3 /* z*(C1+z*C3) */
+ addsd L(DP_C0)(%rip), %xmm4 /* C0+z*(C2+z*C4) */
+ mulsd %xmm1, %xmm4 /* y*(C0+z*(C2+z*C4)) */
+
+ /* y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+ addsd %xmm4, %xmm3
+ /* 1.0+y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+ addsd L(DP_ONES)(%rip), %xmm3
+
+ mulsd (%rsi,%rcx,8), %xmm3 /* DP result */
+ cvtsd2ss %xmm3, %xmm0 /* SP result */
+ ret
+
+ .p2align 4
+L(sin_poly):
+ /* Here if sin(x) calculated using sin(t) polynomial for |t|<Pi/4:
+ * y = t*t; z = y*y;
+ * s = sign(x) * (-1.0)^((n>>2)&1)
+ * result = s * t * (1.0+t^2*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4)))))
+ */
+
+ movaps %xmm0, %xmm4 /* t */
+ shrl $2, %eax /* n>>2 */
+ mulsd %xmm0, %xmm0 /* y=t^2 */
+ andl $1, %eax /* (n>>2)&1 */
+ movaps %xmm0, %xmm1 /* y */
+ xorl %eax, %ecx /* (-1.0)^((n>>2)&1) XOR sign(x) */
+ mulsd %xmm0, %xmm0 /* z=t^4 */
+
+ movsd L(DP_S4)(%rip), %xmm2 /* S4 */
+ mulsd %xmm0, %xmm2 /* z*S4 */
+ movsd L(DP_S3)(%rip), %xmm3 /* S3 */
+ mulsd %xmm0, %xmm3 /* z*S3 */
+ lea L(DP_ONES)(%rip), %rsi
+ addsd L(DP_S2)(%rip), %xmm2 /* S2+z*S4 */
+ mulsd %xmm0, %xmm2 /* z*(S2+z*S4) */
+ addsd L(DP_S1)(%rip), %xmm3 /* S1+z*S3 */
+ mulsd %xmm0, %xmm3 /* z*(S1+z*S3) */
+ addsd L(DP_S0)(%rip), %xmm2 /* S0+z*(S2+z*S4) */
+ mulsd %xmm1, %xmm2 /* y*(S0+z*(S2+z*S4)) */
+ /* t*s, where s = sign(x) * (-1.0)^((n>>2)&1) */
+ mulsd (%rsi,%rcx,8), %xmm4
+ /* y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ addsd %xmm2, %xmm3
+ /* t*s*y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ mulsd %xmm4, %xmm3
+ /* t*s*(1.0+y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ addsd %xmm4, %xmm3
+ cvtsd2ss %xmm3, %xmm0 /* SP result */
+ ret
+
+ .p2align 4
+L(large_args):
+ /* Here if |x|>=9*Pi/4 */
+ cmpl $0x7f800000, %eax /* x is Inf or NaN? */
+ jae L(arg_inf_or_nan)
+
+ /* Here if finite |x|>=9*Pi/4 */
+ cmpl $0x4b000000, %eax /* |x|<2^23? */
+ jae L(very_large_args)
+
+ /* Here if 9*Pi/4<=|x|<2^23 */
+ movsd L(DP_INVPIO4)(%rip), %xmm1 /* 1/(Pi/4) */
+ mulsd %xmm0, %xmm1 /* |x|/(Pi/4) */
+ cvttsd2si %xmm1, %eax /* k=trunc(|x|/(Pi/4)) */
+ addl $1, %eax /* k+1 */
+ movl %eax, %edx
+ andl $0xfffffffe, %edx /* j=(k+1)&0xfffffffe */
+ cvtsi2sdl %edx, %xmm4 /* DP j */
+ movl %edi, %ecx /* Load x */
+ movsd L(DP_PIO4HI)(%rip), %xmm2 /* -PIO4HI = high part of -Pi/4 */
+ shrl $31, %ecx /* sign bit of x */
+ mulsd %xmm4, %xmm2 /* -j*PIO4HI */
+ movsd L(DP_PIO4LO)(%rip), %xmm3 /* -PIO4LO = low part of -Pi/4 */
+ addsd %xmm2, %xmm0 /* |x| - j*PIO4HI */
+ mulsd %xmm3, %xmm4 /* j*PIO4LO */
+ addsd %xmm4, %xmm0 /* t = |x| - j*PIO4HI - j*PIO4LO */
+ jmp L(reconstruction)
+
+ .p2align 4
+L(very_large_args):
+ /* Here if finite |x|>=2^23 */
+
+ /* bitpos = (ix>>23) - BIAS_32 + 59; */
+ shrl $23, %eax /* eb = biased exponent of x */
+ /* bitpos = eb - 0x7f + 59, where 0x7f is exponent bias */
+ subl $68, %eax
+ movl $28, %ecx /* %cl=28 */
+ movl %eax, %edx /* bitpos copy */
+
+ /* j = bitpos/28; */
+ div %cl /* j in register %al=%ax/%cl */
+ movapd %xmm0, %xmm3 /* |x| */
+ /* clear unneeded remainder from %ah */
+ andl $0xff, %eax
+
+ imull $28, %eax, %ecx /* j*28 */
+ lea L(_FPI)(%rip), %rsi
+ movsd L(DP_HI_MASK)(%rip), %xmm4 /* DP_HI_MASK */
+ movapd %xmm0, %xmm5 /* |x| */
+ mulsd -16(%rsi,%rax,8), %xmm3 /* tmp3 = FPI[j-2]*|x| */
+ movapd %xmm0, %xmm1 /* |x| */
+ mulsd -8(%rsi,%rax,8), %xmm5 /* tmp2 = FPI[j-1]*|x| */
+ mulsd (%rsi,%rax,8), %xmm0 /* tmp0 = FPI[j]*|x| */
+ addl $19, %ecx /* j*28+19 */
+ mulsd 8(%rsi,%rax,8), %xmm1 /* tmp1 = FPI[j+1]*|x| */
+ cmpl %ecx, %edx /* bitpos>=j*28+19? */
+ jl L(very_large_skip1)
+
+ /* Here if bitpos>=j*28+19 */
+ andpd %xmm3, %xmm4 /* HI(tmp3) */
+ subsd %xmm4, %xmm3 /* tmp3 = tmp3 - HI(tmp3) */
+L(very_large_skip1):
+
+ movsd L(DP_2POW52)(%rip), %xmm6
+ movapd %xmm5, %xmm2 /* tmp2 copy */
+ addsd %xmm3, %xmm5 /* tmp5 = tmp3 + tmp2 */
+ movl $1, %edx
+ addsd %xmm5, %xmm6 /* tmp6 = tmp5 + 2^52 */
+ movsd 8+L(DP_2POW52)(%rip), %xmm4
+ movd %xmm6, %eax /* k = I64_LO(tmp6); */
+ addsd %xmm6, %xmm4 /* tmp4 = tmp6 - 2^52 */
+ movl %edi, %ecx /* Load x */
+ comisd %xmm5, %xmm4 /* tmp4 > tmp5? */
+ jbe L(very_large_skip2)
+
+ /* Here if tmp4 > tmp5 */
+ subl $1, %eax /* k-- */
+ addsd 8+L(DP_ONES)(%rip), %xmm4 /* tmp4 -= 1.0 */
+L(very_large_skip2):
+
+ andl %eax, %edx /* k&1 */
+ lea L(DP_ZERONE)(%rip), %rsi
+ subsd %xmm4, %xmm3 /* tmp3 -= tmp4 */
+ addsd (%rsi,%rdx,8), %xmm3 /* t = DP_ZERONE[k&1] + tmp3 */
+ addsd %xmm2, %xmm3 /* t += tmp2 */
+ shrl $31, %ecx /* sign of x */
+ addsd %xmm3, %xmm0 /* t += tmp0 */
+ addl $1, %eax /* n=k+1 */
+ addsd %xmm1, %xmm0 /* t += tmp1 */
+ mulsd L(DP_PIO4)(%rip), %xmm0 /* t *= PI04 */
+
+ jmp L(reconstruction) /* end of very_large_args peth */
+
+ .p2align 4
+L(arg_less_pio4):
+ /* Here if |x|<Pi/4 */
+ cmpl $0x3d000000, %eax /* |x|<2^-5? */
+ jl L(arg_less_2pn5)
+
+ /* Here if 2^-5<=|x|<Pi/4 */
+ movaps %xmm0, %xmm3 /* x */
+ mulsd %xmm0, %xmm0 /* y=x^2 */
+ movaps %xmm0, %xmm1 /* y */
+ mulsd %xmm0, %xmm0 /* z=x^4 */
+ movsd L(DP_S4)(%rip), %xmm4 /* S4 */
+ mulsd %xmm0, %xmm4 /* z*S4 */
+ movsd L(DP_S3)(%rip), %xmm5 /* S3 */
+ mulsd %xmm0, %xmm5 /* z*S3 */
+ addsd L(DP_S2)(%rip), %xmm4 /* S2+z*S4 */
+ mulsd %xmm0, %xmm4 /* z*(S2+z*S4) */
+ addsd L(DP_S1)(%rip), %xmm5 /* S1+z*S3 */
+ mulsd %xmm0, %xmm5 /* z*(S1+z*S3) */
+ addsd L(DP_S0)(%rip), %xmm4 /* S0+z*(S2+z*S4) */
+ mulsd %xmm1, %xmm4 /* y*(S0+z*(S2+z*S4)) */
+ mulsd %xmm3, %xmm5 /* x*z*(S1+z*S3) */
+ mulsd %xmm3, %xmm4 /* x*y*(S0+z*(S2+z*S4)) */
+ /* x*y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ addsd %xmm5, %xmm4
+ /* x + x*y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ addsd %xmm4, %xmm3
+ cvtsd2ss %xmm3, %xmm0 /* SP result */
+ ret
+
+ .p2align 4
+L(arg_less_2pn5):
+ /* Here if |x|<2^-5 */
+ cmpl $0x32000000, %eax /* |x|<2^-27? */
+ jl L(arg_less_2pn27)
+
+ /* Here if 2^-27<=|x|<2^-5 */
+ movaps %xmm0, %xmm1 /* DP x */
+ mulsd %xmm0, %xmm0 /* DP x^2 */
+ movsd L(DP_SIN2_1)(%rip), %xmm3 /* DP DP_SIN2_1 */
+ mulsd %xmm0, %xmm3 /* DP x^2*DP_SIN2_1 */
+ addsd L(DP_SIN2_0)(%rip), %xmm3 /* DP DP_SIN2_0+x^2*DP_SIN2_1 */
+ mulsd %xmm0, %xmm3 /* DP x^2*DP_SIN2_0+x^4*DP_SIN2_1 */
+ mulsd %xmm1, %xmm3 /* DP x^3*DP_SIN2_0+x^5*DP_SIN2_1 */
+ addsd %xmm1, %xmm3 /* DP x+x^3*DP_SIN2_0+x^5*DP_SIN2_1 */
+ cvtsd2ss %xmm3, %xmm0 /* SP result */
+ ret
+
+ .p2align 4
+L(arg_less_2pn27):
+ cmpl $0, %eax /* x=0? */
+ je L(arg_zero) /* in case x=0 return sin(+-0)==+-0 */
+ /* Here if |x|<2^-27 */
+ /*
+ * Special cases here:
+ * sin(subnormal) raises inexact/underflow
+ * sin(min_normalized) raises inexact/underflow
+ * sin(normalized) raises inexact
+ */
+ movaps %xmm0, %xmm3 /* Copy of DP x */
+ mulsd L(DP_SMALL)(%rip), %xmm0 /* x*DP_SMALL */
+ subsd %xmm0, %xmm3 /* Result is x-x*DP_SMALL */
+ cvtsd2ss %xmm3, %xmm0 /* Result converted to SP */
+ ret
+
+ .p2align 4
+L(arg_zero):
+ movaps %xmm7, %xmm0 /* SP x */
+ ret
+
+ .p2align 4
+L(arg_inf_or_nan):
+ /* Here if |x| is Inf or NAN */
+ jne L(skip_errno_setting) /* in case of x is NaN */
+
+ /* Here if x is Inf. Set errno to EDOM. */
+ call JUMPTARGET(__errno_location)
+ movl $EDOM, (%rax)
+
+ .p2align 4
+L(skip_errno_setting):
+ /* Here if |x| is Inf or NAN. Continued. */
+ movaps %xmm7, %xmm0 /* load x */
+ subss %xmm0, %xmm0 /* Result is NaN */
+ ret
+END(__sinf)
+
+ .section .rodata, "a"
+ .p2align 3
+L(PIO4J): /* Table of j*Pi/4, for j=0,1,..,10 */
+ .long 0x00000000,0x00000000
+ .long 0x54442d18,0x3fe921fb
+ .long 0x54442d18,0x3ff921fb
+ .long 0x7f3321d2,0x4002d97c
+ .long 0x54442d18,0x400921fb
+ .long 0x2955385e,0x400f6a7a
+ .long 0x7f3321d2,0x4012d97c
+ .long 0xe9bba775,0x4015fdbb
+ .long 0x54442d18,0x401921fb
+ .long 0xbeccb2bb,0x401c463a
+ .long 0x2955385e,0x401f6a7a
+ .type L(PIO4J), @object
+ ASM_SIZE_DIRECTIVE(L(PIO4J))
+
+ .p2align 3
+L(_FPI): /* 4/Pi broken into sum of positive DP values */
+ .long 0x00000000,0x00000000
+ .long 0x6c000000,0x3ff45f30
+ .long 0x2a000000,0x3e3c9c88
+ .long 0xa8000000,0x3c54fe13
+ .long 0xd0000000,0x3aaf47d4
+ .long 0x6c000000,0x38fbb81b
+ .long 0xe0000000,0x3714acc9
+ .long 0x7c000000,0x3560e410
+ .long 0x56000000,0x33bca2c7
+ .long 0xac000000,0x31fbd778
+ .long 0xe0000000,0x300b7246
+ .long 0xe8000000,0x2e5d2126
+ .long 0x48000000,0x2c970032
+ .long 0xe8000000,0x2ad77504
+ .long 0xe0000000,0x290921cf
+ .long 0xb0000000,0x274deb1c
+ .long 0xe0000000,0x25829a73
+ .long 0xbe000000,0x23fd1046
+ .long 0x10000000,0x2224baed
+ .long 0x8e000000,0x20709d33
+ .long 0x80000000,0x1e535a2f
+ .long 0x64000000,0x1cef904e
+ .long 0x30000000,0x1b0d6398
+ .long 0x24000000,0x1964ce7d
+ .long 0x16000000,0x17b908bf
+ .type L(_FPI), @object
+ ASM_SIZE_DIRECTIVE(L(_FPI))
+
+/* Coefficients of polynomial
+ for sin(x)~=x+x^3*DP_SIN2_0+x^5*DP_SIN2_1, |x|<2^-5. */
+ .p2align 3
+L(DP_SIN2_0):
+ .long 0x5543d49d,0xbfc55555
+ .type L(DP_SIN2_0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_SIN2_0))
+
+ .p2align 3
+L(DP_SIN2_1):
+ .long 0x75cec8c5,0x3f8110f4
+ .type L(DP_SIN2_1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_SIN2_1))
+
+ .p2align 3
+L(DP_ZERONE):
+ .long 0x00000000,0x00000000 /* 0.0 */
+ .long 0x00000000,0xbff00000 /* 1.0 */
+ .type L(DP_ZERONE), @object
+ ASM_SIZE_DIRECTIVE(L(DP_ZERONE))
+
+ .p2align 3
+L(DP_ONES):
+ .long 0x00000000,0x3ff00000 /* +1.0 */
+ .long 0x00000000,0xbff00000 /* -1.0 */
+ .type L(DP_ONES), @object
+ ASM_SIZE_DIRECTIVE(L(DP_ONES))
+
+/* Coefficients of polynomial
+ for sin(t)~=t+t^3*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4)))), |t|<Pi/4. */
+ .p2align 3
+L(DP_S3):
+ .long 0x64e6b5b4,0x3ec71d72
+ .type L(DP_S3), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S3))
+
+ .p2align 3
+L(DP_S1):
+ .long 0x10c2688b,0x3f811111
+ .type L(DP_S1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S1))
+
+ .p2align 3
+L(DP_S4):
+ .long 0x1674b58a,0xbe5a947e
+ .type L(DP_S4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S4))
+
+ .p2align 3
+L(DP_S2):
+ .long 0x8b4bd1f9,0xbf2a019f
+ .type L(DP_S2), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S2))
+
+ .p2align 3
+L(DP_S0):
+ .long 0x55551cd9,0xbfc55555
+ .type L(DP_S0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_S0))
+
+ .p2align 3
+L(DP_SMALL):
+ .long 0x00000000,0x3cd00000 /* 2^(-50) */
+ .type L(DP_SMALL), @object
+ ASM_SIZE_DIRECTIVE(L(DP_SMALL))
+
+/* Coefficients of polynomial
+ for cos(t)~=1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4)))), |t|<Pi/4. */
+ .p2align 3
+L(DP_C3):
+ .long 0x9ac43cc0,0x3efa00eb
+ .type L(DP_C3), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C3))
+
+ .p2align 3
+L(DP_C1):
+ .long 0x545c50c7,0x3fa55555
+ .type L(DP_C1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C1))
+
+ .p2align 3
+L(DP_C4):
+ .long 0xdd8844d7,0xbe923c97
+ .type L(DP_C4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C4))
+
+ .p2align 3
+L(DP_C2):
+ .long 0x348b6874,0xbf56c16b
+ .type L(DP_C2), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C2))
+
+ .p2align 3
+L(DP_C0):
+ .long 0xfffe98ae,0xbfdfffff
+ .type L(DP_C0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_C0))
+
+ .p2align 3
+L(DP_PIO4):
+ .long 0x54442d18,0x3fe921fb /* Pi/4 */
+ .type L(DP_PIO4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4))
+
+ .p2align 3
+L(DP_2POW52):
+ .long 0x00000000,0x43300000 /* +2^52 */
+ .long 0x00000000,0xc3300000 /* -2^52 */
+ .type L(DP_2POW52), @object
+ ASM_SIZE_DIRECTIVE(L(DP_2POW52))
+
+ .p2align 3
+L(DP_INVPIO4):
+ .long 0x6dc9c883,0x3ff45f30 /* 4/Pi */
+ .type L(DP_INVPIO4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_INVPIO4))
+
+ .p2align 3
+L(DP_PIO4HI):
+ .long 0x54000000,0xbfe921fb /* High part of Pi/4 */
+ .type L(DP_PIO4HI), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4HI))
+
+ .p2align 3
+L(DP_PIO4LO):
+ .long 0x11A62633,0xbe010b46 /* Low part of Pi/4 */
+ .type L(DP_PIO4LO), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4LO))
+
+ .p2align 2
+L(SP_INVPIO4):
+ .long 0x3fa2f983 /* 4/Pi */
+ .type L(SP_INVPIO4), @object
+ ASM_SIZE_DIRECTIVE(L(SP_INVPIO4))
+
+ .p2align 4
+L(DP_ABS_MASK): /* Mask for getting DP absolute value */
+ .long 0xffffffff,0x7fffffff
+ .long 0xffffffff,0x7fffffff
+ .type L(DP_ABS_MASK), @object
+ ASM_SIZE_DIRECTIVE(L(DP_ABS_MASK))
+
+ .p2align 3
+L(DP_HI_MASK): /* Mask for getting high 21 bits of DP value */
+ .long 0x00000000,0xffffffff
+ .type L(DP_HI_MASK),@object
+ ASM_SIZE_DIRECTIVE(L(DP_HI_MASK))
+
+ .p2align 4
+L(SP_ABS_MASK): /* Mask for getting SP absolute value */
+ .long 0x7fffffff,0x7fffffff
+ .long 0x7fffffff,0x7fffffff
+ .type L(SP_ABS_MASK), @object
+ ASM_SIZE_DIRECTIVE(L(SP_ABS_MASK))
+
+weak_alias(__sinf, sinf)
diff --git a/libc/sysdeps/x86_64/tst-xmmymm.sh b/libc/sysdeps/x86_64/tst-xmmymm.sh
index da8af7e68..64efc6e02 100755
--- a/libc/sysdeps/x86_64/tst-xmmymm.sh
+++ b/libc/sysdeps/x86_64/tst-xmmymm.sh
@@ -1,4 +1,24 @@
#! /bin/bash
+# Make sure no code in ld.so uses xmm/ymm registers on x86-64.
+# Copyright (C) 2009-2012 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+set -e
+
objpfx="$1"
tmp=$(mktemp ${objpfx}tst-xmmymm.XXXXXX)