diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2012-03-28 22:24:59 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2012-03-28 22:24:59 +0000 |
commit | f4b59fd62358f28e23bae2fa8756913fd758299a (patch) | |
tree | aa78d41676b17cfae0c8cd3c77e0004a4c946a5e | |
parent | 11e8a843c1be2bfbacb427ca25282e6979ebb48f (diff) |
Merge changes between r17700 and r17813 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@17814 7b3dc134-2b1b-0410-93df-9e9f96275f8d
192 files changed, 3223 insertions, 2546 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog index b7ba9f57f..9069eb338 100644 --- a/libc/ChangeLog +++ b/libc/ChangeLog @@ -1,3 +1,388 @@ +2012-03-28 David S. Miller <davem@davemloft.net> + + * sysdeps/sparc/Makefile: Add -fPIC to ASFLAGS-.os here.... + * sysdeps/sparc/sparc32/Makefile: rather than here... + * sysdeps/sparc/sparc64/Makefile: and here. + +2012-03-28 Ulrich Drepper <drepper@gmail.com> + + * malloc/mallocbug.c: Avoid warnings about unused variables. + +2012-02-22 Siddhesh Poyarekar <siddhesh@redhat.com> + + [BZ #13760] + * resolv/nss_dns/dns-host.c (gaih_getanswer): Look for errno + in the right place. Discard and retry query if response is + larger than input buffer size. + +2012-03-28 Joseph Myers <joseph@codesourcery.com> + + [BZ #369] + [BZ #2678] + [BZ #3866] + * sysdeps/i386/fpu/e_pow.S (__ieee754_pow): Take absolute value of + x for large integer exponent. + * sysdeps/i386/fpu/e_powf.S (__ieee754_powf): Likewise. + * sysdeps/i386/fpu/e_powl.S (__ieee754_powl): Likewise. Adjust + sign of result as needed afterwards. + * sysdeps/x86_64/fpu/e_powl.S (__ieee754_powl): Likewise. + * sysdeps/ieee754/k_standard.c (__kernel_standard): Handle sign of + result for underflowing pow the same as for overflow. + (__kernel_standard_l): Handle powl overflow and underflow here + rather than calling __kernel_standard. + * math/libm-test.inc (pow_test): Add more tests. + + [BZ #3868] + [BZ #13879] + [BZ #13910] + [BZ #13911] + [BZ #13912] + [BZ #13913] + [BZ #13915] + [BZ #13916] + [BZ #13917] + [BZ #13918] + [BZ #13919] + [BZ #13920] + [BZ #13921] + * sysdeps/generic/math_private.h (__kernel_standard_l): Declare. + * sysdeps/ieee754/k_standard.c: Include <float.h>. + (__kernel_standard_l): New function. + * math/w_acoshl.c (__acoshl): Use __kernel_standard_l instead of + __kernel_standard. + * math/w_acosl.c (__acosl): Likewise. + * math/w_asinl.c (__asinl): Likewise. + * math/w_atan2l.c (__atan2l): Likewise. + * math/w_atanhl.c (__atanhl): Likewise. + * math/w_coshl.c (__coshl): Likewise. + * math/w_exp10l.c (__exp10l): Likewise. + * math/w_exp2l.c (__exp2l): Likewise. + * math/w_fmodl.c (__fmodl): Likewise. + * math/w_hypotl.c (__hypotl): Likewise. + * math/w_j0l.c (__j0l, __y0l): Likewise. + * math/w_j1l.c (__j1l, __y1l): Likewise. + * math/w_jnl.c (__jnl, __ynl): Likewise. + * math/w_lgammal.c (__lgammal): Likewise. + * math/w_log10l.c (__log10l): Likewise. + * math/w_log2l.c (__log2l): Likewise. + * math/w_logl.c (__logl): Likewise. + * math/w_powl.c (__powl): Likewise. + * math/w_remainderl.c (__remainderl): Likewise. + * math/w_scalbl.c (sysv_scalbl): Likewise. + * math/w_sinhl.c (__sinhl): Likewise. + * math/w_sqrtl.c (__sqrtl): Likewise. + * math/w_tgammal.c (__tgammal): Likewise. + * sysdeps/ieee754/ldbl-128/w_expl.c (__expl): Likewise. + * sysdeps/ieee754/ldbl-96/w_expl.c (__expl): Likewise. + * math/libm-test.inc (acos_test): Add more tests. + (acosh_test): Likewise. + (asin_test): Likewise. + (atanh_test): Likewise. + (exp_test): Likewise. + (exp10_test): Likewise. + (exp2_test): Likewise. + (expm1_test): Likewise. + (lgamma_test): Likewise. + (log_test): Likewise. + (log10_test): Likewise. + (log1p_test): Likewise. + (log2_test): Likewise. + (pow_test): Do not allow some spurious overflow exceptions. + (sqrt_test): Add more tests. + (tgamma_test): Likewise. + (y0_test): Likewise. + (y1_test): Likewise. + (yn_test): Likewise. + +2012-03-27 Anton Blanchard <anton@samba.org> + + * sysdeps/unix/sysv/linux/powerpc/bits/mman.h: Define MAP_STACK and + MAP_HUGETLB. + * sysdeps/unix/sysv/linux/s390/bits/mman.h: Likewise. + * sysdeps/unix/sysv/linux/sh/bits/mman.h: Likewise. + * sysdeps/unix/sysv/linux/sparc/bits/mman.h: Likewise. + +2012-03-27 David S. Miller <davem@davemloft.net> + + * conform/Makefile: Run run-conformtest.sh using $(BASH). + + * sysdeps/sparc/sparc64/Makefile (ASFLAGS-.os): Move before + have-as-vis3 check. + +2012-03-27 Andreas Jaeger <aj@suse.de> + + * sysdeps/x86_64/elf/configure.in: Moved to ... + * sysdeps/x86_64/configure.in: ... here. + * sysdeps/x86_64/elf/start.S: Moved to ... + * sysdeps/x86_64/start.S: ... here. + * sysdeps/x86_64/elf/configure: Delete. + + * sysdeps/x86_64/configure.in: Merge contents from + sysdeps/i386/configure.in (without i686 check). + + * sysdeps/i386/elf/Versions: Merge into ... + * sysdeps/i386/Versions: ... this. + * sysdeps/i386/elf/Versions: Delete file. + * sysdeps/i386/elf/start.S: Moved to ... + * sysdeps/i386/start.S: ...here. + * sysdeps/i386/elf/configure.in: Merge into... + * sysdeps/i386/configure.in: ...here. + * sysdeps/i386/elf/configure.in: Delete file. + * sysdeps/i386/elf/configure: Delete file. + + * sysdeps/generic/elf/backtracesyms.c: Moved to ... + * debug/backtracesyms.c: ... here. + * sysdeps/generic/elf/backtracesymsfd.c: Moved to ... + * debug/backtracesymsfd.c: ... here. + * sysdeps/generic/elf/ifunc-sel.h: Moved to ... + * sysdeps/generic/ifunc-sel.h: ... here. + + * sysdeps/unix/i386/start.c: Delete file. + * sysdeps/unix/sparc/start.c: Delete file. + * sysdeps/unix/start.c: Delete file. + + * sysdeps/sh/elf/configure.in: Moved to ... + * sysdeps/sh/configure.in: ... here. + * sysdeps/sh/elf/start.S: Moved to ... + * sysdeps/sh/start.S: ... here. + * sysdeps/sh/elf/configure: Delete file. + + * sysdeps/powerpc/powerpc64/elf/bzero.S: Moved to ... + * sysdeps/powerpc/powerpc64/bzero.S: ... here. + * sysdeps/powerpc/powerpc64/elf/entry.h: Moved to ... + * sysdeps/powerpc/powerpc64/entry.h: ... here. + * sysdeps/powerpc/powerpc64/elf/start.S: Moved to ... + * sysdeps/powerpc/powerpc64/start.S: here. + * sysdeps/powerpc/powerpc64/elf/Makefile: Merge into ... + * sysdeps/powerpc/powerpc64/Makefile: ... this. + * sysdeps/powerpc/powerpc64/elf/configure.in: Merge into ... + * sysdeps/powerpc/powerpc64/configure.in: ... this. + * sysdeps/powerpc/powerpc64/elf/configure: Delete file. + + * sysdeps/powerpc/powerpc32/elf/bzero.S: Moved to ... + * sysdeps/powerpc/powerpc32/bzero.S: ... here. + * sysdeps/powerpc/powerpc32/elf/start.S: Moved to ... + * sysdeps/powerpc/powerpc32/start.S: ... here. + * sysdeps/powerpc/powerpc32/elf/configure.in: Merge into ... + * sysdeps/powerpc/powerpc32/configure.in: ... this. + * sysdeps/powerpc/powerpc32/elf/configure: Delete file. + + * sysdeps/powerpc/elf/ifunc-sel.h: Moved to ... + * sysdeps/powerpc/ifunc-sel.h: ... here. + * sysdeps/powerpc/elf/rtld-global-offsets.sym: Moved to ... + * sysdeps/powerpc/rtld-global-offsets.sym: ... here. + + * sysdeps/sparc/elf/configure.in: Moved to ... + * sysdeps/sparc/configure.in: ... here. + * sysdeps/sparc/elf/configure: Delete file. + * sysdeps/sparc/sparc32/elf/start.S: Moved to ... + * sysdeps/sparc/sparc32/start.S: ... here. + * sysdeps/sparc/sparc64/elf/start.S: Moved to ... + * sysdeps/sparc/sparc64/start.S: ... here. + * sysdeps/sparc/sparc32/elf/Makefile: Merged into ... + * sysdeps/sparc/sparc32/Makefile: ... this. + * sysdeps/sparc/sparc64/elf/Makefile: Merged into ... + * sysdeps/sparc/sparc64/Makefile: ... this. + + * sysdeps/s390/s390-32/elf/bsd-_setjmp.S: Moved to ... + * sysdeps/s390/s390-32/bsd-_setjmp.S: ... here. + * sysdeps/s390/s390-32/elf/bsd-setjmp.S: Moved to ... + * sysdeps/s390/s390-32/bsd-setjmp.S: ... here. + * sysdeps/s390/s390-32/elf/setjmp.S: Moved to ... + * sysdeps/s390/s390-32/setjmp.S: ... here. + * sysdeps/s390/s390-32/elf/configure.in: Moved to ... + * sysdeps/s390/s390-32/configure.in: ... here. + * sysdeps/s390/s390-32/elf/configure: Delete file. + * sysdeps/s390/s390-32/elf/start.S: Moved to ... + * sysdeps/s390/s390-32/start.S: ... here. + + * sysdeps/s390/s390-64/elf/bsd-_setjmp.S: Moved to ... + * sysdeps/s390/s390-64/bsd-_setjmp.S: ... here. + * sysdeps/s390/s390-64/elf/bsd-setjmp.S: Moved to ... + * sysdeps/s390/s390-64/bsd-setjmp.S: ... here. + * sysdeps/s390/s390-64/elf/setjmp.S: Moved to ... + * sysdeps/s390/s390-64/setjmp.S: ... here. + * sysdeps/s390/s390-64/elf/configure.in: Moved to ... + * sysdeps/s390/s390-64/configure.in: ... here + * sysdeps/s390/s390-64/elf/configure: Delete file. + * sysdeps/s390/s390-64/elf/start.S: Moved to ... + * sysdeps/s390/s390-64/start.S: ... here. + * sysdeps/s390/s390-64/elf/configure: Delete. + + * configure.in: Remove support for elf directories in sysdeps. + + * configure: Regenerated. + * sysdeps/i386/configure: Regenerated. + * sysdeps/powerpc/powerpc32/configure: Regenerated. + * sysdeps/powerpc/powerpc64/configure: Regenerated. + * sysdeps/s390/s390-32/configure: Regenerated. + * sysdeps/s390/s390-64/configure: Regenerated. + * sysdeps/sh/configure: Regenerated. + * sysdeps/sparc/configure: Regenerated. + * sysdeps/x86_64/configure: Regenerated. + +2012-03-26 Andreas Schwab <schwab@linux-m68k.org> + + * sysdeps/powerpc/fpu/libm-test-ulps: Update. + + * sysdeps/ieee754/ldbl-128ibm/e_expl.c (lomark): Adjust to take + denormal result into account. + +2012-03-25 Roland McGrath <roland@hack.frob.com> + + * posix/confstr.c (confstr): Lift RESTENVS definition to function scope. + Reported by Allan McRae <allan@archlinux.org>. + +2012-03-23 Jeff Law <law@redhat.com> + + * nss/getnssent.c (__nss_getent): Fix typo. + +2012-03-23 David S. Miller <davem@davemloft.net> + + * sysdeps/sparc/fpu/libm-test-ulps: Update. + +2012-03-23 H.J. Lu <hongjiu.lu@intel.com> + + * sysdeps/x86_64/dl-tlsdesc.h (tlsdesc): Use anonymous union + to pad to uint64_t for each field. + (dl_tls_index): Replace unsigned long with uint64_t. + +2012-03-23 Daniel Jacobowitz <dmj@google.com> + Paul Pluzhnikov <ppluzhnikov@google.com> + + [BZ #6528] + * grp/Makefile (otherlibs): Don't set it. + * inet/Makefile (otherlibs): Likewise. + * login/Makefile (otherlibs): Likewise. + * nscd/Makefile (otherlibs): Likewise. + * posix/Makefile (otherlibs): Likewise. + * pwd/Makefile (otherlibs): Likewise. + * rt/Makefile (otherlibs): Likewise. + * sunrpc/Makefile (otherlibs): Likewise. + * nss/Makefile (otherlibs): Likewise. + Add libnss_files to routines and static-only-routines. + ($(objpfx)getent): Remove rule. + * resolv/Makefile: Add libnss_dns and libresolv to routines and + static-only-routines. + +2012-03-22 Joseph Myers <joseph@codesourcery.com> + + [BZ #13892] + * math/s_cexp.c: Include <float.h>. + (__cexp): Handle exp result overflowing not necessarily + overflowing both real and imaginary parts of result. + * math/s_cexpf.c: Likewise. + * math/s_cexpl.c: Likewise. + * math/libm-test.inc (cexp_test): Add more tests. + * sysdeps/i386/fpu/libm-test-ulps: Update. + * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. + +2012-03-22 H.J. Lu <hongjiu.lu@intel.com> + + * include/link.h (ELFW): New macro. + * sysdeps/x86_64/dl-irel.h: Replace Elf64_XXX with ElfW(XXX). + Replace ELF64_R_TYPE with ELFW(R_TYPE). + +2012-03-22 H.J. Lu <hongjiu.lu@intel.com> + + * sysdeps/x86_64/dl-tls.h (dl_tls_index): Replace unsigned long + with uint64_t. + +2012-03-22 H.J. Lu <hongjiu.lu@intel.com> + + * sysdeps/generic/ldsodefs.h (struct La_x32_regs): New forward + declaration. + (struct La_x32_retval): Likewise. + +2012-03-22 H.J. Lu <hongjiu.lu@intel.com> + + * sysdeps/x86_64/preconfigure.in: New file. + * sysdeps/x86_64/preconfigure: New generated file. + +2012-03-22 Joseph Myers <joseph@codesourcery.com> + + [BZ #13824] + * math/e_exp2l.c: Include <float.h>. + (__ieee754_exp2l): Handle overflow and underflow cases + separately. Only pass fractional part of argument to + __ieee754_expl. + * math/libm-test.inc (exp2_test): Add more tests. + + * sysdeps/ieee754/ldbl-128/k_cosl.c (__kernel_cosl): Negate y if + negating x to take absolute value. + * sysdeps/ieee754/ldbl-128/k_sincosl.c (__kernel_sincosl): + Likewise. + * sysdeps/ieee754/ldbl-128ibm/k_cosl.c (__kernel_cosl): Likewise. + * sysdeps/ieee754/ldbl-128ibm/k_sincosl.c (__kernel_sincosl): + Likewise. + * sysdeps/ieee754/ldbl-128/k_sinl.c (__kernel_sinl): Negate y when + computing low part if x was negated. + * sysdeps/ieee754/ldbl-128ibm/k_sinl.c (__kernel_sinl): Likewise. + +2012-03-21 H.J. Lu <hongjiu.lu@intel.com> + + * elf/tst-auditmod1.c: Support la_x32_gnu_pltenter and + la_x32_gnu_pltexit. + (pltexit): Cast int_retval to ptrdiff_t. + * elf/tst-auditmod3b.c: Likewise. + * elf/tst-auditmod4b.c: Likewise. + * elf/tst-auditmod5b.c: Likewise. + * elf/tst-auditmod6b.c: Likewise. + * elf/tst-auditmod6c.c: Likewise. + * elf/tst-auditmod7b.c: Likewise. + + * sysdeps/generic/ldsodefs.h (audit_ifaces): Add x32_gnu_pltenter + and x32_gnu_pltexit. + + * sysdeps/x86_64/bits/link.h: Check __x86_64__ instead of + __ELF_NATIVE_CLASS. + (La_x32_regs): New macro. + (La_x32_retval): Likewise. + (la_x32_gnu_pltenter): New function prototype. + (la_x32_gnu_pltexit): Likewise. + +2012-03-21 Andreas Schwab <schwab@linux-m68k.org> + + * sysdeps/ieee754/ldbl-128ibm/e_powl.c (huge, tiny): Correct + exponent. + + * sysdeps/powerpc/fpu/libm-test-ulps: Update. + + * configure.in (libc_cv_cc_nofma): Check for option to disable + generation of FMA instructions. + * configure: Regenerate. + * config.make.in (config-cflags-nofma): Set from libc_cv_cc_nofma. + * sysdeps/ieee754/dbl-64/Makefile: New file. + * sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines): + Remove brandred-fma4. + (CFLAGS-brandred-fma4.c): Remove. + * sysdeps/x86_64/fpu/multiarch/brandred-fma4.c: Remove. + * sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c (__branred): Don't + define. + * sysdeps/x86_64/fpu/multiarch/s_tan-fma4.c (__branred): Don't + define. + +2012-03-21 H.J. Lu <hongjiu.lu@intel.com> + + * stdio-common/_itoa.c: Check _ITOA_NEEDED instead of + LLONG_MAX != LONG_MAX. + (_itoa_word): Use _ITOA_WORD_TYPE on value. + (_fitoa_word): Likewise. + * stdio-common/_itowa.c: Check _ITOA_NEEDED instead of + LLONG_MAX != LONG_MAX. + * stdio-common/_itowa.h: Include <_itoa.h>. + (_itowa_word): Use _ITOA_WORD_TYPE on value. + (_itowa): New macro. Defined only if _ITOA_NEEDED is false. + * sysdeps/generic/_itoa.h (_ITOA_NEEDED): New macro. Defined + only if not defined. + (_ITOA_WORD_TYPE): Likewise. + (_itoa_word): Use _ITOA_WORD_TYPE on value. + Check !_ITOA_NEEDED instead of LONG_MAX == LLONG_MAX. + +2012-03-21 David S. Miller <davem@davemloft.net> + + * sysdeps/sparc/fpu/libm-test-ulps: Update. + 2012-03-21 H.J. Lu <hongjiu.lu@intel.com> * sysdeps/unix/sysv/linux/configure.in: Check x86_64* instead @@ -20,9 +405,9 @@ 2012-03-21 Thomas Schwinge <thomas@codesourcery.com> - * conform/conformtest.pl: Handle --tmpdir argument, defaulting to /tmp. - * conform/run-conformtest.sh: Pass --tmpdir argument when invoking - conformtest.pl + * conform/conformtest.pl: Handle --tmpdir argument, defaulting to /tmp. + * conform/run-conformtest.sh: Pass --tmpdir argument when invoking + conformtest.pl 2012-03-21 Joseph Myers <joseph@codesourcery.com> @@ -9,14 +9,16 @@ Version 2.16 * The following bugs are resolved with this release: - 174, 350, 411, 2541, 2547, 2548, 2551, 2552, 2553, 2554, 2562, 2563, 2565, - 2566, 2576, 3335, 3976, 3992, 4026, 4108, 4596, 4822, 5077, 5461, 5805, - 5993, 6471, 6884, 6907, 6911, 9739, 9902, 10110, 10135, 10140, 10210, - 10545, 10716, 11174, 11322, 11365, 11451, 11494, 12047, 13058, 13525, - 13526, 13527, 13528, 13529, 13530, 13531, 13532, 13533, 13547, 13551, - 13552, 13553, 13555, 13559, 13566, 13583, 13618, 13637, 13656, 13658, - 13673, 13695, 13704, 13706, 13726, 13738, 13786, 13792, 13806, 13840, - 13841, 13844, 13846, 13851, 13852, 13854, 13871, 13883 + 174, 350, 369, 411, 2541, 2547, 2548, 2551, 2552, 2553, 2554, 2562, 2563, + 2565, 2566, 2576, 2678, 3335, 3866, 3868, 3976, 3992, 4026, 4108, 4596, + 4822, 5077, 5461, 5805, 5993, 6471, 6730, 6884, 6907, 6911, 9739, 9902, + 10110, 10135, 10140, 10210, 10545, 10716, 11174, 11322, 11365, 11451, + 11494, 12047, 13058, 13525, 13526, 13527, 13528, 13529, 13530, 13531, + 13532, 13533, 13547, 13551, 13552, 13553, 13555, 13559, 13566, 13583, + 13618, 13637, 13656, 13658, 13673, 13695, 13704, 13706, 13726, 13738, + 13760, 13786, 13792, 13806, 13824, 13840, 13841, 13844, 13846, 13851, + 13852, 13854, 13871, 13879, 13883, 13892, 13910, 13911, 13912, 13913, + 13915, 13916, 13917, 13918, 13919, 13920, 13921 * ISO C11 support: diff --git a/libc/config.make.in b/libc/config.make.in index 8568d9e05..47b3e51e9 100644 --- a/libc/config.make.in +++ b/libc/config.make.in @@ -38,6 +38,7 @@ config-cflags-sse4 = @libc_cv_cc_sse4@ config-cflags-avx = @libc_cv_cc_avx@ config-cflags-sse2avx = @libc_cv_cc_sse2avx@ config-cflags-novzeroupper = @libc_cv_cc_novzeroupper@ +config-cflags-nofma = @libc_cv_cc_nofma@ config-asflags-i686 = @libc_cv_as_i686@ defines = @DEFINES@ diff --git a/libc/configure b/libc/configure index 087a4cdd5..dfae166d2 100755 --- a/libc/configure +++ b/libc/configure @@ -618,6 +618,7 @@ ldd_rewrite_script use_ldconfig libc_cv_sparc_as_vis3 libc_cv_as_i686 +libc_cv_cc_nofma libc_cv_cc_fma4 libc_cv_cc_novzeroupper libc_cv_cc_sse2avx @@ -4372,27 +4373,6 @@ fi # We have now validated the configuration. - -# Look for an `elf' subdirectory of each machine directory. -# We prepend these rather than inserting them whereever the machine appears -# because things specified by the machine's ELF ABI should override -# OS-specific things, and should always be the same for any OS on the -# machine (otherwise what's the point of an ABI?). -elf_dirs= -for d in $add_ons_pfx ''; do - for m in $mach; do - try="${d}sysdeps$m/elf" - case $d in - /*) try_srcdir= ;; - *) try_srcdir=$srcdir/ ;; - esac - if test -d $try_srcdir$try; then - elf_dirs="$elf_dirs $try" - fi - done -done -sysnames="`echo $elf_dirs | sed -e 's,//,/,g'` $sysnames" - # Peek into option-groups.config to check if sysdeps/ieee754/[l]dbl-wrap needs # to be included into $sysnames. grep "OPTION_EGLIBC_LIBM_BIG = n" option-groups.config > /dev/null 2>&1 @@ -4496,7 +4476,7 @@ $as_echo "$as_me: WARNING: $name/Implies specifies nonexistent $x" >&2;} done # Add the default directories. -default_sysnames="sysdeps/generic/elf sysdeps/generic" +default_sysnames="sysdeps/generic" sysnames="$names $default_sysnames" # The other names were emitted during the scan. @@ -7110,6 +7090,26 @@ if test "$libc_cv_gcc_tls_model_attr" = no; then as_fn_error $? "support for the tls_model attribute is required" "$LINENO" 5 fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler option to disable generation of FMA instructions" >&5 +$as_echo_n "checking for compiler option to disable generation of FMA instructions... " >&6; } +if ${libc_cv_cc_nofma+:} false; then : + $as_echo_n "(cached) " >&6 +else + libc_cv_cc_nofma= +for opt in -ffp-contract=off -mno-fused-madd; do + if { ac_try='${CC-cc} $opt -xc /dev/null -S -o /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + libc_cv_cc_nofma=$opt; break +fi +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_nofma" >&5 +$as_echo "$libc_cv_cc_nofma" >&6; } + if test -n "$submachine"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler option for CPU variant" >&5 $as_echo_n "checking for compiler option for CPU variant... " >&6; } @@ -7732,6 +7732,7 @@ 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 : diff --git a/libc/configure.in b/libc/configure.in index 0cd73b692..d60877c80 100644 --- a/libc/configure.in +++ b/libc/configure.in @@ -748,27 +748,6 @@ AC_SUBST(submachine) # We have now validated the configuration. - -# Look for an `elf' subdirectory of each machine directory. -# We prepend these rather than inserting them whereever the machine appears -# because things specified by the machine's ELF ABI should override -# OS-specific things, and should always be the same for any OS on the -# machine (otherwise what's the point of an ABI?). -elf_dirs= -for d in $add_ons_pfx ''; do - for m in $mach; do - try="${d}sysdeps$m/elf" - case $d in - /*) try_srcdir= ;; - *) try_srcdir=$srcdir/ ;; - esac - if test -d $try_srcdir$try; then - elf_dirs="$elf_dirs $try" - fi - done -done -sysnames="`echo $elf_dirs | sed -e 's,//,/,g'` $sysnames" - # Peek into option-groups.config to check if sysdeps/ieee754/[l]dbl-wrap needs # to be included into $sysnames. grep "OPTION_EGLIBC_LIBM_BIG = n" option-groups.config > /dev/null 2>&1 @@ -873,7 +852,7 @@ changequote([,])dnl done # Add the default directories. -default_sysnames="sysdeps/generic/elf sysdeps/generic" +default_sysnames="sysdeps/generic" sysnames="$names $default_sysnames" AC_SUBST(sysnames) # The other names were emitted during the scan. @@ -2020,6 +1999,14 @@ if test "$libc_cv_gcc_tls_model_attr" = no; then AC_MSG_ERROR([support for the tls_model attribute is required]) fi +dnl Determine how to disable generation of FMA instructions. +AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions], + libc_cv_cc_nofma, [dnl +libc_cv_cc_nofma= +for opt in -ffp-contract=off -mno-fused-madd; do + LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break]) +done]) + if test -n "$submachine"; then AC_CACHE_CHECK([for compiler option for CPU variant], libc_cv_cc_submachine, [dnl @@ -2163,6 +2150,7 @@ AC_SUBST(libc_cv_cc_avx) AC_SUBST(libc_cv_cc_sse2avx) AC_SUBST(libc_cv_cc_novzeroupper) AC_SUBST(libc_cv_cc_fma4) +AC_SUBST(libc_cv_cc_nofma) AC_SUBST(libc_cv_as_i686) AC_SUBST(libc_cv_sparc_as_vis3) diff --git a/libc/conform/Makefile b/libc/conform/Makefile index 4915a67b1..ae9ac141e 100644 --- a/libc/conform/Makefile +++ b/libc/conform/Makefile @@ -31,7 +31,7 @@ endif $(objpfx)run-conformtest.out: run-conformtest.sh conformtest.pl \ $(wildcard data/*.h-data) \ $(wildcard data/*/*.h-data) - -$(SHELL) -e $< $(objpfx) $(PERL) '$(CC)' \ + -$(BASH) -e $< $(objpfx) $(PERL) '$(CC)' \ '-I../include $(+sysdep-includes) $(sysincludes) -I..' generated = $(wildcard $(objpfx)conform-*.out) diff --git a/libc/debug/backtracesyms.c b/libc/debug/backtracesyms.c index a0106647f..3fabf26a8 100644 --- a/libc/debug/backtracesyms.c +++ b/libc/debug/backtracesyms.c @@ -1,5 +1,5 @@ /* Return list with names for address in backtrace. - 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 Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -17,13 +17,20 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#include <assert.h> #include <execinfo.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> +#include <ldsodefs.h> -/* Assume the worst for the width of an address. */ -#define WORD_WIDTH 16 +#if __ELF_NATIVE_CLASS == 32 +# define WORD_WIDTH 8 +#else +/* We assyme 64bits. */ +# define WORD_WIDTH 16 +#endif char ** @@ -31,16 +38,37 @@ __backtrace_symbols (array, size) void *const *array; int size; { + Dl_info info[size]; + int status[size]; int cnt; size_t total = 0; char **result; - /* We can compute the text size needed for the symbols since we print - them all as "[+0x<addr>]". */ - total = size * (WORD_WIDTH + 6); + /* Fill in the information we can get from `dladdr'. */ + for (cnt = 0; cnt < size; ++cnt) + { + struct link_map *map; + status[cnt] = _dl_addr (array[cnt], &info[cnt], &map, NULL); + if (status[cnt] && info[cnt].dli_fname && info[cnt].dli_fname[0] != '\0') + { + /* We have some info, compute the length of the string which will be + "<file-name>(<sym-name>+offset) [address]. */ + total += (strlen (info[cnt].dli_fname ?: "") + + strlen (info[cnt].dli_sname ?: "") + + 3 + WORD_WIDTH + 3 + WORD_WIDTH + 5); + + /* The load bias is more useful to the user than the load + address. The use of these addresses is to calculate an + address in the ELF file, so its prelinked bias is not + something we want to subtract out. */ + info[cnt].dli_fbase = (void *) map->l_addr; + } + else + total += 5 + WORD_WIDTH; + } /* Allocate memory for the result. */ - result = malloc (size * sizeof (char *) + total); + result = (char **) malloc (size * sizeof (char *) + total); if (result != NULL) { char *last = (char *) (result + size); @@ -48,8 +76,45 @@ __backtrace_symbols (array, size) for (cnt = 0; cnt < size; ++cnt) { result[cnt] = last; - last += 1 + sprintf (last, "[+%p]", array[cnt]); + + if (status[cnt] + && info[cnt].dli_fname != NULL && info[cnt].dli_fname[0] != '\0') + { + if (info[cnt].dli_sname == NULL) + /* We found no symbol name to use, so describe it as + relative to the file. */ + info[cnt].dli_saddr = info[cnt].dli_fbase; + + if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0) + last += 1 + sprintf (last, "%s(%s) [%p]", + info[cnt].dli_fname ?: "", + info[cnt].dli_sname ?: "", + array[cnt]); + else + { + char sign; + ptrdiff_t offset; + if (array[cnt] >= (void *) info[cnt].dli_saddr) + { + sign = '+'; + offset = array[cnt] - info[cnt].dli_saddr; + } + else + { + sign = '-'; + offset = info[cnt].dli_saddr - array[cnt]; + } + + last += 1 + sprintf (last, "%s(%s%c%#tx) [%p]", + info[cnt].dli_fname ?: "", + info[cnt].dli_sname ?: "", + sign, offset, array[cnt]); + } + } + else + last += 1 + sprintf (last, "[%p]", array[cnt]); } + assert (last <= (char *) result + size * sizeof (char *) + total); } return result; diff --git a/libc/debug/backtracesymsfd.c b/libc/debug/backtracesymsfd.c index 2345853d8..297e32d6b 100644 --- a/libc/debug/backtracesymsfd.c +++ b/libc/debug/backtracesymsfd.c @@ -1,5 +1,5 @@ /* Write formatted list with names for addresses in backtrace to a file. - Copyright (C) 1998, 2003, 2005 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. @@ -22,7 +22,7 @@ #include <sys/uio.h> #include <_itoa.h> -#include <not-cancel.h> +#include <ldsodefs.h> #if __ELF_NATIVE_CLASS == 32 # define WORD_WIDTH 8 @@ -38,25 +38,87 @@ __backtrace_symbols_fd (array, size, fd) int size; int fd; { - struct iovec iov[3]; + struct iovec iov[9]; int cnt; for (cnt = 0; cnt < size; ++cnt) { char buf[WORD_WIDTH]; + char buf2[WORD_WIDTH]; + Dl_info info; + struct link_map *map; + size_t last = 0; - iov[0].iov_base = (void *) "[0x"; - iov[0].iov_len = 3; + if (_dl_addr (array[cnt], &info, &map, NULL) + && info.dli_fname != NULL && info.dli_fname[0] != '\0') + { + /* Name of the file. */ + iov[0].iov_base = (void *) info.dli_fname; + iov[0].iov_len = strlen (info.dli_fname); + last = 1; - iov[1].iov_base = _itoa_word ((unsigned long int) array[cnt], - &buf[WORD_WIDTH], 16, 0); - iov[1].iov_len = &buf[WORD_WIDTH] - (char *) iov[1].iov_base; + if (info.dli_sname != NULL || map->l_addr != 0) + { + size_t diff; - iov[2].iov_base = (void *) "]\n"; - iov[2].iov_len = 2; + iov[last].iov_base = (void *) "("; + iov[last].iov_len = 1; + ++last; - /* We prefer to use the non-cancelable interface if it is available. */ - writev_not_cancel_no_status (fd, iov, 3); + if (info.dli_sname != NULL) + { + /* We have a symbol name. */ + iov[last].iov_base = (void *) info.dli_sname; + iov[last].iov_len = strlen (info.dli_sname); + ++last; + } + else + /* We have no symbol, so describe it as relative to the file. + The load bias is more useful to the user than the load + address. The use of these addresses is to calculate an + address in the ELF file, so its prelinked bias is not + something we want to subtract out. */ + info.dli_saddr = (void *) map->l_addr; + + if (array[cnt] >= (void *) info.dli_saddr) + { + iov[last].iov_base = (void *) "+0x"; + diff = array[cnt] - info.dli_saddr; + } + else + { + iov[last].iov_base = (void *) "-0x"; + diff = info.dli_saddr - array[cnt]; + } + iov[last].iov_len = 3; + ++last; + + iov[last].iov_base = _itoa_word ((unsigned long int) diff, + &buf2[WORD_WIDTH], 16, 0); + iov[last].iov_len = (&buf2[WORD_WIDTH] + - (char *) iov[last].iov_base); + ++last; + + iov[last].iov_base = (void *) ")"; + iov[last].iov_len = 1; + ++last; + } + } + + iov[last].iov_base = (void *) "[0x"; + iov[last].iov_len = 3; + ++last; + + iov[last].iov_base = _itoa_word ((unsigned long int) array[cnt], + &buf[WORD_WIDTH], 16, 0); + iov[last].iov_len = &buf[WORD_WIDTH] - (char *) iov[last].iov_base; + ++last; + + iov[last].iov_base = (void *) "]\n"; + iov[last].iov_len = 2; + ++last; + + __writev (fd, iov, last); } } weak_alias (__backtrace_symbols_fd, backtrace_symbols_fd) diff --git a/libc/elf/tst-auditmod1.c b/libc/elf/tst-auditmod1.c index 69da278f2..67fc758ac 100644 --- a/libc/elf/tst-auditmod1.c +++ b/libc/elf/tst-auditmod1.c @@ -109,10 +109,17 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook, # define La_retval La_i86_retval # define int_retval lrv_eax #elif defined __x86_64__ -# define pltenter la_x86_64_gnu_pltenter -# define pltexit la_x86_64_gnu_pltexit -# define La_regs La_x86_64_regs -# define La_retval La_x86_64_retval +# ifdef __LP64__ +# define pltenter la_x86_64_gnu_pltenter +# define pltexit la_x86_64_gnu_pltexit +# define La_regs La_x86_64_regs +# define La_retval La_x86_64_retval +# else +# define pltenter la_x32_gnu_pltenter +# define pltexit la_x32_gnu_pltexit +# define La_regs La_x32_regs +# define La_retval La_x32_retval +# endif # define int_retval lrv_rax #elif defined __powerpc__ && __WORDSIZE == 32 # define pltenter la_ppc32_gnu_pltenter @@ -188,7 +195,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook, const char *symname) { printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n", - symname, (long int) sym->st_value, ndx, outregs->int_retval); + symname, (long int) sym->st_value, ndx, + (ptrdiff_t) outregs->int_retval); return 0; } diff --git a/libc/elf/tst-auditmod3b.c b/libc/elf/tst-auditmod3b.c index 388ed6e49..921eaca55 100644 --- a/libc/elf/tst-auditmod3b.c +++ b/libc/elf/tst-auditmod3b.c @@ -105,10 +105,17 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook, return sym->st_value; } -#define pltenter la_x86_64_gnu_pltenter -#define pltexit la_x86_64_gnu_pltexit -#define La_regs La_x86_64_regs -#define La_retval La_x86_64_retval +#ifdef __LP64__ +# define pltenter la_x86_64_gnu_pltenter +# define pltexit la_x86_64_gnu_pltexit +# define La_regs La_x86_64_regs +# define La_retval La_x86_64_retval +#else +# define pltenter la_x32_gnu_pltenter +# define pltexit la_x32_gnu_pltexit +# define La_regs La_x32_regs +# define La_retval La_x32_retval +#endif #define int_retval lrv_rax #include <tst-audit.h> @@ -140,7 +147,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook, const char *symname) { printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n", - symname, (long int) sym->st_value, ndx, outregs->int_retval); + symname, (long int) sym->st_value, ndx, + (ptrdiff_t) outregs->int_retval); __m128i xmm = _mm_set1_epi32 (-1); asm volatile ("movdqa %0, %%xmm0" : : "x" (xmm) : "xmm0" ); diff --git a/libc/elf/tst-auditmod4b.c b/libc/elf/tst-auditmod4b.c index 761d97ce9..75e85582b 100644 --- a/libc/elf/tst-auditmod4b.c +++ b/libc/elf/tst-auditmod4b.c @@ -94,10 +94,17 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook, return sym->st_value; } -#define pltenter la_x86_64_gnu_pltenter -#define pltexit la_x86_64_gnu_pltexit -#define La_regs La_x86_64_regs -#define La_retval La_x86_64_retval +#ifdef __LP64__ +# define pltenter la_x86_64_gnu_pltenter +# define pltexit la_x86_64_gnu_pltexit +# define La_regs La_x86_64_regs +# define La_retval La_x86_64_retval +#else +# define pltenter la_x32_gnu_pltenter +# define pltexit la_x32_gnu_pltexit +# define La_regs La_x32_regs +# define La_retval La_x32_retval +#endif #define int_retval lrv_rax #include <tst-audit.h> @@ -177,7 +184,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook, const char *symname) { printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n", - symname, (long int) sym->st_value, ndx, outregs->int_retval); + symname, (long int) sym->st_value, ndx, + (ptrdiff_t) outregs->int_retval); #ifdef __AVX__ if (check_avx () && strcmp (symname, "audit_test") == 0) diff --git a/libc/elf/tst-auditmod5b.c b/libc/elf/tst-auditmod5b.c index 7e1e94112..d2443c8d2 100644 --- a/libc/elf/tst-auditmod5b.c +++ b/libc/elf/tst-auditmod5b.c @@ -95,10 +95,17 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook, return sym->st_value; } -#define pltenter la_x86_64_gnu_pltenter -#define pltexit la_x86_64_gnu_pltexit -#define La_regs La_x86_64_regs -#define La_retval La_x86_64_retval +#ifdef __LP64__ +# define pltenter la_x86_64_gnu_pltenter +# define pltexit la_x86_64_gnu_pltexit +# define La_regs La_x86_64_regs +# define La_retval La_x86_64_retval +#else +# define pltenter la_x32_gnu_pltenter +# define pltexit la_x32_gnu_pltexit +# define La_regs La_x32_regs +# define La_retval La_x32_retval +#endif #define int_retval lrv_rax #include <tst-audit.h> @@ -150,7 +157,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook, const char *symname) { printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n", - symname, (long int) sym->st_value, ndx, outregs->int_retval); + symname, (long int) sym->st_value, ndx, + (ptrdiff_t) outregs->int_retval); __m128i xmm; diff --git a/libc/elf/tst-auditmod6b.c b/libc/elf/tst-auditmod6b.c index a7a60b992..b00dcd7c2 100644 --- a/libc/elf/tst-auditmod6b.c +++ b/libc/elf/tst-auditmod6b.c @@ -94,10 +94,17 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook, return sym->st_value; } -#define pltenter la_x86_64_gnu_pltenter -#define pltexit la_x86_64_gnu_pltexit -#define La_regs La_x86_64_regs -#define La_retval La_x86_64_retval +#ifdef __LP64__ +# define pltenter la_x86_64_gnu_pltenter +# define pltexit la_x86_64_gnu_pltexit +# define La_regs La_x86_64_regs +# define La_retval La_x86_64_retval +#else +# define pltenter la_x32_gnu_pltenter +# define pltexit la_x32_gnu_pltexit +# define La_regs La_x32_regs +# define La_retval La_x32_retval +#endif #define int_retval lrv_rax #include <tst-audit.h> @@ -179,7 +186,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook, const char *symname) { printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n", - symname, (long int) sym->st_value, ndx, outregs->int_retval); + symname, (long int) sym->st_value, ndx, + (ptrdiff_t) outregs->int_retval); #ifdef __AVX__ if (check_avx () && strcmp (symname, "audit_test") == 0) diff --git a/libc/elf/tst-auditmod6c.c b/libc/elf/tst-auditmod6c.c index e0b5ac231..a78c91396 100644 --- a/libc/elf/tst-auditmod6c.c +++ b/libc/elf/tst-auditmod6c.c @@ -94,10 +94,17 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook, return sym->st_value; } -#define pltenter la_x86_64_gnu_pltenter -#define pltexit la_x86_64_gnu_pltexit -#define La_regs La_x86_64_regs -#define La_retval La_x86_64_retval +#ifdef __LP64__ +# define pltenter la_x86_64_gnu_pltenter +# define pltexit la_x86_64_gnu_pltexit +# define La_regs La_x86_64_regs +# define La_retval La_x86_64_retval +#else +# define pltenter la_x32_gnu_pltenter +# define pltexit la_x32_gnu_pltexit +# define La_regs La_x32_regs +# define La_retval La_x32_retval +#endif #define int_retval lrv_rax #include <tst-audit.h> @@ -185,7 +192,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook, const char *symname) { printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n", - symname, (long int) sym->st_value, ndx, outregs->int_retval); + symname, (long int) sym->st_value, ndx, + (ptrdiff_t) outregs->int_retval); #ifdef __AVX__ if (check_avx () && strcmp (symname, "audit_test") == 0) diff --git a/libc/elf/tst-auditmod7b.c b/libc/elf/tst-auditmod7b.c index a27d38540..d761149a2 100644 --- a/libc/elf/tst-auditmod7b.c +++ b/libc/elf/tst-auditmod7b.c @@ -94,10 +94,17 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook, return sym->st_value; } -#define pltenter la_x86_64_gnu_pltenter -#define pltexit la_x86_64_gnu_pltexit -#define La_regs La_x86_64_regs -#define La_retval La_x86_64_retval +#ifdef __LP64__ +# define pltenter la_x86_64_gnu_pltenter +# define pltexit la_x86_64_gnu_pltexit +# define La_regs La_x86_64_regs +# define La_retval La_x86_64_retval +#else +# define pltenter la_x32_gnu_pltenter +# define pltexit la_x32_gnu_pltexit +# define La_regs La_x32_regs +# define La_retval La_x32_retval +#endif #define int_retval lrv_rax #include <tst-audit.h> @@ -177,7 +184,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook, const char *symname) { printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n", - symname, (long int) sym->st_value, ndx, outregs->int_retval); + symname, (long int) sym->st_value, ndx, + (ptrdiff_t) outregs->int_retval); #ifdef __AVX__ if (check_avx () && strcmp (symname, "audit_test") == 0) diff --git a/libc/grp/Makefile b/libc/grp/Makefile index b2b75e8d7..d5625a90e 100644 --- a/libc/grp/Makefile +++ b/libc/grp/Makefile @@ -42,12 +42,6 @@ endif include ../Rules -ifeq (yes,$(build-static-nss)) -otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ - $(resolvobjdir)/libresolv.a -endif - - ifeq ($(have-thread-library),yes) OPTION_EGLIBC_INET-CFLAGS-$(OPTION_EGLIBC_INET) = -DUSE_NSCD=1 diff --git a/libc/include/link.h b/libc/include/link.h index c5265ee16..2eb317947 100644 --- a/libc/include/link.h +++ b/libc/include/link.h @@ -330,4 +330,9 @@ extern int __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, size_t size, void *data), void *data); +/* We use this macro to refer to ELF macros independent of the native + wordsize. `ELFW(R_TYPE)' is used in place of `ELF32_R_TYPE' or + `ELF64_R_TYPE'. */ +#define ELFW(type) _ElfW (ELF, __ELF_NATIVE_CLASS, type) + #endif /* include/link.h */ diff --git a/libc/inet/Makefile b/libc/inet/Makefile index c04700582..d7bb4af63 100644 --- a/libc/inet/Makefile +++ b/libc/inet/Makefile @@ -99,8 +99,3 @@ endif ifeq ($(build-static-nss),yes) CFLAGS += -DSTATIC_NSS endif - -ifeq (yes,$(build-static-nss)) -otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ - $(resolvobjdir)/libresolv.a -endif diff --git a/libc/login/Makefile b/libc/login/Makefile index f0af07d39..e209f3400 100644 --- a/libc/login/Makefile +++ b/libc/login/Makefile @@ -52,11 +52,6 @@ include ../Rules CFLAGS-getpt.c = -fexceptions -ifeq (yes,$(build-static-nss)) -otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ - $(resolvobjdir)/libresolv.a $(common-objpfx)libc.a -endif - ifeq (yesyes,$(have-fpie)$(build-shared)) pt_chown-cflags += $(pie-ccflag) endif diff --git a/libc/malloc/mallocbug.c b/libc/malloc/mallocbug.c index 84a638795..fc607aed3 100644 --- a/libc/malloc/mallocbug.c +++ b/libc/malloc/mallocbug.c @@ -5,12 +5,15 @@ #define size_t unsigned int +/* Defined as global variables to avoid warnings about unused variables. */ +char *dummy0; +char *dummy1; +char *fill_info_table1; + + int main (int argc, char *argv[]) { - char *dummy0; - char *dummy1; - char *fill_info_table1; char *over_top; size_t over_top_size = 0x3000; char *over_top_dup; @@ -19,11 +22,11 @@ main (int argc, char *argv[]) size_t i; /* Here's what memory is supposed to look like (hex): - size contents - 3000 original_info_table, later fill_info_table1 + size contents + 3000 original_info_table, later fill_info_table1 3fa000 dummy0 3fa000 dummy1 - 6000 info_table_2 + 6000 info_table_2 3000 over_top */ diff --git a/libc/math/e_exp2l.c b/libc/math/e_exp2l.c index e7e493933..8904d3e4a 100644 --- a/libc/math/e_exp2l.c +++ b/libc/math/e_exp2l.c @@ -1,11 +1,49 @@ +/* Compute 2^x. + 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 <math.h> #include <math_private.h> +#include <float.h> long double __ieee754_exp2l (long double x) { - /* This is a very stupid and inprecise implementation. It'll get - replaced sometime (soon?). */ - return __ieee754_expl (M_LN2l * x); + if (__builtin_expect (isless (x, (long double) LDBL_MAX_EXP), 1)) + { + if (__builtin_expect (isgreaterequal (x, (long double) (LDBL_MIN_EXP + - LDBL_MANT_DIG + - 1)), 1)) + { + int intx = (int) x; + long double fractx = x - intx; + return __scalbnl (__ieee754_expl (M_LN2l * fractx), intx); + } + else + { + /* Underflow or exact zero. */ + if (__isinfl (x)) + return 0; + else + return LDBL_MIN * LDBL_MIN; + } + } + else + /* Infinity, NaN or overflow. */ + return LDBL_MAX * x; } strong_alias (__ieee754_exp2l, __exp2l_finite) diff --git a/libc/math/libm-test.inc b/libc/math/libm-test.inc index 45e61e86a..5401031ee 100644 --- a/libc/math/libm-test.inc +++ b/libc/math/libm-test.inc @@ -754,6 +754,8 @@ acos_test (void) /* |x| > 1: */ TEST_f_f (acos, 1.125L, nan_value, INVALID_EXCEPTION); TEST_f_f (acos, -1.125L, nan_value, INVALID_EXCEPTION); + TEST_f_f (acos, max_value, nan_value, INVALID_EXCEPTION); + TEST_f_f (acos, -max_value, nan_value, INVALID_EXCEPTION); TEST_f_f (acos, 0, M_PI_2l); TEST_f_f (acos, minus_zero, M_PI_2l); @@ -783,6 +785,7 @@ acosh_test (void) /* x < 1: */ TEST_f_f (acosh, -1.125L, nan_value, INVALID_EXCEPTION); + TEST_f_f (acosh, -max_value, nan_value, INVALID_EXCEPTION); TEST_f_f (acosh, 1, 0); TEST_f_f (acosh, 7, 2.63391579384963341725009269461593689L); @@ -808,6 +811,8 @@ asin_test (void) /* asin x == NaN plus invalid exception for |x| > 1. */ TEST_f_f (asin, 1.125L, nan_value, INVALID_EXCEPTION); TEST_f_f (asin, -1.125L, nan_value, INVALID_EXCEPTION); + TEST_f_f (asin, max_value, nan_value, INVALID_EXCEPTION); + TEST_f_f (asin, -max_value, nan_value, INVALID_EXCEPTION); TEST_f_f (asin, 0, 0); TEST_f_f (asin, minus_zero, minus_zero); @@ -893,6 +898,8 @@ atanh_test (void) /* atanh (x) == NaN plus invalid exception if |x| > 1. */ TEST_f_f (atanh, 1.125L, nan_value, INVALID_EXCEPTION); TEST_f_f (atanh, -1.125L, nan_value, INVALID_EXCEPTION); + TEST_f_f (atanh, max_value, nan_value, INVALID_EXCEPTION); + TEST_f_f (atanh, -max_value, nan_value, INVALID_EXCEPTION); TEST_f_f (atanh, 0.75L, 0.972955074527656652552676371721589865L); @@ -1917,6 +1924,35 @@ cexp_test (void) TEST_c_c (cexp, -10000, 0x1p16383L, 1.045876464564882298442774542991176546722e-4343L, 4.421154026488516836023811173959413420548e-4344L); #endif + TEST_c_c (cexp, 88.75, 0.75, 2.558360358486542817001900410314204322891e38L, 2.383359453227311447654736314679677655100e38L); + TEST_c_c (cexp, -95, 0.75, 4.039714446238306526889476684000081624047e-42L, 3.763383677300535390271646960780570275931e-42L); + +#ifndef TEST_FLOAT + TEST_c_c (cexp, 709.8125, 0.75, 1.355121963080879535248452862759108365762e308L, 1.262426823598609432507811340856186873507e308L); + TEST_c_c (cexp, -720, 0.75, 1.486960657116368433685753325516638551722e-313L, 1.385247284245720590980701226843815229385e-313L); +#endif + +#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384 + TEST_c_c (cexp, 11356.5625, 0.75, 9.052188470850960144814815984311663764287e4931L, 8.432986734191301036267148978260970230200e4931L); + TEST_c_c (cexp, -11370, 0.75, 8.631121063182211587489310508568170739592e-4939L, 8.040721827809267291427062346918413482824e-4939L); +#endif + +#ifdef TEST_FLOAT + TEST_c_c (cexp, 180, 0x1p-149, plus_infty, 2.087071793345235105931967606907855310664e33L, OVERFLOW_EXCEPTION); +#endif + +#if defined TEST_DOUBLE || (defined TEST_LDOUBLE && LDBL_MAX_EXP == 1024) + TEST_c_c (cexp, 1440, 0x1p-1074, plus_infty, 1.196295853897226111293303155636183216483e302L, OVERFLOW_EXCEPTION); +#endif + +#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384 + TEST_c_c (cexp, 22730, 0x1p-16434L, plus_infty, 2.435706297811211974162115164702304105374e4924L, OVERFLOW_EXCEPTION); +#endif + + TEST_c_c (cexp, 1e6, 0, plus_infty, 0, OVERFLOW_EXCEPTION); + TEST_c_c (cexp, 1e6, min_value, plus_infty, plus_infty, OVERFLOW_EXCEPTION); + TEST_c_c (cexp, 1e6, -min_value, plus_infty, minus_infty, OVERFLOW_EXCEPTION); + END (cexp, complex); } @@ -2978,6 +3014,11 @@ exp_test (void) TEST_f_f (exp, 1000.0L, 0.197007111401704699388887935224332313e435L); #endif + /* Bug 13922: OVERFLOW exception may be missing. */ + TEST_f_f (exp, max_value, plus_infty, OVERFLOW_EXCEPTION_OK); + /* Bug 13705: spurious OVERFLOW exception may be present. */ + TEST_f_f (exp, -max_value, 0, OVERFLOW_EXCEPTION_OK); + END (exp); } @@ -3111,6 +3152,11 @@ exp10_test (void) TEST_f_f (exp10, -1, 0.1L); TEST_f_f (exp10, 1e6, plus_infty, OVERFLOW_EXCEPTION); TEST_f_f (exp10, -1e6, 0); +#ifndef TEST_LDOUBLE /* Bug 13914: spurious exceptions. */ + TEST_f_f (exp10, max_value, plus_infty, OVERFLOW_EXCEPTION); + /* Bug 13924: spurious OVERFLOW exception may be present. */ + TEST_f_f (exp10, -max_value, 0, OVERFLOW_EXCEPTION_OK); +#endif TEST_f_f (exp10, 0.75L, 5.62341325190349080394951039776481231L); END (exp10); @@ -3138,8 +3184,25 @@ exp2_test (void) TEST_f_f (exp2, -1, 0.5); TEST_f_f (exp2, 1e6, plus_infty, OVERFLOW_EXCEPTION); TEST_f_f (exp2, -1e6, 0); + TEST_f_f (exp2, max_value, plus_infty, OVERFLOW_EXCEPTION); + TEST_f_f (exp2, -max_value, 0); TEST_f_f (exp2, 0.75L, 1.68179283050742908606225095246642979L); + TEST_f_f (exp2, 100.5, 1.792728671193156477399422023278661496394e+30L); + TEST_f_f (exp2, 127, 0x1p127); + TEST_f_f (exp2, -149, 0x1p-149); + +#ifndef TEST_FLOAT + TEST_f_f (exp2, 1000.25, 1.274245659452564874772384918171765416737e+301L); + TEST_f_f (exp2, 1023, 0x1p1023); + TEST_f_f (exp2, -1074, 0x1p-1074); +#endif + +#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384 + TEST_f_f (exp2, 16383, 0x1p16383L); + TEST_f_f (exp2, -16400, 0x1p-16400L); +#endif + END (exp2); } @@ -3175,6 +3238,11 @@ expm1_test (void) /* Bug 13787: OVERFLOW exception may be missing. */ TEST_f_f (expm1, 100000.0, plus_infty, OVERFLOW_EXCEPTION_OK); check_int ("errno for expm1(large) == ERANGE", errno, ERANGE, 0, 0, 0); + /* Bug 13787: OVERFLOW exception may be missing. */ + TEST_f_f (expm1, max_value, plus_infty, OVERFLOW_EXCEPTION_OK); +#ifndef TEST_LDOUBLE /* Bug 13923. */ + TEST_f_f (expm1, -max_value, -1); +#endif END (expm1); } @@ -3937,6 +4005,8 @@ lgamma_test (void) TEST_f_f (lgamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); check_int ("errno for lgamma(-integer) == ERANGE", errno, ERANGE, 0, 0, 0); TEST_f_f (lgamma, minus_infty, plus_infty); + TEST_f_f (lgamma, -max_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); + TEST_f_f (lgamma, max_value, plus_infty, OVERFLOW_EXCEPTION); TEST_f_f1 (lgamma, 1, 0, 1); @@ -4838,6 +4908,7 @@ log_test (void) TEST_f_f (log, 1, 0); TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION); + TEST_f_f (log, -max_value, nan_value, INVALID_EXCEPTION); TEST_f_f (log, minus_infty, nan_value, INVALID_EXCEPTION); TEST_f_f (log, plus_infty, plus_infty); TEST_f_f (log, nan_value, nan_value); @@ -4870,6 +4941,7 @@ log10_test (void) /* log10 (x) == NaN plus invalid exception if x < 0. */ TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION); + TEST_f_f (log10, -max_value, nan_value, INVALID_EXCEPTION); TEST_f_f (log10, minus_infty, nan_value, INVALID_EXCEPTION); TEST_f_f (log10, plus_infty, plus_infty); @@ -4902,6 +4974,7 @@ log1p_test (void) TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION); TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION); + TEST_f_f (log1p, -max_value, nan_value, INVALID_EXCEPTION); TEST_f_f (log1p, minus_infty, nan_value, INVALID_EXCEPTION); TEST_f_f (log1p, plus_infty, plus_infty); @@ -4933,6 +5006,7 @@ log2_test (void) TEST_f_f (log2, 1, 0); TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION); + TEST_f_f (log2, -max_value, nan_value, INVALID_EXCEPTION); TEST_f_f (log2, minus_infty, nan_value, INVALID_EXCEPTION); TEST_f_f (log2, plus_infty, plus_infty); @@ -5541,8 +5615,7 @@ pow_test (void) TEST_ff_f (pow, 0, -0x1p127, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); check_int ("errno for pow(0,-num) == ERANGE", errno, ERANGE, 0, 0, 0); errno = 0; - /* Bug 13879: spurious OVERFLOW exception may be present. */ - TEST_ff_f (pow, 0, -max_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|OVERFLOW_EXCEPTION_OK); + TEST_ff_f (pow, 0, -max_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); check_int ("errno for pow(0,-num) == ERANGE", errno, ERANGE, 0, 0, 0); errno = 0; TEST_ff_f (pow, minus_zero, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); @@ -5557,8 +5630,7 @@ pow_test (void) TEST_ff_f (pow, minus_zero, -0x1p127, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); check_int ("errno for pow(-0,-num) == ERANGE", errno, ERANGE, 0, 0, 0); errno = 0; - /* Bug 13879: spurious OVERFLOW exception may be present. */ - TEST_ff_f (pow, minus_zero, -max_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|OVERFLOW_EXCEPTION_OK); + TEST_ff_f (pow, minus_zero, -max_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); check_int ("errno for pow(-0,-num) == ERANGE", errno, ERANGE, 0, 0, 0); TEST_ff_f (pow, 0x1p72L, 0x1p72L, plus_infty, OVERFLOW_EXCEPTION); @@ -5759,6 +5831,259 @@ pow_test (void) TEST_ff_f (pow, -7.49321e+133, -9.80818e+16, 0); #endif + TEST_ff_f (pow, -1.0, -0xffffff, -1.0); + TEST_ff_f (pow, -1.0, -0x1fffffe, 1.0); +#ifndef TEST_FLOAT + TEST_ff_f (pow, -1.0, -0x1.fffffffffffffp+52L, -1.0); + TEST_ff_f (pow, -1.0, -0x1.fffffffffffffp+53L, 1.0); +#endif +#ifdef TEST_LDOUBLE +# if LDBL_MANT_DIG >= 64 + TEST_ff_f (pow, -1.0, -0x1.fffffffffffffffep+63L, -1.0); + TEST_ff_f (pow, -1.0, -0x1.fffffffffffffffep+64L, 1.0); +# endif +# if LDBL_MANT_DIG >= 106 + TEST_ff_f (pow, -1.0, -0x1.ffffffffffffffffffffffffff8p+105L, -1.0); + TEST_ff_f (pow, -1.0, -0x1.ffffffffffffffffffffffffff8p+106L, 1.0); +# endif +# if LDBL_MANT_DIG >= 113 + TEST_ff_f (pow, -1.0, -0x1.ffffffffffffffffffffffffffffp+112L, -1.0); + TEST_ff_f (pow, -1.0, -0x1.ffffffffffffffffffffffffffffp+113L, 1.0); +# endif +#endif + TEST_ff_f (pow, -1.0, -max_value, 1.0); + + TEST_ff_f (pow, -1.0, 0xffffff, -1.0); + TEST_ff_f (pow, -1.0, 0x1fffffe, 1.0); +#ifndef TEST_FLOAT + TEST_ff_f (pow, -1.0, 0x1.fffffffffffffp+52L, -1.0); + TEST_ff_f (pow, -1.0, 0x1.fffffffffffffp+53L, 1.0); +#endif +#ifdef TEST_LDOUBLE +# if LDBL_MANT_DIG >= 64 + TEST_ff_f (pow, -1.0, 0x1.fffffffffffffffep+63L, -1.0); + TEST_ff_f (pow, -1.0, 0x1.fffffffffffffffep+64L, 1.0); +# endif +# if LDBL_MANT_DIG >= 106 + TEST_ff_f (pow, -1.0, 0x1.ffffffffffffffffffffffffff8p+105L, -1.0); + TEST_ff_f (pow, -1.0, 0x1.ffffffffffffffffffffffffff8p+106L, 1.0); +# endif +# if LDBL_MANT_DIG >= 113 + TEST_ff_f (pow, -1.0, 0x1.ffffffffffffffffffffffffffffp+112L, -1.0); + TEST_ff_f (pow, -1.0, 0x1.ffffffffffffffffffffffffffffp+113L, 1.0); +# endif +#endif + TEST_ff_f (pow, -1.0, max_value, 1.0); + + TEST_ff_f (pow, -2.0, 126, 0x1p126); + TEST_ff_f (pow, -2.0, 127, -0x1p127); + TEST_ff_f (pow, -2.0, -126, 0x1p-126); + TEST_ff_f (pow, -2.0, -127, -0x1p-127); + + TEST_ff_f (pow, -2.0, -0xffffff, minus_zero); + TEST_ff_f (pow, -2.0, -0x1fffffe, plus_zero); +#ifndef TEST_FLOAT + TEST_ff_f (pow, -2.0, -0x1.fffffffffffffp+52L, minus_zero); + TEST_ff_f (pow, -2.0, -0x1.fffffffffffffp+53L, plus_zero); +#endif +#ifdef TEST_LDOUBLE +# if LDBL_MANT_DIG >= 64 + TEST_ff_f (pow, -2.0, -0x1.fffffffffffffffep+63L, minus_zero); + TEST_ff_f (pow, -2.0, -0x1.fffffffffffffffep+64L, plus_zero); +# endif +# if LDBL_MANT_DIG >= 106 + TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffff8p+105L, minus_zero); + TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffff8p+106L, plus_zero); +# endif +# if LDBL_MANT_DIG >= 113 + TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffffffp+112L, minus_zero); + TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffffffp+113L, plus_zero); +# endif +#endif + TEST_ff_f (pow, -2.0, -max_value, plus_zero); + + TEST_ff_f (pow, -2.0, 0xffffff, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -2.0, 0x1fffffe, plus_infty, OVERFLOW_EXCEPTION); +#ifndef TEST_FLOAT + TEST_ff_f (pow, -2.0, 0x1.fffffffffffffp+52L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -2.0, 0x1.fffffffffffffp+53L, plus_infty, OVERFLOW_EXCEPTION); +#endif +#ifdef TEST_LDOUBLE +# if LDBL_MANT_DIG >= 64 + TEST_ff_f (pow, -2.0, 0x1.fffffffffffffffep+63L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -2.0, 0x1.fffffffffffffffep+64L, plus_infty, OVERFLOW_EXCEPTION); +# endif +# if LDBL_MANT_DIG >= 106 + TEST_ff_f (pow, -2.0, 0x1.ffffffffffffffffffffffffff8p+105L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -2.0, 0x1.ffffffffffffffffffffffffff8p+106L, plus_infty, OVERFLOW_EXCEPTION); +# endif +# if LDBL_MANT_DIG >= 113 + TEST_ff_f (pow, -2.0, 0x1.ffffffffffffffffffffffffffffp+112L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -2.0, 0x1.ffffffffffffffffffffffffffffp+113L, plus_infty, OVERFLOW_EXCEPTION); +# endif +#endif + /* Bug 13873: OVERFLOW exception may be missing. */ + TEST_ff_f (pow, -2.0, max_value, plus_infty, OVERFLOW_EXCEPTION_OK); + + TEST_ff_f (pow, -max_value, 0.5, nan_value, INVALID_EXCEPTION); + TEST_ff_f (pow, -max_value, 1.5, nan_value, INVALID_EXCEPTION); + TEST_ff_f (pow, -max_value, 1000.5, nan_value, INVALID_EXCEPTION); + TEST_ff_f (pow, -max_value, -2, plus_zero); + TEST_ff_f (pow, -max_value, -3, minus_zero); + TEST_ff_f (pow, -max_value, 2, plus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -max_value, 3, minus_infty, OVERFLOW_EXCEPTION); + + TEST_ff_f (pow, -max_value, -0xffffff, minus_zero); + TEST_ff_f (pow, -max_value, -0x1fffffe, plus_zero); +#ifndef TEST_FLOAT + TEST_ff_f (pow, -max_value, -0x1.fffffffffffffp+52L, minus_zero); + TEST_ff_f (pow, -max_value, -0x1.fffffffffffffp+53L, plus_zero); +#endif +#ifdef TEST_LDOUBLE +# if LDBL_MANT_DIG >= 64 + TEST_ff_f (pow, -max_value, -0x1.fffffffffffffffep+63L, minus_zero); + TEST_ff_f (pow, -max_value, -0x1.fffffffffffffffep+64L, plus_zero); +# endif +# if LDBL_MANT_DIG >= 106 + TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffff8p+105L, minus_zero); + TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffff8p+106L, plus_zero); +# endif +# if LDBL_MANT_DIG >= 113 + TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffffffp+112L, minus_zero); + TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffffffp+113L, plus_zero); +# endif +#endif + /* Bug 13872: spurious OVERFLOW exception may be present. */ + TEST_ff_f (pow, -max_value, -max_value, plus_zero, OVERFLOW_EXCEPTION_OK); + + TEST_ff_f (pow, -max_value, 0xffffff, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -max_value, 0x1fffffe, plus_infty, OVERFLOW_EXCEPTION); +#ifndef TEST_FLOAT + TEST_ff_f (pow, -max_value, 0x1.fffffffffffffp+52L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -max_value, 0x1.fffffffffffffp+53L, plus_infty, OVERFLOW_EXCEPTION); +#endif +#ifdef TEST_LDOUBLE +# if LDBL_MANT_DIG >= 64 + TEST_ff_f (pow, -max_value, 0x1.fffffffffffffffep+63L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -max_value, 0x1.fffffffffffffffep+64L, plus_infty, OVERFLOW_EXCEPTION); +# endif +# if LDBL_MANT_DIG >= 106 + TEST_ff_f (pow, -max_value, 0x1.ffffffffffffffffffffffffff8p+105L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -max_value, 0x1.ffffffffffffffffffffffffff8p+106L, plus_infty, OVERFLOW_EXCEPTION); +# endif +# if LDBL_MANT_DIG >= 113 + TEST_ff_f (pow, -max_value, 0x1.ffffffffffffffffffffffffffffp+112L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -max_value, 0x1.ffffffffffffffffffffffffffffp+113L, plus_infty, OVERFLOW_EXCEPTION); +# endif +#endif + /* Bug 13873: OVERFLOW exception may be missing. */ + TEST_ff_f (pow, -max_value, max_value, plus_infty, OVERFLOW_EXCEPTION_OK); + + TEST_ff_f (pow, -0.5, 126, 0x1p-126); + TEST_ff_f (pow, -0.5, 127, -0x1p-127); + TEST_ff_f (pow, -0.5, -126, 0x1p126); + TEST_ff_f (pow, -0.5, -127, -0x1p127); + + TEST_ff_f (pow, -0.5, -0xffffff, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -0.5, -0x1fffffe, plus_infty, OVERFLOW_EXCEPTION); +#ifndef TEST_FLOAT + TEST_ff_f (pow, -0.5, -0x1.fffffffffffffp+52L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -0.5, -0x1.fffffffffffffp+53L, plus_infty, OVERFLOW_EXCEPTION); +#endif +#ifdef TEST_LDOUBLE +# if LDBL_MANT_DIG >= 64 + TEST_ff_f (pow, -0.5, -0x1.fffffffffffffffep+63L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -0.5, -0x1.fffffffffffffffep+64L, plus_infty, OVERFLOW_EXCEPTION); +# endif +# if LDBL_MANT_DIG >= 106 + TEST_ff_f (pow, -0.5, -0x1.ffffffffffffffffffffffffff8p+105L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -0.5, -0x1.ffffffffffffffffffffffffff8p+106L, plus_infty, OVERFLOW_EXCEPTION); +# endif +# if LDBL_MANT_DIG >= 113 + TEST_ff_f (pow, -0.5, -0x1.ffffffffffffffffffffffffffffp+112L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -0.5, -0x1.ffffffffffffffffffffffffffffp+113L, plus_infty, OVERFLOW_EXCEPTION); +# endif +#endif + /* Bug 13873: OVERFLOW exception may be missing. */ + TEST_ff_f (pow, -0.5, -max_value, plus_infty, OVERFLOW_EXCEPTION_OK); + + TEST_ff_f (pow, -0.5, 0xffffff, minus_zero); + TEST_ff_f (pow, -0.5, 0x1fffffe, plus_zero); +#ifndef TEST_FLOAT + TEST_ff_f (pow, -0.5, 0x1.fffffffffffffp+52L, minus_zero); + TEST_ff_f (pow, -0.5, 0x1.fffffffffffffp+53L, plus_zero); +#endif +#ifdef TEST_LDOUBLE +# if LDBL_MANT_DIG >= 64 + TEST_ff_f (pow, -0.5, 0x1.fffffffffffffffep+63L, minus_zero); + TEST_ff_f (pow, -0.5, 0x1.fffffffffffffffep+64L, plus_zero); +# endif +# if LDBL_MANT_DIG >= 106 + TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffff8p+105L, minus_zero); + TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffff8p+106L, plus_zero); +# endif +# if LDBL_MANT_DIG >= 113 + TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffffffp+112L, minus_zero); + TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffffffp+113L, plus_zero); +# endif +#endif + TEST_ff_f (pow, -0.5, max_value, plus_zero); + + TEST_ff_f (pow, -min_value, 0.5, nan_value, INVALID_EXCEPTION); + TEST_ff_f (pow, -min_value, 1.5, nan_value, INVALID_EXCEPTION); + TEST_ff_f (pow, -min_value, 1000.5, nan_value, INVALID_EXCEPTION); + TEST_ff_f (pow, -min_value, -2, plus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -min_value, -3, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -min_value, 1, -min_value); + TEST_ff_f (pow, -min_value, 2, plus_zero); + TEST_ff_f (pow, -min_value, 3, minus_zero); + + TEST_ff_f (pow, -min_value, -0xffffff, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -min_value, -0x1fffffe, plus_infty, OVERFLOW_EXCEPTION); +#ifndef TEST_FLOAT + TEST_ff_f (pow, -min_value, -0x1.fffffffffffffp+52L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -min_value, -0x1.fffffffffffffp+53L, plus_infty, OVERFLOW_EXCEPTION); +#endif +#ifdef TEST_LDOUBLE +# if LDBL_MANT_DIG >= 64 + TEST_ff_f (pow, -min_value, -0x1.fffffffffffffffep+63L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -min_value, -0x1.fffffffffffffffep+64L, plus_infty, OVERFLOW_EXCEPTION); +# endif +# if LDBL_MANT_DIG >= 106 + TEST_ff_f (pow, -min_value, -0x1.ffffffffffffffffffffffffff8p+105L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -min_value, -0x1.ffffffffffffffffffffffffff8p+106L, plus_infty, OVERFLOW_EXCEPTION); +# endif +# if LDBL_MANT_DIG >= 113 + TEST_ff_f (pow, -min_value, -0x1.ffffffffffffffffffffffffffffp+112L, minus_infty, OVERFLOW_EXCEPTION); + TEST_ff_f (pow, -min_value, -0x1.ffffffffffffffffffffffffffffp+113L, plus_infty, OVERFLOW_EXCEPTION); +# endif +#endif + /* Bug 13873: OVERFLOW exception may be missing. */ + TEST_ff_f (pow, -min_value, -max_value, plus_infty, OVERFLOW_EXCEPTION_OK); + + TEST_ff_f (pow, -min_value, 0xffffff, minus_zero); + TEST_ff_f (pow, -min_value, 0x1fffffe, plus_zero); +#ifndef TEST_FLOAT + TEST_ff_f (pow, -min_value, 0x1.fffffffffffffp+52L, minus_zero); + TEST_ff_f (pow, -min_value, 0x1.fffffffffffffp+53L, plus_zero); +#endif +#ifdef TEST_LDOUBLE +# if LDBL_MANT_DIG >= 64 + TEST_ff_f (pow, -min_value, 0x1.fffffffffffffffep+63L, minus_zero); + TEST_ff_f (pow, -min_value, 0x1.fffffffffffffffep+64L, plus_zero); +# endif +# if LDBL_MANT_DIG >= 106 + TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffff8p+105L, minus_zero); + TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffff8p+106L, plus_zero); +# endif +# if LDBL_MANT_DIG >= 113 + TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffffffp+112L, minus_zero); + TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffffffp+113L, plus_zero); +# endif +#endif + /* Bug 13872: spurious OVERFLOW exception may be present. */ + TEST_ff_f (pow, -min_value, max_value, plus_zero, OVERFLOW_EXCEPTION_OK); + END (pow); } @@ -7052,6 +7377,7 @@ sqrt_test (void) /* sqrt (x) == NaN plus invalid exception for x < 0. */ TEST_f_f (sqrt, -1, nan_value, INVALID_EXCEPTION); + TEST_f_f (sqrt, -max_value, nan_value, INVALID_EXCEPTION); TEST_f_f (sqrt, minus_infty, nan_value, INVALID_EXCEPTION); TEST_f_f (sqrt, nan_value, nan_value); @@ -7290,10 +7616,12 @@ tgamma_test (void) START (tgamma); TEST_f_f (tgamma, plus_infty, plus_infty); + TEST_f_f (tgamma, max_value, plus_infty, OVERFLOW_EXCEPTION); TEST_f_f (tgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); TEST_f_f (tgamma, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION); /* tgamma (x) == NaN plus invalid exception for integer x <= 0. */ TEST_f_f (tgamma, -2, nan_value, INVALID_EXCEPTION); + TEST_f_f (tgamma, -max_value, nan_value, INVALID_EXCEPTION); TEST_f_f (tgamma, minus_infty, nan_value, INVALID_EXCEPTION); TEST_f_f (tgamma, nan_value, nan_value); @@ -7437,6 +7765,7 @@ y0_test (void) START (y0); TEST_f_f (y0, -1.0, minus_infty, INVALID_EXCEPTION); + TEST_f_f (y0, -max_value, minus_infty, INVALID_EXCEPTION); TEST_f_f (y0, 0.0, minus_infty); TEST_f_f (y0, nan_value, nan_value); TEST_f_f (y0, plus_infty, 0); @@ -7477,6 +7806,7 @@ y1_test (void) START (y1); TEST_f_f (y1, -1.0, minus_infty, INVALID_EXCEPTION); + TEST_f_f (y1, -max_value, minus_infty, INVALID_EXCEPTION); TEST_f_f (y1, 0.0, minus_infty); TEST_f_f (y1, plus_infty, 0); TEST_f_f (y1, nan_value, nan_value); @@ -7518,6 +7848,7 @@ yn_test (void) /* yn (0, x) == y0 (x) */ TEST_ff_f (yn, 0, -1.0, minus_infty, INVALID_EXCEPTION); + TEST_ff_f (yn, 0, -max_value, minus_infty, INVALID_EXCEPTION); TEST_ff_f (yn, 0, 0.0, minus_infty); TEST_ff_f (yn, 0, nan_value, nan_value); TEST_ff_f (yn, 0, plus_infty, 0); diff --git a/libc/math/s_cexp.c b/libc/math/s_cexp.c index 82fe8148f..1d7a5a2c4 100644 --- a/libc/math/s_cexp.c +++ b/libc/math/s_cexp.c @@ -1,5 +1,5 @@ /* Return value of complex exponential function for double complex value. - Copyright (C) 1997, 2011 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. @@ -21,7 +21,7 @@ #include <fenv.h> #include <math.h> #include <math_private.h> - +#include <float.h> __complex__ double __cexp (__complex__ double x) @@ -36,20 +36,35 @@ __cexp (__complex__ double x) if (__builtin_expect (icls >= FP_ZERO, 1)) { /* Imaginary part is finite. */ - double exp_val = __ieee754_exp (__real__ x); + const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2); double sinix, cosix; __sincos (__imag__ x, &sinix, &cosix); - if (isfinite (exp_val)) + if (__real__ x > t) { - __real__ retval = exp_val * cosix; - __imag__ retval = exp_val * sinix; + double exp_t = __ieee754_exp (t); + __real__ x -= t; + sinix *= exp_t; + cosix *= exp_t; + if (__real__ x > t) + { + __real__ x -= t; + sinix *= exp_t; + cosix *= exp_t; + } + } + if (__real__ x > t) + { + /* Overflow (original real part of x > 3t). */ + __real__ retval = DBL_MAX * cosix; + __imag__ retval = DBL_MAX * sinix; } else { - __real__ retval = __copysign (exp_val, cosix); - __imag__ retval = __copysign (exp_val, sinix); + double exp_val = __ieee754_exp (__real__ x); + __real__ retval = exp_val * cosix; + __imag__ retval = exp_val * sinix; } } else diff --git a/libc/math/s_cexpf.c b/libc/math/s_cexpf.c index a9c28ed8c..4aa976581 100644 --- a/libc/math/s_cexpf.c +++ b/libc/math/s_cexpf.c @@ -1,5 +1,5 @@ /* Return value of complex exponential function for float complex value. - Copyright (C) 1997, 2011 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. @@ -21,7 +21,7 @@ #include <fenv.h> #include <math.h> #include <math_private.h> - +#include <float.h> __complex__ float __cexpf (__complex__ float x) @@ -36,20 +36,35 @@ __cexpf (__complex__ float x) if (__builtin_expect (icls >= FP_ZERO, 1)) { /* Imaginary part is finite. */ - float exp_val = __ieee754_expf (__real__ x); + const int t = (int) ((FLT_MAX_EXP - 1) * M_LN2); float sinix, cosix; __sincosf (__imag__ x, &sinix, &cosix); - if (isfinite (exp_val)) + if (__real__ x > t) { - __real__ retval = exp_val * cosix; - __imag__ retval = exp_val * sinix; + float exp_t = __ieee754_expf (t); + __real__ x -= t; + sinix *= exp_t; + cosix *= exp_t; + if (__real__ x > t) + { + __real__ x -= t; + sinix *= exp_t; + cosix *= exp_t; + } + } + if (__real__ x > t) + { + /* Overflow (original real part of x > 3t). */ + __real__ retval = FLT_MAX * cosix; + __imag__ retval = FLT_MAX * sinix; } else { - __real__ retval = __copysignf (exp_val, cosix); - __imag__ retval = __copysignf (exp_val, sinix); + float exp_val = __ieee754_expf (__real__ x); + __real__ retval = exp_val * cosix; + __imag__ retval = exp_val * sinix; } } else diff --git a/libc/math/s_cexpl.c b/libc/math/s_cexpl.c index 3059880db..256824924 100644 --- a/libc/math/s_cexpl.c +++ b/libc/math/s_cexpl.c @@ -1,5 +1,5 @@ /* Return value of complex exponential function for long double complex value. - Copyright (C) 1997, 2011 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. @@ -21,7 +21,7 @@ #include <fenv.h> #include <math.h> #include <math_private.h> - +#include <float.h> __complex__ long double __cexpl (__complex__ long double x) @@ -36,20 +36,35 @@ __cexpl (__complex__ long double x) if (__builtin_expect (icls >= FP_ZERO, 1)) { /* Imaginary part is finite. */ - long double exp_val = __ieee754_expl (__real__ x); + const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l); long double sinix, cosix; __sincosl (__imag__ x, &sinix, &cosix); - if (isfinite (exp_val)) + if (__real__ x > t) { - __real__ retval = exp_val * cosix; - __imag__ retval = exp_val * sinix; + long double exp_t = __ieee754_expl (t); + __real__ x -= t; + sinix *= exp_t; + cosix *= exp_t; + if (__real__ x > t) + { + __real__ x -= t; + sinix *= exp_t; + cosix *= exp_t; + } + } + if (__real__ x > t) + { + /* Overflow (original real part of x > 3t). */ + __real__ retval = LDBL_MAX * cosix; + __imag__ retval = LDBL_MAX * sinix; } else { - __real__ retval = __copysignl (exp_val, cosix); - __imag__ retval = __copysignl (exp_val, sinix); + long double exp_val = __ieee754_expl (__real__ x); + __real__ retval = exp_val * cosix; + __imag__ retval = exp_val * sinix; } } else diff --git a/libc/math/w_acoshl.c b/libc/math/w_acoshl.c index cc823b88e..def7be435 100644 --- a/libc/math/w_acoshl.c +++ b/libc/math/w_acoshl.c @@ -26,7 +26,7 @@ __acoshl (long double x) { if (__builtin_expect (isless (x, 1.0L), 0) && _LIB_VERSION != _IEEE_) /* acosh(x<1) */ - return __kernel_standard (x, x, 229); + return __kernel_standard_l (x, x, 229); return __ieee754_acoshl (x); } diff --git a/libc/math/w_acosl.c b/libc/math/w_acosl.c index 05023b429..394fce194 100644 --- a/libc/math/w_acosl.c +++ b/libc/math/w_acosl.c @@ -30,7 +30,7 @@ __acosl (long double x) { /* acos(|x|>1) */ feraiseexcept (FE_INVALID); - return __kernel_standard (x, x, 201); + return __kernel_standard_l (x, x, 201); } return __ieee754_acosl (x); diff --git a/libc/math/w_asinl.c b/libc/math/w_asinl.c index e4036d880..e56e2e527 100644 --- a/libc/math/w_asinl.c +++ b/libc/math/w_asinl.c @@ -30,7 +30,7 @@ __asinl (long double x) { /* asin(|x|>1) */ feraiseexcept (FE_INVALID); - return __kernel_standard (x, x, 202); + return __kernel_standard_l (x, x, 202); } return __ieee754_asinl (x); diff --git a/libc/math/w_atan2l.c b/libc/math/w_atan2l.c index 855437699..30f9512f9 100644 --- a/libc/math/w_atan2l.c +++ b/libc/math/w_atan2l.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 Ulrich Drepper <drepper@gmail.com>, 2011. @@ -28,7 +28,7 @@ long double __atan2l (long double y, long double x) { if (__builtin_expect (x == 0.0L && y == 0.0L, 0) && _LIB_VERSION == _SVID_) - return __kernel_standard (y, x, 203); /* atan2(+-0,+-0) */ + return __kernel_standard_l (y, x, 203); /* atan2(+-0,+-0) */ return __ieee754_atan2l (y, x); } diff --git a/libc/math/w_atanhl.c b/libc/math/w_atanhl.c index 319535d17..6b00bbb4e 100644 --- a/libc/math/w_atanhl.c +++ b/libc/math/w_atanhl.c @@ -26,10 +26,10 @@ __atanhl (long double x) { if (__builtin_expect (isgreaterequal (fabsl (x), 1.0L), 0) && _LIB_VERSION != _IEEE_) - return __kernel_standard (x, x, - fabsl (x) > 1.0L - ? 230 /* atanh(|x|>1) */ - : 231); /* atanh(|x|==1) */ + return __kernel_standard_l (x, x, + fabsl (x) > 1.0L + ? 230 /* atanh(|x|>1) */ + : 231); /* atanh(|x|==1) */ return __ieee754_atanhl (x); } diff --git a/libc/math/w_coshl.c b/libc/math/w_coshl.c index abca8b05f..9c638e91e 100644 --- a/libc/math/w_coshl.c +++ b/libc/math/w_coshl.c @@ -28,7 +28,7 @@ __coshl (long double x) long double z = __ieee754_coshl (x); if (__builtin_expect (!__finitel (z), 0) && __finitel (x) && _LIB_VERSION != _IEEE_) - return __kernel_standard (x, x, 205); /* cosh overflow */ + return __kernel_standard_l (x, x, 205); /* cosh overflow */ return z; } diff --git a/libc/math/w_exp10l.c b/libc/math/w_exp10l.c index bea6a1ee4..7f426ea32 100644 --- a/libc/math/w_exp10l.c +++ b/libc/math/w_exp10l.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 Ulrich Drepper <drepper@gmail.com>, 2011. @@ -31,7 +31,7 @@ __exp10l (long double x) if (__builtin_expect (!__finitel (z), 0) && __finitel (x) && _LIB_VERSION != _IEEE_) /* exp10l overflow (246) if x > 0, underflow (247) if x < 0. */ - return __kernel_standard (x, x, 246 + !!__signbitl (x)); + return __kernel_standard_l (x, x, 246 + !!__signbitl (x)); return z; } diff --git a/libc/math/w_exp2l.c b/libc/math/w_exp2l.c index f05a8fe6d..7f06805a0 100644 --- a/libc/math/w_exp2l.c +++ b/libc/math/w_exp2l.c @@ -12,7 +12,7 @@ __exp2l (long double x) if (__builtin_expect (!__finitel (z), 0) && __finitel (x) && _LIB_VERSION != _IEEE_) /* exp2 overflow: 244, exp2 underflow: 245 */ - return __kernel_standard (x, x, 244 + !!__signbitl (x)); + return __kernel_standard_l (x, x, 244 + !!__signbitl (x)); return z; } diff --git a/libc/math/w_fmodl.c b/libc/math/w_fmodl.c index b088cc370..f508a1f64 100644 --- a/libc/math/w_fmodl.c +++ b/libc/math/w_fmodl.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 Ulrich Drepper <drepper@gmail.com>, 2011. @@ -26,7 +26,7 @@ __fmodl (long double x, long double y) if (__builtin_expect (__isinf_nsl (x) || y == 0.0L, 0) && _LIB_VERSION != _IEEE_ && !__isnanl (y) && !__isnanl (x)) /* fmod(+-Inf,y) or fmod(x,0) */ - return __kernel_standard (x, y, 227); + return __kernel_standard_l (x, y, 227); return __ieee754_fmodl (x, y); } diff --git a/libc/math/w_hypotl.c b/libc/math/w_hypotl.c index 522eb63c3..2e942cae3 100644 --- a/libc/math/w_hypotl.c +++ b/libc/math/w_hypotl.c @@ -29,7 +29,7 @@ __hypotl(long double x, long double y) z = __ieee754_hypotl(x,y); if(__builtin_expect(!__finitel(z), 0) && __finitel(x) && __finitel(y) && _LIB_VERSION != _IEEE_) - return __kernel_standard(x, y, 204); /* hypot overflow */ + return __kernel_standard_l(x, y, 204); /* hypot overflow */ return z; } diff --git a/libc/math/w_j0l.c b/libc/math/w_j0l.c index 54c9c8902..1532d2ebd 100644 --- a/libc/math/w_j0l.c +++ b/libc/math/w_j0l.c @@ -28,7 +28,7 @@ __j0l (long double x) if (__builtin_expect (isgreater (fabsl (x), X_TLOSS), 0) && _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_) /* j0(|x|>X_TLOSS) */ - return __kernel_standard (x, x, 234); + return __kernel_standard_l (x, x, 234); return __ieee754_j0l (x); } @@ -46,14 +46,14 @@ __y0l (long double x) { /* d = zero/(x-x) */ feraiseexcept (FE_INVALID); - return __kernel_standard (x, x, 209); + return __kernel_standard_l (x, x, 209); } else if (x == 0.0L) /* d = -one/(x-x) */ - return __kernel_standard (x, x, 208); + return __kernel_standard_l (x, x, 208); else if (_LIB_VERSION != _POSIX_) /* y0(x>X_TLOSS) */ - return __kernel_standard (x, x, 235); + return __kernel_standard_l (x, x, 235); } return __ieee754_y0l (x); diff --git a/libc/math/w_j1l.c b/libc/math/w_j1l.c index 208377eca..0b0136026 100644 --- a/libc/math/w_j1l.c +++ b/libc/math/w_j1l.c @@ -28,7 +28,7 @@ __j1l (long double x) if (__builtin_expect (isgreater (fabsl (x), X_TLOSS), 0) && _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_) /* j1(|x|>X_TLOSS) */ - return __kernel_standard (x, x, 236); + return __kernel_standard_l (x, x, 236); return __ieee754_j1l (x); } @@ -46,14 +46,14 @@ __y1l (long double x) { /* d = zero/(x-x) */ feraiseexcept (FE_INVALID); - return __kernel_standard (x, x, 211); + return __kernel_standard_l (x, x, 211); } else if (x == 0.0L) /* d = -one/(x-x) */ - return __kernel_standard (x, x, 210); + return __kernel_standard_l (x, x, 210); else if (_LIB_VERSION != _POSIX_) /* y1(x>X_TLOSS) */ - return __kernel_standard (x, x, 237); + return __kernel_standard_l (x, x, 237); } return __ieee754_y1l (x); diff --git a/libc/math/w_jnl.c b/libc/math/w_jnl.c index 2028d488d..0263147b2 100644 --- a/libc/math/w_jnl.c +++ b/libc/math/w_jnl.c @@ -59,7 +59,7 @@ long double __jnl(int n, long double x) /* wrapper jnl */ || __isnanl(x)) return z; if(fabsl(x)>X_TLOSS) { - return __kernel_standard((double)n,x,238); /* jn(|x|>X_TLOSS,n) */ + return __kernel_standard_l((double)n,x,238); /* jn(|x|>X_TLOSS,n) */ } else return z; #endif @@ -77,13 +77,13 @@ long double __ynl(int n, long double x) /* wrapper ynl */ if(x <= 0.0){ if(x==0.0) /* d= -one/(x-x); */ - return __kernel_standard((double)n,x,212); + return __kernel_standard_l((double)n,x,212); else /* d = zero/(x-x); */ - return __kernel_standard((double)n,x,213); + return __kernel_standard_l((double)n,x,213); } if(x>X_TLOSS && _LIB_VERSION != _POSIX_) { - return __kernel_standard((double)n,x,239); /* yn(x>X_TLOSS,n) */ + return __kernel_standard_l((double)n,x,239); /* yn(x>X_TLOSS,n) */ } else return z; #endif diff --git a/libc/math/w_lgammal.c b/libc/math/w_lgammal.c index 7df38e761..1dc7e5862 100644 --- a/libc/math/w_lgammal.c +++ b/libc/math/w_lgammal.c @@ -35,10 +35,10 @@ __lgammal(long double x) : &local_signgam); if(__builtin_expect(!__finitel(y), 0) && __finitel(x) && _LIB_VERSION != _IEEE_) - return __kernel_standard(x, x, - __floorl(x)==x&&x<=0.0L - ? 215 /* lgamma pole */ - : 214); /* lgamma overflow */ + return __kernel_standard_l(x, x, + __floorl(x)==x&&x<=0.0L + ? 215 /* lgamma pole */ + : 214); /* lgamma overflow */ return y; } diff --git a/libc/math/w_log10l.c b/libc/math/w_log10l.c index 0e5a13750..3371b7bd5 100644 --- a/libc/math/w_log10l.c +++ b/libc/math/w_log10l.c @@ -30,12 +30,12 @@ __log10l (long double x) if (x == 0.0L) { feraiseexcept (FE_DIVBYZERO); - return __kernel_standard (x, x, 218); /* log10(0) */ + return __kernel_standard_l (x, x, 218); /* log10(0) */ } else { feraiseexcept (FE_INVALID); - return __kernel_standard (x, x, 219); /* log10(x<0) */ + return __kernel_standard_l (x, x, 219); /* log10(x<0) */ } } diff --git a/libc/math/w_log2l.c b/libc/math/w_log2l.c index eed04ff6c..1400c938e 100644 --- a/libc/math/w_log2l.c +++ b/libc/math/w_log2l.c @@ -30,12 +30,12 @@ __log2l (long double x) if (x == 0.0L) { feraiseexcept (FE_DIVBYZERO); - return __kernel_standard (x, x, 248); /* log2(0) */ + return __kernel_standard_l (x, x, 248); /* log2(0) */ } else { feraiseexcept (FE_INVALID); - return __kernel_standard (x, x, 249); /* log2(x<0) */ + return __kernel_standard_l (x, x, 249); /* log2(x<0) */ } } diff --git a/libc/math/w_logl.c b/libc/math/w_logl.c index 593b37d81..9ea4ff726 100644 --- a/libc/math/w_logl.c +++ b/libc/math/w_logl.c @@ -30,12 +30,12 @@ __logl (long double x) if (x == 0.0L) { feraiseexcept (FE_DIVBYZERO); - return __kernel_standard (x, x, 216); /* log(0) */ + return __kernel_standard_l (x, x, 216); /* log(0) */ } else { feraiseexcept (FE_INVALID); - return __kernel_standard (x, x, 217); /* log(x<0) */ + return __kernel_standard_l (x, x, 217); /* log(x<0) */ } } diff --git a/libc/math/w_powl.c b/libc/math/w_powl.c index 5bb85976e..37863889c 100644 --- a/libc/math/w_powl.c +++ b/libc/math/w_powl.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 Ulrich Drepper <drepper@gmail.com>, 2011. @@ -33,25 +33,25 @@ __powl (long double x, long double y) { if (y == 0.0L) /* pow(NaN,0.0) */ - return __kernel_standard (x, y, 242); + return __kernel_standard_l (x, y, 242); } else if (__finitel (x) && __finitel (y)) { if (__isnanl (z)) /* pow neg**non-int */ - return __kernel_standard (x, y, 224); + return __kernel_standard_l (x, y, 224); else if (x == 0.0L && y < 0.0L) { if (signbit (x) && signbit (z)) /* pow(-0.0,negative) */ - return __kernel_standard (x, y, 223); + return __kernel_standard_l (x, y, 223); else /* pow(+0.0,negative) */ - return __kernel_standard (x, y, 243); + return __kernel_standard_l (x, y, 243); } else /* pow overflow */ - return __kernel_standard (x, y, 221); + return __kernel_standard_l (x, y, 221); } } } @@ -62,11 +62,11 @@ __powl (long double x, long double y) { if (y == 0.0L) /* pow(0.0,0.0) */ - return __kernel_standard (x, y, 220); + return __kernel_standard_l (x, y, 220); } else /* pow underflow */ - return __kernel_standard (x, y, 222); + return __kernel_standard_l (x, y, 222); } return z; diff --git a/libc/math/w_remainderl.c b/libc/math/w_remainderl.c index 3f67b5875..a21065cd7 100644 --- a/libc/math/w_remainderl.c +++ b/libc/math/w_remainderl.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 Ulrich Drepper <drepper@gmail.com>, 2011. @@ -27,7 +27,7 @@ __remainderl (long double x, long double y) if (((__builtin_expect (y == 0.0L, 0) && ! __isnanl (x)) || (__builtin_expect (__isinf_nsl (x), 0) && ! __isnanl (y))) && _LIB_VERSION != _IEEE_) - return __kernel_standard (x, y, 228); /* remainder domain */ + return __kernel_standard_l (x, y, 228); /* remainder domain */ return __ieee754_remainderl (x, y); } diff --git a/libc/math/w_scalbl.c b/libc/math/w_scalbl.c index b3584dea0..1181874ce 100644 --- a/libc/math/w_scalbl.c +++ b/libc/math/w_scalbl.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 Ulrich Drepper <drepper@gmail.com>, 2011. @@ -30,12 +30,12 @@ sysv_scalbl (long double x, long double fn) if (__builtin_expect (__isinfl (z), 0)) { if (__finitel (x)) - return __kernel_standard (x, fn, 232); /* scalb overflow */ + return __kernel_standard_l (x, fn, 232); /* scalb overflow */ else __set_errno (ERANGE); } else if (__builtin_expect (z == 0.0L, 0) && z != x) - return __kernel_standard (x, fn, 233); /* scalb underflow */ + return __kernel_standard_l (x, fn, 233); /* scalb underflow */ return z; } diff --git a/libc/math/w_sinhl.c b/libc/math/w_sinhl.c index 5e65cf9b9..f801b4dd9 100644 --- a/libc/math/w_sinhl.c +++ b/libc/math/w_sinhl.c @@ -27,7 +27,7 @@ __sinhl (long double x) long double z = __ieee754_sinhl (x); if (__builtin_expect (!__finitel (z), 0) && __finitel (x) && _LIB_VERSION != _IEEE_) - return __kernel_standard (x, x, 225); /* sinh overflow */ + return __kernel_standard_l (x, x, 225); /* sinh overflow */ return z; } diff --git a/libc/math/w_sqrtl.c b/libc/math/w_sqrtl.c index 2a4a0481b..74529f9e2 100644 --- a/libc/math/w_sqrtl.c +++ b/libc/math/w_sqrtl.c @@ -25,7 +25,7 @@ long double __sqrtl (long double x) { if (__builtin_expect (isless (x, 0.0L), 0) && _LIB_VERSION != _IEEE_) - return __kernel_standard (x, x, 226); /* sqrt(negative) */ + return __kernel_standard_l (x, x, 226); /* sqrt(negative) */ return __ieee754_sqrtl (x); } diff --git a/libc/math/w_tgammal.c b/libc/math/w_tgammal.c index 6910f923a..86adab29e 100644 --- a/libc/math/w_tgammal.c +++ b/libc/math/w_tgammal.c @@ -30,11 +30,11 @@ __tgammal(long double x) if(__builtin_expect(!__finitel(y), 0) && __finitel(x) && _LIB_VERSION != _IEEE_) { if(x==0.0) - return __kernel_standard(x,x,250); /* tgamma pole */ + return __kernel_standard_l(x,x,250); /* tgamma pole */ else if(__floorl(x)==x&&x<0.0L) - return __kernel_standard(x,x,241); /* tgamma domain */ + return __kernel_standard_l(x,x,241); /* tgamma domain */ else - return __kernel_standard(x,x,240); /* tgamma overflow */ + return __kernel_standard_l(x,x,240); /* tgamma overflow */ } return local_signgam < 0 ? - y : y; } diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog index ad345f950..4622393a4 100644 --- a/libc/nptl/ChangeLog +++ b/libc/nptl/ChangeLog @@ -1,3 +1,9 @@ +2012-03-27 David S. Miller <davem@davemloft.net> + + * tst-cond16.c (do_test): Use a thread stack size which is either + PTHREAD_STACK_MIN or the page size, whichever is larger. + * tst-cond18.c (do_test): Likewise. + 2012-03-19 H.J. Lu <hongjiu.lu@intel.com> * sysdeps/x86_64/pthreaddef.h (CURRENT_STACK_FRAME): Use diff --git a/libc/nptl/tst-cond16.c b/libc/nptl/tst-cond16.c index 44b98634b..8a35d953c 100644 --- a/libc/nptl/tst-cond16.c +++ b/libc/nptl/tst-cond16.c @@ -76,9 +76,15 @@ do_test (void) count *= 4; pthread_t th[count]; - int i, ret; + pthread_attr_t attr; + int i, ret, sz; + pthread_attr_init (&attr); + sz = __getpagesize (); + if (sz < PTHREAD_STACK_MIN) + sz = PTHREAD_STACK_MIN; + pthread_attr_setstacksize (&attr, sz); for (i = 0; i < count; ++i) - if ((ret = pthread_create (&th[i], NULL, tf, NULL)) != 0) + if ((ret = pthread_create (&th[i], &attr, tf, NULL)) != 0) { errno = ret; printf ("pthread_create %d failed: %m\n", i); diff --git a/libc/nptl/tst-cond18.c b/libc/nptl/tst-cond18.c index a1bb947ac..264c93238 100644 --- a/libc/nptl/tst-cond18.c +++ b/libc/nptl/tst-cond18.c @@ -87,10 +87,16 @@ do_test (void) count *= 8; pthread_t th[count + 1]; - int i, ret; + pthread_attr_t attr; + int i, ret, sz; + pthread_attr_init (&attr); + sz = __getpagesize (); + if (sz < PTHREAD_STACK_MIN) + sz = PTHREAD_STACK_MIN; + pthread_attr_setstacksize (&attr, sz); for (i = 0; i <= count; ++i) - if ((ret = pthread_create (&th[i], NULL, tf, (void *) (long) i)) != 0) + if ((ret = pthread_create (&th[i], &attr, tf, (void *) (long) i)) != 0) { errno = ret; printf ("pthread_create %d failed: %m\n", i); diff --git a/libc/nscd/Makefile b/libc/nscd/Makefile index 0780e112c..4e0d9204c 100644 --- a/libc/nscd/Makefile +++ b/libc/nscd/Makefile @@ -53,11 +53,6 @@ extra-objs-$(OPTION_EGLIBC_INET) += $(nscd-modules:=.o) endif -ifeq (yes,$(build-static-nss)) -otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ - $(resolvobjdir)/libresolv.a -endif - all-nscd-modules := $(nscd-modules) selinux ifeq (yes,$(have-selinux)) ifeq (yes,$(have-libaudit)) diff --git a/libc/nss/Makefile b/libc/nss/Makefile index 62355ebab..5c93c710f 100644 --- a/libc/nss/Makefile +++ b/libc/nss/Makefile @@ -50,11 +50,6 @@ xtests-$(OPTION_EGLIBC_INET) += bug-erange include ../Makeconfig -ifeq (yes,$(build-static-nss)) -otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ - $(resolvobjdir)/libresolv.a -endif - # Specify rules for the nss_* modules. We have some services. services := files db @@ -81,10 +76,12 @@ generated += $(filter-out db-alias.c db-netgrp.c, \ install-others += $(inst_vardbdir)/Makefile -# Build static module if requested -ifneq ($(build-static-nss),yes) +# Build static module into libc if requested libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes)) libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes)) +ifeq ($(build-static-nss),yes) +routines += $(libnss_files-routines) +static-only-routines += $(libnss_files-routines) endif ifneq ($(OPTION_EGLIBC_NSSWITCH),y) @@ -128,11 +125,6 @@ endif include ../Rules - -ifeq (yes,$(build-static-nss)) -$(objpfx)getent: $(objpfx)libnss_files.a -endif - ifeq (yes,$(have-selinux)) LDLIBS-makedb := -lselinux endif diff --git a/libc/nss/getnssent.c b/libc/nss/getnssent.c index 014b37681..6c1eac9d6 100644 --- a/libc/nss/getnssent.c +++ b/libc/nss/getnssent.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2004, 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 @@ __nss_getent (getent_r_function func, void **resbuf, char **buffer, *buffer = malloc (*buffer_size); } - while (buffer != NULL + while (*buffer != NULL && func (resbuf, *buffer, *buffer_size, &result, h_errnop) == ERANGE && (h_errnop == NULL || *h_errnop == NETDB_INTERNAL)) { diff --git a/libc/posix/Makefile b/libc/posix/Makefile index ee2f0e4c4..c74f6c05e 100644 --- a/libc/posix/Makefile +++ b/libc/posix/Makefile @@ -138,14 +138,6 @@ generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \ include ../Rules -ifeq (yes,$(build-static-nss)) -# We need it for "make check" only. We can skip them if they haven't -# been built yet during "make". -otherlibs += $(wildcard $(nssobjdir)/libnss_files.a \ - $(resolvobjdir)/libnss_dns.a \ - $(resolvobjdir)/libresolv.a) -endif - # eglibc: ifeq (no,$(cross-compiling)) # globtest and wordexp-test currently only works with shared libraries ifeq (yes,$(build-shared)) diff --git a/libc/posix/confstr.c b/libc/posix/confstr.c index e8822e9cb..3f79d459a 100644 --- a/libc/posix/confstr.c +++ b/libc/posix/confstr.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1991,1996,1997,2000-2004,2009,2010 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 @@ -35,6 +34,10 @@ confstr (name, buf, len) const char *string = ""; size_t string_len = 1; + /* Note that this buffer must be large enough for the longest strings + used below. */ + char restenvs[4 * sizeof "POSIX_V7_LPBIG_OFFBIG"]; + switch (name) { case _CS_PATH: diff --git a/libc/posix/confstr.inc b/libc/posix/confstr.inc index ee8830408..9f1a0711e 100644 --- a/libc/posix/confstr.inc +++ b/libc/posix/confstr.inc @@ -28,59 +28,55 @@ wint_t types are no greater than the width of type long. Currently this means all environment which the system allows. */ - { - char restenvs[4 * sizeof "POSIX_V7_LPBIG_OFFBIG"]; - - string_len = 0; + string_len = 0; #ifndef _POSIX_V7_ILP32_OFF32 - if (__sysconf (_SC_V7_ILP32_OFF32) > 0) + if (__sysconf (_SC_V7_ILP32_OFF32) > 0) #endif #if !defined _POSIX_V7_ILP32_OFF32 || _POSIX_V7_ILP32_OFF32 > 0 - { - memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFF32", - sizeof "POSIX_V7_ILP32_OFF32" - 1); - string_len += sizeof "POSIX_V7_ILP32_OFF32" - 1; - } + { + memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFF32", + sizeof "POSIX_V7_ILP32_OFF32" - 1); + string_len += sizeof "POSIX_V7_ILP32_OFF32" - 1; + } #endif #ifndef _POSIX_V7_ILP32_OFFBIG - if (__sysconf (_SC_V7_ILP32_OFFBIG) > 0) + if (__sysconf (_SC_V7_ILP32_OFFBIG) > 0) #endif #if !defined _POSIX_V7_ILP32_OFFBIG || _POSIX_V7_ILP32_OFFBIG > 0 - { - if (string_len) - restenvs[string_len++] = '\n'; - memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFFBIG", - sizeof "POSIX_V7_ILP32_OFFBIG" - 1); - string_len += sizeof "POSIX_V7_ILP32_OFFBIG" - 1; - } + { + if (string_len) + restenvs[string_len++] = '\n'; + memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFFBIG", + sizeof "POSIX_V7_ILP32_OFFBIG" - 1); + string_len += sizeof "POSIX_V7_ILP32_OFFBIG" - 1; + } #endif #ifndef _POSIX_V7_LP64_OFF64 - if (__sysconf (_SC_V7_LP64_OFF64) > 0) + if (__sysconf (_SC_V7_LP64_OFF64) > 0) #endif #if !defined _POSIX_V7_LP64_OFF64 || _POSIX_V7_LP64_OFF64 > 0 - { - if (string_len) - restenvs[string_len++] = '\n'; - memcpy (restenvs + string_len, "POSIX_V7_LP64_OFF64", - sizeof "POSIX_V7_LP64_OFF64" - 1); - string_len += sizeof "POSIX_V7_LP64_OFF64" - 1; - } + { + if (string_len) + restenvs[string_len++] = '\n'; + memcpy (restenvs + string_len, "POSIX_V7_LP64_OFF64", + sizeof "POSIX_V7_LP64_OFF64" - 1); + string_len += sizeof "POSIX_V7_LP64_OFF64" - 1; + } #endif #ifndef _POSIX_V7_LPBIG_OFFBIG - if (__sysconf (_SC_V7_LPBIG_OFFBIG) > 0) + if (__sysconf (_SC_V7_LPBIG_OFFBIG) > 0) #endif #if !defined _POSIX_V7_LPBIG_OFFBIG || _POSIX_V7_LPBIG_OFFBIG > 0 - { - if (string_len) - restenvs[string_len++] = '\n'; - memcpy (restenvs + string_len, "POSIX_V7_LPBIG_OFFBIG", - sizeof "POSIX_V7_LPBIG_OFFBIG" - 1); - string_len += sizeof "POSIX_V7_LPBIG_OFFBIG" - 1; - } -#endif - restenvs[string_len++] = '\0'; - string = restenvs; - } + { + if (string_len) + restenvs[string_len++] = '\n'; + memcpy (restenvs + string_len, "POSIX_V7_LPBIG_OFFBIG", + sizeof "POSIX_V7_LPBIG_OFFBIG" - 1); + string_len += sizeof "POSIX_V7_LPBIG_OFFBIG" - 1; + } +#endif + restenvs[string_len++] = '\0'; + string = restenvs; break; case _CS_V6_WIDTH_RESTRICTED_ENVS: @@ -91,59 +87,55 @@ wint_t types are no greater than the width of type long. Currently this means all environment which the system allows. */ - { - char restenvs[4 * sizeof "POSIX_V6_LPBIG_OFFBIG"]; - - string_len = 0; + string_len = 0; #ifndef _POSIX_V6_ILP32_OFF32 - if (__sysconf (_SC_V6_ILP32_OFF32) > 0) + if (__sysconf (_SC_V6_ILP32_OFF32) > 0) #endif #if !defined _POSIX_V6_ILP32_OFF32 || _POSIX_V6_ILP32_OFF32 > 0 - { - memcpy (restenvs + string_len, "POSIX_V6_ILP32_OFF32", - sizeof "POSIX_V6_ILP32_OFF32" - 1); - string_len += sizeof "POSIX_V6_ILP32_OFF32" - 1; - } + { + memcpy (restenvs + string_len, "POSIX_V6_ILP32_OFF32", + sizeof "POSIX_V6_ILP32_OFF32" - 1); + string_len += sizeof "POSIX_V6_ILP32_OFF32" - 1; + } #endif #ifndef _POSIX_V6_ILP32_OFFBIG - if (__sysconf (_SC_V6_ILP32_OFFBIG) > 0) + if (__sysconf (_SC_V6_ILP32_OFFBIG) > 0) #endif #if !defined _POSIX_V6_ILP32_OFFBIG || _POSIX_V6_ILP32_OFFBIG > 0 - { - if (string_len) - restenvs[string_len++] = '\n'; - memcpy (restenvs + string_len, "POSIX_V6_ILP32_OFFBIG", - sizeof "POSIX_V6_ILP32_OFFBIG" - 1); - string_len += sizeof "POSIX_V6_ILP32_OFFBIG" - 1; - } + { + if (string_len) + restenvs[string_len++] = '\n'; + memcpy (restenvs + string_len, "POSIX_V6_ILP32_OFFBIG", + sizeof "POSIX_V6_ILP32_OFFBIG" - 1); + string_len += sizeof "POSIX_V6_ILP32_OFFBIG" - 1; + } #endif #ifndef _POSIX_V6_LP64_OFF64 - if (__sysconf (_SC_V6_LP64_OFF64) > 0) + if (__sysconf (_SC_V6_LP64_OFF64) > 0) #endif #if !defined _POSIX_V6_LP64_OFF64 || _POSIX_V6_LP64_OFF64 > 0 - { - if (string_len) - restenvs[string_len++] = '\n'; - memcpy (restenvs + string_len, "POSIX_V6_LP64_OFF64", - sizeof "POSIX_V6_LP64_OFF64" - 1); - string_len += sizeof "POSIX_V6_LP64_OFF64" - 1; - } + { + if (string_len) + restenvs[string_len++] = '\n'; + memcpy (restenvs + string_len, "POSIX_V6_LP64_OFF64", + sizeof "POSIX_V6_LP64_OFF64" - 1); + string_len += sizeof "POSIX_V6_LP64_OFF64" - 1; + } #endif #ifndef _POSIX_V6_LPBIG_OFFBIG - if (__sysconf (_SC_V6_LPBIG_OFFBIG) > 0) + if (__sysconf (_SC_V6_LPBIG_OFFBIG) > 0) #endif #if !defined _POSIX_V6_LPBIG_OFFBIG || _POSIX_V6_LPBIG_OFFBIG > 0 - { - if (string_len) - restenvs[string_len++] = '\n'; - memcpy (restenvs + string_len, "POSIX_V6_LPBIG_OFFBIG", - sizeof "POSIX_V6_LPBIG_OFFBIG" - 1); - string_len += sizeof "POSIX_V6_LPBIG_OFFBIG" - 1; - } -#endif - restenvs[string_len++] = '\0'; - string = restenvs; - } + { + if (string_len) + restenvs[string_len++] = '\n'; + memcpy (restenvs + string_len, "POSIX_V6_LPBIG_OFFBIG", + sizeof "POSIX_V6_LPBIG_OFFBIG" - 1); + string_len += sizeof "POSIX_V6_LPBIG_OFFBIG" - 1; + } +#endif + restenvs[string_len++] = '\0'; + string = restenvs; break; case _CS_V5_WIDTH_RESTRICTED_ENVS: @@ -154,57 +146,53 @@ wint_t types are no greater than the width of type long. Currently this means all environment which the system allows. */ - { - char restenvs[4 * sizeof "XBS5_LPBIG_OFFBIG"]; - - string_len = 0; + string_len = 0; #ifndef _XBS5_ILP32_OFF32 - if (__sysconf (_SC_XBS5_ILP32_OFF32) > 0) + if (__sysconf (_SC_XBS5_ILP32_OFF32) > 0) #endif #if !defined _XBS5_ILP32_OFF32 || _XBS5_ILP32_OFF32 > 0 - { - memcpy (restenvs + string_len, "XBS5_ILP32_OFF32", - sizeof "XBS5_ILP32_OFF32" - 1); - string_len += sizeof "XBS5_ILP32_OFF32" - 1; - } + { + memcpy (restenvs + string_len, "XBS5_ILP32_OFF32", + sizeof "XBS5_ILP32_OFF32" - 1); + string_len += sizeof "XBS5_ILP32_OFF32" - 1; + } #endif #ifndef _XBS5_ILP32_OFFBIG - if (__sysconf (_SC_XBS5_ILP32_OFFBIG) > 0) + if (__sysconf (_SC_XBS5_ILP32_OFFBIG) > 0) #endif #if !defined _XBS5_ILP32_OFFBIG || _XBS5_ILP32_OFFBIG > 0 - { - if (string_len) - restenvs[string_len++] = '\n'; - memcpy (restenvs + string_len, "XBS5_ILP32_OFFBIG", - sizeof "XBS5_ILP32_OFFBIG" - 1); - string_len += sizeof "XBS5_ILP32_OFFBIG" - 1; - } + { + if (string_len) + restenvs[string_len++] = '\n'; + memcpy (restenvs + string_len, "XBS5_ILP32_OFFBIG", + sizeof "XBS5_ILP32_OFFBIG" - 1); + string_len += sizeof "XBS5_ILP32_OFFBIG" - 1; + } #endif #ifndef _XBS5_LP64_OFF64 - if (__sysconf (_SC_XBS5_LP64_OFF64) > 0) + if (__sysconf (_SC_XBS5_LP64_OFF64) > 0) #endif #if !defined _XBS5_LP64_OFF64 || _XBS5_LP64_OFF64 > 0 - { - if (string_len) - restenvs[string_len++] = '\n'; - memcpy (restenvs + string_len, "XBS5_LP64_OFF64", - sizeof "XBS5_LP64_OFF64" - 1); - string_len += sizeof "XBS5_LP64_OFF64" - 1; - } + { + if (string_len) + restenvs[string_len++] = '\n'; + memcpy (restenvs + string_len, "XBS5_LP64_OFF64", + sizeof "XBS5_LP64_OFF64" - 1); + string_len += sizeof "XBS5_LP64_OFF64" - 1; + } #endif #ifndef _XBS5_LPBIG_OFFBIG - if (__sysconf (_SC_XBS5_LPBIG_OFFBIG) > 0) + if (__sysconf (_SC_XBS5_LPBIG_OFFBIG) > 0) #endif #if !defined _XBS5_LPBIG_OFFBIG || _XBS5_LPBIG_OFFBIG > 0 - { - if (string_len) - restenvs[string_len++] = '\n'; - memcpy (restenvs + string_len, "XBS5_LPBIG_OFFBIG", - sizeof "XBS5_LPBIG_OFFBIG" - 1); - string_len += sizeof "XBS5_LPBIG_OFFBIG" - 1; - } -#endif - restenvs[string_len++] = '\0'; - string = restenvs; - } + { + if (string_len) + restenvs[string_len++] = '\n'; + memcpy (restenvs + string_len, "XBS5_LPBIG_OFFBIG", + sizeof "XBS5_LPBIG_OFFBIG" - 1); + string_len += sizeof "XBS5_LPBIG_OFFBIG" - 1; + } +#endif + restenvs[string_len++] = '\0'; + string = restenvs; break; diff --git a/libc/pwd/Makefile b/libc/pwd/Makefile index c4cc26f8c..f5f67aabd 100644 --- a/libc/pwd/Makefile +++ b/libc/pwd/Makefile @@ -43,8 +43,3 @@ CFLAGS-getpw.c = -fexceptions CFLAGS-fgetpwent_r.c = -D_IO_MTSAFE_IO endif - -ifeq (yes,$(build-static-nss)) -otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ - $(resolvobjdir)/libresolv.a -endif diff --git a/libc/resolv/Makefile b/libc/resolv/Makefile index 288f679f5..7297408c0 100644 --- a/libc/resolv/Makefile +++ b/libc/resolv/Makefile @@ -58,8 +58,10 @@ subdir-dirs = nss_dns vpath %.c nss_dns libnss_dns-routines := dns-host dns-network dns-canon -ifneq ($(build-static-nss),yes) libnss_dns-inhibit-o = $(filter-out .os,$(object-suffixes)) +ifeq ($(build-static-nss),yes) +routines += $(libnss_dns-routines) $(libresolv-routines) +static-only-routines += $(libnss_dns-routines) $(libresolv-routines) endif ifeq (yesyesy,$(build-shared)$(have-thread-library)$(OPTION_EGLIBC_INET_ANL)) diff --git a/libc/resolv/nss_dns/dns-host.c b/libc/resolv/nss_dns/dns-host.c index 01369f607..10aecb860 100644 --- a/libc/resolv/nss_dns/dns-host.c +++ b/libc/resolv/nss_dns/dns-host.c @@ -1219,7 +1219,13 @@ gaih_getanswer (const querybuf *answer1, int anslen1, const querybuf *answer2, &first); if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND || (status == NSS_STATUS_TRYAGAIN - && (errno != ERANGE || *h_errnop != NO_RECOVERY))) + /* We want to look at the second answer in case of an + NSS_STATUS_TRYAGAIN only if the error is non-recoverable, i.e. + *h_errnop is NO_RECOVERY. If not, and if the failure was due to + an insufficient buffer (ERANGE), then we need to drop the results + and pass on the NSS_STATUS_TRYAGAIN to the caller so that it can + repeat the query with a larger buffer. */ + && (*errnop != ERANGE || *h_errnop == NO_RECOVERY))) && answer2 != NULL && anslen2 > 0) { enum nss_status status2 = gaih_getanswer_slice(answer2, anslen2, qname, diff --git a/libc/rt/Makefile b/libc/rt/Makefile index 1ad2015dd..9b9f59921 100644 --- a/libc/rt/Makefile +++ b/libc/rt/Makefile @@ -78,8 +78,3 @@ $(tests:%=$(objpfx)%-bp): $(objpfx)librt_b.a $(bounded-thread-library) endif tst-mqueue7-ARGS = -- $(local-built-program-cmd) - -ifeq (yes,$(build-static-nss)) -otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ - $(resolvobjdir)/libresolv.a -endif diff --git a/libc/stdio-common/_itowa.c b/libc/stdio-common/_itowa.c index 1ebc712b4..9381d33b6 100644 --- a/libc/stdio-common/_itowa.c +++ b/libc/stdio-common/_itowa.c @@ -85,7 +85,7 @@ extern const wchar_t _itowa_lower_digits[] attribute_hidden; extern const wchar_t _itowa_upper_digits[] attribute_hidden; -#if LLONG_MAX != LONG_MAX +#if _ITOA_NEEDED wchar_t * _itowa (value, buflim, base, upper_case) unsigned long long int value; diff --git a/libc/stdio-common/_itowa.h b/libc/stdio-common/_itowa.h index 0f3331144..aa349573f 100644 --- a/libc/stdio-common/_itowa.h +++ b/libc/stdio-common/_itowa.h @@ -20,6 +20,7 @@ #define _ITOWA_H 1 #include <features.h> #include <wchar.h> +#include <_itoa.h> /* Convert VALUE into ASCII in base BASE (2..36). Write backwards starting the character just before BUFLIM. @@ -31,7 +32,7 @@ extern wchar_t *_itowa (unsigned long long int value, wchar_t *buflim, static inline wchar_t * __attribute__ ((unused, always_inline)) -_itowa_word (unsigned long value, wchar_t *buflim, +_itowa_word (_ITOA_WORD_TYPE value, wchar_t *buflim, unsigned int base, int upper_case) { extern const wchar_t _itowa_upper_digits[] attribute_hidden; @@ -61,4 +62,10 @@ _itowa_word (unsigned long value, wchar_t *buflim, } #undef SPECIAL +#if !_ITOA_NEEDED +/* No need for special long long versions. */ +# define _itowa(value, buf, base, upper_case) \ + _itowa_word (value, buf, base, upper_case) +#endif + #endif /* itowa.h */ diff --git a/libc/sunrpc/Makefile b/libc/sunrpc/Makefile index 0cd9fd47f..227ef445f 100644 --- a/libc/sunrpc/Makefile +++ b/libc/sunrpc/Makefile @@ -110,11 +110,6 @@ ifeq ($(have-thread-library),yes) xtests-$(OPTION_EGLIBC_SUNRPC) += thrsvc endif -ifeq (yes,$(build-static-nss)) -otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ - $(resolvobjdir)/libresolv.a -endif - ifneq (yes,$(install-bootstrap-headers)) headers += $(rpcsvc:%.x=rpcsvc/%.h) extra-libs-$(OPTION_EGLIBC_SUNRPC) += librpcsvc diff --git a/libc/sysdeps/generic/_itoa.h b/libc/sysdeps/generic/_itoa.h index 8870ee028..0a670431e 100644 --- a/libc/sysdeps/generic/_itoa.h +++ b/libc/sysdeps/generic/_itoa.h @@ -21,6 +21,21 @@ #include <limits.h> +/* When long long is different from long, by default, _itoa_word is + provided to convert long to ASCII and _itoa is provided to convert + long long. A sysdeps _itoa.h can define _ITOA_NEEDED to 0 and define + _ITOA_WORD_TYPE to unsigned long long int to override it so that + _itoa_word is changed to convert long long to ASCII and _itoa is + mapped to _itoa_word. */ + +#ifndef _ITOA_NEEDED +# define _ITOA_NEEDED (LONG_MAX != LLONG_MAX) +#endif +#ifndef _ITOA_WORD_TYPE +# define _ITOA_WORD_TYPE unsigned long int +#endif + + /* Convert VALUE into ASCII in base BASE (2..36). Write backwards starting the character just before BUFLIM. Return the address of the first (left-to-right) character in the number. @@ -35,11 +50,11 @@ extern const char _itoa_lower_digits[]; extern const char _itoa_lower_digits_internal[] attribute_hidden; #ifndef NOT_IN_libc -extern char *_itoa_word (unsigned long value, char *buflim, +extern char *_itoa_word (_ITOA_WORD_TYPE value, char *buflim, unsigned int base, int upper_case); #else static inline char * __attribute__ ((unused, always_inline)) -_itoa_word (unsigned long value, char *buflim, +_itoa_word (_ITOA_WORD_TYPE value, char *buflim, unsigned int base, int upper_case) { const char *digits = (upper_case @@ -76,12 +91,13 @@ _itoa_word (unsigned long value, char *buflim, /* Similar to the _itoa functions, but output starts at buf and pointer after the last written character is returned. */ -extern char *_fitoa_word (unsigned long value, char *buf, unsigned int base, +extern char *_fitoa_word (_ITOA_WORD_TYPE value, char *buf, + unsigned int base, int upper_case) attribute_hidden; extern char *_fitoa (unsigned long long value, char *buf, unsigned int base, int upper_case) attribute_hidden; -#if LONG_MAX == LLONG_MAX +#if !_ITOA_NEEDED /* No need for special long long versions. */ # define _itoa(value, buf, base, upper_case) \ _itoa_word (value, buf, base, upper_case) diff --git a/libc/sysdeps/generic/elf/backtracesyms.c b/libc/sysdeps/generic/elf/backtracesyms.c deleted file mode 100644 index d75ce0a32..000000000 --- a/libc/sysdeps/generic/elf/backtracesyms.c +++ /dev/null @@ -1,122 +0,0 @@ -/* Return list with names for address in backtrace. - Copyright (C) 1998,1999,2000,2001,2003,2009 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 - 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 <assert.h> -#include <execinfo.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <ldsodefs.h> - -#if __ELF_NATIVE_CLASS == 32 -# define WORD_WIDTH 8 -#else -/* We assyme 64bits. */ -# define WORD_WIDTH 16 -#endif - - -char ** -__backtrace_symbols (array, size) - void *const *array; - int size; -{ - Dl_info info[size]; - int status[size]; - int cnt; - size_t total = 0; - char **result; - - /* Fill in the information we can get from `dladdr'. */ - for (cnt = 0; cnt < size; ++cnt) - { - struct link_map *map; - status[cnt] = _dl_addr (array[cnt], &info[cnt], &map, NULL); - if (status[cnt] && info[cnt].dli_fname && info[cnt].dli_fname[0] != '\0') - { - /* We have some info, compute the length of the string which will be - "<file-name>(<sym-name>+offset) [address]. */ - total += (strlen (info[cnt].dli_fname ?: "") - + strlen (info[cnt].dli_sname ?: "") - + 3 + WORD_WIDTH + 3 + WORD_WIDTH + 5); - - /* The load bias is more useful to the user than the load - address. The use of these addresses is to calculate an - address in the ELF file, so its prelinked bias is not - something we want to subtract out. */ - info[cnt].dli_fbase = (void *) map->l_addr; - } - else - total += 5 + WORD_WIDTH; - } - - /* Allocate memory for the result. */ - result = (char **) malloc (size * sizeof (char *) + total); - if (result != NULL) - { - char *last = (char *) (result + size); - - for (cnt = 0; cnt < size; ++cnt) - { - result[cnt] = last; - - if (status[cnt] - && info[cnt].dli_fname != NULL && info[cnt].dli_fname[0] != '\0') - { - if (info[cnt].dli_sname == NULL) - /* We found no symbol name to use, so describe it as - relative to the file. */ - info[cnt].dli_saddr = info[cnt].dli_fbase; - - if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0) - last += 1 + sprintf (last, "%s(%s) [%p]", - info[cnt].dli_fname ?: "", - info[cnt].dli_sname ?: "", - array[cnt]); - else - { - char sign; - ptrdiff_t offset; - if (array[cnt] >= (void *) info[cnt].dli_saddr) - { - sign = '+'; - offset = array[cnt] - info[cnt].dli_saddr; - } - else - { - sign = '-'; - offset = info[cnt].dli_saddr - array[cnt]; - } - - last += 1 + sprintf (last, "%s(%s%c%#tx) [%p]", - info[cnt].dli_fname ?: "", - info[cnt].dli_sname ?: "", - sign, offset, array[cnt]); - } - } - else - last += 1 + sprintf (last, "[%p]", array[cnt]); - } - assert (last <= (char *) result + size * sizeof (char *) + total); - } - - return result; -} -weak_alias (__backtrace_symbols, backtrace_symbols) diff --git a/libc/sysdeps/generic/elf/backtracesymsfd.c b/libc/sysdeps/generic/elf/backtracesymsfd.c deleted file mode 100644 index 3562c50a7..000000000 --- a/libc/sysdeps/generic/elf/backtracesymsfd.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Write formatted list with names for addresses in backtrace to a file. - Copyright (C) 1998,2000,2003,2005,2009,2011 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 - 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 <execinfo.h> -#include <string.h> -#include <sys/uio.h> - -#include <_itoa.h> -#include <ldsodefs.h> - -#if __ELF_NATIVE_CLASS == 32 -# define WORD_WIDTH 8 -#else -/* We assume 64bits. */ -# define WORD_WIDTH 16 -#endif - - -void -__backtrace_symbols_fd (array, size, fd) - void *const *array; - int size; - int fd; -{ - struct iovec iov[9]; - int cnt; - - for (cnt = 0; cnt < size; ++cnt) - { - char buf[WORD_WIDTH]; - char buf2[WORD_WIDTH]; - Dl_info info; - struct link_map *map; - size_t last = 0; - - if (_dl_addr (array[cnt], &info, &map, NULL) - && info.dli_fname != NULL && info.dli_fname[0] != '\0') - { - /* Name of the file. */ - iov[0].iov_base = (void *) info.dli_fname; - iov[0].iov_len = strlen (info.dli_fname); - last = 1; - - if (info.dli_sname != NULL || map->l_addr != 0) - { - size_t diff; - - iov[last].iov_base = (void *) "("; - iov[last].iov_len = 1; - ++last; - - if (info.dli_sname != NULL) - { - /* We have a symbol name. */ - iov[last].iov_base = (void *) info.dli_sname; - iov[last].iov_len = strlen (info.dli_sname); - ++last; - } - else - /* We have no symbol, so describe it as relative to the file. - The load bias is more useful to the user than the load - address. The use of these addresses is to calculate an - address in the ELF file, so its prelinked bias is not - something we want to subtract out. */ - info.dli_saddr = (void *) map->l_addr; - - if (array[cnt] >= (void *) info.dli_saddr) - { - iov[last].iov_base = (void *) "+0x"; - diff = array[cnt] - info.dli_saddr; - } - else - { - iov[last].iov_base = (void *) "-0x"; - diff = info.dli_saddr - array[cnt]; - } - iov[last].iov_len = 3; - ++last; - - iov[last].iov_base = _itoa_word ((unsigned long int) diff, - &buf2[WORD_WIDTH], 16, 0); - iov[last].iov_len = (&buf2[WORD_WIDTH] - - (char *) iov[last].iov_base); - ++last; - - iov[last].iov_base = (void *) ")"; - iov[last].iov_len = 1; - ++last; - } - } - - iov[last].iov_base = (void *) "[0x"; - iov[last].iov_len = 3; - ++last; - - iov[last].iov_base = _itoa_word ((unsigned long int) array[cnt], - &buf[WORD_WIDTH], 16, 0); - iov[last].iov_len = &buf[WORD_WIDTH] - (char *) iov[last].iov_base; - ++last; - - iov[last].iov_base = (void *) "]\n"; - iov[last].iov_len = 2; - ++last; - - __writev (fd, iov, last); - } -} -weak_alias (__backtrace_symbols_fd, backtrace_symbols_fd) -libc_hidden_def (__backtrace_symbols_fd) diff --git a/libc/sysdeps/generic/elf/ifunc-sel.h b/libc/sysdeps/generic/ifunc-sel.h index 6a27b69c5..6a27b69c5 100644 --- a/libc/sysdeps/generic/elf/ifunc-sel.h +++ b/libc/sysdeps/generic/ifunc-sel.h diff --git a/libc/sysdeps/generic/ldsodefs.h b/libc/sysdeps/generic/ldsodefs.h index 54b4395d9..4917d80c0 100644 --- a/libc/sysdeps/generic/ldsodefs.h +++ b/libc/sysdeps/generic/ldsodefs.h @@ -187,6 +187,8 @@ struct La_i86_regs; struct La_i86_retval; struct La_x86_64_regs; struct La_x86_64_retval; +struct La_x32_regs; +struct La_x32_retval; struct La_ppc32_regs; struct La_ppc32_retval; struct La_ppc64_regs; @@ -225,6 +227,10 @@ struct audit_ifaces uintptr_t *, struct La_x86_64_regs *, unsigned int *, const char *name, long int *framesizep); + Elf32_Addr (*x32_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *, + uintptr_t *, struct La_x32_regs *, + unsigned int *, const char *name, + long int *framesizep); Elf32_Addr (*ppc32_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *, uintptr_t *, struct La_ppc32_regs *, unsigned int *, const char *name, @@ -269,6 +275,11 @@ struct audit_ifaces const struct La_x86_64_regs *, struct La_x86_64_retval *, const char *); + unsigned int (*x32_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *, + uintptr_t *, + const struct La_x32_regs *, + struct La_x86_64_retval *, + const char *); unsigned int (*ppc32_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *, uintptr_t *, const struct La_ppc32_regs *, diff --git a/libc/sysdeps/generic/math_private.h b/libc/sysdeps/generic/math_private.h index 813ad9361..e2172246f 100644 --- a/libc/sysdeps/generic/math_private.h +++ b/libc/sysdeps/generic/math_private.h @@ -217,6 +217,7 @@ extern double __ieee754_scalb (double,double); /* fdlibm kernel function */ extern double __kernel_standard (double,double,int); extern float __kernel_standard_f (float,float,int); +extern long double __kernel_standard_l (long double,long double,int); extern double __kernel_sin (double,double,int); extern double __kernel_cos (double,double); extern double __kernel_tan (double,double,int); diff --git a/libc/sysdeps/i386/Versions b/libc/sysdeps/i386/Versions index b0230d31c..7be44aad7 100644 --- a/libc/sysdeps/i386/Versions +++ b/libc/sysdeps/i386/Versions @@ -1,3 +1,9 @@ +ld { + GLIBC_2.3 { + # The alternative i386 runtime interface to TLS. + ___tls_get_addr; + } +} libc { GLIBC_2.0 { # Functions from libgcc. diff --git a/libc/sysdeps/i386/configure b/libc/sysdeps/i386/configure index baa66096a..f56538f99 100755 --- a/libc/sysdeps/i386/configure +++ b/libc/sysdeps/i386/configure @@ -348,3 +348,46 @@ fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_novzeroupper" >&5 $as_echo "$libc_cv_cc_novzeroupper" >&6; } + +# Check for support of thread-local storage handling in assembler and +# linker. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for i386 TLS support" >&5 +$as_echo_n "checking for i386 TLS support... " >&6; } +if ${libc_cv_386_tls+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.s <<\EOF + .section ".tdata", "awT", @progbits + .globl foo +foo: .long 1 + .section ".tbss", "awT", @nobits + .globl bar +bar: .skip 4 + .text +baz: leal bar@TLSLDM(%ebx), %eax + leal bar@DTPOFF(%eax), %edx + subl foo@GOTTPOFF(%edx), %eax + subl $bar@TPOFF, %eax + movl foo@GOTNTPOFF(%edx), %ecx + movl %gs:(%ecx), %eax + movl %gs:bar@NTPOFF, %eax +EOF +if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + libc_cv_386_tls=yes +else + libc_cv_386_tls=no +fi +rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_386_tls" >&5 +$as_echo "$libc_cv_386_tls" >&6; } +if test $libc_cv_386_tls = no; then + as_fn_error $? "the assembler must support TLS" "$LINENO" 5 +fi + +$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h diff --git a/libc/sysdeps/i386/configure.in b/libc/sysdeps/i386/configure.in index 7b4879d54..b9e6f9eef 100644 --- a/libc/sysdeps/i386/configure.in +++ b/libc/sysdeps/i386/configure.in @@ -85,3 +85,37 @@ LIBC_TRY_CC_OPTION([-mno-vzeroupper], [libc_cv_cc_novzeroupper=yes], [libc_cv_cc_novzeroupper=no]) ]) + +# Check for support of thread-local storage handling in assembler and +# linker. +AC_CACHE_CHECK(for i386 TLS support, libc_cv_386_tls, [dnl +cat > conftest.s <<\EOF + .section ".tdata", "awT", @progbits + .globl foo +foo: .long 1 + .section ".tbss", "awT", @nobits + .globl bar +bar: .skip 4 + .text +baz: leal bar@TLSLDM(%ebx), %eax + leal bar@DTPOFF(%eax), %edx + subl foo@GOTTPOFF(%edx), %eax + subl $bar@TPOFF, %eax + movl foo@GOTNTPOFF(%edx), %ecx + movl %gs:(%ecx), %eax + movl %gs:bar@NTPOFF, %eax +EOF +dnl +if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then + libc_cv_386_tls=yes +else + libc_cv_386_tls=no +fi +rm -f conftest*]) +if test $libc_cv_386_tls = no; then + AC_MSG_ERROR([the assembler must support TLS]) +fi + +dnl It is always possible to access static and hidden symbols in an +dnl position independent way. +AC_DEFINE(PI_STATIC_AND_HIDDEN) diff --git a/libc/sysdeps/i386/elf/Versions b/libc/sysdeps/i386/elf/Versions deleted file mode 100644 index 5ca6686b8..000000000 --- a/libc/sysdeps/i386/elf/Versions +++ /dev/null @@ -1,6 +0,0 @@ -ld { - GLIBC_2.3 { - # The alternative i386 runtime interface to TLS. - ___tls_get_addr; - } -} diff --git a/libc/sysdeps/i386/elf/configure.in b/libc/sysdeps/i386/elf/configure.in deleted file mode 100644 index 0c436f3f4..000000000 --- a/libc/sysdeps/i386/elf/configure.in +++ /dev/null @@ -1,36 +0,0 @@ -GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/i386/elf. - -# Check for support of thread-local storage handling in assembler and -# linker. -AC_CACHE_CHECK(for i386 TLS support, libc_cv_386_tls, [dnl -cat > conftest.s <<\EOF - .section ".tdata", "awT", @progbits - .globl foo -foo: .long 1 - .section ".tbss", "awT", @nobits - .globl bar -bar: .skip 4 - .text -baz: leal bar@TLSLDM(%ebx), %eax - leal bar@DTPOFF(%eax), %edx - subl foo@GOTTPOFF(%edx), %eax - subl $bar@TPOFF, %eax - movl foo@GOTNTPOFF(%edx), %ecx - movl %gs:(%ecx), %eax - movl %gs:bar@NTPOFF, %eax -EOF -dnl -if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then - libc_cv_386_tls=yes -else - libc_cv_386_tls=no -fi -rm -f conftest*]) -if test $libc_cv_386_tls = no; then - AC_MSG_ERROR([the assembler must support TLS]) -fi - -dnl It is always possible to access static and hidden symbols in an -dnl position independent way. -AC_DEFINE(PI_STATIC_AND_HIDDEN) diff --git a/libc/sysdeps/i386/fpu/e_pow.S b/libc/sysdeps/i386/fpu/e_pow.S index 1abedf628..b61a94608 100644 --- a/libc/sysdeps/i386/fpu/e_pow.S +++ b/libc/sysdeps/i386/fpu/e_pow.S @@ -114,7 +114,7 @@ ENTRY(__ieee754_pow) fucomp %st(1) // y : x fnstsw sahf - jne 2f + jne 3f /* OK, we have an integer value for y. */ popl %eax @@ -157,7 +157,12 @@ ENTRY(__ieee754_pow) cfi_adjust_cfa_offset (8) .align ALIGNARG(4) -2: /* y is a real number. */ +2: /* y is a large integer (so even). */ + fxch // x : y + fabs // |x| : y + fxch // y : x + .align ALIGNARG(4) +3: /* y is a real number. */ fxch // x : y fldl MO(one) // 1.0 : x : y fldl MO(limit) // 0.29 : 1.0 : x : y diff --git a/libc/sysdeps/i386/fpu/e_powf.S b/libc/sysdeps/i386/fpu/e_powf.S index aa58ed2b6..529a96f95 100644 --- a/libc/sysdeps/i386/fpu/e_powf.S +++ b/libc/sysdeps/i386/fpu/e_powf.S @@ -114,7 +114,7 @@ ENTRY(__ieee754_powf) fucomp %st(1) // y : x fnstsw sahf - jne 2f + jne 3f /* OK, we have an integer value for y. */ popl %edx @@ -151,7 +151,12 @@ ENTRY(__ieee754_powf) cfi_adjust_cfa_offset (4) .align ALIGNARG(4) -2: /* y is a real number. */ +2: /* y is a large integer (so even). */ + fxch // x : y + fabs // |x| : y + fxch // y : x + .align ALIGNARG(4) +3: /* y is a real number. */ fxch // x : y fldl MO(one) // 1.0 : x : y fldl MO(limit) // 0.29 : 1.0 : x : y diff --git a/libc/sysdeps/i386/fpu/e_powl.S b/libc/sysdeps/i386/fpu/e_powl.S index c0aa194c6..0e7c05bb8 100644 --- a/libc/sysdeps/i386/fpu/e_powl.S +++ b/libc/sysdeps/i386/fpu/e_powl.S @@ -117,7 +117,7 @@ ENTRY(__ieee754_powl) fucomp %st(1) // y : x fnstsw sahf - jne 2f + jne 3f /* OK, we have an integer value for y. */ popl %eax @@ -160,7 +160,14 @@ ENTRY(__ieee754_powl) cfi_adjust_cfa_offset (8) .align ALIGNARG(4) -2: /* y is a real number. */ +2: // y is a large integer (absolute value at least 1L<<63), but + // may be odd unless at least 1L<<64. So it may be necessary + // to adjust the sign of a negative result afterwards. + fxch // x : y + fabs // |x| : y + fxch // y : |x| + .align ALIGNARG(4) +3: /* y is a real number. */ fxch // x : y fldl MO(one) // 1.0 : x : y fldl MO(limit) // 0.29 : 1.0 : x : y @@ -190,18 +197,51 @@ ENTRY(__ieee754_powl) f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x)) faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) - addl $8, %esp - cfi_adjust_cfa_offset (-8) fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) - ret + jmp 29f - cfi_adjust_cfa_offset (8) 28: fstp %st(1) // y*log2(x) fldl MO(one) // 1 : y*log2(x) fscale // 2^(y*log2(x)) : y*log2(x) - addl $8, %esp - cfi_adjust_cfa_offset (-8) fstp %st(1) // 2^(y*log2(x)) +29: testb $2, %dh + jz 292f + // x is negative. If y is an odd integer, negate the result. + fldt 24(%esp) // y : abs(result) + fld %st // y : y : abs(result) + fabs // |y| : y : abs(result) + fcompl MO(p64) // y : abs(result) + fnstsw + sahf + jnc 291f + fldl MO(p63) // p63 : y : abs(result) + fxch // y : p63 : abs(result) + fprem // y%p63 : p63 : abs(result) + fstp %st(1) // y%p63 : abs(result) + + // We must find out whether y is an odd integer. + fld %st // y : y : abs(result) + fistpll (%esp) // y : abs(result) + fildll (%esp) // int(y) : y : abs(result) + fucompp // abs(result) + fnstsw + sahf + jne 292f + + // OK, the value is an integer, but is it odd? + popl %eax + cfi_adjust_cfa_offset (-4) + popl %edx + cfi_adjust_cfa_offset (-4) + andb $1, %al + jz 290f // jump if not odd + // It's an odd integer. + fchs +290: ret + cfi_adjust_cfa_offset (8) +291: fstp %st(0) // abs(result) +292: addl $8, %esp + cfi_adjust_cfa_offset (-8) ret // pow(x,±0) = 1 diff --git a/libc/sysdeps/i386/fpu/libm-test-ulps b/libc/sysdeps/i386/fpu/libm-test-ulps index 4d61635f2..1c791405a 100644 --- a/libc/sysdeps/i386/fpu/libm-test-ulps +++ b/libc/sysdeps/i386/fpu/libm-test-ulps @@ -442,6 +442,14 @@ float: 1 ifloat: 1 ildouble: 1 ldouble: 1 +Test "Real part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i": +double: 1 +idouble: 1 Test "Imaginary part of: cexp (0 + 0x1p65 i) == 0.99888622066058013610642172179340364209972 - 0.047183876212354673805106149805700013943218 i": float: 1 ifloat: 1 @@ -456,6 +464,12 @@ ldouble: 1 Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": ildouble: 1 ldouble: 1 +Test "Imaginary part of: cexp (11356.5625 + 0.75 i) == 9.052188470850960144814815984311663764287e4931 + 8.432986734191301036267148978260970230200e4931 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (1440 + 0x1p-1074 i) == inf + 1.196295853897226111293303155636183216483e302 i plus overflow exception": +double: 1 +idouble: 1 Test "Real part of: cexp (50 + 0x1p127 i) == 4.053997150228616856622417636046265337193e21 + 3.232070315463388524466674772633810238819e21 i": double: 2 idouble: 2 @@ -469,6 +483,24 @@ ldouble: 1 Test "Real part of: cexp (500 + 0x1p1023 i) == -1.159886268932754433233243794561351783426e217 + 7.904017694554466595359379965081774849708e216 i": double: 1 idouble: 1 +Test "Real part of: cexp (709.8125 + 0.75 i) == 1.355121963080879535248452862759108365762e308 + 1.262426823598609432507811340856186873507e308 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (709.8125 + 0.75 i) == 1.355121963080879535248452862759108365762e308 + 1.262426823598609432507811340856186873507e308 i": +double: 1 +idouble: 1 +Test "Real part of: cexp (88.75 + 0.75 i) == 2.558360358486542817001900410314204322891e38 + 2.383359453227311447654736314679677655100e38 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (88.75 + 0.75 i) == 2.558360358486542817001900410314204322891e38 + 2.383359453227311447654736314679677655100e38 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 # clog Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": @@ -861,6 +893,8 @@ ifloat: 1 ildouble: 2 ldouble: 2 Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": +double: 1 +idouble: 1 ildouble: 1 ldouble: 1 Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": @@ -873,6 +907,9 @@ idouble: 2 ifloat: 3 ildouble: 3 ldouble: 3 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i": +double: 1 +idouble: 1 Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i": ildouble: 1 ldouble: 1 diff --git a/libc/sysdeps/i386/elf/start.S b/libc/sysdeps/i386/start.S index 992c358c0..990f3715d 100644 --- a/libc/sysdeps/i386/elf/start.S +++ b/libc/sysdeps/i386/start.S @@ -1,6 +1,5 @@ /* Startup code compliant to the ELF i386 ABI. - Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004 - 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 diff --git a/libc/sysdeps/ieee754/dbl-64/Makefile b/libc/sysdeps/ieee754/dbl-64/Makefile new file mode 100644 index 000000000..1a7b31158 --- /dev/null +++ b/libc/sysdeps/ieee754/dbl-64/Makefile @@ -0,0 +1,4 @@ +ifeq ($(subdir),math) +# branred depends on precise IEEE double rounding +CFLAGS-branred.c = $(config-cflags-nofma) +endif diff --git a/libc/sysdeps/ieee754/k_standard.c b/libc/sysdeps/ieee754/k_standard.c index 5d84543b9..4e65bb16c 100644 --- a/libc/sysdeps/ieee754/k_standard.c +++ b/libc/sysdeps/ieee754/k_standard.c @@ -16,6 +16,7 @@ static char rcsid[] = "$NetBSD: k_standard.c,v 1.6 1995/05/10 20:46:35 jtc Exp $ #include <math.h> #include <math_private.h> +#include <float.h> #include <errno.h> #include <assert.h> @@ -507,6 +508,9 @@ __kernel_standard(double x, double y, int type) exc.type = UNDERFLOW; exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); exc.retval = zero; + y *= 0.5; + if (x < zero && __rint (y) != y) + exc.retval = -zero; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { @@ -998,3 +1002,83 @@ __kernel_standard_f(float x, float y, int type) { return __kernel_standard(x, y, type); } + +long double +__kernel_standard_l (long double x, long double y, int type) +{ + double dx, dy; + struct exception exc; + + if (isfinite (x)) + { + long double ax = fabsl (x); + if (ax > DBL_MAX) + dx = __copysignl (DBL_MAX, x); + else if (ax > 0 && ax < DBL_MIN) + dx = __copysignl (DBL_MIN, x); + else + dx = x; + } + else + dx = x; + if (isfinite (y)) + { + long double ay = fabsl (y); + if (ay > DBL_MAX) + dy = __copysignl (DBL_MAX, y); + else if (ay > 0 && ay < DBL_MIN) + dy = __copysignl (DBL_MIN, y); + else + dy = y; + } + else + dy = y; + + switch (type) + { + case 221: + /* powl (x, y) overflow. */ + exc.arg1 = dx; + exc.arg2 = dy; + exc.type = OVERFLOW; + exc.name = "powl"; + if (_LIB_VERSION == _SVID_) + { + exc.retval = HUGE; + y *= 0.5; + if (x < zero && __rintl (y) != y) + exc.retval = -HUGE; + } + else + { + exc.retval = HUGE_VAL; + y *= 0.5; + if (x < zero && __rintl (y) != y) + exc.retval = -HUGE_VAL; + } + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr (&exc)) + __set_errno (ERANGE); + return exc.retval; + + case 222: + /* powl (x, y) underflow. */ + exc.arg1 = dx; + exc.arg2 = dy; + exc.type = UNDERFLOW; + exc.name = "powl"; + exc.retval = zero; + y *= 0.5; + if (x < zero && __rintl (y) != y) + exc.retval = -zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr (&exc)) + __set_errno (ERANGE); + return exc.retval; + + default: + return __kernel_standard (dx, dy, type); + } +} diff --git a/libc/sysdeps/ieee754/ldbl-128/k_cosl.c b/libc/sysdeps/ieee754/ldbl-128/k_cosl.c index 4cb9dd1f5..aa447ec1d 100644 --- a/libc/sysdeps/ieee754/ldbl-128/k_cosl.c +++ b/libc/sysdeps/ieee754/ldbl-128/k_cosl.c @@ -105,7 +105,11 @@ __kernel_cosl(long double x, long double y) cosl(h+l) = cosl(h)cosl(l) - sinl(h)sinl(l). */ index = 0x3ffe - (tix >> 16); hix = (tix + (0x200 << index)) & (0xfffffc00 << index); - x = fabsl (x); + if (signbit (x)) + { + x = -x; + y = -y; + } switch (index) { case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break; diff --git a/libc/sysdeps/ieee754/ldbl-128/k_sincosl.c b/libc/sysdeps/ieee754/ldbl-128/k_sincosl.c index 98c5d6278..00a21c45d 100644 --- a/libc/sysdeps/ieee754/ldbl-128/k_sincosl.c +++ b/libc/sysdeps/ieee754/ldbl-128/k_sincosl.c @@ -132,7 +132,11 @@ __kernel_sincosl(long double x, long double y, long double *sinx, long double *c cosl(h+l) = cosl(h)cosl(l) - sinl(h)sinl(l). */ index = 0x3ffe - (tix >> 16); hix = (tix + (0x200 << index)) & (0xfffffc00 << index); - x = fabsl (x); + if (signbit (x)) + { + x = -x; + y = -y; + } switch (index) { case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break; diff --git a/libc/sysdeps/ieee754/ldbl-128/k_sinl.c b/libc/sysdeps/ieee754/ldbl-128/k_sinl.c index 6eaf878d9..1f0ca8c7f 100644 --- a/libc/sysdeps/ieee754/ldbl-128/k_sinl.c +++ b/libc/sysdeps/ieee754/ldbl-128/k_sinl.c @@ -116,7 +116,7 @@ __kernel_sinl(long double x, long double y, int iy) SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0); if (iy) - l = y - (h - x); + l = (ix < 0 ? -y : y) - (h - x); else l = x - h; z = l * l; diff --git a/libc/sysdeps/ieee754/ldbl-128/w_expl.c b/libc/sysdeps/ieee754/ldbl-128/w_expl.c index f4deda872..10193befa 100644 --- a/libc/sysdeps/ieee754/ldbl-128/w_expl.c +++ b/libc/sysdeps/ieee754/ldbl-128/w_expl.c @@ -39,9 +39,9 @@ long double __expl(long double x) /* wrapper exp */ if(_LIB_VERSION == _IEEE_) return z; if(__finitel(x)) { if(x>o_threshold) - return __kernel_standard(x,x,206); /* exp overflow */ + return __kernel_standard_l(x,x,206); /* exp overflow */ else if(x<u_threshold) - return __kernel_standard(x,x,207); /* exp underflow */ + return __kernel_standard_l(x,x,207); /* exp underflow */ } return z; #endif diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_expl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_expl.c index 133adc273..5618eb3d0 100644 --- a/libc/sysdeps/ieee754/ldbl-128ibm/e_expl.c +++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_expl.c @@ -1,5 +1,5 @@ /* Quad-precision floating point e^x. - Copyright (C) 1999,2004,2006, 2008, 2011 Free Software Foundation, Inc. + Copyright (C) 1999-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jj@ultra.linux.cz> Partly based on double-precision code @@ -74,7 +74,7 @@ static const long double C[] = { /* Largest integer x for which e^x underflows. */ #define lomark C[1] --709.08956571282405153382846025171462914L, +-744.44007192138121808966388925909996033L, /* 3x2^96 */ #define THREEp96 C[2] diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_powl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_powl.c index 52ce33aba..0fd4820e4 100644 --- a/libc/sysdeps/ieee754/ldbl-128ibm/e_powl.c +++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_powl.c @@ -88,8 +88,8 @@ static const long double zero = 0.0L, one = 1.0L, two = 2.0L, two113 = 1.0384593717069655257060992658440192E34L, - huge = 1.0e3000L, - tiny = 1.0e-3000L; + huge = 1.0e300L, + tiny = 1.0e-300L; /* 3/2 log x = 3 z + z^3 + z^3 (z^2 R(z^2)) z = (x-1)/(x+1) diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/k_cosl.c b/libc/sysdeps/ieee754/ldbl-128ibm/k_cosl.c index 52414319a..fc0137468 100644 --- a/libc/sysdeps/ieee754/ldbl-128ibm/k_cosl.c +++ b/libc/sysdeps/ieee754/ldbl-128ibm/k_cosl.c @@ -123,7 +123,11 @@ __kernel_cosl(long double x, long double y) index = 0x3fe - (tix >> 20); hix = (tix + (0x200 << index)) & (0xfffffc00 << index); - x = fabsl (x); + if (signbit (x)) + { + x = -x; + y = -y; + } switch (index) { case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break; diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c b/libc/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c index f3dd95488..98fe07d7a 100644 --- a/libc/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c +++ b/libc/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c @@ -151,7 +151,11 @@ __kernel_sincosl(long double x, long double y, long double *sinx, long double *c index = 0x3fe - (tix >> 20); hix = (tix + (0x2000 << index)) & (0xffffc000 << index); - x = fabsl (x); + if (signbit (x)) + { + x = -x; + y = -y; + } switch (index) { case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break; diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/k_sinl.c b/libc/sysdeps/ieee754/ldbl-128ibm/k_sinl.c index 484b65fc8..94aba0b62 100644 --- a/libc/sysdeps/ieee754/ldbl-128ibm/k_sinl.c +++ b/libc/sysdeps/ieee754/ldbl-128ibm/k_sinl.c @@ -134,7 +134,7 @@ __kernel_sinl(long double x, long double y, int iy) */ SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0); if (iy) - l = y - (h - x); + l = (ix < 0 ? -y : y) - (h - x); else l = x - h; z = l * l; diff --git a/libc/sysdeps/ieee754/ldbl-96/w_expl.c b/libc/sysdeps/ieee754/ldbl-96/w_expl.c index d61c0a37b..55c68462b 100644 --- a/libc/sysdeps/ieee754/ldbl-96/w_expl.c +++ b/libc/sysdeps/ieee754/ldbl-96/w_expl.c @@ -33,12 +33,12 @@ __expl (long double x) if (__builtin_expect (isgreater (x, o_threshold), 0)) { if (_LIB_VERSION != _IEEE_) - return __kernel_standard (x, x, 206); + return __kernel_standard_l (x, x, 206); } else if (__builtin_expect (isless (x, u_threshold), 0)) { if (_LIB_VERSION != _IEEE_) - return __kernel_standard (x, x, 207); + return __kernel_standard_l (x, x, 207); } return __ieee754_expl (x); diff --git a/libc/sysdeps/powerpc/fpu/libm-test-ulps b/libc/sysdeps/powerpc/fpu/libm-test-ulps index 4b1cff076..1ab3d4ad4 100644 --- a/libc/sysdeps/powerpc/fpu/libm-test-ulps +++ b/libc/sysdeps/powerpc/fpu/libm-test-ulps @@ -521,6 +521,11 @@ ldouble: 2 Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": float: 1 ifloat: 1 +Test "Imaginary part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": float: 1 ifloat: 1 @@ -529,6 +534,41 @@ ldouble: 2 Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": ildouble: 1 ldouble: 1 +Test "Imaginary part of: cexp (1440 + 0x1p-1074 i) == inf + 1.196295853897226111293303155636183216483e302 i plus overflow exception": +double: 1 +idouble: 1 +Test "Real part of: cexp (50 + 0x1p127 i) == 4.053997150228616856622417636046265337193e21 + 3.232070315463388524466674772633810238819e21 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (50 + 0x1p127 i) == 4.053997150228616856622417636046265337193e21 + 3.232070315463388524466674772633810238819e21 i": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: cexp (500 + 0x1p1023 i) == -1.159886268932754433233243794561351783426e217 + 7.904017694554466595359379965081774849708e216 i": +double: 1 +idouble: 1 +Test "Imaginary part of: cexp (500 + 0x1p1023 i) == -1.159886268932754433233243794561351783426e217 + 7.904017694554466595359379965081774849708e216 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cexp (709.8125 + 0.75 i) == 1.355121963080879535248452862759108365762e308 + 1.262426823598609432507811340856186873507e308 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (709.8125 + 0.75 i) == 1.355121963080879535248452862759108365762e308 + 1.262426823598609432507811340856186873507e308 i": +double: 1 +idouble: 1 +Test "Real part of: cexp (88.75 + 0.75 i) == 2.558360358486542817001900410314204322891e38 + 2.383359453227311447654736314679677655100e38 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: cexp (88.75 + 0.75 i) == 2.558360358486542817001900410314204322891e38 + 2.383359453227311447654736314679677655100e38 i": +float: 2 +ifloat: 2 # clog Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i": @@ -544,6 +584,15 @@ ldouble: 2 Test "Imaginary part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": ildouble: 1 ldouble: 1 +Test "Imaginary part of: clog (0x1.fffffffffffffp+1023 + 0x1p+1023 i) == 709.8942846690411016323109979483151967689 + 0.4636476090008061606231772164674799632783 i": +double: 1 +idouble: 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 # clog10 Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i": @@ -634,6 +683,51 @@ float: 2 ifloat: 2 ildouble: 3 ldouble: 3 +Test "Imaginary part of: clog10 (0x1.fffffep+127 + 0x1.fffffep+127 i) == 38.68235441693561449174780668781319348761 + pi/4*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x1.fffffep+127 + 1.0 i) == 38.53183941910362389414093724045094697423 + 1.276276851248440096917018665609900318458e-39 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i) == 308.4052305577487344482591243175787477115 + pi/4*log10(e) i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1.fffffffffffffp+1023 + 0x1p+1023 i) == 308.3031705664207720674749211936626341569 + 0.2013595981366865903254995612594728746470 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-1073 + 0x1p-1073 i) == -322.8546703496198318667349645920187712089 + pi/4*log10(e) i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 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 +ildouble: 1 +ldouble: 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 +ildouble: 1 +ldouble: 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 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i": double: 1 float: 1 @@ -2046,25 +2140,33 @@ ildouble: 2 ldouble: 2 Function: Real part of "cexp": +double: 2 float: 1 +idouble: 2 ifloat: 1 ildouble: 2 ldouble: 2 Function: Imaginary part of "cexp": -float: 1 -ifloat: 1 -ildouble: 1 -ldouble: 1 +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 Function: Real part of "clog": +double: 1 float: 2 +idouble: 1 ifloat: 2 ildouble: 2 ldouble: 2 Function: Imaginary part of "clog": +double: 1 float: 3 +idouble: 1 ifloat: 3 ildouble: 1 ldouble: 1 diff --git a/libc/sysdeps/powerpc/elf/ifunc-sel.h b/libc/sysdeps/powerpc/ifunc-sel.h index 526d8ed88..526d8ed88 100644 --- a/libc/sysdeps/powerpc/elf/ifunc-sel.h +++ b/libc/sysdeps/powerpc/ifunc-sel.h diff --git a/libc/sysdeps/powerpc/powerpc32/elf/bzero.S b/libc/sysdeps/powerpc/powerpc32/bzero.S index aa5a237a6..aa5a237a6 100644 --- a/libc/sysdeps/powerpc/powerpc32/elf/bzero.S +++ b/libc/sysdeps/powerpc/powerpc32/bzero.S diff --git a/libc/sysdeps/powerpc/powerpc32/configure b/libc/sysdeps/powerpc/powerpc32/configure index 86ecfdcf4..da0e7f4af 100644 --- a/libc/sysdeps/powerpc/powerpc32/configure +++ b/libc/sysdeps/powerpc/powerpc32/configure @@ -137,3 +137,48 @@ if test $libc_cv_ppc_secure_plt = yes; then $as_echo "#define HAVE_PPC_SECURE_PLT 1" >>confdefs.h fi + +# Check for support of thread-local storage handling in assembler and +# linker. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for powerpc32 TLS support" >&5 +$as_echo_n "checking for powerpc32 TLS support... " >&6; } +if ${libc_cv_powerpc32_tls+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.s <<\EOF + .section ".tdata","awT",@progbits +x: .long 1 +x1: .long 1 +x2: .long 1 + .text + addi 3,31,x@got@tlsgd + addi 3,31,x1@got@tlsld + addi 9,3,x1@dtprel + addis 9,3,x2@dtprel@ha + addi 9,9,x2@dtprel@l + lwz 0,x1@dtprel(3) + addis 9,3,x2@dtprel@ha + lwz 0,x2@dtprel@l(9) + lwz 9,x3@got@tprel(31) + add 9,9,x@tls + addi 9,2,x1@tprel + addis 9,2,x2@tprel@ha + addi 9,9,x2@tprel@l +EOF +if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + libc_cv_powerpc32_tls=yes +else + libc_cv_powerpc32_tls=no +fi +rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_powerpc32_tls" >&5 +$as_echo "$libc_cv_powerpc32_tls" >&6; } +if test $libc_cv_powerpc32_tls = no; then + as_fn_error $? "the assembler must support TLS" "$LINENO" 5 +fi diff --git a/libc/sysdeps/powerpc/powerpc32/configure.in b/libc/sysdeps/powerpc/powerpc32/configure.in index 21d3f5ee5..bc775bb13 100644 --- a/libc/sysdeps/powerpc/powerpc32/configure.in +++ b/libc/sysdeps/powerpc/powerpc32/configure.in @@ -30,3 +30,37 @@ rm -rf conftest*]) if test $libc_cv_ppc_secure_plt = yes; then AC_DEFINE(HAVE_PPC_SECURE_PLT) fi + +# Check for support of thread-local storage handling in assembler and +# linker. +AC_CACHE_CHECK(for powerpc32 TLS support, libc_cv_powerpc32_tls, [dnl +cat > conftest.s <<\EOF + .section ".tdata","awT",@progbits +x: .long 1 +x1: .long 1 +x2: .long 1 + .text + addi 3,31,x@got@tlsgd + addi 3,31,x1@got@tlsld + addi 9,3,x1@dtprel + addis 9,3,x2@dtprel@ha + addi 9,9,x2@dtprel@l + lwz 0,x1@dtprel(3) + addis 9,3,x2@dtprel@ha + lwz 0,x2@dtprel@l(9) + lwz 9,x3@got@tprel(31) + add 9,9,x@tls + addi 9,2,x1@tprel + addis 9,2,x2@tprel@ha + addi 9,9,x2@tprel@l +EOF +dnl +if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then + libc_cv_powerpc32_tls=yes +else + libc_cv_powerpc32_tls=no +fi +rm -f conftest*]) +if test $libc_cv_powerpc32_tls = no; then + AC_MSG_ERROR([the assembler must support TLS]) +fi diff --git a/libc/sysdeps/powerpc/powerpc32/elf/configure b/libc/sysdeps/powerpc/powerpc32/elf/configure deleted file mode 100755 index bce17df1a..000000000 --- a/libc/sysdeps/powerpc/powerpc32/elf/configure +++ /dev/null @@ -1,129 +0,0 @@ - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -# This file is generated from configure.in by Autoconf. DO NOT EDIT! - # Local configure fragment for sysdeps/powerpc32/elf. - -# Check for support of thread-local storage handling in assembler and -# linker. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for powerpc32 TLS support" >&5 -$as_echo_n "checking for powerpc32 TLS support... " >&6; } -if ${libc_cv_powerpc32_tls+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.s <<\EOF - .section ".tdata","awT",@progbits -x: .long 1 -x1: .long 1 -x2: .long 1 - .text - addi 3,31,x@got@tlsgd - addi 3,31,x1@got@tlsld - addi 9,3,x1@dtprel - addis 9,3,x2@dtprel@ha - addi 9,9,x2@dtprel@l - lwz 0,x1@dtprel(3) - addis 9,3,x2@dtprel@ha - lwz 0,x2@dtprel@l(9) - lwz 9,x3@got@tprel(31) - add 9,9,x@tls - addi 9,2,x1@tprel - addis 9,2,x2@tprel@ha - addi 9,9,x2@tprel@l -EOF -if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - libc_cv_powerpc32_tls=yes -else - libc_cv_powerpc32_tls=no -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_powerpc32_tls" >&5 -$as_echo "$libc_cv_powerpc32_tls" >&6; } -if test $libc_cv_powerpc32_tls = no; then - as_fn_error $? "the assembler must support TLS" "$LINENO" 5 -fi diff --git a/libc/sysdeps/powerpc/powerpc32/elf/configure.in b/libc/sysdeps/powerpc/powerpc32/elf/configure.in deleted file mode 100644 index e527b454c..000000000 --- a/libc/sysdeps/powerpc/powerpc32/elf/configure.in +++ /dev/null @@ -1,36 +0,0 @@ -GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/powerpc32/elf. - -# Check for support of thread-local storage handling in assembler and -# linker. -AC_CACHE_CHECK(for powerpc32 TLS support, libc_cv_powerpc32_tls, [dnl -cat > conftest.s <<\EOF - .section ".tdata","awT",@progbits -x: .long 1 -x1: .long 1 -x2: .long 1 - .text - addi 3,31,x@got@tlsgd - addi 3,31,x1@got@tlsld - addi 9,3,x1@dtprel - addis 9,3,x2@dtprel@ha - addi 9,9,x2@dtprel@l - lwz 0,x1@dtprel(3) - addis 9,3,x2@dtprel@ha - lwz 0,x2@dtprel@l(9) - lwz 9,x3@got@tprel(31) - add 9,9,x@tls - addi 9,2,x1@tprel - addis 9,2,x2@tprel@ha - addi 9,9,x2@tprel@l -EOF -dnl -if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then - libc_cv_powerpc32_tls=yes -else - libc_cv_powerpc32_tls=no -fi -rm -f conftest*]) -if test $libc_cv_powerpc32_tls = no; then - AC_MSG_ERROR([the assembler must support TLS]) -fi diff --git a/libc/sysdeps/powerpc/powerpc32/elf/start.S b/libc/sysdeps/powerpc/powerpc32/start.S index 4935e6497..4935e6497 100644 --- a/libc/sysdeps/powerpc/powerpc32/elf/start.S +++ b/libc/sysdeps/powerpc/powerpc32/start.S diff --git a/libc/sysdeps/powerpc/powerpc64/Makefile b/libc/sysdeps/powerpc/powerpc64/Makefile index 01889e131..171e89b3b 100644 --- a/libc/sysdeps/powerpc/powerpc64/Makefile +++ b/libc/sysdeps/powerpc/powerpc64/Makefile @@ -25,6 +25,16 @@ no-special-regs := $(sort $(foreach n,40 41 50 51 60 61 62 63 \ -ffixed-v$n)) \ -ffixed-vrsave -ffixed-vscr -mno-altivec -mno-vsx +# Need to prevent gcc from using fprs in code used during dynamic linking. + +CFLAGS-dl-runtime.os = $(no-special-regs) +CFLAGS-dl-lookup.os = $(no-special-regs) +CFLAGS-dl-misc.os = $(no-special-regs) +CFLAGS-rtld-mempcpy.os = $(no-special-regs) +CFLAGS-rtld-memmove.os = $(no-special-regs) +CFLAGS-rtld-memchr.os = $(no-special-regs) +CFLAGS-rtld-strnlen.os = $(no-special-regs) + ifeq ($(subdir),csu) sysdep_routines += hp-timing elide-routines.os += hp-timing diff --git a/libc/sysdeps/powerpc/powerpc64/elf/bzero.S b/libc/sysdeps/powerpc/powerpc64/bzero.S index b79f88511..3a1c972ab 100644 --- a/libc/sysdeps/powerpc/powerpc64/elf/bzero.S +++ b/libc/sysdeps/powerpc/powerpc64/bzero.S @@ -16,5 +16,5 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -/* This code was moved into memset.S to solve a double stub call problem. +/* This code was moved into memset.S to solve a double stub call problem. @local would have worked but it is not supported in PowerPC64 asm. */ diff --git a/libc/sysdeps/powerpc/powerpc64/configure b/libc/sysdeps/powerpc/powerpc64/configure index 7cff76141..762ae4a25 100644 --- a/libc/sysdeps/powerpc/powerpc64/configure +++ b/libc/sysdeps/powerpc/powerpc64/configure @@ -144,3 +144,67 @@ if test x$libc_cv_overlapping_opd = xyes; then $as_echo "#define USE_PPC64_OVERLAPPING_OPD 1" >>confdefs.h fi + +# Check for support of thread-local storage handling in assembler and +# linker. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for powerpc64 TLS support" >&5 +$as_echo_n "checking for powerpc64 TLS support... " >&6; } +if ${libc_cv_powerpc64_tls+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.s <<\EOF + .section ".tdata","awT",@progbits +x: .quad 1 +x1: .quad 1 +x2: .quad 1 +x3: .quad 1 +x4: .long 1 + .section ".toc","aw" +.LC0: + .quad x@dtpmod + .quad x@dtprel +.LC1: + .quad x1@dtpmod + .quad 0 +.LC2: + .quad x@tprel + .text + addi 3,2,x@got@tlsgd + addi 3,2,.LC0@toc + addi 3,2,x1@got@tlsld + addi 9,3,x1@dtprel + addis 9,3,x2@dtprel@ha + addi 9,9,x2@dtprel@l + ld 9,x3@got@dtprel(2) + addi 3,2,.LC0@toc + lwz 0,x1@dtprel(3) + ld 0,x1@dtprel(3) + addis 9,3,x2@dtprel@ha + lwz 0,x2@dtprel@l(9) + ld 0,x2@dtprel@l(9) + ld 9,x3@got@dtprel(2) + ld 9,x@got@tprel(2) + add 9,9,x@tls + ld 9,.LC2@toc(2) + add 9,9,.LC2@tls + addi 9,13,x1@tprel + addis 9,13,x2@tprel@ha + addi 9,9,x2@tprel@l +EOF +if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + libc_cv_powerpc64_tls=yes +else + libc_cv_powerpc64_tls=no +fi +rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_powerpc64_tls" >&5 +$as_echo "$libc_cv_powerpc64_tls" >&6; } +if test $libc_cv_powerpc64_tls = no; then + as_fn_error $? "the assembler must support TLS" "$LINENO" 5 +fi diff --git a/libc/sysdeps/powerpc/powerpc64/configure.in b/libc/sysdeps/powerpc/powerpc64/configure.in index 67aac663d..7d333a7c5 100644 --- a/libc/sysdeps/powerpc/powerpc64/configure.in +++ b/libc/sysdeps/powerpc/powerpc64/configure.in @@ -40,3 +40,56 @@ rm -f conftest.c conftest.s if test x$libc_cv_overlapping_opd = xyes; then AC_DEFINE(USE_PPC64_OVERLAPPING_OPD) fi + +# Check for support of thread-local storage handling in assembler and +# linker. +AC_CACHE_CHECK(for powerpc64 TLS support, libc_cv_powerpc64_tls, [dnl +cat > conftest.s <<\EOF + .section ".tdata","awT",@progbits +x: .quad 1 +x1: .quad 1 +x2: .quad 1 +x3: .quad 1 +x4: .long 1 + .section ".toc","aw" +.LC0: + .quad x@dtpmod + .quad x@dtprel +.LC1: + .quad x1@dtpmod + .quad 0 +.LC2: + .quad x@tprel + .text + addi 3,2,x@got@tlsgd + addi 3,2,.LC0@toc + addi 3,2,x1@got@tlsld + addi 9,3,x1@dtprel + addis 9,3,x2@dtprel@ha + addi 9,9,x2@dtprel@l + ld 9,x3@got@dtprel(2) + addi 3,2,.LC0@toc + lwz 0,x1@dtprel(3) + ld 0,x1@dtprel(3) + addis 9,3,x2@dtprel@ha + lwz 0,x2@dtprel@l(9) + ld 0,x2@dtprel@l(9) + ld 9,x3@got@dtprel(2) + ld 9,x@got@tprel(2) + add 9,9,x@tls + ld 9,.LC2@toc(2) + add 9,9,.LC2@tls + addi 9,13,x1@tprel + addis 9,13,x2@tprel@ha + addi 9,9,x2@tprel@l +EOF +dnl +if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then + libc_cv_powerpc64_tls=yes +else + libc_cv_powerpc64_tls=no +fi +rm -f conftest*]) +if test $libc_cv_powerpc64_tls = no; then + AC_MSG_ERROR([the assembler must support TLS]) +fi diff --git a/libc/sysdeps/powerpc/powerpc64/elf/Makefile b/libc/sysdeps/powerpc/powerpc64/elf/Makefile deleted file mode 100644 index 6a77e116b..000000000 --- a/libc/sysdeps/powerpc/powerpc64/elf/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# powerpc64/ELF specific definitions. - -# Need to prevent gcc from using fprs in code used during dynamic linking. - -CFLAGS-dl-runtime.os = $(no-special-regs) -CFLAGS-dl-lookup.os = $(no-special-regs) -CFLAGS-dl-misc.os = $(no-special-regs) -CFLAGS-rtld-mempcpy.os = $(no-special-regs) -CFLAGS-rtld-memmove.os = $(no-special-regs) -CFLAGS-rtld-memchr.os = $(no-special-regs) -CFLAGS-rtld-strnlen.os = $(no-special-regs) diff --git a/libc/sysdeps/powerpc/powerpc64/elf/configure b/libc/sysdeps/powerpc/powerpc64/elf/configure deleted file mode 100644 index a3d24a382..000000000 --- a/libc/sysdeps/powerpc/powerpc64/elf/configure +++ /dev/null @@ -1,148 +0,0 @@ - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -# This file is generated from configure.in by Autoconf. DO NOT EDIT! - # Local configure fragment for sysdeps/powerpc64/elf. - -# Check for support of thread-local storage handling in assembler and -# linker. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for powerpc64 TLS support" >&5 -$as_echo_n "checking for powerpc64 TLS support... " >&6; } -if ${libc_cv_powerpc64_tls+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.s <<\EOF - .section ".tdata","awT",@progbits -x: .quad 1 -x1: .quad 1 -x2: .quad 1 -x3: .quad 1 -x4: .long 1 - .section ".toc","aw" -.LC0: - .quad x@dtpmod - .quad x@dtprel -.LC1: - .quad x1@dtpmod - .quad 0 -.LC2: - .quad x@tprel - .text - addi 3,2,x@got@tlsgd - addi 3,2,.LC0@toc - addi 3,2,x1@got@tlsld - addi 9,3,x1@dtprel - addis 9,3,x2@dtprel@ha - addi 9,9,x2@dtprel@l - ld 9,x3@got@dtprel(2) - addi 3,2,.LC0@toc - lwz 0,x1@dtprel(3) - ld 0,x1@dtprel(3) - addis 9,3,x2@dtprel@ha - lwz 0,x2@dtprel@l(9) - ld 0,x2@dtprel@l(9) - ld 9,x3@got@dtprel(2) - ld 9,x@got@tprel(2) - add 9,9,x@tls - ld 9,.LC2@toc(2) - add 9,9,.LC2@tls - addi 9,13,x1@tprel - addis 9,13,x2@tprel@ha - addi 9,9,x2@tprel@l -EOF -if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - libc_cv_powerpc64_tls=yes -else - libc_cv_powerpc64_tls=no -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_powerpc64_tls" >&5 -$as_echo "$libc_cv_powerpc64_tls" >&6; } -if test $libc_cv_powerpc64_tls = no; then - as_fn_error $? "the assembler must support TLS" "$LINENO" 5 -fi diff --git a/libc/sysdeps/powerpc/powerpc64/elf/configure.in b/libc/sysdeps/powerpc/powerpc64/elf/configure.in deleted file mode 100644 index 9a375c66a..000000000 --- a/libc/sysdeps/powerpc/powerpc64/elf/configure.in +++ /dev/null @@ -1,55 +0,0 @@ -GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/powerpc64/elf. - -# Check for support of thread-local storage handling in assembler and -# linker. -AC_CACHE_CHECK(for powerpc64 TLS support, libc_cv_powerpc64_tls, [dnl -cat > conftest.s <<\EOF - .section ".tdata","awT",@progbits -x: .quad 1 -x1: .quad 1 -x2: .quad 1 -x3: .quad 1 -x4: .long 1 - .section ".toc","aw" -.LC0: - .quad x@dtpmod - .quad x@dtprel -.LC1: - .quad x1@dtpmod - .quad 0 -.LC2: - .quad x@tprel - .text - addi 3,2,x@got@tlsgd - addi 3,2,.LC0@toc - addi 3,2,x1@got@tlsld - addi 9,3,x1@dtprel - addis 9,3,x2@dtprel@ha - addi 9,9,x2@dtprel@l - ld 9,x3@got@dtprel(2) - addi 3,2,.LC0@toc - lwz 0,x1@dtprel(3) - ld 0,x1@dtprel(3) - addis 9,3,x2@dtprel@ha - lwz 0,x2@dtprel@l(9) - ld 0,x2@dtprel@l(9) - ld 9,x3@got@dtprel(2) - ld 9,x@got@tprel(2) - add 9,9,x@tls - ld 9,.LC2@toc(2) - add 9,9,.LC2@tls - addi 9,13,x1@tprel - addis 9,13,x2@tprel@ha - addi 9,9,x2@tprel@l -EOF -dnl -if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then - libc_cv_powerpc64_tls=yes -else - libc_cv_powerpc64_tls=no -fi -rm -f conftest*]) -if test $libc_cv_powerpc64_tls = no; then - AC_MSG_ERROR([the assembler must support TLS]) -fi diff --git a/libc/sysdeps/powerpc/powerpc64/elf/entry.h b/libc/sysdeps/powerpc/powerpc64/entry.h index 2a54fe728..2a54fe728 100644 --- a/libc/sysdeps/powerpc/powerpc64/elf/entry.h +++ b/libc/sysdeps/powerpc/powerpc64/entry.h diff --git a/libc/sysdeps/powerpc/powerpc64/elf/start.S b/libc/sysdeps/powerpc/powerpc64/start.S index d9c92d139..d9c92d139 100644 --- a/libc/sysdeps/powerpc/powerpc64/elf/start.S +++ b/libc/sysdeps/powerpc/powerpc64/start.S diff --git a/libc/sysdeps/powerpc/elf/rtld-global-offsets.sym b/libc/sysdeps/powerpc/rtld-global-offsets.sym index ff4e97f2a..ff4e97f2a 100644 --- a/libc/sysdeps/powerpc/elf/rtld-global-offsets.sym +++ b/libc/sysdeps/powerpc/rtld-global-offsets.sym diff --git a/libc/sysdeps/s390/s390-32/bsd-_setjmp.S b/libc/sysdeps/s390/s390-32/bsd-_setjmp.S index 8dfa640a9..141727020 100644 --- a/libc/sysdeps/s390/s390-32/bsd-_setjmp.S +++ b/libc/sysdeps/s390/s390-32/bsd-_setjmp.S @@ -1,46 +1 @@ -/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. s390 version. - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - 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/>. */ - -/* This just does a tail-call to `__sigsetjmp (ARG, 0)'. - We cannot do it in C because it must be a tail-call, so frame-unwinding - in setjmp doesn't clobber the state restored by longjmp. */ - -#include <sysdep.h> - -ENTRY(_setjmp) -#ifdef PIC - /* We cannot use the PLT, because it requires that %r12 be set, but - we can't save and restore our caller's value. Instead, we do an - indirect jump through the GOT. */ - basr %r1,0 -.L0: al %r1,.L1 - .L0(0,%r1) /* get address of global offset table */ - /* get address of __sigjmp_save from got */ - l %r1,__sigjmp_save@GOT12(0,%r1) - lhi %r3,0 /* second argument of one */ - br %r1 -.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 -#else - basr %r1,0 -.L0: l %r1,.L1 - .L0(0,%r1) /* load address of __sigsetjmp */ - lhi %r3,0 /* second argument of zero */ - br %r1 /* branch to __sigsetjmp */ -.L1: .long __sigsetjmp -#endif -END (_setjmp) -libc_hidden_def (_setjmp) +/* We don't need any code here since the setjmp.S file contains it. */ diff --git a/libc/sysdeps/s390/s390-32/bsd-setjmp.S b/libc/sysdeps/s390/s390-32/bsd-setjmp.S index 93faf4cef..141727020 100644 --- a/libc/sysdeps/s390/s390-32/bsd-setjmp.S +++ b/libc/sysdeps/s390/s390-32/bsd-setjmp.S @@ -1,45 +1 @@ -/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. s390 version. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - 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/>. */ - -/* This just does a tail-call to `__sigsetjmp (ARG, 1)'. - We cannot do it in C because it must be a tail-call, so frame-unwinding - in setjmp doesn't clobber the state restored by longjmp. */ - -#include <sysdep.h> - -ENTRY(setjmp) -#ifdef PIC - /* We cannot use the PLT, because it requires that %r12 be set, but - we can't save and restore our caller's value. Instead, we do an - indirect jump through the GOT. */ - basr %r1,0 -.L0: al %r1,.L1 - .L0(0,%r1) /* get address of global offset table */ - /* get address of __sigjmp_save from got */ - l %r1,__sigjmp_save@GOT12(0,%r1) - lhi %r3,1 /* second argument of one */ - br %r1 -.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 -#else - basr %r1,0 -.L0: l %r1,.L1 - .L0(0,%r1) /* load address of __sigsetjmp */ - lhi %r3,1 /* second argument of zero */ - br %r1 /* branch to __sigsetjmp */ -.L1: .long __sigsetjmp -#endif -END (setjmp) +/* We don't need any code here since the setjmp.S file contains it. */ diff --git a/libc/sysdeps/s390/s390-32/elf/configure b/libc/sysdeps/s390/s390-32/configure index 301232883..484548454 100644 --- a/libc/sysdeps/s390/s390-32/elf/configure +++ b/libc/sysdeps/s390/s390-32/configure @@ -81,7 +81,7 @@ $as_echo X/"$0" | } # This file is generated from configure.in by Autoconf. DO NOT EDIT! - # Local configure fragment for sysdeps/s390/elf. + # Local configure fragment for sysdeps/s390. # Check for support of thread-local storage handling in assembler and # linker. @@ -124,4 +124,3 @@ if test $libc_cv_390_tls = no; then fi $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h - diff --git a/libc/sysdeps/s390/s390-32/elf/configure.in b/libc/sysdeps/s390/s390-32/configure.in index d1f40a375..529bdda36 100644 --- a/libc/sysdeps/s390/s390-32/elf/configure.in +++ b/libc/sysdeps/s390/s390-32/configure.in @@ -1,5 +1,5 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/s390/elf. +# Local configure fragment for sysdeps/s390. # Check for support of thread-local storage handling in assembler and # linker. diff --git a/libc/sysdeps/s390/s390-32/elf/bsd-_setjmp.S b/libc/sysdeps/s390/s390-32/elf/bsd-_setjmp.S deleted file mode 100644 index 141727020..000000000 --- a/libc/sysdeps/s390/s390-32/elf/bsd-_setjmp.S +++ /dev/null @@ -1 +0,0 @@ -/* We don't need any code here since the setjmp.S file contains it. */ diff --git a/libc/sysdeps/s390/s390-32/elf/bsd-setjmp.S b/libc/sysdeps/s390/s390-32/elf/bsd-setjmp.S deleted file mode 100644 index 141727020..000000000 --- a/libc/sysdeps/s390/s390-32/elf/bsd-setjmp.S +++ /dev/null @@ -1 +0,0 @@ -/* We don't need any code here since the setjmp.S file contains it. */ diff --git a/libc/sysdeps/s390/s390-32/elf/setjmp.S b/libc/sysdeps/s390/s390-32/elf/setjmp.S deleted file mode 100644 index c54620871..000000000 --- a/libc/sysdeps/s390/s390-32/elf/setjmp.S +++ /dev/null @@ -1,80 +0,0 @@ -/* setjmp for s390, ELF version. - Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - 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 _ASM -#define _SETJMP_H -#include <bits/setjmp.h> - - /* We include the BSD entry points here as well but we make - them weak. */ -ENTRY (setjmp) - .weak C_SYMBOL_NAME (setjmp) - lhi %r3,1 /* second argument of one */ - j .Linternal_sigsetjmp /* branch relativ to __sigsetjmp */ -END (setjmp) - - /* Binary compatibility entry point. */ -ENTRY(_setjmp) - .weak C_SYMBOL_NAME (_setjmp) - lhi %r3,0 /* second argument of zero */ - j .Linternal_sigsetjmp /* branch relativ to __sigsetjmp */ -END (_setjmp) -libc_hidden_def (_setjmp) - -ENTRY(__setjmp) - lhi %r3,0 /* second argument of zero */ - j .Linternal_sigsetjmp /* branch relativ to __sigsetjmp */ -END (__setjmp) - -ENTRY(__sigsetjmp) -.Linternal_sigsetjmp: -#ifdef PTR_MANGLE - stm %r6,%r13,0(%r2) /* store registers in jmp_buf */ - lr %r4,%r14 - lr %r5,%r15 - PTR_MANGLE (%r4, %r1) - PTR_MANGLE2 (%r5, %r1) - stm %r4,%r5,32(%r2) -#else - stm %r6,%r15,0(%r2) /* store registers in jmp_buf */ -#endif - std %f4,40(%r2) - std %f6,48(%r2) -#if defined NOT_IN_libc && defined IS_IN_rtld - /* In ld.so we never save the signal mask. */ - lhi %r2,0 - br %r14 -#elif defined PIC - /* We cannot use the PLT, because it requires that %r12 be set, but - we can't save and restore our caller's value. Instead, we do an - indirect jump through the GOT. */ - basr %r1,0 -.L0: al %r1,.L1 - .L0(0,%r1) /* get address of global offset table */ - /* get address of __sigjmp_save from got */ - l %r1,__sigjmp_save@GOT12(0,%r1) - br %r1 -.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 -#else - basr %r1,0 -.L0: l %r1,.L1-.L0(0,%r1) /* load address of __sigjmp_save */ - br %r1 /* tail-call __sigjmp_save */ -.L1: .long __sigjmp_save -#endif -END (__sigsetjmp) diff --git a/libc/sysdeps/s390/s390-32/setjmp.S b/libc/sysdeps/s390/s390-32/setjmp.S index 506772b95..c54620871 100644 --- a/libc/sysdeps/s390/s390-32/setjmp.S +++ b/libc/sysdeps/s390/s390-32/setjmp.S @@ -1,5 +1,5 @@ -/* - Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc. +/* setjmp for s390, ELF version. + Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -17,17 +17,34 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef _ASM -#define _ASM -#endif - #include <sysdep.h> +#define _ASM +#define _SETJMP_H #include <bits/setjmp.h> -/* Save the current program position in ENV and return 0. */ -/* R2 = pointer to jmp_buf, R3 = savemask */ + /* We include the BSD entry points here as well but we make + them weak. */ +ENTRY (setjmp) + .weak C_SYMBOL_NAME (setjmp) + lhi %r3,1 /* second argument of one */ + j .Linternal_sigsetjmp /* branch relativ to __sigsetjmp */ +END (setjmp) + + /* Binary compatibility entry point. */ +ENTRY(_setjmp) + .weak C_SYMBOL_NAME (_setjmp) + lhi %r3,0 /* second argument of zero */ + j .Linternal_sigsetjmp /* branch relativ to __sigsetjmp */ +END (_setjmp) +libc_hidden_def (_setjmp) + +ENTRY(__setjmp) + lhi %r3,0 /* second argument of zero */ + j .Linternal_sigsetjmp /* branch relativ to __sigsetjmp */ +END (__setjmp) ENTRY(__sigsetjmp) +.Linternal_sigsetjmp: #ifdef PTR_MANGLE stm %r6,%r13,0(%r2) /* store registers in jmp_buf */ lr %r4,%r14 @@ -58,6 +75,6 @@ ENTRY(__sigsetjmp) basr %r1,0 .L0: l %r1,.L1-.L0(0,%r1) /* load address of __sigjmp_save */ br %r1 /* tail-call __sigjmp_save */ -.L1: .long __sigjmp_save +.L1: .long __sigjmp_save #endif END (__sigsetjmp) diff --git a/libc/sysdeps/s390/s390-32/elf/start.S b/libc/sysdeps/s390/s390-32/start.S index d7f3df7f6..d7f3df7f6 100644 --- a/libc/sysdeps/s390/s390-32/elf/start.S +++ b/libc/sysdeps/s390/s390-32/start.S diff --git a/libc/sysdeps/s390/s390-64/bsd-_setjmp.S b/libc/sysdeps/s390/s390-64/bsd-_setjmp.S index 58c7767f9..141727020 100644 --- a/libc/sysdeps/s390/s390-64/bsd-_setjmp.S +++ b/libc/sysdeps/s390/s390-64/bsd-_setjmp.S @@ -1,34 +1 @@ -/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. 64 bit S/390 version. - Copyright (C) 2001, 2002 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - 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/>. */ - -/* This just does a tail-call to `__sigsetjmp (ARG, 0)'. - We cannot do it in C because it must be a tail-call, so frame-unwinding - in setjmp doesn't clobber the state restored by longjmp. */ - -#include <sysdep.h> - -ENTRY(_setjmp) - slgr %r3,%r3 /* Second argument of zero. */ -#ifdef PIC - jg __sigsetjmp@PLT /* Branch to PLT of __sigsetjmp. */ -#else - jg __sigsetjmp /* Branch to __sigsetjmp. */ -#endif -END (_setjmp) -libc_hidden_def (_setjmp) +/* We don't need any code here since the setjmp.S file contains it. */ diff --git a/libc/sysdeps/s390/s390-64/bsd-setjmp.S b/libc/sysdeps/s390/s390-64/bsd-setjmp.S index 956e5c496..141727020 100644 --- a/libc/sysdeps/s390/s390-64/bsd-setjmp.S +++ b/libc/sysdeps/s390/s390-64/bsd-setjmp.S @@ -1,33 +1 @@ -/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. 64 bit S/390 version. - Copyright (C) 2001 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - 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/>. */ - -/* This just does a tail-call to `__sigsetjmp (ARG, 1)'. - We cannot do it in C because it must be a tail-call, so frame-unwinding - in setjmp doesn't clobber the state restored by longjmp. */ - -#include <sysdep.h> - -ENTRY(setjmp) - lghi %r1,1 /* Second argument of one. */ -#ifdef PIC - jg __sigsetjmp@PLT /* Branch to PLT of __sigsetjmp. */ -#else - jg __sigsetjmp /* Branch to __sigsetjmp. */ -#endif -END (setjmp) +/* We don't need any code here since the setjmp.S file contains it. */ diff --git a/libc/sysdeps/s390/s390-64/elf/configure b/libc/sysdeps/s390/s390-64/configure index e81655e0d..0e71b82a1 100644 --- a/libc/sysdeps/s390/s390-64/elf/configure +++ b/libc/sysdeps/s390/s390-64/configure @@ -81,7 +81,7 @@ $as_echo X/"$0" | } # This file is generated from configure.in by Autoconf. DO NOT EDIT! - # Local configure fragment for sysdeps/s390/elf. + # Local configure fragment for sysdeps/s390. # Check for support of thread-local storage handling in assembler and # linker. @@ -124,4 +124,3 @@ if test $libc_cv_390_tls = no; then fi $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h - diff --git a/libc/sysdeps/s390/s390-64/elf/configure.in b/libc/sysdeps/s390/s390-64/configure.in index 007e3838a..235b5f03e 100644 --- a/libc/sysdeps/s390/s390-64/elf/configure.in +++ b/libc/sysdeps/s390/s390-64/configure.in @@ -1,5 +1,5 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/s390/elf. +# Local configure fragment for sysdeps/s390. # Check for support of thread-local storage handling in assembler and # linker. diff --git a/libc/sysdeps/s390/s390-64/elf/bsd-_setjmp.S b/libc/sysdeps/s390/s390-64/elf/bsd-_setjmp.S deleted file mode 100644 index 141727020..000000000 --- a/libc/sysdeps/s390/s390-64/elf/bsd-_setjmp.S +++ /dev/null @@ -1 +0,0 @@ -/* We don't need any code here since the setjmp.S file contains it. */ diff --git a/libc/sysdeps/s390/s390-64/elf/bsd-setjmp.S b/libc/sysdeps/s390/s390-64/elf/bsd-setjmp.S deleted file mode 100644 index 141727020..000000000 --- a/libc/sysdeps/s390/s390-64/elf/bsd-setjmp.S +++ /dev/null @@ -1 +0,0 @@ -/* We don't need any code here since the setjmp.S file contains it. */ diff --git a/libc/sysdeps/s390/s390-64/elf/setjmp.S b/libc/sysdeps/s390/s390-64/elf/setjmp.S deleted file mode 100644 index cbf68bce5..000000000 --- a/libc/sysdeps/s390/s390-64/elf/setjmp.S +++ /dev/null @@ -1,71 +0,0 @@ -/* setjmp for 64 bit S/390, ELF version. - Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - 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 _ASM -#define _SETJMP_H -#include <bits/setjmp.h> - - /* We include the BSD entry points here as well but we make - them weak. */ -ENTRY (setjmp) - .weak C_SYMBOL_NAME (setjmp) - lghi %r3,1 /* Second argument of one. */ - j .Linternal_sigsetjmp /* Branch relativ to __sigsetjmp. */ -END (setjmp) - - /* Binary compatibility entry point. */ -ENTRY(_setjmp) - .weak C_SYMBOL_NAME (_setjmp) - slgr %r3,%r3 /* Second argument of zero. */ - j .Linternal_sigsetjmp /* Branch relativ to __sigsetjmp. */ -END (setjmp) -libc_hidden_def (_setjmp) - -ENTRY(__setjmp) - slgr %r3,%r3 /* Second argument of zero. */ - j .Linternal_sigsetjmp /* Branch relativ to __sigsetjmp. */ -END (setjmp) - -ENTRY(__sigsetjmp) -.Linternal_sigsetjmp: -#ifdef PTR_MANGLE - stmg %r6,%r13,0(%r2) /* Store registers in jmp_buf. */ - lgr %r4,%r14 - lgr %r5,%r15 - PTR_MANGLE (%r4, %r1) - PTR_MANGLE2 (%r5, %r1) - stmg %r4,%r5,64(%r2) -#else - stmg %r6,%r15,0(%r2) /* Store registers in jmp_buf. */ -#endif - std %f1,80(%r2) - std %f3,88(%r2) - std %f5,96(%r2) - std %f7,104(%r2) -#if defined NOT_IN_libc && defined IS_IN_rtld - /* In ld.so we never save the signal mask. */ - lghi %r2,0 - br %r14 -#elif defined PIC - jg __sigjmp_save@PLT /* Branch to PLT of __sigsetjmp. */ -#else - jg __sigjmp_save -#endif -END (__sigsetjmp) diff --git a/libc/sysdeps/s390/s390-64/setjmp.S b/libc/sysdeps/s390/s390-64/setjmp.S index 0c5f1fbf3..cbf68bce5 100644 --- a/libc/sysdeps/s390/s390-64/setjmp.S +++ b/libc/sysdeps/s390/s390-64/setjmp.S @@ -1,4 +1,5 @@ -/* Copyright (C) 2001, 2005 Free Software Foundation, Inc. +/* setjmp for 64 bit S/390, ELF version. + Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -16,17 +17,34 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef _ASM -#define _ASM -#endif - #include <sysdep.h> +#define _ASM +#define _SETJMP_H #include <bits/setjmp.h> -/* Save the current program position in ENV and return 0. */ -/* R2 = pointer to jmp_buf, R3 = savemask. */ + /* We include the BSD entry points here as well but we make + them weak. */ +ENTRY (setjmp) + .weak C_SYMBOL_NAME (setjmp) + lghi %r3,1 /* Second argument of one. */ + j .Linternal_sigsetjmp /* Branch relativ to __sigsetjmp. */ +END (setjmp) + + /* Binary compatibility entry point. */ +ENTRY(_setjmp) + .weak C_SYMBOL_NAME (_setjmp) + slgr %r3,%r3 /* Second argument of zero. */ + j .Linternal_sigsetjmp /* Branch relativ to __sigsetjmp. */ +END (setjmp) +libc_hidden_def (_setjmp) + +ENTRY(__setjmp) + slgr %r3,%r3 /* Second argument of zero. */ + j .Linternal_sigsetjmp /* Branch relativ to __sigsetjmp. */ +END (setjmp) ENTRY(__sigsetjmp) +.Linternal_sigsetjmp: #ifdef PTR_MANGLE stmg %r6,%r13,0(%r2) /* Store registers in jmp_buf. */ lgr %r4,%r14 @@ -46,8 +64,8 @@ ENTRY(__sigsetjmp) lghi %r2,0 br %r14 #elif defined PIC - jg __sigjmp_save@PLT /* Tail-call __sigjmp_save. */ + jg __sigjmp_save@PLT /* Branch to PLT of __sigsetjmp. */ #else - jg __sigjmp_save /* Tail-call __sigjmp_save. */ + jg __sigjmp_save #endif END (__sigsetjmp) diff --git a/libc/sysdeps/s390/s390-64/elf/start.S b/libc/sysdeps/s390/s390-64/start.S index 6256f9729..6256f9729 100644 --- a/libc/sysdeps/s390/s390-64/elf/start.S +++ b/libc/sysdeps/s390/s390-64/start.S diff --git a/libc/sysdeps/sh/elf/configure b/libc/sysdeps/sh/configure index 8235c3c01..29a924b08 100644 --- a/libc/sysdeps/sh/elf/configure +++ b/libc/sysdeps/sh/configure @@ -81,7 +81,7 @@ $as_echo X/"$0" | } # This file is generated from configure.in by Autoconf. DO NOT EDIT! - # Local configure fragment for sysdeps/sh/elf. + # Local configure fragment for sysdeps/sh. # Check for support of thread-local storage handling in assembler and # linker. @@ -119,4 +119,3 @@ if test $libc_cv_sh_tls = no; then fi $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h - diff --git a/libc/sysdeps/sh/elf/configure.in b/libc/sysdeps/sh/configure.in index 9c41a24f4..538e34e9f 100644 --- a/libc/sysdeps/sh/elf/configure.in +++ b/libc/sysdeps/sh/configure.in @@ -1,5 +1,5 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/sh/elf. +# Local configure fragment for sysdeps/sh. # Check for support of thread-local storage handling in assembler and # linker. diff --git a/libc/sysdeps/sh/elf/start.S b/libc/sysdeps/sh/start.S index 0d7557d09..0d7557d09 100644 --- a/libc/sysdeps/sh/elf/start.S +++ b/libc/sysdeps/sh/start.S diff --git a/libc/sysdeps/sparc/Makefile b/libc/sysdeps/sparc/Makefile index 1dd70e8b5..3f0c09640 100644 --- a/libc/sysdeps/sparc/Makefile +++ b/libc/sysdeps/sparc/Makefile @@ -15,3 +15,6 @@ ifeq ($(subdir),csu) CPPFLAGS-crti.S += -fPIC CPPFLAGS-crtn.S += -fPIC endif + +# The assembler on SPARC needs the -fPIC flag even when it's assembler code. +ASFLAGS-.os += -fPIC diff --git a/libc/sysdeps/sparc/configure b/libc/sysdeps/sparc/configure index 9ce761b3b..13d9c63b9 100644 --- a/libc/sysdeps/sparc/configure +++ b/libc/sysdeps/sparc/configure @@ -122,3 +122,96 @@ if test $libc_cv_sparc_as_vis3 = yes; then $as_echo "#define HAVE_AS_VIS3_SUPPORT 1" >>confdefs.h fi + +# Check for support of thread-local storage handling in assembler and linker. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sparc TLS support" >&5 +$as_echo_n "checking for sparc TLS support... " >&6; } +if ${libc_cv_sparc_tls+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.S <<\EOF + .section ".tdata", "awT", @progbits + .globl foo +foo: .word 1 + .section ".tbss", "awT", @nobits + .globl bar +bar: .skip 4 + .text +baz: sethi %tgd_hi22(foo), %l1 + add %l1, %tgd_lo10(foo), %l1 + add %l7, %l1, %o0, %tgd_add(foo) + call __tls_get_addr, %tgd_call(foo) + sethi %tldm_hi22(bar), %l1 + add %l1, %tldm_lo10(bar), %l1 + add %l7, %l1, %o0, %tldm_add(bar) + call __tls_get_addr, %tldm_call(bar) + sethi %tldo_hix22(bar), %l1 + xor %l1, %tldo_lox10(bar), %l1 + add %o0, %l1, %l1, %tldo_add(bar) + sethi %tie_hi22(foo), %l1 + add %l1, %tie_lo10(foo), %l1 +#ifdef __arch64__ + ldx [%l7 + %l1], %l1, %tie_ldx(foo) +#else + ld [%l7 + %l1], %l1, %tie_ld(foo) +#endif + add %g7, %l1, %l1, %tie_add(foo) + sethi %tle_hix22(foo), %l1 + xor %l1, %tle_lox10(foo), %l1 +EOF +if { ac_try='${CC-cc} -c $CFLAGS conftest.S 1>&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + libc_cv_sparc_tls=yes +else + libc_cv_sparc_tls=no +fi +rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_sparc_tls" >&5 +$as_echo "$libc_cv_sparc_tls" >&6; } +if test $libc_cv_sparc_tls = no; then + as_fn_error $? "the assembler must support TLS" "$LINENO" 5 +fi + +# Check for a GCC emitting GOTDATA relocations. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sparc gcc GOTDATA reloc support" >&5 +$as_echo_n "checking for sparc gcc GOTDATA reloc support... " >&6; } +if ${libc_cv_sparc_gcc_gotdata+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <<\EOF +int data; +int foo(void) +{ + return data; +} +EOF +libc_cv_sparc_gcc_gotdata=no +if { ac_try='${CC-cc} -S $CFLAGS -O2 -fPIC conftest.c 1>&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + if grep -q 'gdop_hix22' conftest.s \ + && grep -q 'gdop_lox10' conftest.s; then + libc_cv_sparc_gcc_gotdata=yes + fi +fi +rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_sparc_gcc_gotdata" >&5 +$as_echo "$libc_cv_sparc_gcc_gotdata" >&6; } +if test $libc_cv_sparc_gcc_gotdata = yes; then + $as_echo "#define HAVE_GCC_GOTDATA 1" >>confdefs.h + +fi + +if test $libc_cv_sparc_gcc_gotdata = yes; then + $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h + +fi diff --git a/libc/sysdeps/sparc/configure.in b/libc/sysdeps/sparc/configure.in index b80d9cbf5..a85d0544f 100644 --- a/libc/sysdeps/sparc/configure.in +++ b/libc/sysdeps/sparc/configure.in @@ -28,3 +28,76 @@ rm -f conftest*]) if test $libc_cv_sparc_as_vis3 = yes; then AC_DEFINE(HAVE_AS_VIS3_SUPPORT) fi + +# Check for support of thread-local storage handling in assembler and linker. +AC_CACHE_CHECK(for sparc TLS support, libc_cv_sparc_tls, [dnl +changequote(,)dnl +cat > conftest.S <<\EOF + .section ".tdata", "awT", @progbits + .globl foo +foo: .word 1 + .section ".tbss", "awT", @nobits + .globl bar +bar: .skip 4 + .text +baz: sethi %tgd_hi22(foo), %l1 + add %l1, %tgd_lo10(foo), %l1 + add %l7, %l1, %o0, %tgd_add(foo) + call __tls_get_addr, %tgd_call(foo) + sethi %tldm_hi22(bar), %l1 + add %l1, %tldm_lo10(bar), %l1 + add %l7, %l1, %o0, %tldm_add(bar) + call __tls_get_addr, %tldm_call(bar) + sethi %tldo_hix22(bar), %l1 + xor %l1, %tldo_lox10(bar), %l1 + add %o0, %l1, %l1, %tldo_add(bar) + sethi %tie_hi22(foo), %l1 + add %l1, %tie_lo10(foo), %l1 +#ifdef __arch64__ + ldx [%l7 + %l1], %l1, %tie_ldx(foo) +#else + ld [%l7 + %l1], %l1, %tie_ld(foo) +#endif + add %g7, %l1, %l1, %tie_add(foo) + sethi %tle_hix22(foo), %l1 + xor %l1, %tle_lox10(foo), %l1 +EOF +changequote([,])dnl +dnl +if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.S 1>&AS_MESSAGE_LOG_FD); then + libc_cv_sparc_tls=yes +else + libc_cv_sparc_tls=no +fi +rm -f conftest*]) +if test $libc_cv_sparc_tls = no; then + AC_MSG_ERROR([the assembler must support TLS]) +fi + +# Check for a GCC emitting GOTDATA relocations. +AC_CACHE_CHECK(for sparc gcc GOTDATA reloc support, libc_cv_sparc_gcc_gotdata, [dnl +changequote(,)dnl +cat > conftest.c <<\EOF +int data; +int foo(void) +{ + return data; +} +EOF +changequote([,])dnl +dnl +libc_cv_sparc_gcc_gotdata=no +if AC_TRY_COMMAND(${CC-cc} -S $CFLAGS -O2 -fPIC conftest.c 1>&AS_MESSAGE_LOG_FD); then + if grep -q 'gdop_hix22' conftest.s \ + && grep -q 'gdop_lox10' conftest.s; then + libc_cv_sparc_gcc_gotdata=yes + fi +fi +rm -f conftest*]) +if test $libc_cv_sparc_gcc_gotdata = yes; then + AC_DEFINE(HAVE_GCC_GOTDATA) +fi + +if test $libc_cv_sparc_gcc_gotdata = yes; then + AC_DEFINE(PI_STATIC_AND_HIDDEN) +fi diff --git a/libc/sysdeps/sparc/elf/configure b/libc/sysdeps/sparc/elf/configure deleted file mode 100644 index 355344417..000000000 --- a/libc/sysdeps/sparc/elf/configure +++ /dev/null @@ -1,177 +0,0 @@ - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -# This file is generated from configure.in by Autoconf. DO NOT EDIT! - # Local configure fragment for sysdeps/sparc/elf. - -# Check for support of thread-local storage handling in assembler and linker. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sparc TLS support" >&5 -$as_echo_n "checking for sparc TLS support... " >&6; } -if ${libc_cv_sparc_tls+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.S <<\EOF - .section ".tdata", "awT", @progbits - .globl foo -foo: .word 1 - .section ".tbss", "awT", @nobits - .globl bar -bar: .skip 4 - .text -baz: sethi %tgd_hi22(foo), %l1 - add %l1, %tgd_lo10(foo), %l1 - add %l7, %l1, %o0, %tgd_add(foo) - call __tls_get_addr, %tgd_call(foo) - sethi %tldm_hi22(bar), %l1 - add %l1, %tldm_lo10(bar), %l1 - add %l7, %l1, %o0, %tldm_add(bar) - call __tls_get_addr, %tldm_call(bar) - sethi %tldo_hix22(bar), %l1 - xor %l1, %tldo_lox10(bar), %l1 - add %o0, %l1, %l1, %tldo_add(bar) - sethi %tie_hi22(foo), %l1 - add %l1, %tie_lo10(foo), %l1 -#ifdef __arch64__ - ldx [%l7 + %l1], %l1, %tie_ldx(foo) -#else - ld [%l7 + %l1], %l1, %tie_ld(foo) -#endif - add %g7, %l1, %l1, %tie_add(foo) - sethi %tle_hix22(foo), %l1 - xor %l1, %tle_lox10(foo), %l1 -EOF -if { ac_try='${CC-cc} -c $CFLAGS conftest.S 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - libc_cv_sparc_tls=yes -else - libc_cv_sparc_tls=no -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_sparc_tls" >&5 -$as_echo "$libc_cv_sparc_tls" >&6; } -if test $libc_cv_sparc_tls = no; then - as_fn_error $? "the assembler must support TLS" "$LINENO" 5 -fi - -# Check for a GCC emitting GOTDATA relocations. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sparc gcc GOTDATA reloc support" >&5 -$as_echo_n "checking for sparc gcc GOTDATA reloc support... " >&6; } -if ${libc_cv_sparc_gcc_gotdata+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.c <<\EOF -int data; -int foo(void) -{ - return data; -} -EOF -libc_cv_sparc_gcc_gotdata=no -if { ac_try='${CC-cc} -S $CFLAGS -O2 -fPIC conftest.c 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - if grep -q 'gdop_hix22' conftest.s \ - && grep -q 'gdop_lox10' conftest.s; then - libc_cv_sparc_gcc_gotdata=yes - fi -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_sparc_gcc_gotdata" >&5 -$as_echo "$libc_cv_sparc_gcc_gotdata" >&6; } -if test $libc_cv_sparc_gcc_gotdata = yes; then - $as_echo "#define HAVE_GCC_GOTDATA 1" >>confdefs.h - -fi - -if test $libc_cv_sparc_gcc_gotdata = yes; then - $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h - -fi diff --git a/libc/sysdeps/sparc/elf/configure.in b/libc/sysdeps/sparc/elf/configure.in deleted file mode 100644 index ec683455c..000000000 --- a/libc/sysdeps/sparc/elf/configure.in +++ /dev/null @@ -1,75 +0,0 @@ -GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/sparc/elf. - -# Check for support of thread-local storage handling in assembler and linker. -AC_CACHE_CHECK(for sparc TLS support, libc_cv_sparc_tls, [dnl -changequote(,)dnl -cat > conftest.S <<\EOF - .section ".tdata", "awT", @progbits - .globl foo -foo: .word 1 - .section ".tbss", "awT", @nobits - .globl bar -bar: .skip 4 - .text -baz: sethi %tgd_hi22(foo), %l1 - add %l1, %tgd_lo10(foo), %l1 - add %l7, %l1, %o0, %tgd_add(foo) - call __tls_get_addr, %tgd_call(foo) - sethi %tldm_hi22(bar), %l1 - add %l1, %tldm_lo10(bar), %l1 - add %l7, %l1, %o0, %tldm_add(bar) - call __tls_get_addr, %tldm_call(bar) - sethi %tldo_hix22(bar), %l1 - xor %l1, %tldo_lox10(bar), %l1 - add %o0, %l1, %l1, %tldo_add(bar) - sethi %tie_hi22(foo), %l1 - add %l1, %tie_lo10(foo), %l1 -#ifdef __arch64__ - ldx [%l7 + %l1], %l1, %tie_ldx(foo) -#else - ld [%l7 + %l1], %l1, %tie_ld(foo) -#endif - add %g7, %l1, %l1, %tie_add(foo) - sethi %tle_hix22(foo), %l1 - xor %l1, %tle_lox10(foo), %l1 -EOF -changequote([,])dnl -dnl -if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.S 1>&AS_MESSAGE_LOG_FD); then - libc_cv_sparc_tls=yes -else - libc_cv_sparc_tls=no -fi -rm -f conftest*]) -if test $libc_cv_sparc_tls = no; then - AC_MSG_ERROR([the assembler must support TLS]) -fi - -# Check for a GCC emitting GOTDATA relocations. -AC_CACHE_CHECK(for sparc gcc GOTDATA reloc support, libc_cv_sparc_gcc_gotdata, [dnl -changequote(,)dnl -cat > conftest.c <<\EOF -int data; -int foo(void) -{ - return data; -} -EOF -changequote([,])dnl -dnl -libc_cv_sparc_gcc_gotdata=no -if AC_TRY_COMMAND(${CC-cc} -S $CFLAGS -O2 -fPIC conftest.c 1>&AS_MESSAGE_LOG_FD); then - if grep -q 'gdop_hix22' conftest.s \ - && grep -q 'gdop_lox10' conftest.s; then - libc_cv_sparc_gcc_gotdata=yes - fi -fi -rm -f conftest*]) -if test $libc_cv_sparc_gcc_gotdata = yes; then - AC_DEFINE(HAVE_GCC_GOTDATA) -fi - -if test $libc_cv_sparc_gcc_gotdata = yes; then - AC_DEFINE(PI_STATIC_AND_HIDDEN) -fi diff --git a/libc/sysdeps/sparc/fpu/libm-test-ulps b/libc/sysdeps/sparc/fpu/libm-test-ulps index c07a26a4d..60a53aa43 100644 --- a/libc/sysdeps/sparc/fpu/libm-test-ulps +++ b/libc/sysdeps/sparc/fpu/libm-test-ulps @@ -525,6 +525,9 @@ float: 1 ifloat: 1 # cexp +Test "Imaginary part of: cexp (-10000 + 0x1p16383 i) == 1.045876464564882298442774542991176546722e-4343 + 4.421154026488516836023811173959413420548e-4344 i": +ildouble: 1 +ldouble: 1 Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": ildouble: 1 ldouble: 1 @@ -533,12 +536,55 @@ float: 1 ifloat: 1 ildouble: 1 ldouble: 1 +Test "Imaginary part of: cexp (-720 + 0.75 i) == 1.486960657116368433685753325516638551722e-313 + 1.385247284245720590980701226843815229385e-313 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i": +double: 1 +idouble: 1 Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": float: 1 ifloat: 1 Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": ildouble: 1 ldouble: 1 +Test "Imaginary part of: cexp (1440 + 0x1p-1074 i) == inf + 1.196295853897226111293303155636183216483e302 i plus overflow exception": +double: 1 +idouble: 1 +Test "Imaginary part of: cexp (22730 + 0x1p-16434 i) == inf + 2.435706297811211974162115164702304105374e4924 i plus overflow exception": +ildouble: 1 +ldouble: 1 +Test "Real part of: cexp (50 + 0x1p127 i) == 4.053997150228616856622417636046265337193e21 + 3.232070315463388524466674772633810238819e21 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (50 + 0x1p127 i) == 4.053997150228616856622417636046265337193e21 + 3.232070315463388524466674772633810238819e21 i": +double: 1 +idouble: 1 +Test "Real part of: cexp (500 + 0x1p1023 i) == -1.159886268932754433233243794561351783426e217 + 7.904017694554466595359379965081774849708e216 i": +double: 1 +idouble: 1 +Test "Real part of: cexp (709.8125 + 0.75 i) == 1.355121963080879535248452862759108365762e308 + 1.262426823598609432507811340856186873507e308 i": +double: 1 +idouble: 1 +Test "Imaginary part of: cexp (709.8125 + 0.75 i) == 1.355121963080879535248452862759108365762e308 + 1.262426823598609432507811340856186873507e308 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cexp (88.75 + 0.75 i) == 2.558360358486542817001900410314204322891e38 + 2.383359453227311447654736314679677655100e38 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (88.75 + 0.75 i) == 2.558360358486542817001900410314204322891e38 + 2.383359453227311447654736314679677655100e38 i": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 # clog Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": @@ -685,8 +731,6 @@ ifloat: 1 Test "cos (M_PI_6l * 2.0) == 0.5": double: 1 idouble: 1 -ildouble: 1 -ldouble: 1 Test "cos (M_PI_6l * 4.0) == -0.5": double: 2 float: 1 @@ -699,8 +743,6 @@ ldouble: 1 Test "cos_downward (1) == 0.5403023058681397174009366074429766037323": float: 1 ifloat: 1 -ildouble: 1 -ldouble: 1 Test "cos_downward (10) == -0.8390715290764524522588639478240648345199": ildouble: 1 ldouble: 1 @@ -717,8 +759,6 @@ ldouble: 1 Test "cos_downward (4) == -0.6536436208636119146391681830977503814241": float: 1 ifloat: 1 -ildouble: 1 -ldouble: 1 Test "cos_downward (5) == 0.2836621854632262644666391715135573083344": float: 1 ifloat: 1 @@ -744,9 +784,6 @@ float: 1 ifloat: 1 # cos_towardzero -Test "cos_towardzero (1) == 0.5403023058681397174009366074429766037323": -ildouble: 1 -ldouble: 1 Test "cos_towardzero (10) == -0.8390715290764524522588639478240648345199": ildouble: 1 ldouble: 1 @@ -760,9 +797,6 @@ float: 1 ifloat: 1 ildouble: 1 ldouble: 1 -Test "cos_towardzero (4) == -0.6536436208636119146391681830977503814241": -ildouble: 1 -ldouble: 1 Test "cos_towardzero (5) == 0.2836621854632262644666391715135573083344": float: 1 ifloat: 1 @@ -783,9 +817,15 @@ ildouble: 2 ldouble: 2 # cos_upward +Test "cos_upward (1) == 0.5403023058681397174009366074429766037323": +ildouble: 1 +ldouble: 1 Test "cos_upward (10) == -0.8390715290764524522588639478240648345199": float: 1 ifloat: 1 +Test "cos_upward (4) == -0.6536436208636119146391681830977503814241": +ildouble: 1 +ldouble: 1 Test "cos_upward (6) == 0.9601702866503660205456522979229244054519": float: 1 ifloat: 1 @@ -863,9 +903,6 @@ ifloat: 4 ildouble: 4 ldouble: 4 Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": -ildouble: 2 -ldouble: 2 -Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": ildouble: 1 ldouble: 1 Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i": @@ -873,8 +910,8 @@ double: 2 float: 3 idouble: 2 ifloat: 3 -ildouble: 10 -ldouble: 10 +ildouble: 11 +ldouble: 11 Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i": ildouble: 2 ldouble: 2 @@ -883,8 +920,8 @@ double: 1 float: 4 idouble: 1 ifloat: 4 -ildouble: 3 -ldouble: 3 +ildouble: 2 +ldouble: 2 Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": float: 2 ifloat: 2 @@ -991,6 +1028,11 @@ ifloat: 1 Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": double: 1 idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": +ildouble: 1 +ldouble: 1 # erf Test "erf (1.25) == 0.922900128256458230136523481197281140": @@ -1039,9 +1081,9 @@ ildouble: 1 ldouble: 1 # exp2 -Test "exp2 (10) == 1024": -ildouble: 2 -ldouble: 2 +Test "exp2 (100.5) == 1.792728671193156477399422023278661496394e+30": +ildouble: 1 +ldouble: 1 # exp_downward Test "exp_downward (2) == e^2": @@ -1412,15 +1454,7 @@ ifloat: 1 ildouble: 1 ldouble: 1 -# sin -Test "sin (0x1p1023) == 0.5631277798508840134529434079444683477104": -ildouble: 1 -ldouble: 1 - # sin_downward -Test "sin_downward (1) == 0.8414709848078965066525023216302989996226": -ildouble: 1 -ldouble: 1 Test "sin_downward (10) == -0.5440211108893698134047476618513772816836": float: 1 ifloat: 1 @@ -1443,9 +1477,10 @@ ldouble: 1 Test "sin_downward (6) == -0.2794154981989258728115554466118947596280": float: 1 ifloat: 1 +Test "sin_downward (8) == 0.9893582466233817778081235982452886721164": ildouble: 1 ldouble: 1 -Test "sin_downward (8) == 0.9893582466233817778081235982452886721164": +Test "sin_downward (9) == 0.4121184852417565697562725663524351793439": ildouble: 1 ldouble: 1 @@ -1453,17 +1488,9 @@ ldouble: 1 Test "sin_tonearest (1) == 0.8414709848078965066525023216302989996226": float: 1 ifloat: 1 -ildouble: 1 -ldouble: 1 Test "sin_tonearest (3) == 0.1411200080598672221007448028081102798469": ildouble: 1 ldouble: 1 -Test "sin_tonearest (6) == -0.2794154981989258728115554466118947596280": -ildouble: 1 -ldouble: 1 -Test "sin_tonearest (9) == 0.4121184852417565697562725663524351793439": -ildouble: 1 -ldouble: 1 # sin_towardzero Test "sin_towardzero (1) == 0.8414709848078965066525023216302989996226": @@ -1481,22 +1508,21 @@ ldouble: 1 Test "sin_towardzero (4) == -0.7568024953079282513726390945118290941359": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "sin_towardzero (5) == -0.9589242746631384688931544061559939733525": float: 1 ifloat: 1 ildouble: 1 ldouble: 1 -Test "sin_towardzero (6) == -0.2794154981989258728115554466118947596280": -ildouble: 1 -ldouble: 1 Test "sin_towardzero (8) == 0.9893582466233817778081235982452886721164": ildouble: 1 ldouble: 1 Test "sin_towardzero (9) == 0.4121184852417565697562725663524351793439": float: 1 ifloat: 1 -ildouble: 2 -ldouble: 2 +ildouble: 1 +ldouble: 1 # sin_upward Test "sin_upward (1) == 0.8414709848078965066525023216302989996226": @@ -1516,6 +1542,7 @@ ldouble: 1 Test "sin_upward (4) == -0.7568024953079282513726390945118290941359": float: 1 ifloat: 1 +Test "sin_upward (6) == -0.2794154981989258728115554466118947596280": ildouble: 1 ldouble: 1 Test "sin_upward (7) == 0.6569865987187890903969990915936351779369": @@ -1524,25 +1551,16 @@ ldouble: 1 Test "sin_upward (9) == 0.4121184852417565697562725663524351793439": float: 1 ifloat: 1 -ildouble: 1 -ldouble: 1 # sincos -Test "sincos (0x1p1023, &sin_res, &cos_res) puts 0.5631277798508840134529434079444683477104 in sin_res": -ildouble: 1 -ldouble: 1 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": double: 1 idouble: 1 -ildouble: 1 -ldouble: 1 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res": double: 1 float: 1 idouble: 1 ifloat: 1 -ildouble: 1 -ldouble: 1 Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res": float: 1 ifloat: 1 @@ -2014,14 +2032,18 @@ ildouble: 1 ldouble: 1 Function: Real part of "cexp": +double: 2 float: 1 +idouble: 2 ifloat: 1 ildouble: 1 ldouble: 1 Function: Imaginary part of "cexp": -float: 1 -ifloat: 1 +double: 1 +float: 2 +idouble: 1 +ifloat: 2 ildouble: 1 ldouble: 1 @@ -2104,8 +2126,8 @@ double: 2 float: 4 idouble: 2 ifloat: 4 -ildouble: 10 -ldouble: 10 +ildouble: 11 +ldouble: 11 Function: Imaginary part of "cpow": double: 2 @@ -2196,8 +2218,8 @@ ildouble: 1 ldouble: 1 Function: "exp2": -ildouble: 2 -ldouble: 2 +ildouble: 1 +ldouble: 1 Function: "exp_downward": float: 1 @@ -2297,10 +2319,6 @@ ifloat: 1 ildouble: 1 ldouble: 1 -Function: "sin": -ildouble: 1 -ldouble: 1 - Function: "sin_downward": float: 1 ifloat: 1 @@ -2316,8 +2334,8 @@ ldouble: 1 Function: "sin_towardzero": float: 1 ifloat: 1 -ildouble: 2 -ldouble: 2 +ildouble: 1 +ldouble: 1 Function: "sin_upward": float: 2 diff --git a/libc/sysdeps/sparc/sparc32/Makefile b/libc/sysdeps/sparc/sparc32/Makefile index fb1adafcd..fb7132ee9 100644 --- a/libc/sysdeps/sparc/sparc32/Makefile +++ b/libc/sysdeps/sparc/sparc32/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-1998, 2000, 2011 Free Software Foundation, Inc. +# Copyright (C) 1991-1998, 2000, 2011, 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 diff --git a/libc/sysdeps/sparc/sparc32/elf/Makefile b/libc/sysdeps/sparc/sparc32/elf/Makefile deleted file mode 100644 index a995e6cdf..000000000 --- a/libc/sysdeps/sparc/sparc32/elf/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -# Sparc/ELF specific definitions. - -# The assembler on SPARC needs the -fPIC flag even when it's assembler code. -ASFLAGS-.os = -fPIC diff --git a/libc/sysdeps/sparc/sparc32/elf/start.S b/libc/sysdeps/sparc/sparc32/start.S index 1efa8e839..1efa8e839 100644 --- a/libc/sysdeps/sparc/sparc32/elf/start.S +++ b/libc/sysdeps/sparc/sparc32/start.S diff --git a/libc/sysdeps/sparc/sparc64/elf/Makefile b/libc/sysdeps/sparc/sparc64/elf/Makefile deleted file mode 100644 index a995e6cdf..000000000 --- a/libc/sysdeps/sparc/sparc64/elf/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -# Sparc/ELF specific definitions. - -# The assembler on SPARC needs the -fPIC flag even when it's assembler code. -ASFLAGS-.os = -fPIC diff --git a/libc/sysdeps/sparc/sparc64/elf/start.S b/libc/sysdeps/sparc/sparc64/start.S index 7924fb482..7924fb482 100644 --- a/libc/sysdeps/sparc/sparc64/elf/start.S +++ b/libc/sysdeps/sparc/sparc64/start.S diff --git a/libc/sysdeps/unix/i386/start.c b/libc/sysdeps/unix/i386/start.c deleted file mode 100644 index e6c89ee3f..000000000 --- a/libc/sysdeps/unix/i386/start.c +++ /dev/null @@ -1,2 +0,0 @@ -#define DUMMIES dummy0 -#include <sysdeps/unix/start.c> diff --git a/libc/sysdeps/unix/sparc/start.c b/libc/sysdeps/unix/sparc/start.c deleted file mode 100644 index 86fb8bb0a..000000000 --- a/libc/sysdeps/unix/sparc/start.c +++ /dev/null @@ -1,186 +0,0 @@ -/* Copyright (C) 1991-1997,2004,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. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - - 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 <errno.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> - -#ifndef NO_SHLIB -#include <sys/exec.h> -#include <sys/types.h> -#include <sys/mman.h> -#include <link.h> -#include <syscall.h> -#endif - -#if !defined (__GNUC__) || __GNUC__ < 2 - #error This file uses GNU C extensions; you must compile with GCC version 2. -#endif - -/* The first piece of initialized data. */ -int __data_start = 0; -weak_alias (__data_start, data_start) - -extern void __libc_init (int argc, char **argv, char **envp) __THROW; -extern int main (int argc, char **argv, char **envp) __THROW; - -register long int sp asm("%sp"), fp asm("%fp"); - -#ifndef NO_SHLIB -static void init_shlib (void) __THROW; -#endif - -#ifndef NO_EXPLICIT_START -/* Declare _start with an explicit assembly symbol name of `start' - (note no leading underscore). This is the name Sun's crt0.o uses, - and programs are often linked with `ld -e start'. */ -void _start (void) asm ("start"); -#endif - -void -_start (void) -{ - /* It is important that these be declared `register'. - Otherwise, when compiled without optimization, they are put on the - stack, which loses completely after we zero the FP. */ - register int argc; - register char **argv, **envp; - - /* Unwind the frame built when we entered the function. */ - asm("restore"); - - /* And clear the frame pointer. */ - fp = 0; - - /* The argument info starts after one register - window (64 bytes) past the SP. */ - argc = ((int *) sp)[16]; - argv = (char **) &((int *) sp)[17]; - envp = &argv[argc + 1]; - __environ = envp; - -#ifndef NO_SHLIB - init_shlib (); -#endif - - /* Allocate 24 bytes of stack space for the register save area. */ - sp -= 24; - __libc_init (argc, argv, envp); - - exit (main (argc, argv, envp)); -} - -#ifndef NO_SHLIB - -/* System calls for use by the bootstrap routine. - These are defined here since the usual calls may be dynamically linked. */ - -int syscall (int sysno, ...) asm ("init_syscall"); -asm ("init_syscall:\n" - " clr %g1\n" - " ta 0\n" - " bcc 1f\n" - " sethi %hi(_errno), %g1\n" - " st %o0, [%g1 + %lo(_errno)]\n" - " sub %g0, 1, %o0\n" - "1:retl\n" - " nop"); - -static void -init_shlib () -{ - extern struct link_dynamic _DYNAMIC; - int so, zf; - caddr_t somap; - caddr_t sodmap; - caddr_t sobssmap; - void (*ldstart) (int, int); - struct exec soexec; - struct - { - caddr_t crt_ba; - int crt_dzfd; - int crt_ldfd; - struct link_dynamic *crt_dp; - char **crt_ep; - caddr_t crt_bp; - } soarg; - - /* If not dynamically linked, do nothing. */ - if (&_DYNAMIC == 0) - return; - - /* Map in the dynamic linker. */ - so = syscall (SYS_open, "/usr/lib/ld.so", O_RDONLY); - if (syscall (SYS_read, so, &soexec, sizeof (soexec)) != sizeof (soexec) - || soexec.a_magic != ZMAGIC) - { - static const char emsg[] = "crt0: no /usr/lib/ld.so\n"; - - syscall (SYS_write, 2, emsg, sizeof (emsg) - 1); - syscall (SYS_exit, 127); - } - somap = (caddr_t) syscall (SYS_mmap, 0, - soexec.a_text + soexec.a_data + soexec.a_bss, - PROT_READ | PROT_EXEC, _MAP_NEW | MAP_PRIVATE, - so, 0); - sodmap = (caddr_t) syscall (SYS_mmap, somap + soexec.a_text, soexec.a_data, - PROT_READ | PROT_WRITE | PROT_EXEC, - _MAP_NEW | MAP_FIXED | MAP_PRIVATE, - so, soexec.a_text); - zf = syscall (SYS_open, "/dev/zero", O_RDONLY); - if (soexec.a_bss != 0) - sobssmap = (caddr_t) syscall (SYS_mmap, - somap + soexec.a_text + soexec.a_data, - soexec.a_bss, - PROT_READ | PROT_WRITE | PROT_EXEC, - _MAP_NEW | MAP_FIXED | MAP_PRIVATE, - zf, 0); - - /* Call the entry point of the dynamic linker. */ - soarg.crt_ba = somap; - soarg.crt_dzfd = zf; - soarg.crt_ldfd = so; - soarg.crt_dp = &_DYNAMIC; - soarg.crt_ep = __environ; - soarg.crt_bp = (caddr_t) &&retaddr; - - ldstart = (__typeof (ldstart)) (somap + soexec.a_entry); - (*ldstart) (1, (char *) &soarg - (char *) sp); - - retaddr: -} - -#endif diff --git a/libc/sysdeps/unix/start.c b/libc/sysdeps/unix/start.c deleted file mode 100644 index ecedc5511..000000000 --- a/libc/sysdeps/unix/start.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright (C) 1991, 93, 1995-1998, 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 - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - - 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 <errno.h> -#include <stdlib.h> -#include <unistd.h> -#include <sysdep.h> /* In case it wants to define anything. */ - -/* The first piece of initialized data. */ -int __data_start = 0; -weak_alias (__data_start, data_start) - -#ifdef DUMMIES -#define ARG_DUMMIES DUMMIES, -#define DECL_DUMMIES int DUMMIES; -#else -#define ARG_DUMMIES -#define DECL_DUMMIES -#endif - -extern void __libc_init (int argc, char **argv, char **envp); -extern int main (int argc, char **argv, char **envp); - - -/* Not a prototype because it gets called strangely. */ -static void start1(); - -#ifndef HAVE__start - -/* N.B.: It is important that this be the first function. - This file is the first thing in the text section. */ -void -_start () -{ - start1 (); -} - -#endif - -/* ARGSUSED */ -static void -start1 (ARG_DUMMIES argc, argp) - DECL_DUMMIES - int argc; - char *argp; -{ - char **argv = &argp; - - /* The environment starts just after ARGV. */ - __environ = &argv[argc + 1]; - - /* If the first thing after ARGV is the arguments - themselves, there is no environment. */ - if ((char *) __environ == *argv) - /* The environment is empty. Make __environ - point at ARGV[ARGC], which is NULL. */ - --__environ; - - /* Do C library initializations. */ - __libc_init (argc, argv, __environ); - - /* Call the user program. */ - exit (main (argc, argv, __environ)); -} diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/bits/mman.h b/libc/sysdeps/unix/sysv/linux/powerpc/bits/mman.h index 25491b5ca..c02492cfb 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/bits/mman.h +++ b/libc/sysdeps/unix/sysv/linux/powerpc/bits/mman.h @@ -1,6 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/PowerPC version. - Copyright (C) 1997,2000,2003,2005,2006,2008,2009,2011 - 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 @@ -64,6 +63,8 @@ # define MAP_NORESERVE 0x00040 /* Don't check for reservations. */ # define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ #endif /* Flags to `msync'. */ diff --git a/libc/sysdeps/unix/sysv/linux/s390/bits/mman.h b/libc/sysdeps/unix/sysv/linux/s390/bits/mman.h index 2498e575f..094afbe56 100644 --- a/libc/sysdeps/unix/sysv/linux/s390/bits/mman.h +++ b/libc/sysdeps/unix/sysv/linux/s390/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/s390 version. - Copyright (C) 2000-2003,2005,2006,2009,2011 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 @@ -63,6 +63,8 @@ # define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ # define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ #endif /* Flags to `msync'. */ diff --git a/libc/sysdeps/unix/sysv/linux/sh/bits/mman.h b/libc/sysdeps/unix/sysv/linux/sh/bits/mman.h index a15490104..d7f2ed53a 100644 --- a/libc/sysdeps/unix/sysv/linux/sh/bits/mman.h +++ b/libc/sysdeps/unix/sysv/linux/sh/bits/mman.h @@ -1,6 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/SH version. - Copyright (C) 1997,1999,2000,2003,2005,2006,2009,2011 - 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 @@ -63,6 +62,8 @@ # define MAP_NORESERVE 0x4000 /* Don't check for reservations. */ # define MAP_POPULATE 0x8000 /* Populate (prefault) pagetables. */ # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ #endif /* Flags to `msync'. */ diff --git a/libc/sysdeps/unix/sysv/linux/sparc/bits/mman.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/mman.h index faa40c04d..fb9c75fe2 100644 --- a/libc/sysdeps/unix/sysv/linux/sparc/bits/mman.h +++ b/libc/sysdeps/unix/sysv/linux/sparc/bits/mman.h @@ -1,6 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/SPARC version. - Copyright (C) 1997,1999,2000,2003,2005,2006,2009,2011 - 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 @@ -65,6 +64,8 @@ # define _MAP_NEW 0x80000000 /* Binary compatibility with SunOS. */ # define MAP_POPULATE 0x8000 /* Populate (prefault) pagetables. */ # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ #endif /* Flags to `msync'. */ diff --git a/libc/sysdeps/x86_64/bits/link.h b/libc/sysdeps/x86_64/bits/link.h index c79eda846..fa2091085 100644 --- a/libc/sysdeps/x86_64/bits/link.h +++ b/libc/sysdeps/x86_64/bits/link.h @@ -20,7 +20,7 @@ #endif -#if __ELF_NATIVE_CLASS == 32 +#ifndef __x86_64__ /* Registers for entry into PLT on IA-32. */ typedef struct La_i86_regs { @@ -105,6 +105,8 @@ typedef struct La_x86_64_retval La_x86_64_vector lrv_vector1; } La_x86_64_retval; +#define La_x32_regs La_x86_64_regs +#define La_x32_retval La_x86_64_retval __BEGIN_DECLS @@ -124,6 +126,22 @@ extern unsigned int la_x86_64_gnu_pltexit (Elf64_Sym *__sym, La_x86_64_retval *__outregs, const char *__symname); +extern Elf32_Addr la_x32_gnu_pltenter (Elf32_Sym *__sym, + unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + La_x32_regs *__regs, + unsigned int *__flags, + const char *__symname, + long int *__framesizep); +extern unsigned int la_x32_gnu_pltexit (Elf32_Sym *__sym, + unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + const La_x32_regs *__inregs, + La_x32_retval *__outregs, + const char *__symname); + __END_DECLS #endif diff --git a/libc/sysdeps/x86_64/configure b/libc/sysdeps/x86_64/configure index bd699bbcc..d73710756 100644 --- a/libc/sysdeps/x86_64/configure +++ b/libc/sysdeps/x86_64/configure @@ -1,3 +1,371 @@ -# The i386 fragment also works for x86_64. -. $srcdir/sysdeps/i386/configure +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile +# This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/x86_64. + + +ac_fn_c_check_header_compile "$LINENO" "cpuid.h" "ac_cv_header_cpuid_h" "/* No default includes. */ +" +if test "x$ac_cv_header_cpuid_h" = xyes; then : + +else + as_fn_error $? "gcc must provide the <cpuid.h> header" "$LINENO" 5 +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if -g produces usable source locations for assembler-with-cpp" >&5 +$as_echo_n "checking if -g produces usable source locations for assembler-with-cpp... " >&6; } +if ${libc_cv_cpp_asm_debuginfo+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.S <<EOF +#include "confdefs.h" + +/* comment on + two lines */ + ${libc_cv_dot_text} + ${libc_cv_asm_global_directive} foo +foo: + /* Unfortunately this test only works for a real instruction, + not for any of the machine-independent pseudo-ops. + So we just have to assume everybody has a "nop". */ + nop + /* comment */ + nop + /* comment */ + nop +EOF +if { ac_try='${CC-cc} $CPPFLAGS $ASFLAGS -g -c conftest.S 1>&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } && { + ac_pattern='conftest\.S' + { ac_try='readelf --debug-dump=line conftest.o | + grep $ac_pattern 1>&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + }; then + libc_cv_cpp_asm_debuginfo=yes +else + libc_cv_cpp_asm_debuginfo=no +fi +rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cpp_asm_debuginfo" >&5 +$as_echo "$libc_cv_cpp_asm_debuginfo" >&6; } +if test $libc_cv_cpp_asm_debuginfo = yes; then + $as_echo "#define HAVE_CPP_ASM_DEBUGINFO 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSE4 support" >&5 +$as_echo_n "checking for SSE4 support... " >&6; } +if ${libc_cv_cc_sse4+:} false; then : + $as_echo_n "(cached) " >&6 +else + if { ac_try='${CC-cc} -msse4 -xc /dev/null -S -o /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + libc_cv_cc_sse4=yes +else + libc_cv_cc_sse4=no +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_sse4" >&5 +$as_echo "$libc_cv_cc_sse4" >&6; } +if test $libc_cv_cc_sse4 = yes; then + $as_echo "#define HAVE_SSE4_SUPPORT 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX support" >&5 +$as_echo_n "checking for AVX support... " >&6; } +if ${libc_cv_cc_avx+:} false; then : + $as_echo_n "(cached) " >&6 +else + if { ac_try='${CC-cc} -mavx -xc /dev/null -S -o /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + libc_cv_cc_avx=yes +else + libc_cv_cc_avx=no +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_avx" >&5 +$as_echo "$libc_cv_cc_avx" >&6; } +if test $libc_cv_cc_avx = yes; then + $as_echo "#define HAVE_AVX_SUPPORT 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX encoding of SSE instructions" >&5 +$as_echo_n "checking for AVX encoding of SSE instructions... " >&6; } +if ${libc_cv_cc_sse2avx+:} false; then : + $as_echo_n "(cached) " >&6 +else + if { ac_try='${CC-cc} -msse2avx -xc /dev/null -S -o /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + libc_cv_cc_sse2avx=yes +else + libc_cv_cc_sse2avx=no +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_sse2avx" >&5 +$as_echo "$libc_cv_cc_sse2avx" >&6; } +if test $libc_cv_cc_sse2avx = yes; then + $as_echo "#define HAVE_SSE2AVX_SUPPORT 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FMA4 support" >&5 +$as_echo_n "checking for FMA4 support... " >&6; } +if ${libc_cv_cc_fma4+:} false; then : + $as_echo_n "(cached) " >&6 +else + if { ac_try='${CC-cc} -mfma4 -xc /dev/null -S -o /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + libc_cv_cc_fma4=yes +else + libc_cv_cc_fma4=no +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_fma4" >&5 +$as_echo "$libc_cv_cc_fma4" >&6; } +if test $libc_cv_cc_fma4 = yes; then + $as_echo "#define HAVE_FMA4_SUPPORT 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -mno-vzeroupper support" >&5 +$as_echo_n "checking for -mno-vzeroupper support... " >&6; } +if ${libc_cv_cc_novzeroupper+:} false; then : + $as_echo_n "(cached) " >&6 +else + if { ac_try='${CC-cc} -mno-vzeroupper -xc /dev/null -S -o /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + libc_cv_cc_novzeroupper=yes +else + libc_cv_cc_novzeroupper=no +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_novzeroupper" >&5 +$as_echo "$libc_cv_cc_novzeroupper" >&6; } + +# Check for support of thread-local storage handling in assembler and linker. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86-64 TLS support" >&5 +$as_echo_n "checking for x86-64 TLS support... " >&6; } +if ${libc_cv_x86_64_tls+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.s <<\EOF + .section ".tdata", "awT", @progbits + .globl foo +foo: .quad 1 + .section ".tbss", "awT", @nobits + .globl bar +bar: .skip 8 + .text +baz: leaq bar@TLSLD(%rip), %rdi + leaq bar@DTPOFF(%rax), %rcx + addq foo@GOTTPOFF(%rip), %rax + movq $bar@TPOFF, %rdx +EOF +if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + libc_cv_x86_64_tls=yes +else + libc_cv_x86_64_tls=no +fi +rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_x86_64_tls" >&5 +$as_echo "$libc_cv_x86_64_tls" >&6; } +if test $libc_cv_x86_64_tls = no; then + as_fn_error $? "the assembler must support TLS" "$LINENO" 5 +fi + +$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h + +# work around problem with autoconf and empty lines at the end of files diff --git a/libc/sysdeps/x86_64/configure.in b/libc/sysdeps/x86_64/configure.in new file mode 100644 index 000000000..e3bf103fd --- /dev/null +++ b/libc/sysdeps/x86_64/configure.in @@ -0,0 +1,111 @@ +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +# Local configure fragment for sysdeps/x86_64. + +AC_CHECK_HEADER([cpuid.h], , + [AC_MSG_ERROR([gcc must provide the <cpuid.h> header])], + [/* No default includes. */]) + +AC_CACHE_CHECK(if -g produces usable source locations for assembler-with-cpp, + libc_cv_cpp_asm_debuginfo, [dnl +cat > conftest.S <<EOF +#include "confdefs.h" + +/* comment on + two lines */ + ${libc_cv_dot_text} + ${libc_cv_asm_global_directive} foo +foo: + /* Unfortunately this test only works for a real instruction, + not for any of the machine-independent pseudo-ops. + So we just have to assume everybody has a "nop". */ + nop + /* comment */ + nop + /* comment */ + nop +EOF +if AC_TRY_COMMAND([${CC-cc} $CPPFLAGS $ASFLAGS -g -c conftest.S 1>&AS_MESSAGE_LOG_FD]) && { + ac_pattern='conftest\.S' + AC_TRY_COMMAND([readelf --debug-dump=line conftest.o | + grep $ac_pattern 1>&AS_MESSAGE_LOG_FD]) + }; then + libc_cv_cpp_asm_debuginfo=yes +else + libc_cv_cpp_asm_debuginfo=no +fi +rm -f conftest*])AC_SUBST(libc_cv_cpp_asm_debuginfo) +if test $libc_cv_cpp_asm_debuginfo = yes; then + AC_DEFINE(HAVE_CPP_ASM_DEBUGINFO) +fi + +dnl Check if -msse4 works. +AC_CACHE_CHECK(for SSE4 support, libc_cv_cc_sse4, [dnl +LIBC_TRY_CC_OPTION([-msse4], [libc_cv_cc_sse4=yes], [libc_cv_cc_sse4=no]) +]) +if test $libc_cv_cc_sse4 = yes; then + AC_DEFINE(HAVE_SSE4_SUPPORT) +fi + +dnl Check if -mavx works. +AC_CACHE_CHECK(for AVX support, libc_cv_cc_avx, [dnl +LIBC_TRY_CC_OPTION([-mavx], [libc_cv_cc_avx=yes], [libc_cv_cc_avx=no]) +]) +if test $libc_cv_cc_avx = yes; then + AC_DEFINE(HAVE_AVX_SUPPORT) +fi + +dnl Check if -msse2avx works. +AC_CACHE_CHECK(for AVX encoding of SSE instructions, libc_cv_cc_sse2avx, [dnl +LIBC_TRY_CC_OPTION([-msse2avx], + [libc_cv_cc_sse2avx=yes], + [libc_cv_cc_sse2avx=no]) +]) +if test $libc_cv_cc_sse2avx = yes; then + AC_DEFINE(HAVE_SSE2AVX_SUPPORT) +fi + +dnl Check if -mfma4 works. +AC_CACHE_CHECK(for FMA4 support, libc_cv_cc_fma4, [dnl +LIBC_TRY_CC_OPTION([-mfma4], [libc_cv_cc_fma4=yes], [libc_cv_cc_fma4=no]) +]) +if test $libc_cv_cc_fma4 = yes; then + AC_DEFINE(HAVE_FMA4_SUPPORT) +fi + +dnl Check if -mno-vzeroupper works. +AC_CACHE_CHECK(for -mno-vzeroupper support, libc_cv_cc_novzeroupper, [dnl +LIBC_TRY_CC_OPTION([-mno-vzeroupper], + [libc_cv_cc_novzeroupper=yes], + [libc_cv_cc_novzeroupper=no]) +]) + +# Check for support of thread-local storage handling in assembler and linker. +AC_CACHE_CHECK(for x86-64 TLS support, libc_cv_x86_64_tls, [dnl +cat > conftest.s <<\EOF + .section ".tdata", "awT", @progbits + .globl foo +foo: .quad 1 + .section ".tbss", "awT", @nobits + .globl bar +bar: .skip 8 + .text +baz: leaq bar@TLSLD(%rip), %rdi + leaq bar@DTPOFF(%rax), %rcx + addq foo@GOTTPOFF(%rip), %rax + movq $bar@TPOFF, %rdx +EOF +dnl +if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then + libc_cv_x86_64_tls=yes +else + libc_cv_x86_64_tls=no +fi +rm -f conftest*]) +if test $libc_cv_x86_64_tls = no; then + AC_MSG_ERROR([the assembler must support TLS]) +fi + +dnl It is always possible to access static and hidden symbols in an +dnl position independent way. +AC_DEFINE(PI_STATIC_AND_HIDDEN) +# work around problem with autoconf and empty lines at the end of files diff --git a/libc/sysdeps/x86_64/dl-irel.h b/libc/sysdeps/x86_64/dl-irel.h index bc7e54e98..830f5db8c 100644 --- a/libc/sysdeps/x86_64/dl-irel.h +++ b/libc/sysdeps/x86_64/dl-irel.h @@ -25,23 +25,23 @@ #define ELF_MACHINE_IRELA 1 -static inline Elf64_Addr +static inline ElfW(Addr) __attribute ((always_inline)) -elf_ifunc_invoke (Elf64_Addr addr) +elf_ifunc_invoke (ElfW(Addr) addr) { - return ((Elf64_Addr (*) (void)) (addr)) (); + return ((ElfW(Addr) (*) (void)) (addr)) (); } static inline void __attribute ((always_inline)) -elf_irela (const Elf64_Rela *reloc) +elf_irela (const ElfW(Rela) *reloc) { - Elf64_Addr *const reloc_addr = (void *) reloc->r_offset; - const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info); + ElfW(Addr) *const reloc_addr = (void *) reloc->r_offset; + const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info); if (__builtin_expect (r_type == R_X86_64_IRELATIVE, 1)) { - Elf64_Addr value = elf_ifunc_invoke(reloc->r_addend); + ElfW(Addr) value = elf_ifunc_invoke(reloc->r_addend); *reloc_addr = value; } else diff --git a/libc/sysdeps/x86_64/dl-tls.h b/libc/sysdeps/x86_64/dl-tls.h index 4de581560..56162ee64 100644 --- a/libc/sysdeps/x86_64/dl-tls.h +++ b/libc/sysdeps/x86_64/dl-tls.h @@ -20,8 +20,8 @@ /* Type used for the representation of TLS information in the GOT. */ typedef struct dl_tls_index { - unsigned long int ti_module; - unsigned long int ti_offset; + uint64_t ti_module; + uint64_t ti_offset; } tls_index; diff --git a/libc/sysdeps/x86_64/dl-tlsdesc.h b/libc/sysdeps/x86_64/dl-tlsdesc.h index 82a010922..06ede0214 100644 --- a/libc/sysdeps/x86_64/dl-tlsdesc.h +++ b/libc/sysdeps/x86_64/dl-tlsdesc.h @@ -29,14 +29,24 @@ /* Type used to represent a TLS descriptor in the GOT. */ struct tlsdesc { - ptrdiff_t (*entry)(struct tlsdesc *on_rax); - void *arg; + /* Anonymous union is used here to ensure that GOT entry slot is always + 8 bytes for both x32 and x86-64. */ + union + { + ptrdiff_t (*entry) (struct tlsdesc *on_rax); + uint64_t entry_slot; + }; + union + { + void *arg; + uint64_t arg_slot; + }; }; typedef struct dl_tls_index { - unsigned long int ti_module; - unsigned long int ti_offset; + uint64_t ti_module; + uint64_t ti_offset; } tls_index; /* Type used as the argument in a TLS descriptor for a symbol that diff --git a/libc/sysdeps/x86_64/elf/configure b/libc/sysdeps/x86_64/elf/configure deleted file mode 100755 index 7f2b313bc..000000000 --- a/libc/sysdeps/x86_64/elf/configure +++ /dev/null @@ -1,125 +0,0 @@ - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -# This file is generated from configure.in by Autoconf. DO NOT EDIT! - # Local configure fragment for sysdeps/x86_64/elf. - -# Check for support of thread-local storage handling in assembler and linker. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86-64 TLS support" >&5 -$as_echo_n "checking for x86-64 TLS support... " >&6; } -if ${libc_cv_x86_64_tls+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.s <<\EOF - .section ".tdata", "awT", @progbits - .globl foo -foo: .quad 1 - .section ".tbss", "awT", @nobits - .globl bar -bar: .skip 8 - .text -baz: leaq bar@TLSLD(%rip), %rdi - leaq bar@DTPOFF(%rax), %rcx - addq foo@GOTTPOFF(%rip), %rax - movq $bar@TPOFF, %rdx -EOF -if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - libc_cv_x86_64_tls=yes -else - libc_cv_x86_64_tls=no -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_x86_64_tls" >&5 -$as_echo "$libc_cv_x86_64_tls" >&6; } -if test $libc_cv_x86_64_tls = no; then - as_fn_error $? "the assembler must support TLS" "$LINENO" 5 -fi - -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h - -# work around problem with autoconf and empty lines at the end of files diff --git a/libc/sysdeps/x86_64/elf/configure.in b/libc/sysdeps/x86_64/elf/configure.in deleted file mode 100644 index c53328b4c..000000000 --- a/libc/sysdeps/x86_64/elf/configure.in +++ /dev/null @@ -1,33 +0,0 @@ -GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/x86_64/elf. - -# Check for support of thread-local storage handling in assembler and linker. -AC_CACHE_CHECK(for x86-64 TLS support, libc_cv_x86_64_tls, [dnl -cat > conftest.s <<\EOF - .section ".tdata", "awT", @progbits - .globl foo -foo: .quad 1 - .section ".tbss", "awT", @nobits - .globl bar -bar: .skip 8 - .text -baz: leaq bar@TLSLD(%rip), %rdi - leaq bar@DTPOFF(%rax), %rcx - addq foo@GOTTPOFF(%rip), %rax - movq $bar@TPOFF, %rdx -EOF -dnl -if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then - libc_cv_x86_64_tls=yes -else - libc_cv_x86_64_tls=no -fi -rm -f conftest*]) -if test $libc_cv_x86_64_tls = no; then - AC_MSG_ERROR([the assembler must support TLS]) -fi - -dnl It is always possible to access static and hidden symbols in an -dnl position independent way. -AC_DEFINE(PI_STATIC_AND_HIDDEN) -# work around problem with autoconf and empty lines at the end of files diff --git a/libc/sysdeps/x86_64/fpu/e_powl.S b/libc/sysdeps/x86_64/fpu/e_powl.S index 562791d30..0626ce417 100644 --- a/libc/sysdeps/x86_64/fpu/e_powl.S +++ b/libc/sysdeps/x86_64/fpu/e_powl.S @@ -107,7 +107,7 @@ ENTRY(__ieee754_powl) fistpll -8(%rsp) // y : x fildll -8(%rsp) // int(y) : y : x fucomip %st(1),%st // y : x - jne 2f + jne 3f /* OK, we have an integer value for y. */ mov -8(%rsp),%eax @@ -145,7 +145,14 @@ ENTRY(__ieee754_powl) ret .align ALIGNARG(4) -2: /* y is a real number. */ +2: // y is a large integer (absolute value at least 1L<<63), but + // may be odd unless at least 1L<<64. So it may be necessary + // to adjust the sign of a negative result afterwards. + fxch // x : y + fabs // |x| : y + fxch // y : |x| + .align ALIGNARG(4) +3: /* y is a real number. */ fxch // x : y fldl MO(one) // 1.0 : x : y fldl MO(limit) // 0.29 : 1.0 : x : y @@ -176,13 +183,45 @@ ENTRY(__ieee754_powl) faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) - ret + jmp 29f 28: fstp %st(1) // y*log2(x) fldl MO(one) // 1 : y*log2(x) fscale // 2^(y*log2(x)) : y*log2(x) fstp %st(1) // 2^(y*log2(x)) - ret +29: testb $2, %dh + jz 292f + // x is negative. If y is an odd integer, negate the result. + fldt 24(%rsp) // y : abs(result) + fldl MO(p64) // 1L<<64 : y : abs(result) + fld %st(1) // y : 1L<<64 : y : abs(result) + fabs // |y| : 1L<<64 : y : abs(result) + fcomip %st(1), %st // 1L<<64 : y : abs(result) + fstp %st(0) // y : abs(result) + jnc 291f + fldl MO(p63) // p63 : y : abs(result) + fxch // y : p63 : abs(result) + fprem // y%p63 : p63 : abs(result) + fstp %st(1) // y%p63 : abs(result) + + // We must find out whether y is an odd integer. + fld %st // y : y : abs(result) + fistpll -8(%rsp) // y : abs(result) + fildll -8(%rsp) // int(y) : y : abs(result) + fucomip %st(1),%st // y : abs(result) + ffreep %st // abs(result) + jne 292f + + // OK, the value is an integer, but is it odd? + mov -8(%rsp), %eax + mov -4(%rsp), %edx + andb $1, %al + jz 290f // jump if not odd + // It's an odd integer. + fchs +290: ret +291: fstp %st(0) // abs(result) +292: ret // pow(x,±0) = 1 .align ALIGNARG(4) diff --git a/libc/sysdeps/x86_64/fpu/libm-test-ulps b/libc/sysdeps/x86_64/fpu/libm-test-ulps index e5eb8f937..d43955aff 100644 --- a/libc/sysdeps/x86_64/fpu/libm-test-ulps +++ b/libc/sysdeps/x86_64/fpu/libm-test-ulps @@ -488,12 +488,24 @@ ldouble: 1 Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": float: 1 ifloat: 1 +Test "Real part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i": +double: 1 +idouble: 1 Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": float: 1 ifloat: 1 Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": ildouble: 1 ldouble: 1 +Test "Imaginary part of: cexp (11356.5625 + 0.75 i) == 9.052188470850960144814815984311663764287e4931 + 8.432986734191301036267148978260970230200e4931 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (1440 + 0x1p-1074 i) == inf + 1.196295853897226111293303155636183216483e302 i plus overflow exception": +double: 1 +idouble: 1 Test "Real part of: cexp (50 + 0x1p127 i) == 4.053997150228616856622417636046265337193e21 + 3.232070315463388524466674772633810238819e21 i": double: 2 float: 1 @@ -507,6 +519,24 @@ ldouble: 1 Test "Real part of: cexp (500 + 0x1p1023 i) == -1.159886268932754433233243794561351783426e217 + 7.904017694554466595359379965081774849708e216 i": double: 1 idouble: 1 +Test "Real part of: cexp (709.8125 + 0.75 i) == 1.355121963080879535248452862759108365762e308 + 1.262426823598609432507811340856186873507e308 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (709.8125 + 0.75 i) == 1.355121963080879535248452862759108365762e308 + 1.262426823598609432507811340856186873507e308 i": +double: 1 +idouble: 1 +Test "Real part of: cexp (88.75 + 0.75 i) == 2.558360358486542817001900410314204322891e38 + 2.383359453227311447654736314679677655100e38 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (88.75 + 0.75 i) == 2.558360358486542817001900410314204322891e38 + 2.383359453227311447654736314679677655100e38 i": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 # clog Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i": @@ -2115,9 +2145,9 @@ ldouble: 1 Function: Imaginary part of "cexp": double: 1 -float: 1 +float: 2 idouble: 1 -ifloat: 1 +ifloat: 2 ildouble: 1 ldouble: 1 diff --git a/libc/sysdeps/x86_64/fpu/multiarch/Makefile b/libc/sysdeps/x86_64/fpu/multiarch/Makefile index 2a38ffc76..12b0526e5 100644 --- a/libc/sysdeps/x86_64/fpu/multiarch/Makefile +++ b/libc/sysdeps/x86_64/fpu/multiarch/Makefile @@ -7,10 +7,9 @@ libm-sysdep_routines += e_exp-fma4 e_log-fma4 e_pow-fma4 s_atan-fma4 \ e_asin-fma4 e_atan2-fma4 s_sin-fma4 s_tan-fma4 \ mplog-fma4 mpa-fma4 slowexp-fma4 slowpow-fma4 \ sincos32-fma4 doasin-fma4 dosincos-fma4 \ - brandred-fma4 halfulp-fma4 mpexp-fma4 \ + halfulp-fma4 mpexp-fma4 \ mpatan2-fma4 mpatan-fma4 mpsqrt-fma4 mptan-fma4 -CFLAGS-brandred-fma4.c = -mfma4 CFLAGS-doasin-fma4.c = -mfma4 CFLAGS-dosincos-fma4.c = -mfma4 CFLAGS-e_asin-fma4.c = -mfma4 diff --git a/libc/sysdeps/x86_64/fpu/multiarch/brandred-fma4.c b/libc/sysdeps/x86_64/fpu/multiarch/brandred-fma4.c deleted file mode 100644 index f4f68ac96..000000000 --- a/libc/sysdeps/x86_64/fpu/multiarch/brandred-fma4.c +++ /dev/null @@ -1,4 +0,0 @@ -#define __branred __branred_fma4 -#define SECTION __attribute__ ((section (".text.fma4"))) - -#include <sysdeps/ieee754/dbl-64/branred.c> diff --git a/libc/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c b/libc/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c index 2501af981..4c35739dc 100644 --- a/libc/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c +++ b/libc/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c @@ -1,6 +1,5 @@ #define __cos __cos_fma4 #define __sin __sin_fma4 -#define __branred __branred_fma4 #define __docos __docos_fma4 #define __dubsin __dubsin_fma4 #define __mpcos __mpcos_fma4 diff --git a/libc/sysdeps/x86_64/fpu/multiarch/s_tan-fma4.c b/libc/sysdeps/x86_64/fpu/multiarch/s_tan-fma4.c index d7dab3ca9..a805440b4 100644 --- a/libc/sysdeps/x86_64/fpu/multiarch/s_tan-fma4.c +++ b/libc/sysdeps/x86_64/fpu/multiarch/s_tan-fma4.c @@ -1,5 +1,4 @@ #define tan __tan_fma4 -#define __branred __branred_fma4 #define __dbl_mp __dbl_mp_fma4 #define __mpranred __mpranred_fma4 #define __mptan __mptan_fma4 diff --git a/libc/sysdeps/i386/elf/configure b/libc/sysdeps/x86_64/preconfigure index 83e89bd0a..48ba6a151 100755..100644 --- a/libc/sysdeps/i386/elf/configure +++ b/libc/sysdeps/x86_64/preconfigure @@ -80,49 +80,83 @@ $as_echo X/"$0" | exit } -# This file is generated from configure.in by Autoconf. DO NOT EDIT! - # Local configure fragment for sysdeps/i386/elf. -# Check for support of thread-local storage handling in assembler and -# linker. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for i386 TLS support" >&5 -$as_echo_n "checking for i386 TLS support... " >&6; } -if ${libc_cv_386_tls+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.s <<\EOF - .section ".tdata", "awT", @progbits - .globl foo -foo: .long 1 - .section ".tbss", "awT", @nobits - .globl bar -bar: .skip 4 - .text -baz: leal bar@TLSLDM(%ebx), %eax - leal bar@DTPOFF(%eax), %edx - subl foo@GOTTPOFF(%edx), %eax - subl $bar@TPOFF, %eax - movl foo@GOTNTPOFF(%edx), %ecx - movl %gs:(%ecx), %eax - movl %gs:bar@NTPOFF, %eax -EOF -if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - libc_cv_386_tls=yes + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 else - libc_cv_386_tls=no -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_386_tls" >&5 -$as_echo "$libc_cv_386_tls" >&6; } -if test $libc_cv_386_tls = no; then - as_fn_error $? "the assembler must support TLS" "$LINENO" 5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile +# This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local preconfigure fragment for sysdeps/x86_64 -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h +test -n "$base_machine" || case "$machine" in +x86_64) + base_machine=x86_64 + # Check if we are building for x32. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC compiles in -mx32 mode by default" >&5 +$as_echo_n "checking whether $CC compiles in -mx32 mode by default... " >&6; } +if ${libc_cv_x32+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __LP64__ +# error not x32 +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libc_cv_x32=yes +else + libc_cv_x32=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_x32" >&5 +$as_echo "$libc_cv_x32" >&6; } + if test $libc_cv_x32 = yes; then + machine=x86_64/x32 + else + machine=x86_64/64 + fi + ;; +esac diff --git a/libc/sysdeps/x86_64/preconfigure.in b/libc/sysdeps/x86_64/preconfigure.in new file mode 100644 index 000000000..1f049c7a0 --- /dev/null +++ b/libc/sysdeps/x86_64/preconfigure.in @@ -0,0 +1,20 @@ +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +# Local preconfigure fragment for sysdeps/x86_64 + +test -n "$base_machine" || case "$machine" in +x86_64) + base_machine=x86_64 + # Check if we are building for x32. + AC_CACHE_CHECK(whether $CC compiles in -mx32 mode by default, + libc_cv_x32, [dnl + AC_TRY_COMPILE(dnl +[#ifdef __LP64__ +# error not x32 +#endif], [], libc_cv_x32=yes, libc_cv_x32=no)]) + if test $libc_cv_x32 = yes; then + machine=x86_64/x32 + else + machine=x86_64/64 + fi + ;; +esac diff --git a/libc/sysdeps/x86_64/elf/start.S b/libc/sysdeps/x86_64/start.S index 5e01d2117..5e01d2117 100644 --- a/libc/sysdeps/x86_64/elf/start.S +++ b/libc/sysdeps/x86_64/start.S diff --git a/ports/ChangeLog.alpha b/ports/ChangeLog.alpha index 500e2273c..c25d3f1f6 100644 --- a/ports/ChangeLog.alpha +++ b/ports/ChangeLog.alpha @@ -1,3 +1,15 @@ +2012-03-27 Richard Henderson <rth@twiddle.net> + + * sysdeps/alpha/elf/configure.in: Move to ... + * sysdeps/alpha/configure.in: ... here. Update comment. + * sysdeps/alpha/configure: Regenerate. + * sysdeps/alpha/elf/crti.S: Move to ... + * sysdeps/alpha/crti.S: ... here. + * sysdeps/alpha/elf/crtn.S: Move to ... + * sysdeps/alpha/crtn.S: ... here. + * sysdeps/alpha/elf/start.S: Move to ... + * sysdeps/alpha/start.S: ... here. + 2012-03-21 Richard Henderson <rth@twiddle.net> * sysdeps/alpha/hp-timing.h: Include <_itoa.h> instead diff --git a/ports/ChangeLog.arm b/ports/ChangeLog.arm index f1376cdab..491cc920e 100644 --- a/ports/ChangeLog.arm +++ b/ports/ChangeLog.arm @@ -1,3 +1,19 @@ +2012-03-28 Joseph Myers <joseph@codesourcery.com> + + * sysdeps/unix/sysv/linux/arm/bits/mman.h (MAP_STACK): Define. + (MAP_HUGETLB): Likewise. + +2012-03-27 Joseph Myers <joseph@codesourcery.com> + + * sysdeps/arm/elf/start.S: Moved to ... + * sysdeps/arm/start.S: ...here. + * sysdeps/arm/elf/configure.in: Merge into ... + * sysdeps/arm/configure.in: ...here. + * sysdeps/arm/configure: Regenerated. + * sysdeps/arm/elf/configure.in: Remove file. + * sysdeps/arm/elf/configure: Likewise. + * sysdeps/unix/arm/start.c: Likewise. + 2012-03-20 Joseph Myers <joseph@codesourcery.com> * sysdeps/unix/sysv/linux/arm/register-dump.h: Include <_itoa.h> diff --git a/ports/ChangeLog.hppa b/ports/ChangeLog.hppa index 527147544..700c78fe0 100644 --- a/ports/ChangeLog.hppa +++ b/ports/ChangeLog.hppa @@ -1,3 +1,10 @@ +2012-03-22 Carlos O'Donell <carlos@systemhalted.org> + + [BZ #6730] + + * sysdeps/unix/sysv/linux/hppa/bits/atomic.h: Don't negate %r21 and + check for -EFAULT and -ENOSYS instead. + 2012-03-09 Richard Henderson <rth@twiddle.net> * sysdeps/hppa/hppa1.1/s_signbit.c: Use <> to include math_private.h. diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k index 04c4f93a1..8108e001c 100644 --- a/ports/ChangeLog.m68k +++ b/ports/ChangeLog.m68k @@ -1,3 +1,24 @@ +2012-03-27 Andreas Schwab <schwab@linux-m68k.org> + + * sysdeps/m68k/elf/start.S: Move to ... + * sysdeps/m68k/start.S: ... here. + +2012-03-23 Andreas Schwab <schwab@linux-m68k.org> + + * sysdeps/m68k/m680x0/fpu/libm-test-ulps: Update. + + * sysdeps/m68k/m680x0/fpu/s_cexp.c: Avoid undue overflow. + + * sysdeps/m68k/m680x0/fpu/bits/mathinline.h (__inline_mathop1): + Mark asm as volatile. + (__scalbn): Likewise. + (__lrint): Likewise. + (__sincos): Likewise. + +2012-03-22 Andreas Schwab <schwab@linux-m68k.org> + + * sysdeps/m68k/m680x0/fpu/libm-test-ulps: Update. + 2012-03-21 Andreas Schwab <schwab@linux-m68k.org> * sysdeps/unix/sysv/linux/m68k/register-dump.h: Include <_itoa.h> diff --git a/ports/ChangeLog.mips b/ports/ChangeLog.mips index 44667cdea..01f51c0c4 100644 --- a/ports/ChangeLog.mips +++ b/ports/ChangeLog.mips @@ -1,3 +1,16 @@ +2012-03-28 Joseph Myers <joseph@codesourcery.com> + + * sysdeps/unix/sysv/linux/mips/bits/mman.h (MAP_STACK): Define. + (MAP_HUGETLB): Likewise. + +2012-03-27 Joseph Myers <joseph@codesourcery.com> + + * sysdeps/mips/elf/start.S: Moved to ... + * sysdeps/mips/start.S: ...here. + * sysdeps/mips/elf/configure.in: Moved to ... + * sysdeps/mips/configure.in: ...here. Update comment. + * sysdeps/mips/configure: New generated file. + 2012-03-20 Joseph Myers <joseph@codesourcery.com> * sysdeps/unix/sysv/linux/mips/register-dump.h: Include <_itoa.h> diff --git a/ports/sysdeps/alpha/elf/configure b/ports/sysdeps/alpha/configure index 5da987591..1d0daf5a8 100644 --- a/ports/sysdeps/alpha/elf/configure +++ b/ports/sysdeps/alpha/configure @@ -81,7 +81,7 @@ $as_echo X/"$0" | } # This file is generated from configure.in by Autoconf. DO NOT EDIT! - # Local configure fragment for sysdeps/alpha/elf. + # Local configure fragment for sysdeps/alpha. # Check for support of thread-local storage handling in assembler and linker. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Alpha TLS support" >&5 diff --git a/ports/sysdeps/alpha/elf/configure.in b/ports/sysdeps/alpha/configure.in index 75fff5374..bf8e92665 100644 --- a/ports/sysdeps/alpha/elf/configure.in +++ b/ports/sysdeps/alpha/configure.in @@ -1,5 +1,5 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/alpha/elf. +# Local configure fragment for sysdeps/alpha. # Check for support of thread-local storage handling in assembler and linker. AC_CACHE_CHECK(for Alpha TLS support, libc_cv_alpha_tls, [dnl diff --git a/ports/sysdeps/alpha/elf/crti.S b/ports/sysdeps/alpha/crti.S index bfb69d475..bfb69d475 100644 --- a/ports/sysdeps/alpha/elf/crti.S +++ b/ports/sysdeps/alpha/crti.S diff --git a/ports/sysdeps/alpha/elf/crtn.S b/ports/sysdeps/alpha/crtn.S index 72b3c8aaa..72b3c8aaa 100644 --- a/ports/sysdeps/alpha/elf/crtn.S +++ b/ports/sysdeps/alpha/crtn.S diff --git a/ports/sysdeps/alpha/elf/start.S b/ports/sysdeps/alpha/start.S index 4875536ad..4875536ad 100644 --- a/ports/sysdeps/alpha/elf/start.S +++ b/ports/sysdeps/alpha/start.S diff --git a/ports/sysdeps/arm/configure b/ports/sysdeps/arm/configure index ab2371fce..651d46a34 100644 --- a/ports/sysdeps/arm/configure +++ b/ports/sysdeps/arm/configure @@ -83,6 +83,44 @@ $as_echo X/"$0" | # This file is generated from configure.in by Autoconf. DO NOT EDIT! # Local configure fragment for sysdeps/arm. +# Check for support of thread-local storage handling in assembler and +# linker. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ARM TLS support" >&5 +$as_echo_n "checking for ARM TLS support... " >&6; } +if ${libc_cv_arm_tls+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.s <<\EOF + .section ".tdata", "awT", %progbits + .globl foo +foo: .long 1 + .section ".tbss", "awT", %nobits + .globl bar +bar: .skip 4 + .text +.word foo(tpoff) +.word foo(tlsgd) +EOF +if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + libc_cv_arm_tls=yes +else + libc_cv_arm_tls=no +fi +rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_arm_tls" >&5 +$as_echo "$libc_cv_arm_tls" >&6; } +if test $libc_cv_arm_tls = no; then + as_fn_error $? "the assembler must support TLS" "$LINENO" 5 +fi + +#AC_DEFINE(PI_STATIC_AND_HIDDEN) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the CFI directive .cfi_sections is supported" >&5 $as_echo_n "checking whether the CFI directive .cfi_sections is supported... " >&6; } if ${libc_cv_asm_cfi_directive_sections+:} false; then : diff --git a/ports/sysdeps/arm/configure.in b/ports/sysdeps/arm/configure.in index 9f4ff3b73..706add2d6 100644 --- a/ports/sysdeps/arm/configure.in +++ b/ports/sysdeps/arm/configure.in @@ -1,6 +1,37 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. # Local configure fragment for sysdeps/arm. +# Check for support of thread-local storage handling in assembler and +# linker. +AC_CACHE_CHECK(for ARM TLS support, libc_cv_arm_tls, [dnl +cat > conftest.s <<\EOF + .section ".tdata", "awT", %progbits + .globl foo +foo: .long 1 + .section ".tbss", "awT", %nobits + .globl bar +bar: .skip 4 + .text +.word foo(tpoff) +.word foo(tlsgd) +EOF +dnl +if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then + libc_cv_arm_tls=yes +else + libc_cv_arm_tls=no +fi +rm -f conftest*]) +if test $libc_cv_arm_tls = no; then + AC_MSG_ERROR([the assembler must support TLS]) +fi + +dnl It is always possible to access static and hidden symbols in an +dnl position independent way. +dnl NOTE: This feature was added by the GCC TLS patches. We should test for +dnl it. Until we do, don't define it. +#AC_DEFINE(PI_STATIC_AND_HIDDEN) + AC_CACHE_CHECK([whether the CFI directive .cfi_sections is supported], [libc_cv_asm_cfi_directive_sections], [cat > conftest.s <<EOF diff --git a/ports/sysdeps/arm/elf/configure b/ports/sysdeps/arm/elf/configure deleted file mode 100644 index 49d57a4da..000000000 --- a/ports/sysdeps/arm/elf/configure +++ /dev/null @@ -1,122 +0,0 @@ - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -# This file is generated from configure.in by Autoconf. DO NOT EDIT! - # Local configure fragment for sysdeps/arm/elf. - -# Check for support of thread-local storage handling in assembler and -# linker. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ARM TLS support" >&5 -$as_echo_n "checking for ARM TLS support... " >&6; } -if ${libc_cv_arm_tls+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.s <<\EOF - .section ".tdata", "awT", %progbits - .globl foo -foo: .long 1 - .section ".tbss", "awT", %nobits - .globl bar -bar: .skip 4 - .text -.word foo(tpoff) -.word foo(tlsgd) -EOF -if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - libc_cv_arm_tls=yes -else - libc_cv_arm_tls=no -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_arm_tls" >&5 -$as_echo "$libc_cv_arm_tls" >&6; } -if test $libc_cv_arm_tls = no; then - as_fn_error $? "the assembler must support TLS" "$LINENO" 5 -fi - -#AC_DEFINE(PI_STATIC_AND_HIDDEN) diff --git a/ports/sysdeps/arm/elf/configure.in b/ports/sysdeps/arm/elf/configure.in deleted file mode 100644 index 123a32186..000000000 --- a/ports/sysdeps/arm/elf/configure.in +++ /dev/null @@ -1,33 +0,0 @@ -GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/arm/elf. - -# Check for support of thread-local storage handling in assembler and -# linker. -AC_CACHE_CHECK(for ARM TLS support, libc_cv_arm_tls, [dnl -cat > conftest.s <<\EOF - .section ".tdata", "awT", %progbits - .globl foo -foo: .long 1 - .section ".tbss", "awT", %nobits - .globl bar -bar: .skip 4 - .text -.word foo(tpoff) -.word foo(tlsgd) -EOF -dnl -if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then - libc_cv_arm_tls=yes -else - libc_cv_arm_tls=no -fi -rm -f conftest*]) -if test $libc_cv_arm_tls = no; then - AC_MSG_ERROR([the assembler must support TLS]) -fi - -dnl It is always possible to access static and hidden symbols in an -dnl position independent way. -dnl NOTE: This feature was added by the GCC TLS patches. We should test for -dnl it. Until we do, don't define it. -#AC_DEFINE(PI_STATIC_AND_HIDDEN) diff --git a/ports/sysdeps/arm/elf/start.S b/ports/sysdeps/arm/start.S index a857d8b97..a857d8b97 100644 --- a/ports/sysdeps/arm/elf/start.S +++ b/ports/sysdeps/arm/start.S diff --git a/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h b/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h index 8d4e30a4a..ffcc39edf 100644 --- a/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h +++ b/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h @@ -146,7 +146,8 @@ __NTH (__signbitl (long double __x)) __m81_defun (float_type, func, (float_type __mathop_x)) \ { \ float_type __result; \ - __asm("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\ + __asm __volatile__ ("f" __STRING(op) "%.x %1, %0" \ + : "=f" (__result) : "f" (__mathop_x)); \ return __result; \ } @@ -243,8 +244,8 @@ __m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) \ /* There is no branch-condition for infinity, \ so we must extract and examine the condition codes manually. */ \ unsigned long int __fpsr; \ - __asm("ftst%.x %1\n" \ - "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value)); \ + __asm ("ftst%.x %1\n" \ + "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value)); \ return (__fpsr & (2 << 24)) ? (__fpsr & (8 << 24) ? -1 : 1) : 0; \ } \ \ @@ -262,7 +263,8 @@ __m81_defun (float_type, __CONCAT(__scalbn,s), \ (float_type __x, int __n)) \ { \ float_type __result; \ - __asm ("fscale%.l %1, %0" : "=f" (__result) : "dmi" (__n), "0" (__x)); \ + __asm __volatile__ ("fscale%.l %1, %0" : "=f" (__result) \ + : "dmi" (__n), "0" (__x)); \ return __result; \ } @@ -279,8 +281,8 @@ __inline_functions(long double,l) __m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) \ { \ char __result; \ - __asm("ftst%.x %1\n" \ - "fsun %0" : "=dm" (__result) : "f" (__value)); \ + __asm ("ftst%.x %1\n" \ + "fsun %0" : "=dm" (__result) : "f" (__value)); \ return __result; \ } @@ -319,7 +321,7 @@ __m81_defun (float_type, __CONCAT(__nearbyint,s), (float_type __x)) \ __m81_defun (long int, __CONCAT(__lrint,s), (float_type __x)) \ { \ long int __result; \ - __asm ("fmove%.l %1, %0" : "=dm" (__result) : "f" (__x)); \ + __asm __volatile__ ("fmove%.l %1, %0" : "=dm" (__result) : "f" (__x)); \ return __result; \ } @@ -337,8 +339,8 @@ __m81_inline void \ __NTH (__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx, \ float_type *__cosx)) \ { \ - __asm ("fsincos%.x %2,%1:%0" \ - : "=f" (*__sinx), "=f" (*__cosx) : "f" (__x)); \ + __asm __volatile__ ("fsincos%.x %2,%1:%0" \ + : "=f" (*__sinx), "=f" (*__cosx) : "f" (__x)); \ } __inline_functions (double,) diff --git a/ports/sysdeps/m68k/m680x0/fpu/libm-test-ulps b/ports/sysdeps/m68k/m680x0/fpu/libm-test-ulps index 8d6478cfe..b153ba9be 100644 --- a/ports/sysdeps/m68k/m680x0/fpu/libm-test-ulps +++ b/ports/sysdeps/m68k/m680x0/fpu/libm-test-ulps @@ -439,12 +439,18 @@ ildouble: 1 ldouble: 1 # cexp +Test "Real part of: cexp (-10000 + 0x1p16383 i) == 1.045876464564882298442774542991176546722e-4343 + 4.421154026488516836023811173959413420548e-4344 i": +ildouble: 1 +ldouble: 1 Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": float: 1 ifloat: 1 Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": float: 1 ifloat: 1 +Test "Real part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i": +ildouble: 1 +ldouble: 1 Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": float: 2 ifloat: 2 @@ -453,6 +459,21 @@ float: 1 ifloat: 1 ildouble: 1 ldouble: 1 +Test "Imaginary part of: cexp (11356.5625 + 0.75 i) == 9.052188470850960144814815984311663764287e4931 + 8.432986734191301036267148978260970230200e4931 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (50 + 0x1p127 i) == 4.053997150228616856622417636046265337193e21 + 3.232070315463388524466674772633810238819e21 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cexp (709.8125 + 0.75 i) == 1.355121963080879535248452862759108365762e308 + 1.262426823598609432507811340856186873507e308 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cexp (88.75 + 0.75 i) == 2.558360358486542817001900410314204322891e38 + 2.383359453227311447654736314679677655100e38 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (88.75 + 0.75 i) == 2.558360358486542817001900410314204322891e38 + 2.383359453227311447654736314679677655100e38 i": +ildouble: 1 +ldouble: 1 # clog Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": @@ -1128,8 +1149,8 @@ ifloat: 5 ildouble: 2 ldouble: 2 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6": -float: 2 -ifloat: 2 +float: 3 +ifloat: 3 ildouble: 1 ldouble: 1 Test "jn (2, 0x1.ffff62p+99) == -4.43860668048170034334926693188979974489e-16": @@ -1941,6 +1962,8 @@ ldouble: 1 Function: Real part of "cexp": float: 2 ifloat: 2 +ildouble: 1 +ldouble: 1 Function: Imaginary part of "cexp": float: 1 diff --git a/ports/sysdeps/m68k/m680x0/fpu/s_cexp.c b/ports/sysdeps/m68k/m680x0/fpu/s_cexp.c index 62cddbdad..c2a9f1d22 100644 --- a/ports/sysdeps/m68k/m680x0/fpu/s_cexp.c +++ b/ports/sysdeps/m68k/m680x0/fpu/s_cexp.c @@ -17,6 +17,7 @@ License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ +#include <float.h> #include <complex.h> #include <math.h> #include "mathimpl.h" @@ -43,26 +44,46 @@ s(__cexp) (__complex__ float_type x) if ((ix_cond & (__M81_COND_NAN|__M81_COND_INF)) == 0) { /* Imaginary part is finite. */ - float_type exp_val = m81(__ieee754_exp) (__real__ x); + unsigned long rx_cond = __m81_test (__real__ x); - __real__ retval = __imag__ retval = exp_val; - if (m81(__finite) (exp_val)) + if ((rx_cond & (__M81_COND_NAN|__M81_COND_INF)) == 0) { - float_type sin_ix, cos_ix; - __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix) - : "f" (__imag__ x)); - __real__ retval *= cos_ix; + const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l); + long double sin_ix, cos_ix, exp_val; + + __m81_u (__sincosl) (__imag__ x, &sin_ix, &cos_ix); + + if (__real__ x > t) + { + long double exp_t = __m81_u(__ieee754_expl) (t); + __real__ x -= t; + sin_ix *= exp_t; + cos_ix *= exp_t; + if (__real__ x > t) + { + __real__ x -= t; + sin_ix *= exp_t; + cos_ix *= exp_t; + } + } + + exp_val = __m81_u(__ieee754_expl) (__real__ x); + __real__ retval = exp_val * cos_ix; if (ix_cond & __M81_COND_ZERO) __imag__ retval = __imag__ x; else - __imag__ retval *= sin_ix; + __imag__ retval = exp_val * sin_ix; } else { /* Compute the sign of the result. */ - float_type remainder, pi_2; + long double remainder, pi_2; int quadrant; + if ((rx_cond & (__M81_COND_NAN|__M81_COND_NEG)) == __M81_COND_NEG) + __real__ retval = __imag__ retval = 0.0; + else + __real__ retval = __imag__ retval = __real__ x; __asm ("fmovecr %#0,%0\n\tfscale%.w %#-1,%0" : "=f" (pi_2)); __asm ("fmod%.x %2,%0\n\tfmove%.l %/fpsr,%1" : "=f" (remainder), "=dm" (quadrant) @@ -83,7 +104,7 @@ s(__cexp) (__complex__ float_type x) __imag__ retval = -__imag__ retval; break; } - if (ix_cond & __M81_COND_ZERO && !m81(__isnan) (exp_val)) + if (ix_cond & __M81_COND_ZERO && (rx_cond & __M81_COND_NAN) == 0) __imag__ retval = __imag__ x; } } diff --git a/ports/sysdeps/m68k/elf/start.S b/ports/sysdeps/m68k/start.S index 7c3e99aa7..7c3e99aa7 100644 --- a/ports/sysdeps/m68k/elf/start.S +++ b/ports/sysdeps/m68k/start.S diff --git a/ports/sysdeps/mips/elf/configure b/ports/sysdeps/mips/configure index 3cf02e0f1..e80f0a01a 100644 --- a/ports/sysdeps/mips/elf/configure +++ b/ports/sysdeps/mips/configure @@ -81,7 +81,7 @@ $as_echo X/"$0" | } # This file is generated from configure.in by Autoconf. DO NOT EDIT! - # Local configure fragment for sysdeps/mips/elf. + # Local configure fragment for sysdeps/mips. # Check for support of thread-local storage handling in assembler and # linker. diff --git a/ports/sysdeps/mips/elf/configure.in b/ports/sysdeps/mips/configure.in index 5cb5a742e..ed92d2938 100644 --- a/ports/sysdeps/mips/elf/configure.in +++ b/ports/sysdeps/mips/configure.in @@ -1,5 +1,5 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/mips/elf. +# Local configure fragment for sysdeps/mips. # Check for support of thread-local storage handling in assembler and # linker. diff --git a/ports/sysdeps/mips/elf/start.S b/ports/sysdeps/mips/start.S index fa0cfe14e..fa0cfe14e 100644 --- a/ports/sysdeps/mips/elf/start.S +++ b/ports/sysdeps/mips/start.S diff --git a/ports/sysdeps/unix/arm/start.c b/ports/sysdeps/unix/arm/start.c deleted file mode 100644 index e9a032b9d..000000000 --- a/ports/sysdeps/unix/arm/start.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Special startup code for ARM a.out binaries. - Copyright (C) 1998, 2004, 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. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - - 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 <errno.h> -#include <stdlib.h> -#include <unistd.h> -#include <sysdep.h> - -/* The first piece of initialized data. */ -int __data_start = 0; -weak_alias (__data_start, data_start) - -extern void __libc_init (int argc, char **argv, char **envp); -extern int main (int argc, char **argv, char **envp); - -/* N.B.: It is important that this be the first function. - This file is the first thing in the text section. */ - -/* If this was in C it might create its own stack frame and - screw up the arguments. */ -asm (".text; .globl _start; _start: B start1"); - -/* Fool gcc into thinking that more args are passed. This makes it look - on the stack (correctly) for the real arguments. It causes somewhat - strange register usage in start1(), but we aren't too bothered about - that at the moment. */ -#define DUMMIES a1, a2, a3, a4 - -#ifdef DUMMIES -#define ARG_DUMMIES DUMMIES, -#define DECL_DUMMIES int DUMMIES; -#else -#define ARG_DUMMIES -#define DECL_DUMMIES -#endif - -/* ARGSUSED */ -static void -start1 (ARG_DUMMIES argc, argv, envp) - DECL_DUMMIES - int argc; - char **argv; - char **envp; -{ - /* Store a pointer to the environment. */ - __environ = envp; - - /* Do C library initializations. */ - __libc_init (argc, argv, __environ); - - /* Call the user program. */ - exit (main (argc, argv, __environ)); -} diff --git a/ports/sysdeps/unix/sysv/linux/arm/bits/mman.h b/ports/sysdeps/unix/sysv/linux/arm/bits/mman.h index 0b24db103..46c7249f7 100644 --- a/ports/sysdeps/unix/sysv/linux/arm/bits/mman.h +++ b/ports/sysdeps/unix/sysv/linux/arm/bits/mman.h @@ -1,6 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/ARM version. - Copyright (C) 1997, 2000, 2003, 2005, 2006, 2009, 2011 - 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 @@ -63,6 +62,8 @@ # define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ # define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ #endif /* Flags to `msync'. */ diff --git a/ports/sysdeps/unix/sysv/linux/hppa/bits/atomic.h b/ports/sysdeps/unix/sysv/linux/hppa/bits/atomic.h index 89823d279..457c2e967 100644 --- a/ports/sysdeps/unix/sysv/linux/hppa/bits/atomic.h +++ b/ports/sysdeps/unix/sysv/linux/hppa/bits/atomic.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. +/* Copyright (C) 2003-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Carlos O'Donell <carlos@baldric.uwo.ca>, 2005. @@ -79,14 +79,13 @@ typedef uintmax_t uatomic_max_t; "cmpb,=,n %%r25, %%r21, 0b \n\t" \ "nop \n\t" \ "stw %%r28, %0 \n\t" \ - "sub %%r0, %%r21, %%r21 \n\t" \ "stw %%r21, %1 \n\t" \ : "=m" (lws_ret), "=m" (lws_errno) \ : "r" (mem), "r" (oldval), "r" (newval) \ : _LWS_CLOBBER \ ); \ \ - if(lws_errno == EFAULT || lws_errno == ENOSYS) \ + if(lws_errno == -EFAULT || lws_errno == -ENOSYS) \ ABORT_INSTRUCTION; \ \ lws_ret; \ diff --git a/ports/sysdeps/unix/sysv/linux/mips/bits/mman.h b/ports/sysdeps/unix/sysv/linux/mips/bits/mman.h index d23a766b3..e9c919b8c 100644 --- a/ports/sysdeps/unix/sysv/linux/mips/bits/mman.h +++ b/ports/sysdeps/unix/sysv/linux/mips/bits/mman.h @@ -1,6 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/MIPS version. - Copyright (C) 1997, 2000, 2003, 2004, 2005, 2006, 2009, 2011 - 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 @@ -65,6 +64,8 @@ # define MAP_LOCKED 0x8000 /* pages are locked */ # define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ # define MAP_NONBLOCK 0x20000 /* do not block on IO */ +# define MAP_STACK 0x40000 /* Allocation is for a stack. */ +# define MAP_HUGETLB 0x80000 /* Create huge page mapping. */ #endif /* Flags to `msync'. */ |