summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-01-30 09:30:09 +0000
committerJakub Jelinek <jakub@redhat.com>2006-01-30 09:30:09 +0000
commit3e543bc56346540cbf73fd48d0172fc6a588efd5 (patch)
treeb2c3502b6596d238ac861cc82cafdc6f8b84e143
parent06f313e361a523605ba6d4c9cdc67a7353cd367c (diff)
Updated to fedora-glibc-20060130T0922
-rw-r--r--ChangeLog1384
-rw-r--r--Makefile1
-rw-r--r--Makerules42
-rw-r--r--debug/fprintf_chk.c5
-rw-r--r--debug/printf_chk.c5
-rw-r--r--debug/snprintf_chk.c9
-rw-r--r--debug/sprintf_chk.c7
-rw-r--r--debug/vfprintf_chk.c7
-rw-r--r--debug/vfwprintf_chk.c3
-rw-r--r--debug/vprintf_chk.c5
-rw-r--r--debug/vsnprintf_chk.c10
-rw-r--r--debug/vsprintf_chk.c10
-rw-r--r--dirent/Makefile5
-rw-r--r--dirent/tst-fdopendir2.c41
-rw-r--r--elf/Makefile30
-rw-r--r--elf/check-localplt.c299
-rw-r--r--elf/check-textrel.c20
-rw-r--r--elf/dl-deps.c2
-rw-r--r--fedora/branch.mk4
-rw-r--r--hurd/sigunwind.c4
-rw-r--r--iconv/gconv_cache.c2
-rw-r--r--iconvdata/extra-module.mk6
-rw-r--r--include/fcntl.h4
-rw-r--r--include/sched.h1
-rw-r--r--include/stdlib.h26
-rw-r--r--include/sys/stat.h2
-rw-r--r--include/time.h2
-rw-r--r--include/wchar.h9
-rw-r--r--io/Makefile7
-rw-r--r--io/Versions2
-rw-r--r--io/ppoll.c76
-rw-r--r--io/sys/poll.h21
-rw-r--r--io/tst-faccessat.c61
-rw-r--r--io/tst-fchmodat.c45
-rw-r--r--io/tst-fchownat.c45
-rw-r--r--io/tst-fstatat.c45
-rw-r--r--io/tst-linkat.c171
-rw-r--r--io/tst-mkdirat.c162
-rw-r--r--io/tst-mkfifoat.c162
-rw-r--r--io/tst-mknodat.c162
-rw-r--r--io/tst-openat.c40
-rw-r--r--io/tst-readlinkat.c136
-rw-r--r--io/tst-renameat.c76
-rw-r--r--io/tst-symlinkat.c164
-rw-r--r--libio/Makefile10
-rw-r--r--libio/Versions3
-rw-r--r--libio/bits/libio-ldbl.h27
-rw-r--r--libio/bits/stdio-ldbl.h74
-rw-r--r--libio/fileops.c5
-rw-r--r--libio/fputwc.c4
-rw-r--r--libio/fputwc_u.c4
-rw-r--r--libio/fwprintf.c6
-rw-r--r--libio/fwscanf.c6
-rw-r--r--libio/genops.c66
-rw-r--r--libio/getwc_u.c4
-rw-r--r--libio/ioungetwc.c4
-rw-r--r--libio/iovdprintf.c10
-rw-r--r--libio/iovsprintf.c14
-rw-r--r--libio/iovsscanf.c9
-rw-r--r--libio/iovswscanf.c11
-rw-r--r--libio/libio.h22
-rw-r--r--libio/libioP.h7
-rw-r--r--libio/memstream.c13
-rw-r--r--libio/obprintf.c10
-rw-r--r--libio/stdio.h8
-rw-r--r--libio/swprintf.c6
-rw-r--r--libio/swscanf.c7
-rw-r--r--libio/tst-fopenloc2.c116
-rw-r--r--libio/tst-memstream1.c89
-rw-r--r--libio/tst-memstream2.c104
-rw-r--r--libio/tst-wmemstream1.c5
-rw-r--r--libio/tst-wmemstream2.c5
-rw-r--r--libio/vasprintf.c7
-rw-r--r--libio/vscanf.c7
-rw-r--r--libio/vsnprintf.c9
-rw-r--r--libio/vswprintf.c8
-rw-r--r--libio/vwprintf.c9
-rw-r--r--libio/vwscanf.c7
-rw-r--r--libio/wfileops.c4
-rw-r--r--libio/wmemstream.c149
-rw-r--r--libio/wprintf.c7
-rw-r--r--libio/wscanf.c7
-rw-r--r--malloc/obstack.c62
-rw-r--r--malloc/obstack.h109
-rw-r--r--math/Makefile12
-rw-r--r--math/bits/mathcalls.h4
-rw-r--r--math/complex.h11
-rw-r--r--math/e_exp2l.c12
-rw-r--r--math/libm-test.inc318
-rw-r--r--math/math.h28
-rw-r--r--math/s_cacosh.c5
-rw-r--r--math/s_cacoshf.c5
-rw-r--r--math/s_cacoshl.c5
-rw-r--r--math/w_j0l.c11
-rw-r--r--math/w_j1l.c10
-rw-r--r--math/w_jnl.c10
-rw-r--r--misc/Makefile9
-rw-r--r--misc/bits/syslog-ldbl.h36
-rw-r--r--misc/efgcvt.c49
-rw-r--r--misc/efgcvt_r.c40
-rw-r--r--misc/pselect.c36
-rw-r--r--misc/qefgcvt_r.c2
-rw-r--r--misc/sys/cdefs.h28
-rw-r--r--misc/sys/syslog.h3
-rw-r--r--misc/syslog.c15
-rw-r--r--misc/tst-pselect.c121
-rw-r--r--nptl/ChangeLog54
-rw-r--r--nptl/Makefile13
-rw-r--r--nptl/sysdeps/alpha/tls.h2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/mips/bits/pthreadtypes.h17
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h28
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/bits/pthreadtypes.h10
-rw-r--r--nptl/tst-cancel4.c50
-rw-r--r--nptl/tst-initializers1-c89.c1
-rw-r--r--nptl/tst-initializers1-c99.c1
-rw-r--r--nptl/tst-initializers1-gnu89.c1
-rw-r--r--nptl/tst-initializers1-gnu99.c1
-rw-r--r--posix/glob.c427
-rw-r--r--posix/regex_internal.c6
-rw-r--r--scripts/data/localplt-i386-linux-gnu.data7
-rw-r--r--scripts/data/localplt-x86_64-linux-gnu.data6
-rw-r--r--stdio-common/Makefile4
-rw-r--r--stdio-common/asprintf.c12
-rw-r--r--stdio-common/bits/printf-ldbl.h24
-rw-r--r--stdio-common/dprintf.c9
-rw-r--r--stdio-common/fprintf.c10
-rw-r--r--stdio-common/fscanf.c6
-rw-r--r--stdio-common/printf.c8
-rw-r--r--stdio-common/printf.h6
-rw-r--r--stdio-common/printf_fp.c12
-rw-r--r--stdio-common/printf_size.c6
-rw-r--r--stdio-common/scanf.c5
-rw-r--r--stdio-common/snprintf.c8
-rw-r--r--stdio-common/sprintf.c12
-rw-r--r--stdio-common/sscanf.c12
-rw-r--r--stdio-common/vfprintf.c52
-rw-r--r--stdio-common/vfscanf.c38
-rw-r--r--stdio-common/vprintf.c9
-rw-r--r--stdlib/Makefile9
-rw-r--r--stdlib/bits/monetary-ldbl.h28
-rw-r--r--stdlib/bits/stdlib-ldbl.h42
-rw-r--r--stdlib/fpioconst.c2
-rw-r--r--stdlib/monetary.h7
-rw-r--r--stdlib/stdlib.h7
-rw-r--r--stdlib/strfmon.c8
-rw-r--r--stdlib/strfmon_l.c43
-rw-r--r--stdlib/strtod.c15
-rw-r--r--stdlib/strtod_l.c29
-rw-r--r--stdlib/strtold.c36
-rw-r--r--string/Makefile4
-rw-r--r--string/bug-strtok1.c45
-rw-r--r--sysdeps/alpha/__longjmp.S11
-rw-r--r--sysdeps/alpha/bits/setjmp.h27
-rw-r--r--sysdeps/alpha/fpu/libm-test-ulps4
-rw-r--r--sysdeps/alpha/jmpbuf-offsets.h36
-rw-r--r--sysdeps/alpha/jmpbuf-unwind.h (renamed from nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h)10
-rw-r--r--sysdeps/alpha/setjmp.S57
-rw-r--r--sysdeps/generic/math_ldbl_opt.h14
-rw-r--r--sysdeps/gnu/errlist-compat.awk2
-rw-r--r--sysdeps/hppa/bits/setjmp.h12
-rw-r--r--sysdeps/hppa/elf/start.S72
-rw-r--r--sysdeps/hppa/fpu/libm-test-ulps4
-rw-r--r--sysdeps/hppa/jmpbuf-offsets.h20
-rw-r--r--sysdeps/hppa/jmpbuf-unwind.h27
-rw-r--r--sysdeps/i386/__longjmp.S6
-rw-r--r--sysdeps/i386/bits/setjmp.h18
-rw-r--r--sysdeps/i386/bsd-_setjmp.S6
-rw-r--r--sysdeps/i386/bsd-setjmp.S6
-rw-r--r--sysdeps/i386/fpu/libm-test-ulps4
-rw-r--r--sysdeps/i386/i686/strtok.S10
-rw-r--r--sysdeps/i386/jmpbuf-offsets.h26
-rw-r--r--sysdeps/i386/jmpbuf-unwind.h (renamed from nptl/sysdeps/i386/jmpbuf-unwind.h)10
-rw-r--r--sysdeps/i386/setjmp.S7
-rw-r--r--sysdeps/i386/strtok.S6
-rw-r--r--sysdeps/ia64/fpu/libm-test-ulps4
-rw-r--r--sysdeps/ia64/jmpbuf-unwind.h (renamed from nptl/sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h)7
-rw-r--r--sysdeps/ieee754/dbl-64/e_exp2.c8
-rw-r--r--sysdeps/ieee754/flt-32/e_exp2f.c13
-rw-r--r--sysdeps/ieee754/flt-32/e_expf.c13
-rw-r--r--sysdeps/ieee754/flt-32/s_expm1f.c11
-rw-r--r--sysdeps/ieee754/ldbl-128/e_powl.c2
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/Makefile5
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_acoshl.c69
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_acosl.c328
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_asinl.c265
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_atan2l.c124
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_atanhl.c79
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_coshl.c90
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_expl.c257
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_fmodl.c145
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c58
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_hypotl.c131
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_j0l.c3
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_j1l.c2
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_jnl.c402
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c3
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_log10l.c258
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_log2l.c250
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_logl.c281
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_powl.c441
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c277
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_remainderl.c78
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_sinhl.c84
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c109
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/ieee754.h210
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/k_cosl.c128
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/k_sincosl.c163
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/k_sinl.c132
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/k_tanl.c164
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c175
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/math_ldbl.h124
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c103
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/printf_fphex.c138
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_asinhl.c67
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_atanl.c234
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_ceill.c119
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_copysignl.c45
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_cosl.c88
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_erfl.c958
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_expm1l.c160
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_fabsl.c43
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_finitel.c42
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_floorl.c118
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c82
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_frexpl.c92
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_ilogbl.c63
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_isinfl.c35
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_isnanl.c43
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_llrintl.c124
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_llroundl.c128
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_log1pl.c257
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_logbl.c47
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_lrintl.c9
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_lroundl.c9
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_modfl.c94
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c125
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c108
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c106
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c83
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_remquol.c111
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_rintl.c119
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_roundl.c120
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c105
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c109
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_signbitl.c37
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_sincosl.c72
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_sinl.c84
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_tanhl.c90
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_tanl.c78
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_truncl.c119
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/strtold_l.c63
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/t_sincosl.c694
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/w_expl.c6
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_asinhl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_atanl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_cbrtl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_ceill.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_copysignl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_cosl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_erfl.c6
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_expm1l.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_fabsl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_finitel.c17
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_floorl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c10
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_frexpl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_ilogbl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_isinfl.c16
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_isnanl.c16
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_llrintl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_llroundl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_log1pl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_logbl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_lrintl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_lroundl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_modfl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_nearbyintl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_nextafterl.c6
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_nexttoward.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_nexttowardf.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_remquol.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_rintl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_roundl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_scalblnl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_scalbnl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_signbitl.c11
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_sincosl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_sinl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_tanhl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_tanl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_truncl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/strtold_l.c63
-rw-r--r--sysdeps/ieee754/ldbl-64-128/w_expl.c5
-rw-r--r--sysdeps/ieee754/ldbl-96/s_erfl.c8
-rw-r--r--sysdeps/ieee754/ldbl-96/s_nexttoward.c4
-rw-r--r--sysdeps/ieee754/ldbl-opt/Makefile41
-rw-r--r--sysdeps/ieee754/ldbl-opt/Versions87
-rw-r--r--sysdeps/ieee754/ldbl-opt/cabs.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/cabsl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/carg.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/cargl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/cimag.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/cimagl.c6
-rwxr-xr-xsysdeps/ieee754/ldbl-opt/configure69
-rw-r--r--sysdeps/ieee754/ldbl-opt/configure.in19
-rw-r--r--sysdeps/ieee754/ldbl-opt/conj.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/conjl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/creal.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/creall.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/math_ldbl_opt.c3
-rw-r--r--sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h52
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-acos.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-acosh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-asin.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-asinh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-asprintf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-atan.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-atan2.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-atanh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cabs.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cacos.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cacosh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-carg.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-casin.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-casinh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-catan.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-catanh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cbrt.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ccos.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ccosh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ceil.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cexp.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cimag.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-clog.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-clog10.c11
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-compat.c852
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-compat.h87
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-conj.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-copysign.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cos.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cosh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cpow.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cproj.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-creal.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-csin.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-csinh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-csqrt.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ctan.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ctanh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-drem.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-erf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-erfc.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-exp.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-exp10.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-exp2.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-expm1.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fabs.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fdim.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-finite.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-floor.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fma.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fmax.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fmin.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fmod.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fprintf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fprintf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-frexp.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fwprintf.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fwprintf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-gamma.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-hypot.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ilogb.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-isinf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-isnan.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-j0.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-j1.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-jn.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ldexp.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-lgamma.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-lgamma_r.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-llrint.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-llround.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-log.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-log10.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-log1p.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-log2.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-logb.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-lrint.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-lround.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-modf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nan.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nearbyint.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nextafter.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nexttoward.c14
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nexttowardf.c12
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf.c13
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-pow.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-pow10.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-printf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-printf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-printf_fp.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-printf_size.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qecvt.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qecvt_r.c11
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qfcvt.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qfcvt_r.c11
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qgcvt.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-remainder.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-remquo.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-rint.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-round.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-scalb.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-scalbln.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-scalbn.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-scanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-signbit.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-significand.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sin.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sincos.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sinh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-snprintf.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-snprintf_chk.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sprintf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sprintf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sqrt.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strfmon.c14
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strtold.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c20
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strtoldint.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-swprintf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-swprintf_chk.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-syslog.c11
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-syslog_chk.c12
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-tan.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-tanh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-tgamma.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-trunc.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vasprintf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vdprintf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfprintf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfprintf_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vprintf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vprintf_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf_chk.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsprintf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsprintf_chk.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vswprintf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vswprintf_chk.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsyslog.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsyslog_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vwprintf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vwprintf_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wcstold.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c14
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wcstoldint.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wprintf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wprintf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-y0.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-y1.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-yn.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_asinh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_atan.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cacos.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cacosh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cacoshl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cacosl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casin.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casinh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casinhl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casinl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_catan.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_catanh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_catanhl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_catanl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cbrt.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ccos.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ccosh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ccoshl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ccosl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ceil.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cexp.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cexpl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clog.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clog10.c7
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clog10l.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clogl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_copysign.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cpow.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cpowl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cproj.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cprojl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csin.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csinh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csinhl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csinl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csqrt.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csqrtl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ctan.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ctanh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ctanhl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ctanl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_erf.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_expm1.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fabs.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fdim.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fdiml.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_finite.c18
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_floor.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fma.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmal.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmax.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmaxl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmin.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fminl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_frexp.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ilogb.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_isinf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_isnan.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ldexp.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ldexpl.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_llrint.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_llround.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_log1p.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_logb.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_lrint.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_lround.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_modf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nan.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nanl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nearbyint.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nextafter.c12
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c77
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_remquo.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_rint.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_round.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_scalbln.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_scalbn.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_significand.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_significandl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_sin.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_sincos.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_tan.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_tanh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_trunc.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_acos.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_acosh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_acoshl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_acosl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_asin.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_asinl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_atan2.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_atan2l.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_atanh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_atanhl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_cosh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_coshl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_drem.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_dreml.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_exp.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_exp10.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_exp10l.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_fmod.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_fmodl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_hypot.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_hypotl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_j0.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_j0l.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_j1.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_j1l.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_jn.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_jnl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_lgamma.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_lgamma_r.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_lgammal.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_lgammal_r.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log10.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log10l.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log2.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log2l.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_logl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_pow.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_powl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_remainder.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_remainderl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_scalb.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_scalbl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_sinh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_sinhl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_sqrt.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_sqrtl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_tgamma.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_tgammal.c5
-rw-r--r--sysdeps/linkmap.h4
-rw-r--r--sysdeps/m68k/bits/setjmp.h7
-rw-r--r--sysdeps/m68k/fpu/libm-test-ulps4
-rw-r--r--sysdeps/m68k/jmpbuf-unwind.h25
-rw-r--r--sysdeps/mach/hurd/alpha/longjmp-ts.c3
-rw-r--r--sysdeps/mach/hurd/i386/longjmp-ts.c3
-rw-r--r--sysdeps/mach/hurd/jmp-unwind.c6
-rw-r--r--sysdeps/mach/hurd/powerpc/longjmp-ts.c3
-rw-r--r--sysdeps/mach/hurd/ppoll.c30
-rw-r--r--sysdeps/mips/bits/setjmp.h13
-rw-r--r--sysdeps/mips/fpu/libm-test-ulps4
-rw-r--r--sysdeps/mips/jmpbuf-unwind.h (renamed from nptl/sysdeps/mips/jmpbuf-unwind.h)7
-rw-r--r--sysdeps/powerpc/Implies4
-rw-r--r--sysdeps/powerpc/bits/setjmp.h32
-rw-r--r--sysdeps/powerpc/fpu/bits/mathdef.h9
-rw-r--r--sysdeps/powerpc/fpu/bits/mathinline.h16
-rw-r--r--sysdeps/powerpc/fpu/libm-test-ulps566
-rw-r--r--sysdeps/powerpc/fpu/s_isnan.c3
-rw-r--r--sysdeps/powerpc/jmpbuf-offsets.h39
-rw-r--r--sysdeps/powerpc/jmpbuf-unwind.h (renamed from nptl/sysdeps/powerpc/jmpbuf-unwind.h)10
-rw-r--r--sysdeps/powerpc/powerpc32/Implies1
-rw-r--r--sysdeps/powerpc/powerpc32/__longjmp-common.S7
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S3
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_ceil.S4
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_copysign.S9
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_copysignl.S50
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_fabs.S5
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_fabsl.S36
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_fdim.c5
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_floor.S4
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_fmax.S5
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_fmin.S5
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_isnan.c7
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_llrint.c8
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_lrint.S6
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_lround.S4
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_rint.S4
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_round.S4
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_trunc.S6
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_truncf.S2
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/setjmp-common.S3
-rw-r--r--sysdeps/powerpc/powerpc32/setjmp-common.S5
-rw-r--r--sysdeps/powerpc/powerpc64/__longjmp-common.S6
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/e_sqrt.c29
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c29
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_ceil.S6
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_ceill.S133
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_copysign.S10
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_copysignl.S51
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_fabs.S5
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_fabsl.S36
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_fdim.c5
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_floor.S6
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_floorl.S134
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_fmax.S5
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_fmin.S5
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_isnan.c7
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_llrint.S7
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_llrintl.S94
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_llround.S7
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_llroundf.S6
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_llroundl.S167
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_lrintl.S2
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_lroundl.S2
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S114
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_rint.S6
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_rintl.S113
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_round.S6
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_roundl.S133
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_trunc.S8
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_truncf.S4
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_truncl.S121
-rw-r--r--sysdeps/powerpc/powerpc64/setjmp-common.S5
-rw-r--r--sysdeps/s390/bits/setjmp.h41
-rw-r--r--sysdeps/s390/fpu/libm-test-ulps4
-rw-r--r--sysdeps/s390/jmpbuf-offsets.h29
-rw-r--r--sysdeps/s390/jmpbuf-unwind.h (renamed from nptl/sysdeps/s390/jmpbuf-unwind.h)10
-rw-r--r--sysdeps/sh/bits/setjmp.h11
-rw-r--r--sysdeps/sh/jmpbuf-offsets.h20
-rw-r--r--sysdeps/sh/jmpbuf-unwind.h (renamed from nptl/sysdeps/sh/jmpbuf-unwind.h)9
-rw-r--r--sysdeps/sh/sh3/__longjmp.S17
-rw-r--r--sysdeps/sh/sh3/setjmp.S17
-rw-r--r--sysdeps/sh/sh4/__longjmp.S17
-rw-r--r--sysdeps/sh/sh4/fpu/libm-test-ulps4
-rw-r--r--sysdeps/sh/sh4/setjmp.S17
-rw-r--r--sysdeps/sparc/Makefile3
-rw-r--r--sysdeps/sparc/fpu/bits/mathdef.h14
-rw-r--r--sysdeps/sparc/fpu/bits/mathinline.h81
-rw-r--r--sysdeps/sparc/sparc32/Implies3
-rw-r--r--sysdeps/sparc/sparc32/__longjmp.S4
-rw-r--r--sysdeps/sparc/sparc32/bits/setjmp.h13
-rw-r--r--sysdeps/sparc/sparc32/fpu/e_sqrtl.c1
-rw-r--r--sysdeps/sparc/sparc32/fpu/libm-test-ulps424
-rw-r--r--sysdeps/sparc/sparc32/fpu/s_fabs.c5
-rw-r--r--sysdeps/sparc/sparc32/fpu/s_fabsf.S29
-rw-r--r--sysdeps/sparc/sparc32/fpu/s_fabsl.c5
-rw-r--r--sysdeps/sparc/sparc32/jmpbuf-offsets.h22
-rw-r--r--sysdeps/sparc/sparc32/jmpbuf-unwind.h (renamed from nptl/sysdeps/alpha/jmpbuf-unwind.h)8
-rw-r--r--sysdeps/sparc/sparc32/setjmp.S4
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/Makefile20
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/Versions8
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_div.c4
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_lltoq.c (renamed from sysdeps/sparc/sparc32/soft-fp/q_xtoq.c)4
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtoll.c (renamed from sysdeps/sparc/sparc32/soft-fp/q_qtox.c)6
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtou.c (renamed from sysdeps/sparc/sparc32/soft-fp/q_qtoui.c)4
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtoull.c (renamed from sysdeps/sparc/sparc32/soft-fp/q_qtoux.c)6
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_sqrt.c3
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c (renamed from sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c)4
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_utoq.c (renamed from sysdeps/sparc/sparc32/soft-fp/q_uitoq.c)4
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/sfp-machine.h14
-rw-r--r--sysdeps/sparc/sparc64/Makefile3
-rw-r--r--sysdeps/sparc/sparc64/fpu/libm-test-ulps4
-rw-r--r--sysdeps/sparc/sparc64/jmpbuf-unwind.h (renamed from nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h)6
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/sfp-machine.h3
-rw-r--r--sysdeps/unix/alpha/sysdep.h40
-rw-r--r--sysdeps/unix/fdopendir.c3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/fxstatat.c5
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/linux/bits/sched.h5
-rw-r--r--sysdeps/unix/sysv/linux/faccessat.c62
-rw-r--r--sysdeps/unix/sysv/linux/fchmodat.c25
-rw-r--r--sysdeps/unix/sysv/linux/fchownat.c24
-rw-r--r--sysdeps/unix/sysv/linux/futimesat.c30
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat.c10
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat64.c1
-rw-r--r--sysdeps/unix/sysv/linux/getsysstats.c184
-rw-r--r--sysdeps/unix/sysv/linux/i386/Makefile2
-rw-r--r--sysdeps/unix/sysv/linux/i386/call_pselect6.S65
-rw-r--r--sysdeps/unix/sysv/linux/i386/pselect.c18
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/setjmp.h7
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h31
-rw-r--r--sysdeps/unix/sysv/linux/linkat.c24
-rw-r--r--sysdeps/unix/sysv/linux/mkdirat.c24
-rw-r--r--sysdeps/unix/sysv/linux/openat.c108
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Implies4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h19
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/configure135
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/configure.in37
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sys/procfs.h8
-rw-r--r--sysdeps/unix/sysv/linux/ppoll.c76
-rw-r--r--sysdeps/unix/sysv/linux/pselect.c100
-rw-r--r--sysdeps/unix/sysv/linux/readlinkat.c24
-rw-r--r--sysdeps/unix/sysv/linux/renameat.c107
-rw-r--r--sysdeps/unix/sysv/linux/sh/sysdep.h10
-rw-r--r--sysdeps/unix/sysv/linux/shm_open.c9
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/setjmp.h16
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/wordsize.h20
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/Implies3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h8
-rw-r--r--sysdeps/unix/sysv/linux/symlinkat.c24
-rw-r--r--sysdeps/unix/sysv/linux/unlinkat.c23
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c34
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h8
-rw-r--r--sysdeps/unix/sysv/linux/xmknodat.c38
-rw-r--r--sysdeps/x86_64/__longjmp.S6
-rw-r--r--sysdeps/x86_64/bits/setjmp.h41
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps4
-rw-r--r--sysdeps/x86_64/jmpbuf-offsets.h30
-rw-r--r--sysdeps/x86_64/jmpbuf-unwind.h (renamed from nptl/sysdeps/x86_64/jmpbuf-unwind.h)10
-rw-r--r--sysdeps/x86_64/setjmp.S6
-rw-r--r--sysdeps/x86_64/strtok.S4
-rw-r--r--time/time.h5
-rw-r--r--timezone/africa3
-rw-r--r--timezone/antarctica18
-rw-r--r--timezone/asia55
-rw-r--r--timezone/australasia51
-rw-r--r--timezone/backward9
-rw-r--r--timezone/europe3
-rw-r--r--timezone/northamerica89
-rw-r--r--timezone/private.h2
-rw-r--r--timezone/southamerica22
-rw-r--r--timezone/systemv36
-rw-r--r--timezone/test-tz.c2
-rw-r--r--timezone/tzfile.h6
-rw-r--r--timezone/zdump.c52
-rw-r--r--timezone/zic.c108
-rw-r--r--wcsmbs/Makefile5
-rw-r--r--wcsmbs/bits/wchar-ldbl.h62
-rw-r--r--wcsmbs/bits/wchar2.h21
-rw-r--r--wcsmbs/wchar.h10
798 files changed, 24183 insertions, 1967 deletions
diff --git a/ChangeLog b/ChangeLog
index fd1b7aec42..26533c1060 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,1387 @@
+2006-01-27 Dwayne Grant McConnell <decimal@us.ibm.com>
+ Jakub Jelinek <jakub@redhat.com>
+ Roland McGrath <roland@redhat.com>
+ Steven Munroe <sjmunroe@us.ibm.com>
+ Alan Modra <amodra@bigpond.net.au>
+
+ * sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Comment fix.
+ * sysdeps/powerpc/powerpc32/fpu/s_truncf.S: Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/s_llroundf.S: Likewise.
+
+ * sysdeps/powerpc/fpu/libm-test-ulps: Update.
+
+ * math/libm-test.inc (check_float_internal): Allow ulp <= 0.5.
+ (erfc_test): Don't run erfcl (27.0L) test if erfcl (27.0L) is
+ denormal.
+ [TEST_LDOUBLE] (ceil_test, floor_test, llrint_test, llround_test,
+ rint_test, round_test, trunc_test): Add new tests.
+
+ * sysdeps/powerpc/powerpc32/fpu/s_copysignl.S: New file.
+ * sysdeps/powerpc/powerpc32/fpu/s_fabs.S: New file.
+ * sysdeps/powerpc/powerpc32/fpu/s_fabsl.S: New file.
+ * sysdeps/powerpc/powerpc32/fpu/s_fdim.c: New file.
+ * sysdeps/powerpc/powerpc32/fpu/s_fmax.S: New file.
+ * sysdeps/powerpc/powerpc32/fpu/s_fmin.S: New file.
+ * sysdeps/powerpc/powerpc32/fpu/s_isnan.c: New file.
+
+ * sysdeps/powerpc/powerpc64/fpu/s_ceill.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_copysignl.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_fabs.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_fabsl.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_fdim.c: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_floorl.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_fmax.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_fmin.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_isnan.c: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_llrintl.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_llroundl.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_lrintl.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_lroundl.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_rintl.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_roundl.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_truncl.S: New file.
+
+ * sysdeps/unix/sysv/linux/powerpc/Implies: New file.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies: New file.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies: New file.
+ * sysdeps/unix/sysv/linux/powerpc/configure.in: New file.
+ * sysdeps/unix/sysv/linux/powerpc/configure: New file.
+ * sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
+ (__LONG_DOUBLE_MATH_OPTIONAL): Define.
+ (__NO_LONG_DOUBLE_MATH): Define.
+ * sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h: New file.
+ * sysdeps/powerpc/fpu/s_isnan.c: Include math_ldbl_opt.h.
+ * sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (ceill): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (copysignl): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc64/fpu/s_floor.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (floorl): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (llrintl, lrintl): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc64/fpu/s_llround.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (llroundl, lroundl): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc64/fpu/s_rint.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (rintl): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc64/fpu/s_round.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (roundl): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (truncl): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc32/fpu/s_ceil.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (ceill): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (copysignl): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc32/fpu/s_floor.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (floorl): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (lrintl): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc32/fpu/s_llrint.c: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (llrintl): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc32/fpu/s_lround.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (lroundl): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc32/fpu/s_rint.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (rintl): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc32/fpu/s_round.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (roundl): Add compatibility symbols.
+ * sysdeps/powerpc/powerpc32/fpu/s_trunc.S: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (truncl): Add compatibility symbols.
+
+ * misc/qefgcvt_r.c [LDBL_MIN_10_EXP == -291] (FLOAT_MIN_10_NORM): New.
+
+ * sysdeps/powerpc/fpu/bits/mathdef.h (__NO_LONG_DOUBLE_MATH): Remove.
+ * sysdeps/powerpc/Implies: Add ieee754/ldbl-128ibm.
+ * sysdeps/powerpc/powerpc32/Implies: Remove powerpc/soft-fp.
+ * sysdeps/ieee754/ldbl-128ibm/Makefile: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_acoshl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_acosl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_asinl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_atan2l.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_atanhl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_coshl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_expl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_fmodl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_hypotl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_j0l.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_j1l.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_jnl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_log10l.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_log2l.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_logl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_powl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_remainderl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_sinhl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/ieee754.h: New file.
+ * sysdeps/ieee754/ldbl-128ibm/k_cosl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/k_sincosl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/k_sinl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/k_tanl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h: New file.
+ * sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_asinhl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_atanl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_cosl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_erfl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_expm1l.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_fabsl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_finitel.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_frexpl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_ilogbl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_isinfl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_isnanl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_logbl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_modfl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_remquol.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_rintl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_signbitl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_sincosl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_sinl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_tanhl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_tanl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_truncl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/strtold_l.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/t_sincosl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/w_expl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_copysignl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_floorl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_llrintl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_llroundl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_roundl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_ceill.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_lrintl.c: New file.
+ * sysdeps/ieee754/ldbl-128ibm/s_lroundl.c: New file.
+
+ * sysdeps/ieee754/ldbl-128/e_powl.c: Fix old comment.
+
+2006-01-22 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/gnu/errlist-compat.awk: Reduce required number of symbols in
+ sanity check.
+
+2006-01-21 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/renameat.c (__atfct_seterrno_2): Correctly
+ return EBADF for non-existing file descriptors.
+ * sysdeps/unix/sysv/linux/openat.c (__atfct_seterrno): Likewise.
+ * io/tst-openat.c (do_test): Add some more tests.
+ * io/tst-faccessat.c (do_test): Likewise.
+ * io/tst-renameat.c (do_test): Likewise.
+ * io/tst-fstatat.c (do_test): Likewise.
+ * io/tst-fchmodat.c (do_test): Likewise.
+ * io/tst-fchownat.c (do_test): Likewise.
+
+2006-01-21 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/unix/sysv/linux/faccessat.c: Move RESULT defn inside block.
+
+ * misc/tst-pselect.c: Include <unistd.h>.
+
+ * time/time.h [__need_timespec et al]: Include <bits/types.h> here too.
+
+ * stdlib/fpioconst.c: Fix whitespace typo.
+
+2006-01-20 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/ieee754/ldbl-64-128/s_nexttowardfd.c: Moved to...
+ * sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c: ... here. New file.
+ * sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h (long_double_symbol_1): For
+ C define again using _weak_alias, for assembler use weak_alias.
+
+ * sysdeps/powerpc/powerpc64/fpu/e_sqrt.c: New file.
+ * sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c: New file.
+ * sysdeps/powerpc/fpu/bits/mathinline.h (__CPU_HAS_FSQRT): New macro.
+ (__ieee754_sqrt, __ieee754_sqrtf): Use it.
+
+2006-01-21 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/pselect.c (__pselect): Allow actual
+ system call code to be redefined in macro CALL_PSELECT6.
+ * sysdeps/unix/sysv/linux/i386/Makefile [subdir=misc]
+ (sysdep_routines): Add call_pselect6.
+ * sysdeps/unix/sysv/linux/i386/call_pselect6.S: New file.
+ * sysdeps/unix/sysv/linux/i386/pselect.c: New file.
+ * misc/Makefile (tests): Add tst-pselect.
+ * misc/tst-pselect.c: New file.
+
+2006-01-20 Roland McGrath <roland@frob.com>
+
+ * sysdeps/mach/hurd/ppoll.c: New file.
+
+2006-01-20 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/pselect.c: Fix typo in declaration.
+
+ * sysdeps/unix/sysv/linux/xmknodat.c (__xmknodat): Cast k_dev
+ value to unsigned int to match kernel.
+
+ * sysdeps/unix/sysv/linux/faccessat.c (faccessat): Try using the
+ syscall in more cases.
+
+ * io/Makefile (tests): Add tst-symlinkat, tst-linkat, tst-readlinkat,
+ tst-mkdirat, tst-mknodat, and tst-mkfifoat.
+ * io/tst-symlinkat.c: New file.
+ * io/tst-linkat.c: New file.
+ * io/tst-readlinkat.c: New file.
+ * io/tst-mkdirat.c: New file.
+ * io/tst-mknodat.c: New file.
+ * io/tst-mkfifoat.c: New file.
+
+ * dirent/Makefile (tests): Add tst-fdopendir2.
+ * dirent/tst-fdopendir2.c: New file.
+
+2006-01-20 Alexandre Oliva <aoliva@redhat.com>
+
+ * sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
+ (sigcontext_struct) [__WORDSIZE == 32]: Define.
+
+2006-01-20 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * sysdeps/sh/sh4/__longjmp.S: Demangle also r14 and r15.
+ * sysdeps/sh/sh3/__longjmp.S: Likewise.
+ * sysdeps/sh/sh4/setjmp.S: Mangle also r14 and r15.
+ * sysdeps/sh/sh3/setjmp.S: Likewise.
+ * sysdeps/unix/sysv/linux/sh/sysdep.h [__ASSEMBLER__]
+ (PTR_MANGLE): Add temporary register as the second parameter.
+ (PTR_DEMANGLE): Likewize.
+ (PTR_MANGLE2, PTR_DEMANGLE2): Define.
+
+2006-01-19 Ulrich Drepper <drepper@redhat.com>
+
+ * include/fcntl.h: Declare __have_atfcts.
+ * sysdeps/unix/sysv/linux/faccessat.c: Use syscall if available.
+ * sysdeps/unix/sysv/linux/fchmodat.c: Likewise.
+ * sysdeps/unix/sysv/linux/fchownat.c: Likewise.
+ * sysdeps/unix/sysv/linux/futimesat.c: Likewise.
+ * sysdeps/unix/sysv/linux/linkat.c: Likewise.
+ * sysdeps/unix/sysv/linux/mkdirat.c: Likewise.
+ * sysdeps/unix/sysv/linux/openat.c: Likewise.
+ * sysdeps/unix/sysv/linux/readlinkat.c: Likewise.
+ * sysdeps/unix/sysv/linux/renameat.c: Likewise.
+ * sysdeps/unix/sysv/linux/symlinkat.c: Likewise.
+ * sysdeps/unix/sysv/linux/unlinkat.c: Likewise.
+ * sysdeps/unix/sysv/linux/xmknodat.c: Likewise.
+ * sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c: Likewise.
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_PSELECT,
+ __ASSUME_PPOLL, and __ASSUME_ATFCTS if possible.
+
+ * io/ppoll.c: New file.
+ * io/Makefile (routines): Add ppoll.
+ (CFLAGS-ppoll.c): Define.
+ * io/Versions: Export ppoll for GLIBC_2.4.
+ * io/sys/poll.h: Declare ppoll.
+ * sysdeps/unix/sysv/linux/ppoll.c: New file.
+
+ * misc/pselect.c: Make it possible to include this file to define
+ the generic code as a static function.
+ * sysdeps/unix/sysv/linux/pselect.c: New file.
+
+2006-01-19 Jakub Jelinek <jakub@redhat.com>
+
+ * misc/pselect.c (__pselect): Remove static.
+ Include sysdep-cancel.h again. Add LIBC_CANCEL_HANDLED ().
+
+2006-01-18 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h [__ASSEMBLER__]: Don't
+ include problematic headers for assembler.
+
+ * Makerules ($(+sysdir_pfx)sysd-rules): Don't emit m_%.c rules,
+ instead emit m_%.o compilation rules from s_%.? source files.
+ * math/Makefile ($(objpfx)m_%$o: s_%.c): New rule using o-iterator.
+
+2006-01-18 Ulrich Drepper <drepper@redhat.com>
+
+ * misc/pselect.c (__pselect): No need to enable async cancellation
+ here. This is done in select.
+
+ * sysdeps/unix/sysv/linux/fxstatat.c [STAT_IS_KERNEL_STAT]
+ (__fxstatat): Correct handling of invalid vers values.
+
+ [BZ #2173]
+ * libio/fileops.c (_IO_new_file_fopen): If ,ccs= is given, also
+ set vtable to the wide vtable.
+ * libio/tst-fopenloc2.c: New file.
+ * libio/Makefile (tests): Add tst-fopenloc2.
+
+2006-01-18 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c: Restore
+ attribute_hidden here.
+
+ * sysdeps/sparc/sparc64/Makefile (long-double-fcts): Move this ...
+ * sysdeps/sparc/Makefile (long-double-fcts): ... to here.
+
+2006-01-18 Jakub Jelinek <jakub@redhat.com>
+
+ * elf/dl-deps.c (_dl_map_object_deps): In case of failure also make a
+ copy of objname string.
+
+2006-01-16 Roland McGrath <roland@redhat.com>
+
+ * Makerules ($(+sysdir_pfx)sysd-rules): Emit pattern rules to install
+ into $(inst_includedir)/%.h from sysdirs.
+ [headers]: Change static pattern rule for installing
+ $(headers) to do only those not matching %.h.
+ ($(inst_includedir)/%.h: $(objpfx)%.h): Add this pattern rule instead.
+ ($(inst_includedir)/%.h: %.h): Likewise.
+ ($(inst_includedir)/%.h: $(..)include/%.h): Likewise.
+
+ * Makefile ($(inst_includedir)/gnu/stubs.h):
+ Add $(make-target-directory).
+
+ * stdlib/Makefile (headers): Restore headers removed in last change.
+
+2006-01-16 Jakub Jelinek <jakub@redhat.com>
+
+ * math/e_exp2l.c: Don't include stdio.h, errno.h, stub-tag.h, include
+ math_private.h.
+ (__ieee754_exp2l): Compute for now as expl (M_LN2l * x)
+ instead of failing.
+ (exp2l): Remove stub_warning.
+
+2006-01-15 Jakub Jelinek <jakub@redhat.com>
+
+ * io/tst-faccessat.c (do_test): Don't fail if geteuid () == 0.
+
+2006-01-16 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define
+ __ASSUME_TMPFS_NAME.
+ * sysdeps/unix/sysv/linux/shm_open.c [__ASSUME_TMPFS_NAME]
+ (where_is_shmfs): Don't test for obsolete shm filesystem name.
+
+ * sysdeps/unix/sysv/linux/getsysstats.c: Don't search for proc
+ mount point. We assume procfs is mounted at /proc in many other
+ places already.
+
+2006-01-15 Andreas Jaeger <aj@suse.de>
+
+ [BZ #1950]
+ * posix/regex_internal.c (re_string_reconstruct): Adjust for
+ build_wcs_upper_buffer change.
+ (build_wcs_upper_buffer): Change return type.
+
+ [BZ #2153]
+ * math/s_cacosh.c (__cacosh): Do not return a negative
+ value. Patch by Wes Loewer <wjltemp-temp01@yahoo.com>.
+ * math/s_cacoshl.c (__cacoshl): Likewise.
+ * math/s_cacoshf.c (__cacoshf): Likewise.
+ * math/libm-test.inc (cacosh_test): Adjust for change.
+
+ * sysdeps/alpha/fpu/libm-test-ulps: Adopt for cacosh test change.
+ * sysdeps/hppa/fpu/libm-test-ulps: Likewise.
+ * sysdeps/i386/fpu/libm-test-ulps: Likewise.
+ * sysdeps/ia64/fpu/libm-test-ulps: Likewise.
+ * sysdeps/m68k/fpu/libm-test-ulps: Likewise.
+ * sysdeps/mips/fpu/libm-test-ulps: Likewise.
+ * sysdeps/powerpc/fpu/libm-test-ulps: Likewise.
+ * sysdeps/s390/fpu/libm-test-ulps: Likewise.
+ * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
+ * sysdeps/sh/sh4/fpu/libm-test-ulps: Likewise.
+ * sysdeps/sparc/sparc32/fpu/libm-test-ulps: Likewise.
+ * sysdeps/sparc/sparc64/fpu/libm-test-ulps: Likewise.
+
+ [BZ #2079]
+ * libio/fputwc_u.c (fputwc_unlocked): Fix return value.
+ * libio/getwc_u.c (__getwc_unlocked): Likewise.
+ * libio/wfileops.c (_IO_wdo_write): Likewise.
+
+ [BZ #2078]
+ * libio/fputwc.c (fputwc): Use proper type for result.
+ * libio/ioungetwc.c (ungetwc): Likewise.
+
+2006-01-14 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/bits/sched.h: Define SCHED_BATCH.
+
+2006-01-14 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_DECL): Don't try
+ attribute_hidden here.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vsyslog.c (vsyslog): Restore
+ attribute_hidden here.
+ * sysdeps/ieee754/ldbl-opt/nldbl-asprintf.c (__asprintf): Likewise.
+ * sysdeps/ieee754/ldbl-opt/nldbl-fprintf.c (fprintf): Likewise.
+ * sysdeps/ieee754/ldbl-opt/nldbl-qecvt.c (qecvt): Likewise.
+ * sysdeps/ieee754/ldbl-opt/nldbl-qfcvt.c (qfcvt): Likewise.
+ * sysdeps/ieee754/ldbl-opt/nldbl-qgcvt.c (qgcvt): Likewise.
+
+ * sysdeps/ieee754/ldbl-opt/configure.in: Use AC_TRY_COMPILE and
+ verify __LONG_DOUBLE_128__ predefine.
+ * sysdeps/ieee754/ldbl-opt/configure: Regenerated.
+
+ * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_HIDDEN): Removed.
+ (NLDBL_DECL): Rewritten.
+ Remove __THROW from NLDBL_DECL uses.
+ Use NLDBL_DECL for __vstrfmon_l.
+ (__nldbl___vsyslog_chk): Restore missing decl.
+ * sysdeps/ieee754/ldbl-opt/nldbl-asinh.c: Restore attribute_hidden.
+
+2006-01-14 Jakub Jelinek <jakub@redhat.com>
+
+ * misc/sys/cdefs.h (__LDBL_REDIR1_DECL): Define.
+ (__LDBL_REDIR_DECL): Stringize __nldbl and name.
+ * stdlib/bits/monetary-ldbl.h: Remove pastos from wchar-ldbl.h.
+ (strfmon, strfmon_l): Add __LDBL_REDIR_DECL.
+ * stdlib/bits/stdlib-ldbl.h (strtold, strtold_l, __strtold_internal,
+ qecvt, qfcvt, qgcvt, qecvt_r, qfcvt_r): Use __LDBL_REDIR1_DECL
+ instead of __LDBL_REDIR_DECL.
+ * wcsmbs/bits/wchar-ldbl.h: Remove stale #if.
+ (__LDBL_REDIR_WCHAR): Remove.
+ (fwprintf, wprintf, swprintf, vfwprintf, vwprintf, vswprintf,
+ fwscanf, wscanf, swscanf, vfwscanf, vwscanf, vswscanf): Use
+ __LDBL_REDIR_DECL instead of __LDBL_REDIR_WCHAR.
+ (wcstold, wcstold_l, __wcstold_internal): Add __LDBL_REDIR1_DECL.
+ * wcsmbs/wchar.h: Include bits/wchar-ldbl.h after bits/wchar2.h
+ instead of before it.
+ (wcstold inline): Move #ifndef __LDBL_COMPAT before
+ extern keyword.
+ * libio/bits/stdio-ldbl.h (__snprintf_chk, __vsnprintf_chk): Add
+ __LDBL_REDIR_DECL.
+ * misc/bits/syslog-ldbl.h (vsyslog): Protect with #ifdef __USE_BSD.
+ (__syslog_chk, __vsyslog_chk): Add __LDBL_REDIR_DECL.
+
+2006-01-14 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_DECL): Fix typo.
+ (NLDBL_HIDDEN): New macro.
+ (NLDBL_DECL): Use it in place of attribute_hidden.
+
+ * misc/efgcvt.c: Include <math_ldbl_opt.h> instead of <shlib-compat.h>.
+ * misc/efgcvt_r.c: Likewise.
+
+ * sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h: New file.
+ * sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h: #include <nldbl-abi.h>
+ to define LONG_DOUBLE_COMPAT_VERSION. Use that in place of
+ NLDBL_VERSION.
+ * sysdeps/ieee754/ldbl-opt/Versions: Include <nldbl-abi.h>.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/Versions: Revert last change.
+
+2006-01-14 Jakub Jelinek <jakub@redhat.com>
+
+ * math/math.h [__NO_LONG_DOUBLE_MATH] (__nldbl_nexttowardf): New
+ prototype.
+ (nexttowardf): Redirect to __nldbl_nexttowardf.
+ (nexttoward): Redirect to nextafter.
+ (__MATHDECL_2, __MATHDECL_1): Redirect *l functions to
+ non-*l versions if __LONG_DOUBLE_MATH_OPTIONAL and
+ __NO_LONG_DOUBLE_MATH.
+ * math/complex.h (__MATHDECL_1): Likewise.
+ * math/bits/mathcalls.h (nexttoward): Don't prototype if
+ __LDBL_COMPAT.
+ * misc/sys/cdefs.h: Include <bits/wordsize.h>.
+ (__LDBL_COMPAT, __LDBL_REDIR1, __LDBL_REDIR, __LDBL_REDIR1_NTH,
+ __LDBL_REDIR_NTH, __LDBL_REDIR_DECL): New macros.
+
+ * libio/bits/stdio-ldbl.h: New file.
+ * libio/Makefile (headers): Add it.
+ * libio/stdio.h [__LDBL_COMPAT]: #include it.
+ * libio/bits/libio-ldbl.h: New file.
+ * libio/Makefile (headers): Add it.
+ * libio/libio.h [__LDBL_COMPAT]: #include it.
+ * libio/libioP.h: Include <math_ldbl_opt.h>.
+ * include/wchar.h (__fwprintf, __vfwprintf): Fix commented out
+ attribute.
+ (__vfwprintf_chk): New prototype. Add libc_hidden_proto.
+ * wcsmbs/bits/wchar-ldbl.h: New file.
+ * wcsmbs/Makefile (headers): Add it.
+ * wcsmbs/wchar.h [__LDBL_COMPAT]: #include it.
+ * wcsmbs/bits/wchar2.h (__vswprintf_alias): Removed.
+ (vswprintf): Define as a macro rather than inline function.
+ * stdio-common/bits/printf-ldbl.h: New file.
+ * stdio-common/Makefile (headers): Add it.
+ * stdio-common/printf.h [__LDBL_COMPAT]: #include it.
+ * libio/fwprintf.c: Include libioP.h.
+ (fwprintf): Use ldbl_weak_alias instead of weak_alias.
+ * libio/fwscanf.c: Include libioP.h.
+ (fwscanf): Rename to __fwscanf and add ldbl_strong_alias.
+ * libio/iovdprintf.c (vdprintf): Use ldbl_weak_alias instead of
+ weak_alias.
+ * libio/iovsprintf.c (_IO_vsprintf): Rename to __IO_vsprintf,
+ add ldbl_strong_alias and use INTDEF2 instead of INTDEF.
+ (vsprintf): Use ldbl_weak_alias instead of weak_alias.
+ * libio/iovsscanf.c (__vsscanf, vsscanf): Use ldbl_weak_alias
+ instead of weak_alias.
+ * libio/iovswscanf.c (vswscanf): Rename to __vswscanf,
+ add ldbl_strong_alias and use ldbl_hidden_def instead of
+ libc_hidden_def.
+ * libio/obprintf.c (obstack_printf, obstack_vprintf): Use
+ ldbl_weak_alias instead of weak_alias.
+ * libio/swprintf.c: Include libioP.h.
+ (swprintf): Rename to __swprintf and add ldbl_strong_alias.
+ * libio/swscanf.c: Include libioP.h.
+ (swscanf): Rename to __swscanf and add ldbl_strong_alias.
+ * libio/vasprintf.c (vasprintf): Use ldbl_weak_alias instead of
+ weak_alias.
+ * libio/vscanf.c (vscanf): Use ldbl_weak_alias instead of
+ weak_alias.
+ * libio/vsnprintf.c (__vsnprintf, vsnprintf): Use ldbl_weak_alias
+ instead of weak_alias.
+ * libio/vswprintf.c (__vswprintf): Remove alias.
+ (vswprintf): Use ldbl_weak_alias instead of weak_alias.
+ * libio/vwprintf.c: Include libioP.h.
+ (vwprintf): Rename to __vwprintf and add ldbl_strong_alias.
+ * libio/vwscanf.c (vwscanf): Rename to __vwscanf and add
+ ldbl_strong_alias.
+ * libio/wprintf.c: Include libioP.h.
+ (wprintf): Rename to __wprintf and add ldbl_strong_alias.
+ * libio/wscanf.c: Include libioP.h.
+ (wscanf): Rename to __wscanf and add ldbl_strong_alias.
+ * stdio-common/asprintf.c (__asprintf): Rename to ___asprintf, add
+ ldbl_strong_alias and use INTDEF2 instead of INTDEF.
+ (asprintf): Use ldbl_weak_alias instead of weak_alias.
+ * stdio-common/dprintf.c (dprintf): Rename to __dprintf, add
+ ldbl_strong_alias and use ldbl_hidden_def instead of
+ libc_hidden_def.
+ * stdio-common/fprintf.c: Include libioP.h.
+ (fprintf): Rename to __fprintf, add ldbl_strong_alias and
+ use ldbl_hidden_def instead of libc_hidden_def.
+ (_IO_fprintf): Use ldbl_weak_alias instead of weak_alias.
+ * stdio-common/fscanf.c: Include libioP.h.
+ (fscanf): Rename to __fscanf and add ldbl_strong_alias.
+ * stdio-common/printf.c: Include libioP.h.
+ (printf): Rename to __printf and add ldbl_strong_alias.
+ (_IO_printf): Use ldbl_strong_alias instead of strong_alias.
+ * stdio-common/printf_fp.c (__printf_fp): Rename to __printf_fp, add
+ ldbl_strong_alias and use ldbl_hidden_def instead of
+ libc_hidden_def.
+ * stdio-common/printf_size.c (printf_size): Rename to __printf_size
+ and add ldbl_strong_alias.
+ * stdio-common/scanf.c (scanf): Rename to __scanf and add
+ ldbl_strong_alias.
+ * stdio-common/snprintf.c (snprintf): Use ldbl_weak_alias instead of
+ weak_alias.
+ * stdio-common/sprintf.c (sprintf): Rename to __sprintf, add
+ ldbl_strong_alias and use ldbl_hidden_def instead of
+ libc_hidden_def.
+ (_IO_sprintf): Use ldbl_strong_alias instead of strong_alias.
+ * stdio-common/sscanf.c: Include libioP.h instead of iolibio.h.
+ (sscanf): Rename to __sscanf and add ldbl_strong_alias.
+ * stdio-common/vfprintf.c (vfprintf): Define to
+ _IO_vfprintf_internal. Use ldbl_strong_alias instead. Use
+ ldbl_hidden_def instead of libc_hidden_def.
+ (_IO_vfprintf_internal): Clear is_long_double if __ldbl_is_dbl,
+ handle the argument as double if it is non-zero.
+ (vfwprintf): Use ldbl_weak_alias instead of weak_alias.
+ (_IO_vfprintf): Add ldbl_strong_alias.
+ * stdio-common/vfscanf.c (_IO_vfscanf): Rename to
+ _IO_vfscanf_internal, don't use strtold if __ldbl_is_dbl, add
+ ldbl_strong_alias.
+ (vfwscanf): Use ldbl_weak_alias instead of weak_alias.
+ (__vfscanf): Rename to ___vfscanf, add ldbl_strong_alias and
+ use ldbl_hidden_def instead of libc_hidden_def.
+ (vfscanf): Use ldbl_weak_alias instead of weak_alias.
+ * stdio-common/vprintf.c: Include libioP.h.
+ (vprintf): Rename to __vprintf and add ldbl_strong_alias.
+ * debug/fprintf_chk.c (__fprintf_chk): Rename to ___fprintf_chk
+ and add ldbl_strong_alias.
+ * debug/printf_chk.c (__printf_chk): Rename to ___printf_chk
+ and add ldbl_strong_alias.
+ * debug/snprintf_chk.c: Include libioP.h.
+ (__snprintf_chk): Rename to ___snprintf_chk and add ldbl_strong_alias.
+ * debug/sprintf_chk.c: Include libioP.h.
+ (__sprintf_chk): Rename to ___sprintf_chk and add ldbl_strong_alias.
+ * debug/vfprintf_chk.c (__vfprintf_chk): Rename to ___vfprintf_chk,
+ add ldbl_strong_alias and use ldbl_hidden_def instead of
+ libc_hidden_def.
+ * debug/vfwprintf_chk.c (__vfwprintf_chk): Add libc_hidden_def.
+ * debug/vprintf_chk.c (__vprintf_chk): Rename to ___vprintf_chk
+ and add ldbl_strong_alias.
+ * debug/vsnprintf_chk.c (__vsnprintf_chk): Rename to ___vsnprintf_chk,
+ add ldbl_strong_alias and use ldbl_hidden_def instead of
+ libc_hidden_def.
+ * debug/vsprintf_chk.c (__vsprintf_chk): Rename to ___vsprintf_chk,
+ add ldbl_strong_alias and use ldbl_hidden_def instead of
+ libc_hidden_def.
+
+ * stdlib/stdlib.h (strtold): Don't define inline if [!__LDBL_COMPAT].
+ * wcsmbs/wchar.h (wcstold): Likewise.
+ * stdlib/strtod_l.c: Include math_ldbl_opt.h.
+ (____STRTOF_INTERNAL): Define.
+ (INTERNAL (__STRTOF)): Rename to ____STRTOF_INTERNAL.
+ (__STRTOF): Call ____STRTOF_INTERNAL instead.
+ [LONG_DOUBLE_COMPAT] (strtold_l, wcstold_l, __strtold_l, __wcstold_l):
+ Add compatibility symbols.
+ * stdlib/strtod.c: Include math_ldbl_opt.h.
+ [LONG_DOUBLE_COMPAT] (strtold, wcstold, __strtold_internal,
+ __wcstold_internal): Add compatibility symbols.
+ * stdlib/strtold.c: Include bits/wordsize.h, wchar.h.
+ (NEW, NEW1): Define.
+ (__new_strtold, __new_wcstold): New prototypes.
+ (____new_strtold_internal, ____new_wcstold_internal): Likewise.
+ Add libc_hidden_proto.
+ (STRTOF): Define to NEW (*told).
+ [__LONG_DOUBLE_MATH_OPTIONAL] (wcstold, strtold): Add
+ long_double_symbol.
+ [__LONG_DOUBLE_MATH_OPTIONAL] (__wcstold_internal,
+ __strtold_internal): Likewise. Add libc_hidden_ver.
+
+ * stdlib/bits/stdlib-ldbl.h: New file.
+ * stdlib/Makefile (headers): Add it.
+ * stdlib/stdlib.h [__LDBL_COMPAT]: #include it.
+ * include/stdlib.h (ecvt_r, fcvt_r, qecvt_r, qfcvt_r): Remove
+ libc_hidden_proto.
+ (__ecvt, __fcvt, __gcvt, __ecvt_r, __fcvt_r, __qecvt, __qfcvt,
+ __qgcvt, __qecvt_r, __qfcvt_r): New prototypes.
+ * misc/efgcvt_r.c: Include shlib-compat.h.
+ (LONG_DOUBLE_CVT): Define.
+ (__APPEND, __APPEND2): Define.
+ (*fcvt_r): Use __APPEND instead of APPEND. Remove libc_hidden_def.
+ (*ecvt_r): Likewise.
+ (cvt_symbol): Define. Use it on fcvt_r and ecvt_r.
+ * misc/efgcvt.c: Include shlib-compat.h.
+ (LONG_DOUBLE_CVT): Define.
+ (__APPEND, __APPEND2): Define.
+ (fcvt): Use __APPEND instead of APPEND. Remove libc_hidden_def.
+ (ecvt, gcvt): Likewise.
+ (cvt_symbol): Define. Use it on fcvt, ecvt and gcvt.
+
+ * stdlib/bits/monetary-ldbl.h: New file.
+ * stdlib/Makefile (headers): Add it.
+ * stdlib/monetary.h [__LDBL_COMPAT]: #include it.
+ * stdlib/strfmon.c: Include math_ldbl_opt.h.
+ (strfmon): Rename to __strfmon and add ldbl_strong_alias.
+ * stdlib/strfmon_l.c: Remove all traces of [!USE_IN_LIBIO].
+ (__vstrfmon_l): Don't set is_long_double if __ldbl_is_dbl.
+ (__strfmon_l): Rename to ___strfmon_l and add ldbl_strong_alias.
+ (strfmon_l): Use ldbl_weak_alias instead of weak_alias.
+
+ * misc/bits/syslog-ldbl.h: New file.
+ * misc/Makefile (headers): Add it.
+ * misc/sys/syslog.h [__LDBL_COMPAT]: #include it.
+ * misc/syslog.c: Include math_ldbl_opt.h.
+ (syslog): Rename to __syslog and add ldbl_strong_alias,
+ use ldbl_hidden_def instead of libc_hidden_def.
+ (vsyslog): Rename to __vsyslog and add ldbl_strong_alias,
+ use ldbl_hidden_def instead of libc_hidden_def.
+
+ * sysdeps/generic/math_ldbl_opt.h: New file.
+ * math/w_j1l.c (j1l, y1l): Rename to __ prefixed variants.
+ Add weak_alias.
+ * math/w_j0l.c (j0l, y0l): Likewise.
+ * math/w_jnl.c (jnl, ynl): Likewise.
+ * sysdeps/ieee754/ldbl-96/s_nexttoward.c
+ (__nexttowardl): Remove strong_alias.
+ (nexttowardl): Remove weak_alias.
+ * sysdeps/ieee754/ldbl-96/s_erfl.c
+ (__erfl, __erfcl): Remove strong_alias.
+ (erfl, erfcl): Remove weak_alias.
+
+ * sysdeps/ieee754/ldbl-64-128/s_asinhl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_atanl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_cbrtl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_ceill.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_copysignl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_cosl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_erfl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_expm1l.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_fabsl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_finitel.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_floorl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_frexpl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_ilogbl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_isinfl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_isnanl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_llrintl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_llroundl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_log1pl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_logbl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_lrintl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_lroundl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_modfl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_nearbyintl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_nextafterl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_nexttoward.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_nexttowardf.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_nexttowardfd.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_remquol.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_rintl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_roundl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_scalblnl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_scalbnl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_signbitl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_sincosl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_sinl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_tanhl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_tanl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/s_truncl.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/strtold_l.c: New file.
+ * sysdeps/ieee754/ldbl-64-128/w_expl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/configure.in: New file.
+ * sysdeps/ieee754/ldbl-opt/configure: New file.
+ * sysdeps/ieee754/ldbl-opt/Makefile: New file.
+ * sysdeps/ieee754/ldbl-opt/Versions: New file.
+ * sysdeps/ieee754/ldbl-opt/cabs.c: New file.
+ * sysdeps/ieee754/ldbl-opt/cabsl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/carg.c: New file.
+ * sysdeps/ieee754/ldbl-opt/cargl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/cimag.c: New file.
+ * sysdeps/ieee754/ldbl-opt/cimagl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/conj.c: New file.
+ * sysdeps/ieee754/ldbl-opt/conjl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/creal.c: New file.
+ * sysdeps/ieee754/ldbl-opt/creall.c: New file.
+ * sysdeps/ieee754/ldbl-opt/math_ldbl_opt.c: New file.
+ * sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-acos.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-acosh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-asin.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-asinh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-asprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-atan.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-atan2.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-atanh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-cabs.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-cacos.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-cacosh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-carg.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-casin.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-casinh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-catan.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-catanh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-cbrt.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-ccos.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-ccosh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-ceil.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-cexp.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-cimag.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-clog.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-clog10.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-compat.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-compat.h: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-conj.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-copysign.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-cos.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-cosh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-cpow.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-cproj.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-creal.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-csin.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-csinh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-csqrt.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-ctan.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-ctanh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-drem.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-erf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-erfc.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-exp.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-exp10.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-exp2.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-expm1.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-fabs.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-fdim.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-finite.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-floor.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-fma.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-fmax.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-fmin.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-fmod.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-fprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-fprintf_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-frexp.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-fwprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-fwprintf_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-gamma.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-hypot.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-ilogb.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-isinf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-isnan.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-j0.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-j1.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-jn.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-ldexp.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-lgamma.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-lgamma_r.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-llrint.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-llround.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-log.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-log10.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-log1p.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-log2.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-logb.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-lrint.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-lround.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-modf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-nan.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-nearbyint.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-nextafter.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-nexttoward.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-nexttowardf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-pow.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-pow10.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-printf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-printf_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-printf_fp.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-printf_size.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-qecvt.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-qecvt_r.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-qfcvt.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-qfcvt_r.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-qgcvt.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-remainder.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-remquo.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-rint.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-round.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-scalb.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-scalbln.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-scalbn.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-scanf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-signbit.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-significand.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-sin.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-sincos.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-sinh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-snprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-snprintf_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-sprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-sprintf_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-sqrt.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-strfmon.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-strtold.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-strtoldint.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-swprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-swprintf_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-syslog.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-syslog_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-tan.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-tanh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-tgamma.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-trunc.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vasprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vdprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vfprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vfprintf_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vprintf_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vsprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vsprintf_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vswprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vswprintf_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vsyslog.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vsyslog_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vwprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vwprintf_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-wcstold.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-wcstoldint.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-wprintf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-wprintf_chk.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-y0.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-y1.c: New file.
+ * sysdeps/ieee754/ldbl-opt/nldbl-yn.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_asinh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_atan.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_cacos.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_cacosh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_cacoshl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_cacosl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_casin.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_casinh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_casinhl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_casinl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_catan.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_catanh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_catanhl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_catanl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_cbrt.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_ccos.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_ccosh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_ccoshl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_ccosl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_ceil.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_cexp.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_cexpl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_clog.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_clog10.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_clog10l.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_clogl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_copysign.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_cpow.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_cpowl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_cproj.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_cprojl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_csin.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_csinh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_csinhl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_csinl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_csqrt.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_csqrtl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_ctan.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_ctanh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_ctanhl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_ctanl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_erf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_expm1.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_fabs.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_fdim.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_fdiml.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_finite.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_floor.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_fma.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_fmal.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_fmax.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_fmaxl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_fmin.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_fminl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_frexp.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_ilogb.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_isinf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_isnan.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_ldexp.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_ldexpl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_llrint.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_llround.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_log1p.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_logb.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_lrint.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_lround.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_modf.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_nan.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_nanl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_nearbyint.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_nextafter.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_remquo.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_rint.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_round.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_scalbln.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_scalbn.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_significand.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_significandl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_sin.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_sincos.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_tan.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_tanh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/s_trunc.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_acos.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_acosh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_acoshl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_acosl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_asin.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_asinl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_atan2.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_atan2l.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_atanh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_atanhl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_cosh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_coshl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_drem.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_dreml.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_exp.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_exp10.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_exp10l.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_fmod.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_fmodl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_hypot.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_hypotl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_j0.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_j0l.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_j1.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_j1l.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_jn.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_jnl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_lgamma.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_lgamma_r.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_lgammal.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_lgammal_r.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_log.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_log10.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_log10l.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_log2.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_log2l.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_logl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_pow.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_powl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_remainder.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_remainderl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_scalb.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_scalbl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_sinh.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_sinhl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_sqrt.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_sqrtl.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_tgamma.c: New file.
+ * sysdeps/ieee754/ldbl-opt/w_tgammal.c: New file.
+
+ * sysdeps/unix/sysv/linux/sparc/bits/wordsize.h: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/Implies: New file.
+ * sysdeps/sparc/sparc32/Implies: Move ldbl-128 first and flt-32
+ after dbl-64.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/Versions (NLDBL_VERSION):
+ %define this to to GLIBC_2.4.
+ * sysdeps/sparc/sparc32/fpu/e_sqrtl.c: New file.
+ * sysdeps/sparc/sparc32/fpu/s_fabs.c: New file.
+ * sysdeps/sparc/sparc32/fpu/s_fabsf.S: New file.
+ * sysdeps/sparc/sparc32/fpu/s_fabsl.c: New file.
+ * sysdeps/sparc/sparc32/soft-fp/q_qtoui.c: Removed.
+ * sysdeps/sparc/sparc32/soft-fp/q_qtoux.c: Removed.
+ * sysdeps/sparc/sparc32/soft-fp/q_qtox.c: Removed.
+ * sysdeps/sparc/sparc32/soft-fp/q_uitoq.c: Removed.
+ * sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c: Removed.
+ * sysdeps/sparc/sparc32/soft-fp/q_xtoq.c: Removed.
+ * sysdeps/sparc/sparc32/soft-fp/q_lltoq.c: New file.
+ * sysdeps/sparc/sparc32/soft-fp/q_qtoll.c: New file.
+ * sysdeps/sparc/sparc32/soft-fp/q_qtou.c: New file.
+ * sysdeps/sparc/sparc32/soft-fp/q_qtoull.c: New file.
+ * sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c: New file.
+ * sysdeps/sparc/sparc32/soft-fp/q_utoq.c: New file.
+ * sysdeps/sparc/sparc32/soft-fp/Versions: New file.
+ * sysdeps/sparc/fpu/bits/mathinline.h (__unordered_cmp,
+ __unordered_v9cmp): Define differently depending on
+ -m32 -mlong-double-{64,128}.
+ (__signbitl, sqrtl, __ieee754_sqrtl): New inlines.
+ * sysdeps/sparc/fpu/bits/mathdef.h (__NO_LONG_DOUBLE_MATH): Remove.
+ * sysdeps/sparc/sparc32/soft-fp/Makefile (sparc32-quad-routines):
+ Set.
+ (sysdep-routines): Add sparc32-quad-routines.
+ * sysdeps/sparc/sparc32/soft-fp/sfp-machine.h: Include stdlib.h.
+ (FP_HANDLE_EXCEPTIONS): Call ___Q_simulate_exceptions as a normal
+ function.
+ * sysdeps/sparc/sparc32/soft-fp/q_sqrt.c (__ieee754_sqrtl): New
+ alias to _Q_sqrt.
+ * sysdeps/sparc/sparc32/soft-fp/q_div.c (_Q_div): Fix a typo.
+ * sysdeps/sparc/sparc64/soft-fp/sfp-machine.h: Include stdlib.h.
+ * sysdeps/sparc/sparc32/fpu/libm-test-ulps: Update.
+
+ * libio/libio.h (_IO_vfscanf, _IO_vfprintf): Remove __THROW.
+ (_IO_vfwscanf, _IO_vfwprintf): Likewise.
+ * libio/libioP.h (_IO_vdprintf): Likewise.
+
+2006-01-13 Richard Henderson <rth@redhat.com>
+
+ * sysdeps/unix/sysv/linux/alpha/sysdep.h (PTR_MANGLE, PTR_MANGLE2,
+ PTR_DEMANGLE, PTR_DEMANGLE2): Move ...
+ * sysdeps/unix/alpha/sysdep.h: ... here.
+ * sysdeps/unix/sysv/linux/alpha/fxstatat.c: Define __GI___fxstatat64.
+
+2006-01-13 Andreas Jaeger <aj@suse.de>
+
+ * sysdeps/unix/sysv/linux/powerpc/sys/procfs.h (ELF_NVRREG): Fix
+ value for PowerPC64.
+
+2006-01-12 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/s390/jmpbuf-offsets.h: New file.
+ * sysdeps/s390/jmpbuf-unwind.h: Include it.
+
+ * sysdeps/alpha/__longjmp.S: Include <jmpbuf-offsets.h>
+ instead of <bits/setjmp.h>.
+ * sysdeps/alpha/setjmp.S: Likewise.
+ * sysdeps/i386/__longjmp.S: Likewise.
+ * sysdeps/i386/bsd-_setjmp.S: Likewise.
+ * sysdeps/i386/bsd-setjmp.S: Likewise.
+ * sysdeps/i386/setjmp.S: Likewise.
+ * sysdeps/powerpc/powerpc32/__longjmp-common.S: Likewise.
+ * sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S: Likewise.
+ * sysdeps/powerpc/powerpc32/fpu/setjmp-common.S:
+ * sysdeps/powerpc/powerpc32/setjmp-common.S: Likewise.
+ * sysdeps/powerpc/powerpc64/__longjmp-common.S: Likewise.
+ * sysdeps/powerpc/powerpc64/setjmp-common.S: Likewise.
+ * sysdeps/sh/sh3/setjmp.S: Likewise.
+ * sysdeps/sh/sh4/setjmp.S: Likewise.
+ * sysdeps/sparc/sparc32/__longjmp.S: Likewise.
+ * sysdeps/sparc/sparc32/setjmp.S: Likewise.
+ * sysdeps/x86_64/__longjmp.S: Likewise.
+ * sysdeps/x86_64/setjmp.S: Likewise.
+ * sysdeps/mach/hurd/i386/longjmp-ts.c: Include <jmpbuf-offsets.h>.
+ * sysdeps/mach/hurd/powerpc/longjmp-ts.c: Likewise.
+ * sysdeps/mach/hurd/alpha/longjmp-ts.c: Likewise.
+ * sysdeps/alpha/jmpbuf-unwind.h: Likewise.
+ * sysdeps/hppa/jmpbuf-unwind.h: Likewise.
+ * sysdeps/i386/jmpbuf-unwind.h: Likewise.
+ * sysdeps/powerpc/jmpbuf-unwind.h: Likewise.
+ * sysdeps/sparc/sparc32/jmpbuf-unwind.h: Likewise.
+ * sysdeps/sparc/sparc64/jmpbuf-unwind.h: Likewise.
+ * sysdeps/x86_64/jmpbuf-unwind.h: Likewise.
+ * setjmp/jmpbuf-offsets.h: File removed.
+ * include/bits/setjmp.h: File removed.
+
+2006-01-11 Ulrich Drepper <drepper@redhat.com>
+
+ * libio/wmemstream.c: New file.
+ * libio/stdio.h: Declare open_wmemstream.
+ * libio/Versions: Export open_wmemstream for GLIBC_2.4.
+ * libio/Makefile (routines): Add wmemstream.
+ (tests): Add tst-memstream1, tst-memstream2, tst-wmemstream2, and
+ tst-wmemstream2.
+ * libio/tst-memstream1.c: New file.
+ * libio/tst-memstream2.c: New file.
+ * libio/tst-wmemstream1.c: New file.
+ * libio/tst-wmemstream2.c: New file.
+
+ * libio/memstream.c (_IO_mem_sync): Remove useless call to
+ _IO_default_sync.
+
+ * elf/check-textrel.c: Add missing argument.
+
+ * Makerules: Define build-module-asneeded.
+ * iconvdata/extra-module.mk: Use build-module-asneeded.
+ needed.
+
+2006-01-09 Richard Henderson <rth@redhat.com>
+
+ * iconvdata/extra-module.mk ($(objpfx)$(mod).so): Depend on ld.so.
+ * sysdeps/alpha/__longjmp.S: Use PTR_DEMANGLE.
+ * sysdeps/alpha/setjmp.S: Likewise. Avoid __sigjmp_save for rtld;
+ tailcall in libc.so.
+ * sysdeps/unix/sysv/linux/alpha/sysdep.h (PTR_MANGLE): Define.
+ (PTR_MANGLE2): Define.
+
+2006-01-11 Ulrich Drepper <drepper@redhat.com>
+
+ * elf/check-localplt.c: New file.
+ * elf/Makefile: Add rules to build and run check-localplt.
+ * scripts/data/localplt-x86_64-linux-gnu.data: New file.
+ * scripts/data/localplt-i386-linux-gnu.data: New file.
+
+ * include/sys/stat.h: Add libc_hidden_proto for __fxstatat64.
+ * sysdeps/unix/sysv/linux/fxstatat64.c: Add libc_hidden_def for
+ __fxstatat64.
+ * sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c: Add
+ __GI___fxstatat64 alias.
+
+ * libio/memstream.c (_IO_mem_finish): Fix potential memory leak if
+ realloc fails.
+
+ * include/sched.h: Add libc_hidden_proto for __sched_yield.
+
+ * libio/genops.c (_IO_unbuffer_write): Give concurrently running
+ threads the chance to work correctly by trying to lock the stream.
+ If this does not work, proceed without locking.
+
+2006-01-10 Ulrich Drepper <drepper@redhat.com>
+
+ * libio/genops.c (_IO_unbuffer_write): Don't always free the
+ buffer. This is not necessary except in debug mode. If we don't
+ free the buffer but the FILE structure to a list.
+ (buffer_free): New function. Free buffers or tell _IO_unbuffer_write
+ to do so.
+ * libio/libio.h (struct _IO_FILE): Add new members to keep track
+ of which buffers have to be freed.
+
+ * iconv/gconv_cache.c (free_mem): Don't call munmap if gconv_cache
+ is NULL.
+
+2005-10-14 Paul Eggert <eggert@cs.ucla.edu>
+
+ * malloc/obstack.c: Fix old comments. Update FSF snail mail address.
+ * malloc/obstack.h: Likewise.
+
+ [BZ #321]
+ Fix portability bugs encountered when porting to Itanium.
+ * malloc/obstack.h (obstack_empty_p, obstack_finish): Do not
+ assume that the "contents" member is suitably aligned. It is
+ not, for some hosts and alignments: e.g., Itanium, long-double.
+ * malloc/obstack.c (_obstack_begin, _obstack_begin_1,
+ _obstack_newchunk): Likewise.
+ * malloc/obstack.c: Include <stddef.h>, for size_t.
+ Include <inttypes.h>, <stdint.h> if needed and available.
+ (DEFAULT_ALIGNMENT): Now an enum constant, not a macro.
+ Use C89 offsetof rather than K&R trick.
+ Use the maximum alignment of uintmax_t, long double, void *
+ rather than the alignment of double.
+ (union fooround): Use uintmax_t, long double, void * members
+ rather than just long and double.
+
+ [BZ #321]
+ Fix portability bugs encountered when porting to the IBM iSeries,
+ where pointers are 256 bits wide and no integers are that wide.
+ * malloc/obstack.h (__PTR_TO_INT, __INT_TO_PTR): Remove.
+ All uses changed to:
+ (__BPTR_ALIGN, __PTR_ALIGN): New macros.
+ (struct _obstack_chunk.temp): Change from int to a union
+ of pointer and int. All uses changed.
+
+ [BZ #321]
+ * malloc/obstack.c (print_and_abort) [!_LIBC]:
+ Call fprintf (stderr, ...), not __fxprintf (NULL, ...).
+ [_LIBC && USE_IN_LIBIO]: Don't include <wchar.h>; no longer needed.
+
+2006-01-10 Derek Price <derek@ximbiot.com>
+ Paul Eggert <eggert@cs.ucla.edu>
+
+ [BZ #1060]
+ * posix/glob.c: Assume freestanding C89 compiler. Simplify cruft that
+ may be replaced with GNULIB modules. Make no attempt to find 64-bit
+ versions of file access functions directly when [!_LIBC].
+ Don't define GLOB_* macros here.
+ (DIRENT_MUST_BE, DIRENT_MIGHT_BE_SYMLINK, DIRENT_MIGHT_BE_DIR): New
+ macros to abstract dirent->d_type access.
+ (GETPW_R_SIZE_MAX, GET_LOGIN_NAME_MAX): New macros to abstract sysconf
+ access.
+
+2006-01-10 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+ (PTR_MANGLE): Fix cast.
+
+ * timezone/test-tz.c: Revert last change, updating to match
+ tzdata2005r definition of "MST".
+
+2006-01-10 Ulrich Drepper <drepper@redhat.com>
+
+ * include/bits/setjmp.h: Don't include jmpbuf-offsets.h if _ISOMAC is
+ defined.
+
+2006-01-10 Andreas Jaeger <aj@suse.de>
+
+ * include/time.h: Use normal comments.
+
+2006-01-10 Thomas Schwinge <tschwinge@gnu.org>
+
+ * hurd/sigunwind.c: Include <jmpbuf-unwind.h> instead of <setjmp.h>.
+ * sysdeps/mach/hurd/jmp-unwind.c: Likewise.
+
+2006-01-10 Jakub Jelinek <jakub@redhat.com>
+
+ * wcsmbs/bits/wchar2.h (vswprintf): Call __vswprintf_alias rather than
+ vswprintf recursively.
+
+2006-01-10 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/x86_64/bits/setjmp.h: Add back accidently removed #endif.
+
+2006-01-10 Roland McGrath <roland@redhat.com>
+
+ * include/bits/setjmp.h: New file.
+ * setjmp/jmpbuf-offsets.h: New file.
+ * sysdeps/alpha/bits/setjmp.h: Move JB_* macros ...
+ * sysdeps/alpha/jmpbuf-offsets.h: ... here, new file.
+ * sysdeps/hppa/bits/setjmp.h (JB_SP): Macro moved ...
+ * sysdeps/hppa/jmpbuf-offsets.h: ... here, new file.
+ * sysdeps/i386/bits/setjmp.h: Move JB_* macros ...
+ * sysdeps/i386/jmpbuf-offsets.h: ... here, new file.
+ * sysdeps/mips/bits/setjmp.h (JB_PC): Macro removed.
+ * sysdeps/powerpc/bits/setjmp.h: Move JB_* macros ...
+ * sysdeps/powerpc/jmpbuf-offsets.h: ... here, new file.
+ * sysdeps/s390/bits/setjmp.h: Remove __JB_* macros.
+ * sysdeps/sh/bits/setjmp.h (JB_SIZE): Macro moved ...
+ * sysdeps/sh/jmpbuf-offsets.h: ... here, new file.
+ * sysdeps/sparc/sparc32/bits/setjmp.h: Move JB_* macros ...
+ * sysdeps/sparc/sparc32/jmpbuf-offsets.h: ... here, new file.
+ * sysdeps/unix/sysv/linux/sparc/bits/setjmp.h: Remove JB_* macros.
+ * sysdeps/x86_64/bits/setjmp.h: Move JB_* macros ...
+ * sysdeps/x86_64/jmpbuf-offsets.h: ... here, new file.
+
+ * sysdeps/powerpc/bits/setjmp.h (_JMPBUF_UNWINDS): Move macro ...
+ * sysdeps/powerpc/jmpbuf-unwind.h: ... here.
+ * sysdeps/alpha/bits/setjmp.h (_JMPBUF_UNWINDS): Move macro ...
+ * sysdeps/alpha/jmpbuf-unwind.h: ... here.
+ * sysdeps/sparc/sparc32/bits/setjmp.h (_JMPBUF_UNWINDS): Move macro ...
+ * sysdeps/sparc/sparc32/jmpbuf-unwind.h: ... here.
+ * sysdeps/i386/bits/setjmp.h (_JMPBUF_UNWINDS): Move macro ...
+ * sysdeps/i386/jmpbuf-unwind.h: ... here.
+ * sysdeps/x86_64/bits/setjmp.h (_JMPBUF_UNWINDS): Move macro ...
+ * sysdeps/x86_64/jmpbuf-unwind.h: ... here.
+ * sysdeps/sh/bits/setjmp.h (_JMPBUF_UNWINDS): Move macro ...
+ * sysdeps/sh/jmpbuf-unwind.h: ... here.
+ * sysdeps/hppa/bits/setjmp.h (_JMPBUF_UNWINDS): Move macro ...
+ * sysdeps/hppa/jmpbuf-unwind.h: ... here, new file.
+ * sysdeps/mips/bits/setjmp.h (_JMPBUF_UNWINDS): Move macro ...
+ * sysdeps/mips/jmpbuf-unwind.h: ... here.
+ * sysdeps/m68k/bits/setjmp.h (_JMPBUF_UNWINDS): Move macro ...
+ * sysdeps/m68k/jmpbuf-unwind.h: ... here, new file.
+ * sysdeps/s390/bits/setjmp.h (_JMPBUF_UNWINDS): Move macro ...
+ * sysdeps/s390/jmpbuf-unwind.h: ... here.
+ * sysdeps/unix/sysv/linux/ia64/bits/setjmp.h (_JMPBUF_UNWINDS):
+ Move macro ...
+ * sysdeps/ia64/jmpbuf-unwind.h: ... here.
+ * sysdeps/unix/sysv/linux/sparc/bits/setjmp.h (_JMPBUF_UNWINDS):
+ Move macro ...
+ * sysdeps/sparc/sparc64/jmpbuf-unwind.h: ... here.
+
+ * sysdeps/alpha/jmpbuf-unwind.h: New file, moved from nptl/.
+ * sysdeps/i386/jmpbuf-unwind.h: New file, moved from nptl/.
+ * sysdeps/ia64/jmpbuf-unwind.h: New file, moved from nptl/.
+ * sysdeps/mips/jmpbuf-unwind.h: New file, moved from nptl/.
+ * sysdeps/powerpc/jmpbuf-unwind.h: New file, moved from nptl/.
+ * sysdeps/s390/jmpbuf-unwind.h: New file, moved from nptl/.
+ * sysdeps/sh/jmpbuf-unwind.h: New file, moved from nptl/.
+ * sysdeps/sparc/sparc32/jmpbuf-unwind.h: New file, moved from nptl/.
+ * sysdeps/sparc/sparc64/jmpbuf-unwind.h: New file, moved from nptl/.
+ * sysdeps/x86_64/jmpbuf-unwind.h: New file, moved from nptl/.
+
+ * sysdeps/linkmap.h: File removed.
+
+2006-01-07 Carlos O'Donell <carlos@systemhalted.org>
+
+ * sysdeps/hppa/elf/start.S (_start): Use PLABEL32 relocations
+ by using LR and RR. Add %sr0 to iitlbp.
+
+2006-01-09 Roland McGrath <roland@redhat.com>
+
+ * timezone/private.h: Update from tzcode2005r.
+ * timezone/tzfile.h: Likewise.
+ * timezone/zdump.c: Likewise.
+ * timezone/zic.c: Likewise.
+ * timezone/africa: Update from tzdata2005r.
+ * timezone/antarctica: Likewise.
+ * timezone/asia: Likewise.
+ * timezone/australasia: Likewise.
+ * timezone/backward: Likewise.
+ * timezone/europe: Likewise.
+ * timezone/northamerica: Likewise.
+ * timezone/southamerica: Likewise.
+ * timezone/systemv: Likewise.
+
+ * elf/Makefile ($(objpfx)reldep5.out): Fix dependency typo,
+ so we depend on $(objpfx)reldepmod6.so as intended.
+
+2006-01-09 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #2126]
+ * sysdeps/i386/i686/strtok.S: Store pointer to NUL byte if NULL is
+ returned.
+ * sysdeps/i386/strtok.S: Likewise.
+ * sysdeps/x86_64/strtok.S: Likewise.
+ * string/Makefile (tests): Add bug-strtok1.
+ * string/bug-strtok1.c: New file.
+
+ * elf/check-textrel.c (AB): Also check for writable and executable
+ segments.
+
+ * sysdeps/ieee754/dbl-64/e_exp2.c: Remove section attribute from
+ const variables, gas produces garbage.
+ * sysdeps/ieee754/flt-32/e_exp2f.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_expf.c: Likewise.
+ * sysdeps/ieee754/flt-32/s_expm1f.c: Likewise.
+
2006-01-09 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/sparc/bits/setjmp.h (_JMPBUF_UNWINDS): Add
diff --git a/Makefile b/Makefile
index 061e68da81..8a7fbf307f 100644
--- a/Makefile
+++ b/Makefile
@@ -163,6 +163,7 @@ else
installed-stubs = $(inst_includedir)/gnu/stubs-$(biarch).h
$(inst_includedir)/gnu/stubs.h: include/stubs-biarch.h $(+force)
+ $(make-target-directory)
$(INSTALL_DATA) $< $@
install-others-nosubdir: $(installed-stubs)
diff --git a/Makerules b/Makerules
index 36e2441be0..a96a03eee4 100644
--- a/Makerules
+++ b/Makerules
@@ -257,6 +257,10 @@ $(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \
\$$(compile-command.S)"; \
echo "\$$(objpfx)ptw-%$$o: $$dir/%.s \$$(before-compile); \
\$$(compile-command.s)"; \
+ echo "\$$(objpfx)m_%$$o: $$dir/s_%.S \$$(before-compile); \
+ \$$(compile-command.S)"; \
+ echo "\$$(objpfx)m_%$$o: $$dir/s_%.s \$$(before-compile); \
+ \$$(compile-command.s)"; \
$(close-check-inhibit-asm) \
echo "\$$(objpfx)%$$o: $$dir/%.c \$$(before-compile); \
\$$(compile-command.c)"; \
@@ -264,11 +268,12 @@ $(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \
\$$(compile-command.c)"; \
echo "\$$(objpfx)ptw-%$$o: $$dir/%.c \$$(before-compile); \
\$$(compile-command.c)"; \
+ echo "\$$(objpfx)m_%$$o: $$dir/s_%.c \$$(before-compile); \
+ \$$(compile-command.c)"; \
done; \
- echo "\$$(objpfx)m_%.S: $$dir/s_%.S; \$$(+make-include-of-dep)"; \
- echo "\$$(objpfx)m_%.c: $$dir/s_%.c; \$$(+make-include-of-dep)"; \
+ echo "\$$(inst_includedir)/%.h: $$dir/%.h \$$(+force); \
+ \$$(do-install)"; \
done; \
- echo "\$$(objpfx)m_%.c: s_%.c; \$$(+make-include-of-dep)"; \
echo 'sysd-rules-done = t') > $@T
mv -f $@T $@
@@ -277,17 +282,6 @@ ifndef sysd-rules-done
no_deps=t
endif
-# This is used by the m_%.[Sc] pattern rules in sysd-rules.
-define +make-include-of-dep
-echo '#include <$<>' > $@T
-mv -f $@T $@
-endef
-
-# It matters that this set of rules, for compiling from sources in
-# the current directory (the $srcdir/$subdir) come before the
-# generated sysdep rules in included from sysd-rules below. When
-# compiling in the source tree, generated sources go into the current
-# directory, and those should be chosen before any sources in sysdeps.
define o-iterator-doit
$(objpfx)%$o: %.S $(before-compile); $$(compile-command.S)
endef
@@ -572,6 +566,11 @@ define build-module
$(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \
$(csu-objpfx)abi-note.o $(build-module-objlist)
endef
+define build-module-asneeded
+$(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \
+ $(csu-objpfx)abi-note.o \
+ -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed
+endef
else
ifneq (,$(findstring aix,$(config-os)))
define build-module
@@ -1121,8 +1120,21 @@ $(addprefix $(inst_datadir)/,$(install-data)): $(inst_datadir)/%: % $(+force)
endif
headers := $(strip $(headers))
ifdef headers
-$(addprefix $(inst_includedir)/,$(headers)): $(inst_includedir)/%: % $(+force)
+# This implicit rule installs headers from the source directory.
+# It may be ignored in preference to rules from sysd-rules to find
+# headers in the sysdeps tree.
+$(inst_includedir)/%.h: $(objpfx)%.h $(+force)
+ $(do-install)
+$(inst_includedir)/%.h: %.h $(+force)
+ $(do-install)
+$(inst_includedir)/%.h: $(..)include/%.h $(+force)
+ $(do-install)
+headers-nonh := $(filter-out %.h,$(headers))
+ifdef headers-nonh
+$(addprefix $(inst_includedir)/,$(headers-nonh)): $(inst_includedir)/%: \
+ % $(+force)
$(do-install)
+endif # headers-nonh
endif # headers
.PHONY: install-bin-nosubdir install-bin-script-nosubdir \
diff --git a/debug/fprintf_chk.c b/debug/fprintf_chk.c
index 2b7d22b6a6..58b5fb2b3e 100644
--- a/debug/fprintf_chk.c
+++ b/debug/fprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -24,7 +24,7 @@
/* Write formatted output to FP from the format string FORMAT. */
int
-__fprintf_chk (FILE *fp, int flag, const char *format, ...)
+___fprintf_chk (FILE *fp, int flag, const char *format, ...)
{
va_list ap;
int done;
@@ -43,3 +43,4 @@ __fprintf_chk (FILE *fp, int flag, const char *format, ...)
return done;
}
+ldbl_strong_alias (___fprintf_chk, __fprintf_chk)
diff --git a/debug/printf_chk.c b/debug/printf_chk.c
index 86096b45c0..b8f00965dc 100644
--- a/debug/printf_chk.c
+++ b/debug/printf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -24,7 +24,7 @@
/* Write formatted output to stdout from the format string FORMAT. */
int
-__printf_chk (int flag, const char *format, ...)
+___printf_chk (int flag, const char *format, ...)
{
va_list ap;
int done;
@@ -43,3 +43,4 @@ __printf_chk (int flag, const char *format, ...)
return done;
}
+ldbl_strong_alias (___printf_chk, __printf_chk)
diff --git a/debug/snprintf_chk.c b/debug/snprintf_chk.c
index 5a77afef29..315d47c88b 100644
--- a/debug/snprintf_chk.c
+++ b/debug/snprintf_chk.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 1995, 1997, 1998, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1997, 1998, 2004, 2006
+ 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
@@ -16,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <libioP.h>
#include <stdarg.h>
#include <stdio.h>
@@ -24,8 +26,8 @@
string FORMAT, writing no more than MAXLEN characters. */
/* VARARGS5 */
int
-__snprintf_chk (char *s, size_t maxlen, int flags, size_t slen,
- const char *format, ...)
+___snprintf_chk (char *s, size_t maxlen, int flags, size_t slen,
+ const char *format, ...)
{
va_list arg;
int done;
@@ -36,3 +38,4 @@ __snprintf_chk (char *s, size_t maxlen, int flags, size_t slen,
return done;
}
+ldbl_strong_alias (___snprintf_chk, __snprintf_chk)
diff --git a/debug/sprintf_chk.c b/debug/sprintf_chk.c
index d141633b9f..658c0cccda 100644
--- a/debug/sprintf_chk.c
+++ b/debug/sprintf_chk.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,1995,1997,1998,2002,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1997, 1998, 2002, 2004, 2006
+ 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
@@ -16,13 +17,14 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <libioP.h>
#include <stdarg.h>
#include <stdio.h>
/* Write formatted output into S, according to the format string FORMAT. */
/* VARARGS4 */
int
-__sprintf_chk (char *s, int flags, size_t slen, const char *format, ...)
+___sprintf_chk (char *s, int flags, size_t slen, const char *format, ...)
{
va_list arg;
int done;
@@ -33,3 +35,4 @@ __sprintf_chk (char *s, int flags, size_t slen, const char *format, ...)
return done;
}
+ldbl_strong_alias (___sprintf_chk, __sprintf_chk)
diff --git a/debug/vfprintf_chk.c b/debug/vfprintf_chk.c
index 10dde3cb1e..bd2796eaf7 100644
--- a/debug/vfprintf_chk.c
+++ b/debug/vfprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -24,7 +24,7 @@
/* Write formatted output to FP from the format string FORMAT. */
int
-__vfprintf_chk (FILE *fp, int flag, const char *format, va_list ap)
+___vfprintf_chk (FILE *fp, int flag, const char *format, va_list ap)
{
int done;
@@ -40,4 +40,5 @@ __vfprintf_chk (FILE *fp, int flag, const char *format, va_list ap)
return done;
}
-libc_hidden_def (__vfprintf_chk)
+ldbl_hidden_def (___vfprintf_chk, __vfprintf_chk)
+ldbl_strong_alias (___vfprintf_chk, __vfprintf_chk)
diff --git a/debug/vfwprintf_chk.c b/debug/vfwprintf_chk.c
index d4af557ae4..a2612d53e9 100644
--- a/debug/vfwprintf_chk.c
+++ b/debug/vfwprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -40,3 +40,4 @@ __vfwprintf_chk (FILE *fp, int flag, const wchar_t *format, va_list ap)
return done;
}
+libc_hidden_def (__vfwprintf_chk)
diff --git a/debug/vprintf_chk.c b/debug/vprintf_chk.c
index 1fd5bcd849..68a63ee7f9 100644
--- a/debug/vprintf_chk.c
+++ b/debug/vprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -24,7 +24,7 @@
/* Write formatted output to stdout from the format string FORMAT. */
int
-__vprintf_chk (int flag, const char *format, va_list ap)
+___vprintf_chk (int flag, const char *format, va_list ap)
{
int done;
@@ -40,3 +40,4 @@ __vprintf_chk (int flag, const char *format, va_list ap)
return done;
}
+ldbl_strong_alias (___vprintf_chk, __vprintf_chk)
diff --git a/debug/vsnprintf_chk.c b/debug/vsnprintf_chk.c
index a0fd4ebfdc..c46937ff6f 100644
--- a/debug/vsnprintf_chk.c
+++ b/debug/vsnprintf_chk.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 1995, 1997, 1998, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1997, 1998, 2004, 2006
+ 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
@@ -27,8 +28,8 @@ extern const struct _IO_jump_t _IO_strn_jumps attribute_hidden;
string FORMAT, writing no more than MAXLEN characters. */
/* VARARGS5 */
int
-__vsnprintf_chk (char *s, size_t maxlen, int flags, size_t slen,
- const char *format, va_list args)
+___vsnprintf_chk (char *s, size_t maxlen, int flags, size_t slen,
+ const char *format, va_list args)
{
/* XXX Maybe for less strict version do not fail immediately.
Though, maxlen is supposed to be the size of buffer pointed
@@ -67,4 +68,5 @@ __vsnprintf_chk (char *s, size_t maxlen, int flags, size_t slen,
*sf.f._sbf._f._IO_write_ptr = '\0';
return ret;
}
-libc_hidden_def (__vsnprintf_chk)
+ldbl_hidden_def (___vsnprintf_chk, __vsnprintf_chk)
+ldbl_strong_alias (___vsnprintf_chk, __vsnprintf_chk)
diff --git a/debug/vsprintf_chk.c b/debug/vsprintf_chk.c
index f41c5fc64b..6538064dce 100644
--- a/debug/vsprintf_chk.c
+++ b/debug/vsprintf_chk.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1994, 1997, 1999-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1997, 1999-2003, 2004, 2006
+ 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
@@ -61,8 +62,8 @@ static const struct _IO_jump_t _IO_str_chk_jumps =
int
-__vsprintf_chk (char *s, int flags, size_t slen, const char *format,
- va_list args)
+___vsprintf_chk (char *s, int flags, size_t slen, const char *format,
+ va_list args)
{
_IO_strfile f;
int ret;
@@ -88,4 +89,5 @@ __vsprintf_chk (char *s, int flags, size_t slen, const char *format,
*f._sbf._f._IO_write_ptr = '\0';
return ret;
}
-libc_hidden_def (__vsprintf_chk)
+ldbl_hidden_def (___vsprintf_chk, __vsprintf_chk)
+ldbl_strong_alias (___vsprintf_chk, __vsprintf_chk)
diff --git a/dirent/Makefile b/dirent/Makefile
index ba492ca781..ef639f2095 100644
--- a/dirent/Makefile
+++ b/dirent/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2000, 2002, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1991-2000,2002,2003,2005,2006 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -28,7 +28,8 @@ routines := opendir closedir readdir readdir_r rewinddir \
alphasort64 versionsort64 fdopendir
distribute := dirstream.h
-tests := list tst-seekdir opendir-tst1 bug-readdir1 tst-fdopendir
+tests := list tst-seekdir opendir-tst1 bug-readdir1 tst-fdopendir \
+ tst-fdopendir2
CFLAGS-scandir.c = $(uses-callbacks)
CFLAGS-scandir64.c = $(uses-callbacks)
diff --git a/dirent/tst-fdopendir2.c b/dirent/tst-fdopendir2.c
new file mode 100644
index 0000000000..3720809dc2
--- /dev/null
+++ b/dirent/tst-fdopendir2.c
@@ -0,0 +1,41 @@
+#include <errno.h>
+#include <dirent.h>
+#include <stdio.h>
+#include <unistd.h>
+
+
+static int
+do_test (void)
+{
+ char tmpl[] = "/tmp/tst-fdopendir2-XXXXXX";
+ int fd = mkstemp (tmpl);
+ if (fd == -1)
+ {
+ puts ("cannot open temp file");
+ return 1;
+ }
+
+ errno = 0;
+ DIR *d = fdopendir (fd);
+
+ int e = errno;
+
+ close (fd);
+ unlink (tmpl);
+
+ if (d != NULL)
+ {
+ puts ("fdopendir with normal file descriptor did not fail");
+ return 1;
+ }
+ if (e != ENOTDIR)
+ {
+ printf ("fdopendir set errno to %d, not %d as expected\n", e, ENOTDIR);
+ return 1;
+ }
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/elf/Makefile b/elf/Makefile
index 91fb218ccd..5cd78c2f83 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1995-2004, 2005, 2006 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
@@ -647,7 +647,7 @@ $(objpfx)dblunload: $(libdl)
$(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
$(objpfx)reldep5: $(libdl)
-$(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod5.so
+$(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
$(objpfx)reldep6: $(libdl)
$(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
@@ -806,6 +806,10 @@ check-textrel-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
$(objpfx)check-textrel: check-textrel.c
$(native-compile)
+check-localplt-CFLAGS = -O -Wall -D_GNU_SOURCE -std=gnu99
+$(objpfx)check-localplt: check-localplt.c
+ $(native-compile)
+
ifeq (yes,$(build-shared))
tests: $(objpfx)check-textrel.out
@@ -818,6 +822,28 @@ generated += check-textrel check-textrel.out
$(objpfx)tst-dlmodcount: $(libdl)
$(objpfx)tst-dlmodcount.out: $(test-modules)
+check-data := $(firstword $(wildcard \
+ $(foreach M,$(config-machine) $(base-machine),\
+ ../scripts/data/localplt-$M-$(config-os).data)))
+ifneq (,$(check-data))
+tests: $(objpfx)check-localplt.out
+
+ifeq ($(have-thread-library),yes)
+thread-dso := $(filter-out %_nonshared.a, $(shared-thread-library))
+endif
+
+$(objpfx)check-localplt.out: $(objpfx)check-localplt $(common-objpfx)libc.so \
+ $(common-objpfx)math/libm.so $(thread-dso) \
+ $(common-objpfx)rt/librt.so \
+ $(common-objpfx)dlfcn/libdl.so \
+ $(check-data)
+ $(objpfx)check-localplt $(common-objpfx)libc.so \
+ $(common-objpfx)math/libm.so $(thread-dso) \
+ $(common-objpfx)rt/librt.so \
+ $(common-objpfx)dlfcn/libdl.so | \
+ LC_ALL=C sort | \
+ diff -u $(check-data) - > $@
+endif
endif
$(objpfx)tst-dlopenrpathmod.so: $(libdl)
diff --git a/elf/check-localplt.c b/elf/check-localplt.c
new file mode 100644
index 0000000000..b4358a8a3f
--- /dev/null
+++ b/elf/check-localplt.c
@@ -0,0 +1,299 @@
+/* Show local PLT use in DSOs.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contribute by Ulrich Drepper <drepper@redhat.com>. 2006.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <byteswap.h>
+#include <elf.h>
+#include <endian.h>
+#include <fcntl.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+#ifdef BITS
+
+# define AB(name) _AB (name, BITS)
+# define _AB(name, bits) __AB (name, bits)
+# define __AB(name, bits) name##bits
+# define E(name) _E (name, BITS)
+# define _E(name, bits) __E (name, bits)
+# define __E(name, bits) Elf##bits##_##name
+# define EE(name) _EE (name, BITS)
+# define _EE(name, bits) __EE (name, bits)
+# define __EE(name, bits) ELF##bits##_##name
+# define SWAP(val) \
+ ({ __typeof (val) __res; \
+ if (((ehdr.e_ident[EI_DATA] == ELFDATA2MSB \
+ && BYTE_ORDER == LITTLE_ENDIAN) \
+ || (ehdr.e_ident[EI_DATA] == ELFDATA2LSB \
+ && BYTE_ORDER == BIG_ENDIAN)) \
+ && sizeof (val) != 1) \
+ { \
+ if (sizeof (val) == 2) \
+ __res = bswap_16 (val); \
+ else if (sizeof (val) == 4) \
+ __res = bswap_32 (val); \
+ else \
+ __res = bswap_64 (val); \
+ } \
+ else \
+ __res = (val); \
+ __res; })
+
+
+static int
+AB(handle_file) (const char *fname, int fd)
+{
+ E(Ehdr) ehdr;
+
+ if (pread (fd, &ehdr, sizeof (ehdr), 0) != sizeof (ehdr))
+ {
+ read_error:
+ printf ("%s: read error: %m\n", fname);
+ return 1;
+ }
+
+ const size_t phnum = SWAP (ehdr.e_phnum);
+ const size_t phentsize = SWAP (ehdr.e_phentsize);
+
+ /* Read the program header. */
+ E(Phdr) *phdr = alloca (phentsize * phnum);
+ if (pread (fd, phdr, phentsize * phnum, SWAP (ehdr.e_phoff))
+ != phentsize * phnum)
+ goto read_error;
+
+ /* Search for the PT_DYNAMIC entry. */
+ size_t cnt;
+ E(Phdr) *dynphdr = NULL;
+ for (cnt = 0; cnt < phnum; ++cnt)
+ if (SWAP (phdr[cnt].p_type) == PT_DYNAMIC)
+ {
+ dynphdr = &phdr[cnt];
+ break;
+ }
+
+ if (dynphdr == NULL)
+ {
+ printf ("%s: no DYNAMIC segment found\n", fname);
+ return 1;
+ }
+
+ /* Read the dynamic segment. */
+ size_t pmemsz = SWAP(dynphdr->p_memsz);
+ E(Dyn) *dyn = alloca (pmemsz);
+ if (pread64 (fd, dyn, pmemsz, SWAP(dynphdr->p_offset)) != pmemsz)
+ goto read_error;
+
+ /* Search for an DT_PLTREL, DT_JMPREL, DT_PLTRELSZ, DT_STRTAB,
+ DT_STRSZ, and DT_SYMTAB entries. */
+ size_t pltrel_idx = SIZE_MAX;
+ size_t jmprel_idx = SIZE_MAX;
+ size_t pltrelsz_idx = SIZE_MAX;
+ size_t strtab_idx = SIZE_MAX;
+ size_t strsz_idx = SIZE_MAX;
+ size_t symtab_idx = SIZE_MAX;
+ for (cnt = 0; (cnt + 1) * sizeof (E(Dyn)) - 1 < pmemsz; ++cnt)
+ {
+ unsigned int tag = SWAP (dyn[cnt].d_tag);
+
+ if (tag == DT_NULL)
+ /* We reached the end. */
+ break;
+
+ if (tag == DT_PLTREL)
+ pltrel_idx = cnt;
+ else if (tag == DT_JMPREL)
+ jmprel_idx = cnt;
+ else if (tag == DT_PLTRELSZ)
+ pltrelsz_idx = cnt;
+ else if (tag == DT_STRTAB)
+ strtab_idx = cnt;
+ else if (tag == DT_STRSZ)
+ strsz_idx = cnt;
+ else if (tag == DT_SYMTAB)
+ symtab_idx = cnt;
+ }
+
+ if (pltrel_idx == SIZE_MAX || jmprel_idx == SIZE_MAX
+ || pltrelsz_idx == SIZE_MAX || strtab_idx == SIZE_MAX
+ || strsz_idx == SIZE_MAX || symtab_idx == SIZE_MAX)
+ {
+ puts ("not all PLT information found");
+ return 1;
+ }
+
+ E(Xword) relsz = SWAP (dyn[pltrelsz_idx].d_un.d_val);
+
+ void *relmem = NULL;
+ char *strtab = NULL;
+ E(Xword) symtab_offset = 0;
+
+ /* Find the offset of DT_JMPREL and load the data. */
+ for (cnt = 0; cnt < phnum; ++cnt)
+ if (SWAP (phdr[cnt].p_type) == PT_LOAD)
+ {
+ E(Addr) vaddr = SWAP (phdr[cnt].p_vaddr);
+ E(Xword) memsz = SWAP (phdr[cnt].p_memsz);
+
+ if (vaddr <= SWAP (dyn[jmprel_idx].d_un.d_val)
+ && vaddr + memsz >= SWAP (dyn[jmprel_idx].d_un.d_val) + relsz)
+ {
+ relmem = alloca (SWAP (dyn[pltrelsz_idx].d_un.d_val));
+ if (pread64 (fd, relmem, relsz,
+ SWAP (phdr[cnt].p_offset)
+ + SWAP (dyn[jmprel_idx].d_un.d_val) - vaddr)
+ != relsz)
+ {
+ puts ("cannot read JMPREL");
+ return 1;
+ }
+ }
+
+ if (vaddr <= SWAP (dyn[symtab_idx].d_un.d_val)
+ && vaddr + memsz > SWAP (dyn[symtab_idx].d_un.d_val))
+ symtab_offset = (SWAP (phdr[cnt].p_offset)
+ + SWAP (dyn[symtab_idx].d_un.d_val) - vaddr);
+
+ if (vaddr <= SWAP (dyn[strtab_idx].d_un.d_val)
+ && vaddr + memsz >= (SWAP (dyn[strtab_idx].d_un.d_val)
+ + SWAP(dyn[strsz_idx].d_un.d_val)))
+ {
+ strtab = alloca (SWAP(dyn[strsz_idx].d_un.d_val));
+ if (pread64 (fd, strtab, SWAP(dyn[strsz_idx].d_un.d_val),
+ SWAP (phdr[cnt].p_offset)
+ + SWAP (dyn[strtab_idx].d_un.d_val) - vaddr)
+ != SWAP(dyn[strsz_idx].d_un.d_val))
+ {
+ puts ("cannot read STRTAB");
+ return 1;
+ }
+ }
+ }
+
+ if (relmem == NULL || strtab == NULL || symtab_offset == 0)
+ {
+ puts ("couldn't load PLT data");
+ return 1;
+ }
+
+ if (SWAP (dyn[pltrel_idx].d_un.d_val) == DT_RELA)
+ for (E(Rela) *rela = relmem; (char *) rela - (char *) relmem < relsz;
+ ++rela)
+ {
+ E(Sym) sym;
+
+ if (pread64 (fd, &sym, sizeof (sym),
+ symtab_offset
+ + EE(R_SYM) (SWAP (rela->r_info)) * sizeof (sym))
+ != sizeof (sym))
+ {
+ puts ("cannot read symbol");
+ return 1;
+ }
+
+ if (sym.st_value != 0)
+ /* This symbol is locally defined. */
+ printf ("%s: %s\n", basename (fname), strtab + SWAP (sym.st_name));
+ }
+ else
+ for (E(Rel) *rel = relmem; (char *) rel - (char *) relmem < relsz; ++rel)
+ {
+ E(Sym) sym;
+
+ if (pread64 (fd, &sym, sizeof (sym),
+ symtab_offset
+ + EE(R_SYM) (SWAP (rel->r_info)) * sizeof (sym))
+ != sizeof (sym))
+ {
+ puts ("cannot read symbol");
+ return 1;
+ }
+
+ if (sym.st_value != 0)
+ /* This symbol is locally defined. */
+ printf ("%s: %s\n", basename (fname), strtab + SWAP (sym.st_name));
+ }
+
+ return 0;
+}
+
+# undef BITS
+#else
+
+# define BITS 32
+# include "check-localplt.c"
+
+# define BITS 64
+# include "check-localplt.c"
+
+
+static int
+handle_file (const char *fname)
+{
+ int fd = open (fname, O_RDONLY);
+ if (fd == -1)
+ {
+ printf ("cannot open %s: %m\n", fname);
+ return 1;
+ }
+
+ /* Read was is supposed to be the ELF header. Read the initial
+ bytes to determine whether this is a 32 or 64 bit file. */
+ char ident[EI_NIDENT];
+ if (read (fd, ident, EI_NIDENT) != EI_NIDENT)
+ {
+ printf ("%s: read error: %m\n", fname);
+ close (fd);
+ return 1;
+ }
+
+ if (memcmp (&ident[EI_MAG0], ELFMAG, SELFMAG) != 0)
+ {
+ printf ("%s: not an ELF file\n", fname);
+ close (fd);
+ return 1;
+ }
+
+ int result;
+ if (ident[EI_CLASS] == ELFCLASS64)
+ result = handle_file64 (fname, fd);
+ else
+ result = handle_file32 (fname, fd);
+
+ close (fd);
+
+ return result;
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ int cnt;
+ int result = 0;
+
+ for (cnt = 1; cnt < argc; ++cnt)
+ result |= handle_file (argv[cnt]);
+
+ return result;
+}
+#endif
diff --git a/elf/check-textrel.c b/elf/check-textrel.c
index ec97e4b0c9..2b9639ff19 100644
--- a/elf/check-textrel.c
+++ b/elf/check-textrel.c
@@ -1,5 +1,5 @@
/* Check for text relocations in DSOs.
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contribute by Ulrich Drepper <drepper@redhat.com>. 2002.
@@ -79,20 +79,28 @@ AB(handle_file) (const char *fname, int fd)
/* Search for the PT_DYNAMIC entry. */
size_t cnt;
+ E(Phdr) *dynphdr = NULL;
for (cnt = 0; cnt < phnum; ++cnt)
if (SWAP (phdr[cnt].p_type) == PT_DYNAMIC)
- break;
-
- if (cnt == phnum)
+ dynphdr = &phdr[cnt];
+ else if (SWAP (phdr[cnt].p_type) == PT_LOAD
+ && (SWAP (phdr[cnt].p_flags) & (PF_X | PF_W)) == (PF_X | PF_W))
+ {
+ printf ("%s: segment %zu is executable and writable\n",
+ fname, cnt);
+ return 1;
+ }
+
+ if (dynphdr == NULL)
{
printf ("%s: no DYNAMIC segment found\n", fname);
return 1;
}
/* Read the dynamic segment. */
- size_t pmemsz = SWAP(phdr[cnt].p_memsz);
+ size_t pmemsz = SWAP(dynphdr->p_memsz);
E(Dyn) *dyn = alloca (pmemsz);
- if (pread (fd, dyn, pmemsz, SWAP(phdr[cnt].p_offset)) != pmemsz)
+ if (pread (fd, dyn, pmemsz, SWAP(dynphdr->p_offset)) != pmemsz)
goto read_error;
/* Search for an DT_TEXTREL entry of DT_FLAGS with the DF_TEXTREL
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index a73e21db7b..fd3b5243fd 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -247,6 +247,7 @@ _dl_map_object_deps (struct link_map *map,
if (__builtin_expect (errstring != NULL, 0))
{
char *new_errstring = strdupa (errstring);
+ objname = strdupa (objname);
if (malloced)
free ((char *) errstring);
errstring = new_errstring;
@@ -337,6 +338,7 @@ _dl_map_object_deps (struct link_map *map,
if (__builtin_expect (errstring != NULL, 0))
{
char *new_errstring = strdupa (errstring);
+ objname = strdupa (objname);
if (malloced)
free ((char *) errstring);
errstring = new_errstring;
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 422e153c10..77ef6ab14a 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora
glibc-base := HEAD
DIST_BRANCH := devel
COLLECTION := dist-fc4
-fedora-sync-date := 2006-01-09 21:52 UTC
-fedora-sync-tag := fedora-glibc-20060109T2152
+fedora-sync-date := 2006-01-30 09:22 UTC
+fedora-sync-tag := fedora-glibc-20060130T0922
diff --git a/hurd/sigunwind.c b/hurd/sigunwind.c
index 67f78c1ce5..31dbe2a10e 100644
--- a/hurd/sigunwind.c
+++ b/hurd/sigunwind.c
@@ -1,5 +1,5 @@
/* longjmp cleanup function for unwinding past signal handlers.
- Copyright (C) 1995, 1996, 1997, 1998, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995,1996,1997,1998,2005,2006 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
@@ -19,7 +19,7 @@
#include <hurd.h>
#include <thread_state.h>
-#include <setjmp.h>
+#include <jmpbuf-unwind.h>
#include <assert.h>
#include <stdint.h>
diff --git a/iconv/gconv_cache.c b/iconv/gconv_cache.c
index 9a8a20816c..716c384de2 100644
--- a/iconv/gconv_cache.c
+++ b/iconv/gconv_cache.c
@@ -467,7 +467,7 @@ libc_freeres_fn (free_mem)
if (cache_malloced)
free (gconv_cache);
#ifdef _POSIX_MAPPED_FILES
- else
+ else if (gconv_cache != NULL)
__munmap (gconv_cache, cache_size);
#endif
}
diff --git a/iconvdata/extra-module.mk b/iconvdata/extra-module.mk
index 7eda4e25aa..163074fea4 100644
--- a/iconvdata/extra-module.mk
+++ b/iconvdata/extra-module.mk
@@ -5,12 +5,14 @@ extra-objs := $(extra-objs) $(patsubst %,%.os,$($(mod)-routines))
$(objpfx)$(mod).so: $(addprefix $(objpfx),$(addsuffix .os,$($(mod)-routines)))\
$(common-objpfx)shlib.lds
- $(build-module)
+ $(build-module-asneeded)
# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
# This ensures they will load libc.so for needed symbols if loaded by
# a statically-linked program that hasn't already loaded it.
-$(objpfx)$(mod).so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
+$(objpfx)$(mod).so: $(common-objpfx)libc.so \
+ $(common-objpfx)/elf/ld.so \
+ $(common-objpfx)libc_nonshared.a
ifneq (,$(extra-modules-left))
include extra-module.mk
diff --git a/include/fcntl.h b/include/fcntl.h
index 610e322cfd..f00881449d 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -25,4 +25,8 @@ extern void __atfct_seterrno_2 (int errval, int fd1, const char *buf1,
int fd2, const char *buf2)
attribute_hidden;
+
+/* Flag determining whether the *at system calls are available. */
+extern int __have_atfcts attribute_hidden;
+
#endif
diff --git a/include/sched.h b/include/sched.h
index 4a142c69af..7b057ea833 100644
--- a/include/sched.h
+++ b/include/sched.h
@@ -10,6 +10,7 @@ extern int __sched_setscheduler (__pid_t __pid, int __policy,
libc_hidden_proto (__sched_setscheduler)
extern int __sched_getscheduler (__pid_t __pid);
extern int __sched_yield (void);
+libc_hidden_proto (__sched_yield)
extern int __sched_get_priority_max (int __algorithm);
extern int __sched_get_priority_min (int __algorithm);
extern int __sched_rr_get_interval (__pid_t __pid, struct timespec *__t);
diff --git a/include/stdlib.h b/include/stdlib.h
index 89bee37c0a..27111b8a85 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -25,10 +25,6 @@ libc_hidden_proto (abort)
libc_hidden_proto (getenv)
libc_hidden_proto (bsearch)
libc_hidden_proto (qsort)
-libc_hidden_proto (ecvt_r)
-libc_hidden_proto (fcvt_r)
-libc_hidden_proto (qecvt_r)
-libc_hidden_proto (qfcvt_r)
libc_hidden_proto (lrand48_r)
libc_hidden_proto (wctomb)
libc_hidden_proto (__secure_getenv)
@@ -186,6 +182,28 @@ __NTH (__strtoull_l (__const char * __restrict __nptr,
return ____strtoull_l_internal (__nptr, __endptr, __base, 0, __loc);
}
+extern char *__ecvt (double __value, int __ndigit, int *__restrict __decpt,
+ int *__restrict __sign);
+extern char *__fcvt (double __value, int __ndigit, int *__restrict __decpt,
+ int *__restrict __sign);
+extern char *__gcvt (double __value, int __ndigit, char *__buf);
+extern int __ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
+ int *__restrict __sign, char *__restrict __buf,
+ size_t __len);
+extern int __fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
+ int *__restrict __sign, char *__restrict __buf,
+ size_t __len);
+extern char *__qecvt (long double __value, int __ndigit,
+ int *__restrict __decpt, int *__restrict __sign);
+extern char *__qfcvt (long double __value, int __ndigit,
+ int *__restrict __decpt, int *__restrict __sign);
+extern char *__qgcvt (long double __value, int __ndigit, char *__buf);
+extern int __qecvt_r (long double __value, int __ndigit,
+ int *__restrict __decpt, int *__restrict __sign,
+ char *__restrict __buf, size_t __len);
+extern int __qfcvt_r (long double __value, int __ndigit,
+ int *__restrict __decpt, int *__restrict __sign,
+ char *__restrict __buf, size_t __len);
# ifndef NOT_IN_libc
# undef MB_CUR_MAX
diff --git a/include/sys/stat.h b/include/sys/stat.h
index 4a4d05d938..72105a45a9 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -31,6 +31,8 @@ extern __inline__ int __mknod (__const char *__path, __mode_t __mode,
}
libc_hidden_proto (__xmknodat)
+libc_hidden_proto (__fxstatat64)
+
/* The `stat', `fstat', `lstat' functions have to be handled special since
even while not compiling the library with optimization calls to these
diff --git a/include/time.h b/include/time.h
index adf2dea1ec..224736540b 100644
--- a/include/time.h
+++ b/include/time.h
@@ -92,7 +92,7 @@ extern int __getclktck (void);
/* strptime support. */
/* Status of lookup: do we use the locale data or the raw data? */
#ifndef __cplusplus
-// C++ cannot deal with using 'not'.
+/* C++ cannot deal with using 'not'. */
enum ptime_locale_status { not, loc, raw };
extern char * __strptime_internal (const char *rp, const char *fmt,
diff --git a/include/wchar.h b/include/wchar.h
index e8079e6d80..89e9a4f81e 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -107,18 +107,21 @@ extern int __vswprintf (wchar_t *__restrict __s, size_t __n,
/* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
extern int __fwprintf (__FILE *__restrict __s,
__const wchar_t *__restrict __format, ...)
- /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+ /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
extern int __vfwprintf (__FILE *__restrict __s,
__const wchar_t *__restrict __format,
__gnuc_va_list __arg)
+ /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
+extern int __vfwprintf_chk (FILE *__restrict __s, int __flag,
+ const wchar_t *__restrict __format,
+ __gnuc_va_list __arg)
/* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
int __flag, size_t __s_len,
__const wchar_t *__restrict __format,
__gnuc_va_list __arg)
/* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
+libc_hidden_proto (__vfwprintf_chk)
libc_hidden_proto (__vswprintf_chk)
/* Internal functions. */
diff --git a/io/Makefile b/io/Makefile
index 5e6d72eace..895b3e3a73 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -48,7 +48,7 @@ routines := \
ttyname ttyname_r isatty \
link linkat symlink symlinkat readlink readlinkat \
unlink unlinkat rmdir \
- ftw ftw64 fts poll \
+ ftw ftw64 fts poll ppoll \
posix_fadvise posix_fadvise64 \
posix_fallocate posix_fallocate64 \
sendfile sendfile64
@@ -64,7 +64,9 @@ test-srcs := ftwtest
tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs \
tst-openat tst-unlinkat tst-fstatat tst-futimesat \
- tst-renameat tst-fchownat tst-fchmodat tst-faccessat
+ tst-renameat tst-fchownat tst-fchmodat tst-faccessat \
+ tst-symlinkat tst-linkat tst-readlinkat tst-mkdirat \
+ tst-mknodat tst-mkfifoat
distribute := ftwtest-sh
@@ -72,6 +74,7 @@ include ../Rules
CFLAGS-fcntl.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-poll.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-ppoll.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-lockf.c = -fexceptions
CFLAGS-statfs.c = -fexceptions
CFLAGS-fstatfs.c = -fexceptions
diff --git a/io/Versions b/io/Versions
index 16006a8e08..bc9c9d2685 100644
--- a/io/Versions
+++ b/io/Versions
@@ -110,5 +110,7 @@ libc {
readlinkat;
symlinkat;
unlinkat;
+
+ ppoll;
}
}
diff --git a/io/ppoll.c b/io/ppoll.c
new file mode 100644
index 0000000000..a035cfeb1f
--- /dev/null
+++ b/io/ppoll.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <limits.h>
+#include <signal.h>
+#include <stddef.h> /* For NULL. */
+#include <sys/poll.h>
+#include <sysdep-cancel.h>
+
+
+int
+ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
+ const sigset_t *sigmask)
+{
+ int tval = -1;
+
+ /* poll uses a simple millisecond value. Convert it. */
+ if (timeout != NULL)
+ {
+ if (timeout->tv_sec < 0
+ || timeout->tv_nsec < 0 || timeout->tv_nsec >= 1000000000)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (timeout->tv_sec > INT_MAX / 1000
+ || (timeout->tv_sec == INT_MAX / 1000
+ && ((timeout->tv_nsec + 999999) / 1000000 > INT_MAX % 1000)))
+ /* We cannot represent the timeout in an int value. Wait
+ forever. */
+ tval = -1;
+ else
+ tval = (timeout->tv_sec * 1000
+ + (timeout->tv_nsec + 999999) / 1000000);
+ }
+
+ /* The setting and restoring of the signal mask and the select call
+ should be an atomic operation. This can't be done without kernel
+ help. */
+ sigset_t savemask;
+ if (sigmask != NULL)
+ __sigprocmask (SIG_SETMASK, sigmask, &savemask);
+
+ /* Note the ppoll() is a cancellation point. But since we call
+ poll() which itself is a cancellation point we do not have
+ to do anything here. */
+ int retval = __poll (fds, nfds, tval);
+
+ if (sigmask != NULL)
+ __sigprocmask (SIG_SETMASK, &savemask, NULL);
+
+ return retval;
+}
+
+#ifndef ppoll
+/* __poll handles cancellation. */
+LIBC_CANCEL_HANDLED ();
+#endif
diff --git a/io/sys/poll.h b/io/sys/poll.h
index 9cf1b9f1c0..4085b785ee 100644
--- a/io/sys/poll.h
+++ b/io/sys/poll.h
@@ -1,5 +1,5 @@
/* Compatibility definitions for System V `poll' interface.
- Copyright (C) 1994,1996-2001,2004,2005 Free Software Foundation, Inc.
+ Copyright (C) 1994,1996-2001,2004,2005,2006 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
@@ -24,6 +24,13 @@
/* Get the platform dependent bits of `poll'. */
#include <bits/poll.h>
+#ifdef __USE_GNU
+/* Get the __sigset_t definition. */
+# include <bits/sigset.h>
+/* Get the timespec definition. */
+# define __need_timespec
+# include <time.h>
+#endif
/* Type used for the number of file descriptors. */
@@ -50,6 +57,18 @@ __BEGIN_DECLS
__THROW. */
extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout);
+#ifdef __USE_GNU
+/* Like poll, but before waiting the threads signal mask is replaced
+ with that specified in the fourth parameter. For better usability,
+ the timeout value is specified using a TIMESPEC object.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int ppoll (struct pollfd *__fds, nfds_t __nfds,
+ __const struct timespec *__timeout,
+ __const __sigset_t *__ss);
+#endif
+
__END_DECLS
#endif /* sys/poll.h */
diff --git a/io/tst-faccessat.c b/io/tst-faccessat.c
index 3bf7aed2e5..48532070a7 100644
--- a/io/tst-faccessat.c
+++ b/io/tst-faccessat.c
@@ -98,6 +98,20 @@ do_test (void)
write (fd, "hello", 5);
puts ("file created");
+ /* Before closing the file, try using this file descriptor to open
+ another file. This must fail. */
+ if (faccessat (fd, "should-not-work", F_OK, AT_EACCESS) != -1)
+ {
+ puts ("faccessat using descriptor for normal file worked");
+ return 1;
+ }
+ if (errno != ENOTDIR)
+ {
+ puts ("\
+error for faccessat using descriptor for normal file not ENOTDIR ");
+ return 1;
+ }
+
close (fd);
int result = 0;
@@ -135,12 +149,45 @@ do_test (void)
errno = 0;
if (faccessat (dir_fd, "some-file", W_OK, AT_EACCESS) == 0
- || errno != EACCES)
+ ? (geteuid () != 0) : (errno != EACCES))
{
printf ("faccessat W_OK on unwritable file: %m\n");
result = 1;
}
+ /* Create a file descriptor which is closed again right away. */
+ int dir_fd2 = dup (dir_fd);
+ if (dir_fd2 == -1)
+ {
+ puts ("dup failed");
+ return 1;
+ }
+ close (dir_fd2);
+
+ /* With the file descriptor closed the next call must fail. */
+ if (faccessat (dir_fd2, "some-file", F_OK, AT_EACCESS) != -1)
+ {
+ puts ("faccessat using closed descriptor succeeded");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("faccessat using closed descriptor did not set EBADF");
+ return 1;
+ }
+
+ /* Same with a non-existing file. */
+ if (faccessat (dir_fd2, "non-existing-file", F_OK, AT_EACCESS) != -1)
+ {
+ puts ("2nd faccessat using closed descriptor succeeded");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("2nd faccessat using closed descriptor did not set EBADF");
+ return 1;
+ }
+
if (unlinkat (dir_fd, "some-file", 0) != 0)
{
puts ("unlinkat failed");
@@ -149,5 +196,17 @@ do_test (void)
close (dir_fd);
+ fd = faccessat (-1, "some-file", F_OK, AT_EACCESS);
+ if (fd != -1)
+ {
+ puts ("faccessat using -1 descriptor succeeded");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("faccessat using -1 descriptor did not set EBADF");
+ return 1;
+ }
+
return result;
}
diff --git a/io/tst-fchmodat.c b/io/tst-fchmodat.c
index 0288d6b5d9..bfb75d62e5 100644
--- a/io/tst-fchmodat.c
+++ b/io/tst-fchmodat.c
@@ -107,6 +107,20 @@ do_test (void)
return 1;
}
+ /* Before closing the file, try using this file descriptor to open
+ another file. This must fail. */
+ if (fchmodat (fd, "some-file", 0400, 0) != -1)
+ {
+ puts ("fchmodat using descriptor for normal file worked");
+ return 1;
+ }
+ if (errno != ENOTDIR)
+ {
+ puts ("\
+error for fchmodat using descriptor for normal file not ENOTDIR ");
+ return 1;
+ }
+
close (fd);
if ((st1.st_mode & 0777) != 0644)
@@ -140,7 +154,38 @@ do_test (void)
return 1;
}
+ /* Create a file descriptor which is closed again right away. */
+ int dir_fd2 = dup (dir_fd);
+ if (dir_fd2 == -1)
+ {
+ puts ("dup failed");
+ return 1;
+ }
+ close (dir_fd2);
+
+ if (fchmodat (dir_fd2, "some-file", 0400, 0) != -1)
+ {
+ puts ("fchmodat using closed descriptor worked");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("error for fchmodat using closed descriptor not EBADF ");
+ return 1;
+ }
+
close (dir_fd);
+ if (fchmodat (-1, "some-file", 0400, 0) != -1)
+ {
+ puts ("fchmodat using invalid descriptor worked");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("error for fchmodat using invalid descriptor not EBADF ");
+ return 1;
+ }
+
return 0;
}
diff --git a/io/tst-fchownat.c b/io/tst-fchownat.c
index 0cbf78b2b0..fd32ac9e6b 100644
--- a/io/tst-fchownat.c
+++ b/io/tst-fchownat.c
@@ -112,6 +112,20 @@ do_test (void)
return 1;
}
+ /* Before closing the file, try using this file descriptor to open
+ another file. This must fail. */
+ if (fchownat (fd, "some-file", 1, 1, 0) != -1)
+ {
+ puts ("fchownat using descriptor for normal file worked");
+ return 1;
+ }
+ if (errno != ENOTDIR)
+ {
+ puts ("\
+error for fchownat using descriptor for normal file not ENOTDIR ");
+ return 1;
+ }
+
close (fd);
if (fchownat (dir_fd, "some-file", st1.st_uid + 1, st1.st_gid + 1, 0) != 0)
@@ -139,7 +153,38 @@ do_test (void)
return 1;
}
+ /* Create a file descriptor which is closed again right away. */
+ int dir_fd2 = dup (dir_fd);
+ if (dir_fd2 == -1)
+ {
+ puts ("dup failed");
+ return 1;
+ }
+ close (dir_fd2);
+
+ if (fchownat (dir_fd2, "some-file", 1, 1, 0) != -1)
+ {
+ puts ("fchownat using closed descriptor worked");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("error for fchownat using closed descriptor not EBADF ");
+ return 1;
+ }
+
close (dir_fd);
+ if (fchownat (-1, "some-file", 1, 1, 0) != -1)
+ {
+ puts ("fchownat using invalid descriptor worked");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("error for fchownat using invalid descriptor not EBADF ");
+ return 1;
+ }
+
return 0;
}
diff --git a/io/tst-fstatat.c b/io/tst-fstatat.c
index 6ddf30d87b..5493102167 100644
--- a/io/tst-fstatat.c
+++ b/io/tst-fstatat.c
@@ -97,6 +97,20 @@ do_test (void)
puts ("file created");
struct stat64 st1;
+
+ /* Before closing the file, try using this file descriptor to open
+ another file. This must fail. */
+ if (fstatat64 (fd, "some-file", &st1, 0) != -1)
+ {
+ puts ("fstatatat using descriptor for normal file worked");
+ return 1;
+ }
+ if (errno != ENOTDIR)
+ {
+ puts ("error for fstatat using descriptor for normal file not ENOTDIR ");
+ return 1;
+ }
+
if (fstat64 (fd, &st1) != 0)
{
puts ("fstat64 failed");
@@ -137,7 +151,38 @@ do_test (void)
return 1;
}
+ /* Create a file descriptor which is closed again right away. */
+ int dir_fd2 = dup (dir_fd);
+ if (dir_fd2 == -1)
+ {
+ puts ("dup failed");
+ return 1;
+ }
+ close (dir_fd2);
+
+ if (fstatat64 (dir_fd2, "some-file", &st1, 0) != -1)
+ {
+ puts ("fstatat64 using closed descriptor worked");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("error for fstatat using closed descriptor not EBADF ");
+ return 1;
+ }
+
close (dir_fd);
+ if (fstatat64 (-1, "some-file", &st1, 0) != -1)
+ {
+ puts ("fstatat64 using invalid descriptor worked");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("error for fstatat using invalid descriptor not EBADF ");
+ return 1;
+ }
+
return 0;
}
diff --git a/io/tst-linkat.c b/io/tst-linkat.c
new file mode 100644
index 0000000000..a77ceb1db4
--- /dev/null
+++ b/io/tst-linkat.c
@@ -0,0 +1,171 @@
+#include <dirent.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static void prepare (void);
+#define PREPARE(argc, argv) prepare ()
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+#include "../test-skeleton.c"
+
+static int dir_fd;
+
+static void
+prepare (void)
+{
+ size_t test_dir_len = strlen (test_dir);
+ static const char dir_name[] = "/tst-linkat.XXXXXX";
+
+ size_t dirbuflen = test_dir_len + sizeof (dir_name);
+ char *dirbuf = malloc (dirbuflen);
+ if (dirbuf == NULL)
+ {
+ puts ("out of memory");
+ exit (1);
+ }
+
+ snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name);
+ if (mkdtemp (dirbuf) == NULL)
+ {
+ puts ("cannot create temporary directory");
+ exit (1);
+ }
+
+ add_temp_file (dirbuf);
+
+ dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY);
+ if (dir_fd == -1)
+ {
+ puts ("cannot open directory");
+ exit (1);
+ }
+}
+
+
+static int
+do_test (void)
+{
+ /* fdopendir takes over the descriptor, make a copy. */
+ int dupfd = dup (dir_fd);
+ if (dupfd == -1)
+ {
+ puts ("dup failed");
+ return 1;
+ }
+ if (lseek (dupfd, 0, SEEK_SET) != 0)
+ {
+ puts ("1st lseek failed");
+ return 1;
+ }
+
+ /* The directory should be empty safe the . and .. files. */
+ DIR *dir = fdopendir (dupfd);
+ if (dir == NULL)
+ {
+ puts ("fdopendir failed");
+ return 1;
+ }
+ struct dirent64 *d;
+ while ((d = readdir64 (dir)) != NULL)
+ if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
+ {
+ printf ("temp directory contains file \"%s\"\n", d->d_name);
+ return 1;
+ }
+ closedir (dir);
+
+ /* Try to create a file. */
+ int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666);
+ if (fd == -1)
+ {
+ if (errno == ENOSYS)
+ {
+ puts ("*at functions not supported");
+ return 0;
+ }
+
+ puts ("file creation failed");
+ return 1;
+ }
+ write (fd, "hello", 5);
+ puts ("file created");
+
+ struct stat64 st1;
+ if (fstat64 (fd, &st1) != 0)
+ {
+ puts ("fstat64 failed");
+ return 1;
+ }
+
+ close (fd);
+
+ if (linkat (dir_fd, "some-file", dir_fd, "another-file") != 0)
+ {
+ puts ("symlinkat failed");
+ return 1;
+ }
+
+ struct stat64 st2;
+ if (fstatat64 (dir_fd, "some-file", &st2, 0) != 0)
+ {
+ puts ("fstatat64 failed");
+ return 1;
+ }
+ if (st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino)
+ {
+ puts ("file changed after symlinkat");
+ return 1;
+ }
+
+ if (fstatat64 (dir_fd, "another-file", &st2, AT_SYMLINK_NOFOLLOW) != 0)
+ {
+ puts ("2nd fstatat64 failed");
+ return 1;
+ }
+ if (S_ISLNK (st2.st_mode))
+ {
+ puts ("2nd fstatat64 shows file is a symlink");
+ return 1;
+ }
+ if (st1.st_dev != st2.st_dev
+ || st1.st_ino != st2.st_ino
+ || st1.st_size != st2.st_size)
+ {
+ puts ("stat results for linked file do not match");
+ return 1;
+ }
+
+ if (fstatat64 (dir_fd, "another-file", &st2, 0) != 0)
+ {
+ puts ("3rd fstatat64 failed");
+ return 1;
+ }
+ if (st1.st_dev != st2.st_dev
+ || st1.st_ino != st2.st_ino
+ || st1.st_size != st2.st_size)
+ {
+ puts ("stat results do not match");
+ return 1;
+ }
+
+ if (unlinkat (dir_fd, "another-file", 0) != 0)
+ {
+ puts ("unlinkat failed");
+ return 1;
+ }
+ if (unlinkat (dir_fd, "some-file", 0) != 0)
+ {
+ puts ("2nd unlinkat failed");
+ return 1;
+ }
+
+ close (dir_fd);
+
+ return 0;
+}
diff --git a/io/tst-mkdirat.c b/io/tst-mkdirat.c
new file mode 100644
index 0000000000..3efa4622ef
--- /dev/null
+++ b/io/tst-mkdirat.c
@@ -0,0 +1,162 @@
+#include <dirent.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static void prepare (void);
+#define PREPARE(argc, argv) prepare ()
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+#include "../test-skeleton.c"
+
+static int dir_fd;
+
+static void
+prepare (void)
+{
+ size_t test_dir_len = strlen (test_dir);
+ static const char dir_name[] = "/tst-mkdirat.XXXXXX";
+
+ size_t dirbuflen = test_dir_len + sizeof (dir_name);
+ char *dirbuf = malloc (dirbuflen);
+ if (dirbuf == NULL)
+ {
+ puts ("out of memory");
+ exit (1);
+ }
+
+ snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name);
+ if (mkdtemp (dirbuf) == NULL)
+ {
+ puts ("cannot create temporary directory");
+ exit (1);
+ }
+
+ add_temp_file (dirbuf);
+
+ dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY);
+ if (dir_fd == -1)
+ {
+ puts ("cannot open directory");
+ exit (1);
+ }
+}
+
+
+static int
+do_test (void)
+{
+ /* fdopendir takes over the descriptor, make a copy. */
+ int dupfd = dup (dir_fd);
+ if (dupfd == -1)
+ {
+ puts ("dup failed");
+ return 1;
+ }
+ if (lseek (dupfd, 0, SEEK_SET) != 0)
+ {
+ puts ("1st lseek failed");
+ return 1;
+ }
+
+ /* The directory should be empty safe the . and .. files. */
+ DIR *dir = fdopendir (dupfd);
+ if (dir == NULL)
+ {
+ puts ("fdopendir failed");
+ return 1;
+ }
+ struct dirent64 *d;
+ while ((d = readdir64 (dir)) != NULL)
+ if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
+ {
+ printf ("temp directory contains file \"%s\"\n", d->d_name);
+ return 1;
+ }
+ closedir (dir);
+
+ /* Create a new directory. */
+ int e = mkdirat (dir_fd, "some-dir", 0777);
+ if (e == -1)
+ {
+ if (errno == ENOSYS)
+ {
+ puts ("*at functions not supported");
+ return 0;
+ }
+
+ puts ("directory creation failed");
+ return 1;
+ }
+
+ struct stat64 st1;
+ if (fstatat64 (dir_fd, "some-dir", &st1, 0) != 0)
+ {
+ puts ("fstat64 failed");
+ return 1;
+ }
+ if (!S_ISDIR (st1.st_mode))
+ {
+ puts ("mkdirat did not create a directory");
+ return 1;
+ }
+
+ dupfd = dup (dir_fd);
+ if (dupfd == -1)
+ {
+ puts ("dup failed");
+ return 1;
+ }
+ if (lseek (dupfd, 0, SEEK_SET) != 0)
+ {
+ puts ("1st lseek failed");
+ return 1;
+ }
+
+ dir = fdopendir (dupfd);
+ if (dir == NULL)
+ {
+ puts ("2nd fdopendir failed");
+ return 1;
+ }
+ bool has_some_dir = false;
+ while ((d = readdir64 (dir)) != NULL)
+ if (strcmp (d->d_name, "some-dir") == 0)
+ {
+ has_some_dir = true;
+#ifdef _DIRENT_HAVE_D_TYPE
+ if (d->d_type != DT_UNKNOWN && d->d_type != DT_DIR)
+ {
+ puts ("d_type for some-dir wrong");
+ return 1;
+ }
+#endif
+ }
+ else if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
+ {
+ printf ("temp directory contains file \"%s\"\n", d->d_name);
+ return 1;
+ }
+ closedir (dir);
+
+ if (!has_some_dir)
+ {
+ puts ("some-dir not in directory list");
+ return 1;
+ }
+
+ if (unlinkat (dir_fd, "some-dir", AT_REMOVEDIR) != 0)
+ {
+ puts ("unlinkat failed");
+ return 1;
+ }
+
+ close (dir_fd);
+
+ return 0;
+}
diff --git a/io/tst-mkfifoat.c b/io/tst-mkfifoat.c
new file mode 100644
index 0000000000..2bf29f63af
--- /dev/null
+++ b/io/tst-mkfifoat.c
@@ -0,0 +1,162 @@
+#include <dirent.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static void prepare (void);
+#define PREPARE(argc, argv) prepare ()
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+#include "../test-skeleton.c"
+
+static int dir_fd;
+
+static void
+prepare (void)
+{
+ size_t test_dir_len = strlen (test_dir);
+ static const char dir_name[] = "/tst-mkfifoat.XXXXXX";
+
+ size_t dirbuflen = test_dir_len + sizeof (dir_name);
+ char *dirbuf = malloc (dirbuflen);
+ if (dirbuf == NULL)
+ {
+ puts ("out of memory");
+ exit (1);
+ }
+
+ snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name);
+ if (mkdtemp (dirbuf) == NULL)
+ {
+ puts ("cannot create temporary directory");
+ exit (1);
+ }
+
+ add_temp_file (dirbuf);
+
+ dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY);
+ if (dir_fd == -1)
+ {
+ puts ("cannot open directory");
+ exit (1);
+ }
+}
+
+
+static int
+do_test (void)
+{
+ /* fdopendir takes over the descriptor, make a copy. */
+ int dupfd = dup (dir_fd);
+ if (dupfd == -1)
+ {
+ puts ("dup failed");
+ return 1;
+ }
+ if (lseek (dupfd, 0, SEEK_SET) != 0)
+ {
+ puts ("1st lseek failed");
+ return 1;
+ }
+
+ /* The directory should be empty safe the . and .. files. */
+ DIR *dir = fdopendir (dupfd);
+ if (dir == NULL)
+ {
+ puts ("fdopendir failed");
+ return 1;
+ }
+ struct dirent64 *d;
+ while ((d = readdir64 (dir)) != NULL)
+ if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
+ {
+ printf ("temp directory contains file \"%s\"\n", d->d_name);
+ return 1;
+ }
+ closedir (dir);
+
+ /* Create a new directory. */
+ int e = mkfifoat (dir_fd, "some-fifo", 0777);
+ if (e == -1)
+ {
+ if (errno == ENOSYS)
+ {
+ puts ("*at functions not supported");
+ return 0;
+ }
+
+ puts ("fifo creation failed");
+ return 1;
+ }
+
+ struct stat64 st1;
+ if (fstatat64 (dir_fd, "some-fifo", &st1, 0) != 0)
+ {
+ puts ("fstat64 failed");
+ return 1;
+ }
+ if (!S_ISFIFO (st1.st_mode))
+ {
+ puts ("mkfifoat did not create FIFO");
+ return 1;
+ }
+
+ dupfd = dup (dir_fd);
+ if (dupfd == -1)
+ {
+ puts ("dup failed");
+ return 1;
+ }
+ if (lseek (dupfd, 0, SEEK_SET) != 0)
+ {
+ puts ("1st lseek failed");
+ return 1;
+ }
+
+ dir = fdopendir (dupfd);
+ if (dir == NULL)
+ {
+ puts ("2nd fdopendir failed");
+ return 1;
+ }
+ bool has_some_fifo = false;
+ while ((d = readdir64 (dir)) != NULL)
+ if (strcmp (d->d_name, "some-fifo") == 0)
+ {
+ has_some_fifo = true;
+#ifdef _DIRENT_HAVE_D_TYPE
+ if (d->d_type != DT_UNKNOWN && d->d_type != DT_FIFO)
+ {
+ puts ("d_type for some-fifo wrong");
+ return 1;
+ }
+#endif
+ }
+ else if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
+ {
+ printf ("temp directory contains file \"%s\"\n", d->d_name);
+ return 1;
+ }
+ closedir (dir);
+
+ if (!has_some_fifo)
+ {
+ puts ("some-fifo not in directory list");
+ return 1;
+ }
+
+ if (unlinkat (dir_fd, "some-fifo", 0) != 0)
+ {
+ puts ("unlinkat failed");
+ return 1;
+ }
+
+ close (dir_fd);
+
+ return 0;
+}
diff --git a/io/tst-mknodat.c b/io/tst-mknodat.c
new file mode 100644
index 0000000000..9158c0dfd4
--- /dev/null
+++ b/io/tst-mknodat.c
@@ -0,0 +1,162 @@
+#include <dirent.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static void prepare (void);
+#define PREPARE(argc, argv) prepare ()
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+#include "../test-skeleton.c"
+
+static int dir_fd;
+
+static void
+prepare (void)
+{
+ size_t test_dir_len = strlen (test_dir);
+ static const char dir_name[] = "/tst-mknodat.XXXXXX";
+
+ size_t dirbuflen = test_dir_len + sizeof (dir_name);
+ char *dirbuf = malloc (dirbuflen);
+ if (dirbuf == NULL)
+ {
+ puts ("out of memory");
+ exit (1);
+ }
+
+ snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name);
+ if (mkdtemp (dirbuf) == NULL)
+ {
+ puts ("cannot create temporary directory");
+ exit (1);
+ }
+
+ add_temp_file (dirbuf);
+
+ dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY);
+ if (dir_fd == -1)
+ {
+ puts ("cannot open directory");
+ exit (1);
+ }
+}
+
+
+static int
+do_test (void)
+{
+ /* fdopendir takes over the descriptor, make a copy. */
+ int dupfd = dup (dir_fd);
+ if (dupfd == -1)
+ {
+ puts ("dup failed");
+ return 1;
+ }
+ if (lseek (dupfd, 0, SEEK_SET) != 0)
+ {
+ puts ("1st lseek failed");
+ return 1;
+ }
+
+ /* The directory should be empty safe the . and .. files. */
+ DIR *dir = fdopendir (dupfd);
+ if (dir == NULL)
+ {
+ puts ("fdopendir failed");
+ return 1;
+ }
+ struct dirent64 *d;
+ while ((d = readdir64 (dir)) != NULL)
+ if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
+ {
+ printf ("temp directory contains file \"%s\"\n", d->d_name);
+ return 1;
+ }
+ closedir (dir);
+
+ /* Create a new directory. */
+ int e = mknodat (dir_fd, "some-sock", 0777 | S_IFSOCK, 0);
+ if (e == -1)
+ {
+ if (errno == ENOSYS)
+ {
+ puts ("*at functions not supported");
+ return 0;
+ }
+
+ puts ("socket creation failed");
+ return 1;
+ }
+
+ struct stat64 st1;
+ if (fstatat64 (dir_fd, "some-sock", &st1, 0) != 0)
+ {
+ puts ("fstat64 failed");
+ return 1;
+ }
+ if (!S_ISSOCK (st1.st_mode))
+ {
+ puts ("mknodat did not create a Unix domain socket");
+ return 1;
+ }
+
+ dupfd = dup (dir_fd);
+ if (dupfd == -1)
+ {
+ puts ("dup failed");
+ return 1;
+ }
+ if (lseek (dupfd, 0, SEEK_SET) != 0)
+ {
+ puts ("1st lseek failed");
+ return 1;
+ }
+
+ dir = fdopendir (dupfd);
+ if (dir == NULL)
+ {
+ puts ("2nd fdopendir failed");
+ return 1;
+ }
+ bool has_some_sock = false;
+ while ((d = readdir64 (dir)) != NULL)
+ if (strcmp (d->d_name, "some-sock") == 0)
+ {
+ has_some_sock = true;
+#ifdef _DIRENT_HAVE_D_TYPE
+ if (d->d_type != DT_UNKNOWN && d->d_type != DT_SOCK)
+ {
+ puts ("d_type for some-sock wrong");
+ return 1;
+ }
+#endif
+ }
+ else if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
+ {
+ printf ("temp directory contains file \"%s\"\n", d->d_name);
+ return 1;
+ }
+ closedir (dir);
+
+ if (!has_some_sock)
+ {
+ puts ("some-sock not in directory list");
+ return 1;
+ }
+
+ if (unlinkat (dir_fd, "some-sock", 0) != 0)
+ {
+ puts ("unlinkat failed");
+ return 1;
+ }
+
+ close (dir_fd);
+
+ return 0;
+}
diff --git a/io/tst-openat.c b/io/tst-openat.c
index d10b654fa9..0ceb745880 100644
--- a/io/tst-openat.c
+++ b/io/tst-openat.c
@@ -94,6 +94,21 @@ do_test (void)
return 1;
}
write (fd, "hello", 5);
+
+ /* Before closing the file, try using this file descriptor to open
+ another file. This must fail. */
+ int fd2 = openat (fd, "should-not-work", O_CREAT|O_RDWR, 0666);
+ if (fd2 != -1)
+ {
+ puts ("openat using descriptor for normal file worked");
+ return 1;
+ }
+ if (errno != ENOTDIR)
+ {
+ puts ("error for openat using descriptor for normal file not ENOTDIR ");
+ return 1;
+ }
+
close (fd);
puts ("file created");
@@ -165,5 +180,30 @@ do_test (void)
close (dir_fd);
close (cwdfd);
+ /* With the file descriptor closed the next call must fail. */
+ fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666);
+ if (fd != -1)
+ {
+ puts ("openat using closed descriptor succeeded");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("openat using closed descriptor did not set EBADF");
+ return 1;
+ }
+
+ fd = openat (-1, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666);
+ if (fd != -1)
+ {
+ puts ("openat using -1 descriptor succeeded");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("openat using -1 descriptor did not set EBADF");
+ return 1;
+ }
+
return 0;
}
diff --git a/io/tst-readlinkat.c b/io/tst-readlinkat.c
new file mode 100644
index 0000000000..891b6e6817
--- /dev/null
+++ b/io/tst-readlinkat.c
@@ -0,0 +1,136 @@
+#include <dirent.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static void prepare (void);
+#define PREPARE(argc, argv) prepare ()
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+#include "../test-skeleton.c"
+
+static int dir_fd;
+
+static void
+prepare (void)
+{
+ size_t test_dir_len = strlen (test_dir);
+ static const char dir_name[] = "/tst-symlinkat.XXXXXX";
+
+ size_t dirbuflen = test_dir_len + sizeof (dir_name);
+ char *dirbuf = malloc (dirbuflen);
+ if (dirbuf == NULL)
+ {
+ puts ("out of memory");
+ exit (1);
+ }
+
+ snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name);
+ if (mkdtemp (dirbuf) == NULL)
+ {
+ puts ("cannot create temporary directory");
+ exit (1);
+ }
+
+ add_temp_file (dirbuf);
+
+ dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY);
+ if (dir_fd == -1)
+ {
+ puts ("cannot open directory");
+ exit (1);
+ }
+}
+
+
+static int
+do_test (void)
+{
+ /* fdopendir takes over the descriptor, make a copy. */
+ int dupfd = dup (dir_fd);
+ if (dupfd == -1)
+ {
+ puts ("dup failed");
+ return 1;
+ }
+ if (lseek (dupfd, 0, SEEK_SET) != 0)
+ {
+ puts ("1st lseek failed");
+ return 1;
+ }
+
+ /* The directory should be empty safe the . and .. files. */
+ DIR *dir = fdopendir (dupfd);
+ if (dir == NULL)
+ {
+ puts ("fdopendir failed");
+ return 1;
+ }
+ struct dirent64 *d;
+ while ((d = readdir64 (dir)) != NULL)
+ if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
+ {
+ printf ("temp directory contains file \"%s\"\n", d->d_name);
+ return 1;
+ }
+ closedir (dir);
+
+ static const char symlinkcontent[] = "some-file";
+ if (symlinkat (symlinkcontent, dir_fd, "another-file") != 0)
+ {
+ puts ("symlinkat failed");
+ return 1;
+ }
+
+ struct stat64 st2;
+ if (fstatat64 (dir_fd, "another-file", &st2, AT_SYMLINK_NOFOLLOW) != 0)
+ {
+ puts ("fstatat64 failed");
+ return 1;
+ }
+ if (!S_ISLNK (st2.st_mode))
+ {
+ puts ("2nd fstatat64 does not show file is a symlink");
+ return 1;
+ }
+
+ if (fstatat64 (dir_fd, symlinkcontent, &st2, AT_SYMLINK_NOFOLLOW) == 0)
+ {
+ puts ("2nd fstatat64 succeeded");
+ return 1;
+ }
+
+ char buf[100];
+ int n = readlinkat (dir_fd, "another-file", buf, sizeof (buf));
+ if (n == -1)
+ {
+ puts ("readlinkat failed");
+ return 1;
+ }
+ if (n != sizeof (symlinkcontent) - 1)
+ {
+ printf ("readlinkat returned %d, expected %zu\n",
+ n, sizeof (symlinkcontent) - 1);
+ return 1;
+ }
+ if (strncmp (buf, symlinkcontent, n) != 0)
+ {
+ puts ("readlinkat retrieved wrong link content");
+ return 1;
+ }
+
+ if (unlinkat (dir_fd, "another-file", 0) != 0)
+ {
+ puts ("unlinkat failed");
+ return 1;
+ }
+
+ close (dir_fd);
+
+ return 0;
+}
diff --git a/io/tst-renameat.c b/io/tst-renameat.c
index fb494594f5..a7c0ec16c4 100644
--- a/io/tst-renameat.c
+++ b/io/tst-renameat.c
@@ -103,6 +103,29 @@ do_test (void)
return 1;
}
+ /* Using a descriptor for a normal file must fail. */
+ if (renameat (fd, "some-file", dir_fd, "another-file") == 0)
+ {
+ puts ("renameat with normal file descriptor succeeded");
+ return 1;
+ }
+ if (errno != ENOTDIR)
+ {
+ puts ("error for renameat with normal file descriptor not ENOTDIR");
+ return 1;
+ }
+
+ if (renameat (dir_fd, "some-file", fd, "another-file") == 0)
+ {
+ puts ("2nd renameat with normal file descriptor succeeded");
+ return 1;
+ }
+ if (errno != ENOTDIR)
+ {
+ puts ("error for 2nd renameat with normal file descriptor not ENOTDIR");
+ return 1;
+ }
+
close (fd);
if (renameat (dir_fd, "some-file", dir_fd, "another-file") != 0)
@@ -137,12 +160,65 @@ do_test (void)
return 1;
}
+ /* Create a file descriptor which is closed again right away. */
+ int dir_fd2 = dup (dir_fd);
+ if (dir_fd2 == -1)
+ {
+ puts ("dup failed");
+ return 1;
+ }
+ close (dir_fd2);
+
+ if (renameat (dir_fd2, "another-file", dir_fd, "some-file") == 0)
+ {
+ puts ("renameat with closed file descriptor succeeded");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("error for renameat with closed file descriptor not EBADF");
+ return 1;
+ }
+
+ if (renameat (dir_fd, "another-file", dir_fd2, "some-file") == 0)
+ {
+ puts ("2nd renameat with closed file descriptor succeeded");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("error for 2nd renameat with closed file descriptor not EBADF");
+ return 1;
+ }
+
if (unlinkat (dir_fd, "another-file", 0) != 0)
{
puts ("unlinkat failed");
return 1;
}
+ if (renameat (-1, "another-file", dir_fd, "some-file") == 0)
+ {
+ puts ("renameat with invalid file descriptor succeeded");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("error for renameat with invalid file descriptor not EBADF");
+ return 1;
+ }
+
+ if (renameat (dir_fd, "another-file", -1, "some-file") == 0)
+ {
+ puts ("2nd renameat with invalid file descriptor succeeded");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ puts ("error for 2nd renameat with invalid file descriptor not EBADF");
+ return 1;
+ }
+
close (dir_fd);
return 0;
diff --git a/io/tst-symlinkat.c b/io/tst-symlinkat.c
new file mode 100644
index 0000000000..1e98588fc8
--- /dev/null
+++ b/io/tst-symlinkat.c
@@ -0,0 +1,164 @@
+#include <dirent.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static void prepare (void);
+#define PREPARE(argc, argv) prepare ()
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+#include "../test-skeleton.c"
+
+static int dir_fd;
+
+static void
+prepare (void)
+{
+ size_t test_dir_len = strlen (test_dir);
+ static const char dir_name[] = "/tst-symlinkat.XXXXXX";
+
+ size_t dirbuflen = test_dir_len + sizeof (dir_name);
+ char *dirbuf = malloc (dirbuflen);
+ if (dirbuf == NULL)
+ {
+ puts ("out of memory");
+ exit (1);
+ }
+
+ snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name);
+ if (mkdtemp (dirbuf) == NULL)
+ {
+ puts ("cannot create temporary directory");
+ exit (1);
+ }
+
+ add_temp_file (dirbuf);
+
+ dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY);
+ if (dir_fd == -1)
+ {
+ puts ("cannot open directory");
+ exit (1);
+ }
+}
+
+
+static int
+do_test (void)
+{
+ /* fdopendir takes over the descriptor, make a copy. */
+ int dupfd = dup (dir_fd);
+ if (dupfd == -1)
+ {
+ puts ("dup failed");
+ return 1;
+ }
+ if (lseek (dupfd, 0, SEEK_SET) != 0)
+ {
+ puts ("1st lseek failed");
+ return 1;
+ }
+
+ /* The directory should be empty safe the . and .. files. */
+ DIR *dir = fdopendir (dupfd);
+ if (dir == NULL)
+ {
+ puts ("fdopendir failed");
+ return 1;
+ }
+ struct dirent64 *d;
+ while ((d = readdir64 (dir)) != NULL)
+ if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
+ {
+ printf ("temp directory contains file \"%s\"\n", d->d_name);
+ return 1;
+ }
+ closedir (dir);
+
+ /* Try to create a file. */
+ int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666);
+ if (fd == -1)
+ {
+ if (errno == ENOSYS)
+ {
+ puts ("*at functions not supported");
+ return 0;
+ }
+
+ puts ("file creation failed");
+ return 1;
+ }
+ write (fd, "hello", 5);
+ puts ("file created");
+
+ struct stat64 st1;
+ if (fstat64 (fd, &st1) != 0)
+ {
+ puts ("fstat64 failed");
+ return 1;
+ }
+
+ close (fd);
+
+ if (symlinkat ("some-file", dir_fd, "another-file") != 0)
+ {
+ puts ("symlinkat failed");
+ return 1;
+ }
+
+ struct stat64 st2;
+ if (fstatat64 (dir_fd, "some-file", &st2, 0) != 0)
+ {
+ puts ("fstatat64 failed");
+ return 1;
+ }
+ if (st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino)
+ {
+ puts ("file changed after symlinkat");
+ return 1;
+ }
+
+ if (fstatat64 (dir_fd, "another-file", &st2, AT_SYMLINK_NOFOLLOW) != 0)
+ {
+ puts ("2nd fstatat64 failed");
+ return 1;
+ }
+ if (!S_ISLNK (st2.st_mode))
+ {
+ puts ("2nd fstatat64 does not show file is a symlink");
+ return 1;
+ }
+
+ if (fstatat64 (dir_fd, "another-file", &st2, 0) != 0)
+ {
+ puts ("3rd fstatat64 failed");
+ return 1;
+ }
+ if (st1.st_dev != st2.st_dev
+ || st1.st_ino != st2.st_ino
+ || st1.st_size != st2.st_size)
+ {
+ puts ("stat results do not match");
+ return 1;
+ }
+
+ if (unlinkat (dir_fd, "another-file", 0) != 0)
+ {
+ puts ("unlinkat failed");
+ return 1;
+ }
+ if (unlinkat (dir_fd, "some-file", 0) != 0)
+ {
+ puts ("2nd unlinkat failed");
+ return 1;
+ }
+
+ close (dir_fd);
+
+ return 0;
+}
diff --git a/libio/Makefile b/libio/Makefile
index a97623f14a..e9c1d522fd 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1995-2002,2003,2004,2006 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -22,7 +22,7 @@
subdir := libio
headers := stdio.h libio.h _G_config.h bits/stdio.h bits/stdio-lock.h \
- bits/sys_errlist.h bits/stdio2.h
+ bits/sys_errlist.h bits/stdio2.h bits/stdio-ldbl.h bits/libio-ldbl.h
routines := \
filedoalloc iofclose iofdopen iofflush iofgetpos iofgets iofopen \
@@ -35,7 +35,7 @@ routines := \
iofputws iofputws_u iogetwline iowpadn ioungetwc putwc putwc_u \
putwchar putwchar_u putchar putchar_u fwprintf swprintf vwprintf \
wprintf wscanf fwscanf vwscanf vswprintf iovswscanf swscanf wgenops \
- wstrops wfileops iofwide fwide \
+ wstrops wfileops iofwide fwide wmemstream \
\
clearerr feof ferror fileno fputc freopen fseek getc getchar \
memstream pclose putc putchar rewind setbuf setlinebuf vasprintf \
@@ -54,7 +54,9 @@ tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
tst-freopen bug-rewind bug-rewind2 bug-ungetc bug-fseek \
tst-mmap-eofsync tst-mmap-fflushsync bug-mmap-fflush \
tst-mmap2-eofsync tst-mmap-offend bug-fopena+ bug-wfflush \
- bug-ungetc2 bug-ftell bug-ungetc3 bug-ungetc4
+ bug-ungetc2 bug-ftell bug-ungetc3 bug-ungetc4 tst-fopenloc2 \
+ tst-memstream1 tst-memstream2 \
+ tst-wmemstream1 tst-wmemstream2
test-srcs = test-freopen
all: # Make this the default target; it will be defined in Rules.
diff --git a/libio/Versions b/libio/Versions
index c870494872..e7a96daca5 100644
--- a/libio/Versions
+++ b/libio/Versions
@@ -145,6 +145,9 @@ libc {
# w*
wprintf; wscanf;
}
+ GLIBC_2.4 {
+ open_wmemstream;
+ }
GLIBC_PRIVATE {
# Used by NPTL and librt
__libc_fatal;
diff --git a/libio/bits/libio-ldbl.h b/libio/bits/libio-ldbl.h
new file mode 100644
index 0000000000..6e02115f4a
--- /dev/null
+++ b/libio/bits/libio-ldbl.h
@@ -0,0 +1,27 @@
+/* -mlong-double-64 compatibility mode for libio functions.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _IO_STDIO_H
+# error "Never include <bits/libio-ldbl.h> directly; use <libio.h> instead."
+#endif
+
+__LDBL_REDIR_DECL (_IO_vfscanf)
+__LDBL_REDIR_DECL (_IO_vfprintf)
+__LDBL_REDIR_DECL (_IO_vfwscanf)
+__LDBL_REDIR_DECL (_IO_vfwprintf)
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
new file mode 100644
index 0000000000..7a4291225e
--- /dev/null
+++ b/libio/bits/stdio-ldbl.h
@@ -0,0 +1,74 @@
+/* -mlong-double-64 compatibility mode for stdio functions.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _STDIO_H
+# error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead."
+#endif
+
+__BEGIN_NAMESPACE_STD
+__LDBL_REDIR_DECL (fprintf)
+__LDBL_REDIR_DECL (printf)
+__LDBL_REDIR_DECL (sprintf)
+__LDBL_REDIR_DECL (vfprintf)
+__LDBL_REDIR_DECL (vprintf)
+__LDBL_REDIR_DECL (vsprintf)
+__LDBL_REDIR_DECL (fscanf)
+__LDBL_REDIR_DECL (scanf)
+__LDBL_REDIR_DECL (sscanf)
+__END_NAMESPACE_STD
+
+#if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
+__BEGIN_NAMESPACE_C99
+__LDBL_REDIR_DECL (snprintf)
+__LDBL_REDIR_DECL (vsnprintf)
+__END_NAMESPACE_C99
+#endif
+
+#ifdef __USE_ISOC99
+__BEGIN_NAMESPACE_C99
+__LDBL_REDIR_DECL (vfscanf)
+__LDBL_REDIR_DECL (vsscanf)
+__LDBL_REDIR_DECL (vscanf)
+__END_NAMESPACE_C99
+#endif
+
+#ifdef __USE_GNU
+__LDBL_REDIR_DECL (vdprintf)
+__LDBL_REDIR_DECL (dprintf)
+__LDBL_REDIR_DECL (vasprintf)
+__LDBL_REDIR_DECL (__asprintf)
+__LDBL_REDIR_DECL (asprintf)
+__LDBL_REDIR_DECL (obstack_printf)
+__LDBL_REDIR_DECL (obstack_vprintf)
+#endif
+
+#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
+__LDBL_REDIR_DECL (__sprintf_chk)
+__LDBL_REDIR_DECL (__vsprintf_chk)
+# if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
+__LDBL_REDIR_DECL (__snprintf_chk)
+__LDBL_REDIR_DECL (__vsnprintf_chk)
+# endif
+# if __USE_FORTIFY_LEVEL > 1
+__LDBL_REDIR_DECL (__fprintf_chk)
+__LDBL_REDIR_DECL (__printf_chk)
+__LDBL_REDIR_DECL (__vfprintf_chk)
+__LDBL_REDIR_DECL (__vprintf_chk)
+# endif
+#endif
diff --git a/libio/fileops.c b/libio/fileops.c
index 74d5cd0dbc..cf7fd65421 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997-2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1997-2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Per Bothner <bothner@cygnus.com>.
@@ -399,6 +399,9 @@ _IO_new_file_fopen (fp, filename, mode, is32not64)
/* And now the transliteration. */
cc->__cd_out.__cd.__data[0].__trans = &__libio_translit;
+ /* From now on use the wide character callback functions. */
+ ((struct _IO_FILE_plus *) fp)->vtable = fp->_wide_data->_wide_vtable;
+
/* Set the mode now. */
result->_mode = 1;
}
diff --git a/libio/fputwc.c b/libio/fputwc.c
index 8c749435a0..42cf9d716c 100644
--- a/libio/fputwc.c
+++ b/libio/fputwc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,1996,1997,1998,1999,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1996,1997,1998,1999,2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -33,7 +33,7 @@ fputwc (wc, fp)
wchar_t wc;
_IO_FILE *fp;
{
- int result;
+ wint_t result;
CHECK_FILE (fp, EOF);
_IO_acquire_lock (fp);
if (_IO_fwide (fp, 1) < 0)
diff --git a/libio/fputwc_u.c b/libio/fputwc_u.c
index 93cbcab3d3..0478410cca 100644
--- a/libio/fputwc_u.c
+++ b/libio/fputwc_u.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1996, 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1996, 1997, 1999, 2006 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,7 +35,7 @@ fputwc_unlocked (wc, fp)
wchar_t wc;
_IO_FILE *fp;
{
- CHECK_FILE (fp, EOF);
+ CHECK_FILE (fp, WEOF);
if (_IO_fwide (fp, 1) < 0)
return WEOF;
return _IO_putwc_unlocked (wc, fp);
diff --git a/libio/fwprintf.c b/libio/fwprintf.c
index cadeda04ab..9d9111d7c6 100644
--- a/libio/fwprintf.c
+++ b/libio/fwprintf.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1997, 1999, 2000, 2001, 2006
+ 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
@@ -16,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <libioP.h>
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
@@ -35,4 +37,4 @@ __fwprintf (FILE *stream, const wchar_t *format, ...)
return done;
}
-weak_alias (__fwprintf, fwprintf)
+ldbl_weak_alias (__fwprintf, fwprintf)
diff --git a/libio/fwscanf.c b/libio/fwscanf.c
index 411e1825c0..17296fa3d6 100644
--- a/libio/fwscanf.c
+++ b/libio/fwscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1997, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1997, 1999, 2000, 2006 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
@@ -16,6 +16,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <libioP.h>
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
@@ -23,7 +24,7 @@
/* Read formatted input from STREAM according to the format string FORMAT. */
/* VARARGS2 */
int
-fwscanf (FILE *stream, const wchar_t *format, ...)
+__fwscanf (FILE *stream, const wchar_t *format, ...)
{
va_list arg;
int done;
@@ -34,3 +35,4 @@ fwscanf (FILE *stream, const wchar_t *format, ...)
return done;
}
+ldbl_strong_alias (__fwscanf, fwscanf)
diff --git a/libio/genops.c b/libio/genops.c
index 741ed77f86..da29ade4e6 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993,1995,1997-2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1995,1997-2002, 2003, 2004, 2006
+ 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
@@ -657,6 +658,7 @@ _IO_no_init (fp, flags, orientation, wd, jmp)
fp->_wide_data->_wide_vtable = jmp;
}
#endif
+ fp->_freeres_list = NULL;
}
int
@@ -914,10 +916,27 @@ INTDEF(_IO_flush_all_linebuffered)
weak_alias (_IO_flush_all_linebuffered, _flushlbf)
#endif
+
+/* The following is a bit tricky. In general, we want to unbuffer the
+ streams so that all output which follows is seen. If we are not
+ looking for memory leaks it does not make much sense to free the
+ actual buffer because this will happen anyway once the program
+ terminated. If we do want to look for memory leaks we have to free
+ the buffers. Whether something is freed is determined by the
+ function sin the libc_freeres section. Those are called as part of
+ the atexit routine, just like _IO_cleanup. The problem is we do
+ not know whether the freeres code is called first or _IO_cleanup.
+ if the former is the case, we set the DEALLOC_BUFFER variable to
+ true and _IO_unbuffer_write will take care of the rest. If
+ _IO_unbuffer_write is called first we add the streams to a list
+ which the freeres function later can walk through. */
static void _IO_unbuffer_write (void);
+static bool dealloc_buffers;
+static _IO_FILE *freeres_list;
+
static void
-_IO_unbuffer_write ()
+_IO_unbuffer_write (void)
{
struct _IO_FILE *fp;
for (fp = (_IO_FILE *) INTUSE(_IO_list_all); fp; fp = fp->_chain)
@@ -927,7 +946,32 @@ _IO_unbuffer_write ()
|| (fp->_flags & _IO_IS_APPENDING))
/* Iff stream is un-orientated, it wasn't used. */
&& fp->_mode != 0)
- _IO_SETBUF (fp, NULL, 0);
+ {
+ int cnt;
+#define MAXTRIES 2
+ for (cnt = 0; cnt < MAXTRIES; ++cnt)
+ if (_IO_lock_trylock (*fp->_lock) == 0)
+ break;
+ else
+ /* Give the other thread time to finish up its use of the
+ stream. */
+ __sched_yield ();
+
+ if (! dealloc_buffers && !(fp->_flags & _IO_USER_BUF))
+ {
+ fp->_flags |= _IO_USER_BUF;
+
+ fp->_freeres_list = freeres_list;
+ freeres_list = fp;
+ fp->_freeres_buf = fp->_IO_buf_base;
+ fp->_freeres_size = _IO_blen (fp);
+ }
+
+ _IO_SETBUF (fp, NULL, 0);
+
+ if (cnt < MAXTRIES)
+ _IO_lock_unlock (*fp->_lock);
+ }
/* Make sure that never again the wide char functions can be
used. */
@@ -935,11 +979,25 @@ _IO_unbuffer_write ()
}
}
+
+libc_freeres_fn (buffer_free)
+{
+ dealloc_buffers = true;
+
+ while (freeres_list != NULL)
+ {
+ FREE_BUF (freeres_list->_freeres_buf, freeres_list->_freeres_size);
+
+ freeres_list = freeres_list->_freeres_list;
+ }
+}
+
+
int
_IO_cleanup ()
{
/* We do *not* want locking. Some threads might use streams but
- that is there problem, we flush them underneath them. */
+ that is their problem, we flush them underneath them. */
int result = _IO_flush_all_lockp (0);
/* We currently don't have a reliable mechanism for making sure that
diff --git a/libio/getwc_u.c b/libio/getwc_u.c
index bdad3c8bf3..229343cc61 100644
--- a/libio/getwc_u.c
+++ b/libio/getwc_u.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,1995,1996,1997,1999,2000 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1995,1996,1997,1999,2000, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -33,7 +33,7 @@
wint_t
__getwc_unlocked (FILE *fp)
{
- CHECK_FILE (fp, EOF);
+ CHECK_FILE (fp, WEOF);
return _IO_getwc_unlocked (fp);
}
diff --git a/libio/ioungetwc.c b/libio/ioungetwc.c
index 00d3e965b5..f7b6866617 100644
--- a/libio/ioungetwc.c
+++ b/libio/ioungetwc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003
+/* Copyright (C) 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -34,7 +34,7 @@ ungetwc (c, fp)
wint_t c;
_IO_FILE *fp;
{
- int result;
+ wint_t result;
CHECK_FILE (fp, WEOF);
_IO_acquire_lock (fp);
_IO_fwide (fp, 1);
diff --git a/libio/iovdprintf.c b/libio/iovdprintf.c
index e81d870ca7..edab849a44 100644
--- a/libio/iovdprintf.c
+++ b/libio/iovdprintf.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1997-2000,2001,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997-2000, 2001, 2002, 2003, 2006
+ 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
@@ -25,7 +26,7 @@
This exception applies to code released by its copyright holders
in files containing the exception. */
-#include "libioP.h"
+#include <libioP.h>
#include <stdio_ext.h>
int
@@ -63,7 +64,4 @@ _IO_vdprintf (d, format, arg)
return done;
}
-
-#ifdef weak_alias
-weak_alias (_IO_vdprintf, vdprintf)
-#endif
+ldbl_weak_alias (_IO_vdprintf, vdprintf)
diff --git a/libio/iovsprintf.c b/libio/iovsprintf.c
index b26a99b271..7fcd0a156e 100644
--- a/libio/iovsprintf.c
+++ b/libio/iovsprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997-2003 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997-2003, 2006 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
@@ -29,10 +29,7 @@
#include "strfile.h"
int
-_IO_vsprintf (string, format, args)
- char *string;
- const char *format;
- _IO_va_list args;
+__IO_vsprintf (char *string, const char *format, _IO_va_list args)
{
_IO_strfile sf;
int ret;
@@ -47,8 +44,7 @@ _IO_vsprintf (string, format, args)
_IO_putc_unlocked ('\0', (_IO_FILE *) &sf._sbf);
return ret;
}
-INTDEF(_IO_vsprintf)
+INTDEF2(__IO_vsprintf, _IO_vsprintf)
-#ifdef weak_alias
-weak_alias (_IO_vsprintf, vsprintf)
-#endif
+ldbl_strong_alias (__IO_vsprintf, _IO_vsprintf)
+ldbl_weak_alias (__IO_vsprintf, vsprintf)
diff --git a/libio/iovsscanf.c b/libio/iovsscanf.c
index 1a965c2d92..10e4b0a9ac 100644
--- a/libio/iovsscanf.c
+++ b/libio/iovsscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997-2003 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997-2003, 2006 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
@@ -45,8 +45,5 @@ _IO_vsscanf (string, format, args)
ret = INTUSE(_IO_vfscanf) ((_IO_FILE *) &sf._sbf, format, args, NULL);
return ret;
}
-
-#ifdef weak_alias
-weak_alias (_IO_vsscanf, __vsscanf)
-weak_alias (_IO_vsscanf, vsscanf)
-#endif
+ldbl_weak_alias (_IO_vsscanf, __vsscanf)
+ldbl_weak_alias (_IO_vsscanf, vsscanf)
diff --git a/libio/iovswscanf.c b/libio/iovswscanf.c
index 1bbddd442f..182d8da410 100644
--- a/libio/iovswscanf.c
+++ b/libio/iovswscanf.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993, 1997-2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997-2000, 2001, 2002, 2006
+ 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
@@ -30,10 +31,7 @@
#include <wchar.h>
int
-vswscanf (string, format, args)
- const wchar_t *string;
- const wchar_t *format;
- _IO_va_list args;
+__vswscanf (const wchar_t *string, const wchar_t *format, _IO_va_list args)
{
int ret;
_IO_strfile sf;
@@ -47,4 +45,5 @@ vswscanf (string, format, args)
ret = _IO_vfwscanf ((_IO_FILE *) &sf._sbf, format, args, NULL);
return ret;
}
-libc_hidden_def (vswscanf)
+ldbl_hidden_def (__vswscanf, vswscanf)
+ldbl_strong_alias (__vswscanf, vswscanf)
diff --git a/libio/libio.h b/libio/libio.h
index 21e70489cf..6f9c418c31 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1995,1997-2003,2004,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1995,1997-2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Per Bothner <bothner@cygnus.com>.
@@ -317,13 +317,19 @@ struct _IO_FILE_complete
/* Wide character stream stuff. */
struct _IO_codecvt *_codecvt;
struct _IO_wide_data *_wide_data;
+ struct _IO_FILE *_freeres_list;
+ void *_freeres_buf;
+ size_t _freeres_size;
# else
void *__pad1;
void *__pad2;
+ void *__pad3;
+ void *__pad4;
+ size_t __pad5;
# endif
int _mode;
/* Make sure we don't get into trouble again. */
- char _unused2[15 * sizeof (int) - 2 * sizeof (void *)];
+ char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
#endif
};
@@ -472,9 +478,9 @@ extern int _IO_ftrylockfile (_IO_FILE *) __THROW;
#endif /* !_IO_MTSAFE_IO */
extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
- _IO_va_list, int *__restrict) __THROW;
+ _IO_va_list, int *__restrict);
extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
- _IO_va_list) __THROW;
+ _IO_va_list);
extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t) __THROW;
extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t) __THROW;
@@ -521,13 +527,17 @@ weak_extern (_IO_stdin_used);
# endif
extern int _IO_vfwscanf (_IO_FILE * __restrict, const wchar_t * __restrict,
- _IO_va_list, int *__restrict) __THROW;
+ _IO_va_list, int *__restrict);
extern int _IO_vfwprintf (_IO_FILE *__restrict, const wchar_t *__restrict,
- _IO_va_list) __THROW;
+ _IO_va_list);
extern _IO_ssize_t _IO_wpadn (_IO_FILE *, wint_t, _IO_ssize_t) __THROW;
extern void _IO_free_wbackup_area (_IO_FILE *) __THROW;
#endif
+#ifdef __LDBL_COMPAT
+# include <bits/libio-ldbl.h>
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/libio/libioP.h b/libio/libioP.h
index be3b38a2e4..a2cd4c2202 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993, 1997-2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997-2003,2004,2005,2006
+ 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 +36,8 @@
/*# include <comthread.h>*/
#endif
+#include <math_ldbl_opt.h>
+
#include "iolibio.h"
/* Control of exported symbols. Used in glibc. By default we don't
@@ -649,7 +652,7 @@ extern void _IO_wstr_finish (_IO_FILE *, int) __THROW;
extern int _IO_vasprintf (char **result_ptr, __const char *format,
_IO_va_list args) __THROW;
-extern int _IO_vdprintf (int d, __const char *format, _IO_va_list arg) __THROW;
+extern int _IO_vdprintf (int d, __const char *format, _IO_va_list arg);
extern int _IO_vsnprintf (char *string, _IO_size_t maxlen,
__const char *format, _IO_va_list args) __THROW;
diff --git a/libio/memstream.c b/libio/memstream.c
index 4cc9ab2dfc..742da740ef 100644
--- a/libio/memstream.c
+++ b/libio/memstream.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-97,99,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995-97,99,2000,2002-2004,2006 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
@@ -106,11 +106,6 @@ _IO_mem_sync (fp)
_IO_FILE* fp;
{
struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp;
- int res;
-
- res = _IO_default_sync (fp);
- if (res < 0)
- return res;
if (fp->_IO_write_ptr == fp->_IO_write_end)
{
@@ -140,9 +135,9 @@ _IO_mem_finish (fp, dummy)
{
(*mp->bufloc)[fp->_IO_write_ptr - fp->_IO_write_base] = '\0';
*mp->sizeloc = fp->_IO_write_ptr - fp->_IO_write_base;
- }
- fp->_IO_buf_base = NULL;
+ fp->_IO_buf_base = NULL;
+ }
- INTUSE(_IO_default_finish) (fp, 0);
+ _IO_str_finish (fp, 0);
}
diff --git a/libio/obprintf.c b/libio/obprintf.c
index 1167a93d0b..0a50c8e0fc 100644
--- a/libio/obprintf.c
+++ b/libio/obprintf.c
@@ -1,5 +1,5 @@
/* Print output of stream to given obstack.
- Copyright (C) 1996,1997,1999,2000,2001,2002,2003,2004,2005
+ Copyright (C) 1996,1997,1999,2000,2001,2002,2003,2004,2005,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -176,9 +176,7 @@ _IO_obstack_vprintf (struct obstack *obstack, const char *format, va_list args)
return result;
}
-#ifdef weak_alias
-weak_alias (_IO_obstack_vprintf, obstack_vprintf)
-#endif
+ldbl_weak_alias (_IO_obstack_vprintf, obstack_vprintf)
int
@@ -191,6 +189,4 @@ _IO_obstack_printf (struct obstack *obstack, const char *format, ...)
va_end (ap);
return result;
}
-#ifdef weak_alias
-weak_alias (_IO_obstack_printf, obstack_printf)
-#endif
+ldbl_weak_alias (_IO_obstack_printf, obstack_printf)
diff --git a/libio/stdio.h b/libio/stdio.h
index 3be5728579..80838d2997 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -295,6 +295,11 @@ extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW;
and the number of characters written on fflush or fclose. */
extern FILE *open_memstream (char **__restrict __bufloc,
size_t *__restrict __sizeloc) __THROW;
+
+/* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces
+ a wide character string. */
+extern FILE *open_wmemstream (wchar_t **__restrict __bufloc,
+ size_t *__restrict __sizeloc) __THROW;
#endif
@@ -838,6 +843,9 @@ extern void funlockfile (FILE *__stream) __THROW;
#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
# include <bits/stdio2.h>
#endif
+#ifdef __LDBL_COMPAT
+# include <bits/stdio-ldbl.h>
+#endif
__END_DECLS
diff --git a/libio/swprintf.c b/libio/swprintf.c
index 298c1e7537..ea0bdfd33c 100644
--- a/libio/swprintf.c
+++ b/libio/swprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1995,1997,1998,1999,2000,2003
+/* Copyright (C) 1991,1995,1997,1998,1999,2000,2003,2004,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -17,13 +17,14 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <libioP.h>
#include <stdarg.h>
#include <wchar.h>
/* Write formatted output into S, according to the format string FORMAT. */
/* VARARGS3 */
int
-swprintf (wchar_t *s, size_t n, const wchar_t *format, ...)
+__swprintf (wchar_t *s, size_t n, const wchar_t *format, ...)
{
va_list arg;
int done;
@@ -34,3 +35,4 @@ swprintf (wchar_t *s, size_t n, const wchar_t *format, ...)
return done;
}
+ldbl_strong_alias (__swprintf, swprintf)
diff --git a/libio/swscanf.c b/libio/swscanf.c
index c837ad14f6..f93d207416 100644
--- a/libio/swscanf.c
+++ b/libio/swscanf.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,1995,1996,1998,1999,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1998, 1999, 2003, 2006
+ 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
@@ -16,13 +17,14 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <libioP.h>
#include <stdarg.h>
#include <wchar.h>
/* Read formatted input from S, according to the format string FORMAT. */
/* VARARGS2 */
int
-swscanf (const wchar_t *s, const wchar_t *format, ...)
+__swscanf (const wchar_t *s, const wchar_t *format, ...)
{
va_list arg;
int done;
@@ -33,3 +35,4 @@ swscanf (const wchar_t *s, const wchar_t *format, ...)
return done;
}
+ldbl_strong_alias (__swscanf, swscanf)
diff --git a/libio/tst-fopenloc2.c b/libio/tst-fopenloc2.c
new file mode 100644
index 0000000000..5ddd63446b
--- /dev/null
+++ b/libio/tst-fopenloc2.c
@@ -0,0 +1,116 @@
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <wchar.h>
+
+
+static const struct
+{
+ const char *enc;
+ const char *data;
+ size_t datalen;
+ const wchar_t *expected;
+ size_t expectedlen;
+} tests[] =
+ {
+ { "UCS-4LE", "a\0\0\0b\0\0\0", 8, L"ab", 2 },
+ { "UCS-4BE", "\0\0\0a\0\0\0b", 8, L"ab", 2 },
+ };
+#define ntests (sizeof (tests) / sizeof (tests[0]))
+
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+static void prepare (void);
+#define PREPARE(argc, argv) prepare ();
+
+#include "../test-skeleton.c"
+
+
+static int fd;
+static char *tmpname;
+
+
+static void
+prepare (void)
+{
+ fd = create_temp_file ("tst-fopenloc2", &tmpname);
+ if (fd == -1)
+ {
+ puts ("cannot open temp file");
+ exit (1);
+ }
+}
+
+
+static int
+do_test (void)
+{
+ for (int i = 0; i < ntests; ++i)
+ {
+ if (ftruncate (fd, 0) != 0)
+ {
+ printf ("ftruncate in round %d failed\n", i + 1);
+ return 1;
+ }
+
+ if (TEMP_FAILURE_RETRY (write (fd, tests[i].data, tests[i].datalen))
+ != tests[i].datalen)
+ {
+ printf ("write in round %d failed\n", i + 1);
+ return 1;
+ }
+
+ if (lseek (fd, 0, SEEK_SET) != 0)
+ {
+ printf ("lseek in round %d failed\n", i + 1);
+ return 1;
+ }
+
+ char *ccs;
+ if (asprintf (&ccs, "r,ccs=%s", tests[i].enc) == -1)
+ {
+ printf ("asprintf in round %d failed\n", i + 1);
+ return 1;
+ }
+
+ FILE *fp = fopen (tmpname, ccs);
+ if (fp == NULL)
+ {
+ printf ("fopen in round %d failed\n", i + 1);
+ return 1;
+ }
+
+#define LINELEN 100
+ wchar_t line[LINELEN];
+ if (fgetws (line, LINELEN, fp) != line)
+ {
+ printf ("fgetws in round %d failed\n", i + 1);
+ return 1;
+ }
+
+ if (wcslen (line) != tests[i].expectedlen)
+ {
+ printf ("round %d: expected length %zu, got length %zu\n",
+ i + 1, tests[i].expectedlen, wcslen (line));
+ return 1;
+ }
+
+ if (wcscmp (tests[i].expected, line) != 0)
+ {
+ printf ("round %d: expected L\"%ls\", got L\"%ls\"\n",
+ i + 1, tests[i].expected, line);
+ return 1;
+ }
+
+ fclose (fp);
+
+ free (ccs);
+ }
+
+ close (fd);
+
+ return 0;
+}
diff --git a/libio/tst-memstream1.c b/libio/tst-memstream1.c
new file mode 100644
index 0000000000..d18f5cc22a
--- /dev/null
+++ b/libio/tst-memstream1.c
@@ -0,0 +1,89 @@
+#include <mcheck.h>
+#include <stdio.h>
+
+
+#ifndef CHAR_T
+# define CHAR_T char
+# define W(o) o
+# define OPEN_MEMSTREAM open_memstream
+#endif
+
+#define S(s) S1 (s)
+#define S1(s) #s
+
+
+static void
+mcheck_abort (enum mcheck_status ev)
+{
+ printf ("mecheck failed with status %d\n", (int) ev);
+ exit (1);
+}
+
+
+static int
+do_test (void)
+{
+ mcheck_pedantic (mcheck_abort);
+
+ CHAR_T *buf = (CHAR_T *) 1l;
+ size_t len = 12345;
+ FILE *fp = OPEN_MEMSTREAM (&buf, &len);
+ if (fp == NULL)
+ {
+ printf ("%s failed\n", S(OPEN_MEMSTREAM));
+ return 1;
+ }
+
+ if (fflush (fp) != 0)
+ {
+ puts ("fflush failed");
+ return 1;
+ }
+
+ if (len != 0)
+ {
+ puts ("string after no write not empty");
+ return 1;
+ }
+ if (buf == (CHAR_T *) 1l)
+ {
+ puts ("buf not updated");
+ return 1;
+ }
+ if (buf[0] != W('\0'))
+ {
+ puts ("buf[0] != 0");
+ return 1;
+ }
+
+ buf = (CHAR_T *) 1l;
+ len = 12345;
+ if (fclose (fp) != 0)
+ {
+ puts ("fclose failed");
+ return 1;
+ }
+
+ if (len != 0)
+ {
+ puts ("string after close with no write not empty");
+ return 1;
+ }
+ if (buf == (CHAR_T *) 1l)
+ {
+ puts ("buf not updated");
+ return 1;
+ }
+ if (buf[0] != W('\0'))
+ {
+ puts ("buf[0] != 0");
+ return 1;
+ }
+
+ free (buf);
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libio/tst-memstream2.c b/libio/tst-memstream2.c
new file mode 100644
index 0000000000..9619d7725d
--- /dev/null
+++ b/libio/tst-memstream2.c
@@ -0,0 +1,104 @@
+#include <mcheck.h>
+#include <stdio.h>
+
+
+#ifndef CHAR_T
+# define CHAR_T char
+# define W(o) o
+# define OPEN_MEMSTREAM open_memstream
+#endif
+
+#define S(s) S1 (s)
+#define S1(s) #s
+
+
+static void
+mcheck_abort (enum mcheck_status ev)
+{
+ printf ("mecheck failed with status %d\n", (int) ev);
+ exit (1);
+}
+
+
+static int
+do_test (void)
+{
+ mcheck_pedantic (mcheck_abort);
+
+ CHAR_T *buf = (CHAR_T *) 1l;
+ size_t len = 12345;
+ FILE *fp = OPEN_MEMSTREAM (&buf, &len);
+ if (fp == NULL)
+ {
+ printf ("%s failed\n", S(OPEN_MEMSTREAM));
+ return 1;
+ }
+
+ for (int outer = 0; outer < 800; ++outer)
+ {
+ for (int inner = 0; inner < 100; ++inner)
+ if (fputc (W('a') + (outer * 100 + inner) % 26, fp) == EOF)
+ {
+ printf ("fputc at %d:%d failed\n", outer, inner);
+ return 1;
+ }
+
+ if (fflush (fp) != 0)
+ {
+ puts ("fflush failed");
+ return 1;
+ }
+
+ if (len != (outer + 1) * 100)
+ {
+ printf ("string in round %d not %d bytest long\n",
+ outer + 1, (outer + 1) * 100);
+ return 1;
+ }
+ if (buf == (CHAR_T *) 1l)
+ {
+ printf ("round %d: buf not updated\n", outer + 1);
+ return 1;
+ }
+ for (int inner = 0; inner < (outer + 1) * 100; ++inner)
+ if (buf[inner] != W('a') + inner % 26)
+ {
+ printf ("round %d: buf[%d] != '%c'\n", outer + 1, inner,
+ (char) (W('a') + inner % 26));
+ return 1;
+ }
+ }
+
+ buf = (CHAR_T *) 1l;
+ len = 12345;
+ if (fclose (fp) != 0)
+ {
+ puts ("fclose failed");
+ return 1;
+ }
+
+ if (len != 800 * 100)
+ {
+ puts ("string after close not 80000 bytes long");
+ return 1;
+ }
+ if (buf == (CHAR_T *) 1l)
+ {
+ puts ("buf not updated");
+ return 1;
+ }
+ for (int inner = 0; inner < 800 * 100; ++inner)
+ if (buf[inner] != W('a') + inner % 26)
+ {
+ printf ("after close: buf[%d] != %c\n", inner,
+ (char) (W('a') + inner % 26));
+ return 1;
+ }
+
+ free (buf);
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libio/tst-wmemstream1.c b/libio/tst-wmemstream1.c
new file mode 100644
index 0000000000..0c59c1adcb
--- /dev/null
+++ b/libio/tst-wmemstream1.c
@@ -0,0 +1,5 @@
+#define CHAR_T wchar_t
+#define W(o) L##o
+#define OPEN_MEMSTREAM open_wmemstream
+
+#include "tst-memstream1.c"
diff --git a/libio/tst-wmemstream2.c b/libio/tst-wmemstream2.c
new file mode 100644
index 0000000000..f51a1db20c
--- /dev/null
+++ b/libio/tst-wmemstream2.c
@@ -0,0 +1,5 @@
+#define CHAR_T wchar_t
+#define W(o) L##o
+#define OPEN_MEMSTREAM open_wmemstream
+
+#include "tst-memstream2.c"
diff --git a/libio/vasprintf.c b/libio/vasprintf.c
index e32a488438..ac7733006d 100644
--- a/libio/vasprintf.c
+++ b/libio/vasprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1997,1999-2002,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1999-2002,2004,2006 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
@@ -87,7 +87,4 @@ _IO_vasprintf (result_ptr, format, args)
(*result_ptr)[needed - 1] = '\0';
return ret;
}
-
-#ifdef weak_alias
-weak_alias (_IO_vasprintf, vasprintf)
-#endif
+ldbl_weak_alias (_IO_vasprintf, vasprintf)
diff --git a/libio/vscanf.c b/libio/vscanf.c
index 477cbaee84..78c30eefdf 100644
--- a/libio/vscanf.c
+++ b/libio/vscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997, 2002, 2006 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
@@ -37,7 +37,4 @@ _IO_vscanf (format, args)
{
return INTUSE(_IO_vfscanf) (_IO_stdin, format, args, NULL);
}
-
-#ifdef weak_alias
-weak_alias (_IO_vscanf, vscanf)
-#endif
+ldbl_weak_alias (_IO_vscanf, vscanf)
diff --git a/libio/vsnprintf.c b/libio/vsnprintf.c
index 4250c2d2de..289160e540 100644
--- a/libio/vsnprintf.c
+++ b/libio/vsnprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994,1997,1999-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1994,1997,1999-2003, 2004, 2006 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
@@ -123,8 +123,5 @@ _IO_vsnprintf (string, maxlen, format, args)
*sf.f._sbf._f._IO_write_ptr = '\0';
return ret;
}
-
-#ifdef weak_alias
-weak_alias (_IO_vsnprintf, __vsnprintf)
-weak_alias (_IO_vsnprintf, vsnprintf)
-#endif
+ldbl_weak_alias (_IO_vsnprintf, __vsnprintf)
+ldbl_weak_alias (_IO_vsnprintf, vsnprintf)
diff --git a/libio/vswprintf.c b/libio/vswprintf.c
index eda8495241..5bbd20227b 100644
--- a/libio/vswprintf.c
+++ b/libio/vswprintf.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1994,1997,1999-2002,2004,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1997, 1999-2002, 2004, 2005, 2006
+ 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
@@ -126,8 +127,5 @@ _IO_vswprintf (string, maxlen, format, args)
return ret;
}
-
-#ifdef weak_alias
weak_alias (_IO_vswprintf, __vswprintf)
-weak_alias (_IO_vswprintf, vswprintf)
-#endif
+ldbl_weak_alias (_IO_vswprintf, vswprintf)
diff --git a/libio/vwprintf.c b/libio/vwprintf.c
index 814fdf32bf..bd9a950c7c 100644
--- a/libio/vwprintf.c
+++ b/libio/vwprintf.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,1993,1995,1997,1999,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1995, 1997, 1999, 2001, 2006
+ 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
@@ -16,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <libioP.h>
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
@@ -23,9 +25,8 @@
/* Write formatted output to stdout according to the
format string FORMAT, using the argument list in ARG. */
int
-vwprintf (format, arg)
- const wchar_t *format;
- __gnuc_va_list arg;
+__vwprintf (const wchar_t *format, __gnuc_va_list arg)
{
return __vfwprintf (stdout, format, arg);
}
+ldbl_strong_alias (__vwprintf, vwprintf)
diff --git a/libio/vwscanf.c b/libio/vwscanf.c
index cd7af9ce5b..f6d04e8e87 100644
--- a/libio/vwscanf.c
+++ b/libio/vwscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997, 1999, 2006 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
@@ -29,9 +29,8 @@
#include <wchar.h>
int
-vwscanf (format, args)
- const wchar_t *format;
- _IO_va_list args;
+__vwscanf (const wchar_t *format, _IO_va_list args)
{
return _IO_vfwscanf (_IO_stdin, format, args, NULL);
}
+ldbl_strong_alias (__vwscanf, vwscanf)
diff --git a/libio/wfileops.c b/libio/wfileops.c
index 5f9faac223..b930aad067 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,1995,1997-2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1995,1997-2003,2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@cygnus.com>.
Based on the single byte version by Per Bothner <bothner@cygnus.com>.
@@ -69,7 +69,7 @@ _IO_wdo_write (fp, data, to_do)
{
if (_IO_new_do_write (fp, fp->_IO_write_base,
fp->_IO_write_ptr - fp->_IO_write_base) == EOF)
- return EOF;
+ return WEOF;
}
do
diff --git a/libio/wmemstream.c b/libio/wmemstream.c
new file mode 100644
index 0000000000..1709f2dd33
--- /dev/null
+++ b/libio/wmemstream.c
@@ -0,0 +1,149 @@
+/* Copyright (C) 1995-97,99,2000,2002-2004,2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "libioP.h"
+#include "strfile.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+
+struct _IO_FILE_wmemstream
+{
+ _IO_strfile _sf;
+ wchar_t **bufloc;
+ _IO_size_t *sizeloc;
+};
+
+
+static int _IO_wmem_sync (_IO_FILE* fp) __THROW;
+static void _IO_wmem_finish (_IO_FILE* fp, int) __THROW;
+
+
+static const struct _IO_jump_t _IO_wmem_jumps =
+{
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_wmem_finish),
+ JUMP_INIT (overflow, (_IO_overflow_t) _IO_wstr_overflow),
+ JUMP_INIT (underflow, (_IO_underflow_t) _IO_wstr_underflow),
+ JUMP_INIT (uflow, (_IO_underflow_t) INTUSE(_IO_wdefault_uflow)),
+ JUMP_INIT (pbackfail, (_IO_pbackfail_t) _IO_wstr_pbackfail),
+ JUMP_INIT (xsputn, INTUSE(_IO_wdefault_xsputn)),
+ JUMP_INIT (xsgetn, INTUSE(_IO_wdefault_xsgetn)),
+ JUMP_INIT (seekoff, _IO_wstr_seekoff),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, _IO_default_setbuf),
+ JUMP_INIT (sync, _IO_wmem_sync),
+ JUMP_INIT (doallocate, INTUSE(_IO_wdefault_doallocate)),
+ JUMP_INIT (read, _IO_default_read),
+ JUMP_INIT (write, _IO_default_write),
+ JUMP_INIT (seek, _IO_default_seek),
+ JUMP_INIT (close, _IO_default_close),
+ JUMP_INIT (stat, _IO_default_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue)
+};
+
+/* Open a stream that writes into a malloc'd buffer that is expanded as
+ necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
+ and the number of characters written on fflush or fclose. */
+_IO_FILE *
+open_wmemstream (bufloc, sizeloc)
+ wchar_t **bufloc;
+ _IO_size_t *sizeloc;
+{
+ struct locked_FILE
+ {
+ struct _IO_FILE_wmemstream fp;
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_t lock;
+#endif
+ struct _IO_wide_data wd;
+ } *new_f;
+ wchar_t *buf;
+
+ new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
+ if (new_f == NULL)
+ return NULL;
+#ifdef _IO_MTSAFE_IO
+ new_f->fp._sf._sbf._f._lock = &new_f->lock;
+#endif
+
+ buf = malloc (_IO_BUFSIZ);
+ if (buf == NULL)
+ return NULL;
+
+ _IO_no_init (&new_f->fp._sf._sbf._f, 0, 0, &new_f->wd, &_IO_wmem_jumps);
+ _IO_fwide (&new_f->fp._sf._sbf._f, 1);
+ _IO_wstr_init_static (&new_f->fp._sf._sbf._f, buf,
+ _IO_BUFSIZ / sizeof (wchar_t), buf);
+ new_f->fp._sf._sbf._f._flags &= ~_IO_USER_BUF;
+ new_f->fp._sf._s._allocate_buffer = (_IO_alloc_type) malloc;
+ new_f->fp._sf._s._free_buffer = (_IO_free_type) free;
+
+ new_f->fp.bufloc = bufloc;
+ new_f->fp.sizeloc = sizeloc;
+
+ return (_IO_FILE *) &new_f->fp._sf._sbf;
+}
+
+
+static int
+_IO_wmem_sync (fp)
+ _IO_FILE* fp;
+{
+ struct _IO_FILE_wmemstream *mp = (struct _IO_FILE_wmemstream *) fp;
+
+ if (fp->_wide_data->_IO_write_ptr == fp->_wide_data->_IO_write_end)
+ {
+ _IO_wstr_overflow (fp, '\0');
+ --fp->_wide_data->_IO_write_ptr;
+ }
+ else
+ *fp->_wide_data->_IO_write_ptr = '\0';
+
+ *mp->bufloc = fp->_wide_data->_IO_write_base;
+ *mp->sizeloc = (fp->_wide_data->_IO_write_ptr
+ - fp->_wide_data->_IO_write_base);
+
+ return 0;
+}
+
+
+static void
+_IO_wmem_finish (fp, dummy)
+ _IO_FILE* fp;
+ int dummy;
+{
+ struct _IO_FILE_wmemstream *mp = (struct _IO_FILE_wmemstream *) fp;
+
+ *mp->bufloc = (wchar_t *) realloc (fp->_wide_data->_IO_write_base,
+ (fp->_wide_data->_IO_write_ptr
+ - fp->_wide_data->_IO_write_base + 1)
+ * sizeof (wchar_t));
+ if (*mp->bufloc != NULL)
+ {
+ size_t len = (fp->_wide_data->_IO_write_ptr
+ - fp->_wide_data->_IO_write_base);
+ (*mp->bufloc)[len] = '\0';
+ *mp->sizeloc = len;
+
+ fp->_wide_data->_IO_buf_base = NULL;
+ }
+
+ _IO_wstr_finish (fp, 0);
+}
diff --git a/libio/wprintf.c b/libio/wprintf.c
index f418cf515d..d06451c15a 100644
--- a/libio/wprintf.c
+++ b/libio/wprintf.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,1995,1996,1997,1999,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997, 1999, 2001, 2006
+ 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
@@ -16,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <libioP.h>
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
@@ -23,7 +25,7 @@
/* Write formatted output to stdout from the format string FORMAT. */
/* VARARGS1 */
int
-wprintf (const wchar_t *format, ...)
+__wprintf (const wchar_t *format, ...)
{
va_list arg;
int done;
@@ -34,3 +36,4 @@ wprintf (const wchar_t *format, ...)
return done;
}
+ldbl_strong_alias (__wprintf, wprintf)
diff --git a/libio/wscanf.c b/libio/wscanf.c
index f4b8cd1b83..3eba6207c3 100644
--- a/libio/wscanf.c
+++ b/libio/wscanf.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997, 1999, 2006
+ 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
@@ -16,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <libioP.h>
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
@@ -24,7 +26,7 @@
/* Read formatted input from stdin according to the format string FORMAT. */
/* VARARGS1 */
int
-wscanf (const wchar_t *format, ...)
+__wscanf (const wchar_t *format, ...)
{
va_list arg;
int done;
@@ -35,3 +37,4 @@ wscanf (const wchar_t *format, ...)
return done;
}
+ldbl_strong_alias (__wscanf, wscanf)
diff --git a/malloc/obstack.c b/malloc/obstack.c
index aba21f9aac..75440d9c79 100644
--- a/malloc/obstack.c
+++ b/malloc/obstack.c
@@ -1,8 +1,7 @@
/* obstack.c - subroutines used implicitly by object stack macros
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
- This file is part of the GNU C Library. Its master source is NOT part of
- the C library, however. The master source lives in /gd/gnu/lib.
+ 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
@@ -16,8 +15,9 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -52,22 +52,38 @@
# endif
#endif
-#if defined _LIBC && defined USE_IN_LIBIO
-# include <wchar.h>
-#endif
+#include <stddef.h>
#ifndef ELIDE_CODE
+# if HAVE_INTTYPES_H
+# include <inttypes.h>
+# endif
+# if HAVE_STDINT_H || defined _LIBC
+# include <stdint.h>
+# endif
+
/* Determine default alignment. */
-struct fooalign {char x; double d;};
-# define DEFAULT_ALIGNMENT \
- ((PTR_INT_TYPE) ((char *) &((struct fooalign *) 0)->d - (char *) 0))
+union fooround
+{
+ uintmax_t i;
+ long double d;
+ void *p;
+};
+struct fooalign
+{
+ char c;
+ union fooround u;
+};
/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
But in fact it might be less smart and round addresses to as much as
DEFAULT_ROUNDING. So we prepare for it to do that. */
-union fooround {long x; double d;};
-# define DEFAULT_ROUNDING (sizeof (union fooround))
+enum
+ {
+ DEFAULT_ALIGNMENT = offsetof (struct fooalign, u),
+ DEFAULT_ROUNDING = sizeof (union fooround)
+ };
/* When we copy a long block of data, this is the unit to do it with.
On some machines, copying successive ints does not work;
@@ -143,7 +159,7 @@ _obstack_begin (struct obstack *h,
register struct _obstack_chunk *chunk; /* points to new chunk */
if (alignment == 0)
- alignment = (int) DEFAULT_ALIGNMENT;
+ alignment = DEFAULT_ALIGNMENT;
if (size == 0)
/* Default size is what GNU malloc can fit in a 4096-byte block. */
{
@@ -170,7 +186,8 @@ _obstack_begin (struct obstack *h,
chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
if (!chunk)
(*obstack_alloc_failed_handler) ();
- h->next_free = h->object_base = chunk->contents;
+ h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
+ alignment - 1);
h->chunk_limit = chunk->limit
= (char *) chunk + h->chunk_size;
chunk->prev = 0;
@@ -189,7 +206,7 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment,
register struct _obstack_chunk *chunk; /* points to new chunk */
if (alignment == 0)
- alignment = (int) DEFAULT_ALIGNMENT;
+ alignment = DEFAULT_ALIGNMENT;
if (size == 0)
/* Default size is what GNU malloc can fit in a 4096-byte block. */
{
@@ -217,7 +234,8 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment,
chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
if (!chunk)
(*obstack_alloc_failed_handler) ();
- h->next_free = h->object_base = chunk->contents;
+ h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
+ alignment - 1);
h->chunk_limit = chunk->limit
= (char *) chunk + h->chunk_size;
chunk->prev = 0;
@@ -259,8 +277,7 @@ _obstack_newchunk (struct obstack *h, int length)
/* Compute an aligned object_base in the new chunk */
object_base =
- __INT_TO_PTR ((__PTR_TO_INT (new_chunk->contents) + h->alignment_mask)
- & ~ (h->alignment_mask));
+ __PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask);
/* Move the existing object to the new chunk.
Word at a time is fast and is safe if the object
@@ -285,7 +302,10 @@ _obstack_newchunk (struct obstack *h, int length)
/* If the object just copied was the only data in OLD_CHUNK,
free that chunk and remove it from the chain.
But not if that chunk might contain an empty object. */
- if (h->object_base == old_chunk->contents && ! h->maybe_empty_object)
+ if (! h->maybe_empty_object
+ && (h->object_base
+ == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents,
+ h->alignment_mask)))
{
new_chunk->prev = old_chunk->prev;
CALL_FREEFUN (h, old_chunk);
@@ -410,7 +430,11 @@ print_and_abort (void)
happen because the "memory exhausted" message appears in other places
like this and the translation should be reused instead of creating
a very similar string which requires a separate translation. */
+# ifdef _LIBC
(void) __fxprintf (NULL, "%s\n", _("memory exhausted"));
+# else
+ fprintf (stderr, "%s\n", _("memory exhausted"));
+# endif
exit (obstack_exit_failure);
}
diff --git a/malloc/obstack.h b/malloc/obstack.h
index 03f6ccb2ce..206fe55050 100644
--- a/malloc/obstack.h
+++ b/malloc/obstack.h
@@ -1,8 +1,7 @@
/* obstack.h - object stack macros
Copyright (C) 1988-1994,1996-1999,2003,2004,2005
Free Software Foundation, Inc.
- This file is part of the GNU C Library. Its master source is NOT part of
- the C library, however. The master source lives in /gd/gnu/lib.
+ 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
@@ -16,8 +15,8 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
/* Summary:
@@ -111,19 +110,7 @@ Summary:
extern "C" {
#endif
-/* We use subtraction of (char *) 0 instead of casting to int
- because on word-addressable machines a simple cast to int
- may ignore the byte-within-word field of the pointer. */
-
-#ifndef __PTR_TO_INT
-# define __PTR_TO_INT(P) ((P) - (char *) 0)
-#endif
-
-#ifndef __INT_TO_PTR
-# define __INT_TO_PTR(P) ((P) + (char *) 0)
-#endif
-
-/* We need the type of the resulting object. If __PTRDIFF_TYPE__ is
+/* We need the type of a pointer subtraction. If __PTRDIFF_TYPE__ is
defined, as with GNU C, use that; that way we don't pollute the
namespace with <stddef.h>'s symbols. Otherwise, include <stddef.h>
and use ptrdiff_t. */
@@ -135,6 +122,23 @@ extern "C" {
# define PTR_INT_TYPE ptrdiff_t
#endif
+/* If B is the base of an object addressed by P, return the result of
+ aligning P to the next multiple of A + 1. B and P must be of type
+ char *. A + 1 must be a power of 2. */
+
+#define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A)))
+
+/* Similiar to _BPTR_ALIGN (B, P, A), except optimize the common case
+ where pointers can be converted to integers, aligned as integers,
+ and converted back again. If PTR_INT_TYPE is narrower than a
+ pointer (e.g., the AS/400), play it safe and compute the alignment
+ relative to B. Otherwise, use the faster strategy of computing the
+ alignment relative to 0. */
+
+#define __PTR_ALIGN(B, P, A) \
+ __BPTR_ALIGN (sizeof (PTR_INT_TYPE) < sizeof (void *) ? (B) : (char *) 0, \
+ P, A)
+
#include <string.h>
struct _obstack_chunk /* Lives at front of each chunk. */
@@ -151,7 +155,11 @@ struct obstack /* control current object in current chunk */
char *object_base; /* address of object we are building */
char *next_free; /* where to add next char to current object */
char *chunk_limit; /* address of char after current chunk */
- PTR_INT_TYPE temp; /* Temporary for some macros. */
+ union
+ {
+ PTR_INT_TYPE tempint;
+ void *tempptr;
+ } temp; /* Temporary for some macros. */
int alignment_mask; /* Mask of alignment for each object. */
/* These prototypes vary based on `use_extra_arg', and we use
casts to the prototypeless function type in all assignments,
@@ -276,7 +284,10 @@ __extension__ \
# define obstack_empty_p(OBSTACK) \
__extension__ \
({ struct obstack const *__o = (OBSTACK); \
- (__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); })
+ (__o->chunk->prev == 0 \
+ && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \
+ __o->chunk->contents, \
+ __o->alignment_mask)); })
# define obstack_grow(OBSTACK,where,length) \
__extension__ \
@@ -375,8 +386,8 @@ __extension__ \
if (__o1->next_free == __value) \
__o1->maybe_empty_object = 1; \
__o1->next_free \
- = __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\
- & ~ (__o1->alignment_mask)); \
+ = __PTR_ALIGN (__o1->object_base, __o1->next_free, \
+ __o1->alignment_mask); \
if (__o1->next_free - (char *)__o1->chunk \
> __o1->chunk_limit - (char *)__o1->chunk) \
__o1->next_free = __o1->chunk_limit; \
@@ -400,7 +411,10 @@ __extension__ \
(unsigned) ((h)->chunk_limit - (h)->next_free)
# define obstack_empty_p(h) \
- ((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0)
+ ((h)->chunk->prev == 0 \
+ && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \
+ (h)->chunk->contents, \
+ (h)->alignment_mask))
/* Note that the call to _obstack_newchunk is enclosed in (..., 0)
so that we can avoid having void expressions
@@ -409,23 +423,23 @@ __extension__ \
but some compilers won't accept it. */
# define obstack_make_room(h,length) \
-( (h)->temp = (length), \
- (((h)->next_free + (h)->temp > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), (h)->temp), 0) : 0))
+( (h)->temp.tempint = (length), \
+ (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \
+ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0))
# define obstack_grow(h,where,length) \
-( (h)->temp = (length), \
- (((h)->next_free + (h)->temp > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
- memcpy ((h)->next_free, where, (h)->temp), \
- (h)->next_free += (h)->temp)
+( (h)->temp.tempint = (length), \
+ (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \
+ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \
+ memcpy ((h)->next_free, where, (h)->temp.tempint), \
+ (h)->next_free += (h)->temp.tempint)
# define obstack_grow0(h,where,length) \
-( (h)->temp = (length), \
- (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \
- memcpy ((h)->next_free, where, (h)->temp), \
- (h)->next_free += (h)->temp, \
+( (h)->temp.tempint = (length), \
+ (((h)->next_free + (h)->temp.tempint + 1 > (h)->chunk_limit) \
+ ? (_obstack_newchunk ((h), (h)->temp.tempint + 1), 0) : 0), \
+ memcpy ((h)->next_free, where, (h)->temp.tempint), \
+ (h)->next_free += (h)->temp.tempint, \
*((h)->next_free)++ = 0)
# define obstack_1grow(h,datum) \
@@ -450,10 +464,10 @@ __extension__ \
(((int *) ((h)->next_free += sizeof (int)))[-1] = (aint))
# define obstack_blank(h,length) \
-( (h)->temp = (length), \
- (((h)->chunk_limit - (h)->next_free < (h)->temp) \
- ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
- obstack_blank_fast (h, (h)->temp))
+( (h)->temp.tempint = (length), \
+ (((h)->chunk_limit - (h)->next_free < (h)->temp.tempint) \
+ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \
+ obstack_blank_fast (h, (h)->temp.tempint))
# define obstack_alloc(h,length) \
(obstack_blank ((h), (length)), obstack_finish ((h)))
@@ -468,22 +482,23 @@ __extension__ \
( ((h)->next_free == (h)->object_base \
? (((h)->maybe_empty_object = 1), 0) \
: 0), \
- (h)->temp = __PTR_TO_INT ((h)->object_base), \
+ (h)->temp.tempptr = (h)->object_base, \
(h)->next_free \
- = __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \
- & ~ ((h)->alignment_mask)), \
+ = __PTR_ALIGN ((h)->object_base, (h)->next_free, \
+ (h)->alignment_mask), \
(((h)->next_free - (char *) (h)->chunk \
> (h)->chunk_limit - (char *) (h)->chunk) \
? ((h)->next_free = (h)->chunk_limit) : 0), \
(h)->object_base = (h)->next_free, \
- (void *) __INT_TO_PTR ((h)->temp))
+ (h)->temp.tempptr)
# define obstack_free(h,obj) \
-( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
- (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
+( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \
+ ((((h)->temp.tempint > 0 \
+ && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \
? (int) ((h)->next_free = (h)->object_base \
- = (h)->temp + (char *) (h)->chunk) \
- : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
+ = (h)->temp.tempint + (char *) (h)->chunk) \
+ : (((obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0)))
#endif /* not __GNUC__ or not __STDC__ */
diff --git a/math/Makefile b/math/Makefile
index 8e5c788403..b45283d8fc 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -1,4 +1,5 @@
-# Copyright (C) 1996-2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1996-2001,2002,2003,2004,2005,2006
+# Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -149,6 +150,15 @@ distribute += ieee-math.c
include ../Rules
+# The generated sysd-rules file defines rules like this for sources
+# coming from sysdeps/ directories. These rules find the generic sources.
+define o-iterator-doit
+$(objpfx)m_%$o: s_%.c $(before-compile); $$(compile-command.c)
+endef
+object-suffixes-left := $(all-object-suffixes)
+include $(o-iterator)
+
+
# This file defines the default _LIB_VERSION variable that controls
# the error return conventions for the math functions.
CPPFLAGS-s_lib_version.c := -D_POSIX_MODE
diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h
index 75b2f74556..174fe34589 100644
--- a/math/bits/mathcalls.h
+++ b/math/bits/mathcalls.h
@@ -1,5 +1,5 @@
/* Prototype declarations for math functions; helper file for <math.h>.
- Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1996-2002, 2003, 2006 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
@@ -281,7 +281,7 @@ __MATHCALL (rint,, (_Mdouble_ __x));
/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
-# ifdef __USE_ISOC99
+# if defined __USE_ISOC99 && !defined __LDBL_COMPAT
__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__));
# endif
diff --git a/math/complex.h b/math/complex.h
index f005a93912..229bb7dca6 100644
--- a/math/complex.h
+++ b/math/complex.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2006 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
@@ -84,7 +84,14 @@ __BEGIN_DECLS
/* And the long double versions. It is non-critical to define them
here unconditionally since `long double' is required in ISO C99. */
-#if __STDC__ - 0 || __GNUC__ - 0 && !defined __NO_LONG_DOUBLE_MATH
+#if (__STDC__ - 0 || __GNUC__ - 0) \
+ && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
+# ifdef __LDBL_COMPAT
+# undef __MATHDECL_1
+# define __MATHDECL_1(type, function, args) \
+ extern type __REDIRECT(__MATH_PRECNAME(function), args, function) __THROW
+# endif
+
# ifndef _Mlong_double_
# define _Mlong_double_ long double
# endif
diff --git a/math/e_exp2l.c b/math/e_exp2l.c
index 64ef6d3d50..7e598d8d2d 100644
--- a/math/e_exp2l.c
+++ b/math/e_exp2l.c
@@ -1,14 +1,10 @@
#include <math.h>
-#include <stdio.h>
-#include <errno.h>
+#include "math_private.h"
long double
__ieee754_exp2l (long double x)
{
- fputs ("__ieee754_exp2l not implemented\n", stderr);
- __set_errno (ENOSYS);
- return 0.0;
+ /* This is a very stupid and inprecise implementation. It'll get
+ replaced sometime (soon?). */
+ return __ieee754_expl (M_LN2l * x);
}
-
-stub_warning (exp2l)
-#include <stub-tag.h>
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 15509019c9..9534596725 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1997.
@@ -22,7 +22,7 @@
This file is processed by a perl script. The resulting file has to
be included by a master file that defines:
- Makros:
+ Macros:
FUNC(function): converts general function name (like cos) to
name with correct suffix (e.g. cosl or cosf)
MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L)
@@ -498,7 +498,7 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
&& computed == 0.0 && expected == 0.0
&& signbit(computed) != signbit (expected))
ok = 0;
- else if (ulp == 0.0 || (ulp <= max_ulp && !ignore_max_ulp))
+ else if (ulp <= 0.5 || (ulp <= max_ulp && !ignore_max_ulp))
ok = 1;
else
{
@@ -1116,7 +1116,7 @@ cacosh_test (void)
TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
TEST_c_c (cacosh, 0.75L, 1.25L, 1.13239363160530819522266333696834467L, 1.11752014915610270578240049553777969L);
- TEST_c_c (cacosh, -2, -3, -1.9833870299165354323470769028940395L, 2.1414491111159960199416055713254211L);
+ TEST_c_c (cacosh, -2, -3, 1.9833870299165354323470769028940395L, -2.1414491111159960199416055713254211L);
END (cacosh, complex);
}
@@ -1631,6 +1631,51 @@ ceil_test (void)
TEST_f_f (ceil, 0.25, 1.0);
TEST_f_f (ceil, -0.25, minus_zero);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (ceil, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (ceil, 4503599627370496.25L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370496.5L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370497.5L, 4503599627370498.0L);
+
+ TEST_f_f (ceil, -4503599627370495.5L, -4503599627370495.0L);
+ TEST_f_f (ceil, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (ceil, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (ceil, -4503599627370496.75L, -4503599627370496.0L);
+ TEST_f_f (ceil, -4503599627370497.5L, -4503599627370497.0L);
+
+ TEST_f_f (ceil, 9007199254740991.5L, 9007199254740992.0L);
+ TEST_f_f (ceil, 9007199254740992.25L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740992.5L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (ceil, -9007199254740991.5L, -9007199254740991.0L);
+ TEST_f_f (ceil, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740992.5L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740992.75L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740993.5L, -9007199254740993.0L);
+
+ TEST_f_f (ceil, 72057594037927935.5L, 72057594037927936.0L);
+ TEST_f_f (ceil, 72057594037927936.25L, 72057594037927937.0L);
+ TEST_f_f (ceil, 72057594037927936.5L, 72057594037927937.0L);
+ TEST_f_f (ceil, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (ceil, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (ceil, -72057594037927935.5L, -72057594037927935.0L);
+ TEST_f_f (ceil, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927936.75L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927937.5L, -72057594037927937.0L);
+
+ TEST_f_f (ceil, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.25L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
+
END (ceil);
}
@@ -2389,7 +2434,9 @@ erfc_test (void)
TEST_f_f (erfc, 4.125L, 0.542340079956506600531223408575531062e-8L);
#ifdef TEST_LDOUBLE
/* The result can only be represented in long double. */
+# if LDBL_MIN_10_EXP < -319
TEST_f_f (erfc, 27.0L, 0.523704892378925568501606768284954709e-318L);
+# endif
#endif
END (erfc);
@@ -2584,6 +2631,52 @@ floor_test (void)
TEST_f_f (floor, 0.25, 0.0);
TEST_f_f (floor, -0.25, -1.0);
+
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (floor, 4503599627370495.5L, 4503599627370495.0L);
+ TEST_f_f (floor, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (floor, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (floor, 4503599627370496.75L, 4503599627370496.0L);
+ TEST_f_f (floor, 4503599627370497.5L, 4503599627370497.0L);
+
+ TEST_f_f (floor, -4503599627370495.5L, -4503599627370496.0L);
+ TEST_f_f (floor, -4503599627370496.25L, -4503599627370497.0L);
+ TEST_f_f (floor, -4503599627370496.5L, -4503599627370497.0L);
+ TEST_f_f (floor, -4503599627370496.75L, -4503599627370497.0L);
+ TEST_f_f (floor, -4503599627370497.5L, -4503599627370498.0L);
+
+ TEST_f_f (floor, 9007199254740991.5L, 9007199254740991.0L);
+ TEST_f_f (floor, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (floor, 9007199254740992.5L, 9007199254740992.0L);
+ TEST_f_f (floor, 9007199254740992.75L, 9007199254740992.0L);
+ TEST_f_f (floor, 9007199254740993.5L, 9007199254740993.0L);
+
+ TEST_f_f (floor, -9007199254740991.5L, -9007199254740992.0L);
+ TEST_f_f (floor, -9007199254740992.25L, -9007199254740993.0L);
+ TEST_f_f (floor, -9007199254740992.5L, -9007199254740993.0L);
+ TEST_f_f (floor, -9007199254740992.75L, -9007199254740993.0L);
+ TEST_f_f (floor, -9007199254740993.5L, -9007199254740994.0L);
+
+ TEST_f_f (floor, 72057594037927935.5L, 72057594037927935.0L);
+ TEST_f_f (floor, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (floor, 72057594037927936.5L, 72057594037927936.0L);
+ TEST_f_f (floor, 72057594037927936.75L, 72057594037927936.0L);
+ TEST_f_f (floor, 72057594037927937.5L, 72057594037927937.0L);
+
+ TEST_f_f (floor, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (floor, -72057594037927936.25L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927936.5L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (floor, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
+#endif
+
END (floor);
}
@@ -3164,6 +3257,44 @@ llrint_test (void)
TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
/* 0x100000000000000 */
TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
+#ifdef TEST_LDOUBLE
+ /* The input can only be represented in long double. */
+ TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
+ TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
+
+ TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
+ TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
+
+ TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
+
+ TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
+
+ TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
+ TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
+
+ TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
+ TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
+#endif
END (llrint);
}
@@ -3398,6 +3529,52 @@ llround_test (void)
TEST_f_L (llround, 8589934591.5, 8589934592LL);
#endif
+#ifdef TEST_LDOUBLE
+ /* The input can only be represented in long double. */
+ TEST_f_L (llround, 4503599627370495.5L, 4503599627370496LL);
+ TEST_f_L (llround, 4503599627370496.25L, 4503599627370496LL);
+ TEST_f_L (llround, 4503599627370496.5L, 4503599627370497LL);
+ TEST_f_L (llround, 4503599627370496.75L, 4503599627370497LL);
+ TEST_f_L (llround, 4503599627370497.5L, 4503599627370498LL);
+
+ TEST_f_L (llround, -4503599627370495.5L, -4503599627370496LL);
+ TEST_f_L (llround, -4503599627370496.25L, -4503599627370496LL);
+ TEST_f_L (llround, -4503599627370496.5L, -4503599627370497LL);
+ TEST_f_L (llround, -4503599627370496.75L, -4503599627370497LL);
+ TEST_f_L (llround, -4503599627370497.5L, -4503599627370498LL);
+
+ TEST_f_L (llround, 9007199254740991.5L, 9007199254740992LL);
+ TEST_f_L (llround, 9007199254740992.25L, 9007199254740992LL);
+ TEST_f_L (llround, 9007199254740992.5L, 9007199254740993LL);
+ TEST_f_L (llround, 9007199254740992.75L, 9007199254740993LL);
+ TEST_f_L (llround, 9007199254740993.5L, 9007199254740994LL);
+
+ TEST_f_L (llround, -9007199254740991.5L, -9007199254740992LL);
+ TEST_f_L (llround, -9007199254740992.25L, -9007199254740992LL);
+ TEST_f_L (llround, -9007199254740992.5L, -9007199254740993LL);
+ TEST_f_L (llround, -9007199254740992.75L, -9007199254740993LL);
+ TEST_f_L (llround, -9007199254740993.5L, -9007199254740994LL);
+
+ TEST_f_L (llround, 72057594037927935.5L, 72057594037927936LL);
+ TEST_f_L (llround, 72057594037927936.25L, 72057594037927936LL);
+ TEST_f_L (llround, 72057594037927936.5L, 72057594037927937LL);
+ TEST_f_L (llround, 72057594037927936.75L, 72057594037927937LL);
+ TEST_f_L (llround, 72057594037927937.5L, 72057594037927938LL);
+
+ TEST_f_L (llround, -72057594037927935.5L, -72057594037927936LL);
+ TEST_f_L (llround, -72057594037927936.25L, -72057594037927936LL);
+ TEST_f_L (llround, -72057594037927936.5L, -72057594037927937LL);
+ TEST_f_L (llround, -72057594037927936.75L, -72057594037927937LL);
+ TEST_f_L (llround, -72057594037927937.5L, -72057594037927938LL);
+
+ TEST_f_L (llround, 9223372036854775806.25L, 9223372036854775806LL);
+ TEST_f_L (llround, -9223372036854775806.25L, -9223372036854775806LL);
+ TEST_f_L (llround, 9223372036854775806.5L, 9223372036854775807LL);
+ TEST_f_L (llround, -9223372036854775806.5L, -9223372036854775807LL);
+ TEST_f_L (llround, 9223372036854775807.0L, 9223372036854775807LL);
+ TEST_f_L (llround, -9223372036854775807.0L, -9223372036854775807LL);
+#endif
+
END (llround);
}
@@ -3794,6 +3971,50 @@ rint_test (void)
TEST_f_f (rint, -2.5, -2.0);
TEST_f_f (rint, -3.5, -4.0);
TEST_f_f (rint, -4.5, -4.0);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
+
+ TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
+ TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
+
+ TEST_f_f (rint, 9007199254740991.5L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.5L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (rint, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (rint, -9007199254740991.5L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.5L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.75L, -9007199254740993.0L);
+ TEST_f_f (rint, -9007199254740993.5L, -9007199254740994.0L);
+
+ TEST_f_f (rint, 72057594037927935.5L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.5L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (rint, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (rint, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (rint, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (rint, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (rint, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
END (rint);
}
@@ -3924,6 +4145,51 @@ round_test (void)
TEST_f_f (round, 2097152.5, 2097153);
TEST_f_f (round, -2097152.5, -2097153);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (round, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (round, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (round, 4503599627370496.5L, 4503599627370497.0L);
+ TEST_f_f (round, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (round, 4503599627370497.5L, 4503599627370498.0L);
+
+ TEST_f_f (round, -4503599627370495.5L, -4503599627370496.0L);
+ TEST_f_f (round, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (round, -4503599627370496.5L, -4503599627370497.0L);
+ TEST_f_f (round, -4503599627370496.75L, -4503599627370497.0L);
+ TEST_f_f (round, -4503599627370497.5L, -4503599627370498.0L);
+
+ TEST_f_f (round, 9007199254740991.5L, 9007199254740992.0L);
+ TEST_f_f (round, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (round, 9007199254740992.5L, 9007199254740993.0L);
+ TEST_f_f (round, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (round, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (round, -9007199254740991.5L, -9007199254740992.0L);
+ TEST_f_f (round, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (round, -9007199254740992.5L, -9007199254740993.0L);
+ TEST_f_f (round, -9007199254740992.75L, -9007199254740993.0L);
+ TEST_f_f (round, -9007199254740993.5L, -9007199254740994.0L);
+
+ TEST_f_f (round, 72057594037927935.5L, 72057594037927936.0L);
+ TEST_f_f (round, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (round, 72057594037927936.5L, 72057594037927937.0L);
+ TEST_f_f (round, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (round, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (round, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (round, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (round, -72057594037927936.5L, -72057594037927937.0L);
+ TEST_f_f (round, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (round, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (round, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (round, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
+
END (round);
}
@@ -4291,6 +4557,50 @@ trunc_test (void)
TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (trunc, 4503599627370495.5L, 4503599627370495.0L);
+ TEST_f_f (trunc, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (trunc, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (trunc, 4503599627370496.75L, 4503599627370496.0L);
+ TEST_f_f (trunc, 4503599627370497.5L, 4503599627370497.0L);
+
+ TEST_f_f (trunc, -4503599627370495.5L, -4503599627370495.0L);
+ TEST_f_f (trunc, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (trunc, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (trunc, -4503599627370496.75L, -4503599627370496.0L);
+ TEST_f_f (trunc, -4503599627370497.5L, -4503599627370497.0L);
+
+ TEST_f_f (trunc, 9007199254740991.5L, 9007199254740991.0L);
+ TEST_f_f (trunc, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (trunc, 9007199254740992.5L, 9007199254740992.0L);
+ TEST_f_f (trunc, 9007199254740992.75L, 9007199254740992.0L);
+ TEST_f_f (trunc, 9007199254740993.5L, 9007199254740993.0L);
+
+ TEST_f_f (trunc, -9007199254740991.5L, -9007199254740991.0L);
+ TEST_f_f (trunc, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (trunc, -9007199254740992.5L, -9007199254740992.0L);
+ TEST_f_f (trunc, -9007199254740992.75L, -9007199254740992.0L);
+ TEST_f_f (trunc, -9007199254740993.5L, -9007199254740993.0L);
+
+ TEST_f_f (trunc, 72057594037927935.5L, 72057594037927935.0L);
+ TEST_f_f (trunc, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (trunc, 72057594037927936.5L, 72057594037927936.0L);
+ TEST_f_f (trunc, 72057594037927936.75L, 72057594037927936.0L);
+ TEST_f_f (trunc, 72057594037927937.5L, 72057594037927937.0L);
+
+ TEST_f_f (trunc, -72057594037927935.5L, -72057594037927935.0L);
+ TEST_f_f (trunc, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927936.75L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927937.5L, -72057594037927937.0L);
+
+ TEST_f_f (trunc, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
+#endif
END (trunc);
}
diff --git a/math/math.h b/math/math.h
index 7f8a4815f4..050b89ca85 100644
--- a/math/math.h
+++ b/math/math.h
@@ -1,5 +1,6 @@
/* Declarations for math functions.
- Copyright (C) 1991-1993,1995-1999,2001,2002,2004 Free Software Foundation, Inc.
+ Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006
+ 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
@@ -96,10 +97,33 @@ __BEGIN_DECLS
# undef _Mdouble_END_NAMESPACE
# undef __MATH_PRECNAME
-# if (__STDC__ - 0 || __GNUC__ - 0) && !defined __NO_LONG_DOUBLE_MATH
+# if (__STDC__ - 0 || __GNUC__ - 0) \
+ && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
+# ifdef __LDBL_COMPAT
+
+# ifdef __USE_ISOC99
+extern float __nldbl_nexttowardf (float __x, long double __y)
+ __attribute__ ((__const__)) __THROW;
+# ifdef __REDIRECT_NTH
+extern float __REDIRECT_NTH (nexttowardf, (float __x, long double __y),
+ __nldbl_nexttowardf)
+ __attribute__ ((__const__));
+extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
+ nextafter) __attribute__ ((__const__));
+# endif
+# endif
+
/* Include the file of declarations again, this time using `long double'
instead of `double' and appending l to each function name. */
+# undef __MATHDECL_1
+# define __MATHDECL_2(type, function,suffix, args, alias) \
+ extern type __REDIRECT(__MATH_PRECNAME(function,suffix), \
+ args, alias) __THROW
+# define __MATHDECL_1(type, function,suffix, args) \
+ __MATHDECL_2(type, function,suffix, args, __CONCAT(function,suffix))
+# endif
+
# ifndef _Mlong_double_
# define _Mlong_double_ long double
# endif
diff --git a/math/s_cacosh.c b/math/s_cacosh.c
index 1ae8708d49..e921f0763e 100644
--- a/math/s_cacosh.c
+++ b/math/s_cacosh.c
@@ -1,5 +1,5 @@
/* Return arc hyperbole cosine for double value.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -73,6 +73,9 @@ __cacosh (__complex__ double x)
y = __csqrt (y);
+ if (__real__ x < 0.0)
+ y = -y;
+
__real__ y += __real__ x;
__imag__ y += __imag__ x;
diff --git a/math/s_cacoshf.c b/math/s_cacoshf.c
index 52c35505e0..3fc48bb617 100644
--- a/math/s_cacoshf.c
+++ b/math/s_cacoshf.c
@@ -1,5 +1,5 @@
/* Return arc hyperbole cosine for float value.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -75,6 +75,9 @@ __cacoshf (__complex__ float x)
y = __csqrtf (y);
+ if (__real__ x < 0.0)
+ y = -y;
+
__real__ y += __real__ x;
__imag__ y += __imag__ x;
diff --git a/math/s_cacoshl.c b/math/s_cacoshl.c
index 4e5e2b3e3e..643858920e 100644
--- a/math/s_cacoshl.c
+++ b/math/s_cacoshl.c
@@ -1,5 +1,5 @@
/* Return arc hyperbole cosine for long double value.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -73,6 +73,9 @@ __cacoshl (__complex__ long double x)
y = __csqrtl (y);
+ if (__real__ x < 0.0)
+ y = -y;
+
__real__ y += __real__ x;
__imag__ y += __imag__ x;
diff --git a/math/w_j0l.c b/math/w_j0l.c
index fde0f64f89..1ec6e9e0c2 100644
--- a/math/w_j0l.c
+++ b/math/w_j0l.c
@@ -26,9 +26,9 @@ static char rcsid[] = "$NetBSD: $";
#include "math_private.h"
#ifdef __STDC__
- long double j0l(long double x) /* wrapper j0l */
+ long double __j0l(long double x) /* wrapper j0l */
#else
- long double j0l(x) /* wrapper j0 */
+ long double __j0l(x) /* wrapper j0 */
long double x;
#endif
{
@@ -43,11 +43,12 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
+weak_alias (__j0l, j0l)
#ifdef __STDC__
- long double y0l(long double x) /* wrapper y0l */
+ long double __y0l(long double x) /* wrapper y0l */
#else
- long double y0l(x) /* wrapper y0 */
+ long double __y0l(x) /* wrapper y0 */
long double x;
#endif
{
@@ -71,3 +72,5 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
+
+weak_alias (__y0l, y0l)
diff --git a/math/w_j1l.c b/math/w_j1l.c
index 5ecfd1ec6e..7bd31ad995 100644
--- a/math/w_j1l.c
+++ b/math/w_j1l.c
@@ -26,9 +26,9 @@ static char rcsid[] = "$NetBSD: $";
#include "math_private.h"
#ifdef __STDC__
- long double j1l(long double x) /* wrapper j1l */
+ long double __j1l(long double x) /* wrapper j1l */
#else
- long double j1l(x) /* wrapper j1l */
+ long double __j1l(x) /* wrapper j1l */
long double x;
#endif
{
@@ -44,11 +44,12 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
+weak_alias (__j1l, j1l)
#ifdef __STDC__
- long double y1l(long double x) /* wrapper y1l */
+ long double __y1l(long double x) /* wrapper y1l */
#else
- long double y1l(x) /* wrapper y1l */
+ long double __y1l(x) /* wrapper y1l */
long double x;
#endif
{
@@ -72,3 +73,4 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
+weak_alias (__y1l, y1l)
diff --git a/math/w_jnl.c b/math/w_jnl.c
index 021c16a104..4bb4d6b620 100644
--- a/math/w_jnl.c
+++ b/math/w_jnl.c
@@ -48,9 +48,9 @@ static char rcsid[] = "$NetBSD: $";
#include "math_private.h"
#ifdef __STDC__
- long double jnl(int n, long double x) /* wrapper jnl */
+ long double __jnl(int n, long double x) /* wrapper jnl */
#else
- long double jnl(n,x) /* wrapper jnl */
+ long double __jnl(n,x) /* wrapper jnl */
long double x; int n;
#endif
{
@@ -66,11 +66,12 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
+weak_alias (__jnl, jnl)
#ifdef __STDC__
- long double ynl(int n, long double x) /* wrapper ynl */
+ long double __ynl(int n, long double x) /* wrapper ynl */
#else
- long double ynl(n,x) /* wrapper ynl */
+ long double __ynl(n,x) /* wrapper ynl */
long double x; int n;
#endif
{
@@ -94,3 +95,4 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
+weak_alias (__ynl, ynl)
diff --git a/misc/Makefile b/misc/Makefile
index 5199b6b653..7d60baa7d6 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1991-2002,2003,2004,2005,2006 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
@@ -25,11 +25,12 @@ subdir := misc
headers := sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \
sys/ptrace.h sys/file.h sys/dir.h sys/cdefs.h \
ar.h a.out.h libgen.h stab.h bits/stab.def sgtty.h \
- ttyent.h syslog.h sys/syslog.h paths.h sys/reboot.h \
+ ttyent.h paths.h sys/reboot.h \
sys/mman.h sys/param.h fstab.h mntent.h search.h err.h error.h \
sys/queue.h sysexits.h syscall.h sys/syscall.h sys/swap.h \
sys/select.h ustat.h sys/ustat.h bits/ustat.h sys/sysinfo.h \
- regexp.h bits/select.h bits/mman.h sys/xattr.h bits/syslog.h
+ regexp.h bits/select.h bits/mman.h sys/xattr.h \
+ syslog.h sys/syslog.h bits/syslog.h bits/syslog-ldbl.h
routines := brk sbrk sstk ioctl \
readv writev \
@@ -76,7 +77,7 @@ endif
gpl2lgpl := error.c error.h
tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
- tst-error1
+ tst-error1 tst-pselect
ifeq (no,$(cross-compiling))
tests: $(objpfx)tst-error1-mem
endif
diff --git a/misc/bits/syslog-ldbl.h b/misc/bits/syslog-ldbl.h
new file mode 100644
index 0000000000..d153c8f8cd
--- /dev/null
+++ b/misc/bits/syslog-ldbl.h
@@ -0,0 +1,36 @@
+/* -mlong-double-64 compatibility mode for syslog functions.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_SYSLOG_H
+# error "Never include <bits/syslog-ldbl.h> directly; use <sys/syslog.h> instead."
+#endif
+
+__LDBL_REDIR_DECL (syslog)
+
+#ifdef __USE_BSD
+__LDBL_REDIR_DECL (vsyslog)
+#endif
+
+#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
+__LDBL_REDIR_DECL (__syslog_chk)
+
+# ifdef __USE_BSD
+__LDBL_REDIR_DECL (__vsyslog_chk)
+# endif
+#endif
diff --git a/misc/efgcvt.c b/misc/efgcvt.c
index 915d00dfd5..b9fb4a9b71 100644
--- a/misc/efgcvt.c
+++ b/misc/efgcvt.c
@@ -1,5 +1,6 @@
/* Compatibility functions for floating point formatting.
- Copyright (C) 1995, 1996, 1997, 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1999, 2002, 2006
+ 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
@@ -23,6 +24,7 @@
#include <sys/param.h>
#include <float.h>
#include <bits/libc-lock.h>
+#include <math_ldbl_opt.h>
#ifndef FLOAT_TYPE
# define FLOAT_TYPE double
@@ -44,10 +46,14 @@
# error "NDIGIT_MAX must be precomputed"
# define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0)))
# endif
+#else
+# define LONG_DOUBLE_CVT
#endif
#define APPEND(a, b) APPEND2 (a, b)
#define APPEND2(a, b) a##b
+#define __APPEND(a, b) __APPEND2 (a, b)
+#define __APPEND2(a, b) __##a##b
#define FCVT_BUFFER APPEND (FUNC_PREFIX, fcvt_buffer)
@@ -60,14 +66,14 @@ static char ECVT_BUFFER[MAXDIG];
libc_freeres_ptr (static char *FCVT_BUFPTR);
char *
-APPEND (FUNC_PREFIX, fcvt) (value, ndigit, decpt, sign)
+__APPEND (FUNC_PREFIX, fcvt) (value, ndigit, decpt, sign)
FLOAT_TYPE value;
int ndigit, *decpt, *sign;
{
if (FCVT_BUFPTR == NULL)
{
- if (APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign,
- FCVT_BUFFER, MAXDIG) != -1)
+ if (__APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign,
+ FCVT_BUFFER, MAXDIG) != -1)
return FCVT_BUFFER;
FCVT_BUFPTR = (char *) malloc (FCVT_MAXDIG);
@@ -75,26 +81,26 @@ APPEND (FUNC_PREFIX, fcvt) (value, ndigit, decpt, sign)
return FCVT_BUFFER;
}
- (void) APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign,
- FCVT_BUFPTR, FCVT_MAXDIG);
+ (void) __APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign,
+ FCVT_BUFPTR, FCVT_MAXDIG);
return FCVT_BUFPTR;
}
char *
-APPEND (FUNC_PREFIX, ecvt) (value, ndigit, decpt, sign)
+__APPEND (FUNC_PREFIX, ecvt) (value, ndigit, decpt, sign)
FLOAT_TYPE value;
int ndigit, *decpt, *sign;
{
- (void) APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign,
- ECVT_BUFFER, MAXDIG);
+ (void) __APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign,
+ ECVT_BUFFER, MAXDIG);
return ECVT_BUFFER;
}
char *
-APPEND (FUNC_PREFIX, gcvt) (value, ndigit, buf)
+__APPEND (FUNC_PREFIX, gcvt) (value, ndigit, buf)
FLOAT_TYPE value;
int ndigit;
char *buf;
@@ -102,3 +108,26 @@ APPEND (FUNC_PREFIX, gcvt) (value, ndigit, buf)
sprintf (buf, "%.*" FLOAT_FMT_FLAG "g", MIN (ndigit, NDIGIT_MAX), value);
return buf;
}
+
+#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
+# ifdef LONG_DOUBLE_CVT
+# define cvt_symbol(symbol) \
+ cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
+ APPEND (FUNC_PREFIX, symbol), GLIBC_2_4)
+# define cvt_symbol_1(lib, local, symbol, version) \
+ versioned_symbol (lib, local, symbol, version)
+# else
+# define cvt_symbol(symbol) \
+ cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
+ APPEND (q, symbol), GLIBC_2_0); \
+ strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+# define cvt_symbol_1(lib, local, symbol, version) \
+ compat_symbol (lib, local, symbol, version)
+# endif
+#else
+# define cvt_symbol(symbol) \
+ strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+#endif
+cvt_symbol(fcvt);
+cvt_symbol(ecvt);
+cvt_symbol(gcvt);
diff --git a/misc/efgcvt_r.c b/misc/efgcvt_r.c
index 69cca9038f..ba9566d22c 100644
--- a/misc/efgcvt_r.c
+++ b/misc/efgcvt_r.c
@@ -1,5 +1,6 @@
/* Compatibility functions for floating point formatting, reentrant versions.
- Copyright (C) 1995,96,97,98,99,2000,01,02,04 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006
+ 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
@@ -25,6 +26,7 @@
#include <math.h>
#include <stdlib.h>
#include <sys/param.h>
+#include <math_ldbl_opt.h>
#ifndef FLOAT_TYPE
# define FLOAT_TYPE double
@@ -55,10 +57,14 @@
# error "FLOAT_MIN_10_NORM must be precomputed"
# define FLOAT_MIN_10_NORM exp10 (DBL_MIN_10_EXP)
# endif
+#else
+# define LONG_DOUBLE_CVT
#endif
#define APPEND(a, b) APPEND2 (a, b)
#define APPEND2(a, b) a##b
+#define __APPEND(a, b) __APPEND2 (a, b)
+#define __APPEND2(a, b) __##a##b
#define FLOOR APPEND(floor, FLOAT_NAME_EXT)
#define FABS APPEND(fabs, FLOAT_NAME_EXT)
@@ -67,7 +73,7 @@
int
-APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len)
+__APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len)
FLOAT_TYPE value;
int ndigit, *decpt, *sign;
char *buf;
@@ -163,10 +169,9 @@ APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len)
return 0;
}
-libc_hidden_def (APPEND (FUNC_PREFIX, fcvt_r))
int
-APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
+__APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
FLOAT_TYPE value;
int ndigit, *decpt, *sign;
char *buf;
@@ -229,11 +234,32 @@ APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
*sign = isfinite (value) ? signbit (value) != 0 : 0;
}
else
- if (APPEND (FUNC_PREFIX, fcvt_r) (value, MIN (ndigit, NDIGIT_MAX) - 1,
- decpt, sign, buf, len))
+ if (__APPEND (FUNC_PREFIX, fcvt_r) (value, MIN (ndigit, NDIGIT_MAX) - 1,
+ decpt, sign, buf, len))
return -1;
*decpt += exponent;
return 0;
}
-libc_hidden_def (APPEND (FUNC_PREFIX, ecvt_r))
+
+#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
+# ifdef LONG_DOUBLE_CVT
+# define cvt_symbol(symbol) \
+ cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
+ APPEND (FUNC_PREFIX, symbol), GLIBC_2_4)
+# define cvt_symbol_1(lib, local, symbol, version) \
+ versioned_symbol (lib, local, symbol, version)
+# else
+# define cvt_symbol(symbol) \
+ cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
+ APPEND (q, symbol), GLIBC_2_0); \
+ strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+# define cvt_symbol_1(lib, local, symbol, version) \
+ compat_symbol (lib, local, symbol, version)
+# endif
+#else
+# define cvt_symbol(symbol) \
+ strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+#endif
+cvt_symbol(fcvt_r);
+cvt_symbol(ecvt_r);
diff --git a/misc/pselect.c b/misc/pselect.c
index 43b371cce7..80cf8be4b3 100644
--- a/misc/pselect.c
+++ b/misc/pselect.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,1998,2001,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1998,2001,2002,2003,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -24,15 +24,16 @@
#include <sys/select.h>
#include <sysdep-cancel.h>
+
/* Check the first NFDS descriptors each in READFDS (if not NULL) for read
readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
(if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out
after waiting the interval specified therein. Additionally set the sigmask
SIGMASK for this call. Returns the number of ready descriptors, or -1 for
errors. */
-static int
-do_pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
- const struct timespec *timeout, const sigset_t *sigmask)
+int
+__pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+ const struct timespec *timeout, const sigset_t *sigmask)
{
struct timeval tval;
int retval;
@@ -61,28 +62,9 @@ do_pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
return retval;
}
-
-
-int
-__pselect (nfds, readfds, writefds, exceptfds, timeout, sigmask)
- int nfds;
- fd_set *readfds;
- fd_set *writefds;
- fd_set *exceptfds;
- const struct timespec *timeout;
- const sigset_t *sigmask;
-{
- if (SINGLE_THREAD_P)
- return do_pselect (nfds, readfds, writefds, exceptfds, timeout, sigmask);
-
- int oldtype = LIBC_CANCEL_ASYNC ();
-
- int result = do_pselect (nfds, readfds, writefds, exceptfds, timeout,
- sigmask);
-
- LIBC_CANCEL_RESET (oldtype);
-
- return result;
-}
+#ifndef __pselect
weak_alias (__pselect, pselect)
strong_alias (__pselect, __libc_pselect)
+/* __select handles cancellation. */
+LIBC_CANCEL_HANDLED ();
+#endif
diff --git a/misc/qefgcvt_r.c b/misc/qefgcvt_r.c
index d5b2a799b3..a03ff748ef 100644
--- a/misc/qefgcvt_r.c
+++ b/misc/qefgcvt_r.c
@@ -43,6 +43,8 @@
#endif
#if LDBL_MIN_10_EXP == -37
# define FLOAT_MIN_10_NORM 1.0e-37L
+#elif LDBL_MIN_10_EXP == -291
+# define FLOAT_MIN_10_NORM 1.0e-291L
#elif LDBL_MIN_10_EXP == -307
# define FLOAT_MIN_10_NORM 1.0e-307L
#elif LDBL_MIN_10_EXP == -4931
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index eb192cca49..ce5e83d571 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992-2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2001, 2002, 2004, 2005, 2006
+ 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
@@ -309,4 +310,29 @@
# endif
#endif
+#include <bits/wordsize.h>
+
+#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# define __LDBL_COMPAT 1
+# ifdef __REDIRECT
+# define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias)
+# define __LDBL_REDIR(name, proto) \
+ __LDBL_REDIR1 (name, proto, __nldbl_##name)
+# define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias)
+# define __LDBL_REDIR_NTH(name, proto) \
+ __LDBL_REDIR1_NTH (name, proto, __nldbl_##name)
+# define __LDBL_REDIR1_DECL(name, alias) \
+ extern __typeof (name) name __asm (__ASMNAME (#alias));
+# define __LDBL_REDIR_DECL(name) \
+ extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
+# endif
+#endif
+#if !defined __LDBL_COMPAT || !defined __REDIRECT
+# define __LDBL_REDIR1(name, proto, alias) name proto
+# define __LDBL_REDIR(name, proto) name proto
+# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
+# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
+# define __LDBL_REDIR_DECL(name)
+#endif
+
#endif /* sys/cdefs.h */
diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h
index 9de7570d8a..0bc5b8d677 100644
--- a/misc/sys/syslog.h
+++ b/misc/sys/syslog.h
@@ -206,6 +206,9 @@ extern void vsyslog (int __pri, __const char *__fmt, __gnuc_va_list __ap)
#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
# include <bits/syslog.h>
#endif
+#ifdef __LDBL_COMPAT
+# include <bits/syslog-ldbl.h>
+#endif
__END_DECLS
diff --git a/misc/syslog.c b/misc/syslog.c
index 6b0e7748fe..5781b4a964 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -58,6 +58,8 @@ static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94";
#endif
#include <libio/iolibio.h>
+#include <math_ldbl_opt.h>
+
#define ftell(s) INTUSE(_IO_ftell) (s)
static int LogType = SOCK_DGRAM; /* type of socket connection */
@@ -109,7 +111,7 @@ cancel_handler (void *ptr)
* print message on log file; output is intended for syslogd(8).
*/
void
-syslog(int pri, const char *fmt, ...)
+__syslog(int pri, const char *fmt, ...)
{
va_list ap;
@@ -117,7 +119,8 @@ syslog(int pri, const char *fmt, ...)
__vsyslog_chk(pri, -1, fmt, ap);
va_end(ap);
}
-libc_hidden_def (syslog)
+ldbl_hidden_def (__syslog, syslog)
+ldbl_strong_alias (__syslog, syslog)
void
__syslog_chk(int pri, int flag, const char *fmt, ...)
@@ -318,14 +321,12 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap)
libc_hidden_def (__vsyslog_chk)
void
-vsyslog(pri, fmt, ap)
- int pri;
- register const char *fmt;
- va_list ap;
+__vsyslog(int pri, const char *fmt, va_list ap)
{
__vsyslog_chk (pri, -1, fmt, ap);
}
-libc_hidden_def (vsyslog)
+ldbl_hidden_def (__vsyslog, vsyslog)
+ldbl_strong_alias (__vsyslog, vsyslog)
static struct sockaddr_un SyslogAddr; /* AF_UNIX address of local logger */
diff --git a/misc/tst-pselect.c b/misc/tst-pselect.c
new file mode 100644
index 0000000000..123c31912e
--- /dev/null
+++ b/misc/tst-pselect.c
@@ -0,0 +1,121 @@
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/select.h>
+#include <sys/wait.h>
+
+
+static volatile int handler_called;
+
+static void
+handler (int sig)
+{
+ handler_called = 1;
+}
+
+
+static int
+do_test (void)
+{
+ struct sigaction sa;
+ sa.sa_handler = handler;
+ sa.sa_flags = 0;
+ sigemptyset (&sa.sa_mask);
+
+ if (sigaction (SIGUSR1, &sa, NULL) != 0)
+ {
+ puts ("sigaction failed");
+ return 1;
+ }
+
+ if (sigblock (SIGUSR1) != 0)
+ {
+ puts ("sigblock failed");
+ return 1;
+ }
+
+ int fds[2][2];
+
+ if (pipe (fds[0]) != 0 || pipe (fds[1]) != 0)
+ {
+ puts ("pipe failed");
+ return 1;
+ }
+
+ fd_set rfds;
+ FD_ZERO (&rfds);
+
+ sigset_t ss;
+ sigprocmask (SIG_SETMASK, NULL, &ss);
+ sigdelset (&ss, SIGUSR1);
+
+ struct timespec to = { .tv_sec = 0, .tv_nsec = 500000000 };
+
+ pid_t p = fork ();
+ if (p == 0)
+ {
+ close (fds[0][1]);
+ close (fds[1][0]);
+
+ FD_SET (fds[0][0], &rfds);
+
+ int e;
+ do
+ {
+ errno = 0;
+ e = pselect (fds[0][0] + 1, &rfds, NULL, NULL, &to, &ss);
+ }
+ while (e == 0);
+
+ if (e != -1)
+ {
+ puts ("child: pselect did not fail");
+ return 0;
+ }
+ if (errno != EINTR)
+ {
+ puts ("child: pselect did not set errno to EINTR");
+ return 0;
+ }
+
+ TEMP_FAILURE_RETRY (write (fds[1][1], "foo", 3));
+
+ exit (0);
+ }
+
+ close (fds[0][0]);
+ close (fds[1][1]);
+
+ FD_SET (fds[1][0], &rfds);
+
+ kill (p, SIGUSR1);
+
+ int e = pselect (fds[1][0] + 1, &rfds, NULL, NULL, NULL, &ss);
+ if (e == -1)
+ {
+ puts ("parent: pselect failed");
+ return 1;
+ }
+ if (e != 1)
+ {
+ puts ("parent: pselect did not report readable fd");
+ return 1;
+ }
+ if (!FD_ISSET (fds[1][0], &rfds))
+ {
+ puts ("parent: pselect reports wrong fd");
+ return 1;
+ }
+
+ if (TEMP_FAILURE_RETRY (waitpid (p, NULL, 0)) != p)
+ {
+ puts ("waitpid failed");
+ return 1;
+ }
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 0c54b30247..a03b311003 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,5 +1,49 @@
+2006-01-20 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * sysdeps/unix/sysv/linux/sh/lowlevellock.h (lll_futex_wait):
+ Return status.
+ (lll_futex_timed_wait): Define.
+
+2006-01-19 Ulrich Drepper <drepper@redhat.com>
+
+ * tst-cancel4.c: Test ppoll.
+
+2006-01-18 Andreas Jaeger <aj@suse.de>
+
+ [BZ #2167]
+ * sysdeps/unix/sysv/linux/mips/bits/pthreadtypes.h
+ (pthread_mutex_t): Follow changes for other archs. Based on patch
+ by Jim Gifford <patches@jg555.com>.
+
+2006-01-13 Richard Henderson <rth@redhat.com>
+
+ * sysdeps/alpha/tls.h (tcbhead_t): Rename member to __private.
+
+2006-01-10 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/alpha/jmpbuf-unwind.h: File moved to main source tree.
+ * sysdeps/i386/jmpbuf-unwind.h: Likewise.
+ * sysdeps/mips/jmpbuf-unwind.h: Likewise.
+ * sysdeps/powerpc/jmpbuf-unwind.h: Likewise.
+ * sysdeps/s390/jmpbuf-unwind.h: Likewise.
+ * sysdeps/sh/jmpbuf-unwind.h: Likewise.
+ * sysdeps/sparc/sparc32/jmpbuf-unwind.h: Likewise.
+ * sysdeps/sparc/sparc64/jmpbuf-unwind.h: Likewise.
+ * sysdeps/x86_64/jmpbuf-unwind.h: Likewise.
+ * sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h: Likewise.
+
2006-01-09 Roland McGrath <roland@redhat.com>
+ * tst-initializers1-c89.c: New file.
+ * tst-initializers1-c99.c: New file.
+ * tst-initializers1-gnu89.c: New file.
+ * tst-initializers1-gnu99.c: New file.
+ * Makefile (tests): Add them.
+ (CFLAGS-tst-initializers1-c89.c): New variable.
+ (CFLAGS-tst-initializers1-c99.c): New variable.
+ (CFLAGS-tst-initializers1-gnu89.c): New variable.
+ (CFLAGS-tst-initializers1-gnu99.c): New variable.
+
* sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h (pthread_mutex_t):
Use __extension__ on anonymous union definition.
* sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h: Likewise.
@@ -8,6 +52,16 @@
* sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/pthreadtypes.h: Likewise.
+2006-01-08 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h (pthread_mutex_t):
+ Don't give the union a name because it changes the mangled name.
+ Instead name the struct for __data.
+ * sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h (pthread_mutex_t):
+ Likewise.
+ * sysdeps/unix/sysv/linux/sparc/bits/pthreadtypes.h (pthread_mutex_t):
+ Likewise.
+
2006-01-09 Jakub Jelinek <jakub@redhat.com>
* sysdeps/sparc/sparc64/jmpbuf-unwind.h (_JMPBUF_UNWINDS_ADJ): Add
diff --git a/nptl/Makefile b/nptl/Makefile
index 119d6a6f0d..2b245dfb31 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2002,2003,2004,2005,2006 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
@@ -246,7 +246,8 @@ tests = tst-typesizes \
tst-backtrace1 \
tst-oddstacklimit \
tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
- tst-getpid1 tst-getpid2 tst-initializers1
+ tst-getpid1 tst-getpid2 \
+ tst-initializers1 $(patsubst %,tst-initializers1-%,c89 gnu89 c99 gnu99)
xtests = tst-setuid1 tst-setuid1-static
# Files which must not be linked with libpthread.
@@ -415,7 +416,13 @@ CFLAGS-tst-oncex3.c += -fexceptions
CFLAGS-tst-oncex4.c += -fexceptions
CFLAGS-tst-align.c += $(stack-align-test-flags)
CFLAGS-tst-align3.c += $(stack-align-test-flags)
-CFLAGS-tst-initializers1.c += -W -Wall -Werror
+CFLAGS-tst-initializers1.c = -W -Wall -Werror
+CFLAGS-tst-initializers1-< = $(CFLAGS-tst-initializers1.c) \
+ $(patsubst tst-initializers1-%.c,-std=%,$<)
+CFLAGS-tst-initializers1-c89.c = $(CFLAGS-tst-initializers1-<)
+CFLAGS-tst-initializers1-c99.c = $(CFLAGS-tst-initializers1-<)
+CFLAGS-tst-initializers1-gnu89.c = $(CFLAGS-tst-initializers1-<)
+CFLAGS-tst-initializers1-gnu99.c = $(CFLAGS-tst-initializers1-<)
tst-cancel7-ARGS = --command "$(built-program-cmd)"
tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
diff --git a/nptl/sysdeps/alpha/tls.h b/nptl/sysdeps/alpha/tls.h
index fa3c832a68..20f780c5f5 100644
--- a/nptl/sysdeps/alpha/tls.h
+++ b/nptl/sysdeps/alpha/tls.h
@@ -65,7 +65,7 @@ typedef union dtv
typedef struct
{
dtv_t *dtv;
- void *private;
+ void *__private;
} tcbhead_t;
/* This is the size of the initial TCB. */
diff --git a/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
index 50049376b0..cb916917e5 100644
--- a/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
@@ -1,5 +1,5 @@
/* Machine-specific pthread type layouts. Alpha version.
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006 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
@@ -45,9 +45,9 @@ typedef union
/* Data structures for mutex handling. The structure of the attribute
type is deliberately not exposed. */
-typedef union __pthread_mutex_u
+typedef union
{
- struct
+ struct __pthread_mutex_s
{
int __lock;
unsigned int __count;
@@ -57,8 +57,8 @@ typedef union __pthread_mutex_u
binary compatibility. */
int __kind;
int __spins;
- union __pthread_mutex_u *__next;
- union __pthread_mutex_u *__prev;
+ struct __pthread_mutex_s *__next;
+ struct __pthread_mutex_s *__prev;
#define __PTHREAD_MUTEX_HAVE_PREV 1
} __data;
char __size[__SIZEOF_PTHREAD_MUTEX_T];
diff --git a/nptl/sysdeps/unix/sysv/linux/mips/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/mips/bits/pthreadtypes.h
index e14a487508..d5e89a9364 100644
--- a/nptl/sysdeps/unix/sysv/linux/mips/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/mips/bits/pthreadtypes.h
@@ -1,5 +1,5 @@
/* Machine-specific pthread type layouts. MIPS version.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -59,7 +59,7 @@ typedef union
type is deliberately not exposed. */
typedef union
{
- struct
+ struct __pthread_mutex_s
{
int __lock;
unsigned int __count;
@@ -70,10 +70,19 @@ typedef union
/* KIND must stay at this position in the structure to maintain
binary compatibility. */
int __kind;
-#if _MIPS_SIM != _ABI64
+#if _MIPS_SIM == _ABI64
+ int __spins;
+ struct __pthread_mutex_s *__next;
+ struct __pthread_mutex_s *__prev;
+# define __PTHREAD_MUTEX_HAVE_PREV 1
+#else
unsigned int __nusers;
+ __extension__ union
+ {
+ int __spins;
+ struct __pthread_mutex_s *__next;
+ };
#endif
- int __spins;
} __data;
char __size[__SIZEOF_PTHREAD_MUTEX_T];
long int __align;
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h
index 211c3fb08e..7642eccab0 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h
@@ -46,9 +46,9 @@ typedef union
/* Data structures for mutex handling. The structure of the attribute
type is not exposed on purpose. */
-typedef union __pthread_mutex_u
+typedef union
{
- struct
+ struct __pthread_mutex_s
{
int __lock;
unsigned int __count;
@@ -60,7 +60,7 @@ typedef union __pthread_mutex_u
__extension__ union
{
int __spins;
- union __pthread_mutex_u *__next;
+ struct __pthread_mutex_s *__next;
};
} __data;
char __size[__SIZEOF_PTHREAD_MUTEX_T];
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
index d9376d45a0..e3e3777f44 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 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
@@ -181,19 +181,37 @@ typedef int lll_lock_t;
# endif
#define lll_futex_wait(futex, val) \
- do { \
- int __ignore; \
+ ({ \
+ int __status; \
register unsigned long __r3 asm ("r3") = SYS_futex; \
register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \
register unsigned long __r5 asm ("r5") = FUTEX_WAIT; \
register unsigned long __r6 asm ("r6") = (unsigned long) (val); \
register unsigned long __r7 asm ("r7") = 0; \
__asm __volatile (SYSCALL_WITH_INST_PAD \
- : "=z" (__ignore) \
+ : "=z" (__status) \
: "r" (__r3), "r" (__r4), "r" (__r5), \
"r" (__r6), "r" (__r7) \
: "memory", "t"); \
- } while (0)
+ __status; \
+ })
+
+
+#define lll_futex_timed_wait(futex, val, timeout) \
+ ({ \
+ int __status; \
+ register unsigned long __r3 asm ("r3") = SYS_futex; \
+ register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \
+ register unsigned long __r5 asm ("r5") = FUTEX_WAIT; \
+ register unsigned long __r6 asm ("r6") = (unsigned long) (val); \
+ register unsigned long __r7 asm ("r7") = (timeout); \
+ __asm __volatile (SYSCALL_WITH_INST_PAD \
+ : "=z" (__status) \
+ : "r" (__r3), "r" (__r4), "r" (__r5), \
+ "r" (__r6), "r" (__r7) \
+ : "memory", "t"); \
+ __status; \
+ })
#define lll_futex_wake(futex, nr) \
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/sparc/bits/pthreadtypes.h
index e948ca10a8..7dc61c12e1 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/bits/pthreadtypes.h
@@ -60,9 +60,9 @@ typedef union
/* Data structures for mutex handling. The structure of the attribute
type is deliberately not exposed. */
-typedef union __pthread_mutex_u
+typedef union
{
- struct
+ struct __pthread_mutex_s
{
int __lock;
unsigned int __count;
@@ -75,15 +75,15 @@ typedef union __pthread_mutex_u
int __kind;
#if __WORDSIZE == 64
int __spins;
- union __pthread_mutex_u *__next;
- union __pthread_mutex_u *__prev;
+ struct __pthread_mutex_s *__next;
+ struct __pthread_mutex_s *__prev;
# define __PTHREAD_MUTEX_HAVE_PREV 1
#else
unsigned int __nusers;
__extension__ union
{
int __spins;
- union __pthread_mutex_u *__next;
+ struct __pthread_mutex_s *__next;
};
#endif
} __data;
diff --git a/nptl/tst-cancel4.c b/nptl/tst-cancel4.c
index cb7619688e..73cfa44614 100644
--- a/nptl/tst-cancel4.c
+++ b/nptl/tst-cancel4.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -524,6 +524,53 @@ tf_poll (void *arg)
static void *
+tf_ppoll (void *arg)
+{
+ int fd;
+ int r;
+
+ if (arg == NULL)
+ fd = fds[0];
+ else
+ {
+ char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
+ tempfd = fd = mkstemp (fname);
+ if (fd == -1)
+ printf ("%s: mkstemp failed\n", __FUNCTION__);
+ unlink (fname);
+
+ r = pthread_barrier_wait (&b2);
+ if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ printf ("%s: barrier_wait failed\n", __FUNCTION__);
+ exit (1);
+ }
+ }
+
+ r = pthread_barrier_wait (&b2);
+ if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ printf ("%s: barrier_wait failed\n", __FUNCTION__);
+ exit (1);
+ }
+
+ struct pollfd rfs[1] = { [0] = { .fd = fd, .events = POLLIN } };
+
+ int s;
+ pthread_cleanup_push (cl, NULL);
+
+ s = ppoll (rfs, 1, NULL, NULL);
+
+ pthread_cleanup_pop (0);
+
+ printf ("%s: ppoll returns with %d (%s)\n", __FUNCTION__, s,
+ strerror (errno));
+
+ exit (1);
+}
+
+
+static void *
tf_wait (void *arg)
{
pid_t pid = fork ();
@@ -2006,6 +2053,7 @@ static struct
ADD_TEST (select, 2, 0),
ADD_TEST (pselect, 2, 0),
ADD_TEST (poll, 2, 0),
+ ADD_TEST (ppoll, 2, 0),
ADD_TEST (write, 2, 0),
ADD_TEST (writev, 2, 0),
ADD_TEST (sleep, 2, 0),
diff --git a/nptl/tst-initializers1-c89.c b/nptl/tst-initializers1-c89.c
new file mode 100644
index 0000000000..7c27c1d545
--- /dev/null
+++ b/nptl/tst-initializers1-c89.c
@@ -0,0 +1 @@
+#include "tst-initializers1.c"
diff --git a/nptl/tst-initializers1-c99.c b/nptl/tst-initializers1-c99.c
new file mode 100644
index 0000000000..7c27c1d545
--- /dev/null
+++ b/nptl/tst-initializers1-c99.c
@@ -0,0 +1 @@
+#include "tst-initializers1.c"
diff --git a/nptl/tst-initializers1-gnu89.c b/nptl/tst-initializers1-gnu89.c
new file mode 100644
index 0000000000..7c27c1d545
--- /dev/null
+++ b/nptl/tst-initializers1-gnu89.c
@@ -0,0 +1 @@
+#include "tst-initializers1.c"
diff --git a/nptl/tst-initializers1-gnu99.c b/nptl/tst-initializers1-gnu99.c
new file mode 100644
index 0000000000..7c27c1d545
--- /dev/null
+++ b/nptl/tst-initializers1-gnu99.c
@@ -0,0 +1 @@
+#include "tst-initializers1.c"
diff --git a/posix/glob.c b/posix/glob.c
index 2e767304a7..d2a9981e31 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2002,2003,2004,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2002,2003,2004,2005,2006 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
@@ -16,23 +16,16 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-/* AIX requires this to be the first thing in the file. */
-#if defined _AIX && !defined __GNUC__
- #pragma alloca
-#endif
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/* Enable GNU extensions in glob.h. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-#endif
+#include <glob.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <stddef.h>
/* Outcomment the following line for production quality code. */
/* #define NDEBUG 1 */
@@ -40,30 +33,7 @@
#include <stdio.h> /* Needed on stupid SunOS for assert. */
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#define GLOB_INTERFACE_VERSION 1
-#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
-# include <gnu-versions.h>
-# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
-# define ELIDE_CODE
-# endif
-#endif
-
-#ifndef ELIDE_CODE
#if !defined _LIBC || !defined GLOB_ONLY_P
-
-#if defined STDC_HEADERS || defined __GNU_LIBRARY__
-# include <stddef.h>
-#endif
-
#if defined HAVE_UNISTD_H || defined _LIBC
# include <unistd.h>
# ifndef POSIX
@@ -73,22 +43,13 @@
# endif
#endif
-#if !defined _AMIGA && !defined VMS && !defined WINDOWS32
-# include <pwd.h>
-#endif
+#include <pwd.h>
-#if !defined __GNU_LIBRARY__ && !defined STDC_HEADERS
-extern int errno;
-#endif
+#include <errno.h>
#ifndef __set_errno
# define __set_errno(val) errno = (val)
#endif
-#ifndef NULL
-# define NULL 0
-#endif
-
-
#if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
@@ -117,17 +78,28 @@ extern int errno;
#endif
/* When used in the GNU libc the symbol _DIRENT_HAVE_D_TYPE is available
- if the `d_type' member for `struct dirent' is available. */
-#ifdef _DIRENT_HAVE_D_TYPE
-# define HAVE_D_TYPE 1
-#endif
-
-#if _LIBC
-# define HAVE_DIRENT64 1
-#endif
+ if the `d_type' member for `struct dirent' is available.
+ HAVE_STRUCT_DIRENT_D_TYPE plays the same role in GNULIB. */
+#if defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE
+/* True if the directory entry D must be of type T. */
+# define DIRENT_MUST_BE(d, t) ((d)->d_type == (t))
+
+/* True if the directory entry D might be a symbolic link. */
+# define DIRENT_MIGHT_BE_SYMLINK(d) \
+ ((d)->d_type == DT_UNKNOWN || (d)->d_type == DT_LNK)
+
+/* True if the directory entry D might be a directory. */
+# define DIRENT_MIGHT_BE_DIR(d) \
+ ((d)->d_type == DT_DIR || DIRENT_MIGHT_BE_SYMLINK (d))
+
+#else /* !HAVE_D_TYPE */
+# define DIRENT_MUST_BE(d, t) false
+# define DIRENT_MIGHT_BE_SYMLINK(d) true
+# define DIRENT_MIGHT_BE_DIR(d) true
+#endif /* HAVE_D_TYPE */
/* If the system has the `struct dirent64' type we use it internally. */
-#if defined HAVE_DIRENT64 && !defined COMPILE_GLOB64
+#if defined _LIBC && !defined COMPILE_GLOB64
# if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__
# define CONVERT_D_NAMLEN(d64, d32)
# else
@@ -142,7 +114,7 @@ extern int errno;
(d64)->d_ino = (d32)->d_ino;
# endif
-# ifdef HAVE_D_TYPE
+# ifdef _DIRENT_HAVE_D_TYPE
# define CONVERT_D_TYPE(d64, d32) \
(d64)->d_type = (d32)->d_type;
# else
@@ -165,126 +137,18 @@ extern int errno;
# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
#endif /* POSIX */
-#if defined STDC_HEADERS || defined __GNU_LIBRARY__
-# include <stdlib.h>
-# include <string.h>
-# define ANSI_STRING
-#else /* No standard headers. */
-
-extern char *getenv ();
-
-# ifdef HAVE_STRING_H
-# include <string.h>
-# define ANSI_STRING
-# else
-# include <strings.h>
-# endif
-# ifdef HAVE_MEMORY_H
-# include <memory.h>
-# endif
-
-extern char *malloc (), *realloc ();
-extern void free ();
-
-extern void qsort ();
-extern void abort (), exit ();
-
-#endif /* Standard headers. */
+#include <stdlib.h>
+#include <string.h>
/* NAME_MAX is usually defined in <dirent.h> or <limits.h>. */
-#if defined HAVE_LIMITS_H || defined __GNU_LIBRARY__
-# include <limits.h>
-#endif
+#include <limits.h>
#ifndef NAME_MAX
# define NAME_MAX (sizeof (((struct dirent *) 0)->d_name))
#endif
-#ifndef ANSI_STRING
-
-# ifndef bzero
-extern void bzero ();
-# endif
-# ifndef bcopy
-extern void bcopy ();
-# endif
-
-# define memcpy(d, s, n) bcopy ((s), (d), (n))
-# define strrchr rindex
-/* memset is only used for zero here, but let's be paranoid. */
-# define memset(s, better_be_zero, n) \
- ((void) ((better_be_zero) == 0 ? (bzero((s), (n)), 0) : (abort(), 0)))
-#endif /* Not ANSI_STRING. */
-
-#if !defined HAVE_STRCOLL && !defined _LIBC
-# define strcoll strcmp
-#endif
-
-#if !defined HAVE_MEMPCPY && __GLIBC__ - 0 == 2 && __GLIBC_MINOR__ >= 1
-# define HAVE_MEMPCPY 1
-# undef mempcpy
-# define mempcpy(Dest, Src, Len) __mempcpy (Dest, Src, Len)
-#endif
-
-#ifndef __GNU_LIBRARY__
-# ifdef __GNUC__
-__inline
-# endif
-# ifndef __SASC
-# ifdef WINDOWS32
-static void *
-# else
-static char *
-# endif
-my_realloc (p, n)
- char *p;
- unsigned int n;
-{
- /* These casts are the for sake of the broken Ultrix compiler,
- which warns of illegal pointer combinations otherwise. */
- if (p == NULL)
- return (char *) malloc (n);
- return (char *) realloc (p, n);
-}
-# define realloc my_realloc
-# endif /* __SASC */
-#endif /* __GNU_LIBRARY__ */
-
-
-#if !defined __alloca && !defined __GNU_LIBRARY__
-
-# ifdef __GNUC__
-# undef alloca
-# define alloca(n) __builtin_alloca (n)
-# else /* Not GCC. */
-# ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-# else /* Not HAVE_ALLOCA_H. */
-# ifndef _AIX
-# ifdef WINDOWS32
-# include <malloc.h>
-# else
-extern char *alloca ();
-# endif /* WINDOWS32 */
-# endif /* Not _AIX. */
-# endif /* sparc or HAVE_ALLOCA_H. */
-# endif /* GCC. */
-
-# define __alloca alloca
-
-#endif
-
-#ifndef __GNU_LIBRARY__
-# define __stat stat
-# ifdef STAT_MACROS_BROKEN
-# undef S_ISDIR
-# endif
-# ifndef S_ISDIR
-# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
-# endif
-#endif
+#include <alloca.h>
#ifdef _LIBC
-# include <alloca.h>
# undef strdup
# define strdup(str) __strdup (str)
# define sysconf(id) __sysconf (id)
@@ -296,52 +160,37 @@ extern char *alloca ();
# ifndef __stat64
# define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
# endif
-# define HAVE_STAT64 1
-#endif
-
-#ifndef HAVE_STAT64
-# define __stat64(fname, buf) __stat (fname, buf)
-/* This is the variable name we are using. */
-# define st64 st
-#endif
+# define struct_stat64 struct stat64
+#else /* !_LIBC */
+# include "getlogin_r.h"
+# include "mempcpy.h"
+# include "stat-macros.h"
+# include "strdup.h"
+# define __stat64(fname, buf) stat (fname, buf)
+# define struct_stat64 struct stat
+# define __stat(fname, buf) stat (fname, buf)
+# define __alloca alloca
+# define __readdir readdir
+# define __readdir64 readdir64
+# define __glob_pattern_p glob_pattern_p
+#endif /* _LIBC */
-#if !(defined STDC_HEADERS || defined __GNU_LIBRARY__)
-# undef size_t
-# define size_t unsigned int
-#endif
-
-/* Some system header files erroneously define these.
- We want our own definitions from <fnmatch.h> to take precedence. */
-#ifndef __GNU_LIBRARY__
-# undef FNM_PATHNAME
-# undef FNM_NOESCAPE
-# undef FNM_PERIOD
-#endif
#include <fnmatch.h>
-/* Some system header files erroneously define these.
- We want our own definitions from <glob.h> to take precedence. */
-#ifndef __GNU_LIBRARY__
-# undef GLOB_ERR
-# undef GLOB_MARK
-# undef GLOB_NOSORT
-# undef GLOB_DOOFFS
-# undef GLOB_NOCHECK
-# undef GLOB_APPEND
-# undef GLOB_NOESCAPE
-# undef GLOB_PERIOD
+#ifdef _SC_GETPW_R_SIZE_MAX
+# define GETPW_R_SIZE_MAX() sysconf (_SC_GETPW_R_SIZE_MAX)
+#else
+# define GETPW_R_SIZE_MAX() (-1)
#endif
-#include <glob.h>
-
-#ifdef HAVE_GETLOGIN_R
-extern int getlogin_r (char *, size_t);
+#ifdef _SC_LOGIN_NAME_MAX
+# define GET_LOGIN_NAME_MAX() sysconf (_SC_LOGIN_NAME_MAX)
#else
-extern char *getlogin (void);
+# define GET_LOGIN_NAME_MAX() (-1)
#endif
static const char *next_brace_sub (const char *begin, int flags) __THROW;
-#endif /* GLOB_ONLY_P */
+#endif /* !defined _LIBC || !defined GLOB_ONLY_P */
static int glob_in_dir (const char *pattern, const char *directory,
int flags, int (*errfunc) (const char *, int),
@@ -349,14 +198,12 @@ static int glob_in_dir (const char *pattern, const char *directory,
#if !defined _LIBC || !defined GLOB_ONLY_P
static int prefix_array (const char *prefix, char **array, size_t n) __THROW;
-static int collated_compare (const __ptr_t, const __ptr_t) __THROW;
+static int collated_compare (const void *, const void *) __THROW;
/* Find the end of the sub-pattern in a brace expression. */
static const char *
-next_brace_sub (cp, flags)
- const char *cp;
- int flags;
+next_brace_sub (const char *cp, int flags)
{
unsigned int depth = 0;
while (*cp != '\0')
@@ -378,7 +225,7 @@ next_brace_sub (cp, flags)
return *cp != '\0' ? cp : NULL;
}
-#endif /* !GLOB_ONLY_P */
+#endif /* !defined _LIBC || !defined GLOB_ONLY_P */
/* Do glob searching for PATTERN, placing results in PGLOB.
The bits defined above may be set in FLAGS.
@@ -467,12 +314,7 @@ glob (pattern, flags, errfunc, pglob)
#endif
/* We know the prefix for all sub-patterns. */
-#ifdef HAVE_MEMPCPY
alt_start = mempcpy (onealt, pattern, begin - pattern);
-#else
- memcpy (onealt, pattern, begin - pattern);
- alt_start = &onealt[begin - pattern];
-#endif
/* Find the first sub-pattern and at the same time find the
rest after the closing brace. */
@@ -525,12 +367,7 @@ glob (pattern, flags, errfunc, pglob)
int result;
/* Construct the new glob expression. */
-#ifdef HAVE_MEMPCPY
mempcpy (mempcpy (alt_start, p, next - p), rest, rest_len);
-#else
- memcpy (alt_start, p, next - p);
- memcpy (&alt_start[next - p], rest, rest_len);
-#endif
result = glob (onealt,
((flags & ~(GLOB_NOCHECK | GLOB_NOMAGIC))
@@ -625,12 +462,7 @@ glob (pattern, flags, errfunc, pglob)
++dirlen;
drive_spec = (char *) __alloca (dirlen + 1);
-#ifdef HAVE_MEMPCPY
*((char *) mempcpy (drive_spec, pattern, dirlen)) = '\0';
-#else
- memcpy (drive_spec, pattern, dirlen);
- drive_spec[dirlen] = '\0';
-#endif
/* For now, disallow wildcards in the drive spec, to
prevent infinite recursion in glob. */
if (__glob_pattern_p (drive_spec, !(flags & GLOB_NOESCAPE)))
@@ -641,12 +473,7 @@ glob (pattern, flags, errfunc, pglob)
}
#endif
newp = (char *) __alloca (dirlen + 1);
-#ifdef HAVE_MEMPCPY
*((char *) mempcpy (newp, pattern, dirlen)) = '\0';
-#else
- memcpy (newp, pattern, dirlen);
- newp[dirlen] = '\0';
-#endif
dirname = newp;
++filename;
@@ -706,8 +533,7 @@ glob (pattern, flags, errfunc, pglob)
{
int success;
char *name;
-# if defined HAVE_GETLOGIN_R || defined _LIBC
- size_t buflen = sysconf (_SC_LOGIN_NAME_MAX) + 1;
+ size_t buflen = GET_LOGIN_NAME_MAX () + 1;
if (buflen == 0)
/* `sysconf' does not support _SC_LOGIN_NAME_MAX. Try
@@ -716,14 +542,11 @@ glob (pattern, flags, errfunc, pglob)
name = (char *) __alloca (buflen);
success = getlogin_r (name, buflen) == 0;
-# else
- success = (name = getlogin ()) != NULL;
-# endif
if (success)
{
struct passwd *p;
# if defined HAVE_GETPWNAM_R || defined _LIBC
- long int pwbuflen = sysconf (_SC_GETPW_R_SIZE_MAX);
+ long int pwbuflen = GETPW_R_SIZE_MAX ();
char *pwtmpbuf;
struct passwd pwbuf;
int save = errno;
@@ -777,13 +600,8 @@ glob (pattern, flags, errfunc, pglob)
char *newp;
size_t home_len = strlen (home_dir);
newp = (char *) __alloca (home_len + dirlen);
-# ifdef HAVE_MEMPCPY
mempcpy (mempcpy (newp, home_dir, home_len),
&dirname[1], dirlen);
-# else
- memcpy (newp, home_dir, home_len);
- memcpy (&newp[home_len], &dirname[1], dirlen);
-# endif
dirname = newp;
}
}
@@ -800,13 +618,8 @@ glob (pattern, flags, errfunc, pglob)
{
char *newp;
newp = (char *) __alloca (end_name - dirname);
-# ifdef HAVE_MEMPCPY
*((char *) mempcpy (newp, dirname + 1, end_name - dirname))
= '\0';
-# else
- memcpy (newp, dirname + 1, end_name - dirname);
- newp[end_name - dirname - 1] = '\0';
-# endif
user_name = newp;
}
@@ -814,7 +627,7 @@ glob (pattern, flags, errfunc, pglob)
{
struct passwd *p;
# if defined HAVE_GETPWNAM_R || defined _LIBC
- long int buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
+ long int buflen = GETPW_R_SIZE_MAX ();
char *pwtmpbuf;
struct passwd pwbuf;
int save = errno;
@@ -857,14 +670,8 @@ glob (pattern, flags, errfunc, pglob)
size_t home_len = strlen (home_dir);
size_t rest_len = end_name == NULL ? 0 : strlen (end_name);
newp = (char *) __alloca (home_len + rest_len + 1);
-# ifdef HAVE_MEMPCPY
*((char *) mempcpy (mempcpy (newp, home_dir, home_len),
end_name, rest_len)) = '\0';
-# else
- memcpy (newp, home_dir, home_len);
- memcpy (&newp[home_len], end_name, rest_len);
- newp[home_len + rest_len] = '\0';
-# endif
dirname = newp;
}
else
@@ -882,9 +689,7 @@ glob (pattern, flags, errfunc, pglob)
if (filename == NULL)
{
struct stat st;
-#ifdef HAVE_STAT64
- struct stat64 st64;
-#endif
+ struct_stat64 st64;
/* Return the directory if we don't check for error or if it exists. */
if ((flags & GLOB_NOCHECK)
@@ -909,16 +714,7 @@ glob (pattern, flags, errfunc, pglob)
}
pglob->gl_pathv = new_gl_pathv;
-#if defined HAVE_STRDUP || defined _LIBC
pglob->gl_pathv[newcount] = strdup (dirname);
-#else
- {
- size_t len = strlen (dirname) + 1;
- char *dircopy = (char *) malloc (len);
- if (dircopy != NULL)
- pglob->gl_pathv[newcount] = memcpy (dircopy, dirname, len);
- }
-#endif
if (pglob->gl_pathv[newcount] == NULL)
goto nospace;
pglob->gl_pathv[++newcount] = NULL;
@@ -1082,9 +878,7 @@ glob (pattern, flags, errfunc, pglob)
/* Append slashes to directory names. */
size_t i;
struct stat st;
-#ifdef HAVE_STAT64
- struct stat64 st64;
-#endif
+ struct_stat64 st64;
for (i = oldcount; i < pglob->gl_pathc + pglob->gl_offs; ++i)
if (((flags & GLOB_ALTDIRFUNC)
@@ -1109,7 +903,7 @@ glob (pattern, flags, errfunc, pglob)
if (!(flags & GLOB_NOSORT))
{
/* Sort the vector. */
- qsort ((__ptr_t) &pglob->gl_pathv[oldcount],
+ qsort (&pglob->gl_pathv[oldcount],
pglob->gl_pathc + pglob->gl_offs - oldcount,
sizeof (char *), collated_compare);
}
@@ -1133,8 +927,8 @@ globfree (pglob)
size_t i;
for (i = 0; i < pglob->gl_pathc; ++i)
if (pglob->gl_pathv[pglob->gl_offs + i] != NULL)
- free ((__ptr_t) pglob->gl_pathv[pglob->gl_offs + i]);
- free ((__ptr_t) pglob->gl_pathv);
+ free (pglob->gl_pathv[pglob->gl_offs + i]);
+ free (pglob->gl_pathv);
pglob->gl_pathv = NULL;
}
}
@@ -1145,9 +939,7 @@ libc_hidden_def (globfree)
/* Do a collated comparison of A and B. */
static int
-collated_compare (a, b)
- const __ptr_t a;
- const __ptr_t b;
+collated_compare (const void *a, const void *b)
{
const char *const s1 = *(const char *const * const) a;
const char *const s2 = *(const char *const * const) b;
@@ -1167,10 +959,7 @@ collated_compare (a, b)
A slash is inserted between DIRNAME and each elt of ARRAY,
unless DIRNAME is just "/". Each old element of ARRAY is freed. */
static int
-prefix_array (dirname, array, n)
- const char *dirname;
- char **array;
- size_t n;
+prefix_array (const char *dirname, char **array, size_t n)
{
register size_t i;
size_t dirlen = strlen (dirname);
@@ -1207,22 +996,16 @@ prefix_array (dirname, array, n)
if (new == NULL)
{
while (i > 0)
- free ((__ptr_t) array[--i]);
+ free (array[--i]);
return 1;
}
-#ifdef HAVE_MEMPCPY
{
- char *endp = (char *) mempcpy (new, dirname, dirlen);
+ char *endp = mempcpy (new, dirname, dirlen);
*endp++ = DIRSEP_CHAR;
mempcpy (endp, array[i], eltlen);
}
-#else
- memcpy (new, dirname, dirlen);
- new[dirlen] = DIRSEP_CHAR;
- memcpy (&new[dirlen + 1], array[i], eltlen);
-#endif
- free ((__ptr_t) array[i]);
+ free (array[i]);
array[i] = new;
}
@@ -1284,16 +1067,10 @@ link_exists_p (const char *dir, size_t dirlen, const char *fname,
size_t fnamelen = strlen (fname);
char *fullname = (char *) __alloca (dirlen + 1 + fnamelen + 1);
struct stat st;
- struct stat64 st64;
+ struct_stat64 st64;
-# ifdef HAVE_MEMPCPY
mempcpy (mempcpy (mempcpy (fullname, dir, dirlen), "/", 1),
fname, fnamelen + 1);
-# else
- memcpy (fullname, dir, dirlen);
- fullname[dirlen] = '/';
- memcpy (&fullname[dirlen + 1], fname, fnamelen + 1);
-# endif
return (((flags & GLOB_ALTDIRFUNC)
? (*pglob->gl_stat) (fullname, &st)
@@ -1307,15 +1084,12 @@ link_exists_p (const char *dir, size_t dirlen, const char *fname,
The GLOB_NOSORT bit in FLAGS is ignored. No sorting is ever done.
The GLOB_APPEND flag is assumed to be set (always appends). */
static int
-glob_in_dir (pattern, directory, flags, errfunc, pglob)
- const char *pattern;
- const char *directory;
- int flags;
- int (*errfunc) (const char *, int);
- glob_t *pglob;
+glob_in_dir (const char *pattern, const char *directory, int flags,
+ int (*errfunc) (const char *, int),
+ glob_t *pglob)
{
size_t dirlen = strlen (directory);
- __ptr_t stream = NULL;
+ void *stream = NULL;
struct globlink
{
struct globlink *next;
@@ -1341,21 +1115,13 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
/* Since we use the normal file functions we can also use stat()
to verify the file is there. */
struct stat st;
-# ifdef HAVE_STAT64
- struct stat64 st64;
-# endif
+ struct_stat64 st64;
size_t patlen = strlen (pattern);
char *fullname = (char *) __alloca (dirlen + 1 + patlen + 1);
-# ifdef HAVE_MEMPCPY
mempcpy (mempcpy (mempcpy (fullname, directory, dirlen),
"/", 1),
pattern, patlen + 1);
-# else
- memcpy (fullname, directory, dirlen);
- fullname[dirlen] = '/';
- memcpy (&fullname[dirlen + 1], pattern, patlen + 1);
-# endif
if (((flags & GLOB_ALTDIRFUNC)
? (*pglob->gl_stat) (fullname, &st)
: __stat64 (fullname, &st64)) == 0)
@@ -1384,7 +1150,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
{
stream = ((flags & GLOB_ALTDIRFUNC)
? (*pglob->gl_opendir) (directory)
- : (__ptr_t) opendir (directory));
+ : opendir (directory));
if (stream == NULL)
{
if (errno != ENOTDIR
@@ -1409,7 +1175,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
{
const char *name;
size_t len;
-#if defined HAVE_DIRENT64 && !defined COMPILE_GLOB64
+#if defined _LIBC && !defined COMPILE_GLOB64
struct dirent64 *d;
union
{
@@ -1431,27 +1197,22 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
d = NULL;
}
else
- d = __readdir64 ((DIR *) stream);
+ d = __readdir64 (stream);
#else
struct dirent *d = ((flags & GLOB_ALTDIRFUNC)
? ((struct dirent *)
(*pglob->gl_readdir) (stream))
- : __readdir ((DIR *) stream));
+ : __readdir (stream));
#endif
if (d == NULL)
break;
if (! REAL_DIR_ENTRY (d))
continue;
-#ifdef HAVE_D_TYPE
/* If we shall match only directories use the information
provided by the dirent call if possible. */
- if ((flags & GLOB_ONLYDIR)
- && d->d_type != DT_UNKNOWN
- && d->d_type != DT_DIR
- && d->d_type != DT_LNK)
+ if ((flags & GLOB_ONLYDIR) && !DIRENT_MIGHT_BE_DIR (d))
continue;
-#endif
name = d->d_name;
@@ -1459,12 +1220,9 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
{
/* If the file we found is a symlink we have to
make sure the target file exists. */
- if (
-#ifdef HAVE_D_TYPE
- (d->d_type != DT_UNKNOWN && d->d_type != DT_LNK) ||
-#endif
- link_exists_p (directory, dirlen, name, pglob,
- flags))
+ if (!DIRENT_MIGHT_BE_SYMLINK (d)
+ || link_exists_p (directory, dirlen, name, pglob,
+ flags))
{
struct globlink *new = (struct globlink *)
__alloca (sizeof (struct globlink));
@@ -1472,13 +1230,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
new->name = (char *) malloc (len + 1);
if (new->name == NULL)
goto memory_error;
-#ifdef HAVE_MEMPCPY
- *((char *) mempcpy ((__ptr_t) new->name, name, len))
- = '\0';
-#else
- memcpy ((__ptr_t) new->name, name, len);
- new->name[len] = '\0';
-#endif
+ *((char *) mempcpy (new->name, name, len)) = '\0';
new->next = names;
names = new;
++nfound;
@@ -1498,12 +1250,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
names->name = (char *) malloc (len + 1);
if (names->name == NULL)
goto memory_error;
-#ifdef HAVE_MEMPCPY
*((char *) mempcpy (names->name, pattern, len)) = '\0';
-#else
- memcpy (names->name, pattern, len);
- names->name[len] = '\0';
-#endif
}
if (nfound != 0)
@@ -1531,7 +1278,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
if (flags & GLOB_ALTDIRFUNC)
(*pglob->gl_closedir) (stream);
else
- closedir ((DIR *) stream);
+ closedir (stream);
}
__set_errno (save);
@@ -1543,16 +1290,14 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
if (flags & GLOB_ALTDIRFUNC)
(*pglob->gl_closedir) (stream);
else
- closedir ((DIR *) stream);
+ closedir (stream);
__set_errno (save);
}
while (names != NULL)
{
if (names->name != NULL)
- free ((__ptr_t) names->name);
+ free (names->name);
names = names->next;
}
return GLOB_NOSPACE;
}
-
-#endif /* Not ELIDE_CODE. */
diff --git a/posix/regex_internal.c b/posix/regex_internal.c
index a0b3fa7a6c..855497ebf1 100644
--- a/posix/regex_internal.c
+++ b/posix/regex_internal.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -259,7 +259,7 @@ build_wcs_buffer (re_string_t *pstr)
/* Build wide character buffer PSTR->WCS like build_wcs_buffer,
but for REG_ICASE. */
-static int
+static reg_errcode_t
internal_function
build_wcs_upper_buffer (re_string_t *pstr)
{
@@ -721,7 +721,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
{
if (pstr->icase)
{
- int ret = build_wcs_upper_buffer (pstr);
+ reg_errcode_t ret = build_wcs_upper_buffer (pstr);
if (BE (ret != REG_NOERROR, 0))
return ret;
}
diff --git a/scripts/data/localplt-i386-linux-gnu.data b/scripts/data/localplt-i386-linux-gnu.data
new file mode 100644
index 0000000000..8fb56b6086
--- /dev/null
+++ b/scripts/data/localplt-i386-linux-gnu.data
@@ -0,0 +1,7 @@
+libc.so: _Unwind_Find_FDE
+libc.so: calloc
+libc.so: free
+libc.so: malloc
+libc.so: memalign
+libc.so: realloc
+libm.so: matherr
diff --git a/scripts/data/localplt-x86_64-linux-gnu.data b/scripts/data/localplt-x86_64-linux-gnu.data
new file mode 100644
index 0000000000..2219aa9048
--- /dev/null
+++ b/scripts/data/localplt-x86_64-linux-gnu.data
@@ -0,0 +1,6 @@
+libc.so: calloc
+libc.so: free
+libc.so: malloc
+libc.so: memalign
+libc.so: realloc
+libm.so: matherr
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index a2cfbe720c..70f6d64c9a 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1991-2002,2003,2004,2005,2006 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
@@ -21,7 +21,7 @@
#
subdir := stdio-common
-headers := printf.h stdio_ext.h
+headers := stdio_ext.h printf.h bits/printf-ldbl.h
routines := \
ctermid cuserid \
diff --git a/stdio-common/asprintf.c b/stdio-common/asprintf.c
index 2c466d28d5..66e766ebfb 100644
--- a/stdio-common/asprintf.c
+++ b/stdio-common/asprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1997, 1998, 2002, 2004
+/* Copyright (C) 1991, 1995, 1997, 1998, 2002, 2004, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -20,7 +20,7 @@
#include <stdarg.h>
#include <stdio.h>
-#include <libio/libioP.h>
+#include <libioP.h>
#define vasprintf(s, f, a) _IO_vasprintf (s, f, a)
#undef __asprintf
@@ -28,7 +28,7 @@
allocated with malloc and stored in *STRING_PTR. */
/* VARARGS2 */
int
-__asprintf (char **string_ptr, const char *format, ...)
+___asprintf (char **string_ptr, const char *format, ...)
{
va_list arg;
int done;
@@ -39,5 +39,7 @@ __asprintf (char **string_ptr, const char *format, ...)
return done;
}
-INTDEF(__asprintf)
-weak_alias (__asprintf, asprintf)
+INTDEF2(___asprintf, __asprintf)
+
+ldbl_strong_alias (___asprintf, __asprintf)
+ldbl_weak_alias (___asprintf, asprintf)
diff --git a/stdio-common/bits/printf-ldbl.h b/stdio-common/bits/printf-ldbl.h
new file mode 100644
index 0000000000..cbdc3f1cbc
--- /dev/null
+++ b/stdio-common/bits/printf-ldbl.h
@@ -0,0 +1,24 @@
+/* -mlong-double-64 compatibility mode for <printf.h> functions.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _PRINTF_H
+# error "Never include <bits/printf-ldbl.h> directly; use <printf.h> instead."
+#endif
+
+__LDBL_REDIR_DECL (printf_size)
diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c
index b362e5fa71..6d00e10a63 100644
--- a/stdio-common/dprintf.c
+++ b/stdio-common/dprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,95,97,98,2002,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991,95,97,98,2002,2004,2006 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
@@ -19,13 +19,13 @@
#include <stdarg.h>
#include <stdio.h>
-#include <libio/libioP.h>
+#include <libioP.h>
#define vdprintf(d, f, a) _IO_vdprintf (d, f, a)
/* Write formatted output to D, according to the format string FORMAT. */
/* VARARGS2 */
int
-dprintf (int d, const char *format, ...)
+__dprintf (int d, const char *format, ...)
{
va_list arg;
int done;
@@ -36,4 +36,5 @@ dprintf (int d, const char *format, ...)
return done;
}
-libc_hidden_def (dprintf)
+ldbl_hidden_def (__dprintf, dprintf)
+ldbl_strong_alias (__dprintf, dprintf)
diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c
index 0b99fc8994..689e80f466 100644
--- a/stdio-common/fprintf.c
+++ b/stdio-common/fprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,97,2002,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1997, 2002, 2004, 2006 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
@@ -18,12 +18,13 @@
#include <stdarg.h>
#include <stdio.h>
+#include <libioP.h>
/* Write formatted output to STREAM from the format string FORMAT. */
/* VARARGS2 */
int
-fprintf (FILE *stream, const char *format, ...)
+__fprintf (FILE *stream, const char *format, ...)
{
va_list arg;
int done;
@@ -34,9 +35,10 @@ fprintf (FILE *stream, const char *format, ...)
return done;
}
-libc_hidden_def (fprintf)
+ldbl_hidden_def (__fprintf, fprintf)
+ldbl_strong_alias (__fprintf, fprintf)
/* We define the function with the real name here. But deep down in
libio the original function _IO_fprintf is also needed. So make
an alias. */
-weak_alias (fprintf, _IO_fprintf)
+ldbl_weak_alias (__fprintf, _IO_fprintf)
diff --git a/stdio-common/fscanf.c b/stdio-common/fscanf.c
index 58a66eaf30..a6b60162cf 100644
--- a/stdio-common/fscanf.c
+++ b/stdio-common/fscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1997, 2006 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
@@ -16,13 +16,14 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <libioP.h>
#include <stdarg.h>
#include <stdio.h>
/* Read formatted input from STREAM according to the format string FORMAT. */
/* VARARGS2 */
int
-fscanf (FILE *stream, const char *format, ...)
+__fscanf (FILE *stream, const char *format, ...)
{
va_list arg;
int done;
@@ -33,3 +34,4 @@ fscanf (FILE *stream, const char *format, ...)
return done;
}
+ldbl_strong_alias (__fscanf, fscanf)
diff --git a/stdio-common/printf.c b/stdio-common/printf.c
index e28c5837e5..4c8f3a2a0c 100644
--- a/stdio-common/printf.c
+++ b/stdio-common/printf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <libioP.h>
#include <stdarg.h>
#include <stdio.h>
@@ -25,7 +26,7 @@
/* Write formatted output to stdout from the format string FORMAT. */
/* VARARGS1 */
int
-printf (const char *format, ...)
+__printf (const char *format, ...)
{
va_list arg;
int done;
@@ -38,5 +39,6 @@ printf (const char *format, ...)
}
#undef _IO_printf
+ldbl_strong_alias (__printf, printf);
/* This is for libg++. */
-strong_alias (printf, _IO_printf);
+ldbl_strong_alias (__printf, _IO_printf);
diff --git a/stdio-common/printf.h b/stdio-common/printf.h
index c16569b59b..360cdcce1d 100644
--- a/stdio-common/printf.h
+++ b/stdio-common/printf.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-1993,1995-1999,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1995-1999,2000,2001,2006
+ 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
@@ -139,6 +140,9 @@ extern int printf_size_info (__const struct printf_info *__restrict
__info, size_t __n, int *__restrict __argtypes)
__THROW;
+#ifdef __LDBL_COMPAT
+# include <bits/printf-ldbl.h>
+#endif
__END_DECLS
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index ed225e05a6..8a68f1948d 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -1,5 +1,6 @@
/* Floating point output for `printf'.
- Copyright (C) 1995-1999,2000,2001,2002,2003 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -138,9 +139,9 @@ static wchar_t *group_number (wchar_t *buf, wchar_t *bufend,
int
-__printf_fp (FILE *fp,
- const struct printf_info *info,
- const void *const *args)
+___printf_fp (FILE *fp,
+ const struct printf_info *info,
+ const void *const *args)
{
/* The floating-point value to output. */
union
@@ -1153,7 +1154,8 @@ __printf_fp (FILE *fp,
}
return done;
}
-libc_hidden_def (__printf_fp)
+ldbl_hidden_def (___printf_fp, __printf_fp)
+ldbl_strong_alias (___printf_fp, __printf_fp)
/* Return the number of extra grouping characters that will be inserted
into a number with INTDIG_MAX integer digits. */
diff --git a/stdio-common/printf_size.c b/stdio-common/printf_size.c
index 32f262ead0..957de2f571 100644
--- a/stdio-common/printf_size.c
+++ b/stdio-common/printf_size.c
@@ -1,5 +1,5 @@
/* Print size value using units for orders of magnitude.
- Copyright (C) 1997-2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997-2002, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
Based on a proposal by Larry McVoy <lm@sgi.com>.
@@ -86,7 +86,8 @@ extern int __printf_fp (FILE *fp, const struct printf_info *info,
int
-printf_size (FILE *fp, const struct printf_info *info, const void *const *args)
+__printf_size (FILE *fp, const struct printf_info *info,
+ const void *const *args)
{
/* Units for the both formats. */
#define BINARY_UNITS " kmgtpezy"
@@ -233,6 +234,7 @@ printf_size (FILE *fp, const struct printf_info *info, const void *const *args)
return done;
}
+ldbl_strong_alias (__printf_size, printf_size);
/* This is the function used by `vfprintf' to determine number and
type of the arguments. */
diff --git a/stdio-common/scanf.c b/stdio-common/scanf.c
index 62c9959651..d4a4daf726 100644
--- a/stdio-common/scanf.c
+++ b/stdio-common/scanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002, 2004
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002, 2004, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -26,7 +26,7 @@
/* Read formatted input from stdin according to the format string FORMAT. */
/* VARARGS1 */
int
-scanf (const char *format, ...)
+__scanf (const char *format, ...)
{
va_list arg;
int done;
@@ -37,3 +37,4 @@ scanf (const char *format, ...)
return done;
}
+ldbl_strong_alias (__scanf, scanf)
diff --git a/stdio-common/snprintf.c b/stdio-common/snprintf.c
index ce392f0096..00d2082350 100644
--- a/stdio-common/snprintf.c
+++ b/stdio-common/snprintf.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 1995, 1997, 1998, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1997, 1998, 2004, 2006
+ 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
@@ -18,8 +19,7 @@
#include <stdarg.h>
#include <stdio.h>
-
-#include <libio/libioP.h>
+#include <libioP.h>
#define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
/* Write formatted output into S, according to the format
@@ -37,4 +37,4 @@ __snprintf (char *s, size_t maxlen, const char *format, ...)
return done;
}
-weak_alias (__snprintf, snprintf)
+ldbl_weak_alias (__snprintf, snprintf)
diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c
index 249fcb0dde..7f564d5635 100644
--- a/stdio-common/sprintf.c
+++ b/stdio-common/sprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1997, 1998, 2002, 2004
+/* Copyright (C) 1991, 1995, 1997, 1998, 2002, 2004, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -19,13 +19,13 @@
#include <stdarg.h>
#include <stdio.h>
-#include <libio/iolibio.h>
+#include <libioP.h>
#define vsprintf(s, f, a) INTUSE(_IO_vsprintf) (s, f, a)
/* Write formatted output into S, according to the format string FORMAT. */
/* VARARGS2 */
int
-sprintf (char *s, const char *format, ...)
+__sprintf (char *s, const char *format, ...)
{
va_list arg;
int done;
@@ -36,6 +36,6 @@ sprintf (char *s, const char *format, ...)
return done;
}
-libc_hidden_def (sprintf)
-
-strong_alias(sprintf, _IO_sprintf)
+ldbl_hidden_def (__sprintf, sprintf)
+ldbl_strong_alias (__sprintf, sprintf)
+ldbl_strong_alias (__sprintf, _IO_sprintf)
diff --git a/stdio-common/sscanf.c b/stdio-common/sscanf.c
index b36976710b..384a6977dc 100644
--- a/stdio-common/sscanf.c
+++ b/stdio-common/sscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1998, 2002, 2003, 2004
+/* Copyright (C) 1991, 1995, 1996, 1998, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -19,13 +19,13 @@
#include <stdarg.h>
#include <stdio.h>
-#include <libio/iolibio.h>
+#include <libioP.h>
#define __vsscanf(s, f, a) _IO_vsscanf (s, f, a)
/* Read formatted input from S, according to the format string FORMAT. */
/* VARARGS2 */
int
-sscanf (const char *s, const char *format, ...)
+__sscanf (const char *s, const char *format, ...)
{
va_list arg;
int done;
@@ -36,8 +36,8 @@ sscanf (const char *s, const char *format, ...)
return done;
}
-libc_hidden_def (sscanf)
-
+ldbl_hidden_def (__sscanf, sscanf)
+ldbl_strong_alias (__sscanf, sscanf)
#undef _IO_sscanf
/* This is for libg++. */
-strong_alias (sscanf, _IO_sscanf)
+ldbl_strong_alias (__sscanf, _IO_sscanf)
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 83da710a2a..eb11ac2806 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006
+ 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,7 +65,7 @@
#define UNBUFFERED_P(S) ((S)->_IO_file_flags & _IO_UNBUFFERED)
#ifndef COMPILE_WPRINTF
-# define vfprintf _IO_vfprintf
+# define vfprintf _IO_vfprintf_internal
# define CHAR_T char
# define UCHAR_T unsigned char
# define INT_T int
@@ -758,6 +759,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
\
if (fspec == NULL) \
{ \
+ if (__ldbl_is_dbl) \
+ is_long_double = 0; \
+ \
struct printf_info info = { .prec = prec, \
.width = width, \
.spec = spec, \
@@ -785,6 +789,11 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
else \
{ \
ptr = (const void *) &args_value[fspec->data_arg]; \
+ if (__ldbl_is_dbl) \
+ { \
+ fspec->data_arg_type = PA_DOUBLE; \
+ fspec->info.is_long_double = 0; \
+ } \
\
function_done = __printf_fp (s, &fspec->info, &ptr); \
} \
@@ -808,6 +817,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
\
if (fspec == NULL) \
{ \
+ if (__ldbl_is_dbl) \
+ is_long_double = 0; \
+ \
struct printf_info info = { .prec = prec, \
.width = width, \
.spec = spec, \
@@ -834,6 +846,8 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
else \
{ \
ptr = (const void *) &args_value[fspec->data_arg]; \
+ if (__ldbl_is_dbl) \
+ fspec->info.is_long_double = 0; \
\
function_done = __printf_fphex (s, &fspec->info, &ptr); \
} \
@@ -1704,7 +1718,15 @@ do_positional:
T (PA_INT|PA_FLAG_LONG_LONG, pa_long_long_int, long long int);
T (PA_FLOAT, pa_double, double); /* Promoted. */
T (PA_DOUBLE, pa_double, double);
- T (PA_DOUBLE|PA_FLAG_LONG_DOUBLE, pa_long_double, long double);
+ case PA_DOUBLE|PA_FLAG_LONG_DOUBLE:
+ if (__ldbl_is_dbl)
+ {
+ args_value[cnt].pa_double = va_arg (ap_save, double);
+ args_type[cnt] &= ~PA_FLAG_LONG_DOUBLE;
+ }
+ else
+ args_value[cnt].pa_long_double = va_arg (ap_save, long double);
+ break;
T (PA_STRING, pa_string, const char *);
T (PA_WSTRING, pa_wstring, const wchar_t *);
T (PA_POINTER, pa_pointer, void *);
@@ -2154,25 +2176,11 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format,
}
#undef vfprintf
-#ifdef strong_alias
-/* This is for glibc. */
-# ifdef COMPILE_WPRINTF
+#ifdef COMPILE_WPRINTF
strong_alias (_IO_vfwprintf, __vfwprintf);
-weak_alias (_IO_vfwprintf, vfwprintf);
-# else
-strong_alias (_IO_vfprintf, vfprintf);
-libc_hidden_def (vfprintf)
-INTDEF(_IO_vfprintf)
-# endif
+ldbl_weak_alias (_IO_vfwprintf, vfwprintf);
#else
-# if defined __ELF__ || defined __GNU_LIBRARY__
-# include <gnu-stabs.h>
-# ifdef weak_alias
-# ifdef COMPILE_WPRINTF
-weak_alias (_IO_vfwprintf, vfwprintf);
-# else
-weak_alias (_IO_vfprintf, vfprintf);
-# endif
-# endif
-# endif
+ldbl_strong_alias (_IO_vfprintf_internal, vfprintf);
+ldbl_hidden_def (_IO_vfprintf_internal, vfprintf)
+ldbl_strong_alias (_IO_vfprintf_internal, _IO_vfprintf);
#endif
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index be008dc687..4dd7768431 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006
+ 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
@@ -178,18 +179,12 @@
Return the number of assignments made, or -1 for an input error. */
#ifdef COMPILE_WSCANF
int
-_IO_vfwscanf (s, format, argptr, errp)
- _IO_FILE *s;
- const wchar_t *format;
- _IO_va_list argptr;
- int *errp;
+_IO_vfwscanf (_IO_FILE *s, const wchar_t *format, _IO_va_list argptr,
+ int *errp)
#else
int
-_IO_vfscanf (s, format, argptr, errp)
- _IO_FILE *s;
- const char *format;
- _IO_va_list argptr;
- int *errp;
+_IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
+ int *errp)
#endif
{
va_list arg;
@@ -1891,13 +1886,13 @@ _IO_vfscanf (s, format, argptr, errp)
scan_float:
/* Convert the number. */
ADDW (L_('\0'));
- if (flags & LONGDBL)
+ if ((flags & LONGDBL) && !__ldbl_is_dbl)
{
long double d = __strtold_internal (wp, &tw, flags & GROUP);
if (!(flags & SUPPRESS) && tw != wp)
*ARG (long double *) = negative ? -d : d;
}
- else if (flags & LONG)
+ else if (flags & (LONG | LONGDBL))
{
double d = __strtod_internal (wp, &tw, flags & GROUP);
if (!(flags & SUPPRESS) && tw != wp)
@@ -2460,18 +2455,15 @@ __vfwscanf (FILE *s, const wchar_t *format, va_list argptr)
{
return _IO_vfwscanf (s, format, argptr, NULL);
}
+ldbl_weak_alias (__vfwscanf, vfwscanf)
#else
int
-__vfscanf (FILE *s, const char *format, va_list argptr)
+___vfscanf (FILE *s, const char *format, va_list argptr)
{
- return INTUSE(_IO_vfscanf) (s, format, argptr, NULL);
+ return _IO_vfscanf_internal (s, format, argptr, NULL);
}
-libc_hidden_def (__vfscanf)
-#endif
-
-#ifdef COMPILE_WSCANF
-weak_alias (__vfwscanf, vfwscanf)
-#else
-weak_alias (__vfscanf, vfscanf)
-INTDEF(_IO_vfscanf)
+ldbl_strong_alias (_IO_vfscanf_internal, _IO_vfscanf)
+ldbl_strong_alias (___vfscanf, __vfscanf)
+ldbl_hidden_def (___vfscanf, __vfscanf)
+ldbl_weak_alias (___vfscanf, vfscanf)
#endif
diff --git a/stdio-common/vprintf.c b/stdio-common/vprintf.c
index a8c4a53cd8..5c9cac494a 100644
--- a/stdio-common/vprintf.c
+++ b/stdio-common/vprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1995, 1997, 2006 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
@@ -19,15 +19,16 @@
#include <stdarg.h>
#undef __OPTIMIZE__ /* Avoid inline `vprintf' function. */
#include <stdio.h>
+#include <libioP.h>
#undef vprintf
/* Write formatted output to stdout according to the
format string FORMAT, using the argument list in ARG. */
int
-vprintf (format, arg)
- const char *format;
- __gnuc_va_list arg;
+__vprintf (const char *format, __gnuc_va_list arg)
{
return vfprintf (stdout, format, arg);
}
+
+ldbl_strong_alias (__vprintf, vprintf)
diff --git a/stdlib/Makefile b/stdlib/Makefile
index f44c66b283..2690d5dd47 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1991-2002,2003,2004,2005,2006 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
@@ -21,9 +21,12 @@
#
subdir := stdlib
-headers := stdlib.h alloca.h monetary.h fmtmsg.h ucontext.h sys/ucontext.h \
+headers := stdlib.h bits/stdlib.h bits/stdlib-ldbl.h \
+ monetary.h bits/monetary-ldbl.h \
inttypes.h stdint.h bits/wordsize.h \
- errno.h sys/errno.h bits/errno.h bits/stdlib.h
+ errno.h sys/errno.h bits/errno.h \
+ ucontext.h sys/ucontext.h \
+ alloca.h fmtmsg.h
routines := \
atof atoi atol atoll \
diff --git a/stdlib/bits/monetary-ldbl.h b/stdlib/bits/monetary-ldbl.h
new file mode 100644
index 0000000000..3e080f93f0
--- /dev/null
+++ b/stdlib/bits/monetary-ldbl.h
@@ -0,0 +1,28 @@
+/* -mlong-double-64 compatibility mode for monetary functions.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _MONETARY_H
+# error "Never include <bits/monetary-ldbl.h> directly; use <monetary.h> instead."
+#endif
+
+__LDBL_REDIR_DECL (strfmon)
+
+#ifdef __USE_GNU
+__LDBL_REDIR_DECL (strfmon_l)
+#endif
diff --git a/stdlib/bits/stdlib-ldbl.h b/stdlib/bits/stdlib-ldbl.h
new file mode 100644
index 0000000000..f966bd92e7
--- /dev/null
+++ b/stdlib/bits/stdlib-ldbl.h
@@ -0,0 +1,42 @@
+/* -mlong-double-64 compatibility mode for <stdlib.h> functions.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _STDLIB_H
+# error "Never include <bits/stdlib-ldbl.h> directly; use <stdlib.h> instead."
+#endif
+
+#ifdef __USE_ISOC99
+__BEGIN_NAMESPACE_C99
+__LDBL_REDIR1_DECL (strtold, strtod)
+__END_NAMESPACE_C99
+#endif
+
+#ifdef __USE_GNU
+__LDBL_REDIR1_DECL (strtold_l, strtod_l)
+#endif
+
+__LDBL_REDIR1_DECL (__strtold_internal, __strtod_internal)
+
+#ifdef __USE_MISC
+__LDBL_REDIR1_DECL (qecvt, ecvt)
+__LDBL_REDIR1_DECL (qfcvt, fcvt)
+__LDBL_REDIR1_DECL (qgcvt, gcvt)
+__LDBL_REDIR1_DECL (qecvt_r, ecvt_r)
+__LDBL_REDIR1_DECL (qfcvt_r, fcvt_r)
+#endif
diff --git a/stdlib/fpioconst.c b/stdlib/fpioconst.c
index 59a5e43a82..0e36da65b2 100644
--- a/stdlib/fpioconst.c
+++ b/stdlib/fpioconst.c
@@ -278,7 +278,7 @@ const mp_limb_t __tens[] =
0x26b2716ed595d80full, 0x1d153624adc666b0ull, 0x63ff540e3c42d35aull,
0x65f9ef17cc5573c0ull, 0x80dcc7f755bc28f2ull, 0x5fdcefcef46eeddcull,
0x00000000000553f7ull,
-#if!defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024
+#if !defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024
# define TENS_P9_IDX (TENS_P8_IDX + TENS_P8_SIZE)
# define TENS_P9_SIZE 28
[TENS_P9_IDX] = 0x0000000000000000ull, 0x0000000000000000ull,
diff --git a/stdlib/monetary.h b/stdlib/monetary.h
index 4c8a4cd3d4..d9234ca61b 100644
--- a/stdlib/monetary.h
+++ b/stdlib/monetary.h
@@ -1,5 +1,6 @@
/* Header file for monetary value formatting functions.
- Copyright (C) 1996,97,98,99,2000,02 Free Software Foundation, Inc.
+ Copyright (C) 1996,1997,1998,1999,2000,2002,2006
+ 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
@@ -50,6 +51,10 @@ extern ssize_t strfmon_l (char *__restrict __s, size_t __maxsize,
__THROW __attribute_format_strfmon__ (4, 5);
#endif
+#ifdef __LDBL_COMPAT
+# include <bits/monetary-ldbl.h>
+#endif
+
__END_DECLS
#endif /* monetary.h */
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 085130cafa..c3fc14562e 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2003,2004,2005,2006 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
@@ -350,11 +350,13 @@ __NTH (strtof (__const char *__restrict __nptr, char **__restrict __endptr))
{
return __strtof_internal (__nptr, __endptr, 0);
}
+# ifndef __LDBL_COMPAT
extern __inline long double
__NTH (strtold (__const char *__restrict __nptr, char **__restrict __endptr))
{
return __strtold_internal (__nptr, __endptr, 0);
}
+# endif
__END_NAMESPACE_C99
# endif
@@ -966,6 +968,9 @@ extern int getloadavg (double __loadavg[], int __nelem)
#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
# include <bits/stdlib.h>
#endif
+#ifdef __LDBL_COMPAT
+# include <bits/stdlib-ldbl.h>
+#endif
#endif /* don't just need malloc and calloc */
#undef __need_malloc_and_calloc
diff --git a/stdlib/strfmon.c b/stdlib/strfmon.c
index b11f95c9ac..11ae931d13 100644
--- a/stdlib/strfmon.c
+++ b/stdlib/strfmon.c
@@ -1,5 +1,6 @@
/* Formatting a monetary value according to the current locale.
- Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1996-2001, 2002, 2003, 2004, 2006
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>
and Jochen Hein <Jochen.Hein@informatik.TU-Clausthal.de>, 1996.
@@ -22,10 +23,10 @@
#include <monetary.h>
#include <stdarg.h>
#include <locale/localeinfo.h>
-
+#include <math_ldbl_opt.h>
ssize_t
-strfmon (char *s, size_t maxsize, const char *format, ...)
+__strfmon (char *s, size_t maxsize, const char *format, ...)
{
va_list ap;
@@ -37,3 +38,4 @@ strfmon (char *s, size_t maxsize, const char *format, ...)
return res;
}
+ldbl_strong_alias (__strfmon, strfmon)
diff --git a/stdlib/strfmon_l.c b/stdlib/strfmon_l.c
index 58dab340cf..f6d52e0b56 100644
--- a/stdlib/strfmon_l.c
+++ b/stdlib/strfmon_l.c
@@ -1,5 +1,5 @@
/* Formatting a monetary value according to the given locale.
- Copyright (C) 1996, 1997, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 2002, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -23,10 +23,8 @@
#include <langinfo.h>
#include <locale.h>
#include <monetary.h>
-#ifdef USE_IN_LIBIO
-# include "../libio/libioP.h"
-# include "../libio/strfile.h"
-#endif
+#include "../libio/libioP.h"
+#include "../libio/strfile.h"
#include <printf.h>
#include <stdarg.h>
#include <stdio.h>
@@ -91,13 +89,9 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
va_list ap)
{
struct locale_data *current = loc->__locales[LC_MONETARY];
-#ifdef USE_IN_LIBIO
_IO_strfile f;
-# ifdef _IO_MTSAFE_IO
+#ifdef _IO_MTSAFE_IO
_IO_lock_t lock;
-# endif
-#else
- FILE f;
#endif
struct printf_info info;
char *dest; /* Pointer so copy the output. */
@@ -278,7 +272,8 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
if (*fmt == 'L')
{
++fmt;
- is_long_double = 1;
+ if (!__ldbl_is_dbl)
+ is_long_double = 1;
}
/* Handle format specifier. */
@@ -515,30 +510,13 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
out_string (sign_string);
/* Print the number. */
-#ifdef USE_IN_LIBIO
-# ifdef _IO_MTSAFE_IO
+#ifdef _IO_MTSAFE_IO
f._sbf._f._lock = &lock;
-# endif
+#endif
INTUSE(_IO_init) ((_IO_FILE *) &f, 0);
_IO_JUMPS ((struct _IO_FILE_plus *) &f) = &_IO_str_jumps;
INTUSE(_IO_str_init_static) ((_IO_strfile *) &f, dest,
(s + maxsize) - dest, dest);
-#else
- memset ((void *) &f, 0, sizeof (f));
- f.__magic = _IOMAGIC;
- f.__mode.__write = 1;
- /* The buffer size is one less than MAXLEN
- so we have space for the null terminator. */
- f.__bufp = f.__buffer = (char *) dest;
- f.__bufsize = (s + maxsize) - dest;
- f.__put_limit = f.__buffer + f.__bufsize;
- f.__get_limit = f.__buffer;
- /* After the buffer is full (MAXLEN characters have been written),
- any more characters written will go to the bit bucket. */
- f.__room_funcs = __default_room_functions;
- f.__io_funcs.__write = NULL;
- f.__seen = 1;
-#endif
/* We clear the last available byte so we can find out whether
the numeric representation is too long. */
s[maxsize - 1] = '\0';
@@ -633,7 +611,7 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
}
ssize_t
-__strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
+___strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
{
va_list ap;
@@ -645,4 +623,5 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
return res;
}
-weak_alias (__strfmon_l, strfmon_l)
+ldbl_strong_alias (___strfmon_l, __strfmon_l)
+ldbl_weak_alias (___strfmon_l, strfmon_l)
diff --git a/stdlib/strtod.c b/stdlib/strtod.c
index 1d4e4a4c29..d124bcdcd9 100644
--- a/stdlib/strtod.c
+++ b/stdlib/strtod.c
@@ -1,6 +1,6 @@
/* Read decimal floating point numbers.
This file is part of the GNU C Library.
- Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002, 2003, 2004, 2006 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,6 +24,7 @@
#ifndef FLOAT
+# include <math_ldbl_opt.h>
# define FLOAT double
# ifdef USE_WIDE_CHAR
# define STRTOF wcstod
@@ -68,3 +69,15 @@ STRTOF (nptr, endptr)
{
return INTERNAL(STRTOF_L) (nptr, endptr, 0, _NL_CURRENT_LOCALE);
}
+
+#ifdef LONG_DOUBLE_COMPAT
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+# ifdef USE_WIDE_CHAR
+compat_symbol (libc, wcstod, wcstold, GLIBC_2_0);
+compat_symbol (libc, __wcstod_internal, __wcstold_internal, GLIBC_2_0);
+# else
+compat_symbol (libc, strtod, strtold, GLIBC_2_0);
+compat_symbol (libc, __strtod_internal, __strtold_internal, GLIBC_2_0);
+# endif
+# endif
+#endif
diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c
index 5743ee434c..e13f1086da 100644
--- a/stdlib/strtod_l.c
+++ b/stdlib/strtod_l.c
@@ -1,5 +1,5 @@
/* Convert string representing a number to float value, using given locale.
- Copyright (C) 1997,98,2002,2004,2005 Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,2002,2004,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -28,6 +28,7 @@ extern unsigned long long int ____strtoull_l_internal (const char *, char **,
`strtof.c', `wcstod.c', `wcstold.c', and `wcstof.c' to produce the
`long double' and `float' versions of the reader. */
#ifndef FLOAT
+# include <math_ldbl_opt.h>
# define FLOAT double
# define FLT DBL
# ifdef USE_WIDE_CHAR
@@ -406,6 +407,9 @@ __mpn_lshift_1 (mp_limb_t *ptr, mp_size_t size, unsigned int count,
#define INTERNAL(x) INTERNAL1(x)
#define INTERNAL1(x) __##x##_internal
+#ifndef ____STRTOF_INTERNAL
+# define ____STRTOF_INTERNAL INTERNAL (__STRTOF)
+#endif
/* This file defines a function to check for correct grouping. */
#include "grouping.h"
@@ -417,7 +421,7 @@ __mpn_lshift_1 (mp_limb_t *ptr, mp_size_t size, unsigned int count,
return 0.0. If the number is too big to be represented, set `errno' to
ERANGE and return HUGE_VAL with the appropriate sign. */
FLOAT
-INTERNAL (__STRTOF) (nptr, endptr, group, loc)
+____STRTOF_INTERNAL (nptr, endptr, group, loc)
const STRING_TYPE *nptr;
STRING_TYPE **endptr;
int group;
@@ -1557,7 +1561,7 @@ INTERNAL (__STRTOF) (nptr, endptr, group, loc)
/* NOTREACHED */
}
#if defined _LIBC && !defined USE_WIDE_CHAR
-libc_hidden_def (INTERNAL (__STRTOF))
+libc_hidden_def (____STRTOF_INTERNAL)
#endif
/* External user entry point. */
@@ -1571,6 +1575,23 @@ __STRTOF (nptr, endptr, loc)
STRING_TYPE **endptr;
__locale_t loc;
{
- return INTERNAL (__STRTOF) (nptr, endptr, 0, loc);
+ return ____STRTOF_INTERNAL (nptr, endptr, 0, loc);
}
weak_alias (__STRTOF, STRTOF)
+
+#ifdef LONG_DOUBLE_COMPAT
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_1)
+# ifdef USE_WIDE_CHAR
+compat_symbol (libc, __wcstod_l, __wcstold_l, GLIBC_2_1);
+# else
+compat_symbol (libc, __strtod_l, __strtold_l, GLIBC_2_1);
+# endif
+# endif
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3)
+# ifdef USE_WIDE_CHAR
+compat_symbol (libc, wcstod_l, wcstold_l, GLIBC_2_3);
+# else
+compat_symbol (libc, strtod_l, strtold_l, GLIBC_2_3);
+# endif
+# endif
+#endif
diff --git a/stdlib/strtold.c b/stdlib/strtold.c
index 0bb227a84f..1f56deaa01 100644
--- a/stdlib/strtold.c
+++ b/stdlib/strtold.c
@@ -1,6 +1,6 @@
/* Read decimal floating point numbers.
This file is part of the GNU C Library.
- Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002, 2003, 2004, 2006 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,15 +21,43 @@
/* The actual implementation for all floating point sizes is in strtod.c.
These macros tell it to produce the `float' version, `strtof'. */
+#include <bits/wordsize.h>
+
+#ifdef __LONG_DOUBLE_MATH_OPTIONAL
+# include <wchar.h>
+# define NEW(x) NEW1(x)
+# define NEW1(x) __new_##x
+long double ____new_strtold_internal (const char *, char **, int);
+long double __new_strtold (const char *, char **);
+long double ____new_wcstold_internal (const wchar_t *, wchar_t **, int);
+long double __new_wcstold (const wchar_t *, wchar_t **);
+libc_hidden_proto (____new_strtold_internal)
+libc_hidden_proto (____new_wcstold_internal)
+#else
+# define NEW(x) x
+#endif
+
#define FLOAT long double
#define FLT LDBL
#ifdef USE_WIDE_CHAR
-# define STRTOF wcstold
+# define STRTOF NEW (wcstold)
# define STRTOF_L __wcstold_l
#else
-# define STRTOF strtold
+# define STRTOF NEW (strtold)
# define STRTOF_L __strtold_l
#endif
-
#include "strtod.c"
+
+#ifdef __LONG_DOUBLE_MATH_OPTIONAL
+# include <math_ldbl_opt.h>
+# ifdef USE_WIDE_CHAR
+long_double_symbol (libc, __new_wcstold, wcstold);
+long_double_symbol (libc, ____new_wcstold_internal, __wcstold_internal);
+libc_hidden_ver (____new_wcstold_internal, __wcstold_internal)
+# else
+long_double_symbol (libc, __new_strtold, strtold);
+long_double_symbol (libc, ____new_strtold_internal, __strtold_internal);
+libc_hidden_ver (____new_strtold_internal, __strtold_internal)
+# endif
+#endif
diff --git a/string/Makefile b/string/Makefile
index 2f37d29526..8f9b2ac371 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-1999,2000,2001,2002, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1991-2002, 2005, 2006 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
@@ -53,7 +53,7 @@ tests := tester inl-tester noinl-tester testcopy test-ffs \
tst-strlen stratcliff tst-svc tst-inlcall \
bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap \
tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
- $(addprefix test-,$(strop-tests))
+ bug-strtok1 $(addprefix test-,$(strop-tests))
distribute := memcopy.h pagecopy.h tst-svc.expect test-string.h
diff --git a/string/bug-strtok1.c b/string/bug-strtok1.c
new file mode 100644
index 0000000000..da30acf2e6
--- /dev/null
+++ b/string/bug-strtok1.c
@@ -0,0 +1,45 @@
+/* See BZ #2126. */
+#include <string.h>
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+ const char str[] = "axaaba";
+ char *token;
+ char *cp;
+ char *l;
+ int result = 0;
+
+ puts ("test strtok");
+ cp = strdupa (str);
+ printf ("cp = %p, len = %zu\n", cp, strlen (cp));
+ token = strtok (cp, "ab");
+ result |= token == NULL || strcmp (token, "x");
+ printf ("token: %s (%d)\n", token ? token : "NULL", result);
+ token = strtok(0, "ab");
+ result |= token != NULL;
+ printf ("token: %s (%d)\n", token ? token : "NULL", result);
+ token = strtok(0, "a");
+ result |= token != NULL;
+ printf ("token: %s (%d)\n", token ? token : "NULL", result);
+
+ puts ("test strtok_r");
+ cp = strdupa (str);
+ size_t len = strlen (cp);
+ printf ("cp = %p, len = %zu\n", cp, len);
+ token = strtok_r (cp, "ab", &l);
+ result |= token == NULL || strcmp (token, "x");
+ printf ("token: %s, next = %p (%d)\n", token ? token : "NULL", l, result);
+ token = strtok_r(0, "ab", &l);
+ result |= token != NULL || l != cp + len;
+ printf ("token: %s, next = %p (%d)\n", token ? token : "NULL", l, result);
+ token = strtok_r(0, "a", &l);
+ result |= token != NULL || l != cp + len;
+ printf ("token: %s, next = %p (%d)\n", token ? token : "NULL", l, result);
+
+ return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/sysdeps/alpha/__longjmp.S b/sysdeps/alpha/__longjmp.S
index 40d50312a3..bed26658de 100644
--- a/sysdeps/alpha/__longjmp.S
+++ b/sysdeps/alpha/__longjmp.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1994, 1997, 2006 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
@@ -19,9 +19,7 @@
#define __ASSEMBLY__
#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
ENTRY(__longjmp)
@@ -54,6 +52,11 @@ ENTRY(__longjmp)
ldt $f7, JB_F7*8(a0)
ldt $f8, JB_F8*8(a0)
ldt $f9, JB_F9*8(a0)
+#ifdef PTR_DEMANGLE
+ PTR_DEMANGLE(ra, t1)
+ PTR_DEMANGLE2(t0, t1)
+ PTR_DEMANGLE2(fp, t1)
+#endif
cmoveq v0, 1, v0
mov t0, sp
ret
diff --git a/sysdeps/alpha/bits/setjmp.h b/sysdeps/alpha/bits/setjmp.h
index 71b7738c37..eb0b478fb8 100644
--- a/sysdeps/alpha/bits/setjmp.h
+++ b/sysdeps/alpha/bits/setjmp.h
@@ -1,5 +1,5 @@
/* Define the machine-dependent type `jmp_buf'. Alpha version.
- Copyright (C) 1992, 1997, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1992,1997,2003,2005,2006 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
@@ -55,33 +55,8 @@
* registers.
*/
-#if defined __USE_MISC || defined __ASSEMBLY__
-# define JB_S0 0
-# define JB_S1 1
-# define JB_S2 2
-# define JB_S3 3
-# define JB_S4 4
-# define JB_S5 5
-# define JB_PC 6
-# define JB_FP 7
-# define JB_SP 8
-# define JB_F2 9
-# define JB_F3 10
-# define JB_F4 11
-# define JB_F5 12
-# define JB_F6 13
-# define JB_F7 14
-# define JB_F8 15
-# define JB_F9 16
-#endif
-
#ifndef __ASSEMBLY__
typedef long int __jmp_buf[17];
-
-/* Test if longjmp to JMPBUF would unwind the frame containing a local
- variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \
- ((void *)(_address) < (void *) _demangle ((_jmpbuf)[JB_SP]))
#endif
#endif /* bits/setjmp.h */
diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
index 7e8140cddc..6b882e388a 100644
--- a/sysdeps/alpha/fpu/libm-test-ulps
+++ b/sysdeps/alpha/fpu/libm-test-ulps
@@ -20,12 +20,12 @@ float: 1
ifloat: 1
# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 7
idouble: 1
ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 3
idouble: 1
diff --git a/sysdeps/alpha/jmpbuf-offsets.h b/sysdeps/alpha/jmpbuf-offsets.h
new file mode 100644
index 0000000000..c2503d442a
--- /dev/null
+++ b/sysdeps/alpha/jmpbuf-offsets.h
@@ -0,0 +1,36 @@
+/* Private macros for accessing __jmp_buf contents. Alpha version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define JB_S0 0
+#define JB_S1 1
+#define JB_S2 2
+#define JB_S3 3
+#define JB_S4 4
+#define JB_S5 5
+#define JB_PC 6
+#define JB_FP 7
+#define JB_SP 8
+#define JB_F2 9
+#define JB_F3 10
+#define JB_F4 11
+#define JB_F5 12
+#define JB_F6 13
+#define JB_F7 14
+#define JB_F8 15
+#define JB_F9 16
diff --git a/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h b/sysdeps/alpha/jmpbuf-unwind.h
index 83b7a01a0e..ca5f693d5d 100644
--- a/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h
+++ b/sysdeps/alpha/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -18,10 +18,16 @@
02111-1307 USA. */
#include <setjmp.h>
+#include <jmpbuf-offsets.h>
#include <stdint.h>
#include <unwind.h>
#include <sysdep.h>
+/* Test if longjmp to JMPBUF would unwind the frame containing a local
+ variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \
+ ((void *)(_address) < (void *) _demangle ((_jmpbuf)[JB_SP]))
+
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
@@ -38,5 +44,5 @@ _jmpbuf_sp (__jmp_buf regs)
#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
-/* We use the normal lobngjmp for unwinding. */
+/* We use the normal longjmp for unwinding. */
#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/alpha/setjmp.S b/sysdeps/alpha/setjmp.S
index 14a0320cd3..bc5da0f5bc 100644
--- a/sysdeps/alpha/setjmp.S
+++ b/sysdeps/alpha/setjmp.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1994, 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1992,1994,1996,1997,2002,2006 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
@@ -19,20 +19,24 @@
#define __ASSEMBLY__
#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
- .ent __sigsetjmp
- .global __sigsetjmp
+ .ent __sigsetjmp
+ .global __sigsetjmp
__sigsetjmp:
- ldgp gp, 0(pv)
+ ldgp gp, 0(pv)
$sigsetjmp_local:
- subq sp, 16, sp
- .frame sp, 16, ra, 0
- stq ra, 0(sp)
- .mask 0x04000000, -16
+#ifndef PIC
+#define FRAME 16
+ subq sp, FRAME, sp
+ .frame sp, FRAME, ra, 0
+ stq ra, 0(sp)
+ .mask 0x04000000, -FRAME
+#else
+#define FRAME 0
+ .frame sp, FRAME, ra, 0
+#endif
#ifdef PROF
.set noat
lda AT, _mcount
@@ -47,10 +51,27 @@ $sigsetjmp_local:
stq s3, JB_S3*8(a0)
stq s4, JB_S4*8(a0)
stq s5, JB_S5*8(a0)
+#ifdef PTR_MANGLE
+ PTR_MANGLE(t1, ra, t0)
+ stq t1, JB_PC*8(a0)
+#else
stq ra, JB_PC*8(a0)
- addq sp, 16, t0
+#endif
+#if defined(PTR_MANGLE) && FRAME == 0
+ PTR_MANGLE2(t1, sp, t0)
+#else
+ addq sp, FRAME, t1
+# ifdef PTR_MANGLE
+ PTR_MANGLE2(t1, t1, t0)
+# endif
+#endif
+ stq t1, JB_SP*8(a0)
+#ifdef PTR_MANGLE
+ PTR_MANGLE2(t1, fp, t0)
+ stq t1, JB_FP*8(a0)
+#else
stq fp, JB_FP*8(a0)
- stq t0, JB_SP*8(a0)
+#endif
stt $f2, JB_F2*8(a0)
stt $f3, JB_F3*8(a0)
stt $f4, JB_F4*8(a0)
@@ -60,12 +81,20 @@ $sigsetjmp_local:
stt $f8, JB_F8*8(a0)
stt $f9, JB_F9*8(a0)
+#ifndef PIC
/* Call to C to (potentially) save our signal mask. */
jsr ra, __sigjmp_save
-
ldq ra, 0(sp)
addq sp, 16, sp
ret
+#elif defined NOT_IN_libc && defined IS_IN_rtld
+ /* In ld.so we never save the signal mask. */
+ mov 0, v0
+ ret
+#else
+ /* Tailcall to save the signal mask. */
+ br $31, __sigjmp_save !samegp
+#endif
END(__sigsetjmp)
diff --git a/sysdeps/generic/math_ldbl_opt.h b/sysdeps/generic/math_ldbl_opt.h
new file mode 100644
index 0000000000..8a5d8ba107
--- /dev/null
+++ b/sysdeps/generic/math_ldbl_opt.h
@@ -0,0 +1,14 @@
+/* -mlong-double-64 compatibility mode macros. Stub version.
+
+ These macros are used by some math/ and sysdeps/ieee754/ code.
+ These are the generic definitions for when no funny business is going on.
+ sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h defines them differently
+ for platforms where compatibility symbols are required for a previous
+ ABI that defined long double functions as aliases for the double code. */
+
+#define LONG_DOUBLE_COMPAT(lib, introduced) 0
+#define long_double_symbol(lib, local, symbol)
+#define ldbl_hidden_def(local, name) libc_hidden_def (name)
+#define ldbl_strong_alias(name, aliasname) strong_alias (name, aliasname)
+#define ldbl_weak_alias(name, aliasname) weak_alias (name, aliasname)
+#define __ldbl_is_dbl 0
diff --git a/sysdeps/gnu/errlist-compat.awk b/sysdeps/gnu/errlist-compat.awk
index 2fb5fd906d..ab67a18f64 100644
--- a/sysdeps/gnu/errlist-compat.awk
+++ b/sysdeps/gnu/errlist-compat.awk
@@ -35,7 +35,7 @@ $1 == "#errlist-compat" {
# Don't process any further Versions files
ARGC = ARGIND + 1;
cnt = $2 + 0;
- if (cnt < 100) {
+ if (cnt < 80) {
print "*** this line seems bogus:", $0 > "/dev/stderr";
exit 1;
}
diff --git a/sysdeps/hppa/bits/setjmp.h b/sysdeps/hppa/bits/setjmp.h
index 07ea01eb97..d5ae7e7b5b 100644
--- a/sysdeps/hppa/bits/setjmp.h
+++ b/sysdeps/hppa/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2005, 2006 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
@@ -29,18 +29,8 @@
easier, and to ensure proper alignment. Naturally, user code should
not depend on either representation. */
-#if defined __USE_MISC || defined _ASM
-#define JB_SP (76/4)
-#endif
-
#ifndef _ASM
typedef double __jmp_buf[21];
#endif
-/* Test if longjmp to JMPBUF would unwind the frame containing a local
- variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \
- ((void *) (_address) > \
- (void *) _demangle ((((unsigned long *) _jmpbuf)[JB_SP])))
-
#endif /* bits/setjmp.h */
diff --git a/sysdeps/hppa/elf/start.S b/sysdeps/hppa/elf/start.S
index 4cf832a2f6..94edeaa212 100644
--- a/sysdeps/hppa/elf/start.S
+++ b/sysdeps/hppa/elf/start.S
@@ -34,16 +34,27 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
- .text
-
- .align 4
-
.import main, code
.import $global$, data
.import __libc_start_main, code
.import __libc_csu_fini, code
.import __libc_csu_init, code
+ /* Have the linker create plabel words
+ so we get PLABEL32 relocs and not 21/14 */
+ .section .rodata
+ .align 4
+.Lpmain:
+ .word P%main
+.Lp__libc_start_main:
+ .word P%__libc_start_main
+.Lp__libc_csu_fini:
+ .word P%__libc_csu_fini
+.Lp__libc_csu_init:
+ .word P%__libc_csu_init
+
+ .text
+ .align 4
.globl _start
.export _start, ENTRY
.type _start,@function
@@ -52,28 +63,41 @@ _start:
.proc
.callinfo
- /* load main */
- ldil LP%main, %r26
- ldo RP%main(%r26), %r26
-
- /* argc and argv should be in 25 and 24 */
-
/* Expand the stack to store the 5th through 7th args */
ldo 64(%sp), %sp
-
- /* void (*rtld_fini) (void) (actually the 6th arg) */
- stw %r23, -56(%sp)
-
- /* void (*init) (void) */
- ldil LP%__libc_csu_init, %r23
- ldo RP%__libc_csu_init(%r23), %r23
-
- /* void (*fini) (void) */
- ldil LP%__libc_csu_fini, %r22
- ldo RP%__libc_csu_fini(%r22), %r22
+ /* TODO: Follow ABI? Place more things on the stack here... */
+
+#if SHARED
+ /* load main (1st argument) */
+ addil LR'.Lpmain, %r19
+ ldw RR'.Lpmain(%r1), %r26
+ ldw 0(%r26),%r26
+ /* argc and argv should be in 25 and 24 (2nd and 3rd argument) */
+ /* void (*init) (void) (4th argument) */
+ addil LR'.Lp__libc_csu_init, %r19
+ ldw RR'.Lp__libc_csu_init(%r1), %r23
+ ldw 0(%r23), %r23
+ /* void (*fini) (void) (5th argument) */
+ addil LR'.Lp__libc_csu_fini, %r19
+ ldw RR'.Lp__libc_csu_fini(%r1), %r22
+ ldw 0(%r22), %r22
+#else
+ /* load main (1st argument) */
+ ldil LR'.Lpmain, %r26
+ ldw RR'.Lpmain(%r26), %r26
+ /* argc and argv should be in 25 and 24 (2nd and 3rd argument) */
+ /* void (*init) (void) (4th argument) */
+ ldil LR'.Lp__libc_csu_init, %r23
+ ldw RR'.Lp__libc_csu_init(%r23), %r23
+ /* void (*fini) (void) (5th argument) */
+ ldil LR'.Lp__libc_csu_fini, %r22
+ ldw RR'.Lp__libc_csu_fini(%r22), %r22
+#endif
+ /* Store 5th argument */
stw %r22, -52(%sp)
-
- /* void *stack_end */
+ /* void (*rtld_fini) (void) (6th argument) */
+ stw %r23, -56(%sp)
+ /* void *stack_end (7th argument) */
stw %sp, -60(%sp)
/* load global */
@@ -83,7 +107,7 @@ _start:
bl __libc_start_main,%r2
nop
/* die horribly if it returned (it shouldn't) */
- iitlbp %r0,(%r0)
+ iitlbp %r0,(%sr0,%r0)
nop
.procend
diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
index 73172b49a0..b514496676 100644
--- a/sysdeps/hppa/fpu/libm-test-ulps
+++ b/sysdeps/hppa/fpu/libm-test-ulps
@@ -17,12 +17,12 @@ float: 1
ifloat: 1
# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 7
idouble: 1
ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 3
idouble: 1
diff --git a/sysdeps/hppa/jmpbuf-offsets.h b/sysdeps/hppa/jmpbuf-offsets.h
new file mode 100644
index 0000000000..d95ed8a419
--- /dev/null
+++ b/sysdeps/hppa/jmpbuf-offsets.h
@@ -0,0 +1,20 @@
+/* Private macros for accessing __jmp_buf contents. HPPA version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define JB_SP (76/4)
diff --git a/sysdeps/hppa/jmpbuf-unwind.h b/sysdeps/hppa/jmpbuf-unwind.h
new file mode 100644
index 0000000000..6ea1876e19
--- /dev/null
+++ b/sysdeps/hppa/jmpbuf-unwind.h
@@ -0,0 +1,27 @@
+/* Examine __jmp_buf for unwinding frames. HPPA version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <setjmp.h>
+#include <jmpbuf-offsets.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame containing a local
+ variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \
+ ((void *) (_address) > \
+ (void *) _demangle ((((unsigned long *) _jmpbuf)[JB_SP])))
diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S
index 10a4650fb0..559d56b250 100644
--- a/sysdeps/i386/__longjmp.S
+++ b/sysdeps/i386/__longjmp.S
@@ -1,5 +1,5 @@
/* longjmp for i386.
- Copyright (C) 1995-1998,2000,2002,2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-1998,2000,2002,2005, 2006 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
@@ -18,9 +18,7 @@
02111-1307 USA. */
#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
#include <asm-syntax.h>
#include <bp-sym.h>
#include <bp-asm.h>
diff --git a/sysdeps/i386/bits/setjmp.h b/sysdeps/i386/bits/setjmp.h
index d99a726ba3..0133c40e70 100644
--- a/sysdeps/i386/bits/setjmp.h
+++ b/sysdeps/i386/bits/setjmp.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 1998, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,2001,2003,2005,2006
+ 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
@@ -24,23 +25,8 @@
# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
#endif
-#if defined __USE_MISC || defined _ASM
-# define JB_BX 0
-# define JB_SI 1
-# define JB_DI 2
-# define JB_BP 3
-# define JB_SP 4
-# define JB_PC 5
-# define JB_SIZE 24
-#endif
-
#ifndef _ASM
typedef int __jmp_buf[6];
#endif
-/* Test if longjmp to JMPBUF would unwind the frame
- containing a local variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
- ((void *) (address) < (void *) demangle ((jmpbuf)[JB_SP]))
-
#endif /* bits/setjmp.h */
diff --git a/sysdeps/i386/bsd-_setjmp.S b/sysdeps/i386/bsd-_setjmp.S
index 99cc79160a..ee329ee86c 100644
--- a/sysdeps/i386/bsd-_setjmp.S
+++ b/sysdeps/i386/bsd-_setjmp.S
@@ -1,5 +1,5 @@
/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. i386 version.
- Copyright (C) 1994-1997,2000-2002,2005 Free Software Foundation, Inc.
+ Copyright (C) 1994-1997,2000-2002,2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -22,9 +22,7 @@
in setjmp doesn't clobber the state restored by longjmp. */
#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
#include "bp-sym.h"
#include "bp-asm.h"
diff --git a/sysdeps/i386/bsd-setjmp.S b/sysdeps/i386/bsd-setjmp.S
index 02c76a8c79..c9af0e1477 100644
--- a/sysdeps/i386/bsd-setjmp.S
+++ b/sysdeps/i386/bsd-setjmp.S
@@ -1,5 +1,5 @@
/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. i386 version.
- Copyright (C) 1994-1997,2000,2001,2005 Free Software Foundation, Inc.
+ Copyright (C) 1994-1997,2000,2001,2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -22,9 +22,7 @@
in setjmp doesn't clobber the state restored by longjmp. */
#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
#include "bp-sym.h"
#include "bp-asm.h"
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index e5a4cdf7ed..4efc714b29 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -35,14 +35,14 @@ ildouble: 2
ldouble: 2
# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 9
idouble: 1
ifloat: 9
ildouble: 6
ldouble: 6
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 4
idouble: 1
diff --git a/sysdeps/i386/i686/strtok.S b/sysdeps/i386/i686/strtok.S
index 0cd266a2a1..fe225e5485 100644
--- a/sysdeps/i386/i686/strtok.S
+++ b/sysdeps/i386/i686/strtok.S
@@ -1,6 +1,6 @@
/* strtok (str, delim) -- Return next DELIM separated token from STR.
For Intel 80686.
- Copyright (C) 1998, 2000, 2001, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2001, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -250,9 +250,9 @@ L(8): cmpl %eax, %edx
cmovne %ecx, %edx
/* Store the pointer to the next character. */
-# ifdef USE_AS_STRTOK_R
+#ifdef USE_AS_STRTOK_R
movl SAVE(%esp), %ecx
-# endif
+#endif
movl %edx, SAVE_PTR
CHECK_BOUNDS_HIGH (%edx, SAVE_PTR, jb)
RETURN_BOUNDED_POINTER (SAVE_PTR)
@@ -271,6 +271,10 @@ L(epilogue):
L(returnNULL):
xorl %eax, %eax
+#ifdef USE_AS_STRTOK_R
+ movl SAVE(%esp), %ecx
+#endif
+ movl %edx, SAVE_PTR
RETURN_NULL_BOUNDED_POINTER
jmp L(epilogue)
diff --git a/sysdeps/i386/jmpbuf-offsets.h b/sysdeps/i386/jmpbuf-offsets.h
new file mode 100644
index 0000000000..c53d539edd
--- /dev/null
+++ b/sysdeps/i386/jmpbuf-offsets.h
@@ -0,0 +1,26 @@
+/* Private macros for accessing __jmp_buf contents. i386 version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define JB_BX 0
+#define JB_SI 1
+#define JB_DI 2
+#define JB_BP 3
+#define JB_SP 4
+#define JB_PC 5
+#define JB_SIZE 24
diff --git a/nptl/sysdeps/i386/jmpbuf-unwind.h b/sysdeps/i386/jmpbuf-unwind.h
index 83b7a01a0e..360493fb35 100644
--- a/nptl/sysdeps/i386/jmpbuf-unwind.h
+++ b/sysdeps/i386/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -18,10 +18,16 @@
02111-1307 USA. */
#include <setjmp.h>
+#include <jmpbuf-offsets.h>
#include <stdint.h>
#include <unwind.h>
#include <sysdep.h>
+/* Test if longjmp to JMPBUF would unwind the frame
+ containing a local variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+ ((void *) (address) < (void *) demangle ((jmpbuf)[JB_SP]))
+
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
@@ -38,5 +44,5 @@ _jmpbuf_sp (__jmp_buf regs)
#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
-/* We use the normal lobngjmp for unwinding. */
+/* We use the normal longjmp for unwinding. */
#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S
index 94dcbf2e1f..56c3994f66 100644
--- a/sysdeps/i386/setjmp.S
+++ b/sysdeps/i386/setjmp.S
@@ -1,5 +1,6 @@
/* setjmp for i386.
- Copyright (C) 1995,1996,1997,2000,2001,2005 Free Software Foundation, Inc.
+ Copyright (C) 1995,1996,1997,2000,2001,2005,2006
+ 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
@@ -18,9 +19,7 @@
02111-1307 USA. */
#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
#include <asm-syntax.h>
#include "bp-sym.h"
#include "bp-asm.h"
diff --git a/sysdeps/i386/strtok.S b/sysdeps/i386/strtok.S
index 88b343b6fe..c5f40a83b1 100644
--- a/sysdeps/i386/strtok.S
+++ b/sysdeps/i386/strtok.S
@@ -1,6 +1,6 @@
/* strtok (str, delim) -- Return next DELIM separated token from STR.
For Intel 80x86, x>=3.
- Copyright (C) 1996-1998, 2000, 2001, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1996-1998,2000,2001,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -385,6 +385,10 @@ L(epilogue):
L(returnNULL):
xorl %eax, %eax
+#ifdef USE_AS_STRTOK_R
+ movl SAVE(%esp), %ecx
+#endif
+ movl %edx, SAVE_PTR
RETURN_NULL_BOUNDED_POINTER
jmp L(epilogue)
diff --git a/sysdeps/ia64/fpu/libm-test-ulps b/sysdeps/ia64/fpu/libm-test-ulps
index d0e801ac11..c5a2a08549 100644
--- a/sysdeps/ia64/fpu/libm-test-ulps
+++ b/sysdeps/ia64/fpu/libm-test-ulps
@@ -8,14 +8,14 @@ ildouble: 2
ldouble: 2
# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 7
idouble: 1
ifloat: 7
ildouble: 7
ldouble: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
idouble: 1
ildouble: 1
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h b/sysdeps/ia64/jmpbuf-unwind.h
index c6ef5f7fbd..c53447223b 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h
+++ b/sysdeps/ia64/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -21,6 +21,11 @@
#include <stdint.h>
#include <unwind.h>
+/* Test if longjmp to JMPBUF would unwind the frame containing a local
+ variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \
+ ((void *) (_address) < (void *) (((long int *) _jmpbuf)[0]))
+
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
({ uintptr_t _cfa = (uintptr_t) _Unwind_GetCFA (_context) - (_adj); \
(_cfa < (uintptr_t)(((long *)(_jmpbuf))[0]) - (_adj) \
diff --git a/sysdeps/ieee754/dbl-64/e_exp2.c b/sysdeps/ieee754/dbl-64/e_exp2.c
index b7ed7398a3..ce6368be43 100644
--- a/sysdeps/ieee754/dbl-64/e_exp2.c
+++ b/sysdeps/ieee754/dbl-64/e_exp2.c
@@ -1,5 +1,5 @@
/* Double-precision floating point 2^x.
- Copyright (C) 1997, 1998, 2000, 2001, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,2000,2001,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
@@ -42,10 +42,8 @@
constants in the .data section. Ideally the constant is placed in
.rodata.cst8 so that it can be merged, but gcc sucks, it ICEs when
we try to force this section on it. --drepper */
-static const volatile double TWO1023 __attribute__ ((section (".rodata")))
- = 8.988465674311579539e+307;
-static const volatile double TWOM1000 __attribute__ ((section (".rodata")))
- = 9.3326361850321887899e-302;
+static const volatile double TWO1023 = 8.988465674311579539e+307;
+static const volatile double TWOM1000 = 9.3326361850321887899e-302;
double
__ieee754_exp2 (double x)
diff --git a/sysdeps/ieee754/flt-32/e_exp2f.c b/sysdeps/ieee754/flt-32/e_exp2f.c
index ea55304d9a..194222a0cd 100644
--- a/sysdeps/ieee754/flt-32/e_exp2f.c
+++ b/sysdeps/ieee754/flt-32/e_exp2f.c
@@ -1,5 +1,5 @@
/* Single-precision floating point 2^x.
- Copyright (C) 1997, 1998, 2000, 2001, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,2000,2001,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
@@ -38,15 +38,8 @@
#include "t_exp2f.h"
-/* XXX I know the assembler generates a warning about incorrect section
- attributes. But without the attribute here the compiler places the
- constants in the .data section. Ideally the constant is placed in
- .rodata.cst4 so that it can be merged, but gcc sucks, it ICEs when
- we try to force this section on it. --drepper */
-static const volatile float TWOM100 __attribute__ ((section (".rodata")))
- = 7.88860905e-31;
-static const volatile float TWO127 __attribute__ ((section (".rodata")))
- = 1.7014118346e+38;
+static const volatile float TWOM100 = 7.88860905e-31;
+static const volatile float TWO127 = 1.7014118346e+38;
float
__ieee754_exp2f (float x)
diff --git a/sysdeps/ieee754/flt-32/e_expf.c b/sysdeps/ieee754/flt-32/e_expf.c
index b3e458c3da..b9cd53c033 100644
--- a/sysdeps/ieee754/flt-32/e_expf.c
+++ b/sysdeps/ieee754/flt-32/e_expf.c
@@ -1,5 +1,5 @@
/* Single-precision floating point e^x.
- Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
@@ -60,15 +60,8 @@
extern const float __exp_deltatable[178];
extern const double __exp_atable[355] /* __attribute__((mode(DF))) */;
-/* XXX I know the assembler generates a warning about incorrect section
- attributes. But without the attribute here the compiler places the
- constants in the .data section. Ideally the constant is placed in
- .rodata.cst4 so that it can be merged, but gcc sucks, it ICEs when
- we try to force this section on it. --drepper */
-static const volatile float TWOM100 __attribute__ ((section (".rodata")))
- = 7.88860905e-31;
-static const volatile float TWO127 __attribute__ ((section (".rodata")))
- = 1.7014118346e+38;
+static const volatile float TWOM100 = 7.88860905e-31;
+static const volatile float TWO127 = 1.7014118346e+38;
float
__ieee754_expf (float x)
diff --git a/sysdeps/ieee754/flt-32/s_expm1f.c b/sysdeps/ieee754/flt-32/s_expm1f.c
index 7d32dbb016..1f032be25f 100644
--- a/sysdeps/ieee754/flt-32/s_expm1f.c
+++ b/sysdeps/ieee754/flt-32/s_expm1f.c
@@ -20,15 +20,8 @@ static char rcsid[] = "$NetBSD: s_expm1f.c,v 1.5 1995/05/10 20:47:11 jtc Exp $";
#include "math.h"
#include "math_private.h"
-/* XXX I know the assembler generates a warning about incorrect section
- attributes. But without the attribute here the compiler places the
- constants in the .data section. Ideally the constant is placed in
- .rodata.cst4 so that it can be merged, but gcc sucks, it ICEs when
- we try to force this section on it. --drepper */
-static const volatile float huge __attribute__ ((section (".rodata")))
- = 1.0e+30;
-static const volatile float tiny __attribute__ ((section (".rodata")))
- = 1.0e-30;
+static const volatile float huge = 1.0e+30;
+static const volatile float tiny = 1.0e-30;
#ifdef __STDC__
static const float
diff --git a/sysdeps/ieee754/ldbl-128/e_powl.c b/sysdeps/ieee754/ldbl-128/e_powl.c
index 18bf237e65..ba7e27b7d7 100644
--- a/sysdeps/ieee754/ldbl-128/e_powl.c
+++ b/sysdeps/ieee754/ldbl-128/e_powl.c
@@ -220,7 +220,7 @@ __ieee754_powl (x, y)
{
if (((ix - 0x3fff0000) | p.parts32.w1 | p.parts32.w2 | p.parts32.w3)
== 0)
- return y - y; /* inf**+-1 is NaN */
+ return y - y; /* +-1**inf is NaN */
else if (ix >= 0x3fff0000) /* (|x|>1)**+-inf = inf,0 */
return (hy >= 0) ? y : zero;
else /* (|x|<1)**-,+inf = inf,0 */
diff --git a/sysdeps/ieee754/ldbl-128ibm/Makefile b/sysdeps/ieee754/ldbl-128ibm/Makefile
new file mode 100644
index 0000000000..8e1e2e6ae5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/Makefile
@@ -0,0 +1,5 @@
+# The`long double' type is a distinct type we support if
+# -mlong-double-128 option is used (or when it becomes a default
+# when -mlong-double-64 is not used).
+long-double-fcts = yes
+sysdep-CFLAGS += -mlong-double-128
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c b/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c
new file mode 100644
index 0000000000..00576c76c8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c
@@ -0,0 +1,69 @@
+/* @(#)e_acosh.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: e_acosh.c,v 1.9 1995/05/12 04:57:18 jtc Exp $";
+#endif
+
+/* __ieee754_acosh(x)
+ * Method :
+ * Based on
+ * acosh(x) = log [ x + sqrt(x*x-1) ]
+ * we have
+ * acosh(x) := log(x)+ln2, if x is large; else
+ * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else
+ * acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1.
+ *
+ * Special cases:
+ * acosh(x) is NaN with signal if x<1.
+ * acosh(NaN) is NaN without signal.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+one = 1.0L,
+ln2 = 6.93147180559945286227e-01L; /* 0x3FE62E42, 0xFEFA39EF */
+
+#ifdef __STDC__
+ long double __ieee754_acoshl(long double x)
+#else
+ long double __ieee754_acoshl(x)
+ long double x;
+#endif
+{
+ long double t;
+ int64_t hx;
+ u_int64_t lx;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ if(hx<0x3ff0000000000000LL) { /* x < 1 */
+ return (x-x)/(x-x);
+ } else if(hx >=0x41b0000000000000LL) { /* x > 2**28 */
+ if(hx >=0x7ff0000000000000LL) { /* x is inf of NaN */
+ return x+x;
+ } else
+ return __ieee754_logl(x)+ln2; /* acosh(huge)=log(2x) */
+ } else if (((hx-0x3ff0000000000000LL)|(lx&0x7fffffffffffffffLL))==0) {
+ return 0.0; /* acosh(1) = 0 */
+ } else if (hx > 0x4000000000000000LL) { /* 2**28 > x > 2 */
+ t=x*x;
+ return __ieee754_logl(2.0*x-one/(x+__ieee754_sqrtl(t-one)));
+ } else { /* 1<x<2 */
+ t = x-one;
+ return __log1p(t+__sqrtl(2.0*t+t*t));
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acosl.c b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c
new file mode 100644
index 0000000000..8823fd69b4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c
@@ -0,0 +1,328 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ Long double expansions are
+ Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under
+ the following terms:
+
+ This 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.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/* __ieee754_acosl(x)
+ * Method :
+ * acos(x) = pi/2 - asin(x)
+ * acos(-x) = pi/2 + asin(x)
+ * For |x| <= 0.375
+ * acos(x) = pi/2 - asin(x)
+ * Between .375 and .5 the approximation is
+ * acos(0.4375 + x) = acos(0.4375) + x P(x) / Q(x)
+ * Between .5 and .625 the approximation is
+ * acos(0.5625 + x) = acos(0.5625) + x rS(x) / sS(x)
+ * For x > 0.625,
+ * acos(x) = 2 asin(sqrt((1-x)/2))
+ * computed with an extended precision square root in the leading term.
+ * For x < -0.625
+ * acos(x) = pi - 2 asin(sqrt((1-|x|)/2))
+ *
+ * Special cases:
+ * if x is NaN, return x itself;
+ * if |x|>1, return NaN with invalid signal.
+ *
+ * Functions needed: __ieee754_sqrtl.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+ one = 1.0L,
+ pio2_hi = 1.5707963267948966192313216916397514420986L,
+ pio2_lo = 4.3359050650618905123985220130216759843812E-35L,
+
+ /* acos(0.5625 + x) = acos(0.5625) + x rS(x) / sS(x)
+ -0.0625 <= x <= 0.0625
+ peak relative error 3.3e-35 */
+
+ rS0 = 5.619049346208901520945464704848780243887E0L,
+ rS1 = -4.460504162777731472539175700169871920352E1L,
+ rS2 = 1.317669505315409261479577040530751477488E2L,
+ rS3 = -1.626532582423661989632442410808596009227E2L,
+ rS4 = 3.144806644195158614904369445440583873264E1L,
+ rS5 = 9.806674443470740708765165604769099559553E1L,
+ rS6 = -5.708468492052010816555762842394927806920E1L,
+ rS7 = -1.396540499232262112248553357962639431922E1L,
+ rS8 = 1.126243289311910363001762058295832610344E1L,
+ rS9 = 4.956179821329901954211277873774472383512E-1L,
+ rS10 = -3.313227657082367169241333738391762525780E-1L,
+
+ sS0 = -4.645814742084009935700221277307007679325E0L,
+ sS1 = 3.879074822457694323970438316317961918430E1L,
+ sS2 = -1.221986588013474694623973554726201001066E2L,
+ sS3 = 1.658821150347718105012079876756201905822E2L,
+ sS4 = -4.804379630977558197953176474426239748977E1L,
+ sS5 = -1.004296417397316948114344573811562952793E2L,
+ sS6 = 7.530281592861320234941101403870010111138E1L,
+ sS7 = 1.270735595411673647119592092304357226607E1L,
+ sS8 = -1.815144839646376500705105967064792930282E1L,
+ sS9 = -7.821597334910963922204235247786840828217E-2L,
+ /* 1.000000000000000000000000000000000000000E0 */
+
+ acosr5625 = 9.7338991014954640492751132535550279812151E-1L,
+ pimacosr5625 = 2.1682027434402468335351320579240000860757E0L,
+
+ /* acos(0.4375 + x) = acos(0.4375) + x rS(x) / sS(x)
+ -0.0625 <= x <= 0.0625
+ peak relative error 2.1e-35 */
+
+ P0 = 2.177690192235413635229046633751390484892E0L,
+ P1 = -2.848698225706605746657192566166142909573E1L,
+ P2 = 1.040076477655245590871244795403659880304E2L,
+ P3 = -1.400087608918906358323551402881238180553E2L,
+ P4 = 2.221047917671449176051896400503615543757E1L,
+ P5 = 9.643714856395587663736110523917499638702E1L,
+ P6 = -5.158406639829833829027457284942389079196E1L,
+ P7 = -1.578651828337585944715290382181219741813E1L,
+ P8 = 1.093632715903802870546857764647931045906E1L,
+ P9 = 5.448925479898460003048760932274085300103E-1L,
+ P10 = -3.315886001095605268470690485170092986337E-1L,
+ Q0 = -1.958219113487162405143608843774587557016E0L,
+ Q1 = 2.614577866876185080678907676023269360520E1L,
+ Q2 = -9.990858606464150981009763389881793660938E1L,
+ Q3 = 1.443958741356995763628660823395334281596E2L,
+ Q4 = -3.206441012484232867657763518369723873129E1L,
+ Q5 = -1.048560885341833443564920145642588991492E2L,
+ Q6 = 6.745883931909770880159915641984874746358E1L,
+ Q7 = 1.806809656342804436118449982647641392951E1L,
+ Q8 = -1.770150690652438294290020775359580915464E1L,
+ Q9 = -5.659156469628629327045433069052560211164E-1L,
+ /* 1.000000000000000000000000000000000000000E0 */
+
+ acosr4375 = 1.1179797320499710475919903296900511518755E0L,
+ pimacosr4375 = 2.0236129215398221908706530535894517323217E0L,
+
+ /* asin(x) = x + x^3 pS(x^2) / qS(x^2)
+ 0 <= x <= 0.5
+ peak relative error 1.9e-35 */
+ pS0 = -8.358099012470680544198472400254596543711E2L,
+ pS1 = 3.674973957689619490312782828051860366493E3L,
+ pS2 = -6.730729094812979665807581609853656623219E3L,
+ pS3 = 6.643843795209060298375552684423454077633E3L,
+ pS4 = -3.817341990928606692235481812252049415993E3L,
+ pS5 = 1.284635388402653715636722822195716476156E3L,
+ pS6 = -2.410736125231549204856567737329112037867E2L,
+ pS7 = 2.219191969382402856557594215833622156220E1L,
+ pS8 = -7.249056260830627156600112195061001036533E-1L,
+ pS9 = 1.055923570937755300061509030361395604448E-3L,
+
+ qS0 = -5.014859407482408326519083440151745519205E3L,
+ qS1 = 2.430653047950480068881028451580393430537E4L,
+ qS2 = -4.997904737193653607449250593976069726962E4L,
+ qS3 = 5.675712336110456923807959930107347511086E4L,
+ qS4 = -3.881523118339661268482937768522572588022E4L,
+ qS5 = 1.634202194895541569749717032234510811216E4L,
+ qS6 = -4.151452662440709301601820849901296953752E3L,
+ qS7 = 5.956050864057192019085175976175695342168E2L,
+ qS8 = -4.175375777334867025769346564600396877176E1L;
+ /* 1.000000000000000000000000000000000000000E0 */
+
+#ifdef __STDC__
+long double
+__ieee754_acosl (long double x)
+#else
+long double
+__ieee754_acosl (x)
+ long double x;
+#endif
+{
+ long double z, r, w, p, q, s, t, f2;
+ int32_t ix, sign;
+ ieee854_long_double_shape_type u;
+
+ u.value = x;
+ sign = u.parts32.w0;
+ ix = sign & 0x7fffffff;
+ u.parts32.w0 = ix; /* |x| */
+ if (ix >= 0x3ff00000) /* |x| >= 1 */
+ {
+ if (ix == 0x3ff00000
+ && (u.parts32.w1 | (u.parts32.w2&0x7fffffff) | u.parts32.w3) == 0)
+ { /* |x| == 1 */
+ if ((sign & 0x80000000) == 0)
+ return 0.0; /* acos(1) = 0 */
+ else
+ return (2.0 * pio2_hi) + (2.0 * pio2_lo); /* acos(-1)= pi */
+ }
+ return (x - x) / (x - x); /* acos(|x| > 1) is NaN */
+ }
+ else if (ix < 0x3fe00000) /* |x| < 0.5 */
+ {
+ if (ix < 0x3c600000) /* |x| < 2**-57 */
+ return pio2_hi + pio2_lo;
+ if (ix < 0x3fde0000) /* |x| < .4375 */
+ {
+ /* Arcsine of x. */
+ z = x * x;
+ p = (((((((((pS9 * z
+ + pS8) * z
+ + pS7) * z
+ + pS6) * z
+ + pS5) * z
+ + pS4) * z
+ + pS3) * z
+ + pS2) * z
+ + pS1) * z
+ + pS0) * z;
+ q = (((((((( z
+ + qS8) * z
+ + qS7) * z
+ + qS6) * z
+ + qS5) * z
+ + qS4) * z
+ + qS3) * z
+ + qS2) * z
+ + qS1) * z
+ + qS0;
+ r = x + x * p / q;
+ z = pio2_hi - (r - pio2_lo);
+ return z;
+ }
+ /* .4375 <= |x| < .5 */
+ t = u.value - 0.4375L;
+ p = ((((((((((P10 * t
+ + P9) * t
+ + P8) * t
+ + P7) * t
+ + P6) * t
+ + P5) * t
+ + P4) * t
+ + P3) * t
+ + P2) * t
+ + P1) * t
+ + P0) * t;
+
+ q = (((((((((t
+ + Q9) * t
+ + Q8) * t
+ + Q7) * t
+ + Q6) * t
+ + Q5) * t
+ + Q4) * t
+ + Q3) * t
+ + Q2) * t
+ + Q1) * t
+ + Q0;
+ r = p / q;
+ if (sign & 0x80000000)
+ r = pimacosr4375 - r;
+ else
+ r = acosr4375 + r;
+ return r;
+ }
+ else if (ix < 0x3fe40000) /* |x| < 0.625 */
+ {
+ t = u.value - 0.5625L;
+ p = ((((((((((rS10 * t
+ + rS9) * t
+ + rS8) * t
+ + rS7) * t
+ + rS6) * t
+ + rS5) * t
+ + rS4) * t
+ + rS3) * t
+ + rS2) * t
+ + rS1) * t
+ + rS0) * t;
+
+ q = (((((((((t
+ + sS9) * t
+ + sS8) * t
+ + sS7) * t
+ + sS6) * t
+ + sS5) * t
+ + sS4) * t
+ + sS3) * t
+ + sS2) * t
+ + sS1) * t
+ + sS0;
+ if (sign & 0x80000000)
+ r = pimacosr5625 - p / q;
+ else
+ r = acosr5625 + p / q;
+ return r;
+ }
+ else
+ { /* |x| >= .625 */
+ z = (one - u.value) * 0.5;
+ s = __ieee754_sqrtl (z);
+ /* Compute an extended precision square root from
+ the Newton iteration s -> 0.5 * (s + z / s).
+ The change w from s to the improved value is
+ w = 0.5 * (s + z / s) - s = (s^2 + z)/2s - s = (z - s^2)/2s.
+ Express s = f1 + f2 where f1 * f1 is exactly representable.
+ w = (z - s^2)/2s = (z - f1^2 - 2 f1 f2 - f2^2)/2s .
+ s + w has extended precision. */
+ u.value = s;
+ u.parts32.w2 = 0;
+ u.parts32.w3 = 0;
+ f2 = s - u.value;
+ w = z - u.value * u.value;
+ w = w - 2.0 * u.value * f2;
+ w = w - f2 * f2;
+ w = w / (2.0 * s);
+ /* Arcsine of s. */
+ p = (((((((((pS9 * z
+ + pS8) * z
+ + pS7) * z
+ + pS6) * z
+ + pS5) * z
+ + pS4) * z
+ + pS3) * z
+ + pS2) * z
+ + pS1) * z
+ + pS0) * z;
+ q = (((((((( z
+ + qS8) * z
+ + qS7) * z
+ + qS6) * z
+ + qS5) * z
+ + qS4) * z
+ + qS3) * z
+ + qS2) * z
+ + qS1) * z
+ + qS0;
+ r = s + (w + s * p / q);
+
+ if (sign & 0x80000000)
+ w = pio2_hi + (pio2_lo - r);
+ else
+ w = r;
+ return 2.0 * w;
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_asinl.c b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
new file mode 100644
index 0000000000..3696694f78
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
@@ -0,0 +1,265 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ Long double expansions are
+ Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under the
+ following terms:
+
+ This 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.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/* __ieee754_asin(x)
+ * Method :
+ * Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ...
+ * we approximate asin(x) on [0,0.5] by
+ * asin(x) = x + x*x^2*R(x^2)
+ * Between .5 and .625 the approximation is
+ * asin(0.5625 + x) = asin(0.5625) + x rS(x) / sS(x)
+ * For x in [0.625,1]
+ * asin(x) = pi/2-2*asin(sqrt((1-x)/2))
+ * Let y = (1-x), z = y/2, s := sqrt(z), and pio2_hi+pio2_lo=pi/2;
+ * then for x>0.98
+ * asin(x) = pi/2 - 2*(s+s*z*R(z))
+ * = pio2_hi - (2*(s+s*z*R(z)) - pio2_lo)
+ * For x<=0.98, let pio4_hi = pio2_hi/2, then
+ * f = hi part of s;
+ * c = sqrt(z) - f = (z-f*f)/(s+f) ...f+c=sqrt(z)
+ * and
+ * asin(x) = pi/2 - 2*(s+s*z*R(z))
+ * = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo)
+ * = pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c))
+ *
+ * Special cases:
+ * if x is NaN, return x itself;
+ * if |x|>1, return NaN with invalid signal.
+ *
+ */
+
+
+#include "math.h"
+#include "math_private.h"
+long double sqrtl (long double);
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+ one = 1.0L,
+ huge = 1.0e+300L,
+ pio2_hi = 1.5707963267948966192313216916397514420986L,
+ pio2_lo = 4.3359050650618905123985220130216759843812E-35L,
+ pio4_hi = 7.8539816339744830961566084581987569936977E-1L,
+
+ /* coefficient for R(x^2) */
+
+ /* asin(x) = x + x^3 pS(x^2) / qS(x^2)
+ 0 <= x <= 0.5
+ peak relative error 1.9e-35 */
+ pS0 = -8.358099012470680544198472400254596543711E2L,
+ pS1 = 3.674973957689619490312782828051860366493E3L,
+ pS2 = -6.730729094812979665807581609853656623219E3L,
+ pS3 = 6.643843795209060298375552684423454077633E3L,
+ pS4 = -3.817341990928606692235481812252049415993E3L,
+ pS5 = 1.284635388402653715636722822195716476156E3L,
+ pS6 = -2.410736125231549204856567737329112037867E2L,
+ pS7 = 2.219191969382402856557594215833622156220E1L,
+ pS8 = -7.249056260830627156600112195061001036533E-1L,
+ pS9 = 1.055923570937755300061509030361395604448E-3L,
+
+ qS0 = -5.014859407482408326519083440151745519205E3L,
+ qS1 = 2.430653047950480068881028451580393430537E4L,
+ qS2 = -4.997904737193653607449250593976069726962E4L,
+ qS3 = 5.675712336110456923807959930107347511086E4L,
+ qS4 = -3.881523118339661268482937768522572588022E4L,
+ qS5 = 1.634202194895541569749717032234510811216E4L,
+ qS6 = -4.151452662440709301601820849901296953752E3L,
+ qS7 = 5.956050864057192019085175976175695342168E2L,
+ qS8 = -4.175375777334867025769346564600396877176E1L,
+ /* 1.000000000000000000000000000000000000000E0 */
+
+ /* asin(0.5625 + x) = asin(0.5625) + x rS(x) / sS(x)
+ -0.0625 <= x <= 0.0625
+ peak relative error 3.3e-35 */
+ rS0 = -5.619049346208901520945464704848780243887E0L,
+ rS1 = 4.460504162777731472539175700169871920352E1L,
+ rS2 = -1.317669505315409261479577040530751477488E2L,
+ rS3 = 1.626532582423661989632442410808596009227E2L,
+ rS4 = -3.144806644195158614904369445440583873264E1L,
+ rS5 = -9.806674443470740708765165604769099559553E1L,
+ rS6 = 5.708468492052010816555762842394927806920E1L,
+ rS7 = 1.396540499232262112248553357962639431922E1L,
+ rS8 = -1.126243289311910363001762058295832610344E1L,
+ rS9 = -4.956179821329901954211277873774472383512E-1L,
+ rS10 = 3.313227657082367169241333738391762525780E-1L,
+
+ sS0 = -4.645814742084009935700221277307007679325E0L,
+ sS1 = 3.879074822457694323970438316317961918430E1L,
+ sS2 = -1.221986588013474694623973554726201001066E2L,
+ sS3 = 1.658821150347718105012079876756201905822E2L,
+ sS4 = -4.804379630977558197953176474426239748977E1L,
+ sS5 = -1.004296417397316948114344573811562952793E2L,
+ sS6 = 7.530281592861320234941101403870010111138E1L,
+ sS7 = 1.270735595411673647119592092304357226607E1L,
+ sS8 = -1.815144839646376500705105967064792930282E1L,
+ sS9 = -7.821597334910963922204235247786840828217E-2L,
+ /* 1.000000000000000000000000000000000000000E0 */
+
+ asinr5625 = 5.9740641664535021430381036628424864397707E-1L;
+
+
+
+#ifdef __STDC__
+long double
+__ieee754_asinl (long double x)
+#else
+double
+__ieee754_asinl (x)
+ long double x;
+#endif
+{
+ long double t, w, p, q, c, r, s;
+ int32_t ix, sign, flag;
+ ieee854_long_double_shape_type u;
+
+ flag = 0;
+ u.value = x;
+ sign = u.parts32.w0;
+ ix = sign & 0x7fffffff;
+ u.parts32.w0 = ix; /* |x| */
+ if (ix >= 0x3ff00000) /* |x|>= 1 */
+ {
+ if (ix == 0x3ff00000
+ && (u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3) == 0)
+ /* asin(1)=+-pi/2 with inexact */
+ return x * pio2_hi + x * pio2_lo;
+ return (x - x) / (x - x); /* asin(|x|>1) is NaN */
+ }
+ else if (ix < 0x3fe00000) /* |x| < 0.5 */
+ {
+ if (ix < 0x3c600000) /* |x| < 2**-57 */
+ {
+ if (huge + x > one)
+ return x; /* return x with inexact if x!=0 */
+ }
+ else
+ {
+ t = x * x;
+ /* Mark to use pS, qS later on. */
+ flag = 1;
+ }
+ }
+ else if (ix < 0x3fe40000) /* 0.625 */
+ {
+ t = u.value - 0.5625;
+ p = ((((((((((rS10 * t
+ + rS9) * t
+ + rS8) * t
+ + rS7) * t
+ + rS6) * t
+ + rS5) * t
+ + rS4) * t
+ + rS3) * t
+ + rS2) * t
+ + rS1) * t
+ + rS0) * t;
+
+ q = ((((((((( t
+ + sS9) * t
+ + sS8) * t
+ + sS7) * t
+ + sS6) * t
+ + sS5) * t
+ + sS4) * t
+ + sS3) * t
+ + sS2) * t
+ + sS1) * t
+ + sS0;
+ t = asinr5625 + p / q;
+ if ((sign & 0x80000000) == 0)
+ return t;
+ else
+ return -t;
+ }
+ else
+ {
+ /* 1 > |x| >= 0.625 */
+ w = one - u.value;
+ t = w * 0.5;
+ }
+
+ p = (((((((((pS9 * t
+ + pS8) * t
+ + pS7) * t
+ + pS6) * t
+ + pS5) * t
+ + pS4) * t
+ + pS3) * t
+ + pS2) * t
+ + pS1) * t
+ + pS0) * t;
+
+ q = (((((((( t
+ + qS8) * t
+ + qS7) * t
+ + qS6) * t
+ + qS5) * t
+ + qS4) * t
+ + qS3) * t
+ + qS2) * t
+ + qS1) * t
+ + qS0;
+
+ if (flag) /* 2^-57 < |x| < 0.5 */
+ {
+ w = p / q;
+ return x + x * w;
+ }
+
+ s = __ieee754_sqrtl (t);
+ if (ix >= 0x3fef3333) /* |x| > 0.975 */
+ {
+ w = p / q;
+ t = pio2_hi - (2.0 * (s + s * w) - pio2_lo);
+ }
+ else
+ {
+ u.value = s;
+ u.parts32.w3 = 0;
+ u.parts32.w2 = 0;
+ w = u.value;
+ c = (t - w * w) / (s + w);
+ r = p / q;
+ p = 2.0 * s * r - (pio2_lo - 2.0 * c);
+ q = pio4_hi - 2.0 * w;
+ t = pio4_hi - (p - q);
+ }
+
+ if ((sign & 0x80000000) == 0)
+ return t;
+ else
+ return -t;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c b/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c
new file mode 100644
index 0000000000..a4bb53df04
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c
@@ -0,0 +1,124 @@
+/* e_atan2l.c -- long double version of e_atan2.c.
+ * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* __ieee754_atan2l(y,x)
+ * Method :
+ * 1. Reduce y to positive by atan2l(y,x)=-atan2l(-y,x).
+ * 2. Reduce x to positive by (if x and y are unexceptional):
+ * ARG (x+iy) = arctan(y/x) ... if x > 0,
+ * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
+ *
+ * Special cases:
+ *
+ * ATAN2((anything), NaN ) is NaN;
+ * ATAN2(NAN , (anything) ) is NaN;
+ * ATAN2(+-0, +(anything but NaN)) is +-0 ;
+ * ATAN2(+-0, -(anything but NaN)) is +-pi ;
+ * ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2;
+ * ATAN2(+-(anything but INF and NaN), +INF) is +-0 ;
+ * ATAN2(+-(anything but INF and NaN), -INF) is +-pi;
+ * ATAN2(+-INF,+INF ) is +-pi/4 ;
+ * ATAN2(+-INF,-INF ) is +-3pi/4;
+ * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2;
+ *
+ * Constants:
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+tiny = 1.0e-300L,
+zero = 0.0,
+pi_o_4 = 7.85398163397448309615660845819875699e-01L, /* 3ffe921fb54442d18469898cc51701b8 */
+pi_o_2 = 1.57079632679489661923132169163975140e+00L, /* 3fff921fb54442d18469898cc51701b8 */
+pi = 3.14159265358979323846264338327950280e+00L, /* 4000921fb54442d18469898cc51701b8 */
+pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74020bbea64 */
+
+#ifdef __STDC__
+ long double __ieee754_atan2l(long double y, long double x)
+#else
+ long double __ieee754_atan2l(y,x)
+ long double y,x;
+#endif
+{
+ long double z;
+ int64_t k,m,hx,hy,ix,iy;
+ u_int64_t lx,ly;
+
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ ix = hx&0x7fffffffffffffffLL;
+ GET_LDOUBLE_WORDS64(hy,ly,y);
+ iy = hy&0x7fffffffffffffffLL;
+ if(((ix)>0x7ff0000000000000LL)||
+ ((iy)>0x7ff0000000000000LL)) /* x or y is NaN */
+ return x+y;
+ if(((hx-0x3ff0000000000000LL))==0) return __atanl(y); /* x=1.0L */
+ m = ((hy>>63)&1)|((hx>>62)&2); /* 2*sign(x)+sign(y) */
+
+ /* when y = 0 */
+ if((iy|(ly&0x7fffffffffffffffLL))==0) {
+ switch(m) {
+ case 0:
+ case 1: return y; /* atan(+-0,+anything)=+-0 */
+ case 2: return pi+tiny;/* atan(+0,-anything) = pi */
+ case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
+ }
+ }
+ /* when x = 0 */
+ if((ix|(lx&0x7fffffffffffffff))==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
+
+ /* when x is INF */
+ if(ix==0x7ff0000000000000LL) {
+ if(iy==0x7ff0000000000000LL) {
+ switch(m) {
+ case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */
+ case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */
+ case 2: return 3.0L*pi_o_4+tiny;/*atan(+INF,-INF)*/
+ case 3: return -3.0L*pi_o_4-tiny;/*atan(-INF,-INF)*/
+ }
+ } else {
+ switch(m) {
+ case 0: return zero ; /* atan(+...,+INF) */
+ case 1: return -zero ; /* atan(-...,+INF) */
+ case 2: return pi+tiny ; /* atan(+...,-INF) */
+ case 3: return -pi-tiny ; /* atan(-...,-INF) */
+ }
+ }
+ }
+ /* when y is INF */
+ if(iy==0x7ff0000000000000LL) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
+
+ /* compute y/x */
+ k = (iy-ix)>>52;
+ if(k > 120) z=pi_o_2+0.5L*pi_lo; /* |y/x| > 2**120 */
+ else if(hx<0&&k<-120) z=0.0L; /* |y|/x < -2**120 */
+ else z=__atanl(fabsl(y/x)); /* safe to do y/x */
+ switch (m) {
+ case 0: return z ; /* atan(+,+) */
+ case 1: return -z ; /* atan(-,+) */
+ case 2: return pi-(z-pi_lo);/* atan(+,-) */
+ default: /* case 3 */
+ return (z-pi_lo)-pi;/* atan(-,-) */
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c b/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c
new file mode 100644
index 0000000000..a801bd6f74
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c
@@ -0,0 +1,79 @@
+/* @(#)e_atanh.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $";
+#endif
+
+/* __ieee754_atanh(x)
+ * Method :
+ * 1.Reduced x to positive by atanh(-x) = -atanh(x)
+ * 2.For x>=0.5
+ * 1 2x x
+ * atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
+ * 2 1 - x 1 - x
+ *
+ * For x<0.5
+ * atanh(x) = 0.5*log1p(2x+2x*x/(1-x))
+ *
+ * Special cases:
+ * atanh(x) is NaN if |x| > 1 with signal;
+ * atanh(NaN) is that NaN with no signal;
+ * atanh(+-1) is +-INF with signal.
+ *
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double one = 1.0L, huge = 1e300L;
+#else
+static long double one = 1.0L, huge = 1e300L;
+#endif
+
+#ifdef __STDC__
+static const long double zero = 0.0L;
+#else
+static long double zero = 0.0L;
+#endif
+
+#ifdef __STDC__
+ long double __ieee754_atanhl(long double x)
+#else
+ long double __ieee754_atanhl(x)
+ long double x;
+#endif
+{
+ long double t;
+ int64_t hx,ix;
+ u_int64_t lx;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ ix = hx&0x7fffffffffffffffLL;
+ if (ix >= 0x3ff0000000000000LL) { /* |x|>=1 */
+ if (ix > 0x3ff0000000000000LL)
+ return (x-x)/(x-x);
+ t = fabsl (x);
+ if (t > one)
+ return (x-x)/(x-x);
+ if (t == one)
+ return x/zero;
+ }
+ if(ix<0x3e20000000000000LL&&(huge+x)>zero) return x; /* x<2**-29 */
+ x = fabsl (x);
+ if(ix<0x3fe0000000000000LL) { /* x < 0.5 */
+ t = x+x;
+ t = 0.5*__log1pl(t+t*x/(one-x));
+ } else
+ t = 0.5*__log1pl((x+x)/(one-x));
+ if(hx>=0) return t; else return -t;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_coshl.c b/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
new file mode 100644
index 0000000000..73cb47892f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
@@ -0,0 +1,90 @@
+/* @(#)e_cosh.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $";
+#endif
+
+/* __ieee754_cosh(x)
+ * Method :
+ * mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2
+ * 1. Replace x by |x| (cosh(x) = cosh(-x)).
+ * 2.
+ * [ exp(x) - 1 ]^2
+ * 0 <= x <= ln2/2 : cosh(x) := 1 + -------------------
+ * 2*exp(x)
+ *
+ * exp(x) + 1/exp(x)
+ * ln2/2 <= x <= 22 : cosh(x) := -------------------
+ * 2
+ * 22 <= x <= lnovft : cosh(x) := exp(x)/2
+ * lnovft <= x <= ln2ovft: cosh(x) := exp(x/2)/2 * exp(x/2)
+ * ln2ovft < x : cosh(x) := huge*huge (overflow)
+ *
+ * Special cases:
+ * cosh(x) is |x| if x is +INF, -INF, or NaN.
+ * only cosh(0)=1 is exact for finite x.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double one = 1.0L, half=0.5L, huge = 1.0e300L;
+#else
+static long double one = 1.0L, half=0.5L, huge = 1.0e300L;
+#endif
+
+#ifdef __STDC__
+ long double __ieee754_coshl(long double x)
+#else
+ long double __ieee754_coshl(x)
+ long double x;
+#endif
+{
+ long double t,w;
+ int64_t ix;
+
+ /* High word of |x|. */
+ GET_LDOUBLE_MSW64(ix,x);
+ ix &= 0x7fffffffffffffffLL;
+
+ /* x is INF or NaN */
+ if(ix>=0x7ff0000000000000LL) return x*x;
+
+ /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */
+ if(ix<0x3fd62e42fefa39efLL) {
+ t = __expm1l(fabsl(x));
+ w = one+t;
+ if (ix<0x3c80000000000000LL) return w; /* cosh(tiny) = 1 */
+ return one+(t*t)/(w+w);
+ }
+
+ /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
+ if (ix < 0x4036000000000000LL) {
+ t = __ieee754_expl(fabsl(x));
+ return half*t+half/t;
+ }
+
+ /* |x| in [22, log(maxdouble)] return half*exp(|x|) */
+ if (ix < 0x40862e42fefa39efLL) return half*__ieee754_expl(fabsl(x));
+
+ /* |x| in [log(maxdouble), overflowthresold] */
+ if (ix < 0x408633ce8fb9f87dLL) {
+ w = __ieee754_expl(half*fabsl(x));
+ t = half*w;
+ return t*w;
+ }
+
+ /* |x| > overflowthresold, cosh(x) overflow */
+ return huge*huge;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_expl.c b/sysdeps/ieee754/ldbl-128ibm/e_expl.c
new file mode 100644
index 0000000000..3c4088f75f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_expl.c
@@ -0,0 +1,257 @@
+/* Quad-precision floating point e^x.
+ Copyright (C) 1999,2004,2006 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
+ by Geoffrey Keating <geoffk@ozemail.com.au>
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* The basic design here is from
+ Abraham Ziv, "Fast Evaluation of Elementary Mathematical Functions with
+ Correctly Rounded Last Bit", ACM Trans. Math. Soft., 17 (3), September 1991,
+ pp. 410-423.
+
+ We work with number pairs where the first number is the high part and
+ the second one is the low part. Arithmetic with the high part numbers must
+ be exact, without any roundoff errors.
+
+ The input value, X, is written as
+ X = n * ln(2)_0 + arg1[t1]_0 + arg2[t2]_0 + x
+ - n * ln(2)_1 + arg1[t1]_1 + arg2[t2]_1 + xl
+
+ where:
+ - n is an integer, 16384 >= n >= -16495;
+ - ln(2)_0 is the first 93 bits of ln(2), and |ln(2)_0-ln(2)-ln(2)_1| < 2^-205
+ - t1 is an integer, 89 >= t1 >= -89
+ - t2 is an integer, 65 >= t2 >= -65
+ - |arg1[t1]-t1/256.0| < 2^-53
+ - |arg2[t2]-t2/32768.0| < 2^-53
+ - x + xl is whatever is left, |x + xl| < 2^-16 + 2^-53
+
+ Then e^x is approximated as
+
+ e^x = 2^n_1 ( 2^n_0 e^(arg1[t1]_0 + arg1[t1]_1) e^(arg2[t2]_0 + arg2[t2]_1)
+ + 2^n_0 e^(arg1[t1]_0 + arg1[t1]_1) e^(arg2[t2]_0 + arg2[t2]_1)
+ * p (x + xl + n * ln(2)_1))
+ where:
+ - p(x) is a polynomial approximating e(x)-1
+ - e^(arg1[t1]_0 + arg1[t1]_1) is obtained from a table
+ - e^(arg2[t2]_0 + arg2[t2]_1) likewise
+ - n_1 + n_0 = n, so that |n_0| < -LDBL_MIN_EXP-1.
+
+ If it happens that n_1 == 0 (this is the usual case), that multiplication
+ is omitted.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <float.h>
+#include <ieee754.h>
+#include <math.h>
+#include <fenv.h>
+#include <inttypes.h>
+#include <math_private.h>
+#include <sysdeps/ieee754/ldbl-128/t_expl.h>
+
+static const long double C[] = {
+/* Smallest integer x for which e^x overflows. */
+#define himark C[0]
+ 709.08956571282405153382846025171462914L,
+
+/* Largest integer x for which e^x underflows. */
+#define lomark C[1]
+-709.08956571282405153382846025171462914L,
+
+/* 3x2^96 */
+#define THREEp96 C[2]
+ 59421121885698253195157962752.0L,
+
+/* 3x2^103 */
+#define THREEp103 C[3]
+ 30423614405477505635920876929024.0L,
+
+/* 3x2^111 */
+#define THREEp111 C[4]
+ 7788445287802241442795744493830144.0L,
+
+/* 1/ln(2) */
+#define M_1_LN2 C[5]
+ 1.44269504088896340735992468100189204L,
+
+/* first 93 bits of ln(2) */
+#define M_LN2_0 C[6]
+ 0.693147180559945309417232121457981864L,
+
+/* ln2_0 - ln(2) */
+#define M_LN2_1 C[7]
+-1.94704509238074995158795957333327386E-31L,
+
+/* very small number */
+#define TINY C[8]
+ 1.0e-308L,
+
+/* 2^16383 */
+#define TWO1023 C[9]
+ 8.988465674311579538646525953945123668E+307L,
+
+/* 256 */
+#define TWO8 C[10]
+ 256.0L,
+
+/* 32768 */
+#define TWO15 C[11]
+ 32768.0L,
+
+/* Chebyshev polynom coeficients for (exp(x)-1)/x */
+#define P1 C[12]
+#define P2 C[13]
+#define P3 C[14]
+#define P4 C[15]
+#define P5 C[16]
+#define P6 C[17]
+ 0.5L,
+ 1.66666666666666666666666666666666683E-01L,
+ 4.16666666666666666666654902320001674E-02L,
+ 8.33333333333333333333314659767198461E-03L,
+ 1.38888888889899438565058018857254025E-03L,
+ 1.98412698413981650382436541785404286E-04L,
+};
+
+long double
+__ieee754_expl (long double x)
+{
+ /* Check for usual case. */
+ if (isless (x, himark) && isgreater (x, lomark))
+ {
+ int tval1, tval2, unsafe, n_i, exponent2;
+ long double x22, n, result, xl;
+ union ibm_extended_long_double ex2_u, scale_u;
+ fenv_t oldenv;
+
+ feholdexcept (&oldenv);
+#ifdef FE_TONEAREST
+ fesetround (FE_TONEAREST);
+#endif
+
+ n = roundl(x*M_1_LN2);
+ x = x-n*M_LN2_0;
+ xl = n*M_LN2_1;
+
+ tval1 = roundl(x*TWO8);
+ x -= __expl_table[T_EXPL_ARG1+2*tval1];
+ xl -= __expl_table[T_EXPL_ARG1+2*tval1+1];
+
+ tval2 = roundl(x*TWO15);
+ x -= __expl_table[T_EXPL_ARG2+2*tval2];
+ xl -= __expl_table[T_EXPL_ARG2+2*tval2+1];
+
+ x = x + xl;
+
+ /* Compute ex2 = 2^n_0 e^(argtable[tval1]) e^(argtable[tval2]). */
+ ex2_u.d = __expl_table[T_EXPL_RES1 + tval1]
+ * __expl_table[T_EXPL_RES2 + tval2];
+ n_i = (int)n;
+ /* 'unsafe' is 1 iff n_1 != 0. */
+ unsafe = fabsl(n_i) >= -LDBL_MIN_EXP - 1;
+ ex2_u.ieee.exponent += n_i >> unsafe;
+ /* Fortunately, there are no subnormal lowpart doubles in
+ __expl_table, only normal values and zeros.
+ But after scaling it can be subnormal. */
+ exponent2 = ex2_u.ieee.exponent2 + (n_i >> unsafe);
+ if (ex2_u.ieee.exponent2 == 0)
+ /* assert ((ex2_u.ieee.mantissa2|ex2_u.ieee.mantissa3) == 0) */;
+ else if (exponent2 > 0)
+ ex2_u.ieee.exponent2 = exponent2;
+ else if (exponent2 <= -54)
+ {
+ ex2_u.ieee.exponent2 = 0;
+ ex2_u.ieee.mantissa2 = 0;
+ ex2_u.ieee.mantissa3 = 0;
+ }
+ else
+ {
+ static const double
+ two54 = 1.80143985094819840000e+16, /* 4350000000000000 */
+ twom54 = 5.55111512312578270212e-17; /* 3C90000000000000 */
+ ex2_u.dd[1] *= two54;
+ ex2_u.ieee.exponent2 += n_i >> unsafe;
+ ex2_u.dd[1] *= twom54;
+ }
+
+ /* Compute scale = 2^n_1. */
+ scale_u.d = 1.0L;
+ scale_u.ieee.exponent += n_i - (n_i >> unsafe);
+
+ /* Approximate e^x2 - 1, using a seventh-degree polynomial,
+ with maximum error in [-2^-16-2^-53,2^-16+2^-53]
+ less than 4.8e-39. */
+ x22 = x + x*x*(P1+x*(P2+x*(P3+x*(P4+x*(P5+x*P6)))));
+
+ /* Return result. */
+ fesetenv (&oldenv);
+
+ result = x22 * ex2_u.d + ex2_u.d;
+
+ /* Now we can test whether the result is ultimate or if we are unsure.
+ In the later case we should probably call a mpn based routine to give
+ the ultimate result.
+ Empirically, this routine is already ultimate in about 99.9986% of
+ cases, the test below for the round to nearest case will be false
+ in ~ 99.9963% of cases.
+ Without proc2 routine maximum error which has been seen is
+ 0.5000262 ulp.
+
+ union ieee854_long_double ex3_u;
+
+ #ifdef FE_TONEAREST
+ fesetround (FE_TONEAREST);
+ #endif
+ ex3_u.d = (result - ex2_u.d) - x22 * ex2_u.d;
+ ex2_u.d = result;
+ ex3_u.ieee.exponent += LDBL_MANT_DIG + 15 + IEEE854_LONG_DOUBLE_BIAS
+ - ex2_u.ieee.exponent;
+ n_i = abs (ex3_u.d);
+ n_i = (n_i + 1) / 2;
+ fesetenv (&oldenv);
+ #ifdef FE_TONEAREST
+ if (fegetround () == FE_TONEAREST)
+ n_i -= 0x4000;
+ #endif
+ if (!n_i) {
+ return __ieee754_expl_proc2 (origx);
+ }
+ */
+ if (!unsafe)
+ return result;
+ else
+ return result * scale_u.d;
+ }
+ /* Exceptional cases: */
+ else if (isless (x, himark))
+ {
+ if (__isinfl (x))
+ /* e^-inf == 0, with no error. */
+ return 0;
+ else
+ /* Underflow */
+ return TINY * TINY;
+ }
+ else
+ /* Return x, if x is a NaN or Inf; or overflow, otherwise. */
+ return TWO1023*x;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
new file mode 100644
index 0000000000..96668735b1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
@@ -0,0 +1,145 @@
+/* e_fmodl.c -- long double version of e_fmod.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * __ieee754_fmodl(x,y)
+ * Return x mod y in exact arithmetic
+ * Method: shift and subtract
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <ieee754.h>
+
+#ifdef __STDC__
+static const long double one = 1.0, Zero[] = {0.0, -0.0,};
+#else
+static long double one = 1.0, Zero[] = {0.0, -0.0,};
+#endif
+
+#ifdef __STDC__
+ long double __ieee754_fmodl(long double x, long double y)
+#else
+ long double __ieee754_fmodl(x,y)
+ long double x,y;
+#endif
+{
+ int64_t n,hx,hy,hz,ix,iy,sx,i;
+ u_int64_t lx,ly,lz;
+ int temp;
+
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ GET_LDOUBLE_WORDS64(hy,ly,y);
+ sx = hx&0x8000000000000000ULL; /* sign of x */
+ hx ^=sx; /* |x| */
+ hy &= 0x7fffffffffffffffLL; /* |y| */
+
+ /* purge off exception values */
+ if((hy|(ly&0x7fffffffffffffff))==0||(hx>=0x7ff0000000000000LL)|| /* y=0,or x not finite */
+ (hy>0x7ff0000000000000LL)) /* or y is NaN */
+ return (x*y)/(x*y);
+ if(hx<=hy) {
+ if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */
+ if(lx==ly)
+ return Zero[(u_int64_t)sx>>63]; /* |x|=|y| return x*0*/
+ }
+
+ /* determine ix = ilogb(x) */
+ if(hx<0x0010000000000000LL) { /* subnormal x */
+ if(hx==0) {
+ for (ix = -1043, i=lx; i>0; i<<=1) ix -=1;
+ } else {
+ for (ix = -1022, i=hx<<19; i>0; i<<=1) ix -=1;
+ }
+ } else ix = (hx>>52)-0x3ff;
+
+ /* determine iy = ilogb(y) */
+ if(hy<0x0010000000000000LL) { /* subnormal y */
+ if(hy==0) {
+ for (iy = -1043, i=ly; i>0; i<<=1) iy -=1;
+ } else {
+ for (iy = -1022, i=hy<<19; i>0; i<<=1) iy -=1;
+ }
+ } else iy = (hy>>52)-0x3ff;
+
+ /* Make the IBM extended format 105 bit mantissa look like the ieee854 112
+ bit mantissa so the following operatations will give the correct
+ result. */
+ EXTRACT_IBM_EXTENDED_MANTISSA(hx, lx, temp, x);
+ EXTRACT_IBM_EXTENDED_MANTISSA(hy, ly, temp, y);
+
+ /* set up {hx,lx}, {hy,ly} and align y to x */
+ if(ix >= -1022)
+ hx = 0x0001000000000000LL|(0x0000ffffffffffffLL&hx);
+ else { /* subnormal x, shift x to normal */
+ n = -1022-ix;
+ if(n<=63) {
+ hx = (hx<<n)|(lx>>(64-n));
+ lx <<= n;
+ } else {
+ hx = lx<<(n-64);
+ lx = 0;
+ }
+ }
+ if(iy >= -1022)
+ hy = 0x0001000000000000LL|(0x0000ffffffffffffLL&hy);
+ else { /* subnormal y, shift y to normal */
+ n = -1022-iy;
+ if(n<=63) {
+ hy = (hy<<n)|(ly>>(64-n));
+ ly <<= n;
+ } else {
+ hy = ly<<(n-64);
+ ly = 0;
+ }
+ }
+
+ /* fix point fmod */
+ n = ix - iy;
+ while(n--) {
+ hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
+ if(hz<0){hx = hx+hx+(lx>>63); lx = lx+lx;}
+ else {
+ if((hz|(lz&0x7fffffffffffffff))==0) /* return sign(x)*0 */
+ return Zero[(u_int64_t)sx>>63];
+ hx = hz+hz+(lz>>63); lx = lz+lz;
+ }
+ }
+ hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
+ if(hz>=0) {hx=hz;lx=lz;}
+
+ /* convert back to floating value and restore the sign */
+ if((hx|(lx&0x7fffffffffffffff))==0) /* return sign(x)*0 */
+ return Zero[(u_int64_t)sx>>63];
+ while(hx<0x0001000000000000LL) { /* normalize x */
+ hx = hx+hx+(lx>>63); lx = lx+lx;
+ iy -= 1;
+ }
+ if(iy>= -1022) { /* normalize output */
+ INSERT_IBM_EXTENDED_MANTISSA(x, (sx>>63), iy, hx, lx);
+ } else { /* subnormal output */
+ n = -1022 - iy;
+ if(n<=48) {
+ lx = (lx>>n)|((u_int64_t)hx<<(64-n));
+ hx >>= n;
+ } else if (n<=63) {
+ lx = (hx<<(64-n))|(lx>>n); hx = sx;
+ } else {
+ lx = hx>>(n-64); hx = sx;
+ }
+ INSERT_IBM_EXTENDED_MANTISSA(x, (sx>>63), iy, hx, lx);
+ x *= one; /* create necessary signal */
+ }
+ return x; /* exact output */
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c b/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
new file mode 100644
index 0000000000..03bcb2129a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
@@ -0,0 +1,58 @@
+/* Implementation of gamma function according to ISO C.
+ Copyright (C) 1997,1999,2002,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+ Jakub Jelinek <jj@ultra.linux.cz, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <math_private.h>
+
+
+long double
+__ieee754_gammal_r (long double x, int *signgamp)
+{
+ /* We don't have a real gamma implementation now. We'll use lgamma
+ and the exp function. But due to the required boundary
+ conditions we must check some values separately. */
+ int64_t hx;
+ u_int64_t lx;
+
+ GET_LDOUBLE_WORDS64 (hx, lx, x);
+
+ if (((hx | lx) & 0x7fffffffffffffffLL) == 0)
+ {
+ /* Return value for x == 0 is Inf with divide by zero exception. */
+ *signgamp = 0;
+ return 1.0 / x;
+ }
+ if (hx < 0 && (u_int64_t) hx < 0xfff0000000000000ULL && __rintl (x) == x)
+ {
+ /* Return value for integer x < 0 is NaN with invalid exception. */
+ *signgamp = 0;
+ return (x - x) / (x - x);
+ }
+ if (hx == 0xfff0000000000000ULL)
+ {
+ /* x == -Inf. According to ISO this is NaN. */
+ *signgamp = 0;
+ return x - x;
+ }
+
+ /* XXX FIXME. */
+ return __ieee754_expl (__ieee754_lgammal_r (x, signgamp));
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c b/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
new file mode 100644
index 0000000000..4330f28b93
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
@@ -0,0 +1,131 @@
+/* @(#)e_hypotl.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
+#endif
+
+/* __ieee754_hypotl(x,y)
+ *
+ * Method :
+ * If (assume round-to-nearest) z=x*x+y*y
+ * has error less than sqrtl(2)/2 ulp, than
+ * sqrtl(z) has error less than 1 ulp (exercise).
+ *
+ * So, compute sqrtl(x*x+y*y) with some care as
+ * follows to get the error below 1 ulp:
+ *
+ * Assume x>y>0;
+ * (if possible, set rounding to round-to-nearest)
+ * 1. if x > 2y use
+ * x1*x1+(y*y+(x2*(x+x1))) for x*x+y*y
+ * where x1 = x with lower 53 bits cleared, x2 = x-x1; else
+ * 2. if x <= 2y use
+ * t1*y1+((x-y)*(x-y)+(t1*y2+t2*y))
+ * where t1 = 2x with lower 53 bits cleared, t2 = 2x-t1,
+ * y1= y with lower 53 bits chopped, y2 = y-y1.
+ *
+ * NOTE: scaling may be necessary if some argument is too
+ * large or too tiny
+ *
+ * Special cases:
+ * hypotl(x,y) is INF if x or y is +INF or -INF; else
+ * hypotl(x,y) is NAN if x or y is NAN.
+ *
+ * Accuracy:
+ * hypotl(x,y) returns sqrtl(x^2+y^2) with error less
+ * than 1 ulps (units in the last place)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double two600 = 0x1.0p+600L;
+static const long double two1022 = 0x1.0p+1022L;
+
+#ifdef __STDC__
+ long double __ieee754_hypotl(long double x, long double y)
+#else
+ long double __ieee754_hypotl(x,y)
+ long double x, y;
+#endif
+{
+ long double a,b,t1,t2,y1,y2,w,kld;
+ int64_t j,k,ha,hb;
+
+ GET_LDOUBLE_MSW64(ha,x);
+ ha &= 0x7fffffffffffffffLL;
+ GET_LDOUBLE_MSW64(hb,y);
+ hb &= 0x7fffffffffffffffLL;
+ if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;}
+ a = fabsl(a); /* a <- |a| */
+ b = fabsl(b); /* b <- |b| */
+ if((ha-hb)>0x3c0000000000000LL) {return a+b;} /* x/y > 2**60 */
+ k=0;
+ kld = 1.0L;
+ if(ha > 0x5f30000000000000LL) { /* a>2**500 */
+ if(ha >= 0x7ff0000000000000LL) { /* Inf or NaN */
+ u_int64_t low;
+ w = a+b; /* for sNaN */
+ GET_LDOUBLE_LSW64(low,a);
+ if(((ha&0xfffffffffffffLL)|(low&0x7fffffffffffffffLL))==0)
+ w = a;
+ GET_LDOUBLE_LSW64(low,b);
+ if(((hb^0x7ff0000000000000LL)|(low&0x7fffffffffffffffLL))==0)
+ w = b;
+ return w;
+ }
+ /* scale a and b by 2**-600 */
+ ha -= 0x2580000000000000LL; hb -= 0x2580000000000000LL; k += 600;
+ a /= two600;
+ b /= two600;
+ k += 600;
+ kld = two600;
+ }
+ if(hb < 0x20b0000000000000LL) { /* b < 2**-500 */
+ if(hb <= 0x000fffffffffffffLL) { /* subnormal b or 0 */
+ u_int64_t low;
+ GET_LDOUBLE_LSW64(low,b);
+ if((hb|(low&0x7fffffffffffffffLL))==0) return a;
+ t1=two1022; /* t1=2^1022 */
+ b *= t1;
+ a *= t1;
+ k -= 1022;
+ kld = kld / two1022;
+ } else { /* scale a and b by 2^600 */
+ ha += 0x2580000000000000LL; /* a *= 2^600 */
+ hb += 0x2580000000000000LL; /* b *= 2^600 */
+ k -= 600;
+ a *= two600;
+ b *= two600;
+ kld = kld / two600;
+ }
+ }
+ /* medium size a and b */
+ w = a-b;
+ if (w>b) {
+ SET_LDOUBLE_WORDS64(t1,ha,0);
+ t2 = a-t1;
+ w = __ieee754_sqrtl(t1*t1-(b*(-b)-t2*(a+t1)));
+ } else {
+ a = a+a;
+ SET_LDOUBLE_WORDS64(y1,hb,0);
+ y2 = b - y1;
+ SET_LDOUBLE_WORDS64(t1,ha+0x0010000000000000LL,0);
+ t2 = a - t1;
+ w = __ieee754_sqrtl(t1*y1-(w*(-w)-(t1*y2+t2*b)));
+ }
+ if(k!=0)
+ return w*kld;
+ else
+ return w;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_j0l.c b/sysdeps/ieee754/ldbl-128ibm/e_j0l.c
new file mode 100644
index 0000000000..39a238aa9b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_j0l.c
@@ -0,0 +1,3 @@
+/* Looks like we can use ieee854 e_j0l.c as is for IBM extended format. */
+#include <sysdeps/ieee754/ldbl-128/e_j0l.c>
+
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_j1l.c b/sysdeps/ieee754/ldbl-128ibm/e_j1l.c
new file mode 100644
index 0000000000..c86e24f7c0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_j1l.c
@@ -0,0 +1,2 @@
+/* Looks like we can use ieee854 e_j1l.c as is for IBM extended format. */
+#include <sysdeps/ieee754/ldbl-128/e_j1l.c>
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_jnl.c b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
new file mode 100644
index 0000000000..0eea745676
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
@@ -0,0 +1,402 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* Modifications for 128-bit long double are
+ Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under
+ the following terms:
+
+ This 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.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/*
+ * __ieee754_jn(n, x), __ieee754_yn(n, x)
+ * floating point Bessel's function of the 1st and 2nd kind
+ * of order n
+ *
+ * Special cases:
+ * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
+ * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
+ * Note 2. About jn(n,x), yn(n,x)
+ * For n=0, j0(x) is called,
+ * for n=1, j1(x) is called,
+ * for n<x, forward recursion us used starting
+ * from values of j0(x) and j1(x).
+ * for n>x, a continued fraction approximation to
+ * j(n,x)/j(n-1,x) is evaluated and then backward
+ * recursion is used starting from a supposed value
+ * for j(n,x). The resulting value of j(0,x) is
+ * compared with the actual value to correct the
+ * supposed value of j(n,x).
+ *
+ * yn(n,x) is similar in all respects, except
+ * that forward recursion is used for all
+ * values of n>1.
+ *
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+ invsqrtpi = 5.6418958354775628694807945156077258584405E-1L,
+ two = 2.0e0L,
+ one = 1.0e0L,
+ zero = 0.0L;
+
+
+#ifdef __STDC__
+long double
+__ieee754_jnl (int n, long double x)
+#else
+long double
+__ieee754_jnl (n, x)
+ int n;
+ long double x;
+#endif
+{
+ u_int32_t se;
+ int32_t i, ix, sgn;
+ long double a, b, temp, di;
+ long double z, w;
+ ieee854_long_double_shape_type u;
+
+
+ /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
+ * Thus, J(-n,x) = J(n,-x)
+ */
+
+ u.value = x;
+ se = u.parts32.w0;
+ ix = se & 0x7fffffff;
+
+ /* if J(n,NaN) is NaN */
+ if (ix >= 0x7ff00000)
+ {
+ if ((u.parts32.w0 & 0xfffff) | u.parts32.w1
+ | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3)
+ return x + x;
+ }
+
+ if (n < 0)
+ {
+ n = -n;
+ x = -x;
+ se ^= 0x80000000;
+ }
+ if (n == 0)
+ return (__ieee754_j0l (x));
+ if (n == 1)
+ return (__ieee754_j1l (x));
+ sgn = (n & 1) & (se >> 31); /* even n -- 0, odd n -- sign(x) */
+ x = fabsl (x);
+
+ if (x == 0.0L || ix >= 0x7ff00000) /* if x is 0 or inf */
+ b = zero;
+ else if ((long double) n <= x)
+ {
+ /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */
+ if (ix >= 0x52d00000)
+ { /* x > 2**302 */
+
+ /* ??? Could use an expansion for large x here. */
+
+ /* (x >> n**2)
+ * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
+ * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
+ * Let s=sin(x), c=cos(x),
+ * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then
+ *
+ * n sin(xn)*sqt2 cos(xn)*sqt2
+ * ----------------------------------
+ * 0 s-c c+s
+ * 1 -s-c -c+s
+ * 2 -s+c -c-s
+ * 3 s+c c-s
+ */
+ long double s;
+ long double c;
+ __sincosl (x, &s, &c);
+ switch (n & 3)
+ {
+ case 0:
+ temp = c + s;
+ break;
+ case 1:
+ temp = -c + s;
+ break;
+ case 2:
+ temp = -c - s;
+ break;
+ case 3:
+ temp = c - s;
+ break;
+ }
+ b = invsqrtpi * temp / __ieee754_sqrtl (x);
+ }
+ else
+ {
+ a = __ieee754_j0l (x);
+ b = __ieee754_j1l (x);
+ for (i = 1; i < n; i++)
+ {
+ temp = b;
+ b = b * ((long double) (i + i) / x) - a; /* avoid underflow */
+ a = temp;
+ }
+ }
+ }
+ else
+ {
+ if (ix < 0x3e100000)
+ { /* x < 2**-29 */
+ /* x is tiny, return the first Taylor expansion of J(n,x)
+ * J(n,x) = 1/n!*(x/2)^n - ...
+ */
+ if (n >= 33) /* underflow, result < 10^-300 */
+ b = zero;
+ else
+ {
+ temp = x * 0.5;
+ b = temp;
+ for (a = one, i = 2; i <= n; i++)
+ {
+ a *= (long double) i; /* a = n! */
+ b *= temp; /* b = (x/2)^n */
+ }
+ b = b / a;
+ }
+ }
+ else
+ {
+ /* use backward recurrence */
+ /* x x^2 x^2
+ * J(n,x)/J(n-1,x) = ---- ------ ------ .....
+ * 2n - 2(n+1) - 2(n+2)
+ *
+ * 1 1 1
+ * (for large x) = ---- ------ ------ .....
+ * 2n 2(n+1) 2(n+2)
+ * -- - ------ - ------ -
+ * x x x
+ *
+ * Let w = 2n/x and h=2/x, then the above quotient
+ * is equal to the continued fraction:
+ * 1
+ * = -----------------------
+ * 1
+ * w - -----------------
+ * 1
+ * w+h - ---------
+ * w+2h - ...
+ *
+ * To determine how many terms needed, let
+ * Q(0) = w, Q(1) = w(w+h) - 1,
+ * Q(k) = (w+k*h)*Q(k-1) - Q(k-2),
+ * When Q(k) > 1e4 good for single
+ * When Q(k) > 1e9 good for double
+ * When Q(k) > 1e17 good for quadruple
+ */
+ /* determine k */
+ long double t, v;
+ long double q0, q1, h, tmp;
+ int32_t k, m;
+ w = (n + n) / (long double) x;
+ h = 2.0L / (long double) x;
+ q0 = w;
+ z = w + h;
+ q1 = w * z - 1.0L;
+ k = 1;
+ while (q1 < 1.0e17L)
+ {
+ k += 1;
+ z += h;
+ tmp = z * q1 - q0;
+ q0 = q1;
+ q1 = tmp;
+ }
+ m = n + n;
+ for (t = zero, i = 2 * (n + k); i >= m; i -= 2)
+ t = one / (i / x - t);
+ a = t;
+ b = one;
+ /* estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n)
+ * Hence, if n*(log(2n/x)) > ...
+ * single 8.8722839355e+01
+ * double 7.09782712893383973096e+02
+ * long double 1.1356523406294143949491931077970765006170e+04
+ * then recurrent value may overflow and the result is
+ * likely underflow to zero
+ */
+ tmp = n;
+ v = two / x;
+ tmp = tmp * __ieee754_logl (fabsl (v * tmp));
+
+ if (tmp < 1.1356523406294143949491931077970765006170e+04L)
+ {
+ for (i = n - 1, di = (long double) (i + i); i > 0; i--)
+ {
+ temp = b;
+ b *= di;
+ b = b / x - a;
+ a = temp;
+ di -= two;
+ }
+ }
+ else
+ {
+ for (i = n - 1, di = (long double) (i + i); i > 0; i--)
+ {
+ temp = b;
+ b *= di;
+ b = b / x - a;
+ a = temp;
+ di -= two;
+ /* scale b to avoid spurious overflow */
+ if (b > 1e100L)
+ {
+ a /= b;
+ t /= b;
+ b = one;
+ }
+ }
+ }
+ b = (t * __ieee754_j0l (x) / b);
+ }
+ }
+ if (sgn == 1)
+ return -b;
+ else
+ return b;
+}
+
+#ifdef __STDC__
+long double
+__ieee754_ynl (int n, long double x)
+#else
+long double
+__ieee754_ynl (n, x)
+ int n;
+ long double x;
+#endif
+{
+ u_int32_t se;
+ int32_t i, ix;
+ int32_t sign;
+ long double a, b, temp;
+ ieee854_long_double_shape_type u;
+
+ u.value = x;
+ se = u.parts32.w0;
+ ix = se & 0x7fffffff;
+
+ /* if Y(n,NaN) is NaN */
+ if (ix >= 0x7ff00000)
+ {
+ if ((u.parts32.w0 & 0xfffff) | u.parts32.w1
+ | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3)
+ return x + x;
+ }
+ if (x <= 0.0L)
+ {
+ if (x == 0.0L)
+ return -HUGE_VALL + x;
+ if (se & 0x80000000)
+ return zero / (zero * x);
+ }
+ sign = 1;
+ if (n < 0)
+ {
+ n = -n;
+ sign = 1 - ((n & 1) << 1);
+ }
+ if (n == 0)
+ return (__ieee754_y0l (x));
+ if (n == 1)
+ return (sign * __ieee754_y1l (x));
+ if (ix >= 0x7ff00000)
+ return zero;
+ if (ix >= 0x52D00000)
+ { /* x > 2**302 */
+
+ /* ??? See comment above on the possible futility of this. */
+
+ /* (x >> n**2)
+ * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
+ * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
+ * Let s=sin(x), c=cos(x),
+ * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then
+ *
+ * n sin(xn)*sqt2 cos(xn)*sqt2
+ * ----------------------------------
+ * 0 s-c c+s
+ * 1 -s-c -c+s
+ * 2 -s+c -c-s
+ * 3 s+c c-s
+ */
+ long double s;
+ long double c;
+ __sincosl (x, &s, &c);
+ switch (n & 3)
+ {
+ case 0:
+ temp = s - c;
+ break;
+ case 1:
+ temp = -s - c;
+ break;
+ case 2:
+ temp = -s + c;
+ break;
+ case 3:
+ temp = s + c;
+ break;
+ }
+ b = invsqrtpi * temp / __ieee754_sqrtl (x);
+ }
+ else
+ {
+ a = __ieee754_y0l (x);
+ b = __ieee754_y1l (x);
+ /* quit if b is -inf */
+ u.value = b;
+ se = u.parts32.w0 & 0xfff00000;
+ for (i = 1; i < n && se != 0xfff00000; i++)
+ {
+ temp = b;
+ b = ((long double) (i + i) / x) * b - a;
+ u.value = b;
+ se = u.parts32.w0 & 0xfff00000;
+ a = temp;
+ }
+ }
+ if (sign > 0)
+ return b;
+ else
+ return -b;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c
new file mode 100644
index 0000000000..9bcaaf765a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c
@@ -0,0 +1,3 @@
+/* Looks like we can use ieee854 e_lgammal_r.c as is for IBM extended format. */
+#include <sysdeps/ieee754/ldbl-128/e_lgammal_r.c>
+
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_log10l.c b/sysdeps/ieee754/ldbl-128ibm/e_log10l.c
new file mode 100644
index 0000000000..27e2c71b8d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_log10l.c
@@ -0,0 +1,258 @@
+/* log10l.c
+ *
+ * Common logarithm, 128-bit long double precision
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, log10l();
+ *
+ * y = log10l( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns the base 10 logarithm of x.
+ *
+ * The argument is separated into its exponent and fractional
+ * parts. If the exponent is between -1 and +1, the logarithm
+ * of the fraction is approximated by
+ *
+ * log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x).
+ *
+ * Otherwise, setting z = 2(x-1)/x+1),
+ *
+ * log(x) = z + z^3 P(z)/Q(z).
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ * Relative error:
+ * arithmetic domain # trials peak rms
+ * IEEE 0.5, 2.0 30000 2.3e-34 4.9e-35
+ * IEEE exp(+-10000) 30000 1.0e-34 4.1e-35
+ *
+ * In the tests over the interval exp(+-10000), the logarithms
+ * of the random arguments were uniformly distributed over
+ * [-10000, +10000].
+ *
+ */
+
+/*
+ Cephes Math Library Release 2.2: January, 1991
+ Copyright 1984, 1991 by Stephen L. Moshier
+ Adapted for glibc November, 2001
+
+ This 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.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+/* Coefficients for ln(1+x) = x - x**2/2 + x**3 P(x)/Q(x)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 5.3e-37,
+ * relative peak error spread = 2.3e-14
+ */
+static const long double P[13] =
+{
+ 1.313572404063446165910279910527789794488E4L,
+ 7.771154681358524243729929227226708890930E4L,
+ 2.014652742082537582487669938141683759923E5L,
+ 3.007007295140399532324943111654767187848E5L,
+ 2.854829159639697837788887080758954924001E5L,
+ 1.797628303815655343403735250238293741397E5L,
+ 7.594356839258970405033155585486712125861E4L,
+ 2.128857716871515081352991964243375186031E4L,
+ 3.824952356185897735160588078446136783779E3L,
+ 4.114517881637811823002128927449878962058E2L,
+ 2.321125933898420063925789532045674660756E1L,
+ 4.998469661968096229986658302195402690910E-1L,
+ 1.538612243596254322971797716843006400388E-6L
+};
+static const long double Q[12] =
+{
+ 3.940717212190338497730839731583397586124E4L,
+ 2.626900195321832660448791748036714883242E5L,
+ 7.777690340007566932935753241556479363645E5L,
+ 1.347518538384329112529391120390701166528E6L,
+ 1.514882452993549494932585972882995548426E6L,
+ 1.158019977462989115839826904108208787040E6L,
+ 6.132189329546557743179177159925690841200E5L,
+ 2.248234257620569139969141618556349415120E5L,
+ 5.605842085972455027590989944010492125825E4L,
+ 9.147150349299596453976674231612674085381E3L,
+ 9.104928120962988414618126155557301584078E2L,
+ 4.839208193348159620282142911143429644326E1L
+/* 1.000000000000000000000000000000000000000E0L, */
+};
+
+/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2),
+ * where z = 2(x-1)/(x+1)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 1.1e-35,
+ * relative peak error spread 1.1e-9
+ */
+static const long double R[6] =
+{
+ 1.418134209872192732479751274970992665513E5L,
+ -8.977257995689735303686582344659576526998E4L,
+ 2.048819892795278657810231591630928516206E4L,
+ -2.024301798136027039250415126250455056397E3L,
+ 8.057002716646055371965756206836056074715E1L,
+ -8.828896441624934385266096344596648080902E-1L
+};
+static const long double S[6] =
+{
+ 1.701761051846631278975701529965589676574E6L,
+ -1.332535117259762928288745111081235577029E6L,
+ 4.001557694070773974936904547424676279307E5L,
+ -5.748542087379434595104154610899551484314E4L,
+ 3.998526750980007367835804959888064681098E3L,
+ -1.186359407982897997337150403816839480438E2L
+/* 1.000000000000000000000000000000000000000E0L, */
+};
+
+static const long double
+/* log10(2) */
+L102A = 0.3125L,
+L102B = -1.14700043360188047862611052755069732318101185E-2L,
+/* log10(e) */
+L10EA = 0.5L,
+L10EB = -6.570551809674817234887108108339491770560299E-2L,
+/* sqrt(2)/2 */
+SQRTH = 7.071067811865475244008443621048490392848359E-1L;
+
+
+
+/* Evaluate P[n] x^n + P[n-1] x^(n-1) + ... + P[0] */
+
+static long double
+neval (long double x, const long double *p, int n)
+{
+ long double y;
+
+ p += n;
+ y = *p--;
+ do
+ {
+ y = y * x + *p--;
+ }
+ while (--n > 0);
+ return y;
+}
+
+
+/* Evaluate x^n+1 + P[n] x^(n) + P[n-1] x^(n-1) + ... + P[0] */
+
+static long double
+deval (long double x, const long double *p, int n)
+{
+ long double y;
+
+ p += n;
+ y = x + *p--;
+ do
+ {
+ y = y * x + *p--;
+ }
+ while (--n > 0);
+ return y;
+}
+
+
+
+long double
+__ieee754_log10l (x)
+ long double x;
+{
+ long double z;
+ long double y;
+ int e;
+ int64_t hx, lx;
+
+/* Test for domain */
+ GET_LDOUBLE_WORDS64 (hx, lx, x);
+ if (((hx & 0x7fffffffffffffffLL) | (lx & 0x7fffffffffffffffLL)) == 0)
+ return (-1.0L / (x - x));
+ if (hx < 0)
+ return (x - x) / (x - x);
+ if (hx >= 0x7ff0000000000000LL)
+ return (x + x);
+
+/* separate mantissa from exponent */
+
+/* Note, frexp is used so that denormal numbers
+ * will be handled properly.
+ */
+ x = __frexpl (x, &e);
+
+
+/* logarithm using log(x) = z + z**3 P(z)/Q(z),
+ * where z = 2(x-1)/x+1)
+ */
+ if ((e > 2) || (e < -2))
+ {
+ if (x < SQRTH)
+ { /* 2( 2x-1 )/( 2x+1 ) */
+ e -= 1;
+ z = x - 0.5L;
+ y = 0.5L * z + 0.5L;
+ }
+ else
+ { /* 2 (x-1)/(x+1) */
+ z = x - 0.5L;
+ z -= 0.5L;
+ y = 0.5L * x + 0.5L;
+ }
+ x = z / y;
+ z = x * x;
+ y = x * (z * neval (z, R, 5) / deval (z, S, 5));
+ goto done;
+ }
+
+
+/* logarithm using log(1+x) = x - .5x**2 + x**3 P(x)/Q(x) */
+
+ if (x < SQRTH)
+ {
+ e -= 1;
+ x = 2.0 * x - 1.0L; /* 2x - 1 */
+ }
+ else
+ {
+ x = x - 1.0L;
+ }
+ z = x * x;
+ y = x * (z * neval (x, P, 12) / deval (x, Q, 11));
+ y = y - 0.5 * z;
+
+done:
+
+ /* Multiply log of fraction by log10(e)
+ * and base 2 exponent by log10(2).
+ */
+ z = y * L10EB;
+ z += x * L10EB;
+ z += e * L102B;
+ z += y * L10EA;
+ z += x * L10EA;
+ z += e * L102A;
+ return (z);
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_log2l.c b/sysdeps/ieee754/ldbl-128ibm/e_log2l.c
new file mode 100644
index 0000000000..fe8a8e1d6c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_log2l.c
@@ -0,0 +1,250 @@
+/* log2l.c
+ * Base 2 logarithm, 128-bit long double precision
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, log2l();
+ *
+ * y = log2l( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns the base 2 logarithm of x.
+ *
+ * The argument is separated into its exponent and fractional
+ * parts. If the exponent is between -1 and +1, the (natural)
+ * logarithm of the fraction is approximated by
+ *
+ * log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x).
+ *
+ * Otherwise, setting z = 2(x-1)/x+1),
+ *
+ * log(x) = z + z^3 P(z)/Q(z).
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ * Relative error:
+ * arithmetic domain # trials peak rms
+ * IEEE 0.5, 2.0 100,000 2.6e-34 4.9e-35
+ * IEEE exp(+-10000) 100,000 9.6e-35 4.0e-35
+ *
+ * In the tests over the interval exp(+-10000), the logarithms
+ * of the random arguments were uniformly distributed over
+ * [-10000, +10000].
+ *
+ */
+
+/*
+ Cephes Math Library Release 2.2: January, 1991
+ Copyright 1984, 1991 by Stephen L. Moshier
+ Adapted for glibc November, 2001
+
+ This 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.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+/* Coefficients for ln(1+x) = x - x**2/2 + x**3 P(x)/Q(x)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 5.3e-37,
+ * relative peak error spread = 2.3e-14
+ */
+static const long double P[13] =
+{
+ 1.313572404063446165910279910527789794488E4L,
+ 7.771154681358524243729929227226708890930E4L,
+ 2.014652742082537582487669938141683759923E5L,
+ 3.007007295140399532324943111654767187848E5L,
+ 2.854829159639697837788887080758954924001E5L,
+ 1.797628303815655343403735250238293741397E5L,
+ 7.594356839258970405033155585486712125861E4L,
+ 2.128857716871515081352991964243375186031E4L,
+ 3.824952356185897735160588078446136783779E3L,
+ 4.114517881637811823002128927449878962058E2L,
+ 2.321125933898420063925789532045674660756E1L,
+ 4.998469661968096229986658302195402690910E-1L,
+ 1.538612243596254322971797716843006400388E-6L
+};
+static const long double Q[12] =
+{
+ 3.940717212190338497730839731583397586124E4L,
+ 2.626900195321832660448791748036714883242E5L,
+ 7.777690340007566932935753241556479363645E5L,
+ 1.347518538384329112529391120390701166528E6L,
+ 1.514882452993549494932585972882995548426E6L,
+ 1.158019977462989115839826904108208787040E6L,
+ 6.132189329546557743179177159925690841200E5L,
+ 2.248234257620569139969141618556349415120E5L,
+ 5.605842085972455027590989944010492125825E4L,
+ 9.147150349299596453976674231612674085381E3L,
+ 9.104928120962988414618126155557301584078E2L,
+ 4.839208193348159620282142911143429644326E1L
+/* 1.000000000000000000000000000000000000000E0L, */
+};
+
+/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2),
+ * where z = 2(x-1)/(x+1)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 1.1e-35,
+ * relative peak error spread 1.1e-9
+ */
+static const long double R[6] =
+{
+ 1.418134209872192732479751274970992665513E5L,
+ -8.977257995689735303686582344659576526998E4L,
+ 2.048819892795278657810231591630928516206E4L,
+ -2.024301798136027039250415126250455056397E3L,
+ 8.057002716646055371965756206836056074715E1L,
+ -8.828896441624934385266096344596648080902E-1L
+};
+static const long double S[6] =
+{
+ 1.701761051846631278975701529965589676574E6L,
+ -1.332535117259762928288745111081235577029E6L,
+ 4.001557694070773974936904547424676279307E5L,
+ -5.748542087379434595104154610899551484314E4L,
+ 3.998526750980007367835804959888064681098E3L,
+ -1.186359407982897997337150403816839480438E2L
+/* 1.000000000000000000000000000000000000000E0L, */
+};
+
+static const long double
+/* log2(e) - 1 */
+LOG2EA = 4.4269504088896340735992468100189213742664595E-1L,
+/* sqrt(2)/2 */
+SQRTH = 7.071067811865475244008443621048490392848359E-1L;
+
+
+/* Evaluate P[n] x^n + P[n-1] x^(n-1) + ... + P[0] */
+
+static long double
+neval (long double x, const long double *p, int n)
+{
+ long double y;
+
+ p += n;
+ y = *p--;
+ do
+ {
+ y = y * x + *p--;
+ }
+ while (--n > 0);
+ return y;
+}
+
+
+/* Evaluate x^n+1 + P[n] x^(n) + P[n-1] x^(n-1) + ... + P[0] */
+
+static long double
+deval (long double x, const long double *p, int n)
+{
+ long double y;
+
+ p += n;
+ y = x + *p--;
+ do
+ {
+ y = y * x + *p--;
+ }
+ while (--n > 0);
+ return y;
+}
+
+
+
+long double
+__ieee754_log2l (x)
+ long double x;
+{
+ long double z;
+ long double y;
+ int e;
+ int64_t hx, lx;
+
+/* Test for domain */
+ GET_LDOUBLE_WORDS64 (hx, lx, x);
+ if (((hx & 0x7fffffffffffffffLL) | (lx & 0x7fffffffffffffffLL)) == 0)
+ return (-1.0L / (x - x));
+ if (hx < 0)
+ return (x - x) / (x - x);
+ if (hx >= 0x7ff0000000000000LL)
+ return (x + x);
+
+/* separate mantissa from exponent */
+
+/* Note, frexp is used so that denormal numbers
+ * will be handled properly.
+ */
+ x = __frexpl (x, &e);
+
+
+/* logarithm using log(x) = z + z**3 P(z)/Q(z),
+ * where z = 2(x-1)/x+1)
+ */
+ if ((e > 2) || (e < -2))
+ {
+ if (x < SQRTH)
+ { /* 2( 2x-1 )/( 2x+1 ) */
+ e -= 1;
+ z = x - 0.5L;
+ y = 0.5L * z + 0.5L;
+ }
+ else
+ { /* 2 (x-1)/(x+1) */
+ z = x - 0.5L;
+ z -= 0.5L;
+ y = 0.5L * x + 0.5L;
+ }
+ x = z / y;
+ z = x * x;
+ y = x * (z * neval (z, R, 5) / deval (z, S, 5));
+ goto done;
+ }
+
+
+/* logarithm using log(1+x) = x - .5x**2 + x**3 P(x)/Q(x) */
+
+ if (x < SQRTH)
+ {
+ e -= 1;
+ x = 2.0 * x - 1.0L; /* 2x - 1 */
+ }
+ else
+ {
+ x = x - 1.0L;
+ }
+ z = x * x;
+ y = x * (z * neval (x, P, 12) / deval (x, Q, 11));
+ y = y - 0.5 * z;
+
+done:
+
+/* Multiply log of fraction by log2(e)
+ * and base 2 exponent by 1
+ */
+ z = y * LOG2EA;
+ z += x * LOG2EA;
+ z += y;
+ z += x;
+ z += e;
+ return (z);
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_logl.c b/sysdeps/ieee754/ldbl-128ibm/e_logl.c
new file mode 100644
index 0000000000..aa5fc3740f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_logl.c
@@ -0,0 +1,281 @@
+/* logll.c
+ *
+ * Natural logarithm for 128-bit long double precision.
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, logl();
+ *
+ * y = logl( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns the base e (2.718...) logarithm of x.
+ *
+ * The argument is separated into its exponent and fractional
+ * parts. Use of a lookup table increases the speed of the routine.
+ * The program uses logarithms tabulated at intervals of 1/128 to
+ * cover the domain from approximately 0.7 to 1.4.
+ *
+ * On the interval [-1/128, +1/128] the logarithm of 1+x is approximated by
+ * log(1+x) = x - 0.5 x^2 + x^3 P(x) .
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ * Relative error:
+ * arithmetic domain # trials peak rms
+ * IEEE 0.875, 1.125 100000 1.2e-34 4.1e-35
+ * IEEE 0.125, 8 100000 1.2e-34 4.1e-35
+ *
+ *
+ * WARNING:
+ *
+ * This program uses integer operations on bit fields of floating-point
+ * numbers. It does not work with data structures other than the
+ * structure assumed.
+ *
+ */
+
+/* Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov>
+
+ This 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.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include "math_private.h"
+
+/* log(1+x) = x - .5 x^2 + x^3 l(x)
+ -.0078125 <= x <= +.0078125
+ peak relative error 1.2e-37 */
+static const long double
+l3 = 3.333333333333333333333333333333336096926E-1L,
+l4 = -2.499999999999999999999999999486853077002E-1L,
+l5 = 1.999999999999999999999999998515277861905E-1L,
+l6 = -1.666666666666666666666798448356171665678E-1L,
+l7 = 1.428571428571428571428808945895490721564E-1L,
+l8 = -1.249999999999999987884655626377588149000E-1L,
+l9 = 1.111111111111111093947834982832456459186E-1L,
+l10 = -1.000000000000532974938900317952530453248E-1L,
+l11 = 9.090909090915566247008015301349979892689E-2L,
+l12 = -8.333333211818065121250921925397567745734E-2L,
+l13 = 7.692307559897661630807048686258659316091E-2L,
+l14 = -7.144242754190814657241902218399056829264E-2L,
+l15 = 6.668057591071739754844678883223432347481E-2L;
+
+/* Lookup table of ln(t) - (t-1)
+ t = 0.5 + (k+26)/128)
+ k = 0, ..., 91 */
+static const long double logtbl[92] = {
+-5.5345593589352099112142921677820359632418E-2L,
+-5.2108257402767124761784665198737642086148E-2L,
+-4.8991686870576856279407775480686721935120E-2L,
+-4.5993270766361228596215288742353061431071E-2L,
+-4.3110481649613269682442058976885699556950E-2L,
+-4.0340872319076331310838085093194799765520E-2L,
+-3.7682072451780927439219005993827431503510E-2L,
+-3.5131785416234343803903228503274262719586E-2L,
+-3.2687785249045246292687241862699949178831E-2L,
+-3.0347913785027239068190798397055267411813E-2L,
+-2.8110077931525797884641940838507561326298E-2L,
+-2.5972247078357715036426583294246819637618E-2L,
+-2.3932450635346084858612873953407168217307E-2L,
+-2.1988775689981395152022535153795155900240E-2L,
+-2.0139364778244501615441044267387667496733E-2L,
+-1.8382413762093794819267536615342902718324E-2L,
+-1.6716169807550022358923589720001638093023E-2L,
+-1.5138929457710992616226033183958974965355E-2L,
+-1.3649036795397472900424896523305726435029E-2L,
+-1.2244881690473465543308397998034325468152E-2L,
+-1.0924898127200937840689817557742469105693E-2L,
+-9.6875626072830301572839422532631079809328E-3L,
+-8.5313926245226231463436209313499745894157E-3L,
+-7.4549452072765973384933565912143044991706E-3L,
+-6.4568155251217050991200599386801665681310E-3L,
+-5.5356355563671005131126851708522185605193E-3L,
+-4.6900728132525199028885749289712348829878E-3L,
+-3.9188291218610470766469347968659624282519E-3L,
+-3.2206394539524058873423550293617843896540E-3L,
+-2.5942708080877805657374888909297113032132E-3L,
+-2.0385211375711716729239156839929281289086E-3L,
+-1.5522183228760777967376942769773768850872E-3L,
+-1.1342191863606077520036253234446621373191E-3L,
+-7.8340854719967065861624024730268350459991E-4L,
+-4.9869831458030115699628274852562992756174E-4L,
+-2.7902661731604211834685052867305795169688E-4L,
+-1.2335696813916860754951146082826952093496E-4L,
+-3.0677461025892873184042490943581654591817E-5L,
+#define ZERO logtbl[38]
+ 0.0000000000000000000000000000000000000000E0L,
+-3.0359557945051052537099938863236321874198E-5L,
+-1.2081346403474584914595395755316412213151E-4L,
+-2.7044071846562177120083903771008342059094E-4L,
+-4.7834133324631162897179240322783590830326E-4L,
+-7.4363569786340080624467487620270965403695E-4L,
+-1.0654639687057968333207323853366578860679E-3L,
+-1.4429854811877171341298062134712230604279E-3L,
+-1.8753781835651574193938679595797367137975E-3L,
+-2.3618380914922506054347222273705859653658E-3L,
+-2.9015787624124743013946600163375853631299E-3L,
+-3.4938307889254087318399313316921940859043E-3L,
+-4.1378413103128673800485306215154712148146E-3L,
+-4.8328735414488877044289435125365629849599E-3L,
+-5.5782063183564351739381962360253116934243E-3L,
+-6.3731336597098858051938306767880719015261E-3L,
+-7.2169643436165454612058905294782949315193E-3L,
+-8.1090214990427641365934846191367315083867E-3L,
+-9.0486422112807274112838713105168375482480E-3L,
+-1.0035177140880864314674126398350812606841E-2L,
+-1.1067990155502102718064936259435676477423E-2L,
+-1.2146457974158024928196575103115488672416E-2L,
+-1.3269969823361415906628825374158424754308E-2L,
+-1.4437927104692837124388550722759686270765E-2L,
+-1.5649743073340777659901053944852735064621E-2L,
+-1.6904842527181702880599758489058031645317E-2L,
+-1.8202661505988007336096407340750378994209E-2L,
+-1.9542647000370545390701192438691126552961E-2L,
+-2.0924256670080119637427928803038530924742E-2L,
+-2.2346958571309108496179613803760727786257E-2L,
+-2.3810230892650362330447187267648486279460E-2L,
+-2.5313561699385640380910474255652501521033E-2L,
+-2.6856448685790244233704909690165496625399E-2L,
+-2.8438398935154170008519274953860128449036E-2L,
+-3.0058928687233090922411781058956589863039E-2L,
+-3.1717563112854831855692484086486099896614E-2L,
+-3.3413836095418743219397234253475252001090E-2L,
+-3.5147290019036555862676702093393332533702E-2L,
+-3.6917475563073933027920505457688955423688E-2L,
+-3.8723951502862058660874073462456610731178E-2L,
+-4.0566284516358241168330505467000838017425E-2L,
+-4.2444048996543693813649967076598766917965E-2L,
+-4.4356826869355401653098777649745233339196E-2L,
+-4.6304207416957323121106944474331029996141E-2L,
+-4.8285787106164123613318093945035804818364E-2L,
+-5.0301169421838218987124461766244507342648E-2L,
+-5.2349964705088137924875459464622098310997E-2L,
+-5.4431789996103111613753440311680967840214E-2L,
+-5.6546268881465384189752786409400404404794E-2L,
+-5.8693031345788023909329239565012647817664E-2L,
+-6.0871713627532018185577188079210189048340E-2L,
+-6.3081958078862169742820420185833800925568E-2L,
+-6.5323413029406789694910800219643791556918E-2L,
+-6.7595732653791419081537811574227049288168E-2L
+};
+
+/* ln(2) = ln2a + ln2b with extended precision. */
+static const long double
+ ln2a = 6.93145751953125e-1L,
+ ln2b = 1.4286068203094172321214581765680755001344E-6L;
+
+long double
+__ieee754_logl(long double x)
+{
+ long double z, y, w;
+ ieee854_long_double_shape_type u, t;
+ unsigned int m;
+ int k, e;
+
+ u.value = x;
+ m = u.parts32.w0;
+
+ /* Check for IEEE special cases. */
+ k = m & 0x7fffffff;
+ /* log(0) = -infinity. */
+ if ((k | u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3) == 0)
+ {
+ return -0.5L / ZERO;
+ }
+ /* log ( x < 0 ) = NaN */
+ if (m & 0x80000000)
+ {
+ return (x - x) / ZERO;
+ }
+ /* log (infinity or NaN) */
+ if (k >= 0x7ff00000)
+ {
+ return x + x;
+ }
+
+ /* On this interval the table is not used due to cancellation error. */
+ if ((x <= 1.0078125L) && (x >= 0.9921875L))
+ {
+ z = x - 1.0L;
+ k = 64;
+ t.value = 1.0L;
+ e = 0;
+ }
+ else
+ {
+ /* Extract exponent and reduce domain to 0.703125 <= u < 1.40625 */
+ unsigned int w0;
+ e = (int) (m >> 20) - (int) 0x3fe;
+ m &= 0xfffff;
+ w0 = m | 0x3fe00000;
+ m |= 0x100000;
+ /* Find lookup table index k from high order bits of the significand. */
+ if (m < 0x168000)
+ {
+ k = (m - 0xff000) >> 13;
+ /* t is the argument 0.5 + (k+26)/128
+ of the nearest item to u in the lookup table. */
+ t.parts32.w0 = 0x3ff00000 + (k << 13);
+ t.parts32.w1 = 0;
+ t.parts32.w2 = 0;
+ t.parts32.w3 = 0;
+ w0 += 0x100000;
+ e -= 1;
+ k += 64;
+ }
+ else
+ {
+ k = (m - 0xfe000) >> 14;
+ t.parts32.w0 = 0x3fe00000 + (k << 14);
+ t.parts32.w1 = 0;
+ t.parts32.w2 = 0;
+ t.parts32.w3 = 0;
+ }
+ u.value = __scalbnl (u.value, ((int) ((w0 - u.parts32.w0) * 2)) >> 21);
+ /* log(u) = log( t u/t ) = log(t) + log(u/t)
+ log(t) is tabulated in the lookup table.
+ Express log(u/t) = log(1+z), where z = u/t - 1 = (u-t)/t.
+ cf. Cody & Waite. */
+ z = (u.value - t.value) / t.value;
+ }
+ /* Series expansion of log(1+z). */
+ w = z * z;
+ y = ((((((((((((l15 * z
+ + l14) * z
+ + l13) * z
+ + l12) * z
+ + l11) * z
+ + l10) * z
+ + l9) * z
+ + l8) * z
+ + l7) * z
+ + l6) * z
+ + l5) * z
+ + l4) * z
+ + l3) * z * w;
+ y -= 0.5 * w;
+ y += e * ln2b; /* Base 2 exponent offset times ln(2). */
+ y += z;
+ y += logtbl[k-26]; /* log(t) - (t-1) */
+ y += (t.value - 1.0L);
+ y += e * ln2a;
+ return y;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_powl.c b/sysdeps/ieee754/ldbl-128ibm/e_powl.c
new file mode 100644
index 0000000000..feeaa8ce21
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_powl.c
@@ -0,0 +1,441 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* Expansions and modifications for 128-bit long double are
+ Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under
+ the following terms:
+
+ This 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.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/* __ieee754_powl(x,y) return x**y
+ *
+ * n
+ * Method: Let x = 2 * (1+f)
+ * 1. Compute and return log2(x) in two pieces:
+ * log2(x) = w1 + w2,
+ * where w1 has 113-53 = 60 bit trailing zeros.
+ * 2. Perform y*log2(x) = n+y' by simulating muti-precision
+ * arithmetic, where |y'|<=0.5.
+ * 3. Return x**y = 2**n*exp(y'*log2)
+ *
+ * Special cases:
+ * 1. (anything) ** 0 is 1
+ * 2. (anything) ** 1 is itself
+ * 3. (anything) ** NAN is NAN
+ * 4. NAN ** (anything except 0) is NAN
+ * 5. +-(|x| > 1) ** +INF is +INF
+ * 6. +-(|x| > 1) ** -INF is +0
+ * 7. +-(|x| < 1) ** +INF is +0
+ * 8. +-(|x| < 1) ** -INF is +INF
+ * 9. +-1 ** +-INF is NAN
+ * 10. +0 ** (+anything except 0, NAN) is +0
+ * 11. -0 ** (+anything except 0, NAN, odd integer) is +0
+ * 12. +0 ** (-anything except 0, NAN) is +INF
+ * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF
+ * 14. -0 ** (odd integer) = -( +0 ** (odd integer) )
+ * 15. +INF ** (+anything except 0,NAN) is +INF
+ * 16. +INF ** (-anything except 0,NAN) is +0
+ * 17. -INF ** (anything) = -0 ** (-anything)
+ * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer)
+ * 19. (-anything except 0 and inf) ** (non-integer) is NAN
+ *
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double bp[] = {
+ 1.0L,
+ 1.5L,
+};
+
+/* log_2(1.5) */
+static const long double dp_h[] = {
+ 0.0,
+ 5.8496250072115607565592654282227158546448E-1L
+};
+
+/* Low part of log_2(1.5) */
+static const long double dp_l[] = {
+ 0.0,
+ 1.0579781240112554492329533686862998106046E-16L
+};
+
+static const long double zero = 0.0L,
+ one = 1.0L,
+ two = 2.0L,
+ two113 = 1.0384593717069655257060992658440192E34L,
+ huge = 1.0e3000L,
+ tiny = 1.0e-3000L;
+
+/* 3/2 log x = 3 z + z^3 + z^3 (z^2 R(z^2))
+ z = (x-1)/(x+1)
+ 1 <= x <= 1.25
+ Peak relative error 2.3e-37 */
+static const long double LN[] =
+{
+ -3.0779177200290054398792536829702930623200E1L,
+ 6.5135778082209159921251824580292116201640E1L,
+ -4.6312921812152436921591152809994014413540E1L,
+ 1.2510208195629420304615674658258363295208E1L,
+ -9.9266909031921425609179910128531667336670E-1L
+};
+static const long double LD[] =
+{
+ -5.129862866715009066465422805058933131960E1L,
+ 1.452015077564081884387441590064272782044E2L,
+ -1.524043275549860505277434040464085593165E2L,
+ 7.236063513651544224319663428634139768808E1L,
+ -1.494198912340228235853027849917095580053E1L
+ /* 1.0E0 */
+};
+
+/* exp(x) = 1 + x - x / (1 - 2 / (x - x^2 R(x^2)))
+ 0 <= x <= 0.5
+ Peak relative error 5.7e-38 */
+static const long double PN[] =
+{
+ 5.081801691915377692446852383385968225675E8L,
+ 9.360895299872484512023336636427675327355E6L,
+ 4.213701282274196030811629773097579432957E4L,
+ 5.201006511142748908655720086041570288182E1L,
+ 9.088368420359444263703202925095675982530E-3L,
+};
+static const long double PD[] =
+{
+ 3.049081015149226615468111430031590411682E9L,
+ 1.069833887183886839966085436512368982758E8L,
+ 8.259257717868875207333991924545445705394E5L,
+ 1.872583833284143212651746812884298360922E3L,
+ /* 1.0E0 */
+};
+
+static const long double
+ /* ln 2 */
+ lg2 = 6.9314718055994530941723212145817656807550E-1L,
+ lg2_h = 6.9314718055994528622676398299518041312695E-1L,
+ lg2_l = 2.3190468138462996154948554638754786504121E-17L,
+ ovt = 8.0085662595372944372e-0017L,
+ /* 2/(3*log(2)) */
+ cp = 9.6179669392597560490661645400126142495110E-1L,
+ cp_h = 9.6179669392597555432899980587535537779331E-1L,
+ cp_l = 5.0577616648125906047157785230014751039424E-17L;
+
+#ifdef __STDC__
+long double
+__ieee754_powl (long double x, long double y)
+#else
+long double
+__ieee754_powl (x, y)
+ long double x, y;
+#endif
+{
+ long double z, ax, z_h, z_l, p_h, p_l;
+ long double y1, t1, t2, r, s, t, u, v, w;
+ long double s2, s_h, s_l, t_h, t_l;
+ int32_t i, j, k, yisint, n;
+ u_int32_t ix, iy;
+ int32_t hx, hy;
+ ieee854_long_double_shape_type o, p, q;
+
+ p.value = x;
+ hx = p.parts32.w0;
+ ix = hx & 0x7fffffff;
+
+ q.value = y;
+ hy = q.parts32.w0;
+ iy = hy & 0x7fffffff;
+
+
+ /* y==zero: x**0 = 1 */
+ if ((iy | q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) == 0)
+ return one;
+
+ /* 1.0**y = 1; -1.0**+-Inf = 1 */
+ if (x == one)
+ return one;
+ if (x == -1.0L && iy == 0x7ff00000
+ && (q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) == 0)
+ return one;
+
+ /* +-NaN return x+y */
+ if ((ix > 0x7ff00000)
+ || ((ix == 0x7ff00000)
+ && ((p.parts32.w1 | (p.parts32.w2 & 0x7fffffff) | p.parts32.w3) != 0))
+ || (iy > 0x7ff00000)
+ || ((iy == 0x7ff00000)
+ && ((q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) != 0)))
+ return x + y;
+
+ /* determine if y is an odd int when x < 0
+ * yisint = 0 ... y is not an integer
+ * yisint = 1 ... y is an odd int
+ * yisint = 2 ... y is an even int
+ */
+ yisint = 0;
+ if (hx < 0)
+ {
+ if ((q.parts32.w2 & 0x7fffffff) >= 0x43400000) /* Low part >= 2^53 */
+ yisint = 2; /* even integer y */
+ else if (iy >= 0x3ff00000) /* 1.0 */
+ {
+ if (__floorl (y) == y)
+ {
+ z = 0.5 * y;
+ if (__floorl (z) == z)
+ yisint = 2;
+ else
+ yisint = 1;
+ }
+ }
+ }
+
+ /* special value of y */
+ if ((q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) == 0)
+ {
+ if (iy == 0x7ff00000 && q.parts32.w1 == 0) /* y is +-inf */
+ {
+ if (((ix - 0x3ff00000) | p.parts32.w1
+ | (p.parts32.w2 & 0x7fffffff) | p.parts32.w3) == 0)
+ return y - y; /* inf**+-1 is NaN */
+ else if (ix > 0x3ff00000 || fabsl (x) > 1.0L)
+ /* (|x|>1)**+-inf = inf,0 */
+ return (hy >= 0) ? y : zero;
+ else
+ /* (|x|<1)**-,+inf = inf,0 */
+ return (hy < 0) ? -y : zero;
+ }
+ if (iy == 0x3ff00000)
+ { /* y is +-1 */
+ if (hy < 0)
+ return one / x;
+ else
+ return x;
+ }
+ if (hy == 0x40000000)
+ return x * x; /* y is 2 */
+ if (hy == 0x3fe00000)
+ { /* y is 0.5 */
+ if (hx >= 0) /* x >= +0 */
+ return __ieee754_sqrtl (x);
+ }
+ }
+
+ ax = fabsl (x);
+ /* special value of x */
+ if ((p.parts32.w1 | (p.parts32.w2 & 0x7fffffff) | p.parts32.w3) == 0)
+ {
+ if (ix == 0x7ff00000 || ix == 0 || ix == 0x3ff00000)
+ {
+ z = ax; /*x is +-0,+-inf,+-1 */
+ if (hy < 0)
+ z = one / z; /* z = (1/|x|) */
+ if (hx < 0)
+ {
+ if (((ix - 0x3ff00000) | yisint) == 0)
+ {
+ z = (z - z) / (z - z); /* (-1)**non-int is NaN */
+ }
+ else if (yisint == 1)
+ z = -z; /* (x<0)**odd = -(|x|**odd) */
+ }
+ return z;
+ }
+ }
+
+ /* (x<0)**(non-int) is NaN */
+ if (((((u_int32_t) hx >> 31) - 1) | yisint) == 0)
+ return (x - x) / (x - x);
+
+ /* |y| is huge.
+ 2^-16495 = 1/2 of smallest representable value.
+ If (1 - 1/131072)^y underflows, y > 1.4986e9 */
+ if (iy > 0x41d654b0)
+ {
+ /* if (1 - 2^-113)^y underflows, y > 1.1873e38 */
+ if (iy > 0x47d654b0)
+ {
+ if (ix <= 0x3fefffff)
+ return (hy < 0) ? huge * huge : tiny * tiny;
+ if (ix >= 0x3ff00000)
+ return (hy > 0) ? huge * huge : tiny * tiny;
+ }
+ /* over/underflow if x is not close to one */
+ if (ix < 0x3fefffff)
+ return (hy < 0) ? huge * huge : tiny * tiny;
+ if (ix > 0x3ff00000)
+ return (hy > 0) ? huge * huge : tiny * tiny;
+ }
+
+ n = 0;
+ /* take care subnormal number */
+ if (ix < 0x00100000)
+ {
+ ax *= two113;
+ n -= 113;
+ o.value = ax;
+ ix = o.parts32.w0;
+ }
+ n += ((ix) >> 20) - 0x3ff;
+ j = ix & 0x000fffff;
+ /* determine interval */
+ ix = j | 0x3ff00000; /* normalize ix */
+ if (j <= 0x39880)
+ k = 0; /* |x|<sqrt(3/2) */
+ else if (j < 0xbb670)
+ k = 1; /* |x|<sqrt(3) */
+ else
+ {
+ k = 0;
+ n += 1;
+ ix -= 0x00100000;
+ }
+
+ o.value = ax;
+ o.value = __scalbnl (o.value, ((int) ((ix - o.parts32.w0) * 2)) >> 21);
+ ax = o.value;
+
+ /* compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */
+ u = ax - bp[k]; /* bp[0]=1.0, bp[1]=1.5 */
+ v = one / (ax + bp[k]);
+ s = u * v;
+ s_h = s;
+
+ o.value = s_h;
+ o.parts32.w3 = 0;
+ o.parts32.w2 &= 0xffff8000;
+ s_h = o.value;
+ /* t_h=ax+bp[k] High */
+ t_h = ax + bp[k];
+ o.value = t_h;
+ o.parts32.w3 = 0;
+ o.parts32.w2 &= 0xffff8000;
+ t_h = o.value;
+ t_l = ax - (t_h - bp[k]);
+ s_l = v * ((u - s_h * t_h) - s_h * t_l);
+ /* compute log(ax) */
+ s2 = s * s;
+ u = LN[0] + s2 * (LN[1] + s2 * (LN[2] + s2 * (LN[3] + s2 * LN[4])));
+ v = LD[0] + s2 * (LD[1] + s2 * (LD[2] + s2 * (LD[3] + s2 * (LD[4] + s2))));
+ r = s2 * s2 * u / v;
+ r += s_l * (s_h + s);
+ s2 = s_h * s_h;
+ t_h = 3.0 + s2 + r;
+ o.value = t_h;
+ o.parts32.w3 = 0;
+ o.parts32.w2 &= 0xffff8000;
+ t_h = o.value;
+ t_l = r - ((t_h - 3.0) - s2);
+ /* u+v = s*(1+...) */
+ u = s_h * t_h;
+ v = s_l * t_h + t_l * s;
+ /* 2/(3log2)*(s+...) */
+ p_h = u + v;
+ o.value = p_h;
+ o.parts32.w3 = 0;
+ o.parts32.w2 &= 0xffff8000;
+ p_h = o.value;
+ p_l = v - (p_h - u);
+ z_h = cp_h * p_h; /* cp_h+cp_l = 2/(3*log2) */
+ z_l = cp_l * p_h + p_l * cp + dp_l[k];
+ /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */
+ t = (long double) n;
+ t1 = (((z_h + z_l) + dp_h[k]) + t);
+ o.value = t1;
+ o.parts32.w3 = 0;
+ o.parts32.w2 &= 0xffff8000;
+ t1 = o.value;
+ t2 = z_l - (((t1 - t) - dp_h[k]) - z_h);
+
+ /* s (sign of result -ve**odd) = -1 else = 1 */
+ s = one;
+ if (((((u_int32_t) hx >> 31) - 1) | (yisint - 1)) == 0)
+ s = -one; /* (-ve)**(odd int) */
+
+ /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */
+ y1 = y;
+ o.value = y1;
+ o.parts32.w3 = 0;
+ o.parts32.w2 &= 0xffff8000;
+ y1 = o.value;
+ p_l = (y - y1) * t1 + y * t2;
+ p_h = y1 * t1;
+ z = p_l + p_h;
+ o.value = z;
+ j = o.parts32.w0;
+ if (j >= 0x40d00000) /* z >= 16384 */
+ {
+ /* if z > 16384 */
+ if (((j - 0x40d00000) | o.parts32.w1
+ | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0)
+ return s * huge * huge; /* overflow */
+ else
+ {
+ if (p_l + ovt > z - p_h)
+ return s * huge * huge; /* overflow */
+ }
+ }
+ else if ((j & 0x7fffffff) >= 0x40d01b90) /* z <= -16495 */
+ {
+ /* z < -16495 */
+ if (((j - 0xc0d01bc0) | o.parts32.w1
+ | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0)
+ return s * tiny * tiny; /* underflow */
+ else
+ {
+ if (p_l <= z - p_h)
+ return s * tiny * tiny; /* underflow */
+ }
+ }
+ /* compute 2**(p_h+p_l) */
+ i = j & 0x7fffffff;
+ k = (i >> 20) - 0x3ff;
+ n = 0;
+ if (i > 0x3fe00000)
+ { /* if |z| > 0.5, set n = [z+0.5] */
+ n = __floorl (z + 0.5L);
+ t = n;
+ p_h -= t;
+ }
+ t = p_l + p_h;
+ o.value = t;
+ o.parts32.w3 = 0;
+ o.parts32.w2 &= 0xffff8000;
+ t = o.value;
+ u = t * lg2_h;
+ v = (p_l - (t - p_h)) * lg2 + t * lg2_l;
+ z = u + v;
+ w = v - (z - u);
+ /* exp(z) */
+ t = z * z;
+ u = PN[0] + t * (PN[1] + t * (PN[2] + t * (PN[3] + t * PN[4])));
+ v = PD[0] + t * (PD[1] + t * (PD[2] + t * (PD[3] + t)));
+ t1 = z - t * u / v;
+ r = (z * t1) / (t1 - two) - (w + z * w);
+ z = one - (r - z);
+ z = __scalbnl (z, n);
+ return s * z;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c b/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c
new file mode 100644
index 0000000000..416547c220
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c
@@ -0,0 +1,277 @@
+/* Quad-precision floating point argument reduction.
+ Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "math.h"
+#include "math_private.h"
+#include <ieee754.h>
+
+/*
+ * Table of constants for 2/pi, 5628 hexadecimal digits of 2/pi
+ */
+static const int32_t two_over_pi[] = {
+0xa2f983, 0x6e4e44, 0x1529fc, 0x2757d1, 0xf534dd, 0xc0db62,
+0x95993c, 0x439041, 0xfe5163, 0xabdebb, 0xc561b7, 0x246e3a,
+0x424dd2, 0xe00649, 0x2eea09, 0xd1921c, 0xfe1deb, 0x1cb129,
+0xa73ee8, 0x8235f5, 0x2ebb44, 0x84e99c, 0x7026b4, 0x5f7e41,
+0x3991d6, 0x398353, 0x39f49c, 0x845f8b, 0xbdf928, 0x3b1ff8,
+0x97ffde, 0x05980f, 0xef2f11, 0x8b5a0a, 0x6d1f6d, 0x367ecf,
+0x27cb09, 0xb74f46, 0x3f669e, 0x5fea2d, 0x7527ba, 0xc7ebe5,
+0xf17b3d, 0x0739f7, 0x8a5292, 0xea6bfb, 0x5fb11f, 0x8d5d08,
+0x560330, 0x46fc7b, 0x6babf0, 0xcfbc20, 0x9af436, 0x1da9e3,
+0x91615e, 0xe61b08, 0x659985, 0x5f14a0, 0x68408d, 0xffd880,
+0x4d7327, 0x310606, 0x1556ca, 0x73a8c9, 0x60e27b, 0xc08c6b,
+0x47c419, 0xc367cd, 0xdce809, 0x2a8359, 0xc4768b, 0x961ca6,
+0xddaf44, 0xd15719, 0x053ea5, 0xff0705, 0x3f7e33, 0xe832c2,
+0xde4f98, 0x327dbb, 0xc33d26, 0xef6b1e, 0x5ef89f, 0x3a1f35,
+0xcaf27f, 0x1d87f1, 0x21907c, 0x7c246a, 0xfa6ed5, 0x772d30,
+0x433b15, 0xc614b5, 0x9d19c3, 0xc2c4ad, 0x414d2c, 0x5d000c,
+0x467d86, 0x2d71e3, 0x9ac69b, 0x006233, 0x7cd2b4, 0x97a7b4,
+0xd55537, 0xf63ed7, 0x1810a3, 0xfc764d, 0x2a9d64, 0xabd770,
+0xf87c63, 0x57b07a, 0xe71517, 0x5649c0, 0xd9d63b, 0x3884a7,
+0xcb2324, 0x778ad6, 0x23545a, 0xb91f00, 0x1b0af1, 0xdfce19,
+0xff319f, 0x6a1e66, 0x615799, 0x47fbac, 0xd87f7e, 0xb76522,
+0x89e832, 0x60bfe6, 0xcdc4ef, 0x09366c, 0xd43f5d, 0xd7de16,
+0xde3b58, 0x929bde, 0x2822d2, 0xe88628, 0x4d58e2, 0x32cac6,
+0x16e308, 0xcb7de0, 0x50c017, 0xa71df3, 0x5be018, 0x34132e,
+0x621283, 0x014883, 0x5b8ef5, 0x7fb0ad, 0xf2e91e, 0x434a48,
+0xd36710, 0xd8ddaa, 0x425fae, 0xce616a, 0xa4280a, 0xb499d3,
+0xf2a606, 0x7f775c, 0x83c2a3, 0x883c61, 0x78738a, 0x5a8caf,
+0xbdd76f, 0x63a62d, 0xcbbff4, 0xef818d, 0x67c126, 0x45ca55,
+0x36d9ca, 0xd2a828, 0x8d61c2, 0x77c912, 0x142604, 0x9b4612,
+0xc459c4, 0x44c5c8, 0x91b24d, 0xf31700, 0xad43d4, 0xe54929,
+0x10d5fd, 0xfcbe00, 0xcc941e, 0xeece70, 0xf53e13, 0x80f1ec,
+0xc3e7b3, 0x28f8c7, 0x940593, 0x3e71c1, 0xb3092e, 0xf3450b,
+0x9c1288, 0x7b20ab, 0x9fb52e, 0xc29247, 0x2f327b, 0x6d550c,
+0x90a772, 0x1fe76b, 0x96cb31, 0x4a1679, 0xe27941, 0x89dff4,
+0x9794e8, 0x84e6e2, 0x973199, 0x6bed88, 0x365f5f, 0x0efdbb,
+0xb49a48, 0x6ca467, 0x427271, 0x325d8d, 0xb8159f, 0x09e5bc,
+0x25318d, 0x3974f7, 0x1c0530, 0x010c0d, 0x68084b, 0x58ee2c,
+0x90aa47, 0x02e774, 0x24d6bd, 0xa67df7, 0x72486e, 0xef169f,
+0xa6948e, 0xf691b4, 0x5153d1, 0xf20acf, 0x339820, 0x7e4bf5,
+0x6863b2, 0x5f3edd, 0x035d40, 0x7f8985, 0x295255, 0xc06437,
+0x10d86d, 0x324832, 0x754c5b, 0xd4714e, 0x6e5445, 0xc1090b,
+0x69f52a, 0xd56614, 0x9d0727, 0x50045d, 0xdb3bb4, 0xc576ea,
+0x17f987, 0x7d6b49, 0xba271d, 0x296996, 0xacccc6, 0x5414ad,
+0x6ae290, 0x89d988, 0x50722c, 0xbea404, 0x940777, 0x7030f3,
+0x27fc00, 0xa871ea, 0x49c266, 0x3de064, 0x83dd97, 0x973fa3,
+0xfd9443, 0x8c860d, 0xde4131, 0x9d3992, 0x8c70dd, 0xe7b717,
+0x3bdf08, 0x2b3715, 0xa0805c, 0x93805a, 0x921110, 0xd8e80f,
+0xaf806c, 0x4bffdb, 0x0f9038, 0x761859, 0x15a562, 0xbbcb61,
+0xb989c7, 0xbd4010, 0x04f2d2, 0x277549, 0xf6b6eb, 0xbb22db,
+0xaa140a, 0x2f2689, 0x768364, 0x333b09, 0x1a940e, 0xaa3a51,
+0xc2a31d, 0xaeedaf, 0x12265c, 0x4dc26d, 0x9c7a2d, 0x9756c0,
+0x833f03, 0xf6f009, 0x8c402b, 0x99316d, 0x07b439, 0x15200c,
+0x5bc3d8, 0xc492f5, 0x4badc6, 0xa5ca4e, 0xcd37a7, 0x36a9e6,
+0x9492ab, 0x6842dd, 0xde6319, 0xef8c76, 0x528b68, 0x37dbfc,
+0xaba1ae, 0x3115df, 0xa1ae00, 0xdafb0c, 0x664d64, 0xb705ed,
+0x306529, 0xbf5657, 0x3aff47, 0xb9f96a, 0xf3be75, 0xdf9328,
+0x3080ab, 0xf68c66, 0x15cb04, 0x0622fa, 0x1de4d9, 0xa4b33d,
+0x8f1b57, 0x09cd36, 0xe9424e, 0xa4be13, 0xb52333, 0x1aaaf0,
+0xa8654f, 0xa5c1d2, 0x0f3f0b, 0xcd785b, 0x76f923, 0x048b7b,
+0x721789, 0x53a6c6, 0xe26e6f, 0x00ebef, 0x584a9b, 0xb7dac4,
+0xba66aa, 0xcfcf76, 0x1d02d1, 0x2df1b1, 0xc1998c, 0x77adc3,
+0xda4886, 0xa05df7, 0xf480c6, 0x2ff0ac, 0x9aecdd, 0xbc5c3f,
+0x6dded0, 0x1fc790, 0xb6db2a, 0x3a25a3, 0x9aaf00, 0x9353ad,
+0x0457b6, 0xb42d29, 0x7e804b, 0xa707da, 0x0eaa76, 0xa1597b,
+0x2a1216, 0x2db7dc, 0xfde5fa, 0xfedb89, 0xfdbe89, 0x6c76e4,
+0xfca906, 0x70803e, 0x156e85, 0xff87fd, 0x073e28, 0x336761,
+0x86182a, 0xeabd4d, 0xafe7b3, 0x6e6d8f, 0x396795, 0x5bbf31,
+0x48d784, 0x16df30, 0x432dc7, 0x356125, 0xce70c9, 0xb8cb30,
+0xfd6cbf, 0xa200a4, 0xe46c05, 0xa0dd5a, 0x476f21, 0xd21262,
+0x845cb9, 0x496170, 0xe0566b, 0x015299, 0x375550, 0xb7d51e,
+0xc4f133, 0x5f6e13, 0xe4305d, 0xa92e85, 0xc3b21d, 0x3632a1,
+0xa4b708, 0xd4b1ea, 0x21f716, 0xe4698f, 0x77ff27, 0x80030c,
+0x2d408d, 0xa0cd4f, 0x99a520, 0xd3a2b3, 0x0a5d2f, 0x42f9b4,
+0xcbda11, 0xd0be7d, 0xc1db9b, 0xbd17ab, 0x81a2ca, 0x5c6a08,
+0x17552e, 0x550027, 0xf0147f, 0x8607e1, 0x640b14, 0x8d4196,
+0xdebe87, 0x2afdda, 0xb6256b, 0x34897b, 0xfef305, 0x9ebfb9,
+0x4f6a68, 0xa82a4a, 0x5ac44f, 0xbcf82d, 0x985ad7, 0x95c7f4,
+0x8d4d0d, 0xa63a20, 0x5f57a4, 0xb13f14, 0x953880, 0x0120cc,
+0x86dd71, 0xb6dec9, 0xf560bf, 0x11654d, 0x6b0701, 0xacb08c,
+0xd0c0b2, 0x485551, 0x0efb1e, 0xc37295, 0x3b06a3, 0x3540c0,
+0x7bdc06, 0xcc45e0, 0xfa294e, 0xc8cad6, 0x41f3e8, 0xde647c,
+0xd8649b, 0x31bed9, 0xc397a4, 0xd45877, 0xc5e369, 0x13daf0,
+0x3c3aba, 0x461846, 0x5f7555, 0xf5bdd2, 0xc6926e, 0x5d2eac,
+0xed440e, 0x423e1c, 0x87c461, 0xe9fd29, 0xf3d6e7, 0xca7c22,
+0x35916f, 0xc5e008, 0x8dd7ff, 0xe26a6e, 0xc6fdb0, 0xc10893,
+0x745d7c, 0xb2ad6b, 0x9d6ecd, 0x7b723e, 0x6a11c6, 0xa9cff7,
+0xdf7329, 0xbac9b5, 0x5100b7, 0x0db2e2, 0x24ba74, 0x607de5,
+0x8ad874, 0x2c150d, 0x0c1881, 0x94667e, 0x162901, 0x767a9f,
+0xbefdfd, 0xef4556, 0x367ed9, 0x13d9ec, 0xb9ba8b, 0xfc97c4,
+0x27a831, 0xc36ef1, 0x36c594, 0x56a8d8, 0xb5a8b4, 0x0ecccf,
+0x2d8912, 0x34576f, 0x89562c, 0xe3ce99, 0xb920d6, 0xaa5e6b,
+0x9c2a3e, 0xcc5f11, 0x4a0bfd, 0xfbf4e1, 0x6d3b8e, 0x2c86e2,
+0x84d4e9, 0xa9b4fc, 0xd1eeef, 0xc9352e, 0x61392f, 0x442138,
+0xc8d91b, 0x0afc81, 0x6a4afb, 0xd81c2f, 0x84b453, 0x8c994e,
+0xcc2254, 0xdc552a, 0xd6c6c0, 0x96190b, 0xb8701a, 0x649569,
+0x605a26, 0xee523f, 0x0f117f, 0x11b5f4, 0xf5cbfc, 0x2dbc34,
+0xeebc34, 0xcc5de8, 0x605edd, 0x9b8e67, 0xef3392, 0xb817c9,
+0x9b5861, 0xbc57e1, 0xc68351, 0x103ed8, 0x4871dd, 0xdd1c2d,
+0xa118af, 0x462c21, 0xd7f359, 0x987ad9, 0xc0549e, 0xfa864f,
+0xfc0656, 0xae79e5, 0x362289, 0x22ad38, 0xdc9367, 0xaae855,
+0x382682, 0x9be7ca, 0xa40d51, 0xb13399, 0x0ed7a9, 0x480569,
+0xf0b265, 0xa7887f, 0x974c88, 0x36d1f9, 0xb39221, 0x4a827b,
+0x21cf98, 0xdc9f40, 0x5547dc, 0x3a74e1, 0x42eb67, 0xdf9dfe,
+0x5fd45e, 0xa4677b, 0x7aacba, 0xa2f655, 0x23882b, 0x55ba41,
+0x086e59, 0x862a21, 0x834739, 0xe6e389, 0xd49ee5, 0x40fb49,
+0xe956ff, 0xca0f1c, 0x8a59c5, 0x2bfa94, 0xc5c1d3, 0xcfc50f,
+0xae5adb, 0x86c547, 0x624385, 0x3b8621, 0x94792c, 0x876110,
+0x7b4c2a, 0x1a2c80, 0x12bf43, 0x902688, 0x893c78, 0xe4c4a8,
+0x7bdbe5, 0xc23ac4, 0xeaf426, 0x8a67f7, 0xbf920d, 0x2ba365,
+0xb1933d, 0x0b7cbd, 0xdc51a4, 0x63dd27, 0xdde169, 0x19949a,
+0x9529a8, 0x28ce68, 0xb4ed09, 0x209f44, 0xca984e, 0x638270,
+0x237c7e, 0x32b90f, 0x8ef5a7, 0xe75614, 0x08f121, 0x2a9db5,
+0x4d7e6f, 0x5119a5, 0xabf9b5, 0xd6df82, 0x61dd96, 0x023616,
+0x9f3ac4, 0xa1a283, 0x6ded72, 0x7a8d39, 0xa9b882, 0x5c326b,
+0x5b2746, 0xed3400, 0x7700d2, 0x55f4fc, 0x4d5901, 0x8071e0,
+0xe13f89, 0xb295f3, 0x64a8f1, 0xaea74b, 0x38fc4c, 0xeab2bb,
+0x47270b, 0xabc3a7, 0x34ba60, 0x52dd34, 0xf8563a, 0xeb7e8a,
+0x31bb36, 0x5895b7, 0x47f7a9, 0x94c3aa, 0xd39225, 0x1e7f3e,
+0xd8974e, 0xbba94f, 0xd8ae01, 0xe661b4, 0x393d8e, 0xa523aa,
+0x33068e, 0x1633b5, 0x3bb188, 0x1d3a9d, 0x4013d0, 0xcc1be5,
+0xf862e7, 0x3bf28f, 0x39b5bf, 0x0bc235, 0x22747e, 0xa247c0,
+0xd52d1f, 0x19add3, 0x9094df, 0x9311d0, 0xb42b25, 0x496db2,
+0xe264b2, 0x5ef135, 0x3bc6a4, 0x1a4ad0, 0xaac92e, 0x64e886,
+0x573091, 0x982cfb, 0x311b1a, 0x08728b, 0xbdcee1, 0x60e142,
+0xeb641d, 0xd0bba3, 0xe559d4, 0x597b8c, 0x2a4483, 0xf332ba,
+0xf84867, 0x2c8d1b, 0x2fa9b0, 0x50f3dd, 0xf9f573, 0xdb61b4,
+0xfe233e, 0x6c41a6, 0xeea318, 0x775a26, 0xbc5e5c, 0xcea708,
+0x94dc57, 0xe20196, 0xf1e839, 0xbe4851, 0x5d2d2f, 0x4e9555,
+0xd96ec2, 0xe7d755, 0x6304e0, 0xc02e0e, 0xfc40a0, 0xbbf9b3,
+0x7125a7, 0x222dfb, 0xf619d8, 0x838c1c, 0x6619e6, 0xb20d55,
+0xbb5137, 0x79e809, 0xaf9149, 0x0d73de, 0x0b0da5, 0xce7f58,
+0xac1934, 0x724667, 0x7a1a13, 0x9e26bc, 0x4555e7, 0x585cb5,
+0x711d14, 0x486991, 0x480d60, 0x56adab, 0xd62f64, 0x96ee0c,
+0x212ff3, 0x5d6d88, 0xa67684, 0x95651e, 0xab9e0a, 0x4ddefe,
+0x571010, 0x836a39, 0xf8ea31, 0x9e381d, 0xeac8b1, 0xcac96b,
+0x37f21e, 0xd505e9, 0x984743, 0x9fc56c, 0x0331b7, 0x3b8bf8,
+0x86e56a, 0x8dc343, 0x6230e7, 0x93cfd5, 0x6a8f2d, 0x733005,
+0x1af021, 0xa09fcb, 0x7415a1, 0xd56b23, 0x6ff725, 0x2f4bc7,
+0xb8a591, 0x7fac59, 0x5c55de, 0x212c38, 0xb13296, 0x5cff50,
+0x366262, 0xfa7b16, 0xf4d9a6, 0x2acfe7, 0xf07403, 0xd4d604,
+0x6fd916, 0x31b1bf, 0xcbb450, 0x5bd7c8, 0x0ce194, 0x6bd643,
+0x4fd91c, 0xdf4543, 0x5f3453, 0xe2b5aa, 0xc9aec8, 0x131485,
+0xf9d2bf, 0xbadb9e, 0x76f5b9, 0xaf15cf, 0xca3182, 0x14b56d,
+0xe9fe4d, 0x50fc35, 0xf5aed5, 0xa2d0c1, 0xc96057, 0x192eb6,
+0xe91d92, 0x07d144, 0xaea3c6, 0x343566, 0x26d5b4, 0x3161e2,
+0x37f1a2, 0x209eff, 0x958e23, 0x493798, 0x35f4a6, 0x4bdc02,
+0xc2be13, 0xbe80a0, 0x0b72a3, 0x115c5f, 0x1e1bd1, 0x0db4d3,
+0x869e85, 0x96976b, 0x2ac91f, 0x8a26c2, 0x3070f0, 0x041412,
+0xfc9fa5, 0xf72a38, 0x9c6878, 0xe2aa76, 0x50cfe1, 0x559274,
+0x934e38, 0x0a92f7, 0x5533f0, 0xa63db4, 0x399971, 0xe2b755,
+0xa98a7c, 0x008f19, 0xac54d2, 0x2ea0b4, 0xf5f3e0, 0x60c849,
+0xffd269, 0xae52ce, 0x7a5fdd, 0xe9ce06, 0xfb0ae8, 0xa50cce,
+0xea9d3e, 0x3766dd, 0xb834f5, 0x0da090, 0x846f88, 0x4ae3d5,
+0x099a03, 0x2eae2d, 0xfcb40a, 0xfb9b33, 0xe281dd, 0x1b16ba,
+0xd8c0af, 0xd96b97, 0xb52dc9, 0x9c277f, 0x5951d5, 0x21ccd6,
+0xb6496b, 0x584562, 0xb3baf2, 0xa1a5c4, 0x7ca2cf, 0xa9b93d,
+0x7b7b89, 0x483d38,
+};
+
+static const long double c[] = {
+/* 93 bits of pi/2 */
+#define PI_2_1 c[0]
+ 1.57079632679489661923132169155131424e+00L, /* 3fff921fb54442d18469898cc5100000 */
+
+/* pi/2 - PI_2_1 */
+#define PI_2_1t c[1]
+ 8.84372056613570112025531863263659260e-29L, /* 3fa1c06e0e68948127044533e63a0106 */
+};
+
+int32_t __ieee754_rem_pio2l(long double x, long double *y)
+{
+ long double z, w, t;
+ double tx[8];
+ int64_t exp, n, ix, hx, ixd;
+ u_int64_t lx, lxd;
+
+ GET_LDOUBLE_WORDS64 (hx, lx, x);
+ ix = hx & 0x7fffffffffffffffLL;
+ if (ix <= 0x3fe921fb54442d10LL) /* x in <-pi/4, pi/4> */
+ {
+ y[0] = x;
+ y[1] = 0;
+ return 0;
+ }
+
+ if (ix < 0x4002d97c7f3321d0LL) /* |x| in <pi/4, 3pi/4) */
+ {
+ if (hx > 0)
+ {
+ /* 113 + 93 bit PI is ok */
+ z = x - PI_2_1;
+ y[0] = z - PI_2_1t;
+ y[1] = (z - y[0]) - PI_2_1t;
+ return 1;
+ }
+ else
+ {
+ /* 113 + 93 bit PI is ok */
+ z = x + PI_2_1;
+ y[0] = z + PI_2_1t;
+ y[1] = (z - y[0]) + PI_2_1t;
+ return -1;
+ }
+ }
+
+ if (ix >= 0x7ff0000000000000LL) /* x is +=oo or NaN */
+ {
+ y[0] = x - x;
+ y[1] = y[0];
+ return 0;
+ }
+
+ /* Handle large arguments.
+ We split the 113 bits of the mantissa into 5 24bit integers
+ stored in a double array. */
+ /* Make the IBM extended format 105 bit mantissa look like the ieee854 112
+ bit mantissa so the next operatation will give the correct result. */
+ EXTRACT_IBM_EXTENDED_MANTISSA (ixd, lxd, exp, x);
+ exp = exp - 23;
+ /* This is faster than doing this in floating point, because we
+ have to convert it to integers anyway and like this we can keep
+ both integer and floating point units busy. */
+ tx [0] = (double)(((ixd >> 25) & 0x7fffff) | 0x800000);
+ tx [1] = (double)((ixd >> 1) & 0xffffff);
+ tx [2] = (double)(((ixd << 23) | (lxd >> 41)) & 0xffffff);
+ tx [3] = (double)((lxd >> 17) & 0xffffff);
+ tx [4] = (double)((lxd << 7) & 0xffffff);
+
+ n = __kernel_rem_pio2 (tx, tx + 5, exp, ((lxd << 7) & 0xffffff) ? 5 : 4,
+ 3, two_over_pi);
+
+ /* The result is now stored in 3 double values, we need to convert it into
+ two long double values. */
+ t = (long double) tx [6] + (long double) tx [7];
+ w = (long double) tx [5];
+
+ if (hx >= 0)
+ {
+ y[0] = w + t;
+ y[1] = t - (y[0] - w);
+ return n;
+ }
+ else
+ {
+ y[0] = -(w + t);
+ y[1] = -t - (y[0] + w);
+ return -n;
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c b/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c
new file mode 100644
index 0000000000..b7fa68f32a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c
@@ -0,0 +1,78 @@
+/* e_fmodl.c -- long double version of e_fmod.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* __ieee754_remainderl(x,p)
+ * Return :
+ * returns x REM p = x - [x/p]*p as if in infinite
+ * precise arithmetic, where [x/p] is the (infinite bit)
+ * integer nearest x/p (in half way case choose the even one).
+ * Method :
+ * Based on fmodl() return x-[x/p]chopped*p exactlp.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double zero = 0.0L;
+#else
+static long double zero = 0.0L;
+#endif
+
+
+#ifdef __STDC__
+ long double __ieee754_remainderl(long double x, long double p)
+#else
+ long double __ieee754_remainderl(x,p)
+ long double x,p;
+#endif
+{
+ int64_t hx,hp;
+ u_int64_t sx,lx,lp;
+ long double p_half;
+
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ GET_LDOUBLE_WORDS64(hp,lp,p);
+ sx = hx&0x8000000000000000ULL;
+ hp &= 0x7fffffffffffffffLL;
+ hx &= 0x7fffffffffffffffLL;
+
+ /* purge off exception values */
+ if((hp|(lp&0x7fffffffffffffff))==0) return (x*p)/(x*p); /* p = 0 */
+ if((hx>=0x7ff0000000000000LL)|| /* x not finite */
+ ((hp>=0x7ff0000000000000LL)&& /* p is NaN */
+ (((hp-0x7ff0000000000000LL)|lp)!=0)))
+ return (x*p)/(x*p);
+
+
+ if (hp<=0x7fdfffffffffffffLL) x = __ieee754_fmodl(x,p+p); /* now x < 2p */
+ if (((hx-hp)|(lx-lp))==0) return zero*x;
+ x = fabsl(x);
+ p = fabsl(p);
+ if (hp<0x0020000000000000LL) {
+ if(x+x>p) {
+ x-=p;
+ if(x+x>=p) x -= p;
+ }
+ } else {
+ p_half = 0.5L*p;
+ if(x>p_half) {
+ x-=p;
+ if(x>=p_half) x -= p;
+ }
+ }
+ GET_LDOUBLE_MSW64(hx,x);
+ SET_LDOUBLE_MSW64(x,hx^sx);
+ return x;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c b/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
new file mode 100644
index 0000000000..38ae71d4b7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
@@ -0,0 +1,84 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $";
+#endif
+
+/* __ieee754_sinh(x)
+ * Method :
+ * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
+ * 1. Replace x by |x| (sinh(-x) = -sinh(x)).
+ * 2.
+ * E + E/(E+1)
+ * 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x)
+ * 2
+ *
+ * 22 <= x <= lnovft : sinh(x) := exp(x)/2
+ * lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2)
+ * ln2ovft < x : sinh(x) := x*shuge (overflow)
+ *
+ * Special cases:
+ * sinh(x) is |x| if x is +INF, -INF, or NaN.
+ * only sinh(0)=0 is exact for finite x.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double one = 1.0, shuge = 1.0e307;
+#else
+static long double one = 1.0, shuge = 1.0e307;
+#endif
+
+#ifdef __STDC__
+ long double __ieee754_sinhl(long double x)
+#else
+ long double __ieee754_sinhl(x)
+ long double x;
+#endif
+{
+ long double t,w,h;
+ int64_t ix,jx;
+
+ /* High word of |x|. */
+ GET_LDOUBLE_MSW64(jx,x);
+ ix = jx&0x7fffffffffffffffLL;
+
+ /* x is INF or NaN */
+ if(ix>=0x7ff0000000000000LL) return x+x;
+
+ h = 0.5;
+ if (jx<0) h = -h;
+ /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */
+ if (ix < 0x4036000000000000LL) { /* |x|<22 */
+ if (ix<0x3e20000000000000LL) /* |x|<2**-29 */
+ if(shuge+x>one) return x;/* sinhl(tiny) = tiny with inexact */
+ t = __expm1l(fabsl(x));
+ if(ix<0x3ff0000000000000LL) return h*(2.0*t-t*t/(t+one));
+ return h*(t+t/(t+one));
+ }
+
+ /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */
+ if (ix < 0x40862e42fefa39efLL) return h*__ieee754_expl(fabsl(x));
+
+ /* |x| in [log(maxdouble), overflowthresold] */
+ if (ix <= 0x408633ce8fb9f87dLL) {
+ w = __ieee754_expl(0.5*fabsl(x));
+ t = h*w;
+ return t*w;
+ }
+
+ /* |x| > overflowthresold, sinh(x) overflow */
+ return x*shuge;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c b/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
new file mode 100644
index 0000000000..1f533cae42
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
@@ -0,0 +1,109 @@
+/*
+ * IBM Accurate Mathematical Library
+ * written by International Business Machines Corp.
+ * Copyright (C) 2001, 2004, 2006 Free Software Foundation
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+/*********************************************************************/
+/* MODULE_NAME: uroot.c */
+/* */
+/* FUNCTION: usqrt */
+/* */
+/* FILES NEEDED: dla.h endian.h mydefs.h uroot.h */
+/* uroot.tbl */
+/* */
+/* An ultimate sqrt routine. Given an IEEE double machine number x */
+/* it computes the correctly rounded (to nearest) value of square */
+/* root of x. */
+/* Assumption: Machine arithmetic operations are performed in */
+/* round to nearest mode of IEEE 754 standard. */
+/* */
+/*********************************************************************/
+
+#include <math_private.h>
+
+typedef unsigned int int4;
+typedef union {int4 i[4]; long double x; double d[2]; } mynumber;
+
+static const mynumber
+ t512 = {{0x5ff00000, 0x00000000, 0x00000000, 0x00000000 }}, /* 2^512 */
+ tm256 = {{0x2ff00000, 0x00000000, 0x00000000, 0x00000000 }}; /* 2^-256 */
+static const double
+two54 = 1.80143985094819840000e+16, /* 0x4350000000000000 */
+twom54 = 5.55111512312578270212e-17; /* 0x3C90000000000000 */
+
+/*********************************************************************/
+/* An ultimate sqrt routine. Given an IEEE double machine number x */
+/* it computes the correctly rounded (to nearest) value of square */
+/* root of x. */
+/*********************************************************************/
+long double __ieee754_sqrtl(long double x)
+{
+ static const long double big = 134217728.0, big1 = 134217729.0;
+ long double t,s,i;
+ mynumber a,c;
+ int4 k, l, m;
+ int n;
+ double d;
+
+ a.x=x;
+ k=a.i[0] & 0x7fffffff;
+ /*----------------- 2^-1022 <= | x |< 2^1024 -----------------*/
+ if (k>0x000fffff && k<0x7ff00000) {
+ if (x < 0) return (big1-big1)/(big-big);
+ l = (k&0x001fffff)|0x3fe00000;
+ if (((a.i[2] & 0x7fffffff) | a.i[3]) != 0) {
+ n = (int) ((l - k) * 2) >> 21;
+ m = (a.i[2] >> 20) & 0x7ff;
+ if (m == 0) {
+ a.d[1] *= two54;
+ m = ((a.i[2] >> 20) & 0x7ff) - 54;
+ }
+ m += n;
+ if (m > 0)
+ a.i[2] = (a.i[2] & 0x800fffff) | (m << 20);
+ else if (m <= -54) {
+ a.i[2] &= 0x80000000;
+ a.i[3] = 0;
+ } else {
+ m += 54;
+ a.i[2] = (a.i[2] & 0x800fffff) | (m << 20);
+ a.d[1] *= twom54;
+ }
+ }
+ a.i[0] = l;
+ s = a.x;
+ d = __ieee754_sqrt (a.d[0]);
+ c.i[0] = 0x20000000+((k&0x7fe00000)>>1);
+ c.i[1] = 0;
+ c.i[2] = 0;
+ c.i[3] = 0;
+ i = d;
+ t = 0.5L * (i + s / i);
+ i = 0.5L * (t + s / t);
+ return c.x * i;
+ }
+ else {
+ if (k>=0x7ff00000) {
+ if (a.i[0] == 0xfff00000 && a.i[1] == 0)
+ return (big1-big1)/(big-big); /* sqrt (-Inf) = NaN. */
+ return x; /* sqrt (NaN) = NaN, sqrt (+Inf) = +Inf. */
+ }
+ if (x == 0) return x;
+ if (x < 0) return (big1-big1)/(big-big);
+ return tm256.x*__ieee754_sqrtl(x*t512.x);
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/ieee754.h b/sysdeps/ieee754/ldbl-128ibm/ieee754.h
new file mode 100644
index 0000000000..94a2091c84
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/ieee754.h
@@ -0,0 +1,210 @@
+/* Copyright (C) 1992, 1995, 1996, 1999, 2004, 2006
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _IEEE754_H
+
+#define _IEEE754_H 1
+#include <features.h>
+
+#include <endian.h>
+
+__BEGIN_DECLS
+
+union ieee754_float
+ {
+ float f;
+
+ /* This is the IEEE 754 single-precision format. */
+ struct
+ {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int negative:1;
+ unsigned int exponent:8;
+ unsigned int mantissa:23;
+#endif /* Big endian. */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned int mantissa:23;
+ unsigned int exponent:8;
+ unsigned int negative:1;
+#endif /* Little endian. */
+ } ieee;
+
+ /* This format makes it easier to see if a NaN is a signalling NaN. */
+ struct
+ {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int negative:1;
+ unsigned int exponent:8;
+ unsigned int quiet_nan:1;
+ unsigned int mantissa:22;
+#endif /* Big endian. */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned int mantissa:22;
+ unsigned int quiet_nan:1;
+ unsigned int exponent:8;
+ unsigned int negative:1;
+#endif /* Little endian. */
+ } ieee_nan;
+ };
+
+#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */
+
+
+union ieee754_double
+ {
+ double d;
+
+ /* This is the IEEE 754 double-precision format. */
+ struct
+ {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int negative:1;
+ unsigned int exponent:11;
+ /* Together these comprise the mantissa. */
+ unsigned int mantissa0:20;
+ unsigned int mantissa1:32;
+#endif /* Big endian. */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ /* Together these comprise the mantissa. */
+ unsigned int mantissa1:32;
+ unsigned int mantissa0:20;
+ unsigned int exponent:11;
+ unsigned int negative:1;
+#endif /* Little endian. */
+ } ieee;
+
+ /* This format makes it easier to see if a NaN is a signalling NaN. */
+ struct
+ {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int negative:1;
+ unsigned int exponent:11;
+ unsigned int quiet_nan:1;
+ /* Together these comprise the mantissa. */
+ unsigned int mantissa0:19;
+ unsigned int mantissa1:32;
+#else
+ /* Together these comprise the mantissa. */
+ unsigned int mantissa1:32;
+ unsigned int mantissa0:19;
+ unsigned int quiet_nan:1;
+ unsigned int exponent:11;
+ unsigned int negative:1;
+#endif
+ } ieee_nan;
+ };
+
+#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */
+
+
+union ieee854_long_double
+ {
+ long double d;
+
+ /* This is the IEEE 854 quad-precision format. */
+ struct
+ {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int negative:1;
+ unsigned int exponent:15;
+ /* Together these comprise the mantissa. */
+ unsigned int mantissa0:16;
+ unsigned int mantissa1:32;
+ unsigned int mantissa2:32;
+ unsigned int mantissa3:32;
+#endif /* Big endian. */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ /* Together these comprise the mantissa. */
+ unsigned int mantissa3:32;
+ unsigned int mantissa2:32;
+ unsigned int mantissa1:32;
+ unsigned int mantissa0:16;
+ unsigned int exponent:15;
+ unsigned int negative:1;
+#endif /* Little endian. */
+ } ieee;
+
+ /* This format makes it easier to see if a NaN is a signalling NaN. */
+ struct
+ {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int negative:1;
+ unsigned int exponent:15;
+ unsigned int quiet_nan:1;
+ /* Together these comprise the mantissa. */
+ unsigned int mantissa0:15;
+ unsigned int mantissa1:32;
+ unsigned int mantissa2:32;
+ unsigned int mantissa3:32;
+#else
+ /* Together these comprise the mantissa. */
+ unsigned int mantissa3:32;
+ unsigned int mantissa2:32;
+ unsigned int mantissa1:32;
+ unsigned int mantissa0:15;
+ unsigned int quiet_nan:1;
+ unsigned int exponent:15;
+ unsigned int negative:1;
+#endif
+ } ieee_nan;
+ };
+
+#define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent. */
+
+
+/* IBM extended format for long double.
+
+ Each long double is made up of two IEEE doubles. The value of the
+ long double is the sum of the values of the two parts. The most
+ significant part is required to be the value of the long double
+ rounded to the nearest double, as specified by IEEE. For Inf
+ values, the least significant part is required to be one of +0.0 or
+ -0.0. No other requirements are made; so, for example, 1.0 may be
+ represented as (1.0, +0.0) or (1.0, -0.0), and the low part of a
+ NaN is don't-care. */
+
+union ibm_extended_long_double
+ {
+ long double d;
+ double dd[2];
+
+ /* This is the IBM extended format long double. */
+ struct
+ { /* Big endian. There is no other. */
+
+ unsigned int negative:1;
+ unsigned int exponent:11;
+ /* Together Mantissa0-3 comprise the mantissa. */
+ unsigned int mantissa0:20;
+ unsigned int mantissa1:32;
+
+ unsigned int negative2:1;
+ unsigned int exponent2:11;
+ /* There is an implied 1 here? */
+ /* Together these comprise the mantissa. */
+ unsigned int mantissa2:20;
+ unsigned int mantissa3:32;
+ } ieee;
+ };
+
+#define IBM_EXTENDED_LONG_DOUBLE_BIAS 0x3ff /* Added to exponent. */
+
+__END_DECLS
+
+#endif /* ieee754.h */
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_cosl.c b/sysdeps/ieee754/ldbl-128ibm/k_cosl.c
new file mode 100644
index 0000000000..3baf8b7b66
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/k_cosl.c
@@ -0,0 +1,128 @@
+/* Quad-precision floating point cosine on <-pi/4,pi/4>.
+ Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double c[] = {
+#define ONE c[0]
+ 1.00000000000000000000000000000000000E+00L, /* 3fff0000000000000000000000000000 */
+
+/* cos x ~ ONE + x^2 ( SCOS1 + SCOS2 * x^2 + ... + SCOS4 * x^6 + SCOS5 * x^8 )
+ x in <0,1/256> */
+#define SCOS1 c[1]
+#define SCOS2 c[2]
+#define SCOS3 c[3]
+#define SCOS4 c[4]
+#define SCOS5 c[5]
+-5.00000000000000000000000000000000000E-01L, /* bffe0000000000000000000000000000 */
+ 4.16666666666666666666666666556146073E-02L, /* 3ffa5555555555555555555555395023 */
+-1.38888888888888888888309442601939728E-03L, /* bff56c16c16c16c16c16a566e42c0375 */
+ 2.48015873015862382987049502531095061E-05L, /* 3fefa01a01a019ee02dcf7da2d6d5444 */
+-2.75573112601362126593516899592158083E-07L, /* bfe927e4f5dce637cb0b54908754bde0 */
+
+/* cos x ~ ONE + x^2 ( COS1 + COS2 * x^2 + ... + COS7 * x^12 + COS8 * x^14 )
+ x in <0,0.1484375> */
+#define COS1 c[6]
+#define COS2 c[7]
+#define COS3 c[8]
+#define COS4 c[9]
+#define COS5 c[10]
+#define COS6 c[11]
+#define COS7 c[12]
+#define COS8 c[13]
+-4.99999999999999999999999999999999759E-01L, /* bffdfffffffffffffffffffffffffffb */
+ 4.16666666666666666666666666651287795E-02L, /* 3ffa5555555555555555555555516f30 */
+-1.38888888888888888888888742314300284E-03L, /* bff56c16c16c16c16c16c16a463dfd0d */
+ 2.48015873015873015867694002851118210E-05L, /* 3fefa01a01a01a01a0195cebe6f3d3a5 */
+-2.75573192239858811636614709689300351E-07L, /* bfe927e4fb7789f5aa8142a22044b51f */
+ 2.08767569877762248667431926878073669E-09L, /* 3fe21eed8eff881d1e9262d7adff4373 */
+-1.14707451049343817400420280514614892E-11L, /* bfda9397496922a9601ed3d4ca48944b */
+ 4.77810092804389587579843296923533297E-14L, /* 3fd2ae5f8197cbcdcaf7c3fb4523414c */
+
+/* sin x ~ ONE * x + x^3 ( SSIN1 + SSIN2 * x^2 + ... + SSIN4 * x^6 + SSIN5 * x^8 )
+ x in <0,1/256> */
+#define SSIN1 c[14]
+#define SSIN2 c[15]
+#define SSIN3 c[16]
+#define SSIN4 c[17]
+#define SSIN5 c[18]
+-1.66666666666666666666666666666666659E-01L, /* bffc5555555555555555555555555555 */
+ 8.33333333333333333333333333146298442E-03L, /* 3ff81111111111111111111110fe195d */
+-1.98412698412698412697726277416810661E-04L, /* bff2a01a01a01a01a019e7121e080d88 */
+ 2.75573192239848624174178393552189149E-06L, /* 3fec71de3a556c640c6aaa51aa02ab41 */
+-2.50521016467996193495359189395805639E-08L, /* bfe5ae644ee90c47dc71839de75b2787 */
+};
+
+#define SINCOSL_COS_HI 0
+#define SINCOSL_COS_LO 1
+#define SINCOSL_SIN_HI 2
+#define SINCOSL_SIN_LO 3
+extern const long double __sincosl_table[];
+
+long double
+__kernel_cosl(long double x, long double y)
+{
+ long double h, l, z, sin_l, cos_l_m1;
+ int64_t ix;
+ u_int32_t tix, hix, index;
+ GET_LDOUBLE_MSW64 (ix, x);
+ tix = ((u_int64_t)ix) >> 32;
+ tix &= ~0x80000000; /* tix = |x|'s high 32 bits */
+ if (tix < 0x3fc30000) /* |x| < 0.1484375 */
+ {
+ /* Argument is small enough to approximate it by a Chebyshev
+ polynomial of degree 16. */
+ if (tix < 0x3c600000) /* |x| < 2^-57 */
+ if (!((int)x)) return ONE; /* generate inexact */
+ z = x * x;
+ return ONE + (z*(COS1+z*(COS2+z*(COS3+z*(COS4+
+ z*(COS5+z*(COS6+z*(COS7+z*COS8))))))));
+ }
+ else
+ {
+ /* So that we don't have to use too large polynomial, we find
+ l and h such that x = l + h, where fabsl(l) <= 1.0/256 with 83
+ possible values for h. We look up cosl(h) and sinl(h) in
+ pre-computed tables, compute cosl(l) and sinl(l) using a
+ Chebyshev polynomial of degree 10(11) and compute
+ cosl(h+l) = cosl(h)cosl(l) - sinl(h)sinl(l). */
+ index = 0x3fe - (tix >> 20);
+ hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
+ x = fabsl (x);
+ switch (index)
+ {
+ case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break;
+ case 1: index = ((13 << 15) + hix - 0x3fd00000) >> 13; break;
+ default:
+ case 2: index = (hix - 0x3fc30000) >> 14; break;
+ }
+
+ SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+ l = y - (h - x);
+ z = l * l;
+ sin_l = l*(ONE+z*(SSIN1+z*(SSIN2+z*(SSIN3+z*(SSIN4+z*SSIN5)))));
+ cos_l_m1 = z*(SCOS1+z*(SCOS2+z*(SCOS3+z*(SCOS4+z*SCOS5))));
+ return __sincosl_table [index + SINCOSL_COS_HI]
+ + (__sincosl_table [index + SINCOSL_COS_LO]
+ - (__sincosl_table [index + SINCOSL_SIN_HI] * sin_l
+ - __sincosl_table [index + SINCOSL_COS_HI] * cos_l_m1));
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c b/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c
new file mode 100644
index 0000000000..1cea6fef6e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c
@@ -0,0 +1,163 @@
+/* Quad-precision floating point sine and cosine on <-pi/4,pi/4>.
+ Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double c[] = {
+#define ONE c[0]
+ 1.00000000000000000000000000000000000E+00L, /* 3fff0000000000000000000000000000 */
+
+/* cos x ~ ONE + x^2 ( SCOS1 + SCOS2 * x^2 + ... + SCOS4 * x^6 + SCOS5 * x^8 )
+ x in <0,1/256> */
+#define SCOS1 c[1]
+#define SCOS2 c[2]
+#define SCOS3 c[3]
+#define SCOS4 c[4]
+#define SCOS5 c[5]
+-5.00000000000000000000000000000000000E-01L, /* bffe0000000000000000000000000000 */
+ 4.16666666666666666666666666556146073E-02L, /* 3ffa5555555555555555555555395023 */
+-1.38888888888888888888309442601939728E-03L, /* bff56c16c16c16c16c16a566e42c0375 */
+ 2.48015873015862382987049502531095061E-05L, /* 3fefa01a01a019ee02dcf7da2d6d5444 */
+-2.75573112601362126593516899592158083E-07L, /* bfe927e4f5dce637cb0b54908754bde0 */
+
+/* cos x ~ ONE + x^2 ( COS1 + COS2 * x^2 + ... + COS7 * x^12 + COS8 * x^14 )
+ x in <0,0.1484375> */
+#define COS1 c[6]
+#define COS2 c[7]
+#define COS3 c[8]
+#define COS4 c[9]
+#define COS5 c[10]
+#define COS6 c[11]
+#define COS7 c[12]
+#define COS8 c[13]
+-4.99999999999999999999999999999999759E-01L, /* bffdfffffffffffffffffffffffffffb */
+ 4.16666666666666666666666666651287795E-02L, /* 3ffa5555555555555555555555516f30 */
+-1.38888888888888888888888742314300284E-03L, /* bff56c16c16c16c16c16c16a463dfd0d */
+ 2.48015873015873015867694002851118210E-05L, /* 3fefa01a01a01a01a0195cebe6f3d3a5 */
+-2.75573192239858811636614709689300351E-07L, /* bfe927e4fb7789f5aa8142a22044b51f */
+ 2.08767569877762248667431926878073669E-09L, /* 3fe21eed8eff881d1e9262d7adff4373 */
+-1.14707451049343817400420280514614892E-11L, /* bfda9397496922a9601ed3d4ca48944b */
+ 4.77810092804389587579843296923533297E-14L, /* 3fd2ae5f8197cbcdcaf7c3fb4523414c */
+
+/* sin x ~ ONE * x + x^3 ( SSIN1 + SSIN2 * x^2 + ... + SSIN4 * x^6 + SSIN5 * x^8 )
+ x in <0,1/256> */
+#define SSIN1 c[14]
+#define SSIN2 c[15]
+#define SSIN3 c[16]
+#define SSIN4 c[17]
+#define SSIN5 c[18]
+-1.66666666666666666666666666666666659E-01L, /* bffc5555555555555555555555555555 */
+ 8.33333333333333333333333333146298442E-03L, /* 3ff81111111111111111111110fe195d */
+-1.98412698412698412697726277416810661E-04L, /* bff2a01a01a01a01a019e7121e080d88 */
+ 2.75573192239848624174178393552189149E-06L, /* 3fec71de3a556c640c6aaa51aa02ab41 */
+-2.50521016467996193495359189395805639E-08L, /* bfe5ae644ee90c47dc71839de75b2787 */
+
+/* sin x ~ ONE * x + x^3 ( SIN1 + SIN2 * x^2 + ... + SIN7 * x^12 + SIN8 * x^14 )
+ x in <0,0.1484375> */
+#define SIN1 c[19]
+#define SIN2 c[20]
+#define SIN3 c[21]
+#define SIN4 c[22]
+#define SIN5 c[23]
+#define SIN6 c[24]
+#define SIN7 c[25]
+#define SIN8 c[26]
+-1.66666666666666666666666666666666538e-01L, /* bffc5555555555555555555555555550 */
+ 8.33333333333333333333333333307532934e-03L, /* 3ff811111111111111111111110e7340 */
+-1.98412698412698412698412534478712057e-04L, /* bff2a01a01a01a01a01a019e7a626296 */
+ 2.75573192239858906520896496653095890e-06L, /* 3fec71de3a556c7338fa38527474b8f5 */
+-2.50521083854417116999224301266655662e-08L, /* bfe5ae64567f544e16c7de65c2ea551f */
+ 1.60590438367608957516841576404938118e-10L, /* 3fde6124613a811480538a9a41957115 */
+-7.64716343504264506714019494041582610e-13L, /* bfd6ae7f3d5aef30c7bc660b060ef365 */
+ 2.81068754939739570236322404393398135e-15L, /* 3fce9510115aabf87aceb2022a9a9180 */
+};
+
+#define SINCOSL_COS_HI 0
+#define SINCOSL_COS_LO 1
+#define SINCOSL_SIN_HI 2
+#define SINCOSL_SIN_LO 3
+extern const long double __sincosl_table[];
+
+void
+__kernel_sincosl(long double x, long double y, long double *sinx, long double *cosx, int iy)
+{
+ long double h, l, z, sin_l, cos_l_m1;
+ int64_t ix;
+ u_int32_t tix, hix, index;
+ GET_LDOUBLE_MSW64 (ix, x);
+ tix = ((u_int64_t)ix) >> 32;
+ tix &= ~0x80000000; /* tix = |x|'s high 32 bits */
+ if (tix < 0x3fc30000) /* |x| < 0.1484375 */
+ {
+ /* Argument is small enough to approximate it by a Chebyshev
+ polynomial of degree 16(17). */
+ if (tix < 0x3c600000) /* |x| < 2^-57 */
+ if (!((int)x)) /* generate inexact */
+ {
+ *sinx = x;
+ *cosx = ONE;
+ return;
+ }
+ z = x * x;
+ *sinx = x + (x * (z*(SIN1+z*(SIN2+z*(SIN3+z*(SIN4+
+ z*(SIN5+z*(SIN6+z*(SIN7+z*SIN8)))))))));
+ *cosx = ONE + (z*(COS1+z*(COS2+z*(COS3+z*(COS4+
+ z*(COS5+z*(COS6+z*(COS7+z*COS8))))))));
+ }
+ else
+ {
+ /* So that we don't have to use too large polynomial, we find
+ l and h such that x = l + h, where fabsl(l) <= 1.0/256 with 83
+ possible values for h. We look up cosl(h) and sinl(h) in
+ pre-computed tables, compute cosl(l) and sinl(l) using a
+ Chebyshev polynomial of degree 10(11) and compute
+ sinl(h+l) = sinl(h)cosl(l) + cosl(h)sinl(l) and
+ cosl(h+l) = cosl(h)cosl(l) - sinl(h)sinl(l). */
+ index = 0x3fe - (tix >> 20);
+ hix = (tix + (0x2000 << index)) & (0xffffc000 << index);
+ x = fabsl (x);
+ switch (index)
+ {
+ case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break;
+ case 1: index = ((13 << 15) + hix - 0x3fd00000) >> 13; break;
+ default:
+ case 2: index = (hix - 0x3fc30000) >> 14; break;
+ }
+
+ SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+ if (iy)
+ l = y - (h - x);
+ else
+ l = x - h;
+ z = l * l;
+ sin_l = l*(ONE+z*(SSIN1+z*(SSIN2+z*(SSIN3+z*(SSIN4+z*SSIN5)))));
+ cos_l_m1 = z*(SCOS1+z*(SCOS2+z*(SCOS3+z*(SCOS4+z*SCOS5))));
+ z = __sincosl_table [index + SINCOSL_SIN_HI]
+ + (__sincosl_table [index + SINCOSL_SIN_LO]
+ + (__sincosl_table [index + SINCOSL_SIN_HI] * cos_l_m1)
+ + (__sincosl_table [index + SINCOSL_COS_HI] * sin_l));
+ *sinx = (ix < 0) ? -z : z;
+ *cosx = __sincosl_table [index + SINCOSL_COS_HI]
+ + (__sincosl_table [index + SINCOSL_COS_LO]
+ - (__sincosl_table [index + SINCOSL_SIN_HI] * sin_l
+ - __sincosl_table [index + SINCOSL_COS_HI] * cos_l_m1));
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_sinl.c b/sysdeps/ieee754/ldbl-128ibm/k_sinl.c
new file mode 100644
index 0000000000..c4dce26f9a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/k_sinl.c
@@ -0,0 +1,132 @@
+/* Quad-precision floating point sine on <-pi/4,pi/4>.
+ Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double c[] = {
+#define ONE c[0]
+ 1.00000000000000000000000000000000000E+00L, /* 3fff0000000000000000000000000000 */
+
+/* cos x ~ ONE + x^2 ( SCOS1 + SCOS2 * x^2 + ... + SCOS4 * x^6 + SCOS5 * x^8 )
+ x in <0,1/256> */
+#define SCOS1 c[1]
+#define SCOS2 c[2]
+#define SCOS3 c[3]
+#define SCOS4 c[4]
+#define SCOS5 c[5]
+-5.00000000000000000000000000000000000E-01L, /* bffe0000000000000000000000000000 */
+ 4.16666666666666666666666666556146073E-02L, /* 3ffa5555555555555555555555395023 */
+-1.38888888888888888888309442601939728E-03L, /* bff56c16c16c16c16c16a566e42c0375 */
+ 2.48015873015862382987049502531095061E-05L, /* 3fefa01a01a019ee02dcf7da2d6d5444 */
+-2.75573112601362126593516899592158083E-07L, /* bfe927e4f5dce637cb0b54908754bde0 */
+
+/* sin x ~ ONE * x + x^3 ( SIN1 + SIN2 * x^2 + ... + SIN7 * x^12 + SIN8 * x^14 )
+ x in <0,0.1484375> */
+#define SIN1 c[6]
+#define SIN2 c[7]
+#define SIN3 c[8]
+#define SIN4 c[9]
+#define SIN5 c[10]
+#define SIN6 c[11]
+#define SIN7 c[12]
+#define SIN8 c[13]
+-1.66666666666666666666666666666666538e-01L, /* bffc5555555555555555555555555550 */
+ 8.33333333333333333333333333307532934e-03L, /* 3ff811111111111111111111110e7340 */
+-1.98412698412698412698412534478712057e-04L, /* bff2a01a01a01a01a01a019e7a626296 */
+ 2.75573192239858906520896496653095890e-06L, /* 3fec71de3a556c7338fa38527474b8f5 */
+-2.50521083854417116999224301266655662e-08L, /* bfe5ae64567f544e16c7de65c2ea551f */
+ 1.60590438367608957516841576404938118e-10L, /* 3fde6124613a811480538a9a41957115 */
+-7.64716343504264506714019494041582610e-13L, /* bfd6ae7f3d5aef30c7bc660b060ef365 */
+ 2.81068754939739570236322404393398135e-15L, /* 3fce9510115aabf87aceb2022a9a9180 */
+
+/* sin x ~ ONE * x + x^3 ( SSIN1 + SSIN2 * x^2 + ... + SSIN4 * x^6 + SSIN5 * x^8 )
+ x in <0,1/256> */
+#define SSIN1 c[14]
+#define SSIN2 c[15]
+#define SSIN3 c[16]
+#define SSIN4 c[17]
+#define SSIN5 c[18]
+-1.66666666666666666666666666666666659E-01L, /* bffc5555555555555555555555555555 */
+ 8.33333333333333333333333333146298442E-03L, /* 3ff81111111111111111111110fe195d */
+-1.98412698412698412697726277416810661E-04L, /* bff2a01a01a01a01a019e7121e080d88 */
+ 2.75573192239848624174178393552189149E-06L, /* 3fec71de3a556c640c6aaa51aa02ab41 */
+-2.50521016467996193495359189395805639E-08L, /* bfe5ae644ee90c47dc71839de75b2787 */
+};
+
+#define SINCOSL_COS_HI 0
+#define SINCOSL_COS_LO 1
+#define SINCOSL_SIN_HI 2
+#define SINCOSL_SIN_LO 3
+extern const long double __sincosl_table[];
+
+long double
+__kernel_sinl(long double x, long double y, int iy)
+{
+ long double h, l, z, sin_l, cos_l_m1;
+ int64_t ix;
+ u_int32_t tix, hix, index;
+ GET_LDOUBLE_MSW64 (ix, x);
+ tix = ((u_int64_t)ix) >> 32;
+ tix &= ~0x80000000; /* tix = |x|'s high 32 bits */
+ if (tix < 0x3fc30000) /* |x| < 0.1484375 */
+ {
+ /* Argument is small enough to approximate it by a Chebyshev
+ polynomial of degree 17. */
+ if (tix < 0x3c600000) /* |x| < 2^-57 */
+ if (!((int)x)) return x; /* generate inexact */
+ z = x * x;
+ return x + (x * (z*(SIN1+z*(SIN2+z*(SIN3+z*(SIN4+
+ z*(SIN5+z*(SIN6+z*(SIN7+z*SIN8)))))))));
+ }
+ else
+ {
+ /* So that we don't have to use too large polynomial, we find
+ l and h such that x = l + h, where fabsl(l) <= 1.0/256 with 83
+ possible values for h. We look up cosl(h) and sinl(h) in
+ pre-computed tables, compute cosl(l) and sinl(l) using a
+ Chebyshev polynomial of degree 10(11) and compute
+ sinl(h+l) = sinl(h)cosl(l) + cosl(h)sinl(l). */
+ index = 0x3fe - (tix >> 20);
+ hix = (tix + (0x2000 << index)) & (0xffffc000 << index);
+ x = fabsl (x);
+ switch (index)
+ {
+ case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break;
+ case 1: index = ((13 << 15) + hix - 0x3fd00000) >> 13; break;
+ default:
+ case 2: index = (hix - 0x3fc30000) >> 14; break;
+ }
+
+ SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+ if (iy)
+ l = y - (h - x);
+ else
+ l = x - h;
+ z = l * l;
+ sin_l = l*(ONE+z*(SSIN1+z*(SSIN2+z*(SSIN3+z*(SSIN4+z*SSIN5)))));
+ cos_l_m1 = z*(SCOS1+z*(SCOS2+z*(SCOS3+z*(SCOS4+z*SCOS5))));
+ z = __sincosl_table [index + SINCOSL_SIN_HI]
+ + (__sincosl_table [index + SINCOSL_SIN_LO]
+ + (__sincosl_table [index + SINCOSL_SIN_HI] * cos_l_m1)
+ + (__sincosl_table [index + SINCOSL_COS_HI] * sin_l));
+ return (ix < 0) ? -z : z;
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
new file mode 100644
index 0000000000..6c45b2fc45
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -0,0 +1,164 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ Long double expansions are
+ Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under
+ the following terms:
+
+ This 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.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/* __kernel_tanl( x, y, k )
+ * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854
+ * Input x is assumed to be bounded by ~pi/4 in magnitude.
+ * Input y is the tail of x.
+ * Input k indicates whether tan (if k=1) or
+ * -1/tan (if k= -1) is returned.
+ *
+ * Algorithm
+ * 1. Since tan(-x) = -tan(x), we need only to consider positive x.
+ * 2. if x < 2^-57, return x with inexact if x!=0.
+ * 3. tan(x) is approximated by a rational form x + x^3 / 3 + x^5 R(x^2)
+ * on [0,0.67433].
+ *
+ * Note: tan(x+y) = tan(x) + tan'(x)*y
+ * ~ tan(x) + (1+x*x)*y
+ * Therefore, for better accuracy in computing tan(x+y), let
+ * r = x^3 * R(x^2)
+ * then
+ * tan(x+y) = x + (x^3 / 3 + (x^2 *(r+y)+y))
+ *
+ * 4. For x in [0.67433,pi/4], let y = pi/4 - x, then
+ * tan(x) = tan(pi/4-y) = (1-tan(y))/(1+tan(y))
+ * = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y)))
+ */
+
+#include "math.h"
+#include "math_private.h"
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+ one = 1.0L,
+ pio4hi = 7.8539816339744830961566084581987569936977E-1L,
+ pio4lo = 2.1679525325309452561992610065108379921906E-35L,
+
+ /* tan x = x + x^3 / 3 + x^5 T(x^2)/U(x^2)
+ 0 <= x <= 0.6743316650390625
+ Peak relative error 8.0e-36 */
+ TH = 3.333333333333333333333333333333333333333E-1L,
+ T0 = -1.813014711743583437742363284336855889393E7L,
+ T1 = 1.320767960008972224312740075083259247618E6L,
+ T2 = -2.626775478255838182468651821863299023956E4L,
+ T3 = 1.764573356488504935415411383687150199315E2L,
+ T4 = -3.333267763822178690794678978979803526092E-1L,
+
+ U0 = -1.359761033807687578306772463253710042010E8L,
+ U1 = 6.494370630656893175666729313065113194784E7L,
+ U2 = -4.180787672237927475505536849168729386782E6L,
+ U3 = 8.031643765106170040139966622980914621521E4L,
+ U4 = -5.323131271912475695157127875560667378597E2L;
+ /* 1.000000000000000000000000000000000000000E0 */
+
+
+#ifdef __STDC__
+long double
+__kernel_tanl (long double x, long double y, int iy)
+#else
+long double
+__kernel_tanl (x, y, iy)
+ long double x, y;
+ int iy;
+#endif
+{
+ long double z, r, v, w, s;
+ int32_t ix, sign;
+ ieee854_long_double_shape_type u, u1;
+
+ u.value = x;
+ ix = u.parts32.w0 & 0x7fffffff;
+ if (ix < 0x3c600000) /* x < 2**-57 */
+ {
+ if ((int) x == 0)
+ { /* generate inexact */
+ if ((ix | u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3
+ | (iy + 1)) == 0)
+ return one / fabs (x);
+ else
+ return (iy == 1) ? x : -one / x;
+ }
+ }
+ if (ix >= 0x3fe59420) /* |x| >= 0.6743316650390625 */
+ {
+ if ((u.parts32.w0 & 0x80000000) != 0)
+ {
+ x = -x;
+ y = -y;
+ sign = -1;
+ }
+ else
+ sign = 1;
+ z = pio4hi - x;
+ w = pio4lo - y;
+ x = z + w;
+ y = 0.0;
+ }
+ z = x * x;
+ r = T0 + z * (T1 + z * (T2 + z * (T3 + z * T4)));
+ v = U0 + z * (U1 + z * (U2 + z * (U3 + z * (U4 + z))));
+ r = r / v;
+
+ s = z * x;
+ r = y + z * (s * r + y);
+ r += TH * s;
+ w = x + r;
+ if (ix >= 0x3fe59420)
+ {
+ v = (long double) iy;
+ w = (v - 2.0 * (x - (w * w / (w + v) - r)));
+ if (sign < 0)
+ w = -w;
+ return w;
+ }
+ if (iy == 1)
+ return w;
+ else
+ { /* if allow error up to 2 ulp,
+ simply return -1.0/(x+r) here */
+ /* compute -1.0/(x+r) accurately */
+ u1.value = w;
+ u1.parts32.w2 = 0;
+ u1.parts32.w3 = 0;
+ v = r - (u1.value - x); /* u1+v = r+x */
+ z = -1.0 / w;
+ u.value = z;
+ u.parts32.w2 = 0;
+ u.parts32.w3 = 0;
+ s = 1.0 + u.value * u1.value;
+ return u.value + z * (s + u.value * v);
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c b/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c
new file mode 100644
index 0000000000..18a2e671ad
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c
@@ -0,0 +1,175 @@
+/* Copyright (C) 1995,1996,1997,1998,1999,2002,2003,2006
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+#include <ieee754.h>
+#include <float.h>
+#include <math.h>
+#include <stdlib.h>
+
+/* Convert a `long double' in IBM extended format to a multi-precision
+ integer representing the significand scaled up by its number of
+ bits (106 for long double) and an integral power of two (MPN
+ frexpl). */
+
+mp_size_t
+__mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
+ int *expt, int *is_neg,
+ long double value)
+{
+ union ibm_extended_long_double u;
+ unsigned long long hi, lo;
+ int ediff;
+ u.d = value;
+
+ *is_neg = u.ieee.negative;
+ *expt = (int) u.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS;
+
+ lo = ((long long) u.ieee.mantissa2 << 32) | u.ieee.mantissa3;
+ hi = ((long long) u.ieee.mantissa0 << 32) | u.ieee.mantissa1;
+ /* If the lower double is not a denomal or zero then set the hidden
+ 53rd bit. */
+ if (u.ieee.exponent2 > 0)
+ {
+ lo |= 1LL << 52;
+
+ /* The lower double is normalized separately from the upper. We may
+ need to adjust the lower manitissa to reflect this. */
+ ediff = u.ieee.exponent - u.ieee.exponent2;
+ if (ediff > 53)
+ lo = lo >> (ediff-53);
+ }
+ /* The high double may be rounded and the low double reflects the
+ difference between the long double and the rounded high double
+ value. This is indicated by a differnce between the signs of the
+ high and low doubles. */
+ if ((u.ieee.negative != u.ieee.negative2)
+ && ((u.ieee.exponent2 != 0) && (lo != 0L)))
+ {
+ lo = (1ULL << 53) - lo;
+ if (hi == 0LL)
+ {
+ /* we have a borrow from the hidden bit, so shift left 1. */
+ hi = 0x0ffffffffffffeLL | (lo >> 51);
+ lo = 0x1fffffffffffffLL & (lo << 1);
+ (*expt)--;
+ }
+ else
+ hi--;
+ }
+#if BITS_PER_MP_LIMB == 32
+ /* Combine the mantissas to be contiguous. */
+ res_ptr[0] = lo;
+ res_ptr[1] = (hi << (53 - 32)) | (lo >> 32);
+ res_ptr[2] = hi >> 11;
+ res_ptr[3] = hi >> (32 + 11);
+ #define N 4
+#elif BITS_PER_MP_LIMB == 64
+ /* Combine the two mantissas to be contiguous. */
+ res_ptr[0] = (hi << 53) | lo;
+ res_ptr[1] = hi >> 11;
+ #define N 2
+#else
+ #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
+#endif
+/* The format does not fill the last limb. There are some zeros. */
+#define NUM_LEADING_ZEROS (BITS_PER_MP_LIMB \
+ - (LDBL_MANT_DIG - ((N - 1) * BITS_PER_MP_LIMB)))
+
+ if (u.ieee.exponent == 0)
+ {
+ /* A biased exponent of zero is a special case.
+ Either it is a zero or it is a denormal number. */
+ if (res_ptr[0] == 0 && res_ptr[1] == 0
+ && res_ptr[N - 2] == 0 && res_ptr[N - 1] == 0) /* Assumes N<=4. */
+ /* It's zero. */
+ *expt = 0;
+ else
+ {
+ /* It is a denormal number, meaning it has no implicit leading
+ one bit, and its exponent is in fact the format minimum. */
+ int cnt;
+
+#if N == 2
+ if (res_ptr[N - 1] != 0)
+ {
+ count_leading_zeros (cnt, res_ptr[N - 1]);
+ cnt -= NUM_LEADING_ZEROS;
+ res_ptr[N - 1] = res_ptr[N - 1] << cnt
+ | (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt));
+ res_ptr[0] <<= cnt;
+ *expt = LDBL_MIN_EXP - 1 - cnt;
+ }
+ else
+ {
+ count_leading_zeros (cnt, res_ptr[0]);
+ if (cnt >= NUM_LEADING_ZEROS)
+ {
+ res_ptr[N - 1] = res_ptr[0] << (cnt - NUM_LEADING_ZEROS);
+ res_ptr[0] = 0;
+ }
+ else
+ {
+ res_ptr[N - 1] = res_ptr[0] >> (NUM_LEADING_ZEROS - cnt);
+ res_ptr[0] <<= BITS_PER_MP_LIMB - (NUM_LEADING_ZEROS - cnt);
+ }
+ *expt = LDBL_MIN_EXP - 1
+ - (BITS_PER_MP_LIMB - NUM_LEADING_ZEROS) - cnt;
+ }
+#else
+ int j, k, l;
+
+ for (j = N - 1; j > 0; j--)
+ if (res_ptr[j] != 0)
+ break;
+
+ count_leading_zeros (cnt, res_ptr[j]);
+ cnt -= NUM_LEADING_ZEROS;
+ l = N - 1 - j;
+ if (cnt < 0)
+ {
+ cnt += BITS_PER_MP_LIMB;
+ l--;
+ }
+ if (!cnt)
+ for (k = N - 1; k >= l; k--)
+ res_ptr[k] = res_ptr[k-l];
+ else
+ {
+ for (k = N - 1; k > l; k--)
+ res_ptr[k] = res_ptr[k-l] << cnt
+ | res_ptr[k-l-1] >> (BITS_PER_MP_LIMB - cnt);
+ res_ptr[k--] = res_ptr[0] << cnt;
+ }
+
+ for (; k >= 0; k--)
+ res_ptr[k] = 0;
+ *expt = LDBL_MIN_EXP - 1 - l * BITS_PER_MP_LIMB - cnt;
+#endif
+ }
+ }
+ else
+ /* Add the implicit leading one bit for a normalized number. */
+ res_ptr[N - 1] |= (mp_limb_t) 1 << (LDBL_MANT_DIG - 1
+ - ((N - 1) * BITS_PER_MP_LIMB));
+
+ return N;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
new file mode 100644
index 0000000000..e7e1b963e8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
@@ -0,0 +1,124 @@
+#ifndef _MATH_PRIVATE_H_
+#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
+#endif
+
+#include <sysdeps/ieee754/ldbl-128/math_ldbl.h>
+
+#define EXTRACT_IBM_EXTENDED_MANTISSA(hi64, lo64, expnt, ibm_ext_ldbl) \
+ do \
+ { \
+ /* We have 105 bits of mantissa plus one implicit digit. Since \
+ 106 bits are representable without the rest using hexadecimal \
+ digits we use only the implicit digits for the number before \
+ the decimal point. */ \
+ unsigned long long hi, lo; \
+ int ediff; \
+ union ibm_extended_long_double eldbl; \
+ eldbl.d = ibm_ext_ldbl; \
+ expnt = eldbl.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS; \
+ \
+ lo = ((long long)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3; \
+ hi = ((long long)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1; \
+ /* If the lower double is not a denomal or zero then set the hidden \
+ 53rd bit. */ \
+ if (eldbl.ieee.exponent2 > 0x001) \
+ { \
+ lo |= (1ULL << 52); \
+ lo = lo << 7; /* pre-shift lo to match ieee854. */ \
+ /* The lower double is normalized separately from the upper. We \
+ may need to adjust the lower manitissa to reflect this. */ \
+ ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2; \
+ if (ediff > 53) \
+ lo = lo >> (ediff-53); \
+ } \
+ hi |= (1ULL << 52); \
+ \
+ if ((eldbl.ieee.negative != eldbl.ieee.negative2) \
+ && ((eldbl.ieee.exponent2 != 0) && (lo != 0LL))) \
+ { \
+ hi--; \
+ lo = (1ULL << 60) - lo; \
+ if (hi < (1ULL << 52)) \
+ { \
+ /* we have a borrow from the hidden bit, so shift left 1. */ \
+ hi = (hi << 1) | (lo >> 59); \
+ lo = 0xfffffffffffffffLL & (lo << 1); \
+ expnt--; \
+ } \
+ } \
+ lo64 = (hi << 60) | lo; \
+ hi64 = hi >> 4; \
+ } \
+ while (0)
+
+#define INSERT_IBM_EXTENDED_MANTISSA(ibm_ext_ldbl, sign, expnt, hi64, lo64) \
+ do \
+ { \
+ union ibm_extended_long_double u; \
+ unsigned long hidden2, lzcount; \
+ unsigned long long hi, lo; \
+ \
+ u.ieee.negative = sign; \
+ u.ieee.negative2 = sign; \
+ u.ieee.exponent = expnt + IBM_EXTENDED_LONG_DOUBLE_BIAS; \
+ u.ieee.exponent2 = expnt-53 + IBM_EXTENDED_LONG_DOUBLE_BIAS; \
+ /* Expect 113 bits (112 bits + hidden) right justified in two longs. \
+ The low order 53 bits (52 + hidden) go into the lower double */ \
+ lo = (lo64 >> 7)& ((1ULL << 53) - 1); \
+ hidden2 = (lo64 >> 59) & 1ULL; \
+ /* The high order 53 bits (52 + hidden) go into the upper double */ \
+ hi = (lo64 >> 60) & ((1ULL << 11) - 1); \
+ hi |= (hi64 << 4); \
+ \
+ if (lo != 0LL) \
+ { \
+ /* hidden2 bit of low double controls rounding of the high double. \
+ If hidden2 is '1' then round up hi and adjust lo (2nd mantissa) \
+ plus change the sign of the low double to compensate. */ \
+ if (hidden2) \
+ { \
+ hi++; \
+ u.ieee.negative2 = !sign; \
+ lo = (1ULL << 53) - lo; \
+ } \
+ /* The hidden bit of the lo mantissa is zero so we need to \
+ normalize the it for the low double. Shift it left until the \
+ hidden bit is '1' then adjust the 2nd exponent accordingly. */ \
+ \
+ if (sizeof (lo) == sizeof (long)) \
+ lzcount = __builtin_clzl (lo); \
+ else if ((lo >> 32) != 0) \
+ lzcount = __builtin_clzl ((long) (lo >> 32)); \
+ else \
+ lzcount = __builtin_clzl ((long) lo) + 32; \
+ lzcount = lzcount - 11; \
+ if (lzcount > 0) \
+ { \
+ int expnt2 = u.ieee.exponent2 - lzcount; \
+ if (expnt2 >= 1) \
+ { \
+ /* Not denormal. Normalize and set low exponent. */ \
+ lo = lo << lzcount; \
+ u.ieee.exponent2 = expnt2; \
+ } \
+ else \
+ { \
+ /* Is denormal. */ \
+ lo = lo << (lzcount + expnt2); \
+ u.ieee.exponent2 = 0; \
+ } \
+ } \
+ } \
+ else \
+ { \
+ u.ieee.negative2 = 0; \
+ u.ieee.exponent2 = 0; \
+ } \
+ \
+ u.ieee.mantissa3 = lo & ((1ULL << 32) - 1); \
+ u.ieee.mantissa2 = (lo >> 32) & ((1ULL << 20) - 1); \
+ u.ieee.mantissa1 = hi & ((1ULL << 32) - 1); \
+ u.ieee.mantissa0 = (hi >> 32) & ((1ULL << 20) - 1); \
+ ibm_ext_ldbl = u.d; \
+ } \
+ while (0)
diff --git a/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c b/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
new file mode 100644
index 0000000000..8a2d45e2d8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
@@ -0,0 +1,103 @@
+/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004, 2006
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include <ieee754.h>
+#include <float.h>
+#include <math.h>
+
+/* Convert a multi-precision integer of the needed number of bits (106
+ for long double) and an integral power of two to a `long double' in
+ IBM extended format. */
+
+long double
+__mpn_construct_long_double (mp_srcptr frac_ptr, int expt, int sign)
+{
+ union ibm_extended_long_double u;
+ unsigned long hidden2, lzcount;
+ unsigned long long hi, lo;
+
+ u.ieee.negative = sign;
+ u.ieee.negative2 = sign;
+ u.ieee.exponent = expt + IBM_EXTENDED_LONG_DOUBLE_BIAS;
+ u.ieee.exponent2 = expt - 53 + IBM_EXTENDED_LONG_DOUBLE_BIAS;
+
+#if BITS_PER_MP_LIMB == 32
+ /* The low order 53 bits (52 + hidden) go into the lower double */
+ lo = frac_ptr[0];
+ lo |= (frac_ptr[1] & ((1LL << (53 - 32)) - 1)) << 32;
+ hidden2 = (frac_ptr[1] >> (52 - 32)) & ((mp_limb_t) 1);
+ /* The high order 53 bits (52 + hidden) go into the upper double */
+ hi = (frac_ptr[1] >> (53 - 32)) & ((1 << 11) - 1);
+ hi |= ((unsigned long long) frac_ptr[2]) << 11;
+ hi |= ((unsigned long long) frac_ptr[3]) << (32 + 11);
+#elif BITS_PER_MP_LIMB == 64
+ /* The low order 53 bits (52 + hidden) go into the lower double */
+ lo = frac_ptr[0] & (((mp_limb_t) 1 << 53) - 1);
+ hidden2 = (frac_ptr[0] >> 52) & ((mp_limb_t) 1);
+ /* The high order 53 bits (52 + hidden) go into the upper double */
+ hi = (frac_ptr[0] >> 53) & (((mp_limb_t) 1 << 11) - 1);
+ hi |= (frac_ptr[1] << 11);
+#else
+ #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
+#endif
+
+ if (lo != 0L)
+ {
+ /* hidden2 bit of low double controls rounding of the high double.
+ If hidden2 is '1' then round up hi and adjust lo (2nd mantissa)
+ plus change the sign of the low double to compensate. */
+ if (hidden2)
+ {
+ hi++;
+ u.ieee.negative2 = !sign;
+ lo = (1LL << 53) - lo;
+ }
+
+ /* The hidden bit of the lo mantissa is zero so we need to normalize
+ it for the low double. Shift it left until the hidden bit is '1'
+ then adjust the 2nd exponent accordingly. */
+
+ if (sizeof (lo) == sizeof (long))
+ lzcount = __builtin_clzl (lo);
+ else if ((lo >> 32) != 0)
+ lzcount = __builtin_clzl ((long) (lo >> 32));
+ else
+ lzcount = __builtin_clzl ((long) lo) + 32;
+ lzcount = lzcount - 11;
+ if (lzcount > 0)
+ {
+ lo = lo << lzcount;
+ u.ieee.exponent2 = u.ieee.exponent2 - lzcount;
+ }
+ }
+ else
+ {
+ u.ieee.negative2 = 0;
+ u.ieee.exponent2 = 0;
+ }
+
+ u.ieee.mantissa3 = lo & 0xffffffffLL;
+ u.ieee.mantissa2 = (lo >> 32) & 0xffffff;
+ u.ieee.mantissa1 = hi & 0xffffffffLL;
+ u.ieee.mantissa0 = (hi >> 32) & ((1LL << (LDBL_MANT_DIG - 86)) - 1);
+
+ return u.d;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c b/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
new file mode 100644
index 0000000000..2a7b70fabf
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
@@ -0,0 +1,138 @@
+/* Print floating point number in hexadecimal notation according to ISO C99.
+ Copyright (C) 1997,1998,1999,2000,2001,2002,2004,2006
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define PRINT_FPHEX_LONG_DOUBLE \
+do { \
+ /* We have 105 bits of mantissa plus one implicit digit. Since \
+ 106 bits are representable without rest using hexadecimal \
+ digits we use only the implicit digits for the number before \
+ the decimal point. */ \
+ unsigned long long int num0, num1; \
+ unsigned long long hi, lo; \
+ int ediff; \
+ union ibm_extended_long_double eldbl; \
+ eldbl.d = fpnum.ldbl.d; \
+ \
+ assert (sizeof (long double) == 16); \
+ \
+ lo = ((long long)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3; \
+ hi = ((long long)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1; \
+ /* If the lower double is not a denomal or zero then set the hidden \
+ 53rd bit. */ \
+ if (eldbl.ieee.exponent2 > 0x001) \
+ { \
+ lo |= (1ULL << 52); \
+ lo = lo << 7; /* pre-shift lo to match ieee854. */ \
+ /* The lower double is normalized separately from the upper. We \
+ may need to adjust the lower manitissa to reflect this. */ \
+ ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2; \
+ if (ediff > 53) \
+ lo = lo >> (ediff-53); \
+ } \
+ \
+ if ((eldbl.ieee.negative != eldbl.ieee.negative2) \
+ && ((eldbl.ieee.exponent2 != 0) && (lo != 0L))) \
+ { \
+ lo = (1ULL << 60) - lo; \
+ if (hi == 0L) \
+ { \
+ /* we have a borrow from the hidden bit, so shift left 1. */ \
+ hi = 0xffffffffffffeLL | (lo >> 59); \
+ lo = 0xfffffffffffffffLL & (lo << 1); \
+ eldbl.ieee.exponent--; \
+ } \
+ else \
+ hi--; \
+ } \
+ num1 = (hi << 60) | lo; \
+ num0 = hi >> 4; \
+ \
+ zero_mantissa = (num0|num1) == 0; \
+ \
+ if (sizeof (unsigned long int) > 6) \
+ { \
+ numstr = _itoa_word (num1, numbuf + sizeof numbuf, 16, \
+ info->spec == 'A'); \
+ wnumstr = _itowa_word (num1, \
+ wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t),\
+ 16, info->spec == 'A'); \
+ } \
+ else \
+ { \
+ numstr = _itoa (num1, numbuf + sizeof numbuf, 16, \
+ info->spec == 'A'); \
+ wnumstr = _itowa (num1, \
+ wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t), \
+ 16, info->spec == 'A'); \
+ } \
+ \
+ while (numstr > numbuf + (sizeof numbuf - 64 / 4)) \
+ { \
+ *--numstr = '0'; \
+ *--wnumstr = L'0'; \
+ } \
+ \
+ if (sizeof (unsigned long int) > 6) \
+ { \
+ numstr = _itoa_word (num0, numstr, 16, info->spec == 'A'); \
+ wnumstr = _itowa_word (num0, wnumstr, 16, info->spec == 'A'); \
+ } \
+ else \
+ { \
+ numstr = _itoa (num0, numstr, 16, info->spec == 'A'); \
+ wnumstr = _itowa (num0, wnumstr, 16, info->spec == 'A'); \
+ } \
+ \
+ /* Fill with zeroes. */ \
+ while (numstr > numbuf + (sizeof numbuf - 112 / 4)) \
+ { \
+ *--numstr = '0'; \
+ *--wnumstr = L'0'; \
+ } \
+ \
+ leading = eldbl.ieee.exponent == 0 ? '0' : '1'; \
+ \
+ exponent = eldbl.ieee.exponent; \
+ \
+ if (exponent == 0) \
+ { \
+ if (zero_mantissa) \
+ expnegative = 0; \
+ else \
+ { \
+ /* This is a denormalized number. */ \
+ expnegative = 1; \
+ exponent = IBM_EXTENDED_LONG_DOUBLE_BIAS - 1; \
+ } \
+ } \
+ else if (exponent >= IBM_EXTENDED_LONG_DOUBLE_BIAS) \
+ { \
+ expnegative = 0; \
+ exponent -= IBM_EXTENDED_LONG_DOUBLE_BIAS; \
+ } \
+ else \
+ { \
+ expnegative = 1; \
+ exponent = -(exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS); \
+ } \
+} while (0)
+
+#include <stdio-common/printf_fphex.c>
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c b/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c
new file mode 100644
index 0000000000..d1b63bb909
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c
@@ -0,0 +1,67 @@
+/* @(#)s_asinh.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_asinh.c,v 1.9 1995/05/12 04:57:37 jtc Exp $";
+#endif
+
+/* asinh(x)
+ * Method :
+ * Based on
+ * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ]
+ * we have
+ * asinh(x) := x if 1+x*x=1,
+ * := sign(x)*(log(x)+ln2)) for large |x|, else
+ * := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else
+ * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2)))
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+one = 1.00000000000000000000e+00L, /* 0x3ff0000000000000, 0 */
+ln2 = 0.6931471805599453094172321214581766L, /* 0x3fe62e42fefa39ef, 0x3c7abc9e3b398040 */
+huge= 1.00000000000000000000e+300L;
+
+#ifdef __STDC__
+ long double __asinhl(long double x)
+#else
+ long double __asinhl(x)
+ long double x;
+#endif
+{
+ long double t,w;
+ int64_t hx,ix;
+ GET_LDOUBLE_MSW64(hx,x);
+ ix = hx&0x7fffffffffffffffLL;
+ if(ix>=0x7ff0000000000000LL) return x+x; /* x is inf or NaN */
+ if(ix< 0x3e20000000000000LL) { /* |x|<2**-29 */
+ if(huge+x>one) return x; /* return x inexact except 0 */
+ }
+ if(ix>0x41b0000000000000LL) { /* |x| > 2**28 */
+ w = __ieee754_logl(fabs(x))+ln2;
+ } else if (ix>0x4000000000000000LL) { /* 2**28 > |x| > 2.0 */
+ t = fabs(x);
+ w = __ieee754_logl(2.0*t+one/(__ieee754_sqrtl(x*x+one)+t));
+ } else { /* 2.0 > |x| > 2**-29 */
+ t = x*x;
+ w =__log1pl(fabsl(x)+t/(one+__ieee754_sqrtl(one+t)));
+ }
+ if(hx>0) return w; else return -w;
+}
+long_double_symbol (libm, __asinhl, asinhl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_atanl.c b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
new file mode 100644
index 0000000000..b6195f10be
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
@@ -0,0 +1,234 @@
+/* s_atanl.c
+ *
+ * Inverse circular tangent for 128-bit long double precision
+ * (arctangent)
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, atanl();
+ *
+ * y = atanl( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns radian angle between -pi/2 and +pi/2 whose tangent is x.
+ *
+ * The function uses a rational approximation of the form
+ * t + t^3 P(t^2)/Q(t^2), optimized for |t| < 0.09375.
+ *
+ * The argument is reduced using the identity
+ * arctan x - arctan u = arctan ((x-u)/(1 + ux))
+ * and an 83-entry lookup table for arctan u, with u = 0, 1/8, ..., 10.25.
+ * Use of the table improves the execution speed of the routine.
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ * Relative error:
+ * arithmetic domain # trials peak rms
+ * IEEE -19, 19 4e5 1.7e-34 5.4e-35
+ *
+ *
+ * WARNING:
+ *
+ * This program uses integer operations on bit fields of floating-point
+ * numbers. It does not work with data structures other than the
+ * structure assumed.
+ *
+ */
+
+/* Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov>
+
+ This 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.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+/* arctan(k/8), k = 0, ..., 82 */
+static const long double atantbl[84] = {
+ 0.0000000000000000000000000000000000000000E0L,
+ 1.2435499454676143503135484916387102557317E-1L, /* arctan(0.125) */
+ 2.4497866312686415417208248121127581091414E-1L,
+ 3.5877067027057222039592006392646049977698E-1L,
+ 4.6364760900080611621425623146121440202854E-1L,
+ 5.5859931534356243597150821640166127034645E-1L,
+ 6.4350110879328438680280922871732263804151E-1L,
+ 7.1882999962162450541701415152590465395142E-1L,
+ 7.8539816339744830961566084581987572104929E-1L,
+ 8.4415398611317100251784414827164750652594E-1L,
+ 8.9605538457134395617480071802993782702458E-1L,
+ 9.4200004037946366473793717053459358607166E-1L,
+ 9.8279372324732906798571061101466601449688E-1L,
+ 1.0191413442663497346383429170230636487744E0L,
+ 1.0516502125483736674598673120862998296302E0L,
+ 1.0808390005411683108871567292171998202703E0L,
+ 1.1071487177940905030170654601785370400700E0L,
+ 1.1309537439791604464709335155363278047493E0L,
+ 1.1525719972156675180401498626127513797495E0L,
+ 1.1722738811284763866005949441337046149712E0L,
+ 1.1902899496825317329277337748293183376012E0L,
+ 1.2068173702852525303955115800565576303133E0L,
+ 1.2220253232109896370417417439225704908830E0L,
+ 1.2360594894780819419094519711090786987027E0L,
+ 1.2490457723982544258299170772810901230778E0L,
+ 1.2610933822524404193139408812473357720101E0L,
+ 1.2722973952087173412961937498224804940684E0L,
+ 1.2827408797442707473628852511364955306249E0L,
+ 1.2924966677897852679030914214070816845853E0L,
+ 1.3016288340091961438047858503666855921414E0L,
+ 1.3101939350475556342564376891719053122733E0L,
+ 1.3182420510168370498593302023271362531155E0L,
+ 1.3258176636680324650592392104284756311844E0L,
+ 1.3329603993374458675538498697331558093700E0L,
+ 1.3397056595989995393283037525895557411039E0L,
+ 1.3460851583802539310489409282517796256512E0L,
+ 1.3521273809209546571891479413898128509842E0L,
+ 1.3578579772154994751124898859640585287459E0L,
+ 1.3633001003596939542892985278250991189943E0L,
+ 1.3684746984165928776366381936948529556191E0L,
+ 1.3734007669450158608612719264449611486510E0L,
+ 1.3780955681325110444536609641291551522494E0L,
+ 1.3825748214901258580599674177685685125566E0L,
+ 1.3868528702577214543289381097042486034883E0L,
+ 1.3909428270024183486427686943836432060856E0L,
+ 1.3948567013423687823948122092044222644895E0L,
+ 1.3986055122719575950126700816114282335732E0L,
+ 1.4021993871854670105330304794336492676944E0L,
+ 1.4056476493802697809521934019958079881002E0L,
+ 1.4089588955564736949699075250792569287156E0L,
+ 1.4121410646084952153676136718584891599630E0L,
+ 1.4152014988178669079462550975833894394929E0L,
+ 1.4181469983996314594038603039700989523716E0L,
+ 1.4209838702219992566633046424614466661176E0L,
+ 1.4237179714064941189018190466107297503086E0L,
+ 1.4263547484202526397918060597281265695725E0L,
+ 1.4288992721907326964184700745371983590908E0L,
+ 1.4313562697035588982240194668401779312122E0L,
+ 1.4337301524847089866404719096698873648610E0L,
+ 1.4360250423171655234964275337155008780675E0L,
+ 1.4382447944982225979614042479354815855386E0L,
+ 1.4403930189057632173997301031392126865694E0L,
+ 1.4424730991091018200252920599377292525125E0L,
+ 1.4444882097316563655148453598508037025938E0L,
+ 1.4464413322481351841999668424758804165254E0L,
+ 1.4483352693775551917970437843145232637695E0L,
+ 1.4501726582147939000905940595923466567576E0L,
+ 1.4519559822271314199339700039142990228105E0L,
+ 1.4536875822280323362423034480994649820285E0L,
+ 1.4553696664279718992423082296859928222270E0L,
+ 1.4570043196511885530074841089245667532358E0L,
+ 1.4585935117976422128825857356750737658039E0L,
+ 1.4601391056210009726721818194296893361233E0L,
+ 1.4616428638860188872060496086383008594310E0L,
+ 1.4631064559620759326975975316301202111560E0L,
+ 1.4645314639038178118428450961503371619177E0L,
+ 1.4659193880646627234129855241049975398470E0L,
+ 1.4672716522843522691530527207287398276197E0L,
+ 1.4685896086876430842559640450619880951144E0L,
+ 1.4698745421276027686510391411132998919794E0L,
+ 1.4711276743037345918528755717617308518553E0L,
+ 1.4723501675822635384916444186631899205983E0L,
+ 1.4735431285433308455179928682541563973416E0L, /* arctan(10.25) */
+ 1.5707963267948966192313216916397514420986E0L /* pi/2 */
+};
+
+
+/* arctan t = t + t^3 p(t^2) / q(t^2)
+ |t| <= 0.09375
+ peak relative error 5.3e-37 */
+
+static const long double
+ p0 = -4.283708356338736809269381409828726405572E1L,
+ p1 = -8.636132499244548540964557273544599863825E1L,
+ p2 = -5.713554848244551350855604111031839613216E1L,
+ p3 = -1.371405711877433266573835355036413750118E1L,
+ p4 = -8.638214309119210906997318946650189640184E-1L,
+ q0 = 1.285112506901621042780814422948906537959E2L,
+ q1 = 3.361907253914337187957855834229672347089E2L,
+ q2 = 3.180448303864130128268191635189365331680E2L,
+ q3 = 1.307244136980865800160844625025280344686E2L,
+ q4 = 2.173623741810414221251136181221172551416E1L;
+ /* q5 = 1.000000000000000000000000000000000000000E0 */
+
+
+long double
+__atanl (long double x)
+{
+ int k, sign;
+ long double t, u, p, q;
+ ieee854_long_double_shape_type s;
+
+ s.value = x;
+ k = s.parts32.w0;
+ if (k & 0x80000000)
+ sign = 1;
+ else
+ sign = 0;
+
+ /* Check for IEEE special cases. */
+ k &= 0x7fffffff;
+ if (k >= 0x7ff00000)
+ {
+ /* NaN. */
+ if ((k & 0xfffff) | s.parts32.w1 )
+ return (x + x);
+
+ /* Infinity. */
+ if (sign)
+ return -atantbl[83];
+ else
+ return atantbl[83];
+ }
+
+ if (sign)
+ x = -x;
+
+ if (k >= 0x40248000) /* 10.25 */
+ {
+ k = 83;
+ t = -1.0/x;
+ }
+ else
+ {
+ /* Index of nearest table element.
+ Roundoff to integer is asymmetrical to avoid cancellation when t < 0
+ (cf. fdlibm). */
+ k = 8.0 * x + 0.25;
+ u = 0.125 * k;
+ /* Small arctan argument. */
+ t = (x - u) / (1.0 + x * u);
+ }
+
+ /* Arctan of small argument t. */
+ u = t * t;
+ p = ((((p4 * u) + p3) * u + p2) * u + p1) * u + p0;
+ q = ((((u + q4) * u + q3) * u + q2) * u + q1) * u + q0;
+ u = t * u * p / q + t;
+
+ /* arctan x = arctan u + arctan t */
+ u = atantbl[k] + u;
+ if (sign)
+ return (-u);
+ else
+ return u;
+}
+
+long_double_symbol (libm, __atanl, atanl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c b/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c
new file mode 100644
index 0000000000..010a671dce
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c
@@ -0,0 +1,6 @@
+/* Looks like we can use ieee854 s_cbrtl.c as is for IBM extended format. */
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_cbrtl.c>
+long_double_symbol (libm, __cbrtl, cbrtl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_ceill.c b/sysdeps/ieee754/ldbl-128ibm/s_ceill.c
new file mode 100644
index 0000000000..a4cbbe1048
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_ceill.c
@@ -0,0 +1,119 @@
+/* Ceil (round to +inf) long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <math.h>
+#include <fenv.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__ceill (long double x)
+#else
+long double
+__ceill (x)
+ long double x;
+#endif
+{
+ static const double TWO52 = 4503599627370496.0L;
+ int mode = fegetround();
+ union ibm_extended_long_double u;
+
+ u.d = x;
+
+ if (fabs (u.dd[0]) < TWO52)
+ {
+ fesetround(FE_UPWARD);
+ if (u.dd[0] > 0.0)
+ {
+ u.dd[0] += TWO52;
+ u.dd[0] -= TWO52;
+ }
+ else if (u.dd[0] < 0.0)
+ {
+ u.dd[0] -= TWO52;
+ u.dd[0] += TWO52;
+ }
+ u.dd[1] = 0.0;
+ fesetround(mode);
+ }
+ else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
+ {
+ double high, low;
+ /* In this case we have to round the low double and handle any
+ adjustment to the high double that may be caused by rounding
+ (up). This is complicated by the fact that the high double
+ may already be rounded and the low double may have the
+ opposite sign to compensate. */
+ if (u.dd[0] > 0.0)
+ {
+ if (u.dd[1] > 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] < 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+ high = nextafter (u.dd[0], 0.0);
+ low = u.dd[1] + (u.dd[0] - high);
+ }
+ fesetround(FE_UPWARD);
+ low += TWO52;
+ low -= TWO52;
+ fesetround(mode);
+ }
+ else if (u.dd[0] < 0.0)
+ {
+ if (u.dd[1] < 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] > 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+ high = nextafter (u.dd[0], 0.0);
+ low = u.dd[1] + (u.dd[0] - high);
+ }
+ fesetround(FE_UPWARD);
+ low -= TWO52;
+ low += TWO52;
+ fesetround(mode);
+ }
+ u.dd[0] = high + low;
+ u.dd[1] = high - u.dd[0] + low;
+ }
+
+ return u.d;
+}
+
+long_double_symbol (libm, __ceill, ceill);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c b/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c
new file mode 100644
index 0000000000..7e7b44168d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c
@@ -0,0 +1,45 @@
+/* s_copysignl.c -- long double version of s_copysign.c.
+ * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * copysignl(long double x, long double y)
+ * copysignl(x,y) returns a value with the magnitude of x and
+ * with the sign bit of y.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __copysignl(long double x, long double y)
+#else
+ long double __copysignl(x,y)
+ long double x,y;
+#endif
+{
+ if (y < 0.0)
+ {
+ if (x >= 0.0)
+ x = -x;
+ }
+ else if (x < 0.0)
+ x = -x;
+ return x;
+}
+weak_alias (__copysignl, copysignl)
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_cosl.c b/sysdeps/ieee754/ldbl-128ibm/s_cosl.c
new file mode 100644
index 0000000000..59a8196706
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_cosl.c
@@ -0,0 +1,88 @@
+/* s_cosl.c -- long double version of s_cos.c.
+ * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* cosl(x)
+ * Return cosine function of x.
+ *
+ * kernel function:
+ * __kernel_sinl ... sine function on [-pi/4,pi/4]
+ * __kernel_cosl ... cosine function on [-pi/4,pi/4]
+ * __ieee754_rem_pio2l ... argument reduction routine
+ *
+ * Method.
+ * Let S,C and T denote the sin, cos and tan respectively on
+ * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
+ * in [-pi/4 , +pi/4], and let n = k mod 4.
+ * We have
+ *
+ * n sin(x) cos(x) tan(x)
+ * ----------------------------------------------------------
+ * 0 S C T
+ * 1 C -S -1/T
+ * 2 -S -C T
+ * 3 -C S -1/T
+ * ----------------------------------------------------------
+ *
+ * Special cases:
+ * Let trig be any of sin, cos, or tan.
+ * trig(+-INF) is NaN, with signals;
+ * trig(NaN) is that NaN;
+ *
+ * Accuracy:
+ * TRIG(x) returns trig(x) nearly rounded
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+ long double __cosl(long double x)
+#else
+ long double __cosl(x)
+ long double x;
+#endif
+{
+ long double y[2],z=0.0L;
+ int64_t n, ix;
+
+ /* High word of x. */
+ GET_LDOUBLE_MSW64(ix,x);
+
+ /* |x| ~< pi/4 */
+ ix &= 0x7fffffffffffffffLL;
+ if(ix <= 0x3fe921fb54442d18LL)
+ return __kernel_cosl(x,z);
+
+ /* cos(Inf or NaN) is NaN */
+ else if (ix>=0x7ff0000000000000LL)
+ return x-x;
+
+ /* argument reduction needed */
+ else {
+ n = __ieee754_rem_pio2l(x,y);
+ switch(n&3) {
+ case 0:
+ return __kernel_cosl(y[0],y[1]);
+ case 1:
+ return -__kernel_sinl(y[0],y[1],1);
+ case 2:
+ return -__kernel_cosl(y[0],y[1]);
+ default:
+ return __kernel_sinl(y[0],y[1],1);
+ }
+ }
+}
+long_double_symbol (libm, __cosl, cosl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_erfl.c b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
new file mode 100644
index 0000000000..02b450efce
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
@@ -0,0 +1,958 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* Modifications and expansions for 128-bit long double are
+ Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under
+ the following terms:
+
+ This 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.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/* double erf(double x)
+ * double erfc(double x)
+ * x
+ * 2 |\
+ * erf(x) = --------- | exp(-t*t)dt
+ * sqrt(pi) \|
+ * 0
+ *
+ * erfc(x) = 1-erf(x)
+ * Note that
+ * erf(-x) = -erf(x)
+ * erfc(-x) = 2 - erfc(x)
+ *
+ * Method:
+ * 1. erf(x) = x + x*R(x^2) for |x| in [0, 7/8]
+ * Remark. The formula is derived by noting
+ * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....)
+ * and that
+ * 2/sqrt(pi) = 1.128379167095512573896158903121545171688
+ * is close to one.
+ *
+ * 1a. erf(x) = 1 - erfc(x), for |x| > 1.0
+ * erfc(x) = 1 - erf(x) if |x| < 1/4
+ *
+ * 2. For |x| in [7/8, 1], let s = |x| - 1, and
+ * c = 0.84506291151 rounded to single (24 bits)
+ * erf(s + c) = sign(x) * (c + P1(s)/Q1(s))
+ * Remark: here we use the taylor series expansion at x=1.
+ * erf(1+s) = erf(1) + s*Poly(s)
+ * = 0.845.. + P1(s)/Q1(s)
+ * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25]
+ *
+ * 3. For x in [1/4, 5/4],
+ * erfc(s + const) = erfc(const) + s P1(s)/Q1(s)
+ * for const = 1/4, 3/8, ..., 9/8
+ * and 0 <= s <= 1/8 .
+ *
+ * 4. For x in [5/4, 107],
+ * erfc(x) = (1/x)*exp(-x*x-0.5625 + R(z))
+ * z=1/x^2
+ * The interval is partitioned into several segments
+ * of width 1/8 in 1/x.
+ *
+ * Note1:
+ * To compute exp(-x*x-0.5625+R/S), let s be a single
+ * precision number and s := x; then
+ * -x*x = -s*s + (s-x)*(s+x)
+ * exp(-x*x-0.5626+R/S) =
+ * exp(-s*s-0.5625)*exp((s-x)*(s+x)+R/S);
+ * Note2:
+ * Here 4 and 5 make use of the asymptotic series
+ * exp(-x*x)
+ * erfc(x) ~ ---------- * ( 1 + Poly(1/x^2) )
+ * x*sqrt(pi)
+ *
+ * 5. For inf > x >= 107
+ * erf(x) = sign(x) *(1 - tiny) (raise inexact)
+ * erfc(x) = tiny*tiny (raise underflow) if x > 0
+ * = 2 - tiny if x<0
+ *
+ * 7. Special case:
+ * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1,
+ * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2,
+ * erfc/erf(NaN) is NaN
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+/* Evaluate P[n] x^n + P[n-1] x^(n-1) + ... + P[0] */
+
+static long double
+neval (long double x, const long double *p, int n)
+{
+ long double y;
+
+ p += n;
+ y = *p--;
+ do
+ {
+ y = y * x + *p--;
+ }
+ while (--n > 0);
+ return y;
+}
+
+
+/* Evaluate x^n+1 + P[n] x^(n) + P[n-1] x^(n-1) + ... + P[0] */
+
+static long double
+deval (long double x, const long double *p, int n)
+{
+ long double y;
+
+ p += n;
+ y = x + *p--;
+ do
+ {
+ y = y * x + *p--;
+ }
+ while (--n > 0);
+ return y;
+}
+
+
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+tiny = 1e-300L,
+ half = 0.5L,
+ one = 1.0L,
+ two = 2.0L,
+ /* 2/sqrt(pi) - 1 */
+ efx = 1.2837916709551257389615890312154517168810E-1L,
+ /* 8 * (2/sqrt(pi) - 1) */
+ efx8 = 1.0270333367641005911692712249723613735048E0L;
+
+
+/* erf(x) = x + x R(x^2)
+ 0 <= x <= 7/8
+ Peak relative error 1.8e-35 */
+#define NTN1 8
+static const long double TN1[NTN1 + 1] =
+{
+ -3.858252324254637124543172907442106422373E10L,
+ 9.580319248590464682316366876952214879858E10L,
+ 1.302170519734879977595901236693040544854E10L,
+ 2.922956950426397417800321486727032845006E9L,
+ 1.764317520783319397868923218385468729799E8L,
+ 1.573436014601118630105796794840834145120E7L,
+ 4.028077380105721388745632295157816229289E5L,
+ 1.644056806467289066852135096352853491530E4L,
+ 3.390868480059991640235675479463287886081E1L
+};
+#define NTD1 8
+static const long double TD1[NTD1 + 1] =
+{
+ -3.005357030696532927149885530689529032152E11L,
+ -1.342602283126282827411658673839982164042E11L,
+ -2.777153893355340961288511024443668743399E10L,
+ -3.483826391033531996955620074072768276974E9L,
+ -2.906321047071299585682722511260895227921E8L,
+ -1.653347985722154162439387878512427542691E7L,
+ -6.245520581562848778466500301865173123136E5L,
+ -1.402124304177498828590239373389110545142E4L,
+ -1.209368072473510674493129989468348633579E2L
+/* 1.0E0 */
+};
+
+
+/* erf(z+1) = erf_const + P(z)/Q(z)
+ -.125 <= z <= 0
+ Peak relative error 7.3e-36 */
+static const long double erf_const = 0.845062911510467529296875L;
+#define NTN2 8
+static const long double TN2[NTN2 + 1] =
+{
+ -4.088889697077485301010486931817357000235E1L,
+ 7.157046430681808553842307502826960051036E3L,
+ -2.191561912574409865550015485451373731780E3L,
+ 2.180174916555316874988981177654057337219E3L,
+ 2.848578658049670668231333682379720943455E2L,
+ 1.630362490952512836762810462174798925274E2L,
+ 6.317712353961866974143739396865293596895E0L,
+ 2.450441034183492434655586496522857578066E1L,
+ 5.127662277706787664956025545897050896203E-1L
+};
+#define NTD2 8
+static const long double TD2[NTD2 + 1] =
+{
+ 1.731026445926834008273768924015161048885E4L,
+ 1.209682239007990370796112604286048173750E4L,
+ 1.160950290217993641320602282462976163857E4L,
+ 5.394294645127126577825507169061355698157E3L,
+ 2.791239340533632669442158497532521776093E3L,
+ 8.989365571337319032943005387378993827684E2L,
+ 2.974016493766349409725385710897298069677E2L,
+ 6.148192754590376378740261072533527271947E1L,
+ 1.178502892490738445655468927408440847480E1L
+ /* 1.0E0 */
+};
+
+
+/* erfc(x + 0.25) = erfc(0.25) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 1.4e-35 */
+#define NRNr13 8
+static const long double RNr13[NRNr13 + 1] =
+{
+ -2.353707097641280550282633036456457014829E3L,
+ 3.871159656228743599994116143079870279866E2L,
+ -3.888105134258266192210485617504098426679E2L,
+ -2.129998539120061668038806696199343094971E1L,
+ -8.125462263594034672468446317145384108734E1L,
+ 8.151549093983505810118308635926270319660E0L,
+ -5.033362032729207310462422357772568553670E0L,
+ -4.253956621135136090295893547735851168471E-2L,
+ -8.098602878463854789780108161581050357814E-2L
+};
+#define NRDr13 7
+static const long double RDr13[NRDr13 + 1] =
+{
+ 2.220448796306693503549505450626652881752E3L,
+ 1.899133258779578688791041599040951431383E2L,
+ 1.061906712284961110196427571557149268454E3L,
+ 7.497086072306967965180978101974566760042E1L,
+ 2.146796115662672795876463568170441327274E2L,
+ 1.120156008362573736664338015952284925592E1L,
+ 2.211014952075052616409845051695042741074E1L,
+ 6.469655675326150785692908453094054988938E-1L
+ /* 1.0E0 */
+};
+/* erfc(0.25) = C13a + C13b to extra precision. */
+static const long double C13a = 0.723663330078125L;
+static const long double C13b = 1.0279753638067014931732235184287934646022E-5L;
+
+
+/* erfc(x + 0.375) = erfc(0.375) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 1.2e-35 */
+#define NRNr14 8
+static const long double RNr14[NRNr14 + 1] =
+{
+ -2.446164016404426277577283038988918202456E3L,
+ 6.718753324496563913392217011618096698140E2L,
+ -4.581631138049836157425391886957389240794E2L,
+ -2.382844088987092233033215402335026078208E1L,
+ -7.119237852400600507927038680970936336458E1L,
+ 1.313609646108420136332418282286454287146E1L,
+ -6.188608702082264389155862490056401365834E0L,
+ -2.787116601106678287277373011101132659279E-2L,
+ -2.230395570574153963203348263549700967918E-2L
+};
+#define NRDr14 7
+static const long double RDr14[NRDr14 + 1] =
+{
+ 2.495187439241869732696223349840963702875E3L,
+ 2.503549449872925580011284635695738412162E2L,
+ 1.159033560988895481698051531263861842461E3L,
+ 9.493751466542304491261487998684383688622E1L,
+ 2.276214929562354328261422263078480321204E2L,
+ 1.367697521219069280358984081407807931847E1L,
+ 2.276988395995528495055594829206582732682E1L,
+ 7.647745753648996559837591812375456641163E-1L
+ /* 1.0E0 */
+};
+/* erfc(0.375) = C14a + C14b to extra precision. */
+static const long double C14a = 0.5958709716796875L;
+static const long double C14b = 1.2118885490201676174914080878232469565953E-5L;
+
+/* erfc(x + 0.5) = erfc(0.5) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 4.7e-36 */
+#define NRNr15 8
+static const long double RNr15[NRNr15 + 1] =
+{
+ -2.624212418011181487924855581955853461925E3L,
+ 8.473828904647825181073831556439301342756E2L,
+ -5.286207458628380765099405359607331669027E2L,
+ -3.895781234155315729088407259045269652318E1L,
+ -6.200857908065163618041240848728398496256E1L,
+ 1.469324610346924001393137895116129204737E1L,
+ -6.961356525370658572800674953305625578903E0L,
+ 5.145724386641163809595512876629030548495E-3L,
+ 1.990253655948179713415957791776180406812E-2L
+};
+#define NRDr15 7
+static const long double RDr15[NRDr15 + 1] =
+{
+ 2.986190760847974943034021764693341524962E3L,
+ 5.288262758961073066335410218650047725985E2L,
+ 1.363649178071006978355113026427856008978E3L,
+ 1.921707975649915894241864988942255320833E2L,
+ 2.588651100651029023069013885900085533226E2L,
+ 2.628752920321455606558942309396855629459E1L,
+ 2.455649035885114308978333741080991380610E1L,
+ 1.378826653595128464383127836412100939126E0L
+ /* 1.0E0 */
+};
+/* erfc(0.5) = C15a + C15b to extra precision. */
+static const long double C15a = 0.4794921875L;
+static const long double C15b = 7.9346869534623172533461080354712635484242E-6L;
+
+/* erfc(x + 0.625) = erfc(0.625) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 5.1e-36 */
+#define NRNr16 8
+static const long double RNr16[NRNr16 + 1] =
+{
+ -2.347887943200680563784690094002722906820E3L,
+ 8.008590660692105004780722726421020136482E2L,
+ -5.257363310384119728760181252132311447963E2L,
+ -4.471737717857801230450290232600243795637E1L,
+ -4.849540386452573306708795324759300320304E1L,
+ 1.140885264677134679275986782978655952843E1L,
+ -6.731591085460269447926746876983786152300E0L,
+ 1.370831653033047440345050025876085121231E-1L,
+ 2.022958279982138755020825717073966576670E-2L,
+};
+#define NRDr16 7
+static const long double RDr16[NRDr16 + 1] =
+{
+ 3.075166170024837215399323264868308087281E3L,
+ 8.730468942160798031608053127270430036627E2L,
+ 1.458472799166340479742581949088453244767E3L,
+ 3.230423687568019709453130785873540386217E2L,
+ 2.804009872719893612081109617983169474655E2L,
+ 4.465334221323222943418085830026979293091E1L,
+ 2.612723259683205928103787842214809134746E1L,
+ 2.341526751185244109722204018543276124997E0L,
+ /* 1.0E0 */
+};
+/* erfc(0.625) = C16a + C16b to extra precision. */
+static const long double C16a = 0.3767547607421875L;
+static const long double C16b = 4.3570693945275513594941232097252997287766E-6L;
+
+/* erfc(x + 0.75) = erfc(0.75) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 1.7e-35 */
+#define NRNr17 8
+static const long double RNr17[NRNr17 + 1] =
+{
+ -1.767068734220277728233364375724380366826E3L,
+ 6.693746645665242832426891888805363898707E2L,
+ -4.746224241837275958126060307406616817753E2L,
+ -2.274160637728782675145666064841883803196E1L,
+ -3.541232266140939050094370552538987982637E1L,
+ 6.988950514747052676394491563585179503865E0L,
+ -5.807687216836540830881352383529281215100E0L,
+ 3.631915988567346438830283503729569443642E-1L,
+ -1.488945487149634820537348176770282391202E-2L
+};
+#define NRDr17 7
+static const long double RDr17[NRDr17 + 1] =
+{
+ 2.748457523498150741964464942246913394647E3L,
+ 1.020213390713477686776037331757871252652E3L,
+ 1.388857635935432621972601695296561952738E3L,
+ 3.903363681143817750895999579637315491087E2L,
+ 2.784568344378139499217928969529219886578E2L,
+ 5.555800830216764702779238020065345401144E1L,
+ 2.646215470959050279430447295801291168941E1L,
+ 2.984905282103517497081766758550112011265E0L,
+ /* 1.0E0 */
+};
+/* erfc(0.75) = C17a + C17b to extra precision. */
+static const long double C17a = 0.2888336181640625L;
+static const long double C17b = 1.0748182422368401062165408589222625794046E-5L;
+
+
+/* erfc(x + 0.875) = erfc(0.875) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 2.2e-35 */
+#define NRNr18 8
+static const long double RNr18[NRNr18 + 1] =
+{
+ -1.342044899087593397419622771847219619588E3L,
+ 6.127221294229172997509252330961641850598E2L,
+ -4.519821356522291185621206350470820610727E2L,
+ 1.223275177825128732497510264197915160235E1L,
+ -2.730789571382971355625020710543532867692E1L,
+ 4.045181204921538886880171727755445395862E0L,
+ -4.925146477876592723401384464691452700539E0L,
+ 5.933878036611279244654299924101068088582E-1L,
+ -5.557645435858916025452563379795159124753E-2L
+};
+#define NRDr18 7
+static const long double RDr18[NRDr18 + 1] =
+{
+ 2.557518000661700588758505116291983092951E3L,
+ 1.070171433382888994954602511991940418588E3L,
+ 1.344842834423493081054489613250688918709E3L,
+ 4.161144478449381901208660598266288188426E2L,
+ 2.763670252219855198052378138756906980422E2L,
+ 5.998153487868943708236273854747564557632E1L,
+ 2.657695108438628847733050476209037025318E1L,
+ 3.252140524394421868923289114410336976512E0L,
+ /* 1.0E0 */
+};
+/* erfc(0.875) = C18a + C18b to extra precision. */
+static const long double C18a = 0.215911865234375L;
+static const long double C18b = 1.3073705765341685464282101150637224028267E-5L;
+
+/* erfc(x + 1.0) = erfc(1.0) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 1.6e-35 */
+#define NRNr19 8
+static const long double RNr19[NRNr19 + 1] =
+{
+ -1.139180936454157193495882956565663294826E3L,
+ 6.134903129086899737514712477207945973616E2L,
+ -4.628909024715329562325555164720732868263E2L,
+ 4.165702387210732352564932347500364010833E1L,
+ -2.286979913515229747204101330405771801610E1L,
+ 1.870695256449872743066783202326943667722E0L,
+ -4.177486601273105752879868187237000032364E0L,
+ 7.533980372789646140112424811291782526263E-1L,
+ -8.629945436917752003058064731308767664446E-2L
+};
+#define NRDr19 7
+static const long double RDr19[NRDr19 + 1] =
+{
+ 2.744303447981132701432716278363418643778E3L,
+ 1.266396359526187065222528050591302171471E3L,
+ 1.466739461422073351497972255511919814273E3L,
+ 4.868710570759693955597496520298058147162E2L,
+ 2.993694301559756046478189634131722579643E2L,
+ 6.868976819510254139741559102693828237440E1L,
+ 2.801505816247677193480190483913753613630E1L,
+ 3.604439909194350263552750347742663954481E0L,
+ /* 1.0E0 */
+};
+/* erfc(1.0) = C19a + C19b to extra precision. */
+static const long double C19a = 0.15728759765625L;
+static const long double C19b = 1.1609394035130658779364917390740703933002E-5L;
+
+/* erfc(x + 1.125) = erfc(1.125) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 3.6e-36 */
+#define NRNr20 8
+static const long double RNr20[NRNr20 + 1] =
+{
+ -9.652706916457973956366721379612508047640E2L,
+ 5.577066396050932776683469951773643880634E2L,
+ -4.406335508848496713572223098693575485978E2L,
+ 5.202893466490242733570232680736966655434E1L,
+ -1.931311847665757913322495948705563937159E1L,
+ -9.364318268748287664267341457164918090611E-2L,
+ -3.306390351286352764891355375882586201069E0L,
+ 7.573806045289044647727613003096916516475E-1L,
+ -9.611744011489092894027478899545635991213E-2L
+};
+#define NRDr20 7
+static const long double RDr20[NRDr20 + 1] =
+{
+ 3.032829629520142564106649167182428189014E3L,
+ 1.659648470721967719961167083684972196891E3L,
+ 1.703545128657284619402511356932569292535E3L,
+ 6.393465677731598872500200253155257708763E2L,
+ 3.489131397281030947405287112726059221934E2L,
+ 8.848641738570783406484348434387611713070E1L,
+ 3.132269062552392974833215844236160958502E1L,
+ 4.430131663290563523933419966185230513168E0L
+ /* 1.0E0 */
+};
+/* erfc(1.125) = C20a + C20b to extra precision. */
+static const long double C20a = 0.111602783203125L;
+static const long double C20b = 8.9850951672359304215530728365232161564636E-6L;
+
+/* erfc(1/x) = 1/x exp (-1/x^2 - 0.5625 + R(1/x^2))
+ 7/8 <= 1/x < 1
+ Peak relative error 1.4e-35 */
+#define NRNr8 9
+static const long double RNr8[NRNr8 + 1] =
+{
+ 3.587451489255356250759834295199296936784E1L,
+ 5.406249749087340431871378009874875889602E2L,
+ 2.931301290625250886238822286506381194157E3L,
+ 7.359254185241795584113047248898753470923E3L,
+ 9.201031849810636104112101947312492532314E3L,
+ 5.749697096193191467751650366613289284777E3L,
+ 1.710415234419860825710780802678697889231E3L,
+ 2.150753982543378580859546706243022719599E2L,
+ 8.740953582272147335100537849981160931197E0L,
+ 4.876422978828717219629814794707963640913E-2L
+};
+#define NRDr8 8
+static const long double RDr8[NRDr8 + 1] =
+{
+ 6.358593134096908350929496535931630140282E1L,
+ 9.900253816552450073757174323424051765523E2L,
+ 5.642928777856801020545245437089490805186E3L,
+ 1.524195375199570868195152698617273739609E4L,
+ 2.113829644500006749947332935305800887345E4L,
+ 1.526438562626465706267943737310282977138E4L,
+ 5.561370922149241457131421914140039411782E3L,
+ 9.394035530179705051609070428036834496942E2L,
+ 6.147019596150394577984175188032707343615E1L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp (-1/x^2 - 0.5625 + R(1/x^2))
+ 0.75 <= 1/x <= 0.875
+ Peak relative error 2.0e-36 */
+#define NRNr7 9
+static const long double RNr7[NRNr7 + 1] =
+{
+ 1.686222193385987690785945787708644476545E1L,
+ 1.178224543567604215602418571310612066594E3L,
+ 1.764550584290149466653899886088166091093E4L,
+ 1.073758321890334822002849369898232811561E5L,
+ 3.132840749205943137619839114451290324371E5L,
+ 4.607864939974100224615527007793867585915E5L,
+ 3.389781820105852303125270837910972384510E5L,
+ 1.174042187110565202875011358512564753399E5L,
+ 1.660013606011167144046604892622504338313E4L,
+ 6.700393957480661937695573729183733234400E2L
+};
+#define NRDr7 9
+static const long double RDr7[NRDr7 + 1] =
+{
+-1.709305024718358874701575813642933561169E3L,
+-3.280033887481333199580464617020514788369E4L,
+-2.345284228022521885093072363418750835214E5L,
+-8.086758123097763971926711729242327554917E5L,
+-1.456900414510108718402423999575992450138E6L,
+-1.391654264881255068392389037292702041855E6L,
+-6.842360801869939983674527468509852583855E5L,
+-1.597430214446573566179675395199807533371E5L,
+-1.488876130609876681421645314851760773480E4L,
+-3.511762950935060301403599443436465645703E2L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+ 5/8 <= 1/x < 3/4
+ Peak relative error 1.9e-35 */
+#define NRNr6 9
+static const long double RNr6[NRNr6 + 1] =
+{
+ 1.642076876176834390623842732352935761108E0L,
+ 1.207150003611117689000664385596211076662E2L,
+ 2.119260779316389904742873816462800103939E3L,
+ 1.562942227734663441801452930916044224174E4L,
+ 5.656779189549710079988084081145693580479E4L,
+ 1.052166241021481691922831746350942786299E5L,
+ 9.949798524786000595621602790068349165758E4L,
+ 4.491790734080265043407035220188849562856E4L,
+ 8.377074098301530326270432059434791287601E3L,
+ 4.506934806567986810091824791963991057083E2L
+};
+#define NRDr6 9
+static const long double RDr6[NRDr6 + 1] =
+{
+-1.664557643928263091879301304019826629067E2L,
+-3.800035902507656624590531122291160668452E3L,
+-3.277028191591734928360050685359277076056E4L,
+-1.381359471502885446400589109566587443987E5L,
+-3.082204287382581873532528989283748656546E5L,
+-3.691071488256738343008271448234631037095E5L,
+-2.300482443038349815750714219117566715043E5L,
+-6.873955300927636236692803579555752171530E4L,
+-8.262158817978334142081581542749986845399E3L,
+-2.517122254384430859629423488157361983661E2L
+ /* 1.00 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+ 1/2 <= 1/x < 5/8
+ Peak relative error 4.6e-36 */
+#define NRNr5 10
+static const long double RNr5[NRNr5 + 1] =
+{
+-3.332258927455285458355550878136506961608E-3L,
+-2.697100758900280402659586595884478660721E-1L,
+-6.083328551139621521416618424949137195536E0L,
+-6.119863528983308012970821226810162441263E1L,
+-3.176535282475593173248810678636522589861E2L,
+-8.933395175080560925809992467187963260693E2L,
+-1.360019508488475978060917477620199499560E3L,
+-1.075075579828188621541398761300910213280E3L,
+-4.017346561586014822824459436695197089916E2L,
+-5.857581368145266249509589726077645791341E1L,
+-2.077715925587834606379119585995758954399E0L
+};
+#define NRDr5 9
+static const long double RDr5[NRDr5 + 1] =
+{
+ 3.377879570417399341550710467744693125385E-1L,
+ 1.021963322742390735430008860602594456187E1L,
+ 1.200847646592942095192766255154827011939E2L,
+ 7.118915528142927104078182863387116942836E2L,
+ 2.318159380062066469386544552429625026238E3L,
+ 4.238729853534009221025582008928765281620E3L,
+ 4.279114907284825886266493994833515580782E3L,
+ 2.257277186663261531053293222591851737504E3L,
+ 5.570475501285054293371908382916063822957E2L,
+ 5.142189243856288981145786492585432443560E1L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+ 3/8 <= 1/x < 1/2
+ Peak relative error 2.0e-36 */
+#define NRNr4 10
+static const long double RNr4[NRNr4 + 1] =
+{
+ 3.258530712024527835089319075288494524465E-3L,
+ 2.987056016877277929720231688689431056567E-1L,
+ 8.738729089340199750734409156830371528862E0L,
+ 1.207211160148647782396337792426311125923E2L,
+ 8.997558632489032902250523945248208224445E2L,
+ 3.798025197699757225978410230530640879762E3L,
+ 9.113203668683080975637043118209210146846E3L,
+ 1.203285891339933238608683715194034900149E4L,
+ 8.100647057919140328536743641735339740855E3L,
+ 2.383888249907144945837976899822927411769E3L,
+ 2.127493573166454249221983582495245662319E2L
+};
+#define NRDr4 10
+static const long double RDr4[NRDr4 + 1] =
+{
+-3.303141981514540274165450687270180479586E-1L,
+-1.353768629363605300707949368917687066724E1L,
+-2.206127630303621521950193783894598987033E2L,
+-1.861800338758066696514480386180875607204E3L,
+-8.889048775872605708249140016201753255599E3L,
+-2.465888106627948210478692168261494857089E4L,
+-3.934642211710774494879042116768390014289E4L,
+-3.455077258242252974937480623730228841003E4L,
+-1.524083977439690284820586063729912653196E4L,
+-2.810541887397984804237552337349093953857E3L,
+-1.343929553541159933824901621702567066156E2L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+ 1/4 <= 1/x < 3/8
+ Peak relative error 8.4e-37 */
+#define NRNr3 11
+static const long double RNr3[NRNr3 + 1] =
+{
+-1.952401126551202208698629992497306292987E-6L,
+-2.130881743066372952515162564941682716125E-4L,
+-8.376493958090190943737529486107282224387E-3L,
+-1.650592646560987700661598877522831234791E-1L,
+-1.839290818933317338111364667708678163199E0L,
+-1.216278715570882422410442318517814388470E1L,
+-4.818759344462360427612133632533779091386E1L,
+-1.120994661297476876804405329172164436784E2L,
+-1.452850765662319264191141091859300126931E2L,
+-9.485207851128957108648038238656777241333E1L,
+-2.563663855025796641216191848818620020073E1L,
+-1.787995944187565676837847610706317833247E0L
+};
+#define NRDr3 10
+static const long double RDr3[NRDr3 + 1] =
+{
+ 1.979130686770349481460559711878399476903E-4L,
+ 1.156941716128488266238105813374635099057E-2L,
+ 2.752657634309886336431266395637285974292E-1L,
+ 3.482245457248318787349778336603569327521E0L,
+ 2.569347069372696358578399521203959253162E1L,
+ 1.142279000180457419740314694631879921561E2L,
+ 3.056503977190564294341422623108332700840E2L,
+ 4.780844020923794821656358157128719184422E2L,
+ 4.105972727212554277496256802312730410518E2L,
+ 1.724072188063746970865027817017067646246E2L,
+ 2.815939183464818198705278118326590370435E1L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+ 1/8 <= 1/x < 1/4
+ Peak relative error 1.5e-36 */
+#define NRNr2 11
+static const long double RNr2[NRNr2 + 1] =
+{
+-2.638914383420287212401687401284326363787E-8L,
+-3.479198370260633977258201271399116766619E-6L,
+-1.783985295335697686382487087502222519983E-4L,
+-4.777876933122576014266349277217559356276E-3L,
+-7.450634738987325004070761301045014986520E-2L,
+-7.068318854874733315971973707247467326619E-1L,
+-4.113919921935944795764071670806867038732E0L,
+-1.440447573226906222417767283691888875082E1L,
+-2.883484031530718428417168042141288943905E1L,
+-2.990886974328476387277797361464279931446E1L,
+-1.325283914915104866248279787536128997331E1L,
+-1.572436106228070195510230310658206154374E0L
+};
+#define NRDr2 10
+static const long double RDr2[NRDr2 + 1] =
+{
+ 2.675042728136731923554119302571867799673E-6L,
+ 2.170997868451812708585443282998329996268E-4L,
+ 7.249969752687540289422684951196241427445E-3L,
+ 1.302040375859768674620410563307838448508E-1L,
+ 1.380202483082910888897654537144485285549E0L,
+ 8.926594113174165352623847870299170069350E0L,
+ 3.521089584782616472372909095331572607185E1L,
+ 8.233547427533181375185259050330809105570E1L,
+ 1.072971579885803033079469639073292840135E2L,
+ 6.943803113337964469736022094105143158033E1L,
+ 1.775695341031607738233608307835017282662E1L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+ 1/128 <= 1/x < 1/8
+ Peak relative error 2.2e-36 */
+#define NRNr1 9
+static const long double RNr1[NRNr1 + 1] =
+{
+-4.250780883202361946697751475473042685782E-8L,
+-5.375777053288612282487696975623206383019E-6L,
+-2.573645949220896816208565944117382460452E-4L,
+-6.199032928113542080263152610799113086319E-3L,
+-8.262721198693404060380104048479916247786E-2L,
+-6.242615227257324746371284637695778043982E-1L,
+-2.609874739199595400225113299437099626386E0L,
+-5.581967563336676737146358534602770006970E0L,
+-5.124398923356022609707490956634280573882E0L,
+-1.290865243944292370661544030414667556649E0L
+};
+#define NRDr1 8
+static const long double RDr1[NRDr1 + 1] =
+{
+ 4.308976661749509034845251315983612976224E-6L,
+ 3.265390126432780184125233455960049294580E-4L,
+ 9.811328839187040701901866531796570418691E-3L,
+ 1.511222515036021033410078631914783519649E-1L,
+ 1.289264341917429958858379585970225092274E0L,
+ 6.147640356182230769548007536914983522270E0L,
+ 1.573966871337739784518246317003956180750E1L,
+ 1.955534123435095067199574045529218238263E1L,
+ 9.472613121363135472247929109615785855865E0L
+ /* 1.0E0 */
+};
+
+
+#ifdef __STDC__
+long double
+__erfl (long double x)
+#else
+double
+__erfl (x)
+ long double x;
+#endif
+{
+ long double a, y, z;
+ int32_t i, ix, sign;
+ ieee854_long_double_shape_type u;
+
+ u.value = x;
+ sign = u.parts32.w0;
+ ix = sign & 0x7fffffff;
+
+ if (ix >= 0x7ff00000)
+ { /* erf(nan)=nan */
+ i = ((sign & 0xfff00000) >> 31) << 1;
+ return (long double) (1 - i) + one / x; /* erf(+-inf)=+-1 */
+ }
+
+ if (ix >= 0x3ff00000) /* |x| >= 1.0 */
+ {
+ y = __erfcl (x);
+ return (one - y);
+ /* return (one - __erfcl (x)); */
+ }
+ u.parts32.w0 = ix;
+ a = u.value;
+ z = x * x;
+ if (ix < 0x3fec0000) /* a < 0.875 */
+ {
+ if (ix < 0x3c600000) /* |x|<2**-57 */
+ {
+ if (ix < 0x00800000)
+ {
+ /* erf (-0) = -0. Unfortunately, for IBM extended double
+ 0.125 * (8.0 * x + efx8 * x) for x = -0 evaluates to 0. */
+ if (x == 0)
+ return x;
+ return 0.125 * (8.0 * x + efx8 * x); /*avoid underflow */
+ }
+ return x + efx * x;
+ }
+ y = a + a * neval (z, TN1, NTN1) / deval (z, TD1, NTD1);
+ }
+ else
+ {
+ a = a - one;
+ y = erf_const + neval (a, TN2, NTN2) / deval (a, TD2, NTD2);
+ }
+
+ if (sign & 0x80000000) /* x < 0 */
+ y = -y;
+ return( y );
+}
+
+long_double_symbol (libm, __erfl, erfl);
+#ifdef __STDC__
+ long double
+ __erfcl (long double x)
+#else
+ long double
+ __erfcl (x)
+ double
+ x;
+#endif
+{
+ long double y, z, p, r;
+ int32_t i, ix, sign;
+ ieee854_long_double_shape_type u;
+
+ u.value = x;
+ sign = u.parts32.w0;
+ ix = sign & 0x7fffffff;
+ u.parts32.w0 = ix;
+
+ if (ix >= 0x7ff00000)
+ { /* erfc(nan)=nan */
+ /* erfc(+-inf)=0,2 */
+ return (long double) (((u_int32_t) sign >> 31) << 1) + one / x;
+ }
+
+ if (ix < 0x3fd00000) /* |x| <1/4 */
+ {
+ if (ix < 0x38d00000) /* |x|<2**-114 */
+ return one - x;
+ return one - __erfl (x);
+ }
+ if (ix < 0x3ff40000) /* 1.25 */
+ {
+ x = u.value;
+ i = 8.0 * x;
+ switch (i)
+ {
+ case 2:
+ z = x - 0.25L;
+ y = C13b + z * neval (z, RNr13, NRNr13) / deval (z, RDr13, NRDr13);
+ y += C13a;
+ break;
+ case 3:
+ z = x - 0.375L;
+ y = C14b + z * neval (z, RNr14, NRNr14) / deval (z, RDr14, NRDr14);
+ y += C14a;
+ break;
+ case 4:
+ z = x - 0.5L;
+ y = C15b + z * neval (z, RNr15, NRNr15) / deval (z, RDr15, NRDr15);
+ y += C15a;
+ break;
+ case 5:
+ z = x - 0.625L;
+ y = C16b + z * neval (z, RNr16, NRNr16) / deval (z, RDr16, NRDr16);
+ y += C16a;
+ break;
+ case 6:
+ z = x - 0.75L;
+ y = C17b + z * neval (z, RNr17, NRNr17) / deval (z, RDr17, NRDr17);
+ y += C17a;
+ break;
+ case 7:
+ z = x - 0.875L;
+ y = C18b + z * neval (z, RNr18, NRNr18) / deval (z, RDr18, NRDr18);
+ y += C18a;
+ break;
+ case 8:
+ z = x - 1.0L;
+ y = C19b + z * neval (z, RNr19, NRNr19) / deval (z, RDr19, NRDr19);
+ y += C19a;
+ break;
+ case 9:
+ z = x - 1.125L;
+ y = C20b + z * neval (z, RNr20, NRNr20) / deval (z, RDr20, NRDr20);
+ y += C20a;
+ break;
+ }
+ if (sign & 0x80000000)
+ y = 2.0L - y;
+ return y;
+ }
+ /* 1.25 < |x| < 107 */
+ if (ix < 0x405ac000)
+ {
+ /* x < -9 */
+ if ((ix >= 0x40220000) && (sign & 0x80000000))
+ return two - tiny;
+
+ x = fabsl (x);
+ z = one / (x * x);
+ i = 8.0 / x;
+ switch (i)
+ {
+ default:
+ case 0:
+ p = neval (z, RNr1, NRNr1) / deval (z, RDr1, NRDr1);
+ break;
+ case 1:
+ p = neval (z, RNr2, NRNr2) / deval (z, RDr2, NRDr2);
+ break;
+ case 2:
+ p = neval (z, RNr3, NRNr3) / deval (z, RDr3, NRDr3);
+ break;
+ case 3:
+ p = neval (z, RNr4, NRNr4) / deval (z, RDr4, NRDr4);
+ break;
+ case 4:
+ p = neval (z, RNr5, NRNr5) / deval (z, RDr5, NRDr5);
+ break;
+ case 5:
+ p = neval (z, RNr6, NRNr6) / deval (z, RDr6, NRDr6);
+ break;
+ case 6:
+ p = neval (z, RNr7, NRNr7) / deval (z, RDr7, NRDr7);
+ break;
+ case 7:
+ p = neval (z, RNr8, NRNr8) / deval (z, RDr8, NRDr8);
+ break;
+ }
+ u.value = x;
+ u.parts32.w3 = 0;
+ u.parts32.w2 &= 0xffffe000;
+ z = u.value;
+ r = __ieee754_expl (-z * z - 0.5625) *
+ __ieee754_expl ((z - x) * (z + x) + p);
+ if ((sign & 0x80000000) == 0)
+ return r / x;
+ else
+ return two - r / x;
+ }
+ else
+ {
+ if ((sign & 0x80000000) == 0)
+ return tiny * tiny;
+ else
+ return two - tiny;
+ }
+}
+
+long_double_symbol (libm, __erfcl, erfcl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c b/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c
new file mode 100644
index 0000000000..4908d4e4f3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c
@@ -0,0 +1,160 @@
+/* expm1l.c
+ *
+ * Exponential function, minus 1
+ * 128-bit long double precision
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, expm1l();
+ *
+ * y = expm1l( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns e (2.71828...) raised to the x power, minus one.
+ *
+ * Range reduction is accomplished by separating the argument
+ * into an integer k and fraction f such that
+ *
+ * x k f
+ * e = 2 e.
+ *
+ * An expansion x + .5 x^2 + x^3 R(x) approximates exp(f) - 1
+ * in the basic range [-0.5 ln 2, 0.5 ln 2].
+ *
+ *
+ * ACCURACY:
+ *
+ * Relative error:
+ * arithmetic domain # trials peak rms
+ * IEEE -79,+MAXLOG 100,000 1.7e-34 4.5e-35
+ *
+ */
+
+/* Copyright 2001 by Stephen L. Moshier
+
+ This 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.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+/* exp(x) - 1 = x + 0.5 x^2 + x^3 P(x)/Q(x)
+ -.5 ln 2 < x < .5 ln 2
+ Theoretical peak relative error = 8.1e-36 */
+
+static const long double
+ P0 = 2.943520915569954073888921213330863757240E8L,
+ P1 = -5.722847283900608941516165725053359168840E7L,
+ P2 = 8.944630806357575461578107295909719817253E6L,
+ P3 = -7.212432713558031519943281748462837065308E5L,
+ P4 = 4.578962475841642634225390068461943438441E4L,
+ P5 = -1.716772506388927649032068540558788106762E3L,
+ P6 = 4.401308817383362136048032038528753151144E1L,
+ P7 = -4.888737542888633647784737721812546636240E-1L,
+ Q0 = 1.766112549341972444333352727998584753865E9L,
+ Q1 = -7.848989743695296475743081255027098295771E8L,
+ Q2 = 1.615869009634292424463780387327037251069E8L,
+ Q3 = -2.019684072836541751428967854947019415698E7L,
+ Q4 = 1.682912729190313538934190635536631941751E6L,
+ Q5 = -9.615511549171441430850103489315371768998E4L,
+ Q6 = 3.697714952261803935521187272204485251835E3L,
+ Q7 = -8.802340681794263968892934703309274564037E1L,
+ /* Q8 = 1.000000000000000000000000000000000000000E0 */
+/* C1 + C2 = ln 2 */
+
+ C1 = 6.93145751953125E-1L,
+ C2 = 1.428606820309417232121458176568075500134E-6L,
+/* ln (2^16384 * (1 - 2^-113)) */
+ maxlog = 1.1356523406294143949491931077970764891253E4L,
+/* ln 2^-114 */
+ minarg = -7.9018778583833765273564461846232128760607E1L, big = 2e307L;
+
+
+long double
+__expm1l (long double x)
+{
+ long double px, qx, xx;
+ int32_t ix, sign;
+ ieee854_long_double_shape_type u;
+ int k;
+
+ /* Detect infinity and NaN. */
+ u.value = x;
+ ix = u.parts32.w0;
+ sign = ix & 0x80000000;
+ ix &= 0x7fffffff;
+ if (ix >= 0x7ff00000)
+ {
+ /* Infinity. */
+ if (((ix & 0xfffff) | u.parts32.w1 | (u.parts32.w2&0x7fffffff) | u.parts32.w3) == 0)
+ {
+ if (sign)
+ return -1.0L;
+ else
+ return x;
+ }
+ /* NaN. No invalid exception. */
+ return x;
+ }
+
+ /* expm1(+- 0) = +- 0. */
+ if ((ix == 0) && (u.parts32.w1 | (u.parts32.w2&0x7fffffff) | u.parts32.w3) == 0)
+ return x;
+
+ /* Overflow. */
+ if (x > maxlog)
+ return (big * big);
+
+ /* Minimum value. */
+ if (x < minarg)
+ return (4.0/big - 1.0L);
+
+ /* Express x = ln 2 (k + remainder), remainder not exceeding 1/2. */
+ xx = C1 + C2; /* ln 2. */
+ px = __floorl (0.5 + x / xx);
+ k = px;
+ /* remainder times ln 2 */
+ x -= px * C1;
+ x -= px * C2;
+
+ /* Approximate exp(remainder ln 2). */
+ px = (((((((P7 * x
+ + P6) * x
+ + P5) * x + P4) * x + P3) * x + P2) * x + P1) * x + P0) * x;
+
+ qx = (((((((x
+ + Q7) * x
+ + Q6) * x + Q5) * x + Q4) * x + Q3) * x + Q2) * x + Q1) * x + Q0;
+
+ xx = x * x;
+ qx = x + (0.5 * xx + xx * px / qx);
+
+ /* exp(x) = exp(k ln 2) exp(remainder ln 2) = 2^k exp(remainder ln 2).
+
+ We have qx = exp(remainder ln 2) - 1, so
+ exp(x) - 1 = 2^k (qx + 1) - 1
+ = 2^k qx + 2^k - 1. */
+
+ px = ldexpl (1.0L, k);
+ x = px * qx + (px - 1.0);
+ return x;
+}
+libm_hidden_def (__expm1l)
+long_double_symbol (libm, __expm1l, expm1l);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c b/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c
new file mode 100644
index 0000000000..62663125ee
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c
@@ -0,0 +1,43 @@
+/* s_fabsl.c -- long double version of s_fabs.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+
+/*
+ * fabsl(x) returns the absolute value of x.
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+ long double __fabsl(long double x)
+#else
+ long double __fabsl(x)
+ long double x;
+#endif
+{
+ u_int64_t hx, lx;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ lx = lx ^ ( hx & 0x8000000000000000LL );
+ hx = hx & 0x7fffffffffffffffLL;
+ SET_LDOUBLE_WORDS64(hx,lx,x);
+ return x;
+}
+long_double_symbol (libm, __fabsl, fabsl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_finitel.c b/sysdeps/ieee754/ldbl-128ibm/s_finitel.c
new file mode 100644
index 0000000000..142d3ed90b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_finitel.c
@@ -0,0 +1,42 @@
+/* s_finitel.c -- long double version of s_finite.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * finitel(x) returns 1 is x is finite, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+int
+___finitel (long double x)
+{
+ int64_t hx;
+ GET_LDOUBLE_MSW64(hx,x);
+ return (int)((u_int64_t)((hx&0x7fffffffffffffffLL)
+ -0x7ff0000000000000LL)>>63);
+}
+hidden_ver (___finitel, __finitel)
+#ifndef IS_IN_libm
+weak_alias (___finitel, ____finitel)
+long_double_symbol (libc, ___finitel, finitel);
+long_double_symbol (libc, ____finitel, __finitel);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_floorl.c b/sysdeps/ieee754/ldbl-128ibm/s_floorl.c
new file mode 100644
index 0000000000..e8ef6e849d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_floorl.c
@@ -0,0 +1,118 @@
+/* Round to int long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <math.h>
+#include <fenv.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__floorl (long double x)
+#else
+long double
+__floorl (x)
+ long double x;
+#endif
+{
+ static const double TWO52 = 4503599627370496.0L;
+ int mode = fegetround();
+ union ibm_extended_long_double u;
+
+ u.d = x;
+
+ if (fabs (u.dd[0]) < TWO52)
+ {
+ fesetround(FE_DOWNWARD);
+ if (u.dd[0] > 0.0)
+ {
+ u.dd[0] += TWO52;
+ u.dd[0] -= TWO52;
+ }
+ else if (u.dd[0] < 0.0)
+ {
+ u.dd[0] -= TWO52;
+ u.dd[0] += TWO52;
+ }
+ u.dd[1] = 0.0;
+ fesetround(mode);
+ }
+ else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
+ {
+ double high, low;
+ /* In this case we have to round the low double and handle any
+ adjustment to the high double that may be caused by rounding
+ (up). This is complicated by the fact that the high double
+ may already be rounded and the low double may have the
+ opposite sign to compensate. */
+ if (u.dd[0] > 0.0)
+ {
+ if (u.dd[1] > 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] < 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+ high = nextafter (u.dd[0], 0.0);
+ low = u.dd[1] + (u.dd[0] - high);
+ }
+ fesetround(FE_DOWNWARD);
+ low += TWO52;
+ low -= TWO52;
+ }
+ else if (u.dd[0] < 0.0)
+ {
+ if (u.dd[1] < 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] > 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+ high = nextafter (u.dd[0], 0.0);
+ low = u.dd[1] + (u.dd[0] - high);
+ }
+ fesetround(FE_DOWNWARD);
+ low -= TWO52;
+ low += TWO52;
+ }
+ fesetround(mode);
+ u.dd[0] = high + low;
+ u.dd[1] = high - u.dd[0] + low;
+ }
+
+ return u.d;
+}
+
+long_double_symbol (libm, __floorl, floorl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c b/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c
new file mode 100644
index 0000000000..3ca178a3c5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c
@@ -0,0 +1,82 @@
+/* Return classification value corresponding to argument.
+ Copyright (C) 1997,1999,2002,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+ Jakub Jelinek <jj@ultra.linux.cz>, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+ /*
+ * hx lx
+ * +NaN 7ffn nnnn nnnn nnnn xxxx xxxx xxxx xxxx
+ * -NaN fffn nnnn nnnn nnnn xxxx xxxx xxxx xxxx
+ * +Inf 7ff0 0000 0000 0000 xxxx xxxx xxxx xxxx
+ * -Inf fff0 0000 0000 0000 xxxx xxxx xxxx xxxx
+ * +0 0000 0000 0000 0000
+ * -0 8000 0000 0000 0000
+ * +normal 001n nnnn nnnn nnnn (smallest)
+ * -normal 801n nnnn nnnn nnnn (smallest)
+ * +normal 7fen nnnn nnnn nnnn (largest)
+ * -normal ffen nnnn nnnn nnnn (largest)
+ * +denorm 000n nnnn nnnn nnnn
+ * -denorm 800n nnnn nnnn nnnn
+ */
+
+int
+___fpclassifyl (long double x)
+{
+ u_int64_t hx, lx;
+ int retval = FP_NORMAL;
+
+ GET_LDOUBLE_WORDS64 (hx, lx, x);
+ if ((hx & 0x7ff0000000000000ULL) == 0x7ff0000000000000ULL) {
+ /* +/-NaN or +/-Inf */
+ if (hx & 0x000fffffffffffffULL) {
+ /* +/-NaN */
+ retval = FP_NAN;
+ } else {
+ retval = FP_INFINITE;
+ }
+ } else {
+ /* +/-zero or +/- normal or +/- denormal */
+ if (hx & 0x7fffffffffffffffULL) {
+ /* +/- normal or +/- denormal */
+ if ((hx & 0x7ff0000000000000ULL) >= 0x0360000000000000ULL) {
+ /* +/- normal */
+ retval = FP_NORMAL;
+ } else {
+ /* +/- denormal */
+ retval = FP_SUBNORMAL;
+ }
+ } else {
+ /* +/- zero */
+ retval = FP_ZERO;
+ }
+ }
+
+ return retval;
+}
+long_double_symbol (libm, ___fpclassifyl, __fpclassifyl);
+#ifdef __LONG_DOUBLE_MATH_OPTIONAL
+libm_hidden_ver (___fpclassifyl, __fpclassifyl)
+#else
+libm_hidden_def (__fpclassifyl)
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c b/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c
new file mode 100644
index 0000000000..fab566da3b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c
@@ -0,0 +1,92 @@
+/* s_frexpl.c -- long double version of s_frexp.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * for non-zero x
+ * x = frexpl(arg,&exp);
+ * return a long double fp quantity x such that 0.5 <= |x| <1.0
+ * and the corresponding binary exponent "exp". That is
+ * arg = x*2^exp.
+ * If arg is inf, 0.0, or NaN, then frexpl(arg,&exp) returns arg
+ * with *exp=0.
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+two107 = 162259276829213363391578010288128.0; /* 0x4670000000000000, 0 */
+
+#ifdef __STDC__
+ long double __frexpl(long double x, int *eptr)
+#else
+ long double __frexpl(x, eptr)
+ long double x; int *eptr;
+#endif
+{
+ u_int64_t hx, lx, ix, ixl;
+ int64_t explo;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ ixl = 0x7fffffffffffffffULL&lx;
+ ix = 0x7fffffffffffffffULL&hx;
+ *eptr = 0;
+ if(ix>=0x7ff0000000000000ULL||((ix|ixl)==0)) return x; /* 0,inf,nan */
+ if (ix<0x0010000000000000ULL) { /* subnormal */
+ x *= two107;
+ GET_LDOUBLE_MSW64(hx,x);
+ ix = hx&0x7fffffffffffffffULL;
+ *eptr = -107;
+ }
+ *eptr += (ix>>52)-1022;
+
+ if (ixl != 0ULL) {
+ explo = (ixl>>52) - (ix>>52) + 0x3fe;
+ if ((ixl&0x7ff0000000000000ULL) == 0LL) {
+ /* the lower double is a denomal so we need to correct its
+ mantissa and perhaps its exponent. */
+ int cnt;
+
+ if (sizeof (ixl) == sizeof (long))
+ cnt = __builtin_clzl (ixl);
+ else if ((ixl >> 32) != 0)
+ cnt = __builtin_clzl ((long) (ixl >> 32));
+ else
+ cnt = __builtin_clzl ((long) ixl) + 32;
+ cnt = cnt - 12;
+ lx = (lx&0x8000000000000000ULL) | ((explo-cnt)<<52)
+ | ((ixl<<(cnt+1))&0x000fffffffffffffULL);
+ } else
+ lx = (lx&0x800fffffffffffffULL) | (explo<<52);
+ } else
+ lx = 0ULL;
+
+ hx = (hx&0x800fffffffffffffULL) | 0x3fe0000000000000ULL;
+ SET_LDOUBLE_WORDS64(x,hx,lx);
+ return x;
+}
+#ifdef IS_IN_libm
+long_double_symbol (libm, __frexpl, frexpl);
+#else
+long_double_symbol (libc, __frexpl, frexpl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_ilogbl.c b/sysdeps/ieee754/ldbl-128ibm/s_ilogbl.c
new file mode 100644
index 0000000000..428854d770
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_ilogbl.c
@@ -0,0 +1,63 @@
+/* s_ilogbl.c -- long double version of s_ilogb.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* ilogbl(long double x)
+ * return the binary exponent of non-zero x
+ * ilogbl(0) = FP_ILOGB0
+ * ilogbl(NaN) = FP_ILOGBNAN (no signal is raised)
+ * ilogbl(+-Inf) = INT_MAX (no signal is raised)
+ */
+
+#include <limits.h>
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+ int __ilogbl(long double x)
+#else
+ int __ilogbl(x)
+ long double x;
+#endif
+{
+ int64_t hx,lx;
+ int ix;
+
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ hx &= 0x7fffffffffffffffLL;
+ if(hx <= 0x0010000000000000LL) {
+ if((hx|(lx&0x7fffffffffffffffLL))==0)
+ return FP_ILOGB0; /* ilogbl(0) = FP_ILOGB0 */
+ else /* subnormal x */
+ if(hx==0) {
+ for (ix = -1043; lx>0; lx<<=1) ix -=1;
+ } else {
+ for (ix = -1022, hx<<=11; hx>0; hx<<=1) ix -=1;
+ }
+ return ix;
+ }
+ else if (hx<0x7ff0000000000000LL) return (hx>>52)-0x3ff;
+ else if (FP_ILOGBNAN != INT_MAX) {
+ /* ISO C99 requires ilogbl(+-Inf) == INT_MAX. */
+ if (((hx^0x7ff0000000000000LL)|lx) == 0)
+ return INT_MAX;
+ }
+ return FP_ILOGBNAN;
+}
+long_double_symbol (libm, __ilogbl, ilogbl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c b/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c
new file mode 100644
index 0000000000..717b57466d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c
@@ -0,0 +1,35 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Change for long double by Jakub Jelinek <jj@ultra.linux.cz>
+ * Public domain.
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+int
+___isinfl (long double x)
+{
+ int64_t hx,lx;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ lx = (lx & 0x7fffffffffffffffLL);
+ lx |= (hx & 0x7fffffffffffffffLL) ^ 0x7ff0000000000000LL;
+ lx |= -lx;
+ return ~(lx >> 63) & (hx >> 62);
+}
+hidden_ver (___isinfl, __isinfl)
+#ifndef IS_IN_libm
+weak_alias (___isinfl, ____isinfl)
+long_double_symbol (libc, ___isinfl, isinfl);
+long_double_symbol (libc, ____isinfl, __isinfl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c b/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c
new file mode 100644
index 0000000000..ae5ba8e1ff
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c
@@ -0,0 +1,43 @@
+/* s_isnanl.c -- long double version of s_isnan.c.
+ * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * isnanl(x) returns 1 is x is nan, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+int
+___isnanl (long double x)
+{
+ int64_t hx,lx;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ hx &= 0x7fffffffffffffffLL;
+ hx = 0x7ff0000000000000LL - hx;
+ return (int)((u_int64_t)hx>>63);
+}
+hidden_ver (___isnanl, __isnanl)
+#ifndef IS_IN_libm
+weak_alias (___isnanl, ____isnanl)
+long_double_symbol (libc, ___isnanl, isnanl);
+long_double_symbol (libc, ____isnanl, __isnanl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
new file mode 100644
index 0000000000..bacf1bee0d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
@@ -0,0 +1,124 @@
+/* Round to int long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <math.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long long
+__llrintl (long double x)
+#else
+long long
+__llrintl (x)
+ long double x;
+#endif
+{
+ static const double TWO52 = 4503599627370496.0L;
+ union ibm_extended_long_double u;
+ long long result = __LONG_LONG_MAX__;
+
+ u.d = x;
+
+ if (fabs (u.dd[0]) < TWO52)
+ {
+ double high = u.dd[0];
+ if (high > 0.0)
+ {
+ high += TWO52;
+ high -= TWO52;
+ if (high == -0.0) high = 0.0;
+ }
+ else if (high < 0.0)
+ {
+ high -= TWO52;
+ high += TWO52;
+ if (high == 0.0) high = -0.0;
+ }
+ result = high;
+ }
+ else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
+ {
+ double high, low, tau;
+ long long lowint;
+ /* In this case we have to round the low double and handle any
+ adjustment to the high double that may be caused by rounding
+ (up). This is complicated by the fact that the high double
+ may already be rounded and the low double may have the
+ opposite sign to compensate. */
+ if (u.dd[0] > 0.0)
+ {
+ if (u.dd[1] > 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] < 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+
+ tau = nextafter (u.dd[0], 0.0);
+ tau = (u.dd[0] - tau) * 2.0;
+ high = u.dd[0] - tau;
+ low = u.dd[1] + tau;
+ }
+ low += TWO52;
+ low -= TWO52;
+ }
+ else if (u.dd[0] < 0.0)
+ {
+ if (u.dd[1] < 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] > 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+ tau = nextafter (u.dd[0], 0.0);
+ tau = (u.dd[0] - tau) * 2.0;
+ high = u.dd[0] - tau;
+ low = u.dd[1] + tau;
+ }
+ low = TWO52 - low;
+ low = -(low - TWO52);
+ }
+ lowint = low;
+ result = high;
+ result += lowint;
+ }
+ else
+ result = u.dd[0];
+
+ return result;
+}
+
+long_double_symbol (libm, __llrintl, llrintl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
new file mode 100644
index 0000000000..567e7ecc07
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
@@ -0,0 +1,128 @@
+/* Round to long long, long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <math.h>
+#include <fenv.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long long
+__llroundl (long double x)
+#else
+long long
+__llroundl (x)
+ long double x;
+#endif
+{
+ static const double TWO52 = 4503599627370496.0;
+ static const double HALF = 0.5;
+ int mode = fegetround();
+ union ibm_extended_long_double u;
+ long long result = __LONG_LONG_MAX__;
+
+ u.d = x;
+
+ if (fabs (u.dd[0]) < TWO52)
+ {
+ fesetround(FE_TOWARDZERO);
+ if (u.dd[0] > 0.0)
+ {
+ u.dd[0] += HALF;
+ u.dd[0] += TWO52;
+ u.dd[0] -= TWO52;
+ }
+ else if (u.dd[0] < 0.0)
+ {
+ u.dd[0] = TWO52 - (u.dd[0] - HALF);
+ u.dd[0] = -(u.dd[0] - TWO52);
+ }
+ fesetround(mode);
+ result = u.dd[0];
+ }
+ else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
+ {
+ double high, low;
+ long long lowint;
+ /* In this case we have to round the low double and handle any
+ adjustment to the high double that may be caused by rounding
+ (up). This is complicated by the fact that the high double
+ may already be rounded and the low double may have the
+ opposite sign to compensate. */
+ if (u.dd[0] > 0.0)
+ {
+ if (u.dd[1] > 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] < 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+ high = nextafter (u.dd[0], 0.0);
+ low = u.dd[1] + (u.dd[0] - high);
+ }
+ fesetround(FE_TOWARDZERO);
+ low += HALF;
+ low += TWO52;
+ low -= TWO52;
+ }
+ else if (u.dd[0] < 0.0)
+ {
+ if (u.dd[1] < 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] > 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+ high = nextafter (u.dd[0], 0.0);
+ low = u.dd[1] + (u.dd[0] - high);
+ }
+ fesetround(FE_TOWARDZERO);
+ low -= HALF;
+ low = TWO52 - low;
+ low = -(low - TWO52);
+ }
+ fesetround(mode);
+ lowint = low;
+ result = high;
+ result += lowint;
+ }
+ else
+ {
+ result = u.dd[0];
+ }
+ return result;
+}
+
+long_double_symbol (libm, __llroundl, llroundl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c b/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c
new file mode 100644
index 0000000000..f1863fb688
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c
@@ -0,0 +1,257 @@
+/* log1pl.c
+ *
+ * Relative error logarithm
+ * Natural logarithm of 1+x, 128-bit long double precision
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, log1pl();
+ *
+ * y = log1pl( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns the base e (2.718...) logarithm of 1+x.
+ *
+ * The argument 1+x is separated into its exponent and fractional
+ * parts. If the exponent is between -1 and +1, the logarithm
+ * of the fraction is approximated by
+ *
+ * log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x).
+ *
+ * Otherwise, setting z = 2(w-1)/(w+1),
+ *
+ * log(w) = z + z^3 P(z)/Q(z).
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ * Relative error:
+ * arithmetic domain # trials peak rms
+ * IEEE -1, 8 100000 1.9e-34 4.3e-35
+ */
+
+/* Copyright 2001 by Stephen L. Moshier
+
+ This 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.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+/* Coefficients for log(1+x) = x - x^2 / 2 + x^3 P(x)/Q(x)
+ * 1/sqrt(2) <= 1+x < sqrt(2)
+ * Theoretical peak relative error = 5.3e-37,
+ * relative peak error spread = 2.3e-14
+ */
+static const long double
+ P12 = 1.538612243596254322971797716843006400388E-6L,
+ P11 = 4.998469661968096229986658302195402690910E-1L,
+ P10 = 2.321125933898420063925789532045674660756E1L,
+ P9 = 4.114517881637811823002128927449878962058E2L,
+ P8 = 3.824952356185897735160588078446136783779E3L,
+ P7 = 2.128857716871515081352991964243375186031E4L,
+ P6 = 7.594356839258970405033155585486712125861E4L,
+ P5 = 1.797628303815655343403735250238293741397E5L,
+ P4 = 2.854829159639697837788887080758954924001E5L,
+ P3 = 3.007007295140399532324943111654767187848E5L,
+ P2 = 2.014652742082537582487669938141683759923E5L,
+ P1 = 7.771154681358524243729929227226708890930E4L,
+ P0 = 1.313572404063446165910279910527789794488E4L,
+ /* Q12 = 1.000000000000000000000000000000000000000E0L, */
+ Q11 = 4.839208193348159620282142911143429644326E1L,
+ Q10 = 9.104928120962988414618126155557301584078E2L,
+ Q9 = 9.147150349299596453976674231612674085381E3L,
+ Q8 = 5.605842085972455027590989944010492125825E4L,
+ Q7 = 2.248234257620569139969141618556349415120E5L,
+ Q6 = 6.132189329546557743179177159925690841200E5L,
+ Q5 = 1.158019977462989115839826904108208787040E6L,
+ Q4 = 1.514882452993549494932585972882995548426E6L,
+ Q3 = 1.347518538384329112529391120390701166528E6L,
+ Q2 = 7.777690340007566932935753241556479363645E5L,
+ Q1 = 2.626900195321832660448791748036714883242E5L,
+ Q0 = 3.940717212190338497730839731583397586124E4L;
+
+/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2),
+ * where z = 2(x-1)/(x+1)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 1.1e-35,
+ * relative peak error spread 1.1e-9
+ */
+static const long double
+ R5 = -8.828896441624934385266096344596648080902E-1L,
+ R4 = 8.057002716646055371965756206836056074715E1L,
+ R3 = -2.024301798136027039250415126250455056397E3L,
+ R2 = 2.048819892795278657810231591630928516206E4L,
+ R1 = -8.977257995689735303686582344659576526998E4L,
+ R0 = 1.418134209872192732479751274970992665513E5L,
+ /* S6 = 1.000000000000000000000000000000000000000E0L, */
+ S5 = -1.186359407982897997337150403816839480438E2L,
+ S4 = 3.998526750980007367835804959888064681098E3L,
+ S3 = -5.748542087379434595104154610899551484314E4L,
+ S2 = 4.001557694070773974936904547424676279307E5L,
+ S1 = -1.332535117259762928288745111081235577029E6L,
+ S0 = 1.701761051846631278975701529965589676574E6L;
+
+/* C1 + C2 = ln 2 */
+static const long double C1 = 6.93145751953125E-1L;
+static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
+
+static const long double sqrth = 0.7071067811865475244008443621048490392848L;
+/* ln (2^16384 * (1 - 2^-113)) */
+static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
+static const long double big = 2e300L;
+static const long double zero = 0.0L;
+
+#if 1
+/* Make sure these are prototyped. */
+long double frexpl (long double, int *);
+long double ldexpl (long double, int);
+#endif
+
+
+long double
+__log1pl (long double xm1)
+{
+ long double x, y, z, r, s;
+ ieee854_long_double_shape_type u;
+ int32_t hx;
+ int e;
+
+ /* Test for NaN or infinity input. */
+ u.value = xm1;
+ hx = u.parts32.w0;
+ if (hx >= 0x7ff00000)
+ return xm1;
+
+ /* log1p(+- 0) = +- 0. */
+ if (((hx & 0x7fffffff) == 0)
+ && (u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3) == 0)
+ return xm1;
+
+ x = xm1 + 1.0L;
+
+ /* log1p(-1) = -inf */
+ if (x <= 0.0L)
+ {
+ if (x == 0.0L)
+ return (-1.0L / (x - x));
+ else
+ return (zero / (x - x));
+ }
+
+ /* Separate mantissa from exponent. */
+
+ /* Use frexp used so that denormal numbers will be handled properly. */
+ x = frexpl (x, &e);
+
+ /* Logarithm using log(x) = z + z^3 P(z^2)/Q(z^2),
+ where z = 2(x-1)/x+1). */
+ if ((e > 2) || (e < -2))
+ {
+ if (x < sqrth)
+ { /* 2( 2x-1 )/( 2x+1 ) */
+ e -= 1;
+ z = x - 0.5L;
+ y = 0.5L * z + 0.5L;
+ }
+ else
+ { /* 2 (x-1)/(x+1) */
+ z = x - 0.5L;
+ z -= 0.5L;
+ y = 0.5L * x + 0.5L;
+ }
+ x = z / y;
+ z = x * x;
+ r = ((((R5 * z
+ + R4) * z
+ + R3) * z
+ + R2) * z
+ + R1) * z
+ + R0;
+ s = (((((z
+ + S5) * z
+ + S4) * z
+ + S3) * z
+ + S2) * z
+ + S1) * z
+ + S0;
+ z = x * (z * r / s);
+ z = z + e * C2;
+ z = z + x;
+ z = z + e * C1;
+ return (z);
+ }
+
+
+ /* Logarithm using log(1+x) = x - .5x^2 + x^3 P(x)/Q(x). */
+
+ if (x < sqrth)
+ {
+ e -= 1;
+ if (e != 0)
+ x = 2.0L * x - 1.0L; /* 2x - 1 */
+ else
+ x = xm1;
+ }
+ else
+ {
+ if (e != 0)
+ x = x - 1.0L;
+ else
+ x = xm1;
+ }
+ z = x * x;
+ r = (((((((((((P12 * x
+ + P11) * x
+ + P10) * x
+ + P9) * x
+ + P8) * x
+ + P7) * x
+ + P6) * x
+ + P5) * x
+ + P4) * x
+ + P3) * x
+ + P2) * x
+ + P1) * x
+ + P0;
+ s = (((((((((((x
+ + Q11) * x
+ + Q10) * x
+ + Q9) * x
+ + Q8) * x
+ + Q7) * x
+ + Q6) * x
+ + Q5) * x
+ + Q4) * x
+ + Q3) * x
+ + Q2) * x
+ + Q1) * x
+ + Q0;
+ y = x * (z * r / s);
+ y = y + e * C2;
+ z = y - 0.5L * z;
+ z = z + x;
+ z = z + e * C1;
+ return (z);
+}
+
+long_double_symbol (libm, __log1pl, log1pl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
new file mode 100644
index 0000000000..0c61cdae25
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
@@ -0,0 +1,47 @@
+/* s_logbl.c -- long double version of s_logb.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * long double logbl(x)
+ * IEEE 754 logb. Included to pass IEEE test suite. Not recommend.
+ * Use ilogb instead.
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+ long double __logbl(long double x)
+#else
+ long double __logbl(x)
+ long double x;
+#endif
+{
+ int64_t lx,hx;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ hx &= 0x7fffffffffffffffLL; /* high |x| */
+ if((hx|(lx&0x7fffffffffffffffLL))==0) return -1.0/fabs(x);
+ if(hx>=0x7ff0000000000000LL) return x*x;
+ if((hx>>=52)==0) /* IEEE 754 logb */
+ return -1022.0;
+ else
+ return (long double) (hx-0x3ff);
+}
+long_double_symbol (libm, __logbl, logbl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
new file mode 100644
index 0000000000..029247568c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
@@ -0,0 +1,9 @@
+/* FIXME */
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+long int __lrintl (long double d)
+{
+ return llrintl (d);
+}
+long_double_symbol (libm, __lrintl, lrintl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
new file mode 100644
index 0000000000..7c5de36184
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
@@ -0,0 +1,9 @@
+/* FIXME */
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+long int __lroundl (long double d)
+{
+ return llroundl (d);
+}
+long_double_symbol (libm, __lroundl, lroundl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_modfl.c b/sysdeps/ieee754/ldbl-128ibm/s_modfl.c
new file mode 100644
index 0000000000..f2e65f0c44
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_modfl.c
@@ -0,0 +1,94 @@
+/* s_modfl.c -- long double version of s_modf.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * modfl(long double x, long double *iptr)
+ * return fraction part of x, and return x's integral part in *iptr.
+ * Method:
+ * Bit twiddling.
+ *
+ * Exception:
+ * No exception.
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double one = 1.0;
+#else
+static long double one = 1.0;
+#endif
+
+#ifdef __STDC__
+ long double __modfl(long double x, long double *iptr)
+#else
+ long double __modfl(x, iptr)
+ long double x,*iptr;
+#endif
+{
+ int64_t i0,i1,j0;
+ u_int64_t i;
+ GET_LDOUBLE_WORDS64(i0,i1,x);
+ i1 &= 0x000fffffffffffffLL;
+ j0 = ((i0>>52)&0x7ff)-0x3ff; /* exponent of x */
+ if(j0<52) { /* integer part in high x */
+ if(j0<0) { /* |x|<1 */
+ /* *iptr = +-0 */
+ SET_LDOUBLE_WORDS64(*iptr,i0&0x8000000000000000ULL,0);
+ return x;
+ } else {
+ i = (0x000fffffffffffffLL)>>j0;
+ if(((i0&i)|(i1&0x7fffffffffffffffLL))==0) { /* x is integral */
+ *iptr = x;
+ /* return +-0 */
+ SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
+ return x;
+ } else {
+ SET_LDOUBLE_WORDS64(*iptr,i0&(~i),0);
+ return x - *iptr;
+ }
+ }
+ } else if (j0>103) { /* no fraction part */
+ *iptr = x*one;
+ /* We must handle NaNs separately. */
+ if (j0 == 0x400 && ((i0 & 0x000fffffffffffffLL) | i1))
+ return x*one;
+ /* return +-0 */
+ SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
+ return x;
+ } else { /* fraction part in low x */
+ i = -1ULL>>(j0-52);
+ if((i1&i)==0) { /* x is integral */
+ *iptr = x;
+ /* return +-0 */
+ SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
+ return x;
+ } else {
+ SET_LDOUBLE_WORDS64(*iptr,i0,i1&(~i));
+ return x - *iptr;
+ }
+ }
+}
+#ifdef IS_IN_libm
+long_double_symbol (libm, __modfl, modfl);
+#else
+long_double_symbol (libc, __modfl, modfl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c b/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
new file mode 100644
index 0000000000..2561fda329
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
@@ -0,0 +1,125 @@
+/* Round to int long double floating-point values without raising inexact.
+ IBM extended format long double version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <math.h>
+#include <fenv.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__nearbyintl (long double x)
+#else
+long double
+__nearbyintl (x)
+ long double x;
+#endif
+{
+ fenv_t env;
+ static const long double TWO52 = 4503599627370496.0L;
+ union ibm_extended_long_double u;
+ u.d = x;
+
+ if (fabs (u.dd[0]) < TWO52)
+ {
+ double high = u.dd[0];
+ feholdexcept (&env);
+ if (high > 0.0)
+ {
+ high += TWO52;
+ high -= TWO52;
+ if (high == -0.0) high = 0.0;
+ }
+ else if (high < 0.0)
+ {
+ high -= TWO52;
+ high += TWO52;
+ if (high == 0.0) high = -0.0;
+ }
+ u.dd[0] = high;
+ u.dd[1] = 0.0;
+ fesetenv (&env);
+ }
+ else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
+ {
+ double high, low, tau;
+ /* In this case we have to round the low double and handle any
+ adjustment to the high double that may be caused by rounding
+ (up). This is complicated by the fact that the high double
+ may already be rounded and the low double may have the
+ opposite sign to compensate. */
+ feholdexcept (&env);
+ if (u.dd[0] > 0.0)
+ {
+ if (u.dd[1] > 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] < 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+
+ tau = nextafter (u.dd[0], 0.0);
+ tau = (u.dd[0] - tau) * 2.0;
+ high = u.dd[0] - tau;
+ low = u.dd[1] + tau;
+ }
+ low += TWO52;
+ low -= TWO52;
+ }
+ else if (u.dd[0] < 0.0)
+ {
+ if (u.dd[1] < 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] > 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+ tau = nextafter (u.dd[0], 0.0);
+ tau = (u.dd[0] - tau) * 2.0;
+ high = u.dd[0] - tau;
+ low = u.dd[1] + tau;
+ }
+ low = TWO52 - low;
+ low = -(low - TWO52);
+ }
+ u.dd[0] = high + low;
+ u.dd[1] = high - u.dd[0] + low;
+ fesetenv (&env);
+ }
+
+ return u.d;
+}
+
+long_double_symbol (libm, __nearbyintl, nearbyintl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c b/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
new file mode 100644
index 0000000000..e35ce50829
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
@@ -0,0 +1,108 @@
+/* s_nextafterl.c -- long double version of s_nextafter.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* IEEE functions
+ * nextafterl(x,y)
+ * return the next machine floating-point number of x in the
+ * direction toward y.
+ * Special cases:
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+ long double __nextafterl(long double x, long double y)
+#else
+ long double __nextafterl(x,y)
+ long double x,y;
+#endif
+{
+ int64_t hx,hy,ihx,ihy,ilx,ily;
+ u_int64_t lx,ly;
+
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ GET_LDOUBLE_WORDS64(hy,ly,y);
+ ihx = hx&0x7fffffffffffffffLL; /* |hx| */
+ ilx = lx&0x7fffffffffffffffLL; /* |lx| */
+ ihy = hy&0x7fffffffffffffffLL; /* |hy| */
+ ily = ly&0x7fffffffffffffffLL; /* |ly| */
+
+ if((((ihx&0x7ff0000000000000LL)==0x7ff0000000000000LL)&&
+ ((ihx&0x000fffffffffffffLL)!=0)) || /* x is nan */
+ (((ihy&0x7ff0000000000000LL)==0x7ff0000000000000LL)&&
+ ((ihy&0x000fffffffffffffLL)!=0))) /* y is nan */
+ return x+y; /* signal the nan */
+ if(x==y)
+ return y; /* x=y, return y */
+ if(ihx == 0 && ilx == 0) { /* x == 0 */
+ SET_LDOUBLE_WORDS64(x,hy&0x8000000000000000ULL,1);/* return +-minsubnormal */
+ y = x*x;
+ if(y==x) return y; else return x; /* raise underflow flag */
+ }
+ if(ihx>=0) { /* x > 0 */
+ if(ihx>ihy||((ihx==ihy)&&(ilx>ily))) { /* x > y, x -= ulp */
+
+ if(ilx==0)
+ hx--;
+ else
+ lx--;
+ } else { /* x < y, x += ulp */
+ if((hx==0x7fefffffffffffffLL)&&(lx==0x7c8ffffffffffffeLL))
+ {
+ SET_LDOUBLE_WORDS64(x,0x7ff0000000000000,0x8000000000000000);
+ return x;
+ }
+ else if((hx==0xffefffffffffffffLL)&&(lx==0xfc8ffffffffffffeLL))
+ {
+ SET_LDOUBLE_WORDS64(x,0xfff0000000000000,0x8000000000000000);
+ return x;
+ }
+ else if((lx&0x7fffffffffffffff)==0) hx++;
+ else
+ lx++;
+ }
+ } else { /* x < 0 */
+ if(ihy>=0||ihx>ihy||((ihx==ihy)&&(ilx>ily))){/* x < y, x -= ulp */
+ if((lx&0x7fffffffffffffff)==0)
+ hx--;
+ else
+ lx--;
+ } else { /* x > y, x += ulp */
+ if((lx&0x7fffffffffffffff)==0) hx++;
+ else
+ lx++;
+ }
+ }
+ hy = hx&0x7ff0000000000000LL;
+ if(hy==0x7ff0000000000000LL) return x+x;/* overflow */
+ if(hy==0) { /* underflow */
+ y = x*x;
+ if(y!=x) { /* raise underflow flag */
+ SET_LDOUBLE_WORDS64(y,hx,lx);
+ return y;
+ }
+ }
+ SET_LDOUBLE_WORDS64(x,hx,lx);
+ return x;
+}
+strong_alias (__nextafterl, __nexttowardl)
+long_double_symbol (libm, __nextafterl, nextafterl);
+long_double_symbol (libm, __nexttowardl, nexttowardl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c b/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c
new file mode 100644
index 0000000000..3335100592
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c
@@ -0,0 +1,106 @@
+/* s_nexttoward.c
+ * Conversion from s_nextafter.c by Ulrich Drepper, Cygnus Support,
+ * drepper@cygnus.com and Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* IEEE functions
+ * nexttoward(x,y)
+ * return the next machine floating-point number of x in the
+ * direction toward y.
+ * Special cases:
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+#include <float.h>
+
+#ifdef __STDC__
+ double __nexttoward(double x, long double y)
+#else
+ double __nexttoward(x,y)
+ double x;
+ long double y;
+#endif
+{
+ int32_t hx,ix;
+ int64_t hy,iy;
+ u_int32_t lx;
+ u_int64_t ly,uly;
+
+ EXTRACT_WORDS(hx,lx,x);
+ GET_LDOUBLE_WORDS64(hy,ly,y);
+ ix = hx&0x7fffffff; /* |x| */
+ iy = hy&0x7fffffffffffffffLL; /* |y| */
+ uly = ly&0x7fffffffffffffffLL; /* |y| */
+
+ if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */
+ ((iy>=0x7ff0000000000000LL)&&((iy-0x7ff0000000000000LL)|uly)!=0))
+ /* y is nan */
+ return x+y;
+ if((long double) x==y) return y; /* x=y, return y */
+ if((ix|lx)==0) { /* x == 0 */
+ double x2;
+ INSERT_WORDS(x,(u_int32_t)((hy>>32)&0x80000000),1);/* return +-minsub */
+ x2 = x*x;
+ if(x2==x) return x2; else return x; /* raise underflow flag */
+ }
+ if(hx>=0) { /* x > 0 */
+ if (hy<0||(ix>>20)>(iy>>52)
+ || ((ix>>20)==(iy>>52)
+ && (((((int64_t)hx)<<32)|(lx))>(hy&0x000fffffffffffffLL)
+ || (((((int64_t)hx)<<32)|(lx))==(hy&0x000fffffffffffffLL)
+ )))) { /* x > y, x -= ulp */
+ if(lx==0) hx -= 1;
+ lx -= 1;
+ } else { /* x < y, x += ulp */
+ lx += 1;
+ if(lx==0) hx += 1;
+ }
+ } else { /* x < 0 */
+ if (hy>=0||(ix>>20)>(iy>>52)
+ || ((ix>>20)==(iy>>52)
+ && (((((int64_t)hx)<<32)|(lx))>(hy&0x000fffffffffffffLL)
+ || (((((int64_t)hx)<<32)|(lx))==(hy&0x000fffffffffffffLL)
+ )))) { /* x < y, x -= ulp */
+ if(lx==0) hx -= 1;
+ lx -= 1;
+ } else { /* x > y, x += ulp */
+ lx += 1;
+ if(lx==0) hx += 1;
+ }
+ }
+ hy = hx&0x7ff00000;
+ if(hy>=0x7ff00000) {
+ x = x+x; /* overflow */
+ if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1)
+ /* Force conversion to float. */
+ asm ("" : "=m"(x) : "m"(x));
+ return x;
+ }
+ if(hy<0x00100000) { /* underflow */
+ double x2 = x*x;
+ if(x2!=x) { /* raise underflow flag */
+ INSERT_WORDS(x2,hx,lx);
+ return x2;
+ }
+ }
+ INSERT_WORDS(x,hx,lx);
+ return x;
+}
+long_double_symbol (libm, __nexttoward, nexttoward);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c b/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c
new file mode 100644
index 0000000000..a9373ff822
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c
@@ -0,0 +1,83 @@
+/* s_nexttowardf.c -- float version of s_nextafter.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com
+ * and Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+ float __nexttowardf(float x, long double y)
+#else
+ float __nexttowardf(x,y)
+ float x;
+ long double y;
+#endif
+{
+ int32_t hx,ix;
+ int64_t hy,iy;
+ u_int64_t ly, uly;
+
+ GET_FLOAT_WORD(hx,x);
+ GET_LDOUBLE_WORDS64(hy,ly,y);
+ ix = hx&0x7fffffff; /* |x| */
+ iy = hy&0x7fffffffffffffffLL; /* |y| */
+ uly = ly&0x7fffffffffffffffLL; /* |y| */
+
+ if((ix>0x7f800000) || /* x is nan */
+ ((iy>=0x7ff0000000000000LL)&&((iy-0x7ff0000000000000LL)|uly)!=0))
+ /* y is nan */
+ return x+y;
+ if((long double) x==y) return y; /* x=y, return y */
+ if(ix==0) { /* x == 0 */
+ float x2;
+ SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/
+ x2 = x*x;
+ if(x2==x) return x2; else return x; /* raise underflow flag */
+ }
+ if(hx>=0) { /* x > 0 */
+ if(hy<0||(ix>>23)>(iy>>52)-0x380
+ || ((ix>>23)==(iy>>52)-0x380
+ && (ix&0x7fffff)>((hy>>29)&0x7fffff))) {/* x > y, x -= ulp */
+ hx -= 1;
+ } else { /* x < y, x += ulp */
+ hx += 1;
+ }
+ } else { /* x < 0 */
+ if(hy>=0||(ix>>23)>(iy>>52)-0x380
+ || ((ix>>23)==(iy>>52)-0x380
+ && (ix&0x7fffff)>((hy>>29)&0x7fffff))) {/* x < y, x -= ulp */
+ hx -= 1;
+ } else { /* x > y, x += ulp */
+ hx += 1;
+ }
+ }
+ hy = hx&0x7f800000;
+ if(hy>=0x7f800000) return x+x; /* overflow */
+ if(hy<0x00800000) { /* underflow */
+ float x2 = x*x;
+ if(x2!=x) { /* raise underflow flag */
+ SET_FLOAT_WORD(x2,hx);
+ return x2;
+ }
+ }
+ SET_FLOAT_WORD(x,hx);
+ return x;
+}
+long_double_symbol (libm, __nexttowardf, nexttowardf);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_remquol.c b/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
new file mode 100644
index 0000000000..ca504a01a0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
@@ -0,0 +1,111 @@
+/* Compute remainder and a congruent to the quotient.
+ Copyright (C) 1997,1999,2002,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+ Jakub Jelinek <jj@ultra.linux.cz>, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+
+static const long double zero = 0.0;
+
+
+long double
+__remquol (long double x, long double y, int *quo)
+{
+ int64_t hx,hy;
+ u_int64_t sx,lx,ly,qs;
+ int cquo;
+
+ GET_LDOUBLE_WORDS64 (hx, lx, x);
+ GET_LDOUBLE_WORDS64 (hy, ly, y);
+ sx = hx & 0x8000000000000000ULL;
+ qs = sx ^ (hy & 0x8000000000000000ULL);
+ hy &= 0x7fffffffffffffffLL;
+ hx &= 0x7fffffffffffffffLL;
+
+ /* Purge off exception values. */
+ if ((hy | (ly & 0x7fffffffffffffff)) == 0)
+ return (x * y) / (x * y); /* y = 0 */
+ if ((hx >= 0x7ff0000000000000LL) /* x not finite */
+ || ((hy >= 0x7ff0000000000000LL) /* y is NaN */
+ && (((hy - 0x7ff0000000000000LL) | ly) != 0)))
+ return (x * y) / (x * y);
+
+ if (hy <= 0x7fbfffffffffffffLL)
+ x = __ieee754_fmodl (x, 8 * y); /* now x < 8y */
+
+ if (((hx - hy) | (lx - ly)) == 0)
+ {
+ *quo = qs ? -1 : 1;
+ return zero * x;
+ }
+
+ x = fabsl (x);
+ y = fabsl (y);
+ cquo = 0;
+
+ if (x >= 4 * y)
+ {
+ x -= 4 * y;
+ cquo += 4;
+ }
+ if (x >= 2 * y)
+ {
+ x -= 2 * y;
+ cquo += 2;
+ }
+
+ if (hy < 0x0020000000000000LL)
+ {
+ if (x + x > y)
+ {
+ x -= y;
+ ++cquo;
+ if (x + x >= y)
+ {
+ x -= y;
+ ++cquo;
+ }
+ }
+ }
+ else
+ {
+ long double y_half = 0.5L * y;
+ if (x > y_half)
+ {
+ x -= y;
+ ++cquo;
+ if (x >= y_half)
+ {
+ x -= y;
+ ++cquo;
+ }
+ }
+ }
+
+ *quo = qs ? -cquo : cquo;
+
+ if (sx)
+ x = -x;
+ return x;
+}
+long_double_symbol (libm, __remquol, remquol);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_rintl.c b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c
new file mode 100644
index 0000000000..51b1fea2c4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c
@@ -0,0 +1,119 @@
+/* Round to int long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <math.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__rintl (long double x)
+#else
+long double
+__rintl (x)
+ long double x;
+#endif
+{
+ static const long double TWO52 = 4503599627370496.0L;
+ union ibm_extended_long_double u;
+ u.d = x;
+
+ if (fabs (u.dd[0]) < TWO52)
+ {
+ double high = u.dd[0];
+ if (high > 0.0)
+ {
+ high += TWO52;
+ high -= TWO52;
+ if (high == -0.0) high = 0.0;
+ }
+ else if (high < 0.0)
+ {
+ high -= TWO52;
+ high += TWO52;
+ if (high == 0.0) high = -0.0;
+ }
+ u.dd[0] = high;
+ u.dd[1] = 0.0;
+ }
+ else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
+ {
+ double high, low, tau;
+ /* In this case we have to round the low double and handle any
+ adjustment to the high double that may be caused by rounding
+ (up). This is complicated by the fact that the high double
+ may already be rounded and the low double may have the
+ opposite sign to compensate. */
+ if (u.dd[0] > 0.0)
+ {
+ if (u.dd[1] > 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] < 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+
+ tau = nextafter (u.dd[0], 0.0);
+ tau = (u.dd[0] - tau) * 2.0;
+ high = u.dd[0] - tau;
+ low = u.dd[1] + tau;
+ }
+ low += TWO52;
+ low -= TWO52;
+ }
+ else if (u.dd[0] < 0.0)
+ {
+ if (u.dd[1] < 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] > 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+ tau = nextafter (u.dd[0], 0.0);
+ tau = (u.dd[0] - tau) * 2.0;
+ high = u.dd[0] - tau;
+ low = u.dd[1] + tau;
+ }
+ low = TWO52 - low;
+ low = -(low - TWO52);
+ }
+ u.dd[0] = high + low;
+ u.dd[1] = high - u.dd[0] + low;
+ }
+
+ return u.d;
+}
+
+long_double_symbol (libm, __rintl, rintl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_roundl.c b/sysdeps/ieee754/ldbl-128ibm/s_roundl.c
new file mode 100644
index 0000000000..7fe84b87de
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_roundl.c
@@ -0,0 +1,120 @@
+/* Round to int long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <math.h>
+#include <fenv.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__roundl (long double x)
+#else
+long double
+__roundl (x)
+ long double x;
+#endif
+{
+ static const double TWO52 = 4503599627370496.0;
+ static const double HALF = 0.5;
+ int mode = fegetround();
+ union ibm_extended_long_double u;
+ u.d = x;
+
+ if (fabs (u.dd[0]) < TWO52)
+ {
+ fesetround(FE_TOWARDZERO);
+ if (u.dd[0] > 0.0)
+ {
+ u.dd[0] += HALF;
+ u.dd[0] += TWO52;
+ u.dd[0] -= TWO52;
+ }
+ else if (u.dd[0] < 0.0)
+ {
+ u.dd[0] = TWO52 - (u.dd[0] - HALF);
+ u.dd[0] = -(u.dd[0] - TWO52);
+ }
+ u.dd[1] = 0.0;
+ fesetround(mode);
+ }
+ else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
+ {
+ double high, low;
+ /* In this case we have to round the low double and handle any
+ adjustment to the high double that may be caused by rounding
+ (up). This is complicated by the fact that the high double
+ may already be rounded and the low double may have the
+ opposite sign to compensate. */
+ if (u.dd[0] > 0.0)
+ {
+ if (u.dd[1] > 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] < 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+ high = nextafter (u.dd[0], 0.0);
+ low = u.dd[1] + (u.dd[0] - high);
+ }
+ fesetround(FE_TOWARDZERO);
+ low += HALF;
+ low += TWO52;
+ low -= TWO52;
+ }
+ else if (u.dd[0] < 0.0)
+ {
+ if (u.dd[1] < 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] > 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+ high = nextafter (u.dd[0], 0.0);
+ low = u.dd[1] + (u.dd[0] - high);
+ }
+ fesetround(FE_TOWARDZERO);
+ low -= HALF;
+ low = TWO52 - low;
+ low = -(low - TWO52);
+ }
+ fesetround(mode);
+ u.dd[0] = high + low;
+ u.dd[1] = high - u.dd[0] + low;
+ }
+ return u.d;
+}
+
+long_double_symbol (libm, __roundl, roundl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c b/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c
new file mode 100644
index 0000000000..3a1ba07f2c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c
@@ -0,0 +1,105 @@
+/* s_scalblnl.c -- long double version of s_scalbln.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/* @(#)s_scalbln.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * scalblnl (long double x, long int n)
+ * scalblnl(x,n) returns x* 2**n computed by exponent
+ * manipulation rather than by actually performing an
+ * exponentiation or a multiplication.
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+twolm54 = 5.55111512312578270212e-17, /* 0x3C90000000000000, 0 */
+huge = 1.0E+300L,
+tiny = 1.0E-300L;
+#ifdef __STDC__
+static const double
+#else
+static double
+#endif
+two54 = 1.80143985094819840000e+16, /* 0x4350000000000000 */
+twom54 = 5.55111512312578270212e-17; /* 0x3C90000000000000 */
+
+#ifdef __STDC__
+ long double __scalblnl (long double x, long int n)
+#else
+ long double __scalblnl (x,n)
+ long double x; long int n;
+#endif
+{
+ int64_t k,l,hx,lx;
+ union { int64_t i; double d; } u;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ k = (hx>>52)&0x7ff; /* extract exponent */
+ l = (lx>>52)&0x7ff;
+ if (k==0) { /* 0 or subnormal x */
+ if (((hx|lx)&0x7fffffffffffffffULL)==0) return x; /* +-0 */
+ u.i = hx;
+ u.d *= two54;
+ hx = u.i;
+ k = ((hx>>52)&0x7ff) - 54;
+ }
+ else if (k==0x7ff) return x+x; /* NaN or Inf */
+ k = k+n;
+ if (n> 50000 || k > 0x7fe)
+ return huge*__copysignl(huge,x); /* overflow */
+ if (n< -50000) return tiny*__copysignl(tiny,x); /*underflow */
+ if (k > 0) { /* normal result */
+ hx = (hx&0x800fffffffffffffULL)|(k<<52);
+ if ((lx & 0x7fffffffffffffffULL) == 0) { /* low part +-0 */
+ SET_LDOUBLE_WORDS64(x,hx,lx);
+ return x;
+ }
+ if (l == 0) { /* low part subnormal */
+ u.i = lx;
+ u.d *= two54;
+ lx = u.i;
+ l = ((lx>>52)&0x7ff) - 54;
+ }
+ l = l + n;
+ if (l > 0)
+ lx = (lx&0x800fffffffffffffULL)|(l<<52);
+ else if (l <= -54)
+ lx = (lx&0x8000000000000000ULL);
+ else {
+ l += 54;
+ u.i = (lx&0x800fffffffffffffULL)|(l<<52);
+ u.d *= twom54;
+ lx = u.i;
+ }
+ SET_LDOUBLE_WORDS64(x,hx,lx);
+ return x;
+ }
+ if (k <= -54)
+ return tiny*__copysignl(tiny,x); /*underflow*/
+ k += 54; /* subnormal result */
+ lx &= 0x8000000000000000ULL;
+ SET_LDOUBLE_WORDS64(x,(hx&0x800fffffffffffffULL)|(k<<52),lx);
+ return x*twolm54;
+}
+long_double_symbol (libm, __scalblnl, scalblnl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c b/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c
new file mode 100644
index 0000000000..50bd8cb0b6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c
@@ -0,0 +1,109 @@
+/* s_scalbnl.c -- long double version of s_scalbn.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/* @(#)s_scalbn.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * scalbnl (long double x, int n)
+ * scalbnl(x,n) returns x* 2**n computed by exponent
+ * manipulation rather than by actually performing an
+ * exponentiation or a multiplication.
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+twolm54 = 5.55111512312578270212e-17, /* 0x3C90000000000000, 0 */
+huge = 1.0E+300L,
+tiny = 1.0E-300L;
+#ifdef __STDC__
+static const double
+#else
+static double
+#endif
+two54 = 1.80143985094819840000e+16, /* 0x4350000000000000 */
+twom54 = 5.55111512312578270212e-17; /* 0x3C90000000000000 */
+
+#ifdef __STDC__
+ long double __scalbnl (long double x, int n)
+#else
+ long double __scalbnl (x,n)
+ long double x; int n;
+#endif
+{
+ int64_t k,l,hx,lx;
+ union { int64_t i; double d; } u;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ k = (hx>>52)&0x7ff; /* extract exponent */
+ l = (lx>>52)&0x7ff;
+ if (k==0) { /* 0 or subnormal x */
+ if (((hx|lx)&0x7fffffffffffffffULL)==0) return x; /* +-0 */
+ u.i = hx;
+ u.d *= two54;
+ hx = u.i;
+ k = ((hx>>52)&0x7ff) - 54;
+ }
+ else if (k==0x7ff) return x+x; /* NaN or Inf */
+ k = k+n;
+ if (n> 50000 || k > 0x7fe)
+ return huge*__copysignl(huge,x); /* overflow */
+ if (n< -50000) return tiny*__copysignl(tiny,x); /*underflow */
+ if (k > 0) { /* normal result */
+ hx = (hx&0x800fffffffffffffULL)|(k<<52);
+ if ((lx & 0x7fffffffffffffffULL) == 0) { /* low part +-0 */
+ SET_LDOUBLE_WORDS64(x,hx,lx);
+ return x;
+ }
+ if (l == 0) { /* low part subnormal */
+ u.i = lx;
+ u.d *= two54;
+ lx = u.i;
+ l = ((lx>>52)&0x7ff) - 54;
+ }
+ l = l + n;
+ if (l > 0)
+ lx = (lx&0x800fffffffffffffULL)|(l<<52);
+ else if (l <= -54)
+ lx = (lx&0x8000000000000000ULL);
+ else {
+ l += 54;
+ u.i = (lx&0x800fffffffffffffULL)|(l<<52);
+ u.d *= twom54;
+ lx = u.i;
+ }
+ SET_LDOUBLE_WORDS64(x,hx,lx);
+ return x;
+ }
+ if (k <= -54)
+ return tiny*__copysignl(tiny,x); /*underflow*/
+ k += 54; /* subnormal result */
+ lx &= 0x8000000000000000ULL;
+ SET_LDOUBLE_WORDS64(x,(hx&0x800fffffffffffffULL)|(k<<52),lx);
+ return x*twolm54;
+}
+#ifdef IS_IN_libm
+long_double_symbol (libm, __scalbnl, scalbnl);
+#else
+long_double_symbol (libc, __scalbnl, scalbnl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c b/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c
new file mode 100644
index 0000000000..b4285461b2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c
@@ -0,0 +1,37 @@
+/* Return nonzero value if number is negative.
+ Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+int
+___signbitl (long double x)
+{
+ int64_t e;
+
+ GET_LDOUBLE_MSW64 (e, x);
+ return e < 0;
+}
+#ifdef IS_IN_libm
+long_double_symbol (libm, ___signbitl, __signbitl);
+#else
+long_double_symbol (libc, ___signbitl, __signbitl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c b/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c
new file mode 100644
index 0000000000..1d3d7a4d0d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c
@@ -0,0 +1,72 @@
+/* Compute sine and cosine of argument.
+ Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+ Jakub Jelinek <jj@ultra.linux.cz>.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+void
+__sincosl (long double x, long double *sinx, long double *cosx)
+{
+ int64_t ix;
+
+ /* High word of x. */
+ GET_LDOUBLE_MSW64 (ix, x);
+
+ /* |x| ~< pi/4 */
+ ix &= 0x7fffffffffffffffLL;
+ if (ix <= 0x3fe921fb54442d10LL)
+ __kernel_sincosl (x, 0.0L, sinx, cosx, 0);
+ else if (ix >= 0x7ff0000000000000LL)
+ {
+ /* sin(Inf or NaN) is NaN */
+ *sinx = *cosx = x - x;
+ }
+ else
+ {
+ /* Argument reduction needed. */
+ long double y[2];
+ int n;
+
+ n = __ieee754_rem_pio2l (x, y);
+ switch (n & 3)
+ {
+ case 0:
+ __kernel_sincosl (y[0], y[1], sinx, cosx, 1);
+ break;
+ case 1:
+ __kernel_sincosl (y[0], y[1], cosx, sinx, 1);
+ *cosx = -*cosx;
+ break;
+ case 2:
+ __kernel_sincosl (y[0], y[1], sinx, cosx, 1);
+ *sinx = -*sinx;
+ *cosx = -*cosx;
+ break;
+ default:
+ __kernel_sincosl (y[0], y[1], cosx, sinx, 1);
+ *sinx = -*sinx;
+ break;
+ }
+ }
+}
+long_double_symbol (libm, __sincosl, sincosl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_sinl.c b/sysdeps/ieee754/ldbl-128ibm/s_sinl.c
new file mode 100644
index 0000000000..8cc592c612
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_sinl.c
@@ -0,0 +1,84 @@
+/* s_sinl.c -- long double version of s_sin.c.
+ * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* sinl(x)
+ * Return sine function of x.
+ *
+ * kernel function:
+ * __kernel_sinl ... sine function on [-pi/4,pi/4]
+ * __kernel_cosl ... cose function on [-pi/4,pi/4]
+ * __ieee754_rem_pio2l ... argument reduction routine
+ *
+ * Method.
+ * Let S,C and T denote the sin, cos and tan respectively on
+ * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
+ * in [-pi/4 , +pi/4], and let n = k mod 4.
+ * We have
+ *
+ * n sin(x) cos(x) tan(x)
+ * ----------------------------------------------------------
+ * 0 S C T
+ * 1 C -S -1/T
+ * 2 -S -C T
+ * 3 -C S -1/T
+ * ----------------------------------------------------------
+ *
+ * Special cases:
+ * Let trig be any of sin, cos, or tan.
+ * trig(+-INF) is NaN, with signals;
+ * trig(NaN) is that NaN;
+ *
+ * Accuracy:
+ * TRIG(x) returns trig(x) nearly rounded
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+ long double __sinl(long double x)
+#else
+ long double __sinl(x)
+ long double x;
+#endif
+{
+ long double y[2],z=0.0L;
+ int64_t n, ix;
+
+ /* High word of x. */
+ GET_LDOUBLE_MSW64(ix,x);
+
+ /* |x| ~< pi/4 */
+ ix &= 0x7fffffffffffffffLL;
+ if(ix <= 0x3fe921fb54442d10LL)
+ return __kernel_sinl(x,z,0);
+
+ /* sin(Inf or NaN) is NaN */
+ else if (ix>=0x7ff0000000000000LL) return x-x;
+
+ /* argument reduction needed */
+ else {
+ n = __ieee754_rem_pio2l(x,y);
+ switch(n&3) {
+ case 0: return __kernel_sinl(y[0],y[1],1);
+ case 1: return __kernel_cosl(y[0],y[1]);
+ case 2: return -__kernel_sinl(y[0],y[1],1);
+ default:
+ return -__kernel_cosl(y[0],y[1]);
+ }
+ }
+}
+long_double_symbol (libm, __sinl, sinl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c b/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c
new file mode 100644
index 0000000000..851ca125f6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c
@@ -0,0 +1,90 @@
+/* @(#)s_tanh.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_tanh.c,v 1.7 1995/05/10 20:48:22 jtc Exp $";
+#endif
+
+/* Tanh(x)
+ * Return the Hyperbolic Tangent of x
+ *
+ * Method :
+ * x -x
+ * e - e
+ * 0. tanh(x) is defined to be -----------
+ * x -x
+ * e + e
+ * 1. reduce x to non-negative by tanh(-x) = -tanh(x).
+ * 2. 0 <= x <= 2**-57 : tanh(x) := x*(one+x)
+ * -t
+ * 2**-57 < x <= 1 : tanh(x) := -----; t = expm1(-2x)
+ * t + 2
+ * 2
+ * 1 <= x <= 22.0 : tanh(x) := 1- ----- ; t=expm1(2x)
+ * t + 2
+ * 22.0 < x <= INF : tanh(x) := 1.
+ *
+ * Special cases:
+ * tanh(NaN) is NaN;
+ * only tanh(0)=0 is exact for finite argument.
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double one=1.0L, two=2.0L, tiny = 1.0e-300L;
+#else
+static long double one=1.0L, two=2.0L, tiny = 1.0e-300L;
+#endif
+
+#ifdef __STDC__
+ long double __tanhl(long double x)
+#else
+ long double __tanhl(x)
+ long double x;
+#endif
+{
+ long double t,z;
+ int64_t jx,ix,lx;
+
+ /* High word of |x|. */
+ GET_LDOUBLE_WORDS64(jx,lx,x);
+ ix = jx&0x7fffffffffffffffLL;
+
+ /* x is INF or NaN */
+ if(ix>=0x7ff0000000000000LL) {
+ if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */
+ else return one/x-one; /* tanh(NaN) = NaN */
+ }
+
+ /* |x| < 22 */
+ if (ix < 0x4036000000000000LL) { /* |x|<22 */
+ if ((ix | (lx&0x7fffffffffffffffLL)) == 0)
+ return x; /* x == +-0 */
+ if (ix<0x3c60000000000000LL) /* |x|<2**-57 */
+ return x*(one+x); /* tanh(small) = small */
+ if (ix>=0x3ff0000000000000LL) { /* |x|>=1 */
+ t = __expm1l(two*fabsl(x));
+ z = one - two/(t+two);
+ } else {
+ t = __expm1l(-two*fabsl(x));
+ z= -t/(t+two);
+ }
+ /* |x| > 22, return +-1 */
+ } else {
+ z = one - tiny; /* raised inexact flag */
+ }
+ return (jx>=0)? z: -z;
+}
+long_double_symbol (libm, __tanhl, tanhl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_tanl.c b/sysdeps/ieee754/ldbl-128ibm/s_tanl.c
new file mode 100644
index 0000000000..ea5a7f0ffb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_tanl.c
@@ -0,0 +1,78 @@
+/* s_tanl.c -- long double version of s_tan.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/* @(#)s_tan.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* tanl(x)
+ * Return tangent function of x.
+ *
+ * kernel function:
+ * __kernel_tanl ... tangent function on [-pi/4,pi/4]
+ * __ieee754_rem_pio2l ... argument reduction routine
+ *
+ * Method.
+ * Let S,C and T denote the sin, cos and tan respectively on
+ * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
+ * in [-pi/4 , +pi/4], and let n = k mod 4.
+ * We have
+ *
+ * n sin(x) cos(x) tan(x)
+ * ----------------------------------------------------------
+ * 0 S C T
+ * 1 C -S -1/T
+ * 2 -S -C T
+ * 3 -C S -1/T
+ * ----------------------------------------------------------
+ *
+ * Special cases:
+ * Let trig be any of sin, cos, or tan.
+ * trig(+-INF) is NaN, with signals;
+ * trig(NaN) is that NaN;
+ *
+ * Accuracy:
+ * TRIG(x) returns trig(x) nearly rounded
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+ long double __tanl(long double x)
+#else
+ long double __tanl(x)
+ long double x;
+#endif
+{
+ long double y[2],z=0.0L;
+ int64_t n, ix;
+
+ /* High word of x. */
+ GET_LDOUBLE_MSW64(ix,x);
+
+ /* |x| ~< pi/4 */
+ ix &= 0x7fffffffffffffffLL;
+ if(ix <= 0x3fe921fb54442d10LL) return __kernel_tanl(x,z,1);
+
+ /* tanl(Inf or NaN) is NaN */
+ else if (ix>=0x7ff0000000000000LL) return x-x; /* NaN */
+
+ /* argument reduction needed */
+ else {
+ n = __ieee754_rem_pio2l(x,y);
+ return __kernel_tanl(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even
+ -1 -- n odd */
+ }
+}
+long_double_symbol (libm, __tanl, tanl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_truncl.c b/sysdeps/ieee754/ldbl-128ibm/s_truncl.c
new file mode 100644
index 0000000000..14544af206
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_truncl.c
@@ -0,0 +1,119 @@
+/* Truncate (toward zero) long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <math.h>
+#include <fenv.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__truncl (long double x)
+#else
+long double
+__truncl (x)
+ long double x;
+#endif
+{
+ static const double TWO52 = 4503599627370496.0L;
+ int mode = fegetround();
+ union ibm_extended_long_double u;
+
+ u.d = x;
+
+ if (fabs (u.dd[0]) < TWO52)
+ {
+ fesetround(FE_TOWARDZERO);
+ if (u.dd[0] > 0.0)
+ {
+ u.dd[0] += TWO52;
+ u.dd[0] -= TWO52;
+ }
+ else if (u.dd[0] < 0.0)
+ {
+ u.dd[0] = TWO52 - u.dd[0];
+ u.dd[0] = -(u.dd[0] - TWO52);
+ }
+ u.dd[1] = 0.0;
+ fesetround(mode);
+ }
+ else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
+ {
+ double high, low;
+ /* In this case we have to round the low double and handle any
+ adjustment to the high double that may be caused by rounding
+ (up). This is complicated by the fact that the high double
+ may already be rounded and the low double may have the
+ opposite sign to compensate. */
+ if (u.dd[0] > 0.0)
+ {
+ if (u.dd[1] > 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] < 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+ high = nextafter (u.dd[0], 0.0);
+ low = u.dd[1] + (u.dd[0] - high);
+ }
+ fesetround(FE_TOWARDZERO);
+ low += TWO52;
+ low -= TWO52;
+ fesetround(mode);
+ }
+ else if (u.dd[0] < 0.0)
+ {
+ if (u.dd[1] < 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] > 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+ high = nextafter (u.dd[0], 0.0);
+ low = u.dd[1] + (u.dd[0] - high);
+ }
+ fesetround(FE_TOWARDZERO);
+ low = TWO52 - low;
+ low = -(low - TWO52);
+ fesetround(mode);
+ }
+ u.dd[0] = high + low;
+ u.dd[1] = high - u.dd[0] + low;
+ }
+
+ return u.d;
+}
+
+long_double_symbol (libm, __truncl, truncl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/strtold_l.c b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
new file mode 100644
index 0000000000..d558b00d4a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 1999, 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <xlocale.h>
+
+/* The actual implementation for all floating point sizes is in strtod.c.
+ These macros tell it to produce the `long double' version, `strtold'. */
+
+#define FLOAT long double
+#define FLT LDBL
+#ifdef USE_WIDE_CHAR
+extern long double ____new_wcstold_l (const wchar_t *, wchar_t **, __locale_t);
+# define STRTOF __new_wcstold_l
+# define __STRTOF ____new_wcstold_l
+# define ____STRTOF_INTERNAL ____wcstold_l_internal
+#else
+extern long double ____new_strtold_l (const char *, char **, __locale_t);
+# define STRTOF __new_strtold_l
+# define __STRTOF ____new_strtold_l
+# define ____STRTOF_INTERNAL ____strtold_l_internal
+#endif
+#define MPN2FLOAT __mpn_construct_long_double
+#define FLOAT_HUGE_VAL HUGE_VALL
+# define SET_MANTISSA(flt, mant) \
+ do { union ibm_extended_long_double u; \
+ u.d = (flt); \
+ if ((mant & 0xfffffffffffffULL) == 0) \
+ mant = 0x8000000000000ULL; \
+ u.ieee.mantissa0 = ((mant) >> 32) & 0xfffff; \
+ u.ieee.mantissa1 = (mant) & 0xffffffff; \
+ (flt) = u.d; \
+ } while (0)
+
+#include <strtod_l.c>
+
+#ifdef __LONG_DOUBLE_MATH_OPTIONAL
+# include <math_ldbl_opt.h>
+# ifdef USE_WIDE_CHAR
+long_double_symbol (libc, __new_wcstold_l, wcstold_l);
+long_double_symbol (libc, ____new_wcstold_l, __wcstold_l);
+# else
+long_double_symbol (libc, __new_strtold_l, strtold_l);
+long_double_symbol (libc, ____new_strtold_l, __strtold_l);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/t_sincosl.c b/sysdeps/ieee754/ldbl-128ibm/t_sincosl.c
new file mode 100644
index 0000000000..4c92a0da20
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/t_sincosl.c
@@ -0,0 +1,694 @@
+/* Quad-precision floating point sine and cosine tables.
+ Copyright (C) 1999,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* For 0.1484375 + n/128.0, n=0..82 this table contains
+ first 113 bits of cosine, then at least 113 additional
+ bits and the same for sine.
+ 0.1484375+82.0/128.0 is the smallest number among above defined numbers
+ larger than pi/4.
+ Computed using gmp.
+ */
+
+const long double __sincosl_table[] = {
+
+/* x = 1.48437500000000000000000000000000000e-01L 3ffc3000000000000000000000000000 */
+/* cos(x) = 0.fd2f5320e1b790209b4dda2f98 f79caaa7b873aff1014b0fbc52 43766d03cb006bc837c4358 */
+ 0x0.fd2f5320e1b790209b4dda2f98p0L,
+ 0x0.f79caaa7b873aff1014b0fbc52p-104L,
+/* sin(x) = 0.25dc50bc95711d0d9787d108fd 438cf5959ee0bfb7a1e36e8b1a 112968f356657420e9cc9ea */
+ 0x0.25dc50bc95711d0d9787d108fdp0L,
+ 0x0.438cf5959ee0bfb7a1e36e8b1ap-104L,
+
+/* x = 1.56250000000000000000000000000000000e-01 3ffc4000000000000000000000000000 */
+/* cos(x) = 0.fce1a053e621438b6d60c76e8c 45bf0a9dc71aa16f922acc10e9 5144ec796a249813c9cb649 */
+ 0x0.fce1a053e621438b6d60c76e8cp0L,
+ 0x0.45bf0a9dc71aa16f922acc10e9p-104L,
+/* sin(x) = 0.27d66258bacd96a3eb335b365c 87d59438c5142bb56a489e9b8d b9d36234ffdebb6bdc22d8e */
+ 0x0.27d66258bacd96a3eb335b365cp0L,
+ 0x0.87d59438c5142bb56a489e9b8dp-104L,
+
+/* x = 1.64062500000000000000000000000000000e-01 3ffc5000000000000000000000000000 */
+/* cos(x) = 0.fc8ffa01ba6807417e05962b0d 9fdf1fddb0cc4c07d22e19e080 19bffa50a6c7acdb40307a3 */
+ 0x0.fc8ffa01ba6807417e05962b0dp0L,
+ 0x0.9fdf1fddb0cc4c07d22e19e080p-104L,
+/* sin(x) = 0.29cfd49b8be4f665276cab01cb f0426934906c3dd105473b226e 410b1450f62e53ff7c6cce1 */
+ 0x0.29cfd49b8be4f665276cab01cbp0L,
+ 0x0.f0426934906c3dd105473b226ep-104L,
+
+/* x = 1.71875000000000000000000000000000000e-01 3ffc6000000000000000000000000000 */
+/* cos(x) = 0.fc3a6170f767ac735d63d99a9d 439e1db5e59d3ef153a4265d58 55850ed82b536bf361b80e3 */
+ 0x0.fc3a6170f767ac735d63d99a9dp0L,
+ 0x0.439e1db5e59d3ef153a4265d58p-104L,
+/* sin(x) = 0.2bc89f9f424de5485de7ce03b2 514952b9faf5648c3244d4736f eb95dbb9da49f3b58a9253b */
+ 0x0.2bc89f9f424de5485de7ce03b2p0L,
+ 0x0.514952b9faf5648c3244d4736fp-104L,
+
+/* x = 1.79687500000000000000000000000000000e-01 3ffc7000000000000000000000000000 */
+/* cos(x) = 0.fbe0d7f7fef11e70aa43b8abf4 f6a457cea20c8f3f676b47781f 9821bbe9ce04b3c7b981c0b */
+ 0x0.fbe0d7f7fef11e70aa43b8abf4p0L,
+ 0x0.f6a457cea20c8f3f676b47781fp-104L,
+/* sin(x) = 0.2dc0bb80b49a97ffb34e8dd1f8 db9df7af47ed2dcf58b12c8e78 27e048cae929da02c04ecac */
+ 0x0.2dc0bb80b49a97ffb34e8dd1f8p0L,
+ 0x0.db9df7af47ed2dcf58b12c8e78p-104L,
+
+/* x = 1.87500000000000000000000000000000000e-01 3ffc8000000000000000000000000000 */
+/* cos(x) = 0.fb835efcf670dd2ce6fe792469 7eea13ea358867e9cdb3899b78 3f4f9f43aa5626e8b67b3bc */
+ 0x0.fb835efcf670dd2ce6fe792469p0L,
+ 0x0.7eea13ea358867e9cdb3899b78p-104L,
+/* sin(x) = 0.2fb8205f75e56a2b56a1c4792f 856258769af396e0189ef72c05 e4df59a6b00e4b44a6ea515 */
+ 0x0.2fb8205f75e56a2b56a1c4792fp0L,
+ 0x0.856258769af396e0189ef72c05p-104L,
+
+/* x = 1.95312500000000000000000000000000000e-01 3ffc9000000000000000000000000000 */
+/* cos(x) = 0.fb21f7f5c156696b00ac1fe28a c5fd76674a92b4df80d9c8a46c 684399005deccc41386257c */
+ 0x0.fb21f7f5c156696b00ac1fe28ap0L,
+ 0x0.c5fd76674a92b4df80d9c8a46cp-104L,
+/* sin(x) = 0.31aec65df552876f82ece9a235 6713246eba6799983d7011b0b3 698d6e1da919c15d57c30c1 */
+ 0x0.31aec65df552876f82ece9a235p0L,
+ 0x0.6713246eba6799983d7011b0b3p-104L,
+
+/* x = 2.03125000000000000000000000000000000e-01 3ffca000000000000000000000000000 */
+/* cos(x) = 0.fabca467fb3cb8f1d069f01d8e a33ade5bfd68296ecd1cc9f7b7 609bbcf3676e726c3301334 */
+ 0x0.fabca467fb3cb8f1d069f01d8ep0L,
+ 0x0.a33ade5bfd68296ecd1cc9f7b7p-104L,
+/* sin(x) = 0.33a4a5a19d86246710f602c44d f4fa513f4639ce938477aeeabb 82e8e0a7ed583a188879fd4 */
+ 0x0.33a4a5a19d86246710f602c44dp0L,
+ 0x0.f4fa513f4639ce938477aeeabbp-104L,
+
+/* x = 2.10937500000000000000000000000000000e-01 3ffcb000000000000000000000000000 */
+/* cos(x) = 0.fa5365e8f1d3ca27be1db5d76a e64d983d7470a4ab0f4ccf65a2 b8c67a380df949953a09bc1 */
+ 0x0.fa5365e8f1d3ca27be1db5d76ap0L,
+ 0x0.e64d983d7470a4ab0f4ccf65a2p-104L,
+/* sin(x) = 0.3599b652f40ec999df12a0a4c8 561de159c98d4e54555de518b9 7f48886f715d8df5f4f093e */
+ 0x0.3599b652f40ec999df12a0a4c8p0L,
+ 0x0.561de159c98d4e54555de518b9p-104L,
+
+/* x = 2.18750000000000000000000000000000000e-01 3ffcc000000000000000000000000000 */
+/* cos(x) = 0.f9e63e1d9e8b6f6f2e296bae5b 5ed9c11fd7fa2fe11e09fc7bde 901abed24b6365e72f7db4e */
+ 0x0.f9e63e1d9e8b6f6f2e296bae5bp0L,
+ 0x0.5ed9c11fd7fa2fe11e09fc7bdep-104L,
+/* sin(x) = 0.378df09db8c332ce0d2b53d865 582e4526ea336c768f68c32b49 6c6d11c1cd241bb9f1da523 */
+ 0x0.378df09db8c332ce0d2b53d865p0L,
+ 0x0.582e4526ea336c768f68c32b49p-104L,
+
+/* x = 2.26562500000000000000000000000000000e-01 3ffcd000000000000000000000000000 */
+/* cos(x) = 0.f9752eba9fff6b98842beadab0 54a932fb0f8d5b875ae63d6b22 88d09b148921aeb6e52f61b */
+ 0x0.f9752eba9fff6b98842beadab0p0L,
+ 0x0.54a932fb0f8d5b875ae63d6b22p-104L,
+/* sin(x) = 0.39814cb10513453cb97b21bc1c a6a337b150c21a675ab85503bc 09a436a10ab1473934e20c8 */
+ 0x0.39814cb10513453cb97b21bc1cp0L,
+ 0x0.a6a337b150c21a675ab85503bcp-104L,
+
+/* x = 2.34375000000000000000000000000000000e-01 3ffce000000000000000000000000000 */
+/* cos(x) = 0.f90039843324f9b940416c1984 b6cbed1fc733d97354d4265788 a86150493ce657cae032674 */
+ 0x0.f90039843324f9b940416c1984p0L,
+ 0x0.b6cbed1fc733d97354d4265788p-104L,
+/* sin(x) = 0.3b73c2bf6b4b9f668ef9499c81 f0d965087f1753fa64b086e58c b8470515c18c1412f8c2e02 */
+ 0x0.3b73c2bf6b4b9f668ef9499c81p0L,
+ 0x0.f0d965087f1753fa64b086e58cp-104L,
+
+/* x = 2.42187500000000000000000000000000000e-01 3ffcf000000000000000000000000000 */
+/* cos(x) = 0.f887604e2c39dbb20e4ec58250 59a789ffc95b275ad9954078ba 8a28d3fcfe9cc2c1d49697b */
+ 0x0.f887604e2c39dbb20e4ec58250p0L,
+ 0x0.59a789ffc95b275ad9954078bap-104L,
+/* sin(x) = 0.3d654aff15cb457a0fca854698 aba33039a8a40626609204472d 9d40309b626eccc6dff0ffa */
+ 0x0.3d654aff15cb457a0fca854698p0L,
+ 0x0.aba33039a8a40626609204472dp-104L,
+
+/* x = 2.50000000000000000000000000000000000e-01 3ffd0000000000000000000000000000 */
+/* cos(x) = 0.f80aa4fbef750ba783d33cb95f 94f8a41426dbe79edc4a023ef9 ec13c944551c0795b84fee1 */
+ 0x0.f80aa4fbef750ba783d33cb95fp0L,
+ 0x0.94f8a41426dbe79edc4a023ef9p-104L,
+/* sin(x) = 0.3f55dda9e62aed7513bd7b8e6a 3d1635dd5676648d7db525898d 7086af9330f03c7f285442a */
+ 0x0.3f55dda9e62aed7513bd7b8e6ap0L,
+ 0x0.3d1635dd5676648d7db525898dp-104L,
+
+/* x = 2.57812500000000000000000000000000000e-01 3ffd0800000000000000000000000000 */
+/* cos(x) = 0.f78a098069792daabc9ee42591 b7c5a68cb1ab822aeb446b3311 b4ba5371b8970e2c1547ad7 */
+ 0x0.f78a098069792daabc9ee42591p0L,
+ 0x0.b7c5a68cb1ab822aeb446b3311p-104L,
+/* sin(x) = 0.414572fd94556e6473d6202713 88dd47c0ba050cdb5270112e3e 370e8c4705ae006426fb5d5 */
+ 0x0.414572fd94556e6473d6202713p0L,
+ 0x0.88dd47c0ba050cdb5270112e3ep-104L,
+
+/* x = 2.65625000000000000000000000000000000e-01 3ffd1000000000000000000000000000 */
+/* cos(x) = 0.f7058fde0788dfc805b8fe8878 9e4f4253e3c50afe8b22f41159 620ab5940ff7df9557c0d1f */
+ 0x0.f7058fde0788dfc805b8fe8878p0L,
+ 0x0.9e4f4253e3c50afe8b22f41159p-104L,
+/* sin(x) = 0.4334033bcd90d6604f5f36c1d4 b84451a87150438275b77470b5 0e5b968fa7962b5ffb379b7 */
+ 0x0.4334033bcd90d6604f5f36c1d4p0L,
+ 0x0.b84451a87150438275b77470b5p-104L,
+
+/* x = 2.73437500000000000000000000000000000e-01 3ffd1800000000000000000000000000 */
+/* cos(x) = 0.f67d3a26af7d07aa4bd6d42af8 c0067fefb96d5b46c031eff536 27f215ea3242edc3f2e13eb */
+ 0x0.f67d3a26af7d07aa4bd6d42af8p0L,
+ 0x0.c0067fefb96d5b46c031eff536p-104L,
+/* sin(x) = 0.452186aa5377ab20bbf2524f52 e3a06a969f47166ab88cf88c11 1ad12c55941021ef3317a1a */
+ 0x0.452186aa5377ab20bbf2524f52p0L,
+ 0x0.e3a06a969f47166ab88cf88c11p-104L,
+
+/* x = 2.81250000000000000000000000000000000e-01 3ffd2000000000000000000000000000 */
+/* cos(x) = 0.f5f10a7bb77d3dfa0c1da8b578 42783280d01ce3c0f82bae3b9d 623c168d2e7c29977994451 */
+ 0x0.f5f10a7bb77d3dfa0c1da8b578p0L,
+ 0x0.42783280d01ce3c0f82bae3b9dp-104L,
+/* sin(x) = 0.470df5931ae1d946076fe0dcff 47fe31bb2ede618ebc607821f8 462b639e1f4298b5ae87fd3 */
+ 0x0.470df5931ae1d946076fe0dcffp0L,
+ 0x0.47fe31bb2ede618ebc607821f8p-104L,
+
+/* x = 2.89062500000000000000000000000000000e-01 3ffd2800000000000000000000000000 */
+/* cos(x) = 0.f561030ddd7a78960ea9f4a32c 6521554995667f5547bafee9ec 48b3155cdb0f7fd00509713 */
+ 0x0.f561030ddd7a78960ea9f4a32cp0L,
+ 0x0.6521554995667f5547bafee9ecp-104L,
+/* sin(x) = 0.48f948446abcd6b0f7fccb100e 7a1b26eccad880b0d24b59948c 7cdd49514d44b933e6985c2 */
+ 0x0.48f948446abcd6b0f7fccb100ep0L,
+ 0x0.7a1b26eccad880b0d24b59948cp-104L,
+
+/* x = 2.96875000000000000000000000000000000e-01 3ffd3000000000000000000000000000 */
+/* cos(x) = 0.f4cd261d3e6c15bb369c875863 0d2ac00b7ace2a51c0631bfeb3 9ed158ba924cc91e259c195 */
+ 0x0.f4cd261d3e6c15bb369c875863p0L,
+ 0x0.0d2ac00b7ace2a51c0631bfeb3p-104L,
+/* sin(x) = 0.4ae37710fad27c8aa9c4cf96c0 3519b9ce07dc08a1471775499f 05c29f86190aaebaeb9716e */
+ 0x0.4ae37710fad27c8aa9c4cf96c0p0L,
+ 0x0.3519b9ce07dc08a1471775499fp-104L,
+
+/* x = 3.04687500000000000000000000000000000e-01 3ffd3800000000000000000000000000 */
+/* cos(x) = 0.f43575f94d4f6b272f5fb76b14 d2a64ab52df1ee8ddf7c651034 e5b2889305a9ea9015d758a */
+ 0x0.f43575f94d4f6b272f5fb76b14p0L,
+ 0x0.d2a64ab52df1ee8ddf7c651034p-104L,
+/* sin(x) = 0.4ccc7a50127e1de0cb6b40c302 c651f7bded4f9e7702b0471ae0 288d091a37391950907202f */
+ 0x0.4ccc7a50127e1de0cb6b40c302p0L,
+ 0x0.c651f7bded4f9e7702b0471ae0p-104L,
+
+/* x = 3.12500000000000000000000000000000000e-01 3ffd4000000000000000000000000000 */
+/* cos(x) = 0.f399f500c9e9fd37ae9957263d ab8877102beb569f101ee44953 50868e5847d181d50d3cca2 */
+ 0x0.f399f500c9e9fd37ae9957263dp0L,
+ 0x0.ab8877102beb569f101ee44953p-104L,
+/* sin(x) = 0.4eb44a5da74f600207aaa090f0 734e288603ffadb3eb2542a469 77b105f8547128036dcf7f0 */
+ 0x0.4eb44a5da74f600207aaa090f0p0L,
+ 0x0.734e288603ffadb3eb2542a469p-104L,
+
+/* x = 3.20312500000000000000000000000000000e-01 3ffd4800000000000000000000000000 */
+/* cos(x) = 0.f2faa5a1b74e82fd61fa05f917 7380e8e69b7b15a945e8e5ae11 24bf3d12b0617e03af4fab5 */
+ 0x0.f2faa5a1b74e82fd61fa05f917p0L,
+ 0x0.7380e8e69b7b15a945e8e5ae11p-104L,
+/* sin(x) = 0.509adf9a7b9a5a0f638a8fa3a6 0a199418859f18b37169a644fd b986c21ecb00133853bc35b */
+ 0x0.509adf9a7b9a5a0f638a8fa3a6p0L,
+ 0x0.0a199418859f18b37169a644fdp-104L,
+
+/* x = 3.28125000000000000000000000000000000e-01 3ffd5000000000000000000000000000 */
+/* cos(x) = 0.f2578a595224dd2e6bfa2eb2f9 9cc674f5ea6f479eae2eb58018 6897ae3f893df1113ca06b8 */
+ 0x0.f2578a595224dd2e6bfa2eb2f9p0L,
+ 0x0.9cc674f5ea6f479eae2eb58018p-104L,
+/* sin(x) = 0.5280326c3cf481823ba6bb08ea c82c2093f2bce3c4eb4ee3dec7 df41c92c8a4226098616075 */
+ 0x0.5280326c3cf481823ba6bb08eap0L,
+ 0x0.c82c2093f2bce3c4eb4ee3dec7p-104L,
+
+/* x = 3.35937500000000000000000000000000000e-01 3ffd5800000000000000000000000000 */
+/* cos(x) = 0.f1b0a5b406b526d886c55feadc 8d0dcc8eb9ae2ac707051771b4 8e05b25b000009660bdb3e3 */
+ 0x0.f1b0a5b406b526d886c55feadcp0L,
+ 0x0.8d0dcc8eb9ae2ac707051771b4p-104L,
+/* sin(x) = 0.54643b3da29de9b357155eef0f 332fb3e66c83bf4dddd9491c5e b8e103ccd92d6175220ed51 */
+ 0x0.54643b3da29de9b357155eef0fp0L,
+ 0x0.332fb3e66c83bf4dddd9491c5ep-104L,
+
+/* x = 3.43750000000000000000000000000000000e-01 3ffd6000000000000000000000000000 */
+/* cos(x) = 0.f105fa4d66b607a67d44e04272 5204435142ac8ad54dfb0907a4 f6b56b06d98ee60f19e557a */
+ 0x0.f105fa4d66b607a67d44e04272p0L,
+ 0x0.5204435142ac8ad54dfb0907a4p-104L,
+/* sin(x) = 0.5646f27e8bd65cbe3a5d61ff06 572290ee826d9674a00246b05a e26753cdfc90d9ce81a7d02 */
+ 0x0.5646f27e8bd65cbe3a5d61ff06p0L,
+ 0x0.572290ee826d9674a00246b05ap-104L,
+
+/* x = 3.51562500000000000000000000000000000e-01 3ffd6800000000000000000000000000 */
+/* cos(x) = 0.f0578ad01ede707fa39c09dc6b 984afef74f3dc8d0efb0f4c5a6 b13771145b3e0446fe33887 */
+ 0x0.f0578ad01ede707fa39c09dc6bp0L,
+ 0x0.984afef74f3dc8d0efb0f4c5a6p-104L,
+/* sin(x) = 0.582850a41e1dd46c7f602ea244 cdbbbfcdfa8f3189be794dda42 7ce090b5f85164f1f80ac13 */
+ 0x0.582850a41e1dd46c7f602ea244p0L,
+ 0x0.cdbbbfcdfa8f3189be794dda42p-104L,
+
+/* x = 3.59375000000000000000000000000000000e-01 3ffd7000000000000000000000000000 */
+/* cos(x) = 0.efa559f5ec3aec3a4eb0331927 8a2d41fcf9189462261125fe61 47b078f1daa0b06750a1654 */
+ 0x0.efa559f5ec3aec3a4eb0331927p0L,
+ 0x0.8a2d41fcf9189462261125fe61p-104L,
+/* sin(x) = 0.5a084e28e35fda2776dfdbbb55 31d74ced2b5d17c0b1afc46475 29d50c295e36d8ceec126c1 */
+ 0x0.5a084e28e35fda2776dfdbbb55p0L,
+ 0x0.31d74ced2b5d17c0b1afc46475p-104L,
+
+/* x = 3.67187500000000000000000000000000000e-01 3ffd7800000000000000000000000000 */
+/* cos(x) = 0.eeef6a879146af0bf9b95ea2ea 0ac0d3e2e4d7e15d93f48cbd41 bf8e4fded40bef69e19eafa */
+ 0x0.eeef6a879146af0bf9b95ea2eap0L,
+ 0x0.0ac0d3e2e4d7e15d93f48cbd41p-104L,
+/* sin(x) = 0.5be6e38ce8095542bc14ee9da0 d36483e6734bcab2e07624188a f5653f114eeb46738fa899d */
+ 0x0.5be6e38ce8095542bc14ee9da0p0L,
+ 0x0.d36483e6734bcab2e07624188ap-104L,
+
+/* x = 3.75000000000000000000000000000000000e-01 3ffd8000000000000000000000000000 */
+/* cos(x) = 0.ee35bf5ccac89052cd91ddb734 d3a47e262e3b609db604e21705 3803be0091e76daf28a89b7 */
+ 0x0.ee35bf5ccac89052cd91ddb734p0L,
+ 0x0.d3a47e262e3b609db604e21705p-104L,
+/* sin(x) = 0.5dc40955d9084f48a94675a249 8de5d851320ff5528a6afb3f2e 24de240fce6cbed1ba0ccd6 */
+ 0x0.5dc40955d9084f48a94675a249p0L,
+ 0x0.8de5d851320ff5528a6afb3f2ep-104L,
+
+/* x = 3.82812500000000000000000000000000000e-01 3ffd8800000000000000000000000000 */
+/* cos(x) = 0.ed785b5c44741b4493c56bcb9d 338a151c6f6b85d8f8aca658b2 8572c162b199680eb9304da */
+ 0x0.ed785b5c44741b4493c56bcb9dp0L,
+ 0x0.338a151c6f6b85d8f8aca658b2p-104L,
+/* sin(x) = 0.5f9fb80f21b53649c432540a50 e22c53057ff42ae0fdf1307760 dc0093f99c8efeb2fbd7073 */
+ 0x0.5f9fb80f21b53649c432540a50p0L,
+ 0x0.e22c53057ff42ae0fdf1307760p-104L,
+
+/* x = 3.90625000000000000000000000000000000e-01 3ffd9000000000000000000000000000 */
+/* cos(x) = 0.ecb7417b8d4ee3fec37aba4073 aa48f1f14666006fb431d96713 03c8100d10190ec8179c41d */
+ 0x0.ecb7417b8d4ee3fec37aba4073p0L,
+ 0x0.aa48f1f14666006fb431d96713p-104L,
+/* sin(x) = 0.6179e84a09a5258a40e9b5face 03e525f8b5753cd0105d93fe62 98010c3458e84d75fe420e9 */
+ 0x0.6179e84a09a5258a40e9b5facep0L,
+ 0x0.03e525f8b5753cd0105d93fe62p-104L,
+
+/* x = 3.98437500000000000000000000000000000e-01 3ffd9800000000000000000000000000 */
+/* cos(x) = 0.ebf274bf0bda4f62447e56a093 626798d3013b5942b1abfd155a acc9dc5c6d0806a20d6b9c1 */
+ 0x0.ebf274bf0bda4f62447e56a093p0L,
+ 0x0.626798d3013b5942b1abfd155ap-104L,
+/* sin(x) = 0.6352929dd264bd44a02ea76632 5d8aa8bd9695fc8def3caefba5 b94c9a3c873f7b2d3776ead */
+ 0x0.6352929dd264bd44a02ea76632p0L,
+ 0x0.5d8aa8bd9695fc8def3caefba5p-104L,
+
+/* x = 4.06250000000000000000000000000000000e-01 3ffda000000000000000000000000000 */
+/* cos(x) = 0.eb29f839f201fd13b937968279 16a78f15c85230a4e8ea4b2155 8265a14367e1abb4c30695a */
+ 0x0.eb29f839f201fd13b937968279p0L,
+ 0x0.16a78f15c85230a4e8ea4b2155p-104L,
+/* sin(x) = 0.6529afa7d51b129631ec197c0a 840a11d7dc5368b0a47956feb2 85caa8371c4637ef17ef01b */
+ 0x0.6529afa7d51b129631ec197c0ap0L,
+ 0x0.840a11d7dc5368b0a47956feb2p-104L,
+
+/* x = 4.14062500000000000000000000000000000e-01 3ffda800000000000000000000000000 */
+/* cos(x) = 0.ea5dcf0e30cf03e6976ef0b1ec 26515fba47383855c3b4055a99 b5e86824b2cd1a691fdca7b */
+ 0x0.ea5dcf0e30cf03e6976ef0b1ecp0L,
+ 0x0.26515fba47383855c3b4055a99p-104L,
+/* sin(x) = 0.66ff380ba0144109e39a320b0a 3fa5fd65ea0585bcbf9b1a769a 9b0334576c658139e1a1cbe */
+ 0x0.66ff380ba0144109e39a320b0ap0L,
+ 0x0.3fa5fd65ea0585bcbf9b1a769ap-104L,
+
+/* x = 4.21875000000000000000000000000000000e-01 3ffdb000000000000000000000000000 */
+/* cos(x) = 0.e98dfc6c6be031e60dd3089cbd d18a75b1f6b2c1e97f79225202 f03dbea45b07a5ec4efc062 */
+ 0x0.e98dfc6c6be031e60dd3089cbdp0L,
+ 0x0.d18a75b1f6b2c1e97f79225202p-104L,
+/* sin(x) = 0.68d32473143327973bc712bcc4 ccddc47630d755850c0655243b 205934dc49ffed8eb76adcb */
+ 0x0.68d32473143327973bc712bcc4p0L,
+ 0x0.ccddc47630d755850c0655243bp-104L,
+
+/* x = 4.29687500000000000000000000000000000e-01 3ffdb800000000000000000000000000 */
+/* cos(x) = 0.e8ba8393eca7821aa563d83491 b6101189b3b101c3677f73d7ba d7c10f9ee02b7ab4009739a */
+ 0x0.e8ba8393eca7821aa563d83491p0L,
+ 0x0.b6101189b3b101c3677f73d7bap-104L,
+/* sin(x) = 0.6aa56d8e8249db4eb60a761fe3 f9e559be456b9e13349ca99b0b fb787f22b95db3b70179615 */
+ 0x0.6aa56d8e8249db4eb60a761fe3p0L,
+ 0x0.f9e559be456b9e13349ca99b0bp-104L,
+
+/* x = 4.37500000000000000000000000000000000e-01 3ffdc000000000000000000000000000 */
+/* cos(x) = 0.e7e367d2956cfb16b6aa11e541 9cd0057f5c132a6455bf064297 e6a76fe2b72bb630d6d50ff */
+ 0x0.e7e367d2956cfb16b6aa11e541p0L,
+ 0x0.9cd0057f5c132a6455bf064297p-104L,
+/* sin(x) = 0.6c760c14c8585a51dbd34660ae 6c52ac7036a0b40887a0b63724 f8b4414348c3063a637f457 */
+ 0x0.6c760c14c8585a51dbd34660aep0L,
+ 0x0.6c52ac7036a0b40887a0b63724p-104L,
+
+/* x = 4.45312500000000000000000000000000000e-01 3ffdc800000000000000000000000000 */
+/* cos(x) = 0.e708ac84d4172a3e2737662213 429e14021074d7e702e77d72a8 f1101a7e70410df8273e9aa */
+ 0x0.e708ac84d4172a3e2737662213p0L,
+ 0x0.429e14021074d7e702e77d72a8p-104L,
+/* sin(x) = 0.6e44f8c36eb10a1c752d093c00 f4d47ba446ac4c215d26b03164 42f168459e677d06e7249e3 */
+ 0x0.6e44f8c36eb10a1c752d093c00p0L,
+ 0x0.f4d47ba446ac4c215d26b03164p-104L,
+
+/* x = 4.53125000000000000000000000000000000e-01 3ffdd000000000000000000000000000 */
+/* cos(x) = 0.e62a551594b970a770b15d41d4 c0e483e47aca550111df6966f9 e7ac3a94ae49e6a71eb031e */
+ 0x0.e62a551594b970a770b15d41d4p0L,
+ 0x0.c0e483e47aca550111df6966f9p-104L,
+/* sin(x) = 0.70122c5ec5028c8cff33abf4fd 340ccc382e038379b09cf04f9a 52692b10b72586060cbb001 */
+ 0x0.70122c5ec5028c8cff33abf4fdp0L,
+ 0x0.340ccc382e038379b09cf04f9ap-104L,
+
+/* x = 4.60937500000000000000000000000000000e-01 3ffdd800000000000000000000000000 */
+/* cos(x) = 0.e54864fe33e8575cabf5bd0e5c f1b1a8bc7c0d5f61702450fa6b 6539735820dd2603ae355d5 */
+ 0x0.e54864fe33e8575cabf5bd0e5cp0L,
+ 0x0.f1b1a8bc7c0d5f61702450fa6bp-104L,
+/* sin(x) = 0.71dd9fb1ff4677853acb970a9f 6729c6e3aac247b1c57cea66c7 7413f1f98e8b9e98e49d851 */
+ 0x0.71dd9fb1ff4677853acb970a9fp0L,
+ 0x0.6729c6e3aac247b1c57cea66c7p-104L,
+
+/* x = 4.68750000000000000000000000000000000e-01 3ffde000000000000000000000000000 */
+/* cos(x) = 0.e462dfc670d421ab3d1a159012 28f146a0547011202bf5ab01f9 14431859aef577966bc4fa4 */
+ 0x0.e462dfc670d421ab3d1a159012p0L,
+ 0x0.28f146a0547011202bf5ab01f9p-104L,
+/* sin(x) = 0.73a74b8f52947b681baf6928eb 3fb021769bf4779bad0e3aa9b1 cdb75ec60aad9fc63ff19d5 */
+ 0x0.73a74b8f52947b681baf6928ebp0L,
+ 0x0.3fb021769bf4779bad0e3aa9b1p-104L,
+
+/* x = 4.76562500000000000000000000000000000e-01 3ffde800000000000000000000000000 */
+/* cos(x) = 0.e379c9045f29d517c4808aa497 c2057b2b3d109e76c0dc302d4d 0698b36e3f0bdbf33d8e952 */
+ 0x0.e379c9045f29d517c4808aa497p0L,
+ 0x0.c2057b2b3d109e76c0dc302d4dp-104L,
+/* sin(x) = 0.756f28d011d98528a44a75fc29 c779bd734ecdfb582fdb74b68a 4c4c4be54cfd0b2d3ad292f */
+ 0x0.756f28d011d98528a44a75fc29p0L,
+ 0x0.c779bd734ecdfb582fdb74b68ap-104L,
+
+/* x = 4.84375000000000000000000000000000000e-01 3ffdf000000000000000000000000000 */
+/* cos(x) = 0.e28d245c58baef72225e232abc 003c4366acd9eb4fc2808c2ab7 fe7676cf512ac7f945ae5fb */
+ 0x0.e28d245c58baef72225e232abcp0L,
+ 0x0.003c4366acd9eb4fc2808c2ab7p-104L,
+/* sin(x) = 0.77353054ca72690d4c6e171fd9 9e6b39fa8e1ede5f052fd29645 34c75340970a3a9cd3c5c32 */
+ 0x0.77353054ca72690d4c6e171fd9p0L,
+ 0x0.9e6b39fa8e1ede5f052fd29645p-104L,
+
+/* x = 4.92187500000000000000000000000000000e-01 3ffdf800000000000000000000000000 */
+/* cos(x) = 0.e19cf580eeec046aa1422fa748 07ecefb2a1911c94e7b5f20a00 f70022d940193691e5bd790 */
+ 0x0.e19cf580eeec046aa1422fa748p0L,
+ 0x0.07ecefb2a1911c94e7b5f20a00p-104L,
+/* sin(x) = 0.78f95b0560a9a3bd6df7bd981d c38c61224d08bc20631ea932e6 05e53b579e9e0767dfcbbcb */
+ 0x0.78f95b0560a9a3bd6df7bd981dp0L,
+ 0x0.c38c61224d08bc20631ea932e6p-104L,
+
+/* x = 5.00000000000000000000000000000000000e-01 3ffe0000000000000000000000000000 */
+/* cos(x) = 0.e0a94032dbea7cedbddd9da2fa fad98556566b3a89f43eabd723 50af3e8b19e801204d8fe2e */
+ 0x0.e0a94032dbea7cedbddd9da2fap0L,
+ 0x0.fad98556566b3a89f43eabd723p-104L,
+/* sin(x) = 0.7abba1d12c17bfa1d92f0d93f6 0ded9992f45b4fcaf13cd58b30 3693d2a0db47db35ae8a3a9 */
+ 0x0.7abba1d12c17bfa1d92f0d93f6p0L,
+ 0x0.0ded9992f45b4fcaf13cd58b30p-104L,
+
+/* x = 5.07812500000000000000000000000000000e-01 3ffe0400000000000000000000000000 */
+/* cos(x) = 0.dfb20840f3a9b36f7ae2c51534 2890b5ec583b8366cc2b55029e 95094d31112383f2553498b */
+ 0x0.dfb20840f3a9b36f7ae2c51534p0L,
+ 0x0.2890b5ec583b8366cc2b55029ep-104L,
+/* sin(x) = 0.7c7bfdaf13e5ed17212f8a7525 bfb113aba6c0741b5362bb8d59 282a850b63716bca0c910f0 */
+ 0x0.7c7bfdaf13e5ed17212f8a7525p0L,
+ 0x0.bfb113aba6c0741b5362bb8d59p-104L,
+
+/* x = 5.15625000000000000000000000000000000e-01 3ffe0800000000000000000000000000 */
+/* cos(x) = 0.deb7518814a7a931bbcc88c109 cd41c50bf8bb48f20ae8c36628 d1d3d57574f7dc58f27d91c */
+ 0x0.deb7518814a7a931bbcc88c109p0L,
+ 0x0.cd41c50bf8bb48f20ae8c36628p-104L,
+/* sin(x) = 0.7e3a679daaf25c676542bcb402 8d0964172961c921823a4ef0c3 a9070d886dbd073f6283699 */
+ 0x0.7e3a679daaf25c676542bcb402p0L,
+ 0x0.8d0964172961c921823a4ef0c3p-104L,
+
+/* x = 5.23437500000000000000000000000000000e-01 3ffe0c00000000000000000000000000 */
+/* cos(x) = 0.ddb91ff318799172bd2452d0a3 889f5169c64a0094bcf0b8aa7d cf0d7640a2eba68955a80be */
+ 0x0.ddb91ff318799172bd2452d0a3p0L,
+ 0x0.889f5169c64a0094bcf0b8aa7dp-104L,
+/* sin(x) = 0.7ff6d8a34bd5e8fa54c97482db 5159df1f24e8038419c0b448b9 eea8939b5d4dfcf40900257 */
+ 0x0.7ff6d8a34bd5e8fa54c97482dbp0L,
+ 0x0.5159df1f24e8038419c0b448b9p-104L,
+
+/* x = 5.31250000000000000000000000000000000e-01 3ffe1000000000000000000000000000 */
+/* cos(x) = 0.dcb7777ac420705168f31e3eb7 80ce9c939ecada62843b54522f 5407eb7f21e556059fcd734 */
+ 0x0.dcb7777ac420705168f31e3eb7p0L,
+ 0x0.80ce9c939ecada62843b54522fp-104L,
+/* sin(x) = 0.81b149ce34caa5a4e650f8d09f d4d6aa74206c32ca951a93074c 83b2d294d25dbb0f7fdfad2 */
+ 0x0.81b149ce34caa5a4e650f8d09fp0L,
+ 0x0.d4d6aa74206c32ca951a93074cp-104L,
+
+/* x = 5.39062500000000000000000000000000000e-01 3ffe1400000000000000000000000000 */
+/* cos(x) = 0.dbb25c25b8260c14f6e7bc98ec 991b70c65335198b0ab628bad2 0cc7b229d4dd62183cfa055 */
+ 0x0.dbb25c25b8260c14f6e7bc98ecp0L,
+ 0x0.991b70c65335198b0ab628bad2p-104L,
+/* sin(x) = 0.8369b434a372da7eb5c8a71fe3 6ce1e0b2b493f6f5cb2e38bcae c2a556b3678c401940d1c3c */
+ 0x0.8369b434a372da7eb5c8a71fe3p0L,
+ 0x0.6ce1e0b2b493f6f5cb2e38bcaep-104L,
+
+/* x = 5.46875000000000000000000000000000000e-01 3ffe1800000000000000000000000000 */
+/* cos(x) = 0.daa9d20860827063fde51c09e8 55e9932e1b17143e7244fd267a 899d41ae1f3bc6a0ec42e27 */
+ 0x0.daa9d20860827063fde51c09e8p0L,
+ 0x0.55e9932e1b17143e7244fd267ap-104L,
+/* sin(x) = 0.852010f4f0800521378bd8dd61 4753d080c2e9e0775ffc609947 b9132f5357404f464f06a58 */
+ 0x0.852010f4f0800521378bd8dd61p0L,
+ 0x0.4753d080c2e9e0775ffc609947p-104L,
+
+/* x = 5.54687500000000000000000000000000000e-01 3ffe1c00000000000000000000000000 */
+/* cos(x) = 0.d99ddd44e44a43d4d4a3a3ed95 204106fd54d78e8c7684545c0d a0b7c2c72be7a89b7c182ad */
+ 0x0.d99ddd44e44a43d4d4a3a3ed95p0L,
+ 0x0.204106fd54d78e8c7684545c0dp-104L,
+/* sin(x) = 0.86d45935ab396cb4e421e822de e54f3562dfcefeaa782184c234 01d231f5ad981a1cc195b18 */
+ 0x0.86d45935ab396cb4e421e822dep0L,
+ 0x0.e54f3562dfcefeaa782184c234p-104L,
+
+/* x = 5.62500000000000000000000000000000000e-01 3ffe2000000000000000000000000000 */
+/* cos(x) = 0.d88e820b1526311dd561efbc0c 1a9a5375eb26f65d246c5744b1 3ca26a7e0fd42556da843c8 */
+ 0x0.d88e820b1526311dd561efbc0cp0L,
+ 0x0.1a9a5375eb26f65d246c5744b1p-104L,
+/* sin(x) = 0.88868625b4e1dbb23133101330 22527200c143a5cb16637cb7da f8ade82459ff2e98511f40f */
+ 0x0.88868625b4e1dbb23133101330p0L,
+ 0x0.22527200c143a5cb16637cb7dap-104L,
+
+/* x = 5.70312500000000000000000000000000000e-01 3ffe2400000000000000000000000000 */
+/* cos(x) = 0.d77bc4985e93a607c9d868b906 bbc6bbe3a04258814acb035846 8b826fc91bd4d814827f65e */
+ 0x0.d77bc4985e93a607c9d868b906p0L,
+ 0x0.bbc6bbe3a04258814acb035846p-104L,
+/* sin(x) = 0.8a3690fc5bfc11bf9535e2739a 8512f448a41251514bbed7fc18 d530f9b4650fcbb2861b0aa */
+ 0x0.8a3690fc5bfc11bf9535e2739ap0L,
+ 0x0.8512f448a41251514bbed7fc18p-104L,
+
+/* x = 5.78125000000000000000000000000000000e-01 3ffe2800000000000000000000000000 */
+/* cos(x) = 0.d665a937b4ef2b1f6d51bad6d9 88a4419c1d7051faf31a9efa15 1d7631117efac03713f950a */
+ 0x0.d665a937b4ef2b1f6d51bad6d9p0L,
+ 0x0.88a4419c1d7051faf31a9efa15p-104L,
+/* sin(x) = 0.8be472f9776d809af2b8817124 3d63d66dfceeeb739cc894e023 fbc165a0e3f26ff729c5d57 */
+ 0x0.8be472f9776d809af2b8817124p0L,
+ 0x0.3d63d66dfceeeb739cc894e023p-104L,
+
+/* x = 5.85937500000000000000000000000000000e-01 3ffe2c00000000000000000000000000 */
+/* cos(x) = 0.d54c3441844897fc8f853f0655 f1ba695eba9fbfd7439dbb1171 d862d9d9146ca5136f825ac */
+ 0x0.d54c3441844897fc8f853f0655p0L,
+ 0x0.f1ba695eba9fbfd7439dbb1171p-104L,
+/* sin(x) = 0.8d902565817ee7839bce3cd128 060119492cd36d42d82ada30d7 f8bde91324808377ddbf5d4 */
+ 0x0.8d902565817ee7839bce3cd128p0L,
+ 0x0.060119492cd36d42d82ada30d7p-104L,
+
+/* x = 5.93750000000000000000000000000000000e-01 3ffe3000000000000000000000000000 */
+/* cos(x) = 0.d42f6a1b9f0168cdf031c2f63c 8d9304d86f8d34cb1d5fccb68c a0f2241427fc18d1fd5bbdf */
+ 0x0.d42f6a1b9f0168cdf031c2f63cp0L,
+ 0x0.8d9304d86f8d34cb1d5fccb68cp-104L,
+/* sin(x) = 0.8f39a191b2ba6122a3fa4f41d5 a3ffd421417d46f19a22230a14 f7fcc8fce5c75b4b28b29d1 */
+ 0x0.8f39a191b2ba6122a3fa4f41d5p0L,
+ 0x0.a3ffd421417d46f19a22230a14p-104L,
+
+/* x = 6.01562500000000000000000000000000000e-01 3ffe3400000000000000000000000000 */
+/* cos(x) = 0.d30f4f392c357ab0661c5fa8a7 d9b26627846fef214b1d19a223 79ff9eddba087cf410eb097 */
+ 0x0.d30f4f392c357ab0661c5fa8a7p0L,
+ 0x0.d9b26627846fef214b1d19a223p-104L,
+/* sin(x) = 0.90e0e0d81ca678796cc92c8ea8 c2815bc72ca78abe571bfa8576 aacc571e096a33237e0e830 */
+ 0x0.90e0e0d81ca678796cc92c8ea8p0L,
+ 0x0.c2815bc72ca78abe571bfa8576p-104L,
+
+/* x = 6.09375000000000000000000000000000000e-01 3ffe3800000000000000000000000000 */
+/* cos(x) = 0.d1ebe81a95ee752e48a26bcd32 d6e922d7eb44b8ad2232f69307 95e84b56317269b9dd1dfa6 */
+ 0x0.d1ebe81a95ee752e48a26bcd32p0L,
+ 0x0.d6e922d7eb44b8ad2232f69307p-104L,
+/* sin(x) = 0.9285dc9bc45dd9ea3d02457bcc e59c4175aab6ff7929a8d28719 5525fdace200dba032874fb */
+ 0x0.9285dc9bc45dd9ea3d02457bccp0L,
+ 0x0.e59c4175aab6ff7929a8d28719p-104L,
+
+/* x = 6.17187500000000000000000000000000000e-01 3ffe3c00000000000000000000000000 */
+/* cos(x) = 0.d0c5394d772228195e25736c03 574707de0af1ca344b13bd3914 bfe27518e9e426f5deff1e1 */
+ 0x0.d0c5394d772228195e25736c03p0L,
+ 0x0.574707de0af1ca344b13bd3914p-104L,
+/* sin(x) = 0.94288e48bd0335fc41c4cbd292 0497a8f5d1d8185c99fa0081f9 0c27e2a53ffdd208a0dbe69 */
+ 0x0.94288e48bd0335fc41c4cbd292p0L,
+ 0x0.0497a8f5d1d8185c99fa0081f9p-104L,
+
+/* x = 6.25000000000000000000000000000000000e-01 3ffe4000000000000000000000000000 */
+/* cos(x) = 0.cf9b476c897c25c5bfe750dd3f 308eaf7bcc1ed00179a256870f 4200445043dcdb1974b5878 */
+ 0x0.cf9b476c897c25c5bfe750dd3fp0L,
+ 0x0.308eaf7bcc1ed00179a256870fp-104L,
+/* sin(x) = 0.95c8ef544210ec0b91c49bd2aa 09e8515fa61a156ebb10f5f8c2 32a6445b61ebf3c2ec268f9 */
+ 0x0.95c8ef544210ec0b91c49bd2aap0L,
+ 0x0.09e8515fa61a156ebb10f5f8c2p-104L,
+
+/* x = 6.32812500000000000000000000000000000e-01 3ffe4400000000000000000000000000 */
+/* cos(x) = 0.ce6e171f92f2e27f32225327ec 440ddaefae248413efc0e58cee e1ae369aabe73f88c87ed1a */
+ 0x0.ce6e171f92f2e27f32225327ecp0L,
+ 0x0.440ddaefae248413efc0e58ceep-104L,
+/* sin(x) = 0.9766f93cd18413a6aafc1cfc6f c28abb6817bf94ce349901ae3f 48c3215d3eb60acc5f78903 */
+ 0x0.9766f93cd18413a6aafc1cfc6fp0L,
+ 0x0.c28abb6817bf94ce349901ae3fp-104L,
+
+/* x = 6.40625000000000000000000000000000000e-01 3ffe4800000000000000000000000000 */
+/* cos(x) = 0.cd3dad1b5328a2e459f993f4f5 108819faccbc4eeba9604e81c7 adad51cc8a2561631a06826 */
+ 0x0.cd3dad1b5328a2e459f993f4f5p0L,
+ 0x0.108819faccbc4eeba9604e81c7p-104L,
+/* sin(x) = 0.9902a58a45e27bed68412b426b 675ed503f54d14c8172e0d373f 42cadf04daf67319a7f94be */
+ 0x0.9902a58a45e27bed68412b426bp0L,
+ 0x0.675ed503f54d14c8172e0d373fp-104L,
+
+/* x = 6.48437500000000000000000000000000000e-01 3ffe4c00000000000000000000000000 */
+/* cos(x) = 0.cc0a0e21709883a3ff00911e11 a07ee3bd7ea2b04e081be99be0 264791170761ae64b8b744a */
+ 0x0.cc0a0e21709883a3ff00911e11p0L,
+ 0x0.a07ee3bd7ea2b04e081be99be0p-104L,
+/* sin(x) = 0.9a9bedcdf01b38d993f3d78207 81de292033ead73b89e28f3931 3dbe3a6e463f845b5fa8490 */
+ 0x0.9a9bedcdf01b38d993f3d78207p0L,
+ 0x0.81de292033ead73b89e28f3931p-104L,
+
+/* x = 6.56250000000000000000000000000000000e-01 3ffe5000000000000000000000000000 */
+/* cos(x) = 0.cad33f00658fe5e8204bbc0f3a 66a0e6a773f87987a780b243d7 be83b3db1448ca0e0e62787 */
+ 0x0.cad33f00658fe5e8204bbc0f3ap0L,
+ 0x0.66a0e6a773f87987a780b243d7p-104L,
+/* sin(x) = 0.9c32cba2b14156ef05256c4f85 7991ca6a547cd7ceb1ac8a8e62 a282bd7b9183648a462bd04 */
+ 0x0.9c32cba2b14156ef05256c4f85p0L,
+ 0x0.7991ca6a547cd7ceb1ac8a8e62p-104L,
+
+/* x = 6.64062500000000000000000000000000000e-01 3ffe5400000000000000000000000000 */
+/* cos(x) = 0.c99944936cf48c8911ff93fe64 b3ddb7981e414bdaf6aae12035 77de44878c62bc3bc9cf7b9 */
+ 0x0.c99944936cf48c8911ff93fe64p0L,
+ 0x0.b3ddb7981e414bdaf6aae12035p-104L,
+/* sin(x) = 0.9dc738ad14204e689ac582d0f8 5826590feece34886cfefe2e08 cf2bb8488d55424dc9d3525 */
+ 0x0.9dc738ad14204e689ac582d0f8p0L,
+ 0x0.5826590feece34886cfefe2e08p-104L,
+
+/* x = 6.71875000000000000000000000000000000e-01 3ffe5800000000000000000000000000 */
+/* cos(x) = 0.c85c23c26ed7b6f014ef546c47 929682122876bfbf157de0aff3 c4247d820c746e32cd4174f */
+ 0x0.c85c23c26ed7b6f014ef546c47p0L,
+ 0x0.929682122876bfbf157de0aff3p-104L,
+/* sin(x) = 0.9f592e9b66a9cf906a3c7aa3c1 0199849040c45ec3f0a7475973 11038101780c5f266059dbf */
+ 0x0.9f592e9b66a9cf906a3c7aa3c1p0L,
+ 0x0.0199849040c45ec3f0a7475973p-104L,
+
+/* x = 6.79687500000000000000000000000000000e-01 3ffe5c00000000000000000000000000 */
+/* cos(x) = 0.c71be181ecd6875ce2da5615a0 3cca207d9adcb9dfb0a1d6c40a 4f0056437f1a59ccddd06ee */
+ 0x0.c71be181ecd6875ce2da5615a0p0L,
+ 0x0.3cca207d9adcb9dfb0a1d6c40ap-104L,
+/* sin(x) = 0.a0e8a725d33c828c11fa50fd9e 9a15ffecfad43f3e534358076b 9b0f6865694842b1e8c67dc */
+ 0x0.a0e8a725d33c828c11fa50fd9ep0L,
+ 0x0.9a15ffecfad43f3e534358076bp-104L,
+
+/* x = 6.87500000000000000000000000000000000e-01 3ffe6000000000000000000000000000 */
+/* cos(x) = 0.c5d882d2ee48030c7c07d28e98 1e34804f82ed4cf93655d23653 89b716de6ad44676a1cc5da */
+ 0x0.c5d882d2ee48030c7c07d28e98p0L,
+ 0x0.1e34804f82ed4cf93655d23653p-104L,
+/* sin(x) = 0.a2759c0e79c35582527c32b55f 5405c182c66160cb1d9eb7bb0b 7cdf4ad66f317bda4332914 */
+ 0x0.a2759c0e79c35582527c32b55fp0L,
+ 0x0.5405c182c66160cb1d9eb7bb0bp-104L,
+
+/* x = 6.95312500000000000000000000000000000e-01 3ffe6400000000000000000000000000 */
+/* cos(x) = 0.c4920cc2ec38fb891b38827db0 8884fc66371ac4c2052ca8885b 981bbcfd3bb7b093ee31515 */
+ 0x0.c4920cc2ec38fb891b38827db0p0L,
+ 0x0.8884fc66371ac4c2052ca8885bp-104L,
+/* sin(x) = 0.a400072188acf49cd6b173825e 038346f105e1301afe642bcc36 4cea455e21e506e3e927ed8 */
+ 0x0.a400072188acf49cd6b173825ep0L,
+ 0x0.038346f105e1301afe642bcc36p-104L,
+
+/* x = 7.03125000000000000000000000000000000e-01 3ffe6800000000000000000000000000 */
+/* cos(x) = 0.c348846bbd3631338ffe2bfe9d d1381a35b4e9c0c51b4c13fe37 6bad1bf5caacc4542be0aa9 */
+ 0x0.c348846bbd3631338ffe2bfe9dp0L,
+ 0x0.d1381a35b4e9c0c51b4c13fe37p-104L,
+/* sin(x) = 0.a587e23555bb08086d02b9c662 cdd29316c3e9bd08d93793634a 21b1810cce73bdb97a99b9e */
+ 0x0.a587e23555bb08086d02b9c662p0L,
+ 0x0.cdd29316c3e9bd08d93793634ap-104L,
+
+/* x = 7.10937500000000000000000000000000000e-01 3ffe6c00000000000000000000000000 */
+/* cos(x) = 0.c1fbeef380e4ffdd5a613ec872 2f643ffe814ec2343e53adb549 627224fdc9f2a7b77d3d69f */
+ 0x0.c1fbeef380e4ffdd5a613ec872p0L,
+ 0x0.2f643ffe814ec2343e53adb549p-104L,
+/* sin(x) = 0.a70d272a76a8d4b6da0ec90712 bb748b96dabf88c3079246f3db 7eea6e58ead4ed0e2843303 */
+ 0x0.a70d272a76a8d4b6da0ec90712p0L,
+ 0x0.bb748b96dabf88c3079246f3dbp-104L,
+
+/* x = 7.18750000000000000000000000000000000e-01 3ffe7000000000000000000000000000 */
+/* cos(x) = 0.c0ac518c8b6ae710ba37a3eeb9 0cb15aebcb8bed4356fb507a48 a6e97de9aa6d9660116b436 */
+ 0x0.c0ac518c8b6ae710ba37a3eeb9p0L,
+ 0x0.0cb15aebcb8bed4356fb507a48p-104L,
+/* sin(x) = 0.a88fcfebd9a8dd47e2f3c76ef9 e2439920f7e7fbe735f8bcc985 491ec6f12a2d4214f8cfa99 */
+ 0x0.a88fcfebd9a8dd47e2f3c76ef9p0L,
+ 0x0.e2439920f7e7fbe735f8bcc985p-104L,
+
+/* x = 7.26562500000000000000000000000000000e-01 3ffe7400000000000000000000000000 */
+/* cos(x) = 0.bf59b17550a440687596929656 7cf3e3b4e483061877c02811c6 cae85fad5a6c3da58f49292 */
+ 0x0.bf59b17550a440687596929656p0L,
+ 0x0.7cf3e3b4e483061877c02811c6p-104L,
+/* sin(x) = 0.aa0fd66eddb921232c28520d39 11b8a03193b47f187f1471ac21 6fbcd5bb81029294d3a73f1 */
+ 0x0.aa0fd66eddb921232c28520d39p0L,
+ 0x0.11b8a03193b47f187f1471ac21p-104L,
+
+/* x = 7.34375000000000000000000000000000000e-01 3ffe7800000000000000000000000000 */
+/* cos(x) = 0.be0413f84f2a771c614946a88c bf4da1d75a5560243de8f2283f efa0ea4a48468a52d51d8b3 */
+ 0x0.be0413f84f2a771c614946a88cp0L,
+ 0x0.bf4da1d75a5560243de8f2283fp-104L,
+/* sin(x) = 0.ab8d34b36acd987210ed343ec6 5d7e3adc2e7109fce43d55c8d5 7dfdf55b9e01d2cc1f1b9ec */
+ 0x0.ab8d34b36acd987210ed343ec6p0L,
+ 0x0.5d7e3adc2e7109fce43d55c8d5p-104L,
+
+/* x = 7.42187500000000000000000000000000000e-01 3ffe7c00000000000000000000000000 */
+/* cos(x) = 0.bcab7e6bfb2a14a9b122c574a3 76bec98ab14808c64a4e731b34 047e217611013ac99c0f25d */
+ 0x0.bcab7e6bfb2a14a9b122c574a3p0L,
+ 0x0.76bec98ab14808c64a4e731b34p-104L,
+/* sin(x) = 0.ad07e4c409d08c4fa3a9057bb0 ac24b8636e74e76f51e09bd6b2 319707cbd9f5e254643897a */
+ 0x0.ad07e4c409d08c4fa3a9057bb0p0L,
+ 0x0.ac24b8636e74e76f51e09bd6b2p-104L,
+
+/* x = 7.50000000000000000000000000000000000e-01 3ffe8000000000000000000000000000 */
+/* cos(x) = 0.bb4ff632a908f73ec151839cb9 d993b4e0bfb8f20e7e44e6e4ae e845e35575c3106dbe6fd06 */
+ 0x0.bb4ff632a908f73ec151839cb9p0L,
+ 0x0.d993b4e0bfb8f20e7e44e6e4aep-104L,
+/* sin(x) = 0.ae7fe0b5fc786b2d966e1d6af1 40a488476747c2646425fc7533 f532cd044cb10a971a49a6a */
+ 0x0.ae7fe0b5fc786b2d966e1d6af1p0L,
+ 0x0.40a488476747c2646425fc7533p-104L,
+
+/* x = 7.57812500000000000000000000000000000e-01 3ffe8400000000000000000000000000 */
+/* cos(x) = 0.b9f180ba77dd0751628e135a95 08299012230f14becacdd14c3f 8862d122de5b56d55b53360 */
+ 0x0.b9f180ba77dd0751628e135a95p0L,
+ 0x0.08299012230f14becacdd14c3fp-104L,
+/* sin(x) = 0.aff522a954f2ba16d9defdc416 e33f5e9a5dfd5a6c228e0abc4d 521327ff6e2517a7b3851dd */
+ 0x0.aff522a954f2ba16d9defdc416p0L,
+ 0x0.e33f5e9a5dfd5a6c228e0abc4dp-104L,
+
+/* x = 7.65625000000000000000000000000000000e-01 3ffe8800000000000000000000000000 */
+/* cos(x) = 0.b890237d3bb3c284b614a05390 16bfa1053730bbdf940fa895e1 85f8e58884d3dda15e63371 */
+ 0x0.b890237d3bb3c284b614a05390p0L,
+ 0x0.16bfa1053730bbdf940fa895e1p-104L,
+/* sin(x) = 0.b167a4c90d63c4244cf5493b7c c23bd3c3c1225e078baa0c53d6 d400b926281f537a1a260e6 */
+ 0x0.b167a4c90d63c4244cf5493b7cp0L,
+ 0x0.c23bd3c3c1225e078baa0c53d6p-104L,
+
+/* x = 7.73437500000000000000000000000000000e-01 3ffe8c00000000000000000000000000 */
+/* cos(x) = 0.b72be40067aaf2c050dbdb7a14 c3d7d4f203f6b3f0224a4afe55 d6ec8e92b508fd5c5984b3b */
+ 0x0.b72be40067aaf2c050dbdb7a14p0L,
+ 0x0.c3d7d4f203f6b3f0224a4afe55p-104L,
+/* sin(x) = 0.b2d7614b1f3aaa24df2d6e20a7 7e1ca3e6d838c03e29c1bcb026 e6733324815fadc9eb89674 */
+ 0x0.b2d7614b1f3aaa24df2d6e20a7p0L,
+ 0x0.7e1ca3e6d838c03e29c1bcb026p-104L,
+
+/* x = 7.81250000000000000000000000000000000e-01 3ffe9000000000000000000000000000 */
+/* cos(x) = 0.b5c4c7d4f7dae915ac786ccf4b 1a498d3e73b6e5e74fe7519d9c 53ee6d6b90e881bddfc33e1 */
+ 0x0.b5c4c7d4f7dae915ac786ccf4bp0L,
+ 0x0.1a498d3e73b6e5e74fe7519d9cp-104L,
+/* sin(x) = 0.b44452709a5975290591376543 4a59d111f0433eb2b133f7d103 207e2aeb4aae111ddc385b3 */
+ 0x0.b44452709a5975290591376543p0L,
+ 0x0.4a59d111f0433eb2b133f7d103p-104L,
+
+/* x = 7.89062500000000000000000000000000000e-01 3ffe9400000000000000000000000000 */
+/* cos(x) = 0.b45ad4975b1294cadca4cf40ec 8f22a68cd14b175835239a37e6 3acb85e8e9505215df18140 */
+ 0x0.b45ad4975b1294cadca4cf40ecp0L,
+ 0x0.8f22a68cd14b175835239a37e6p-104L,
+/* sin(x) = 0.b5ae7285bc10cf515753847e8f 8b7a30e0a580d929d770103509 880680f7b8b0e8ad23b65d8 */
+ 0x0.b5ae7285bc10cf515753847e8fp0L,
+ 0x0.8b7a30e0a580d929d770103509p-104L
+};
diff --git a/sysdeps/ieee754/ldbl-128ibm/w_expl.c b/sysdeps/ieee754/ldbl-128ibm/w_expl.c
new file mode 100644
index 0000000000..a5e72b2170
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/w_expl.c
@@ -0,0 +1,6 @@
+/* Looks like we can use ieee854 w_expl.c as is for IBM extended format. */
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/w_expl.c>
+long_double_symbol (libm, __expl, expl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_asinhl.c b/sysdeps/ieee754/ldbl-64-128/s_asinhl.c
new file mode 100644
index 0000000000..4e8a541263
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_asinhl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_asinhl.c>
+long_double_symbol (libm, __asinhl, asinhl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_atanl.c b/sysdeps/ieee754/ldbl-64-128/s_atanl.c
new file mode 100644
index 0000000000..c23d14aade
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_atanl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_atanl.c>
+long_double_symbol (libm, __atanl, atanl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_cbrtl.c b/sysdeps/ieee754/ldbl-64-128/s_cbrtl.c
new file mode 100644
index 0000000000..ace5645277
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_cbrtl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_cbrtl.c>
+long_double_symbol (libm, __cbrtl, cbrtl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_ceill.c b/sysdeps/ieee754/ldbl-64-128/s_ceill.c
new file mode 100644
index 0000000000..a646494f14
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_ceill.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_ceill.c>
+long_double_symbol (libm, __ceill, ceill);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_copysignl.c b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
new file mode 100644
index 0000000000..1319584a52
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_copysignl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __copysignl, copysignl);
+#else
+long_double_symbol (libc, __copysignl, copysignl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_cosl.c b/sysdeps/ieee754/ldbl-64-128/s_cosl.c
new file mode 100644
index 0000000000..6a7e2e3162
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_cosl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_cosl.c>
+long_double_symbol (libm, __cosl, cosl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_erfl.c b/sysdeps/ieee754/ldbl-64-128/s_erfl.c
new file mode 100644
index 0000000000..c5f9bb3ac4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_erfl.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_erfl.c>
+long_double_symbol (libm, __erfl, erfl);
+long_double_symbol (libm, __erfcl, erfcl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_expm1l.c b/sysdeps/ieee754/ldbl-64-128/s_expm1l.c
new file mode 100644
index 0000000000..4fb186127f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_expm1l.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_expm1l.c>
+long_double_symbol (libm, __expm1l, expm1l);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_fabsl.c b/sysdeps/ieee754/ldbl-64-128/s_fabsl.c
new file mode 100644
index 0000000000..93d81d98bc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_fabsl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_fabsl.c>
+long_double_symbol (libm, __fabsl, fabsl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_finitel.c b/sysdeps/ieee754/ldbl-64-128/s_finitel.c
new file mode 100644
index 0000000000..90717a1057
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_finitel.c
@@ -0,0 +1,17 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#undef hidden_def
+#define hidden_def(x)
+#define __finitel(arg) ___finitel(arg)
+#include <sysdeps/ieee754/ldbl-128/s_finitel.c>
+#undef __finitel
+hidden_ver (___finitel, __finitel)
+_weak_alias (___finitel, ____finitel)
+#ifdef IS_IN_libm
+long_double_symbol (libm, ____finitel, finitel);
+long_double_symbol (libm, ___finitel, __finitel);
+#else
+long_double_symbol (libc, ____finitel, finitel);
+long_double_symbol (libc, ___finitel, __finitel);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_floorl.c b/sysdeps/ieee754/ldbl-64-128/s_floorl.c
new file mode 100644
index 0000000000..953043035e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_floorl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_floorl.c>
+long_double_symbol (libm, __floorl, floorl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c b/sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c
new file mode 100644
index 0000000000..a10b6c3a1a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c
@@ -0,0 +1,10 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#define __fpclassifyl ___fpclassifyl
+#undef libm_hidden_def
+#define libm_hidden_def(a)
+#include <sysdeps/ieee754/ldbl-128/s_fpclassifyl.c>
+#undef __fpclassifyl
+long_double_symbol (libm, ___fpclassifyl, __fpclassifyl);
+libm_hidden_ver (___fpclassifyl, __fpclassifyl)
diff --git a/sysdeps/ieee754/ldbl-64-128/s_frexpl.c b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
new file mode 100644
index 0000000000..685bbbab41
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_frexpl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __frexpl, frexpl);
+#else
+long_double_symbol (libc, __frexpl, frexpl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_ilogbl.c b/sysdeps/ieee754/ldbl-64-128/s_ilogbl.c
new file mode 100644
index 0000000000..bb88082405
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_ilogbl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_ilogbl.c>
+long_double_symbol (libm, __ilogbl, ilogbl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_isinfl.c b/sysdeps/ieee754/ldbl-64-128/s_isinfl.c
new file mode 100644
index 0000000000..e046032b09
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_isinfl.c
@@ -0,0 +1,16 @@
+#include <math_ldbl_opt.h>
+#ifndef IS_IN_libm
+# undef weak_alias
+# define weak_alias(n,a)
+# undef hidden_def
+# define hidden_def(x)
+# define __isinfl(arg) ___isinfl(arg)
+#endif
+#include <sysdeps/ieee754/ldbl-128/s_isinfl.c>
+#ifndef IS_IN_libm
+# undef __isinfl
+hidden_ver (___isinfl, __isinfl)
+_weak_alias (___isinfl, ____isinfl)
+long_double_symbol (libc, ____isinfl, isinfl);
+long_double_symbol (libc, ___isinfl, __isinfl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_isnanl.c b/sysdeps/ieee754/ldbl-64-128/s_isnanl.c
new file mode 100644
index 0000000000..3673463ae5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_isnanl.c
@@ -0,0 +1,16 @@
+#include <math_ldbl_opt.h>
+#ifndef IS_IN_libm
+# undef weak_alias
+# define weak_alias(n,a)
+# undef hidden_def
+# define hidden_def(x)
+# define __isnanl(arg) ___isnanl(arg)
+#endif
+#include <sysdeps/ieee754/ldbl-128/s_isnanl.c>
+#ifndef IS_IN_libm
+# undef __isnanl
+hidden_ver (___isnanl, __isnanl)
+_weak_alias (___isnanl, ____isnanl)
+long_double_symbol (libc, ____isnanl, isnanl);
+long_double_symbol (libc, ___isnanl, __isnanl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_llrintl.c b/sysdeps/ieee754/ldbl-64-128/s_llrintl.c
new file mode 100644
index 0000000000..1515f3abd7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_llrintl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_llrintl.c>
+long_double_symbol (libm, __llrintl, llrintl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_llroundl.c b/sysdeps/ieee754/ldbl-64-128/s_llroundl.c
new file mode 100644
index 0000000000..ca35dae491
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_llroundl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_llroundl.c>
+long_double_symbol (libm, __llroundl, llroundl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_log1pl.c b/sysdeps/ieee754/ldbl-64-128/s_log1pl.c
new file mode 100644
index 0000000000..eebd63638a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_log1pl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_log1pl.c>
+long_double_symbol (libm, __log1pl, log1pl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_logbl.c b/sysdeps/ieee754/ldbl-64-128/s_logbl.c
new file mode 100644
index 0000000000..8ba8179feb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_logbl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_logbl.c>
+long_double_symbol (libm, __logbl, logbl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_lrintl.c b/sysdeps/ieee754/ldbl-64-128/s_lrintl.c
new file mode 100644
index 0000000000..56e69c94f9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_lrintl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_lrintl.c>
+long_double_symbol (libm, __lrintl, lrintl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_lroundl.c b/sysdeps/ieee754/ldbl-64-128/s_lroundl.c
new file mode 100644
index 0000000000..d5429e2384
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_lroundl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_lroundl.c>
+long_double_symbol (libm, __lroundl, lroundl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_modfl.c b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
new file mode 100644
index 0000000000..c17d6690a8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_modfl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __modfl, modfl);
+#else
+long_double_symbol (libc, __modfl, modfl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_nearbyintl.c b/sysdeps/ieee754/ldbl-64-128/s_nearbyintl.c
new file mode 100644
index 0000000000..a6d0a313fd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_nearbyintl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_nearbyintl.c>
+long_double_symbol (libm, __nearbyintl, nearbyintl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_nextafterl.c b/sysdeps/ieee754/ldbl-64-128/s_nextafterl.c
new file mode 100644
index 0000000000..64c663eda3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_nextafterl.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_nextafterl.c>
+long_double_symbol (libm, __nextafterl, nextafterl);
+long_double_symbol (libm, __nexttowardl, nexttowardl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_nexttoward.c b/sysdeps/ieee754/ldbl-64-128/s_nexttoward.c
new file mode 100644
index 0000000000..2968503d2e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_nexttoward.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_nexttoward.c>
+long_double_symbol (libm, __nexttoward, nexttoward);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_nexttowardf.c b/sysdeps/ieee754/ldbl-64-128/s_nexttowardf.c
new file mode 100644
index 0000000000..64b9c24465
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_nexttowardf.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_nexttowardf.c>
+long_double_symbol (libm, __nexttowardf, nexttowardf);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_remquol.c b/sysdeps/ieee754/ldbl-64-128/s_remquol.c
new file mode 100644
index 0000000000..16f0eb16a4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_remquol.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_remquol.c>
+long_double_symbol (libm, __remquol, remquol);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_rintl.c b/sysdeps/ieee754/ldbl-64-128/s_rintl.c
new file mode 100644
index 0000000000..19af9bbdcb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_rintl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_rintl.c>
+long_double_symbol (libm, __rintl, rintl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_roundl.c b/sysdeps/ieee754/ldbl-64-128/s_roundl.c
new file mode 100644
index 0000000000..3fa99d6f2a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_roundl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_roundl.c>
+long_double_symbol (libm, __roundl, roundl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_scalblnl.c b/sysdeps/ieee754/ldbl-64-128/s_scalblnl.c
new file mode 100644
index 0000000000..3143f18f6c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_scalblnl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_scalblnl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __scalblnl, scalblnl);
+#else
+long_double_symbol (libc, __scalblnl, scalblnl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_scalbnl.c b/sysdeps/ieee754/ldbl-64-128/s_scalbnl.c
new file mode 100644
index 0000000000..78520e9648
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_scalbnl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_scalbnl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __scalbnl, scalbnl);
+#else
+long_double_symbol (libc, __scalbnl, scalbnl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_signbitl.c b/sysdeps/ieee754/ldbl-64-128/s_signbitl.c
new file mode 100644
index 0000000000..f66db2f651
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_signbitl.c
@@ -0,0 +1,11 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#define __signbitl(arg) ___signbitl(arg)
+#include <sysdeps/ieee754/ldbl-128/s_signbitl.c>
+#undef __signbitl
+#ifdef IS_IN_libm
+long_double_symbol (libm, ___signbitl, __signbitl);
+#else
+long_double_symbol (libc, ___signbitl, __signbitl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_sincosl.c b/sysdeps/ieee754/ldbl-64-128/s_sincosl.c
new file mode 100644
index 0000000000..ce0d4e2887
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_sincosl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_sincosl.c>
+long_double_symbol (libm, __sincosl, sincosl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_sinl.c b/sysdeps/ieee754/ldbl-64-128/s_sinl.c
new file mode 100644
index 0000000000..ebc20affdb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_sinl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_sinl.c>
+long_double_symbol (libm, __sinl, sinl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_tanhl.c b/sysdeps/ieee754/ldbl-64-128/s_tanhl.c
new file mode 100644
index 0000000000..ede93930cd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_tanhl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_tanhl.c>
+long_double_symbol (libm, __tanhl, tanhl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_tanl.c b/sysdeps/ieee754/ldbl-64-128/s_tanl.c
new file mode 100644
index 0000000000..6e635dfdc9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_tanl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_tanl.c>
+long_double_symbol (libm, __tanl, tanl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_truncl.c b/sysdeps/ieee754/ldbl-64-128/s_truncl.c
new file mode 100644
index 0000000000..6311479d01
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_truncl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_truncl.c>
+long_double_symbol (libm, __truncl, truncl);
diff --git a/sysdeps/ieee754/ldbl-64-128/strtold_l.c b/sysdeps/ieee754/ldbl-64-128/strtold_l.c
new file mode 100644
index 0000000000..ef8fe05759
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/strtold_l.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 1999, 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <xlocale.h>
+
+/* The actual implementation for all floating point sizes is in strtod.c.
+ These macros tell it to produce the `long double' version, `strtold'. */
+
+#define FLOAT long double
+#define FLT LDBL
+#ifdef USE_WIDE_CHAR
+extern long double ____new_wcstold_l (const wchar_t *, wchar_t **, __locale_t);
+# define STRTOF __new_wcstold_l
+# define __STRTOF ____new_wcstold_l
+# define ____STRTOF_INTERNAL ____wcstold_l_internal
+#else
+extern long double ____new_strtold_l (const char *, char **, __locale_t);
+# define STRTOF __new_strtold_l
+# define __STRTOF ____new_strtold_l
+# define ____STRTOF_INTERNAL ____strtold_l_internal
+#endif
+#define MPN2FLOAT __mpn_construct_long_double
+#define FLOAT_HUGE_VAL HUGE_VALL
+#define SET_MANTISSA(flt, mant) \
+ do { union ieee854_long_double u; \
+ u.d = (flt); \
+ u.ieee.mantissa0 = 0x8000; \
+ u.ieee.mantissa1 = 0; \
+ u.ieee.mantissa2 = ((mant) >> 32); \
+ u.ieee.mantissa3 = (mant) & 0xffffffff; \
+ (flt) = u.d; \
+ } while (0)
+
+#include <strtod_l.c>
+
+#ifdef __LONG_DOUBLE_MATH_OPTIONAL
+# include <math_ldbl_opt.h>
+# ifdef USE_WIDE_CHAR
+long_double_symbol (libc, __new_wcstold_l, wcstold_l);
+long_double_symbol (libc, ____new_wcstold_l, __wcstold_l);
+# else
+long_double_symbol (libc, __new_strtold_l, strtold_l);
+long_double_symbol (libc, ____new_strtold_l, __strtold_l);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/w_expl.c b/sysdeps/ieee754/ldbl-64-128/w_expl.c
new file mode 100644
index 0000000000..2a402b04c0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/w_expl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/w_expl.c>
+long_double_symbol (libm, __expl, expl);
diff --git a/sysdeps/ieee754/ldbl-96/s_erfl.c b/sysdeps/ieee754/ldbl-96/s_erfl.c
index e026f5a516..7406c3624c 100644
--- a/sysdeps/ieee754/ldbl-96/s_erfl.c
+++ b/sysdeps/ieee754/ldbl-96/s_erfl.c
@@ -341,10 +341,6 @@ __erfl (x)
}
weak_alias (__erfl, erfl)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__erf, __erfl)
-weak_alias (__erf, erfl)
-#endif
#ifdef __STDC__
long double
__erfcl (long double x)
@@ -456,7 +452,3 @@ weak_alias (__erf, erfl)
}
weak_alias (__erfcl, erfcl)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__erfc, __erfcl)
-weak_alias (__erfc, erfcl)
-#endif
diff --git a/sysdeps/ieee754/ldbl-96/s_nexttoward.c b/sysdeps/ieee754/ldbl-96/s_nexttoward.c
index 8b273af929..7945cb5cb1 100644
--- a/sysdeps/ieee754/ldbl-96/s_nexttoward.c
+++ b/sysdeps/ieee754/ldbl-96/s_nexttoward.c
@@ -99,7 +99,3 @@ static char rcsid[] = "$NetBSD: $";
return x;
}
weak_alias (__nexttoward, nexttoward)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__nexttoward, __nexttowardl)
-weak_alias (__nexttoward, nexttowardl)
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/Makefile b/sysdeps/ieee754/ldbl-opt/Makefile
new file mode 100644
index 0000000000..bcafb3c84a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/Makefile
@@ -0,0 +1,41 @@
+# The`long double' type is a distinct type we support if
+# -mlong-double-128 option is used (or when it becomes a default
+# when -mlong-double-64 is not used).
+long-double-fcts = yes
+sysdep-CFLAGS += -mlong-double-128
+
+ifeq ($(subdir),math)
+libm-routines += s_nexttowardfd
+routines += math_ldbl_opt nldbl-compat
+
+extra-libs += libnldbl
+libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \
+ obstack_printf obstack_vprintf printf scanf snprintf \
+ sprintf sscanf swprintf swscanf vasprintf vdprintf vfprintf \
+ vfscanf vfwprintf vfwscanf vprintf vscanf vsnprintf \
+ vsprintf vsscanf vswprintf vswscanf vwprintf vwscanf \
+ wprintf wscanf printf_fp printf_size \
+ fprintf_chk fwprintf_chk printf_chk snprintf_chk sprintf_chk \
+ swprintf_chk vfprintf_chk vfwprintf_chk vprintf_chk \
+ vsnprintf_chk vsprintf_chk vswprintf_chk vwprintf_chk \
+ wprintf_chk \
+ syslog syslog_chk vsyslog vsyslog_chk \
+ strfmon strfmon_l \
+ strtold strtold_l strtoldint wcstold wcstold_l wcstoldint \
+ qecvt qfcvt qgcvt qecvt_r qfcvt_r \
+ isinf isnan finite signbit scalb log2 lgamma_r ceil \
+ significand acos asin atan atan2 cos sin tan cosh sinh \
+ tanh acosh asinh atanh exp log log10 exp10 pow10 expm1 \
+ log1p logb exp2 sqrt cbrt fabs floor j0 j1 y0 y1 erf erfc \
+ lgamma tgamma gamma rint nearbyint round trunc \
+ copysign fdim fmax fmin nextafter pow hypot fmod drem \
+ remainder ldexp scalbn frexp modf scalbln fma nan sincos \
+ jn yn ilogb remquo lrint lround llrint llround nexttowardf \
+ nexttoward conj cacos cacosh casin catan catanh ccos ccosh \
+ casinh cexp clog cproj csin csinh csqrt ctan ctanh cpow \
+ cabs carg cimag creal clog10
+libnldbl-routines = $(libnldbl-calls:%=nldbl-%)
+libnldbl-inhibit-o = $(object-suffixes)
+libnldbl-static-only-routines = $(libnldbl-routines)
+
+endif
diff --git a/sysdeps/ieee754/ldbl-opt/Versions b/sysdeps/ieee754/ldbl-opt/Versions
new file mode 100644
index 0000000000..d22b18ec89
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/Versions
@@ -0,0 +1,87 @@
+%include <nldbl-abi.h>
+%ifndef NLDBL_VERSION
+% error "nldbl-abi.h must define NLDBL_VERSION"
+%endif
+
+libc {
+ NLDBL_VERSION {
+ # IEEE quad long double functions (older symver is for
+ # IEEE double long double).
+ ldexpl; copysignl; finitel; frexpl; isinfl; isnanl; modfl;
+ __isinfl; __isnanl; __finitel; __signbitl;
+ scalbnl;
+ qecvt; qfcvt; qgcvt; qecvt_r; qfcvt_r;
+
+ strtold; __strtold_internal; wcstold; __wcstold_internal;
+ __strtold_l; strtold_l; __wcstold_l; wcstold_l;
+
+ strfmon; __strfmon_l; strfmon_l;
+ __nldbl_strfmon; __nldbl___strfmon_l; __nldbl_strfmon_l;
+ __nldbl___vstrfmon; __nldbl___vstrfmon_l;
+
+ syslog; vsyslog;
+ __nldbl_syslog; __nldbl_vsyslog;
+ __nldbl___syslog_chk; __nldbl___vsyslog_chk;
+
+ # *printf* family, using IEEE quad long double
+ __asprintf; asprintf; dprintf; fprintf; fwprintf; _IO_fprintf;
+ _IO_printf; _IO_sprintf; _IO_vfprintf; _IO_vsprintf; obstack_printf;
+ obstack_vprintf; printf; __printf_fp; printf_size; snprintf; sprintf;
+ swprintf; vasprintf; vdprintf; vfprintf; vfwprintf; vprintf; vsnprintf;
+ __vsnprintf; vsprintf; vswprintf; vwprintf; wprintf;
+
+ # *printf* family, using IEEE double as long double
+ # The standard functions are __REDIRECTed to these if -mlong-double-64
+ __nldbl___asprintf; __nldbl_asprintf; __nldbl_dprintf; __nldbl_fprintf;
+ __nldbl_fwprintf; __nldbl__IO_fprintf; __nldbl__IO_printf;
+ __nldbl__IO_sprintf; __nldbl__IO_vfprintf; __nldbl__IO_vsprintf;
+ __nldbl_obstack_printf; __nldbl_obstack_vprintf; __nldbl_printf;
+ __nldbl___printf_fp; __nldbl_printf_size; __nldbl_snprintf;
+ __nldbl_sprintf; __nldbl_swprintf; __nldbl_vasprintf; __nldbl_vdprintf;
+ __nldbl_vfprintf; __nldbl_vfwprintf; __nldbl_vprintf; __nldbl_vsnprintf;
+ __nldbl___vsnprintf; __nldbl_vsprintf; __nldbl_vswprintf;
+ __nldbl_vwprintf; __nldbl_wprintf;
+
+ # *scanf family, using IEEE quad long double
+ _IO_sscanf; _IO_vfscanf; __vfscanf; __vsscanf; fscanf; fwscanf; scanf;
+ sscanf; swscanf; vfscanf; vfwscanf; vscanf; vsscanf; vswscanf; vwscanf;
+ wscanf;
+
+ # *scanf family, using IEEE double as long double
+ __nldbl__IO_sscanf; __nldbl__IO_vfscanf; __nldbl___vfscanf;
+ __nldbl___vsscanf; __nldbl_fscanf; __nldbl_fwscanf; __nldbl_scanf;
+ __nldbl_sscanf; __nldbl_swscanf; __nldbl_vfscanf; __nldbl_vfwscanf;
+ __nldbl_vscanf; __nldbl_vsscanf; __nldbl_vswscanf; __nldbl_vwscanf;
+ __nldbl_wscanf;
+
+ # checking versions, using IEEE quad long double
+ __sprintf_chk; __vsprintf_chk; __snprintf_chk; __vsnprintf_chk;
+ __printf_chk; __fprintf_chk; __vprintf_chk; __vfprintf_chk;
+
+ # checking versions, using IEEE double as long double
+ __nldbl___sprintf_chk; __nldbl___vsprintf_chk; __nldbl___snprintf_chk;
+ __nldbl___vsnprintf_chk; __nldbl___printf_chk; __nldbl___fprintf_chk;
+ __nldbl___vprintf_chk; __nldbl___vfprintf_chk;
+ __nldbl___swprintf_chk; __nldbl___vswprintf_chk; __nldbl___fwprintf_chk;
+ __nldbl___wprintf_chk; __nldbl___vfwprintf_chk; __nldbl___vwprintf_chk;
+ }
+}
+libm {
+ NLDBL_VERSION {
+ # IEEE quad long double functions (older symver is for
+ # IEEE double as long double).
+ cabsl; cargl; cimagl; conjl; creall; cacosl; cacoshl; casinl;
+ catanl; catanhl; ccosl; ccoshl; casinhl; cexpl; clogl; __clog10l;
+ clog10l; cpowl; cprojl; csinl; csinhl; csqrtl; ctanl; ctanhl;
+ fdiml; fmal; fmaxl; fminl; ldexpl; nanl; nextafterl; nexttowardl;
+ significandl; acosl; acoshl; asinl; atan2l; atanhl; coshl; dreml;
+ exp10l; pow10l; exp2l; fmodl; hypotl; j0l; y0l; j1l; y1l; jnl; ynl;
+ lgammal; gammal; lgammal_r; logl; log10l; log2l; powl; remainderl;
+ scalbl; sinhl; sqrtl; tgammal; asinhl; atanl; cbrtl; ceill; copysignl;
+ erfl; erfcl; expm1l; fabsl; finitel; floorl; frexpl; ilogbl;
+ llrintl; llroundl; log1pl; logbl; lrintl; lroundl; modfl;
+ nearbyintl; remquol; rintl; roundl; scalblnl; scalbnl; sinl; cosl;
+ sincosl; tanl; tanhl; truncl; expl; __finitel; __signbitl;
+ __fpclassifyl; nexttowardf; nexttoward; __nldbl_nexttowardf;
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-opt/cabs.c b/sysdeps/ieee754/ldbl-opt/cabs.c
new file mode 100644
index 0000000000..a181de2fa8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cabs.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/cabs.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cabs, cabsl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/cabsl.c b/sysdeps/ieee754/ldbl-opt/cabsl.c
new file mode 100644
index 0000000000..b861633544
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cabsl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/cabsl.c>
+long_double_symbol (libm, __cabsl, cabsl);
diff --git a/sysdeps/ieee754/ldbl-opt/carg.c b/sysdeps/ieee754/ldbl-opt/carg.c
new file mode 100644
index 0000000000..2ed358113c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/carg.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/carg.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __carg, cargl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/cargl.c b/sysdeps/ieee754/ldbl-opt/cargl.c
new file mode 100644
index 0000000000..952dc60664
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cargl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/cargl.c>
+long_double_symbol (libm, __cargl, cargl);
diff --git a/sysdeps/ieee754/ldbl-opt/cimag.c b/sysdeps/ieee754/ldbl-opt/cimag.c
new file mode 100644
index 0000000000..f8052581b3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cimag.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/cimag.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cimag, cimagl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/cimagl.c b/sysdeps/ieee754/ldbl-opt/cimagl.c
new file mode 100644
index 0000000000..112365e3ae
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cimagl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/cimagl.c>
+long_double_symbol (libm, __cimagl, cimagl);
diff --git a/sysdeps/ieee754/ldbl-opt/configure b/sysdeps/ieee754/ldbl-opt/configure
new file mode 100755
index 0000000000..dc81365318
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/configure
@@ -0,0 +1,69 @@
+# This file is generated from configure.in by Autoconf. DO NOT EDIT!
+ # Local configure fragment for sysdeps/ieee754/ldbl-opt/.
+
+
+echo "$as_me:$LINENO: checking whether $CC $CFLAGS supports -mlong-double-128" >&5
+echo $ECHO_N "checking whether $CC $CFLAGS supports -mlong-double-128... $ECHO_C" >&6
+if test "${libc_cv_mlong_double_128+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mlong-double-128"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+#ifndef __LONG_DOUBLE_128__
+# error "compiler did not predefine __LONG_DOUBLE_128__ as expected"
+#endif
+long double foobar (long double x) { return x; }
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ libc_cv_mlong_double_128=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libc_cv_mlong_double_128=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $libc_cv_mlong_double_128" >&5
+echo "${ECHO_T}$libc_cv_mlong_double_128" >&6
+if test "$libc_cv_mlong_double_128" = no; then
+ { { echo "$as_me:$LINENO: error: this configuration requires -mlong-double-128 support" >&5
+echo "$as_me: error: this configuration requires -mlong-double-128 support" >&2;}
+ { (exit 1); exit 1; }; }
+fi
diff --git a/sysdeps/ieee754/ldbl-opt/configure.in b/sysdeps/ieee754/ldbl-opt/configure.in
new file mode 100644
index 0000000000..a77fadd1c4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/configure.in
@@ -0,0 +1,19 @@
+sinclude(./aclocal.m4)dnl Autoconf lossage
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/ieee754/ldbl-opt/.
+
+AC_CACHE_CHECK(whether $CC $CFLAGS supports -mlong-double-128,
+ libc_cv_mlong_double_128, [dnl
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mlong-double-128"
+AC_TRY_COMPILE(, [
+#ifndef __LONG_DOUBLE_128__
+# error "compiler did not predefine __LONG_DOUBLE_128__ as expected"
+#endif
+long double foobar (long double x) { return x; }],
+ libc_cv_mlong_double_128=yes,
+ libc_cv_mlong_double_128=no)
+CFLAGS="$save_CFLAGS"])
+if test "$libc_cv_mlong_double_128" = no; then
+ AC_MSG_ERROR([this configuration requires -mlong-double-128 support])
+fi
diff --git a/sysdeps/ieee754/ldbl-opt/conj.c b/sysdeps/ieee754/ldbl-opt/conj.c
new file mode 100644
index 0000000000..e4edade05e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/conj.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/conj.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __conj, conjl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/conjl.c b/sysdeps/ieee754/ldbl-opt/conjl.c
new file mode 100644
index 0000000000..c98e0ed1c3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/conjl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/conjl.c>
+long_double_symbol (libm, __conjl, conjl);
diff --git a/sysdeps/ieee754/ldbl-opt/creal.c b/sysdeps/ieee754/ldbl-opt/creal.c
new file mode 100644
index 0000000000..0d1c93e640
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/creal.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/creal.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __creal, creall, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/creall.c b/sysdeps/ieee754/ldbl-opt/creall.c
new file mode 100644
index 0000000000..68fedd4ccd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/creall.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/creall.c>
+long_double_symbol (libm, __creall, creall);
diff --git a/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.c b/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.c
new file mode 100644
index 0000000000..49c5c1249b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.c
@@ -0,0 +1,3 @@
+/* Set temporarily to non-zero if long double should be considered
+ the same as double. */
+__thread int __no_long_double attribute_tls_model_ie attribute_hidden;
diff --git a/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h b/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h
new file mode 100644
index 0000000000..692b0c53c7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h
@@ -0,0 +1,52 @@
+/* -mlong-double-64 compatibility mode macros. */
+
+#include <nldbl-abi.h>
+#ifndef LONG_DOUBLE_COMPAT_VERSION
+# error "nldbl-abi.h must define LONG_DOUBLE_COMPAT_VERSION"
+#endif
+
+#include <shlib-compat.h>
+#define LONG_DOUBLE_COMPAT(lib, introduced) \
+ SHLIB_COMPAT(lib, introduced, LONG_DOUBLE_COMPAT_VERSION)
+#define long_double_symbol(lib, local, symbol) \
+ long_double_symbol_1 (lib, local, symbol, LONG_DOUBLE_COMPAT_VERSION)
+#if defined HAVE_ELF && defined SHARED && defined DO_VERSIONING
+# define ldbl_hidden_def(local, name) libc_hidden_ver (local, name)
+# define ldbl_strong_alias(name, aliasname) \
+ strong_alias (name, __GL_##name##_##aliasname) \
+ long_double_symbol (libc, __GL_##name##_##aliasname, aliasname);
+# define ldbl_weak_alias(name, aliasname) \
+ weak_alias (name, __GL_##name##_##aliasname) \
+ long_double_symbol (libc, __GL_##name##_##aliasname, aliasname);
+# define long_double_symbol_1(lib, local, symbol, version) \
+ versioned_symbol (lib, local, symbol, version)
+#elif defined HAVE_WEAK_SYMBOLS
+# define ldbl_hidden_def(local, name) libc_hidden_def (name)
+# define ldbl_strong_alias(name, aliasname) strong_alias (name, aliasname)
+# define ldbl_weak_alias(name, aliasname) weak_alias (name, aliasname)
+# ifndef __ASSEMBLER__
+/* Note that weak_alias cannot be used - it is defined to nothing
+ in most of the C files. */
+# define long_double_symbol_1(lib, local, symbol, version) \
+ _weak_alias (local, symbol)
+# else
+# define long_double_symbol_1(lib, local, symbol, version) \
+ weak_alias (local, symbol)
+# endif
+#else
+# define ldbl_hidden_def(local, name) libc_hidden_def (name)
+# define ldbl_strong_alias(name, aliasname) strong_alias (name, aliasname)
+# define ldbl_weak_alias(name, aliasname) strong_alias (name, aliasname)
+# define long_double_symbol_1(lib, local, symbol, version) \
+ strong_alias (local, symbol)
+#endif
+
+#ifndef __ASSEMBLER__
+# include <math.h>
+# include <math/math_private.h>
+
+/* Set temporarily to non-zero if long double should be considered
+ the same as double. */
+extern __thread int __no_long_double attribute_tls_model_ie attribute_hidden;
+# define __ldbl_is_dbl __builtin_expect (__no_long_double, 0)
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-acos.c b/sysdeps/ieee754/ldbl-opt/nldbl-acos.c
new file mode 100644
index 0000000000..813a17e9d6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-acos.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+acosl (double x)
+{
+ return acos (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-acosh.c b/sysdeps/ieee754/ldbl-opt/nldbl-acosh.c
new file mode 100644
index 0000000000..75508e30d7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-acosh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+acoshl (double x)
+{
+ return acosh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-asin.c b/sysdeps/ieee754/ldbl-opt/nldbl-asin.c
new file mode 100644
index 0000000000..5bbe6cd992
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-asin.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+asinl (double x)
+{
+ return asin (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-asinh.c b/sysdeps/ieee754/ldbl-opt/nldbl-asinh.c
new file mode 100644
index 0000000000..512f68519b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-asinh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+asinhl (double x)
+{
+ return asinh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-asprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-asprintf.c
new file mode 100644
index 0000000000..4be216d610
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-asprintf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+attribute_hidden
+int
+__asprintf (char **string_ptr, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vasprintf (string_ptr, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+extern __typeof (__asprintf) asprintf attribute_hidden;
+weak_alias (__asprintf, asprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-atan.c b/sysdeps/ieee754/ldbl-opt/nldbl-atan.c
new file mode 100644
index 0000000000..2849e48d03
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-atan.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+atanl (double x)
+{
+ return atan (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-atan2.c b/sysdeps/ieee754/ldbl-opt/nldbl-atan2.c
new file mode 100644
index 0000000000..d4e5a91702
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-atan2.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+atan2l (double x, double y)
+{
+ return atan2 (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-atanh.c b/sysdeps/ieee754/ldbl-opt/nldbl-atanh.c
new file mode 100644
index 0000000000..82b54ca6d4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-atanh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+atanhl (double x)
+{
+ return atanh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cabs.c b/sysdeps/ieee754/ldbl-opt/nldbl-cabs.c
new file mode 100644
index 0000000000..837822d2d6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cabs.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double
+attribute_hidden
+cabsl (double _Complex x)
+{
+ return cabs (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cacos.c b/sysdeps/ieee754/ldbl-opt/nldbl-cacos.c
new file mode 100644
index 0000000000..d935b511b4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cacos.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cacosl (double _Complex x)
+{
+ return cacos (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cacosh.c b/sysdeps/ieee754/ldbl-opt/nldbl-cacosh.c
new file mode 100644
index 0000000000..67f994b849
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cacosh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cacoshl (double _Complex x)
+{
+ return cacosh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-carg.c b/sysdeps/ieee754/ldbl-opt/nldbl-carg.c
new file mode 100644
index 0000000000..bfff141c11
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-carg.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double
+attribute_hidden
+cargl (double _Complex x)
+{
+ return carg (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-casin.c b/sysdeps/ieee754/ldbl-opt/nldbl-casin.c
new file mode 100644
index 0000000000..310aa0ac21
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-casin.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+casinl (double _Complex x)
+{
+ return casin (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-casinh.c b/sysdeps/ieee754/ldbl-opt/nldbl-casinh.c
new file mode 100644
index 0000000000..71b466ea22
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-casinh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+casinhl (double _Complex x)
+{
+ return casinh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-catan.c b/sysdeps/ieee754/ldbl-opt/nldbl-catan.c
new file mode 100644
index 0000000000..ea5f528ee5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-catan.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+catanl (double _Complex x)
+{
+ return catan (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-catanh.c b/sysdeps/ieee754/ldbl-opt/nldbl-catanh.c
new file mode 100644
index 0000000000..e6f58aa048
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-catanh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+catanhl (double _Complex x)
+{
+ return catanh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cbrt.c b/sysdeps/ieee754/ldbl-opt/nldbl-cbrt.c
new file mode 100644
index 0000000000..1c353a6e6b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cbrt.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+cbrtl (double x)
+{
+ return cbrt (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ccos.c b/sysdeps/ieee754/ldbl-opt/nldbl-ccos.c
new file mode 100644
index 0000000000..0e1c2e70f3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ccos.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+ccosl (double _Complex x)
+{
+ return ccos (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ccosh.c b/sysdeps/ieee754/ldbl-opt/nldbl-ccosh.c
new file mode 100644
index 0000000000..da2bf580af
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ccosh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+ccoshl (double _Complex x)
+{
+ return ccosh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ceil.c b/sysdeps/ieee754/ldbl-opt/nldbl-ceil.c
new file mode 100644
index 0000000000..a8fc3d548a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ceil.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+ceill (double x)
+{
+ return ceil (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cexp.c b/sysdeps/ieee754/ldbl-opt/nldbl-cexp.c
new file mode 100644
index 0000000000..f1837afc28
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cexp.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cexpl (double _Complex x)
+{
+ return cexp (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cimag.c b/sysdeps/ieee754/ldbl-opt/nldbl-cimag.c
new file mode 100644
index 0000000000..fffbdd58ec
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cimag.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double
+attribute_hidden
+cimagl (double _Complex x)
+{
+ return cimag (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-clog.c b/sysdeps/ieee754/ldbl-opt/nldbl-clog.c
new file mode 100644
index 0000000000..ecbae7ba91
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-clog.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+clogl (double _Complex x)
+{
+ return clog (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-clog10.c b/sysdeps/ieee754/ldbl-opt/nldbl-clog10.c
new file mode 100644
index 0000000000..193f40104a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-clog10.c
@@ -0,0 +1,11 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+clog10l (double _Complex x)
+{
+ return clog10 (x);
+}
+extern __typeof (clog10l) __clog10l attribute_hidden;
+weak_alias (clog10l, __clog10l)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
new file mode 100644
index 0000000000..f82c5f60bb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
@@ -0,0 +1,852 @@
+/* *printf* family compatibility routines for IEEE double as long double
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@cygnus.com>, 2006.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <libioP.h>
+#include <wchar.h>
+#include <printf.h>
+#include <monetary.h>
+#include <locale/localeinfo.h>
+#include <sys/syslog.h>
+#include <bits/libc-lock.h>
+
+#include "nldbl-compat.h"
+
+libc_hidden_proto (__nldbl_vfprintf)
+libc_hidden_proto (__nldbl_vsscanf)
+libc_hidden_proto (__nldbl_vsprintf)
+libc_hidden_proto (__nldbl_vfscanf)
+libc_hidden_proto (__nldbl_vfwscanf)
+libc_hidden_proto (__nldbl_vdprintf)
+libc_hidden_proto (__nldbl_vswscanf)
+libc_hidden_proto (__nldbl_vfwprintf)
+libc_hidden_proto (__nldbl_vswprintf)
+libc_hidden_proto (__nldbl_vsnprintf)
+libc_hidden_proto (__nldbl_vasprintf)
+libc_hidden_proto (__nldbl_obstack_vprintf)
+libc_hidden_proto (__nldbl___vfwprintf_chk)
+libc_hidden_proto (__nldbl___vsnprintf_chk)
+libc_hidden_proto (__nldbl___vfprintf_chk)
+libc_hidden_proto (__nldbl___vsyslog_chk)
+libc_hidden_proto (__nldbl___vsprintf_chk)
+libc_hidden_proto (__nldbl___vswprintf_chk)
+libc_hidden_proto (__nldbl___vstrfmon)
+libc_hidden_proto (__nldbl___vstrfmon_l)
+
+static void
+__nldbl_cleanup (void *arg)
+{
+ __no_long_double = 0;
+}
+
+#define set_no_long_double() \
+ __libc_cleanup_push (__nldbl_cleanup, NULL); __no_long_double = 1
+#define clear_no_long_double() \
+ __no_long_double = 0; __libc_cleanup_pop (0)
+
+/* Compatibility with IEEE double as long double.
+ IEEE quad long double is used by default for most programs, so
+ we don't need to split this into one file per function for the
+ sake of statically linked programs. */
+
+int
+attribute_compat_text_section
+__nldbl___asprintf (char **string_ptr, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vasprintf (string_ptr, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+weak_alias (__nldbl___asprintf, __nldbl_asprintf)
+
+int
+attribute_compat_text_section
+__nldbl_dprintf (int d, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vdprintf (d, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_fprintf (FILE *stream, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfprintf (stream, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwprintf (stream, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_printf (const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfprintf (stdout, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+strong_alias (__nldbl_printf, __nldbl__IO_printf)
+
+int
+attribute_compat_text_section
+__nldbl_sprintf (char *s, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vsprintf (s, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+strong_alias (__nldbl_sprintf, __nldbl__IO_sprintf)
+
+int
+attribute_compat_text_section
+__nldbl_vfprintf (FILE *s, const char *fmt, va_list ap)
+{
+ int done;
+ set_no_long_double ();
+ done = INTUSE(_IO_vfprintf) (s, fmt, ap);
+ clear_no_long_double ();
+ return done;
+}
+libc_hidden_def (__nldbl_vfprintf)
+strong_alias (__nldbl_vfprintf, __nldbl__IO_vfprintf)
+
+int
+attribute_compat_text_section
+__nldbl__IO_vsprintf (char *string, const char *fmt, va_list ap)
+{
+ int done;
+ __no_long_double = 1;
+ done = INTUSE(_IO_vsprintf) (string, fmt, ap);
+ __no_long_double = 0;
+ return done;
+}
+weak_alias (__nldbl__IO_vsprintf, __nldbl_vsprintf)
+libc_hidden_def (__nldbl_vsprintf)
+
+int
+attribute_compat_text_section
+__nldbl_obstack_vprintf (struct obstack *obstack, const char *fmt,
+ va_list ap)
+{
+ int done;
+ __no_long_double = 1;
+ done = _IO_obstack_vprintf (obstack, fmt, ap);
+ __no_long_double = 0;
+ return done;
+}
+libc_hidden_def (__nldbl_obstack_vprintf)
+
+int
+attribute_compat_text_section
+__nldbl_obstack_printf (struct obstack *obstack, const char *fmt, ...)
+{
+ int result;
+ va_list ap;
+ va_start (ap, fmt);
+ result = __nldbl_obstack_vprintf (obstack, fmt, ap);
+ va_end (ap);
+ return result;
+}
+
+int
+attribute_compat_text_section weak_function
+__nldbl_snprintf (char *s, size_t maxlen, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vsnprintf (s, maxlen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vswprintf (s, n, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vasprintf (char **result_ptr, const char *fmt, va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = _IO_vasprintf (result_ptr, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+libc_hidden_def (__nldbl_vasprintf)
+
+int
+attribute_compat_text_section
+__nldbl_vdprintf (int d, const char *fmt, va_list arg)
+{
+ int res;
+ set_no_long_double ();
+ res = _IO_vdprintf (d, fmt, arg);
+ clear_no_long_double ();
+ return res;
+}
+libc_hidden_def (__nldbl_vdprintf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
+{
+ int res;
+ set_no_long_double ();
+ res = _IO_vfwprintf (s, fmt, ap);
+ clear_no_long_double ();
+ return res;
+}
+libc_hidden_def (__nldbl_vfwprintf)
+
+int
+attribute_compat_text_section
+__nldbl_vprintf (const char *fmt, va_list ap)
+{
+ return __nldbl_vfprintf (stdout, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl_vsnprintf (char *string, size_t maxlen, const char *fmt,
+ va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = _IO_vsnprintf (string, maxlen, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+libc_hidden_def (__nldbl_vsnprintf)
+weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt,
+ va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = _IO_vswprintf (string, maxlen, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+libc_hidden_def (__nldbl_vswprintf)
+
+int
+attribute_compat_text_section
+__nldbl_vwprintf (const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vfwprintf (stdout, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl_wprintf (const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwprintf (stdout, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl__IO_vfscanf (FILE *s, const char *fmt, _IO_va_list ap,
+ int *errp)
+{
+ int res;
+ set_no_long_double ();
+ res = INTUSE(_IO_vfscanf) (s, fmt, ap, errp);
+ clear_no_long_double ();
+ return res;
+}
+
+int
+attribute_compat_text_section
+__nldbl___vfscanf (FILE *s, const char *fmt, va_list ap)
+{
+ int res;
+ set_no_long_double ();
+ res = INTUSE(_IO_vfscanf) (s, fmt, ap, NULL);
+ clear_no_long_double ();
+ return res;
+}
+weak_alias (__nldbl___vfscanf, __nldbl_vfscanf)
+libc_hidden_def (__nldbl_vfscanf)
+
+int
+attribute_compat_text_section
+__nldbl_sscanf (const char *s, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vsscanf (s, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+strong_alias (__nldbl_sscanf, __nldbl__IO_sscanf)
+
+int
+attribute_compat_text_section
+__nldbl___vsscanf (const char *string, const char *fmt, va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = _IO_vsscanf (string, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+weak_alias (__nldbl___vsscanf, __nldbl_vsscanf)
+libc_hidden_def (__nldbl_vsscanf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vscanf (const char *fmt, va_list ap)
+{
+ return __nldbl_vfscanf (stdin, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl_fscanf (FILE *stream, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfscanf (stream, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_scanf (const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfscanf (stdin, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
+{
+ int res;
+ set_no_long_double ();
+ res = _IO_vfwscanf (s, fmt, ap, NULL);
+ clear_no_long_double ();
+ return res;
+}
+libc_hidden_def (__nldbl_vfwscanf)
+
+int
+attribute_compat_text_section
+__nldbl_swscanf (const wchar_t *s, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vswscanf (s, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_vswscanf (const wchar_t *string, const wchar_t *fmt, va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = vswscanf (string, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+libc_hidden_def (__nldbl_vswscanf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vwscanf (const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vfwscanf (stdin, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl_fwscanf (FILE *stream, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwscanf (stream, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_wscanf (const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwscanf (stdin, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___fprintf_chk (FILE *stream, int flag, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfprintf_chk (stream, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfwprintf_chk (stream, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___printf_chk (int flag, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfprintf_chk (stdout, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___snprintf_chk (char *s, size_t maxlen, int flag, size_t slen,
+ const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vsnprintf_chk (s, maxlen, flag, slen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___sprintf_chk (char *s, int flag, size_t slen, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vsprintf_chk (s, flag, slen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___swprintf_chk (wchar_t *s, size_t n, int flag, size_t slen,
+ const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vswprintf_chk (s, n, flag, slen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
+{
+ int res;
+ set_no_long_double ();
+ res = __vfprintf_chk (s, flag, fmt, ap);
+ clear_no_long_double ();
+ return res;
+}
+libc_hidden_def (__nldbl___vfprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
+{
+ int res;
+ set_no_long_double ();
+ res = __vfwprintf_chk (s, flag, fmt, ap);
+ clear_no_long_double ();
+ return res;
+}
+libc_hidden_def (__nldbl___vfwprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vprintf_chk (int flag, const char *fmt, va_list ap)
+{
+ return __nldbl___vfprintf_chk (stdout, flag, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl___vsnprintf_chk (char *string, size_t maxlen, int flag, size_t slen,
+ const char *fmt, va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = __vsnprintf_chk (string, maxlen, flag, slen, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+libc_hidden_def (__nldbl___vsnprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vsprintf_chk (char *string, int flag, size_t slen, const char *fmt,
+ va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = __vsprintf_chk (string, flag, slen, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+libc_hidden_def (__nldbl___vsprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen,
+ const wchar_t *fmt, va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = __vswprintf_chk (string, maxlen, flag, slen, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+libc_hidden_def (__nldbl___vswprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vwprintf_chk (int flag, const wchar_t *fmt, va_list ap)
+{
+ return __nldbl___vfwprintf_chk (stdout, flag, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl___wprintf_chk (int flag, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfwprintf_chk (stdout, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+extern __typeof (printf_size) __printf_size;
+
+int
+attribute_compat_text_section
+__nldbl_printf_size (FILE *fp, const struct printf_info *info,
+ const void *const *args)
+{
+ struct printf_info info_no_ldbl = *info;
+
+ info_no_ldbl.is_long_double = 0;
+ return __printf_size (fp, &info_no_ldbl, args);
+}
+
+extern __typeof (__printf_fp) ___printf_fp;
+
+int
+attribute_compat_text_section
+__nldbl___printf_fp (FILE *fp, const struct printf_info *info,
+ const void *const *args)
+{
+ struct printf_info info_no_ldbl = *info;
+
+ info_no_ldbl.is_long_double = 0;
+ return ___printf_fp (fp, &info_no_ldbl, args);
+}
+
+ssize_t
+attribute_compat_text_section
+__nldbl_strfmon (char *s, size_t maxsize, const char *format, ...)
+{
+ va_list ap;
+ ssize_t res;
+
+ va_start (ap, format);
+ res = __nldbl___vstrfmon (s, maxsize, format, ap);
+ va_end (ap);
+ return res;
+}
+
+ssize_t
+attribute_compat_text_section
+__nldbl___strfmon_l (char *s, size_t maxsize, __locale_t loc,
+ const char *format, ...)
+{
+ va_list ap;
+ ssize_t res;
+
+ va_start (ap, format);
+ res = __nldbl___vstrfmon_l (s, maxsize, loc, format, ap);
+ va_end (ap);
+ return res;
+}
+weak_alias (__nldbl___strfmon_l, __nldbl_strfmon_l)
+
+ssize_t
+attribute_compat_text_section
+__nldbl___vstrfmon (char *s, size_t maxsize, const char *format, va_list ap)
+{
+ ssize_t res;
+ __no_long_double = 1;
+ res = __vstrfmon_l (s, maxsize, _NL_CURRENT_LOCALE, format, ap);
+ __no_long_double = 0;
+ va_end (ap);
+ return res;
+}
+libc_hidden_def (__nldbl___vstrfmon)
+
+ssize_t
+attribute_compat_text_section
+__nldbl___vstrfmon_l (char *s, size_t maxsize, __locale_t loc,
+ const char *format, va_list ap)
+{
+ ssize_t res;
+ __no_long_double = 1;
+ res = __vstrfmon_l (s, maxsize, loc, format, ap);
+ __no_long_double = 0;
+ va_end (ap);
+ return res;
+}
+libc_hidden_def (__nldbl___vstrfmon_l)
+
+void
+attribute_compat_text_section
+__nldbl_syslog (int pri, const char *fmt, ...)
+{
+ va_list ap;
+ va_start (ap, fmt);
+ __nldbl___vsyslog_chk (pri, -1, fmt, ap);
+ va_end (ap);
+}
+
+void
+attribute_compat_text_section
+__nldbl___syslog_chk (int pri, int flag, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start (ap, fmt);
+ __nldbl___vsyslog_chk (pri, flag, fmt, ap);
+ va_end(ap);
+}
+
+void
+attribute_compat_text_section
+__nldbl___vsyslog_chk (int pri, int flag, const char *fmt, va_list ap)
+{
+ set_no_long_double ();
+ __vsyslog_chk (pri, flag, fmt, ap);
+ clear_no_long_double ();
+}
+libc_hidden_def (__nldbl___vsyslog_chk)
+
+void
+attribute_compat_text_section
+__nldbl_vsyslog (int pri, const char *fmt, va_list ap)
+{
+ __nldbl___vsyslog_chk (pri, -1, fmt, ap);
+}
+
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __nldbl__IO_printf, _IO_printf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_sprintf, _IO_sprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_vfprintf, _IO_vfprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_vsprintf, _IO_vsprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_dprintf, dprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_fprintf, fprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_printf, printf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_sprintf, sprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vfprintf, vfprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vprintf, vprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_fprintf, _IO_fprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl___vsnprintf, __vsnprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_asprintf, asprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_obstack_printf, obstack_printf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_obstack_vprintf, obstack_vprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_snprintf, snprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vasprintf, vasprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vdprintf, vdprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vsnprintf, vsnprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vsprintf, vsprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_sscanf, _IO_sscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_vfscanf, _IO_vfscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl___vfscanf, __vfscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl___vsscanf, __vsscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_fscanf, fscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_scanf, scanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_sscanf, sscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vfscanf, vfscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vscanf, vscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vsscanf, vsscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl___printf_fp, __printf_fp, GLIBC_2_0);
+compat_symbol (libc, __nldbl_strfmon, strfmon, GLIBC_2_0);
+compat_symbol (libc, __nldbl_syslog, syslog, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vsyslog, vsyslog, GLIBC_2_0);
+#endif
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_1)
+compat_symbol (libc, __nldbl___asprintf, __asprintf, GLIBC_2_1);
+compat_symbol (libc, __nldbl_printf_size, printf_size, GLIBC_2_1);
+compat_symbol (libc, __nldbl___strfmon_l, __strfmon_l, GLIBC_2_1);
+#endif
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_2)
+compat_symbol (libc, __nldbl_swprintf, swprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vwprintf, vwprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_wprintf, wprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_fwprintf, fwprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vfwprintf, vfwprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vswprintf, vswprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_fwscanf, fwscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_swscanf, swscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vfwscanf, vfwscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vswscanf, vswscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vwscanf, vwscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_wscanf, wscanf, GLIBC_2_2);
+#endif
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3)
+compat_symbol (libc, __nldbl_strfmon_l, strfmon_l, GLIBC_2_3);
+#endif
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3_4)
+compat_symbol (libc, __nldbl___sprintf_chk, __sprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___vsprintf_chk, __vsprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___snprintf_chk, __snprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___vsnprintf_chk, __vsnprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___printf_chk, __printf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___fprintf_chk, __fprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___vprintf_chk, __vprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___vfprintf_chk, __vfprintf_chk, GLIBC_2_3_4);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
new file mode 100644
index 0000000000..c0461000f0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
@@ -0,0 +1,87 @@
+/* Prototypes for compatibility double == long double entry points.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@cygnus.com>, 2006.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef __NLDBL_COMPAT_H
+#define __NLDBL_COMPAT_H 1
+
+/* Avoid long double prototypes. */
+#define __NO_LONG_DOUBLE_MATH 1
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <printf.h>
+#include <wchar.h>
+#include <math.h>
+#include <monetary.h>
+#include <sys/syslog.h>
+
+
+/* Declare the __nldbl_NAME function the wrappers call that's in libc.so. */
+#define NLDBL_DECL(name) extern __typeof (name) __nldbl_##name
+
+NLDBL_DECL (_IO_vfscanf);
+NLDBL_DECL (vfscanf);
+NLDBL_DECL (vfwscanf);
+NLDBL_DECL (obstack_vprintf);
+NLDBL_DECL (vasprintf);
+NLDBL_DECL (dprintf);
+NLDBL_DECL (vdprintf);
+NLDBL_DECL (fprintf);
+NLDBL_DECL (vfprintf);
+NLDBL_DECL (vfwprintf);
+NLDBL_DECL (vsnprintf);
+NLDBL_DECL (vsprintf);
+NLDBL_DECL (vsscanf);
+NLDBL_DECL (vswprintf);
+NLDBL_DECL (vswscanf);
+NLDBL_DECL (__asprintf);
+NLDBL_DECL (asprintf);
+NLDBL_DECL (__printf_fp);
+NLDBL_DECL (printf_size);
+NLDBL_DECL (syslog);
+NLDBL_DECL (vsyslog);
+NLDBL_DECL (qecvt);
+NLDBL_DECL (qfcvt);
+NLDBL_DECL (qgcvt);
+NLDBL_DECL (__vstrfmon_l);
+
+/* This one does not exist in the normal interface, only
+ __nldbl___vstrfmon really exists. */
+extern ssize_t __nldbl___vstrfmon (char *, size_t, const char *, va_list)
+ __THROW;
+
+/* These don't use __typeof because they were not declared by the headers,
+ since we don't compile with _FORTIFY_SOURCE. */
+extern int __nldbl___vfprintf_chk (FILE *__restrict, int,
+ const char *__restrict, _G_va_list);
+extern int __nldbl___vfwprintf_chk (FILE *__restrict, int,
+ const wchar_t *__restrict, __gnuc_va_list);
+extern int __nldbl___vsprintf_chk (char *__restrict, int, size_t,
+ const char *__restrict, _G_va_list) __THROW;
+extern int __nldbl___vsnprintf_chk (char *__restrict, size_t, int, size_t,
+ const char *__restrict, _G_va_list)
+ __THROW;
+extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t,
+ const wchar_t *__restrict, __gnuc_va_list)
+ __THROW;
+extern void __nldbl___vsyslog_chk (int, int, const char *, va_list);
+
+
+#endif /* __NLDBL_COMPAT_H */
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-conj.c b/sysdeps/ieee754/ldbl-opt/nldbl-conj.c
new file mode 100644
index 0000000000..8927ea9968
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-conj.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+conjl (double _Complex x)
+{
+ return conj (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-copysign.c b/sysdeps/ieee754/ldbl-opt/nldbl-copysign.c
new file mode 100644
index 0000000000..ef23badecc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-copysign.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+copysignl (double x, double y)
+{
+ return copysign (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cos.c b/sysdeps/ieee754/ldbl-opt/nldbl-cos.c
new file mode 100644
index 0000000000..08738af048
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cos.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+cosl (double x)
+{
+ return cos (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cosh.c b/sysdeps/ieee754/ldbl-opt/nldbl-cosh.c
new file mode 100644
index 0000000000..0ab834ffd9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cosh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+coshl (double x)
+{
+ return cosh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cpow.c b/sysdeps/ieee754/ldbl-opt/nldbl-cpow.c
new file mode 100644
index 0000000000..709e7d73b1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cpow.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cpowl (double _Complex x, double _Complex y)
+{
+ return cpow (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cproj.c b/sysdeps/ieee754/ldbl-opt/nldbl-cproj.c
new file mode 100644
index 0000000000..6f88b88bf2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cproj.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cprojl (double _Complex x)
+{
+ return cproj (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-creal.c b/sysdeps/ieee754/ldbl-opt/nldbl-creal.c
new file mode 100644
index 0000000000..b02ce6e5e4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-creal.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double
+attribute_hidden
+creall (double _Complex x)
+{
+ return creal (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-csin.c b/sysdeps/ieee754/ldbl-opt/nldbl-csin.c
new file mode 100644
index 0000000000..b2e2c9c8ef
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-csin.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+csinl (double _Complex x)
+{
+ return csin (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-csinh.c b/sysdeps/ieee754/ldbl-opt/nldbl-csinh.c
new file mode 100644
index 0000000000..2bcba920e3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-csinh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+csinhl (double _Complex x)
+{
+ return csinh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-csqrt.c b/sysdeps/ieee754/ldbl-opt/nldbl-csqrt.c
new file mode 100644
index 0000000000..ae00a29885
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-csqrt.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+csqrtl (double _Complex x)
+{
+ return csqrt (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ctan.c b/sysdeps/ieee754/ldbl-opt/nldbl-ctan.c
new file mode 100644
index 0000000000..422c5cce94
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ctan.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+ctanl (double _Complex x)
+{
+ return ctan (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ctanh.c b/sysdeps/ieee754/ldbl-opt/nldbl-ctanh.c
new file mode 100644
index 0000000000..f3842ed26f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ctanh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+ctanhl (double _Complex x)
+{
+ return ctanh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c
new file mode 100644
index 0000000000..6e26db2a24
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+attribute_hidden
+int
+dprintf (int d, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vdprintf (d, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-drem.c b/sysdeps/ieee754/ldbl-opt/nldbl-drem.c
new file mode 100644
index 0000000000..1e08ce1d28
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-drem.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+dreml (double x, double y)
+{
+ return drem (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-erf.c b/sysdeps/ieee754/ldbl-opt/nldbl-erf.c
new file mode 100644
index 0000000000..0032c1febc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-erf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+erfl (double x)
+{
+ return erf (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-erfc.c b/sysdeps/ieee754/ldbl-opt/nldbl-erfc.c
new file mode 100644
index 0000000000..21d09680aa
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-erfc.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+erfcl (double x)
+{
+ return erfc (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-exp.c b/sysdeps/ieee754/ldbl-opt/nldbl-exp.c
new file mode 100644
index 0000000000..ad2c89b6d5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-exp.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+expl (double x)
+{
+ return exp (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-exp10.c b/sysdeps/ieee754/ldbl-opt/nldbl-exp10.c
new file mode 100644
index 0000000000..2d0ead686b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-exp10.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+exp10l (double x)
+{
+ return exp10 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-exp2.c b/sysdeps/ieee754/ldbl-opt/nldbl-exp2.c
new file mode 100644
index 0000000000..d5fce3970d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-exp2.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+exp2l (double x)
+{
+ return exp2 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-expm1.c b/sysdeps/ieee754/ldbl-opt/nldbl-expm1.c
new file mode 100644
index 0000000000..be5c6e51c4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-expm1.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+expm1l (double x)
+{
+ return expm1 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fabs.c b/sysdeps/ieee754/ldbl-opt/nldbl-fabs.c
new file mode 100644
index 0000000000..10729a6ec0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fabs.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fabsl (double x)
+{
+ return fabs (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fdim.c b/sysdeps/ieee754/ldbl-opt/nldbl-fdim.c
new file mode 100644
index 0000000000..72896b63ed
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fdim.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fdiml (double x, double y)
+{
+ return fdim (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-finite.c b/sysdeps/ieee754/ldbl-opt/nldbl-finite.c
new file mode 100644
index 0000000000..000adfb8aa
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-finite.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__finitel (double x)
+{
+ return __finite (x);
+}
+extern __typeof (__finitel) finitel attribute_hidden;
+weak_alias (__finitel, finitel)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-floor.c b/sysdeps/ieee754/ldbl-opt/nldbl-floor.c
new file mode 100644
index 0000000000..c7e9f834b6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-floor.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+floorl (double x)
+{
+ return floor (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fma.c b/sysdeps/ieee754/ldbl-opt/nldbl-fma.c
new file mode 100644
index 0000000000..9474483673
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fma.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fmal (double x, double y, double z)
+{
+ return fma (x, y, z);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fmax.c b/sysdeps/ieee754/ldbl-opt/nldbl-fmax.c
new file mode 100644
index 0000000000..f5a84776ed
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fmax.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fmaxl (double x, double y)
+{
+ return fmax (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fmin.c b/sysdeps/ieee754/ldbl-opt/nldbl-fmin.c
new file mode 100644
index 0000000000..a353cf9484
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fmin.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fminl (double x, double y)
+{
+ return fmin (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fmod.c b/sysdeps/ieee754/ldbl-opt/nldbl-fmod.c
new file mode 100644
index 0000000000..aa692b9f36
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fmod.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fmodl (double x, double y)
+{
+ return fmod (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-fprintf.c
new file mode 100644
index 0000000000..9df4c4bc34
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fprintf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+attribute_hidden
+int
+fprintf (FILE *stream, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfprintf (stream, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+extern __typeof (fprintf) _IO_fprintf attribute_hidden;
+weak_alias (fprintf, _IO_fprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-fprintf_chk.c
new file mode 100644
index 0000000000..43a7618183
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fprintf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__fprintf_chk (FILE *stream, int flag, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfprintf_chk (stream, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-frexp.c b/sysdeps/ieee754/ldbl-opt/nldbl-frexp.c
new file mode 100644
index 0000000000..0ec97e10e3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-frexp.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+frexpl (double x, int *exponent)
+{
+ return frexp (x, exponent);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c
new file mode 100644
index 0000000000..1b768e306f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+fscanf (FILE *stream, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl__IO_vfscanf (stream, fmt, arg, NULL);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf.c
new file mode 100644
index 0000000000..18362af013
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+fwprintf (FILE *stream, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwprintf (stream, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf_chk.c
new file mode 100644
index 0000000000..09731cf29d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfwprintf_chk (stream, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c
new file mode 100644
index 0000000000..27fc1a7271
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+fwscanf (FILE *stream, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwscanf (stream, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-gamma.c b/sysdeps/ieee754/ldbl-opt/nldbl-gamma.c
new file mode 100644
index 0000000000..10dc640b92
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-gamma.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+gammal (double x)
+{
+ return gamma (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-hypot.c b/sysdeps/ieee754/ldbl-opt/nldbl-hypot.c
new file mode 100644
index 0000000000..2105f3eba8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-hypot.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+hypotl (double x, double y)
+{
+ return hypot (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ilogb.c b/sysdeps/ieee754/ldbl-opt/nldbl-ilogb.c
new file mode 100644
index 0000000000..e840b2a447
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ilogb.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+ilogbl (double x)
+{
+ return ilogb (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c
new file mode 100644
index 0000000000..05581c0354
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+_IO_vfscanf (FILE *s, const char *fmt, _IO_va_list ap, int *errp)
+{
+ return __nldbl__IO_vfscanf (s, fmt, ap, errp);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-isinf.c b/sysdeps/ieee754/ldbl-opt/nldbl-isinf.c
new file mode 100644
index 0000000000..340d2418c0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-isinf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isinfl (double x)
+{
+ return __isinf (x);
+}
+extern __typeof (__isinfl) isinfl attribute_hidden;
+weak_alias (__isinfl, isinfl)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-isnan.c b/sysdeps/ieee754/ldbl-opt/nldbl-isnan.c
new file mode 100644
index 0000000000..e5f0f1b394
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-isnan.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isnanl (double x)
+{
+ return __isnan (x);
+}
+extern __typeof (__isnanl) isnanl attribute_hidden;
+weak_alias (__isnanl, isnanl)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-j0.c b/sysdeps/ieee754/ldbl-opt/nldbl-j0.c
new file mode 100644
index 0000000000..9d59f0a015
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-j0.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+j0l (double x)
+{
+ return j0 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-j1.c b/sysdeps/ieee754/ldbl-opt/nldbl-j1.c
new file mode 100644
index 0000000000..dba7366861
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-j1.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+j1l (double x)
+{
+ return j1 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-jn.c b/sysdeps/ieee754/ldbl-opt/nldbl-jn.c
new file mode 100644
index 0000000000..3f19bbb1a8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-jn.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+jnl (int n, double x)
+{
+ return jn (n, x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ldexp.c b/sysdeps/ieee754/ldbl-opt/nldbl-ldexp.c
new file mode 100644
index 0000000000..360f8f0f6b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ldexp.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+ldexpl (double x, int exponent)
+{
+ return ldexp (x, exponent);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-lgamma.c b/sysdeps/ieee754/ldbl-opt/nldbl-lgamma.c
new file mode 100644
index 0000000000..0055212628
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-lgamma.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+lgammal (double x)
+{
+ return lgamma (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-lgamma_r.c b/sysdeps/ieee754/ldbl-opt/nldbl-lgamma_r.c
new file mode 100644
index 0000000000..e1ab9a1d0a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-lgamma_r.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+lgammal_r (double x, int *signgamp)
+{
+ return lgamma_r (x, signgamp);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-llrint.c b/sysdeps/ieee754/ldbl-opt/nldbl-llrint.c
new file mode 100644
index 0000000000..6dfce89d0d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-llrint.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+long long int
+attribute_hidden
+llrintl (double x)
+{
+ return llrint (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-llround.c b/sysdeps/ieee754/ldbl-opt/nldbl-llround.c
new file mode 100644
index 0000000000..0157a079f4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-llround.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+long long int
+attribute_hidden
+llroundl (double x)
+{
+ return llround (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-log.c b/sysdeps/ieee754/ldbl-opt/nldbl-log.c
new file mode 100644
index 0000000000..a5a1ae7cd7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-log.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+logl (double x)
+{
+ return log (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-log10.c b/sysdeps/ieee754/ldbl-opt/nldbl-log10.c
new file mode 100644
index 0000000000..1477866dc6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-log10.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+log10l (double x)
+{
+ return log10 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-log1p.c b/sysdeps/ieee754/ldbl-opt/nldbl-log1p.c
new file mode 100644
index 0000000000..455b25a9f4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-log1p.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+log1pl (double x)
+{
+ return log1p (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-log2.c b/sysdeps/ieee754/ldbl-opt/nldbl-log2.c
new file mode 100644
index 0000000000..8c1ae344e5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-log2.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+log2l (double x)
+{
+ return log2 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-logb.c b/sysdeps/ieee754/ldbl-opt/nldbl-logb.c
new file mode 100644
index 0000000000..d9ce8de075
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-logb.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+logbl (double x)
+{
+ return logb (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-lrint.c b/sysdeps/ieee754/ldbl-opt/nldbl-lrint.c
new file mode 100644
index 0000000000..0acd3d4ae6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-lrint.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+long int
+attribute_hidden
+lrintl (double x)
+{
+ return lrint (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-lround.c b/sysdeps/ieee754/ldbl-opt/nldbl-lround.c
new file mode 100644
index 0000000000..aadb111f88
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-lround.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+long int
+attribute_hidden
+lroundl (double x)
+{
+ return lround (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-modf.c b/sysdeps/ieee754/ldbl-opt/nldbl-modf.c
new file mode 100644
index 0000000000..bcbe6bb435
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-modf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+modfl (double x, double *iptr)
+{
+ return modf (x, iptr);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nan.c b/sysdeps/ieee754/ldbl-opt/nldbl-nan.c
new file mode 100644
index 0000000000..8db157a0ea
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nan.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+nanl (const char *tag)
+{
+ return nan (tag);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nearbyint.c b/sysdeps/ieee754/ldbl-opt/nldbl-nearbyint.c
new file mode 100644
index 0000000000..fd4a24684d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nearbyint.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+nearbyintl (double x)
+{
+ return nearbyint (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nextafter.c b/sysdeps/ieee754/ldbl-opt/nldbl-nextafter.c
new file mode 100644
index 0000000000..b0bae43f49
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nextafter.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+nextafterl (double x, double y)
+{
+ return nextafter (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nexttoward.c b/sysdeps/ieee754/ldbl-opt/nldbl-nexttoward.c
new file mode 100644
index 0000000000..acbd01a0cf
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nexttoward.c
@@ -0,0 +1,14 @@
+#define nexttoward nexttoward_XXX
+#define nexttowardl nexttowardl_XXX
+#include "nldbl-compat.h"
+#undef nexttoward
+#undef nexttowardl
+
+double
+attribute_hidden
+nexttoward (double x, double y)
+{
+ return nextafter (x, y);
+}
+extern __typeof (nexttoward) nexttowardl attribute_hidden;
+strong_alias (nexttoward, nexttowardl)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nexttowardf.c b/sysdeps/ieee754/ldbl-opt/nldbl-nexttowardf.c
new file mode 100644
index 0000000000..350b08d39e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nexttowardf.c
@@ -0,0 +1,12 @@
+#define nexttowardf nexttowardf_XXX
+#include "nldbl-compat.h"
+#undef nexttowardf
+
+extern float __nldbl_nexttowardf (float x, double y);
+
+float
+attribute_hidden
+nexttowardf (float x, double y)
+{
+ return __nldbl_nexttowardf (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf.c b/sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf.c
new file mode 100644
index 0000000000..4abff2dc0d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf.c
@@ -0,0 +1,13 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+obstack_printf (struct obstack *obstack, const char *fmt, ...)
+{
+ int result;
+ va_list ap;
+ va_start (ap, fmt);
+ result = __nldbl_obstack_vprintf (obstack, fmt, ap);
+ va_end (ap);
+ return result;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf.c
new file mode 100644
index 0000000000..228a50726b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+obstack_vprintf (struct obstack *obstack, const char *fmt, va_list ap)
+{
+ return __nldbl_obstack_vprintf (obstack, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-pow.c b/sysdeps/ieee754/ldbl-opt/nldbl-pow.c
new file mode 100644
index 0000000000..a5cc446555
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-pow.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+powl (double x, double y)
+{
+ return pow (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-pow10.c b/sysdeps/ieee754/ldbl-opt/nldbl-pow10.c
new file mode 100644
index 0000000000..20ebf8d1bb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-pow10.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+pow10l (double x)
+{
+ return pow10 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-printf.c b/sysdeps/ieee754/ldbl-opt/nldbl-printf.c
new file mode 100644
index 0000000000..e4b0fbae0c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-printf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+printf (const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfprintf (stdout, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+extern __typeof (printf) _IO_printf attribute_hidden;
+strong_alias (printf, _IO_printf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-printf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-printf_chk.c
new file mode 100644
index 0000000000..926db412f9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-printf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__printf_chk (int flag, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfprintf_chk (stdout, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-printf_fp.c b/sysdeps/ieee754/ldbl-opt/nldbl-printf_fp.c
new file mode 100644
index 0000000000..057dfe0b8a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-printf_fp.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__printf_fp (FILE *fp, const struct printf_info *info,
+ const void *const *args)
+{
+ return __nldbl___printf_fp (fp, info, args);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-printf_size.c b/sysdeps/ieee754/ldbl-opt/nldbl-printf_size.c
new file mode 100644
index 0000000000..d8b1fc9995
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-printf_size.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+printf_size (FILE *__restrict fp, const struct printf_info *info,
+ const void *const *__restrict args)
+{
+ return __nldbl_printf_size (fp, info, args);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qecvt.c b/sysdeps/ieee754/ldbl-opt/nldbl-qecvt.c
new file mode 100644
index 0000000000..9f0b0a66a9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qecvt.c
@@ -0,0 +1,10 @@
+#define qecvt qecvt_XXX
+#include "nldbl-compat.h"
+#undef qecvt
+
+attribute_hidden
+char *
+qecvt (double val, int ndigit, int *__restrict decpt, int *__restrict sign)
+{
+ return ecvt (val, ndigit, decpt, sign);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qecvt_r.c b/sysdeps/ieee754/ldbl-opt/nldbl-qecvt_r.c
new file mode 100644
index 0000000000..06f99146cc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qecvt_r.c
@@ -0,0 +1,11 @@
+#define qecvt_r qecvt_r_XXX
+#include "nldbl-compat.h"
+#undef qecvt_r
+
+int
+attribute_hidden
+qecvt_r (double val, int ndigit, int *__restrict decpt, int *__restrict sign,
+ char *__restrict buf, size_t len)
+{
+ return ecvt_r (val, ndigit, decpt, sign, buf, len);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt.c b/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt.c
new file mode 100644
index 0000000000..37fa7f0467
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt.c
@@ -0,0 +1,10 @@
+#define qfcvt qfcvt_XXX
+#include "nldbl-compat.h"
+#undef qfcvt
+
+attribute_hidden
+char *
+qfcvt (double val, int ndigit, int *__restrict decpt, int *__restrict sign)
+{
+ return fcvt (val, ndigit, decpt, sign);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt_r.c b/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt_r.c
new file mode 100644
index 0000000000..03224fefa9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt_r.c
@@ -0,0 +1,11 @@
+#define qfcvt_r qfcvt_r_XXX
+#include "nldbl-compat.h"
+#undef qfcvt_r
+
+int
+attribute_hidden
+qfcvt_r (double val, int ndigit, int *__restrict decpt, int *__restrict sign,
+ char *__restrict buf, size_t len)
+{
+ return fcvt_r (val, ndigit, decpt, sign, buf, len);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qgcvt.c b/sysdeps/ieee754/ldbl-opt/nldbl-qgcvt.c
new file mode 100644
index 0000000000..b935d0962e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qgcvt.c
@@ -0,0 +1,10 @@
+#define qgcvt qgcvt_XXX
+#include "nldbl-compat.h"
+#undef qgcvt
+
+attribute_hidden
+char *
+qgcvt (double val, int ndigit, char *buf)
+{
+ return gcvt (val, ndigit, buf);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-remainder.c b/sysdeps/ieee754/ldbl-opt/nldbl-remainder.c
new file mode 100644
index 0000000000..a8d5bafb5f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-remainder.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+remainderl (double x, double y)
+{
+ return remainder (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-remquo.c b/sysdeps/ieee754/ldbl-opt/nldbl-remquo.c
new file mode 100644
index 0000000000..592dadae8d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-remquo.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+remquol (double x, double y, int *quo)
+{
+ return remquo (x, y, quo);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-rint.c b/sysdeps/ieee754/ldbl-opt/nldbl-rint.c
new file mode 100644
index 0000000000..00f942f1a7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-rint.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+rintl (double x)
+{
+ return rint (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-round.c b/sysdeps/ieee754/ldbl-opt/nldbl-round.c
new file mode 100644
index 0000000000..be9bd5112e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-round.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+roundl (double x)
+{
+ return round (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-scalb.c b/sysdeps/ieee754/ldbl-opt/nldbl-scalb.c
new file mode 100644
index 0000000000..00d3e2e714
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-scalb.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+scalbl (double x, double n)
+{
+ return scalb (x, n);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-scalbln.c b/sysdeps/ieee754/ldbl-opt/nldbl-scalbln.c
new file mode 100644
index 0000000000..b5bd501250
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-scalbln.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+scalblnl (double x, long int n)
+{
+ return scalbln (x, n);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-scalbn.c b/sysdeps/ieee754/ldbl-opt/nldbl-scalbn.c
new file mode 100644
index 0000000000..b1914ebf49
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-scalbn.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+scalbnl (double x, int n)
+{
+ return scalbn (x, n);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-scanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-scanf.c
new file mode 100644
index 0000000000..bbab371cbe
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-scanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+scanf (const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl__IO_vfscanf (stdin, fmt, arg, NULL);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-signbit.c b/sysdeps/ieee754/ldbl-opt/nldbl-signbit.c
new file mode 100644
index 0000000000..b62d0ed7fe
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-signbit.c
@@ -0,0 +1,10 @@
+#define __signbitl __signbitl_XXX
+#include "nldbl-compat.h"
+#undef __signbitl
+
+int
+attribute_hidden
+__signbitl (double x)
+{
+ return __signbit (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-significand.c b/sysdeps/ieee754/ldbl-opt/nldbl-significand.c
new file mode 100644
index 0000000000..624381dde7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-significand.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+significandl (double x)
+{
+ return significand (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sin.c b/sysdeps/ieee754/ldbl-opt/nldbl-sin.c
new file mode 100644
index 0000000000..0e76e05e6b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sin.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+sinl (double x)
+{
+ return sin (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sincos.c b/sysdeps/ieee754/ldbl-opt/nldbl-sincos.c
new file mode 100644
index 0000000000..9f2ab2b9fc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sincos.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+void
+attribute_hidden
+sincosl (double x, double *sinx, double *cosx)
+{
+ sincos (x, sinx, cosx);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sinh.c b/sysdeps/ieee754/ldbl-opt/nldbl-sinh.c
new file mode 100644
index 0000000000..99ea62e8dc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sinh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+sinhl (double x)
+{
+ return sinh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-snprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-snprintf.c
new file mode 100644
index 0000000000..ef6fb96a2c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-snprintf.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+snprintf (char *s, size_t maxlen, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vsnprintf (s, maxlen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-snprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-snprintf_chk.c
new file mode 100644
index 0000000000..944d3de9db
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-snprintf_chk.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__snprintf_chk (char *s, size_t maxlen, int flag, size_t slen,
+ const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vsnprintf_chk (s, maxlen, flag, slen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-sprintf.c
new file mode 100644
index 0000000000..5d37a7e7f0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sprintf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+sprintf (char *s, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vsprintf (s, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+extern __typeof (sprintf) _IO_sprintf attribute_hidden;
+strong_alias (sprintf, _IO_sprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-sprintf_chk.c
new file mode 100644
index 0000000000..349b7c5c22
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sprintf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__sprintf_chk (char *s, int flag, size_t slen, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vsprintf_chk (s, flag, slen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sqrt.c b/sysdeps/ieee754/ldbl-opt/nldbl-sqrt.c
new file mode 100644
index 0000000000..4ae65665de
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sqrt.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+sqrtl (double x)
+{
+ return sqrt (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c
new file mode 100644
index 0000000000..a771d49996
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+sscanf (const char *s, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vsscanf (s, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+extern __typeof (sscanf) _IO_sscanf attribute_hidden;
+strong_alias (sscanf, _IO_sscanf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strfmon.c b/sysdeps/ieee754/ldbl-opt/nldbl-strfmon.c
new file mode 100644
index 0000000000..38f4071278
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strfmon.c
@@ -0,0 +1,14 @@
+#include "nldbl-compat.h"
+
+ssize_t
+attribute_hidden
+strfmon (char *s, size_t maxsize, const char *format, ...)
+{
+ va_list ap;
+ ssize_t res;
+
+ va_start (ap, format);
+ res = __nldbl___vstrfmon (s, maxsize, format, ap);
+ va_end (ap);
+ return res;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c b/sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c
new file mode 100644
index 0000000000..0db0e8c42f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+ssize_t
+attribute_hidden
+__strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
+{
+ va_list ap;
+ ssize_t res;
+
+ va_start (ap, format);
+ res = __nldbl___vstrfmon_l (s, maxsize, loc, format, ap);
+ va_end (ap);
+ return res;
+}
+extern __typeof (__strfmon_l) strfmon_l attribute_hidden;
+weak_alias (__strfmon_l, strfmon_l)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strtold.c b/sysdeps/ieee754/ldbl-opt/nldbl-strtold.c
new file mode 100644
index 0000000000..99b907947b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strtold.c
@@ -0,0 +1,10 @@
+#define strtold strtold_XXX
+#include "nldbl-compat.h"
+#undef strtold
+
+double
+attribute_hidden
+strtold (const char *nptr, char **endptr)
+{
+ return strtod (nptr, endptr);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c b/sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c
new file mode 100644
index 0000000000..422746379c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c
@@ -0,0 +1,20 @@
+#define strtold_l strtold_l_XXX
+#define __strtold_l __strtold_l_XXX
+#define __strtod_l __strtod_l_XXX
+#include "nldbl-compat.h"
+#undef strtold_l
+#undef __strtold_l
+#undef __strtod_l
+
+extern double
+__strtod_l (__const char *__restrict __nptr, char **__restrict __endptr,
+ __locale_t __loc);
+
+double
+attribute_hidden
+__strtold_l (const char *nptr, char **endptr, __locale_t loc)
+{
+ return __strtod_l (nptr, endptr, loc);
+}
+extern __typeof (__strtold_l) strtold_l attribute_hidden;
+weak_alias (__strtold_l, strtold_l)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strtoldint.c b/sysdeps/ieee754/ldbl-opt/nldbl-strtoldint.c
new file mode 100644
index 0000000000..0bafabc6e4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strtoldint.c
@@ -0,0 +1,10 @@
+#define __strtold_internal __strtold_internal_XXX
+#include "nldbl-compat.h"
+#undef __strtold_internal
+
+double
+attribute_hidden
+__strtold_internal (const char *nptr, char **endptr, int group)
+{
+ return __strtod_internal (nptr, endptr, group);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-swprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-swprintf.c
new file mode 100644
index 0000000000..7f4f7b04d3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-swprintf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vswprintf (s, n, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-swprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-swprintf_chk.c
new file mode 100644
index 0000000000..0373f6ebc2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-swprintf_chk.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__swprintf_chk (wchar_t *s, size_t n, int flag, size_t slen,
+ const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vswprintf_chk (s, n, flag, slen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c
new file mode 100644
index 0000000000..dd058f47ab
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+swscanf (const wchar_t *s, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vswscanf (s, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-syslog.c b/sysdeps/ieee754/ldbl-opt/nldbl-syslog.c
new file mode 100644
index 0000000000..8687e9f540
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-syslog.c
@@ -0,0 +1,11 @@
+#include "nldbl-compat.h"
+
+void
+attribute_hidden
+syslog (int pri, const char *fmt, ...)
+{
+ va_list ap;
+ va_start (ap, fmt);
+ __nldbl_vsyslog (pri, fmt, ap);
+ va_end (ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-syslog_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-syslog_chk.c
new file mode 100644
index 0000000000..31ea6a8b9d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-syslog_chk.c
@@ -0,0 +1,12 @@
+#include "nldbl-compat.h"
+
+void
+attribute_hidden
+__syslog_chk (int pri, int flag, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start (ap, fmt);
+ __nldbl___vsyslog_chk (pri, flag, fmt, ap);
+ va_end(ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-tan.c b/sysdeps/ieee754/ldbl-opt/nldbl-tan.c
new file mode 100644
index 0000000000..1a27b6fbdd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-tan.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+tanl (double x)
+{
+ return tan (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-tanh.c b/sysdeps/ieee754/ldbl-opt/nldbl-tanh.c
new file mode 100644
index 0000000000..fc2fd32eb8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-tanh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+tanhl (double x)
+{
+ return tanh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-tgamma.c b/sysdeps/ieee754/ldbl-opt/nldbl-tgamma.c
new file mode 100644
index 0000000000..bbf613abe1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-tgamma.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+tgammal (double x)
+{
+ return tgamma (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-trunc.c b/sysdeps/ieee754/ldbl-opt/nldbl-trunc.c
new file mode 100644
index 0000000000..d0131e80a3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-trunc.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+truncl (double x)
+{
+ return trunc (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vasprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vasprintf.c
new file mode 100644
index 0000000000..52fa18ccee
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vasprintf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vasprintf (char **result_ptr, const char *fmt, va_list ap)
+{
+ return __nldbl_vasprintf (result_ptr, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vdprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vdprintf.c
new file mode 100644
index 0000000000..1acbd40625
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vdprintf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vdprintf (int d, const char *fmt, va_list arg)
+{
+ return __nldbl_vdprintf (d, fmt, arg);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf.c
new file mode 100644
index 0000000000..6ca8437b28
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vfprintf (FILE *s, const char *fmt, va_list ap)
+{
+ return __nldbl_vfprintf (s, fmt, ap);
+}
+extern __typeof (vfprintf) _IO_vfprintf attribute_hidden;
+strong_alias (vfprintf, _IO_vfprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf_chk.c
new file mode 100644
index 0000000000..0f6820af63
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
+{
+ return __nldbl___vfprintf_chk (s, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c
new file mode 100644
index 0000000000..f23465ee95
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vfscanf (FILE *s, const char *fmt, va_list ap)
+{
+ return __nldbl__IO_vfscanf (s, fmt, ap, NULL);
+}
+extern __typeof (__vfscanf) vfscanf attribute_hidden;
+weak_alias (__vfscanf, vfscanf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf.c
new file mode 100644
index 0000000000..c3fe76a971
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vfwprintf (s, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf_chk.c
new file mode 100644
index 0000000000..b3b69f0571
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
+{
+ return __nldbl___vfwprintf_chk (s, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c
new file mode 100644
index 0000000000..be9febc9a0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vfwscanf (s, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vprintf.c
new file mode 100644
index 0000000000..ed0d27d9a0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vprintf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vprintf (const char *fmt, va_list ap)
+{
+ return __nldbl_vfprintf (stdout, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vprintf_chk.c
new file mode 100644
index 0000000000..63b3e8f965
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vprintf_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vprintf_chk (int flag, const char *fmt, va_list ap)
+{
+ return __nldbl___vfprintf_chk (stdout, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c
new file mode 100644
index 0000000000..e75907b905
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vscanf (const char *fmt, va_list ap)
+{
+ return __nldbl__IO_vfscanf (stdin, fmt, ap, NULL);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf.c
new file mode 100644
index 0000000000..5a9bcbcaee
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vsnprintf (char *string, size_t maxlen, const char *fmt, va_list ap)
+{
+ return __nldbl_vsnprintf (string, maxlen, fmt, ap);
+}
+extern __typeof (vsnprintf) __vsnprintf attribute_hidden;
+weak_alias (vsnprintf, __vsnprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf_chk.c
new file mode 100644
index 0000000000..19380291a3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf_chk.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vsnprintf_chk (char *string, size_t maxlen, int flag, size_t slen,
+ const char *fmt, va_list ap)
+{
+ return __nldbl___vsnprintf_chk (string, maxlen, flag, slen, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf.c
new file mode 100644
index 0000000000..04406d0f6e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+_IO_vsprintf (char *string, const char *fmt, va_list ap)
+{
+ return __nldbl_vsprintf (string, fmt, ap);
+}
+extern __typeof (_IO_vsprintf) vsprintf attribute_hidden;
+weak_alias (_IO_vsprintf, vsprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf_chk.c
new file mode 100644
index 0000000000..9df143fcef
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf_chk.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vsprintf_chk (char *string, int flag, size_t slen, const char *fmt,
+ va_list ap)
+{
+ return __nldbl___vsprintf_chk (string, flag, slen, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c
new file mode 100644
index 0000000000..f5594c122c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vsscanf (const char *string, const char *fmt, va_list ap)
+{
+ return __nldbl_vsscanf (string, fmt, ap);
+}
+extern __typeof (__vsscanf) vsscanf attribute_hidden;
+weak_alias (__vsscanf, vsscanf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf.c
new file mode 100644
index 0000000000..ff3415a072
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vswprintf (string, maxlen, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf_chk.c
new file mode 100644
index 0000000000..0cd1f96bfe
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf_chk.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen,
+ const wchar_t *fmt, va_list ap)
+{
+ return __nldbl___vswprintf_chk (string, maxlen, flag, slen, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c
new file mode 100644
index 0000000000..bd4bb5131b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vswscanf (const wchar_t *string, const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vswscanf (string, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog.c
new file mode 100644
index 0000000000..eed1010eea
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+attribute_hidden
+void
+vsyslog (int pri, const char *fmt, va_list ap)
+{
+ __nldbl_vsyslog (pri, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog_chk.c
new file mode 100644
index 0000000000..2221474f97
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+void
+attribute_hidden
+__vsyslog_chk (int pri, int flag, const char *fmt, va_list ap)
+{
+ __nldbl___vsyslog_chk (pri, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf.c
new file mode 100644
index 0000000000..f46bdb3137
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vwprintf (const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vfwprintf (stdout, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf_chk.c
new file mode 100644
index 0000000000..f7e7185977
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vwprintf_chk (int flag, const wchar_t *fmt, va_list ap)
+{
+ return __nldbl___vfwprintf_chk (stdout, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c
new file mode 100644
index 0000000000..d39578ca4e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vwscanf (const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vfwscanf (stdin, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wcstold.c b/sysdeps/ieee754/ldbl-opt/nldbl-wcstold.c
new file mode 100644
index 0000000000..dbaffaa486
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wcstold.c
@@ -0,0 +1,10 @@
+#define wcstold wcstold_XXX
+#include "nldbl-compat.h"
+#undef wcstold
+
+double
+attribute_hidden
+wcstold (const wchar_t *nptr, wchar_t **endptr)
+{
+ return wcstod (nptr, endptr);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c b/sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c
new file mode 100644
index 0000000000..e32d13a94b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c
@@ -0,0 +1,14 @@
+#define wcstold_l wcstold_l_XXX
+#define __wcstold_l __wcstold_l_XXX
+#include "nldbl-compat.h"
+#undef wcstold_l
+#undef __wcstold_l
+
+double
+attribute_hidden
+__wcstold_l (const wchar_t *nptr, wchar_t **endptr, __locale_t loc)
+{
+ return __wcstod_l (nptr, endptr, loc);
+}
+extern __typeof (__wcstold_l) wcstold_l attribute_hidden;
+weak_alias (__wcstold_l, wcstold_l)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wcstoldint.c b/sysdeps/ieee754/ldbl-opt/nldbl-wcstoldint.c
new file mode 100644
index 0000000000..b638a399ad
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wcstoldint.c
@@ -0,0 +1,10 @@
+#define __wcstold_internal __wcstold_internal_XXX
+#include "nldbl-compat.h"
+#undef __wcstold_internal
+
+double
+attribute_hidden
+__wcstold_internal (const wchar_t *nptr, wchar_t **endptr, int group)
+{
+ return __wcstod_internal (nptr, endptr, group);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-wprintf.c
new file mode 100644
index 0000000000..2aa1a7475a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wprintf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+wprintf (const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwprintf (stdout, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-wprintf_chk.c
new file mode 100644
index 0000000000..39191e123b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wprintf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__wprintf_chk (int flag, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfwprintf_chk (stdout, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c
new file mode 100644
index 0000000000..4ee3fdc15f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+wscanf (const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwscanf (stdin, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-y0.c b/sysdeps/ieee754/ldbl-opt/nldbl-y0.c
new file mode 100644
index 0000000000..e35621f60f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-y0.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+y0l (double x)
+{
+ return y0 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-y1.c b/sysdeps/ieee754/ldbl-opt/nldbl-y1.c
new file mode 100644
index 0000000000..c47abcd3c5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-y1.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+y1l (double x)
+{
+ return y1 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-yn.c b/sysdeps/ieee754/ldbl-opt/nldbl-yn.c
new file mode 100644
index 0000000000..7623d4513b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-yn.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+ynl (int n, double x)
+{
+ return yn (n, x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/s_asinh.c b/sysdeps/ieee754/ldbl-opt/s_asinh.c
new file mode 100644
index 0000000000..e9bcfaea62
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_asinh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_asinh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __asinh, asinhl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_atan.c b/sysdeps/ieee754/ldbl-opt/s_atan.c
new file mode 100644
index 0000000000..5fbd5e62d6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_atan.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_atan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, atan, atanl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cacos.c b/sysdeps/ieee754/ldbl-opt/s_cacos.c
new file mode 100644
index 0000000000..db90a9ef18
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cacos.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cacos.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cacos, cacosl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cacosh.c b/sysdeps/ieee754/ldbl-opt/s_cacosh.c
new file mode 100644
index 0000000000..e68049d46d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cacosh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cacosh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cacosh, cacoshl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cacoshl.c b/sysdeps/ieee754/ldbl-opt/s_cacoshl.c
new file mode 100644
index 0000000000..ed4a299845
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cacoshl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cacoshl.c>
+long_double_symbol (libm, __cacoshl, cacoshl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_cacosl.c b/sysdeps/ieee754/ldbl-opt/s_cacosl.c
new file mode 100644
index 0000000000..9b840054e9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cacosl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cacosl.c>
+long_double_symbol (libm, __cacosl, cacosl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_casin.c b/sysdeps/ieee754/ldbl-opt/s_casin.c
new file mode 100644
index 0000000000..04c47ca602
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_casin.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_casin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __casin, casinl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinh.c b/sysdeps/ieee754/ldbl-opt/s_casinh.c
new file mode 100644
index 0000000000..19c4fa30f8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_casinh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_casinh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __casinh, casinhl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinhl.c b/sysdeps/ieee754/ldbl-opt/s_casinhl.c
new file mode 100644
index 0000000000..976fa8e5b0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_casinhl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_casinhl.c>
+long_double_symbol (libm, __casinhl, casinhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinl.c b/sysdeps/ieee754/ldbl-opt/s_casinl.c
new file mode 100644
index 0000000000..7afb77cd4d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_casinl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_casinl.c>
+long_double_symbol (libm, __casinl, casinl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_catan.c b/sysdeps/ieee754/ldbl-opt/s_catan.c
new file mode 100644
index 0000000000..19f61736d2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_catan.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_catan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __catan, catanl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_catanh.c b/sysdeps/ieee754/ldbl-opt/s_catanh.c
new file mode 100644
index 0000000000..cff7861444
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_catanh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_catanh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __catanh, catanhl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_catanhl.c b/sysdeps/ieee754/ldbl-opt/s_catanhl.c
new file mode 100644
index 0000000000..e9562825e9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_catanhl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_catanhl.c>
+long_double_symbol (libm, __catanhl, catanhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_catanl.c b/sysdeps/ieee754/ldbl-opt/s_catanl.c
new file mode 100644
index 0000000000..ee2fdf5d6c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_catanl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_catanl.c>
+long_double_symbol (libm, __catanl, catanl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_cbrt.c b/sysdeps/ieee754/ldbl-opt/s_cbrt.c
new file mode 100644
index 0000000000..cdc635771e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cbrt.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_cbrt.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __cbrt, cbrtl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ccos.c b/sysdeps/ieee754/ldbl-opt/s_ccos.c
new file mode 100644
index 0000000000..2c43c7f392
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ccos.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_ccos.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __ccos, ccosl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ccosh.c b/sysdeps/ieee754/ldbl-opt/s_ccosh.c
new file mode 100644
index 0000000000..3753cd56bc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ccosh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_ccosh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __ccosh, ccoshl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ccoshl.c b/sysdeps/ieee754/ldbl-opt/s_ccoshl.c
new file mode 100644
index 0000000000..9f0c1e1a32
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ccoshl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ccoshl.c>
+long_double_symbol (libm, __ccoshl, ccoshl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_ccosl.c b/sysdeps/ieee754/ldbl-opt/s_ccosl.c
new file mode 100644
index 0000000000..e93e80538e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ccosl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ccosl.c>
+long_double_symbol (libm, __ccosl, ccosl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_ceil.c b/sysdeps/ieee754/ldbl-opt/s_ceil.c
new file mode 100644
index 0000000000..6e4b70795d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ceil.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_ceil.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __ceil, ceill, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cexp.c b/sysdeps/ieee754/ldbl-opt/s_cexp.c
new file mode 100644
index 0000000000..d983c96b7b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cexp.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cexp.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cexp, cexpl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cexpl.c b/sysdeps/ieee754/ldbl-opt/s_cexpl.c
new file mode 100644
index 0000000000..d5ae1fc0d0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cexpl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cexpl.c>
+long_double_symbol (libm, __cexpl, cexpl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_clog.c b/sysdeps/ieee754/ldbl-opt/s_clog.c
new file mode 100644
index 0000000000..3e0e90cf89
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_clog.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_clog.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __clog, clogl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_clog10.c b/sysdeps/ieee754/ldbl-opt/s_clog10.c
new file mode 100644
index 0000000000..ac3f4a3a71
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_clog10.c
@@ -0,0 +1,7 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_clog10.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __clog10, __clog10l, GLIBC_2_1);
+compat_symbol (libm, clog10, clog10l, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_clog10l.c b/sysdeps/ieee754/ldbl-opt/s_clog10l.c
new file mode 100644
index 0000000000..954f68095a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_clog10l.c
@@ -0,0 +1,10 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#define __clog10l __clog10l_internal
+#include <math/s_clog10l.c>
+#undef __clog10l
+strong_alias (__clog10l_internal, __clog10l__internal)
+long_double_symbol (libm, __clog10l_internal, __clog10l);
+long_double_symbol (libm, __clog10l__internal, clog10l);
diff --git a/sysdeps/ieee754/ldbl-opt/s_clogl.c b/sysdeps/ieee754/ldbl-opt/s_clogl.c
new file mode 100644
index 0000000000..75126c8b89
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_clogl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_clogl.c>
+long_double_symbol (libm, __clogl, clogl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_copysign.c b/sysdeps/ieee754/ldbl-opt/s_copysign.c
new file mode 100644
index 0000000000..425e0eadbd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_copysign.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_copysign.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __copysign, copysignl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cpow.c b/sysdeps/ieee754/ldbl-opt/s_cpow.c
new file mode 100644
index 0000000000..4801d7cdf9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cpow.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cpow.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cpow, cpowl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cpowl.c b/sysdeps/ieee754/ldbl-opt/s_cpowl.c
new file mode 100644
index 0000000000..61840e3381
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cpowl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cpowl.c>
+long_double_symbol (libm, __cpowl, cpowl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_cproj.c b/sysdeps/ieee754/ldbl-opt/s_cproj.c
new file mode 100644
index 0000000000..f298c3795a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cproj.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cproj.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cproj, cprojl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cprojl.c b/sysdeps/ieee754/ldbl-opt/s_cprojl.c
new file mode 100644
index 0000000000..1cc058007e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cprojl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cprojl.c>
+long_double_symbol (libm, __cprojl, cprojl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_csin.c b/sysdeps/ieee754/ldbl-opt/s_csin.c
new file mode 100644
index 0000000000..7017c95450
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csin.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_csin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __csin, csinl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinh.c b/sysdeps/ieee754/ldbl-opt/s_csinh.c
new file mode 100644
index 0000000000..a1fa6671db
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csinh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_csinh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __csinh, csinhl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinhl.c b/sysdeps/ieee754/ldbl-opt/s_csinhl.c
new file mode 100644
index 0000000000..484d466ce8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csinhl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_csinhl.c>
+long_double_symbol (libm, __csinhl, csinhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinl.c b/sysdeps/ieee754/ldbl-opt/s_csinl.c
new file mode 100644
index 0000000000..f71642e886
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csinl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_csinl.c>
+long_double_symbol (libm, __csinl, csinl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_csqrt.c b/sysdeps/ieee754/ldbl-opt/s_csqrt.c
new file mode 100644
index 0000000000..2b6dcfe010
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csqrt.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_csqrt.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __csqrt, csqrtl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_csqrtl.c b/sysdeps/ieee754/ldbl-opt/s_csqrtl.c
new file mode 100644
index 0000000000..045ff93e43
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csqrtl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_csqrtl.c>
+long_double_symbol (libm, __csqrtl, csqrtl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctan.c b/sysdeps/ieee754/ldbl-opt/s_ctan.c
new file mode 100644
index 0000000000..a6a21f9f23
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ctan.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_ctan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __ctan, ctanl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctanh.c b/sysdeps/ieee754/ldbl-opt/s_ctanh.c
new file mode 100644
index 0000000000..fd4be129f8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ctanh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_ctanh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __ctanh, ctanhl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctanhl.c b/sysdeps/ieee754/ldbl-opt/s_ctanhl.c
new file mode 100644
index 0000000000..f159373b39
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ctanhl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ctanhl.c>
+long_double_symbol (libm, __ctanhl, ctanhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctanl.c b/sysdeps/ieee754/ldbl-opt/s_ctanl.c
new file mode 100644
index 0000000000..0c2d94cf49
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ctanl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ctanl.c>
+long_double_symbol (libm, __ctanl, ctanl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_erf.c b/sysdeps/ieee754/ldbl-opt/s_erf.c
new file mode 100644
index 0000000000..76f1baa5ca
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_erf.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_erf.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __erf, erfl, GLIBC_2_0);
+compat_symbol (libm, __erfc, erfcl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_expm1.c b/sysdeps/ieee754/ldbl-opt/s_expm1.c
new file mode 100644
index 0000000000..ef9b5956db
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_expm1.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_expm1.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __expm1, expm1l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fabs.c b/sysdeps/ieee754/ldbl-opt/s_fabs.c
new file mode 100644
index 0000000000..e7c92187e9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fabs.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_fabs.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fabs, fabsl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fdim.c b/sysdeps/ieee754/ldbl-opt/s_fdim.c
new file mode 100644
index 0000000000..02c95bfa81
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fdim.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_fdim.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fdim, fdiml, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fdiml.c b/sysdeps/ieee754/ldbl-opt/s_fdiml.c
new file mode 100644
index 0000000000..06b760b7b4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fdiml.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_fdiml.c>
+long_double_symbol (libm, __fdiml, fdiml);
diff --git a/sysdeps/ieee754/ldbl-opt/s_finite.c b/sysdeps/ieee754/ldbl-opt/s_finite.c
new file mode 100644
index 0000000000..897dbfd3b0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_finite.c
@@ -0,0 +1,18 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_finite.c>
+weak_alias (__finite, ___finite)
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __finite, __finitel, GLIBC_2_1);
+# endif
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, ___finite, finitel, GLIBC_2_0);
+# endif
+#else
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libm, __finite, __finitel, GLIBC_2_0);
+# endif
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, ___finite, finitel, GLIBC_2_0);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_floor.c b/sysdeps/ieee754/ldbl-opt/s_floor.c
new file mode 100644
index 0000000000..7797944e9e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_floor.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_floor.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __floor, floorl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fma.c b/sysdeps/ieee754/ldbl-opt/s_fma.c
new file mode 100644
index 0000000000..2ee7214131
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fma.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_fma.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fma, fmal, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmal.c b/sysdeps/ieee754/ldbl-opt/s_fmal.c
new file mode 100644
index 0000000000..bd12dabcbe
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fmal.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_fmal.c>
+long_double_symbol (libm, __fmal, fmal);
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmax.c b/sysdeps/ieee754/ldbl-opt/s_fmax.c
new file mode 100644
index 0000000000..11e759121f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fmax.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_fmax.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fmax, fmaxl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmaxl.c b/sysdeps/ieee754/ldbl-opt/s_fmaxl.c
new file mode 100644
index 0000000000..98221b2cdc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fmaxl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_fmaxl.c>
+long_double_symbol (libm, __fmaxl, fmaxl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmin.c b/sysdeps/ieee754/ldbl-opt/s_fmin.c
new file mode 100644
index 0000000000..c3fe44d9d9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fmin.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_fmin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fmin, fminl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fminl.c b/sysdeps/ieee754/ldbl-opt/s_fminl.c
new file mode 100644
index 0000000000..9bfdc7ad79
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fminl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_fminl.c>
+long_double_symbol (libm, __fminl, fminl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_frexp.c b/sysdeps/ieee754/ldbl-opt/s_frexp.c
new file mode 100644
index 0000000000..59ce352200
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_frexp.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_frexp.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __frexp, frexpl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __frexp, frexpl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ilogb.c b/sysdeps/ieee754/ldbl-opt/s_ilogb.c
new file mode 100644
index 0000000000..3a6ccbd09d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ilogb.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_ilogb.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __ilogb, ilogbl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_isinf.c b/sysdeps/ieee754/ldbl-opt/s_isinf.c
new file mode 100644
index 0000000000..401c8b1318
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_isinf.c
@@ -0,0 +1,8 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_isinf.c>
+#ifndef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
+compat_symbol (libc, isinf, isinfl, GLIBC_2_0);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_isnan.c b/sysdeps/ieee754/ldbl-opt/s_isnan.c
new file mode 100644
index 0000000000..164b800b85
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_isnan.c
@@ -0,0 +1,8 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_isnan.c>
+#ifndef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
+compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ldexp.c b/sysdeps/ieee754/ldbl-opt/s_ldexp.c
new file mode 100644
index 0000000000..f0f6519892
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ldexp.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <math/s_ldexp.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __ldexp, ldexpl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __ldexp, ldexpl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
new file mode 100644
index 0000000000..d4636b9cc1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ldexpl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __ldexpl, ldexpl);
+#else
+long_double_symbol (libc, __ldexpl, ldexpl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_llrint.c b/sysdeps/ieee754/ldbl-opt/s_llrint.c
new file mode 100644
index 0000000000..e6311972e1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_llrint.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_llrint.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __llrint, llrintl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_llround.c b/sysdeps/ieee754/ldbl-opt/s_llround.c
new file mode 100644
index 0000000000..36c7e6edac
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_llround.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_llround.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __llround, llroundl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_log1p.c b/sysdeps/ieee754/ldbl-opt/s_log1p.c
new file mode 100644
index 0000000000..495fa32e35
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_log1p.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_log1p.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __log1p, log1pl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_logb.c b/sysdeps/ieee754/ldbl-opt/s_logb.c
new file mode 100644
index 0000000000..4d7a6db275
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_logb.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_logb.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __logb, logbl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_lrint.c b/sysdeps/ieee754/ldbl-opt/s_lrint.c
new file mode 100644
index 0000000000..b7af812846
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_lrint.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_lrint.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __lrint, lrintl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_lround.c b/sysdeps/ieee754/ldbl-opt/s_lround.c
new file mode 100644
index 0000000000..f3a27fa9c9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_lround.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_lround.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __lround, lroundl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_modf.c b/sysdeps/ieee754/ldbl-opt/s_modf.c
new file mode 100644
index 0000000000..2263811e5e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_modf.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_modf.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __modf, modfl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __modf, modfl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_nan.c b/sysdeps/ieee754/ldbl-opt/s_nan.c
new file mode 100644
index 0000000000..418aad2076
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nan.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_nan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __nan, nanl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_nanl.c b/sysdeps/ieee754/ldbl-opt/s_nanl.c
new file mode 100644
index 0000000000..9496e0b5ce
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nanl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_nanl.c>
+long_double_symbol (libm, __nanl, nanl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_nearbyint.c b/sysdeps/ieee754/ldbl-opt/s_nearbyint.c
new file mode 100644
index 0000000000..a8b7973acd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nearbyint.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_nearbyint.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_nextafter.c b/sysdeps/ieee754/ldbl-opt/s_nextafter.c
new file mode 100644
index 0000000000..78e2c0ff37
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nextafter.c
@@ -0,0 +1,12 @@
+#include <math_ldbl_opt.h>
+#include <math/s_nextafter.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __nextafter, nextafterl, GLIBC_2_0);
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+strong_alias (__nextafter, __nexttowardd)
+strong_alias (__nextafter, __nexttowardld)
+#undef nexttoward
+compat_symbol (libm, __nexttowardd, nexttoward, GLIBC_2_1);
+compat_symbol (libm, __nexttowardld, nexttowardl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c b/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c
new file mode 100644
index 0000000000..d52526f719
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c
@@ -0,0 +1,77 @@
+/* Single precision version of nexttoward.c.
+ Conversion to IEEE single float by Jakub Jelinek, jj@ultra.linux.cz. */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* IEEE functions
+ * __nexttowardfd(x,y)
+ * return the next machine floating-point number of x in the
+ * direction toward y.
+ * This is for machines which use different binary type for double and
+ * long double conditionally, y is long double equal to double.
+ * Special cases:
+ */
+
+#include <math_ldbl_opt.h>
+
+float __nldbl_nexttowardf(float x, double y);
+
+float __nldbl_nexttowardf(float x, double y)
+{
+ int32_t hx,hy,ix,iy;
+ u_int32_t ly;
+
+ GET_FLOAT_WORD(hx,x);
+ EXTRACT_WORDS(hy,ly,y);
+ ix = hx&0x7fffffff; /* |x| */
+ iy = hy&0x7fffffff; /* |y| */
+
+ if((ix>0x7f800000) || /* x is nan */
+ ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */
+ return x+y;
+ if((double) x==y) return y; /* x=y, return y */
+ if(ix==0) { /* x == 0 */
+ float x2;
+ SET_FLOAT_WORD(x,(u_int32_t)(hy&0x80000000)|1);/* return +-minsub*/
+ x2 = x*x;
+ if(x2==x) return x2; else return x; /* raise underflow flag */
+ }
+ if(hx>=0) { /* x > 0 */
+ if(hy<0||(ix>>23)>(iy>>20)-0x380
+ || ((ix>>23)==(iy>>20)-0x380
+ && (ix&0x7fffff)>(((hy<<3)|(ly>>29))&0x7fffff))) /* x > y, x -= ulp */
+ hx -= 1;
+ else /* x < y, x += ulp */
+ hx += 1;
+ } else { /* x < 0 */
+ if(hy>=0||(ix>>23)>(iy>>20)-0x380
+ || ((ix>>23)==(iy>>20)-0x380
+ && (ix&0x7fffff)>(((hy<<3)|(ly>>29))&0x7fffff))) /* x < y, x -= ulp */
+ hx -= 1;
+ else /* x > y, x += ulp */
+ hx += 1;
+ }
+ hy = hx&0x7f800000;
+ if(hy>=0x7f800000) return x+x; /* overflow */
+ if(hy<0x00800000) { /* underflow */
+ float x2 = x*x;
+ if(x2!=x) { /* raise underflow flag */
+ SET_FLOAT_WORD(x2,hx);
+ return x2;
+ }
+ }
+ SET_FLOAT_WORD(x,hx);
+ return x;
+}
+
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __nldbl_nexttowardf, nexttowardf, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_remquo.c b/sysdeps/ieee754/ldbl-opt/s_remquo.c
new file mode 100644
index 0000000000..9f3d7ba368
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_remquo.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_remquo.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __remquo, remquol, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_rint.c b/sysdeps/ieee754/ldbl-opt/s_rint.c
new file mode 100644
index 0000000000..d9b156ea27
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_rint.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_rint.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __rint, rintl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_round.c b/sysdeps/ieee754/ldbl-opt/s_round.c
new file mode 100644
index 0000000000..edff2f017b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_round.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_round.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __round, roundl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_scalbln.c b/sysdeps/ieee754/ldbl-opt/s_scalbln.c
new file mode 100644
index 0000000000..2398bba49a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_scalbln.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_scalbln.c>
+#ifdef IS_IN_libm
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __scalbln, scalblnl, GLIBC_2_1);
+#endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_1)
+compat_symbol (libc, __scalbln, scalblnl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_scalbn.c b/sysdeps/ieee754/ldbl-opt/s_scalbn.c
new file mode 100644
index 0000000000..094735ea53
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_scalbn.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_scalbn.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __scalbn, scalbnl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __scalbn, scalbnl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_significand.c b/sysdeps/ieee754/ldbl-opt/s_significand.c
new file mode 100644
index 0000000000..5287c09066
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_significand.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_significand.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __significand, significandl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_significandl.c b/sysdeps/ieee754/ldbl-opt/s_significandl.c
new file mode 100644
index 0000000000..9339b4780d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_significandl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_significandl.c>
+long_double_symbol (libm, __significandl, significandl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_sin.c b/sysdeps/ieee754/ldbl-opt/s_sin.c
new file mode 100644
index 0000000000..a11d5a33dc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_sin.c
@@ -0,0 +1,10 @@
+/* dbl-64/s_sin.c uses NAN and sincos identifiers internally. */
+#define sincos sincos_disable
+#include <math_ldbl_opt.h>
+#undef NAN
+#undef sincos
+#include <sysdeps/ieee754/dbl-64/s_sin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __sin, sinl, GLIBC_2_0);
+compat_symbol (libm, __cos, cosl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_sincos.c b/sysdeps/ieee754/ldbl-opt/s_sincos.c
new file mode 100644
index 0000000000..6d2a48f25b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_sincos.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_sincos.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __sincos, sincosl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_tan.c b/sysdeps/ieee754/ldbl-opt/s_tan.c
new file mode 100644
index 0000000000..6b0fec0063
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_tan.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_tan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, tan, tanl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_tanh.c b/sysdeps/ieee754/ldbl-opt/s_tanh.c
new file mode 100644
index 0000000000..e763bbde77
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_tanh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_tanh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __tanh, tanhl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_trunc.c b/sysdeps/ieee754/ldbl-opt/s_trunc.c
new file mode 100644
index 0000000000..9d90a2bd73
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_trunc.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_trunc.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __trunc, truncl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_acos.c b/sysdeps/ieee754/ldbl-opt/w_acos.c
new file mode 100644
index 0000000000..2934041d4d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_acos.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_acos.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __acos, acosl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_acosh.c b/sysdeps/ieee754/ldbl-opt/w_acosh.c
new file mode 100644
index 0000000000..7f7fa14e27
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_acosh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_acosh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __acosh, acoshl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_acoshl.c b/sysdeps/ieee754/ldbl-opt/w_acoshl.c
new file mode 100644
index 0000000000..6243c2ac80
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_acoshl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_acoshl.c>
+long_double_symbol (libm, __acoshl, acoshl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_acosl.c b/sysdeps/ieee754/ldbl-opt/w_acosl.c
new file mode 100644
index 0000000000..8b6e890a53
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_acosl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_acosl.c>
+long_double_symbol (libm, __acosl, acosl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_asin.c b/sysdeps/ieee754/ldbl-opt/w_asin.c
new file mode 100644
index 0000000000..5e1d70ff65
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_asin.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_asin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __asin, asinl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_asinl.c b/sysdeps/ieee754/ldbl-opt/w_asinl.c
new file mode 100644
index 0000000000..a58a224a38
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_asinl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_asinl.c>
+long_double_symbol (libm, __asinl, asinl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_atan2.c b/sysdeps/ieee754/ldbl-opt/w_atan2.c
new file mode 100644
index 0000000000..f1d1501bd2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_atan2.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_atan2.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __atan2, atan2l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_atan2l.c b/sysdeps/ieee754/ldbl-opt/w_atan2l.c
new file mode 100644
index 0000000000..01431eff44
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_atan2l.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_atan2l.c>
+long_double_symbol (libm, __atan2l, atan2l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_atanh.c b/sysdeps/ieee754/ldbl-opt/w_atanh.c
new file mode 100644
index 0000000000..b4cab87c32
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_atanh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_atanh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __atanh, atanhl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_atanhl.c b/sysdeps/ieee754/ldbl-opt/w_atanhl.c
new file mode 100644
index 0000000000..0dbc114481
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_atanhl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_atanhl.c>
+long_double_symbol (libm, __atanhl, atanhl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_cosh.c b/sysdeps/ieee754/ldbl-opt/w_cosh.c
new file mode 100644
index 0000000000..a6f56cf4c5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_cosh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_cosh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __cosh, coshl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_coshl.c b/sysdeps/ieee754/ldbl-opt/w_coshl.c
new file mode 100644
index 0000000000..8c7dccb7f3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_coshl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_coshl.c>
+long_double_symbol (libm, __coshl, coshl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_drem.c b/sysdeps/ieee754/ldbl-opt/w_drem.c
new file mode 100644
index 0000000000..788a5d29d6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_drem.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_drem.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __drem, dreml, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_dreml.c b/sysdeps/ieee754/ldbl-opt/w_dreml.c
new file mode 100644
index 0000000000..d14d7e202c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_dreml.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_dreml.c>
+long_double_symbol (libm, __dreml, dreml);
diff --git a/sysdeps/ieee754/ldbl-opt/w_exp.c b/sysdeps/ieee754/ldbl-opt/w_exp.c
new file mode 100644
index 0000000000..61fcfcc9df
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_exp.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/w_exp.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __exp, expl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_exp10.c b/sysdeps/ieee754/ldbl-opt/w_exp10.c
new file mode 100644
index 0000000000..990c48e61a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_exp10.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_exp10.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __exp10, exp10l, GLIBC_2_1);
+compat_symbol (libm, __pow10, pow10l, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_exp10l.c b/sysdeps/ieee754/ldbl-opt/w_exp10l.c
new file mode 100644
index 0000000000..e06dfb5014
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_exp10l.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_exp10l.c>
+long_double_symbol (libm, __exp10l, exp10l);
+long_double_symbol (libm, __pow10l, pow10l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_fmod.c b/sysdeps/ieee754/ldbl-opt/w_fmod.c
new file mode 100644
index 0000000000..81ad5057f7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_fmod.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_fmod.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fmod, fmodl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_fmodl.c b/sysdeps/ieee754/ldbl-opt/w_fmodl.c
new file mode 100644
index 0000000000..2a534a304c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_fmodl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_fmodl.c>
+long_double_symbol (libm, __fmodl, fmodl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_hypot.c b/sysdeps/ieee754/ldbl-opt/w_hypot.c
new file mode 100644
index 0000000000..e1cf1ffcfe
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_hypot.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_hypot.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __hypot, hypotl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_hypotl.c b/sysdeps/ieee754/ldbl-opt/w_hypotl.c
new file mode 100644
index 0000000000..6c46bd4bde
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_hypotl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_hypotl.c>
+long_double_symbol (libm, __hypotl, hypotl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_j0.c b/sysdeps/ieee754/ldbl-opt/w_j0.c
new file mode 100644
index 0000000000..5c78aff085
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_j0.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_j0.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, j0, j0l, GLIBC_2_0);
+compat_symbol (libm, y0, y0l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_j0l.c b/sysdeps/ieee754/ldbl-opt/w_j0l.c
new file mode 100644
index 0000000000..767a1bcada
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_j0l.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_j0l.c>
+long_double_symbol (libm, __j0l, j0l);
+long_double_symbol (libm, __y0l, y0l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_j1.c b/sysdeps/ieee754/ldbl-opt/w_j1.c
new file mode 100644
index 0000000000..ed3dbc0361
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_j1.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_j1.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, j1, j1l, GLIBC_2_0);
+compat_symbol (libm, y1, y1l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_j1l.c b/sysdeps/ieee754/ldbl-opt/w_j1l.c
new file mode 100644
index 0000000000..946c36467c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_j1l.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_j1l.c>
+long_double_symbol (libm, __j1l, j1l);
+long_double_symbol (libm, __y1l, y1l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_jn.c b/sysdeps/ieee754/ldbl-opt/w_jn.c
new file mode 100644
index 0000000000..7a7e0d434b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_jn.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_jn.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, jn, jnl, GLIBC_2_0);
+compat_symbol (libm, yn, ynl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_jnl.c b/sysdeps/ieee754/ldbl-opt/w_jnl.c
new file mode 100644
index 0000000000..5219543a97
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_jnl.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_jnl.c>
+long_double_symbol (libm, __jnl, jnl);
+long_double_symbol (libm, __ynl, ynl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_lgamma.c b/sysdeps/ieee754/ldbl-opt/w_lgamma.c
new file mode 100644
index 0000000000..ef801c5505
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_lgamma.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_lgamma.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __lgamma, lgammal, GLIBC_2_0);
+compat_symbol (libm, __gamma, gammal, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_lgamma_r.c b/sysdeps/ieee754/ldbl-opt/w_lgamma_r.c
new file mode 100644
index 0000000000..eeab6a6b47
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_lgamma_r.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_lgamma_r.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __lgamma_r, lgammal_r, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_lgammal.c b/sysdeps/ieee754/ldbl-opt/w_lgammal.c
new file mode 100644
index 0000000000..9de7ec8f7f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_lgammal.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_lgammal.c>
+long_double_symbol (libm, __lgammal, lgammal);
+long_double_symbol (libm, __gammal, gammal);
diff --git a/sysdeps/ieee754/ldbl-opt/w_lgammal_r.c b/sysdeps/ieee754/ldbl-opt/w_lgammal_r.c
new file mode 100644
index 0000000000..25459758d7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_lgammal_r.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_lgammal_r.c>
+long_double_symbol (libm, __lgammal_r, lgammal_r);
diff --git a/sysdeps/ieee754/ldbl-opt/w_log.c b/sysdeps/ieee754/ldbl-opt/w_log.c
new file mode 100644
index 0000000000..bde1e31db4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_log.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __log, logl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_log10.c b/sysdeps/ieee754/ldbl-opt/w_log10.c
new file mode 100644
index 0000000000..74e716821e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log10.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_log10.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __log10, log10l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_log10l.c b/sysdeps/ieee754/ldbl-opt/w_log10l.c
new file mode 100644
index 0000000000..9c936e376a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log10l.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_log10l.c>
+long_double_symbol (libm, __log10l, log10l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_log2.c b/sysdeps/ieee754/ldbl-opt/w_log2.c
new file mode 100644
index 0000000000..9b9b45b21b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log2.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_log2.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __log2, log2l, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_log2l.c b/sysdeps/ieee754/ldbl-opt/w_log2l.c
new file mode 100644
index 0000000000..c859682133
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log2l.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_log2l.c>
+long_double_symbol (libm, __log2l, log2l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_logl.c b/sysdeps/ieee754/ldbl-opt/w_logl.c
new file mode 100644
index 0000000000..c2354a02b9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_logl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_logl.c>
+long_double_symbol (libm, __logl, logl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_pow.c b/sysdeps/ieee754/ldbl-opt/w_pow.c
new file mode 100644
index 0000000000..2d98fb9be4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_pow.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_pow.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __pow, powl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_powl.c b/sysdeps/ieee754/ldbl-opt/w_powl.c
new file mode 100644
index 0000000000..85b8927648
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_powl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_powl.c>
+long_double_symbol (libm, __powl, powl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_remainder.c b/sysdeps/ieee754/ldbl-opt/w_remainder.c
new file mode 100644
index 0000000000..94d98930f4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_remainder.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_remainder.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __remainder, remainderl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_remainderl.c b/sysdeps/ieee754/ldbl-opt/w_remainderl.c
new file mode 100644
index 0000000000..e450a25bbc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_remainderl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_remainderl.c>
+long_double_symbol (libm, __remainderl, remainderl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_scalb.c b/sysdeps/ieee754/ldbl-opt/w_scalb.c
new file mode 100644
index 0000000000..e2ac601596
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_scalb.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_scalb.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __scalb, scalbl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_scalbl.c b/sysdeps/ieee754/ldbl-opt/w_scalbl.c
new file mode 100644
index 0000000000..f3d3901f86
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_scalbl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_scalbl.c>
+long_double_symbol (libm, __scalbl, scalbl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_sinh.c b/sysdeps/ieee754/ldbl-opt/w_sinh.c
new file mode 100644
index 0000000000..a5400b5eb1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_sinh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_sinh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __sinh, sinhl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_sinhl.c b/sysdeps/ieee754/ldbl-opt/w_sinhl.c
new file mode 100644
index 0000000000..b94f4ec845
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_sinhl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_sinhl.c>
+long_double_symbol (libm, __sinhl, sinhl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_sqrt.c b/sysdeps/ieee754/ldbl-opt/w_sqrt.c
new file mode 100644
index 0000000000..ca2ba061e8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_sqrt.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_sqrt.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __sqrt, sqrtl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_sqrtl.c b/sysdeps/ieee754/ldbl-opt/w_sqrtl.c
new file mode 100644
index 0000000000..609f5bf3d6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_sqrtl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_sqrtl.c>
+long_double_symbol (libm, __sqrtl, sqrtl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_tgamma.c b/sysdeps/ieee754/ldbl-opt/w_tgamma.c
new file mode 100644
index 0000000000..cce9f348ed
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_tgamma.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_tgamma.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __tgamma, tgammal, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_tgammal.c b/sysdeps/ieee754/ldbl-opt/w_tgammal.c
new file mode 100644
index 0000000000..c3c511db8c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_tgammal.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_tgammal.c>
+long_double_symbol (libm, __tgammal, tgammal);
diff --git a/sysdeps/linkmap.h b/sysdeps/linkmap.h
deleted file mode 100644
index 470b4d3e5f..0000000000
--- a/sysdeps/linkmap.h
+++ /dev/null
@@ -1,4 +0,0 @@
-struct link_map_machine
- {
- /* empty by default */
- };
diff --git a/sysdeps/m68k/bits/setjmp.h b/sysdeps/m68k/bits/setjmp.h
index 612582af26..2d5a08227d 100644
--- a/sysdeps/m68k/bits/setjmp.h
+++ b/sysdeps/m68k/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2005,2006 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
@@ -42,9 +42,4 @@ typedef struct
} __jmp_buf[1];
-/* Test if longjmp to JMPBUF would unwind the frame
- containing a local variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
- ((void *) (address) < (void *) demangle ((jmpbuf)->__sp))
-
#endif /* bits/setjmp.h */
diff --git a/sysdeps/m68k/fpu/libm-test-ulps b/sysdeps/m68k/fpu/libm-test-ulps
index cab950120c..854c10cb1a 100644
--- a/sysdeps/m68k/fpu/libm-test-ulps
+++ b/sysdeps/m68k/fpu/libm-test-ulps
@@ -36,14 +36,14 @@ ildouble: 2
ldouble: 2
# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 7
idouble: 1
ifloat: 7
ildouble: 6
ldouble: 6
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
idouble: 1
ildouble: 2
diff --git a/sysdeps/m68k/jmpbuf-unwind.h b/sysdeps/m68k/jmpbuf-unwind.h
new file mode 100644
index 0000000000..3490c79bdc
--- /dev/null
+++ b/sysdeps/m68k/jmpbuf-unwind.h
@@ -0,0 +1,25 @@
+/* Examine __jmp_buf for unwinding frames. m68k version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <setjmp.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame
+ containing a local variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+ ((void *) (address) < (void *) demangle ((jmpbuf)->__sp))
diff --git a/sysdeps/mach/hurd/alpha/longjmp-ts.c b/sysdeps/mach/hurd/alpha/longjmp-ts.c
index b271d6d2a9..f472dbcb30 100644
--- a/sysdeps/mach/hurd/alpha/longjmp-ts.c
+++ b/sysdeps/mach/hurd/alpha/longjmp-ts.c
@@ -1,5 +1,5 @@
/* Perform a `longjmp' on a Mach thread_state. Alpha version.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006 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
@@ -19,6 +19,7 @@
#include <hurd/signal.h>
#include <setjmp.h>
+#include <jmpbuf-offsets.h>
#include <mach/thread_status.h>
diff --git a/sysdeps/mach/hurd/i386/longjmp-ts.c b/sysdeps/mach/hurd/i386/longjmp-ts.c
index 586ce6b015..c902002cbc 100644
--- a/sysdeps/mach/hurd/i386/longjmp-ts.c
+++ b/sysdeps/mach/hurd/i386/longjmp-ts.c
@@ -1,5 +1,5 @@
/* Perform a `longjmp' on a Mach thread_state. i386 version.
- Copyright (C) 1991, 1994, 1995, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1994, 1995, 1997, 2006 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
@@ -19,6 +19,7 @@
#include <hurd/signal.h>
#include <setjmp.h>
+#include <jmpbuf-offsets.h>
#include <mach/thread_status.h>
diff --git a/sysdeps/mach/hurd/jmp-unwind.c b/sysdeps/mach/hurd/jmp-unwind.c
index a522aa715a..e0e16e28b2 100644
--- a/sysdeps/mach/hurd/jmp-unwind.c
+++ b/sysdeps/mach/hurd/jmp-unwind.c
@@ -1,5 +1,5 @@
/* _longjmp_unwind -- Clean up stack frames unwound by longjmp. Hurd version.
- Copyright (C) 1995, 1996, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995,1996,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,7 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <setjmp.h>
+#include <jmpbuf-unwind.h>
#include <hurd/userlink.h>
#include <hurd/signal.h>
#include <hurd/sigpreempt.h>
@@ -26,7 +26,7 @@
#ifndef _JMPBUF_UNWINDS
-#error "<bits/setjmp.h> fails to define _JMPBUF_UNWINDS"
+#error "<jmpbuf-unwind.h> fails to define _JMPBUF_UNWINDS"
#endif
static inline uintptr_t
diff --git a/sysdeps/mach/hurd/powerpc/longjmp-ts.c b/sysdeps/mach/hurd/powerpc/longjmp-ts.c
index 4a59f16aa8..757366bc47 100644
--- a/sysdeps/mach/hurd/powerpc/longjmp-ts.c
+++ b/sysdeps/mach/hurd/powerpc/longjmp-ts.c
@@ -1,5 +1,5 @@
/* Perform a `longjmp' on a Mach thread_state. PowerPC version.
- Copyright (C) 1991,94,95,97,2001 Free Software Foundation, Inc.
+ Copyright (C) 1991,94,95,97,2001, 2006 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
@@ -19,6 +19,7 @@
#include <hurd/signal.h>
#include <setjmp.h>
+#include <jmpbuf-offsets.h>
#include <mach/thread_status.h>
diff --git a/sysdeps/mach/hurd/ppoll.c b/sysdeps/mach/hurd/ppoll.c
new file mode 100644
index 0000000000..693bc13839
--- /dev/null
+++ b/sysdeps/mach/hurd/ppoll.c
@@ -0,0 +1,30 @@
+/* poll file descriptors. Hurd version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/poll.h>
+#include <sys/time.h>
+#include <hurd.h>
+#include <hurd/fd.h>
+
+int
+ppoll (struct pollfd *fds, nfds_t nfds,
+ const struct timespec *timeout, const sigset_t *sigmask)
+{
+ return _hurd_select (nfds, fds, NULL, NULL, NULL, timeout, sigmask);
+}
diff --git a/sysdeps/mips/bits/setjmp.h b/sysdeps/mips/bits/setjmp.h
index 5f7c82b864..4f159c4988 100644
--- a/sysdeps/mips/bits/setjmp.h
+++ b/sysdeps/mips/bits/setjmp.h
@@ -1,5 +1,5 @@
/* Define the machine-dependent type `jmp_buf'. MIPS version.
- Copyright (C) 1992, 1993, 1995, 1997, 2000, 2002, 2003, 2004, 2005
+ Copyright (C) 1992,1993,1995,1997,2000,2002,2003,2004,2005,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -72,15 +72,4 @@ typedef struct
#endif
} __jmp_buf[1];
-#ifdef __USE_MISC
-/* Offset to the program counter in `jmp_buf'. */
-# define JB_PC 0
-#endif
-
-
-/* Test if longjmp to JMPBUF would unwind the frame
- containing a local variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
- ((void *) (address) < (void *) demangle ((jmpbuf)[0].__sp))
-
#endif /* _MIPS_BITS_SETJMP_H */
diff --git a/sysdeps/mips/fpu/libm-test-ulps b/sysdeps/mips/fpu/libm-test-ulps
index 73172b49a0..b514496676 100644
--- a/sysdeps/mips/fpu/libm-test-ulps
+++ b/sysdeps/mips/fpu/libm-test-ulps
@@ -17,12 +17,12 @@ float: 1
ifloat: 1
# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 7
idouble: 1
ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 3
idouble: 1
diff --git a/nptl/sysdeps/mips/jmpbuf-unwind.h b/sysdeps/mips/jmpbuf-unwind.h
index 9ee03100e6..bfa1a64537 100644
--- a/nptl/sysdeps/mips/jmpbuf-unwind.h
+++ b/sysdeps/mips/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2005, 2006 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
@@ -21,6 +21,11 @@
#include <unwind.h>
#include <sysdep.h>
+/* Test if longjmp to JMPBUF would unwind the frame
+ containing a local variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+ ((void *) (address) < (void *) demangle ((jmpbuf)[0].__sp))
+
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
diff --git a/sysdeps/powerpc/Implies b/sysdeps/powerpc/Implies
index 12ca48b4c9..7ccf9a7c4a 100644
--- a/sysdeps/powerpc/Implies
+++ b/sysdeps/powerpc/Implies
@@ -1,2 +1,4 @@
-ieee754/flt-32
+# On PowerPC we use the IBM extended long double format.
+ieee754/ldbl-128ibm
ieee754/dbl-64
+ieee754/flt-32
diff --git a/sysdeps/powerpc/bits/setjmp.h b/sysdeps/powerpc/bits/setjmp.h
index 6b35fb440b..9c3e22abac 100644
--- a/sysdeps/powerpc/bits/setjmp.h
+++ b/sysdeps/powerpc/bits/setjmp.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 1998, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,2003,2004,2005,2006
+ 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
@@ -31,30 +32,6 @@
#include <bits/wordsize.h>
-#if defined __USE_MISC || defined _ASM
-# define JB_GPR1 0 /* Also known as the stack pointer */
-# define JB_GPR2 1
-# define JB_LR 2 /* The address we will return to */
-# if __WORDSIZE == 64
-# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18*2 words total. */
-# define JB_CR 21 /* Condition code registers with the VRSAVE at */
- /* offset 172 (low half of the double word. */
-# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */
-# define JB_SIZE (64 * 8) /* As per PPC64-VMX ABI. */
-# define JB_VRSAVE 21 /* VRSAVE shares a double word with the CR at offset */
- /* 168 (high half of the double word). */
-# define JB_VRS 40 /* VRs 20 through 31 are saved, 12*4 words total. */
-# else
-# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total. */
-# define JB_CR 21 /* Condition code registers. */
-# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */
-# define JB_SIZE ((64 + (12 * 4)) * 4)
-# define JB_VRSAVE 62
-# define JB_VRS 64
-# endif
-#endif
-
-
/* The current powerpc 32-bit Altivec ABI specifies for SVR4 ABI and EABI
the vrsave must be at byte 248 & v20 at byte 256. So we must pad this
correctly on 32 bit. It also insists that vecregs are only gauranteed
@@ -72,9 +49,4 @@ typedef long int __jmp_buf[64 + (12 * 4)] __attribute__ ((__aligned__ (16)));
# endif
#endif
-/* Test if longjmp to JMPBUF would unwind the frame
- containing a local variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
- ((void *) (address) < (void *) demangle ((jmpbuf)[JB_GPR1]))
-
#endif /* bits/setjmp.h */
diff --git a/sysdeps/powerpc/fpu/bits/mathdef.h b/sysdeps/powerpc/fpu/bits/mathdef.h
index 3a9d538ee4..b79cc6ff96 100644
--- a/sysdeps/powerpc/fpu/bits/mathdef.h
+++ b/sysdeps/powerpc/fpu/bits/mathdef.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997,1998,1999,2000,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2003,2004,2006
+ 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
@@ -61,9 +62,3 @@ typedef double double_t;
# define FP_ILOGBNAN (2147483647)
#endif /* ISO C99 */
-
-#ifndef __NO_LONG_DOUBLE_MATH
-/* Signal that we do not really have a `long double'. The disables the
- declaration of all the `long double' function variants. */
-# define __NO_LONG_DOUBLE_MATH 1
-#endif
diff --git a/sysdeps/powerpc/fpu/bits/mathinline.h b/sysdeps/powerpc/fpu/bits/mathinline.h
index 44f7dbec52..15da56384e 100644
--- a/sysdeps/powerpc/fpu/bits/mathinline.h
+++ b/sysdeps/powerpc/fpu/bits/mathinline.h
@@ -1,5 +1,5 @@
/* Inline math functions for powerpc.
- Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004
+ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -123,12 +123,18 @@ __NTH (fdimf (float __x, float __y))
#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
/* This code is used internally in the GNU libc. */
-# ifdef __LIBC_INTERNAL_MATH_INLINES
+#ifdef __LIBC_INTERNAL_MATH_INLINES
#include <sysdep.h>
#include <ldsodefs.h>
#include <dl-procinfo.h>
+# if __WORDSIZE == 64
+# define __CPU_HAS_FSQRT 1
+# else
+# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
+# endif
+
extern double __slow_ieee754_sqrt (double);
__MATH_INLINE double
__NTH (__ieee754_sqrt (double __x))
@@ -136,7 +142,7 @@ __NTH (__ieee754_sqrt (double __x))
double __z;
/* If the CPU is 64-bit we can use the optional FP instructions we. */
- if ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
+ if (__CPU_HAS_FSQRT)
{
/* Volatile is required to prevent the compiler from moving the
fsqrt instruction above the branch. */
@@ -158,7 +164,7 @@ __NTH (__ieee754_sqrtf (float __x))
float __z;
/* If the CPU is 64-bit we can use the optional FP instructions we. */
- if ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
+ if (__CPU_HAS_FSQRT)
{
/* Volatile is required to prevent the compiler from moving the
fsqrts instruction above the branch. */
@@ -172,5 +178,5 @@ __NTH (__ieee754_sqrtf (float __x))
return __z;
}
-# endif /* __LIBC_INTERNAL_MATH_INLINES */
+#endif /* __LIBC_INTERNAL_MATH_INLINES */
#endif /* __GNUC__ && !_SOFT_FLOAT */
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index 0b57006d40..1005421ec0 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -1,6 +1,19 @@
# Begin of automatic generation
+# acos
+Test "acos (2e-17) == 1.57079632679489659923132169163975144":
+ildouble: 1
+ldouble: 1
+
+# asin
+Test "asin (0.75) == 0.848062078981481008052944338998418080":
+ildouble: 2
+ldouble: 2
+
# atan2
+Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
+ildouble: 1
+ldouble: 1
Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
float: 1
ifloat: 1
@@ -10,25 +23,28 @@ ifloat: 1
Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
# atanh
Test "atanh (0.75) == 0.972955074527656652552676371721589865":
float: 1
ifloat: 1
+# cabs
+Test "cabs (0.75 + 1.25 i) == 1.45773797371132511771853821938639577":
+ildouble: 1
+ldouble: 1
+
# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
-double: 1
-float: 7
-idouble: 1
-ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
-double: 1
-float: 3
-idouble: 1
-ifloat: 3
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+float: 1
+ifloat: 1
# casin
+Test "Real part of: casin (-2 - 3 i) == -0.57065278432109940071028387968566963 - 1.9833870299165354323470769028940395 i":
+ildouble: 1
+ldouble: 1
Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
double: 1
float: 1
@@ -41,11 +57,15 @@ double: 5
float: 1
idouble: 5
ifloat: 1
+ildouble: 4
+ldouble: 4
Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
double: 3
float: 6
idouble: 3
ifloat: 6
+ildouble: 1
+ldouble: 1
Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
float: 1
ifloat: 1
@@ -57,30 +77,21 @@ ifloat: 1
# catan
Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
-float: 3
-ifloat: 3
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
double: 1
float: 1
idouble: 1
ifloat: 1
-Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
-float: 4
-ifloat: 4
# catanh
Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
double: 4
idouble: 4
-Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
-float: 4
-ifloat: 4
Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
double: 1
idouble: 1
-Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
-float: 6
-ifloat: 6
# cbrt
Test "cbrt (-27.0) == -3.0":
@@ -115,9 +126,13 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
float: 1
ifloat: 1
+ildouble: 2
+ldouble: 2
# cexp
Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
@@ -126,101 +141,175 @@ ifloat: 1
Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
float: 1
ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+ildouble: 1
+ldouble: 1
# clog
Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
-float: 3
-ifloat: 3
+ildouble: 1
+ldouble: 1
Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
float: 1
ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
+ildouble: 1
+ldouble: 1
# clog10
Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
double: 1
-float: 5
idouble: 1
-ifloat: 5
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*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
+idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
float: 1
ifloat: 1
+ildouble: 2
+ldouble: 2
Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*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
+idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
# cos
Test "cos (M_PI_6l * 2.0) == 0.5":
double: 1
-float: 1
idouble: 1
-ifloat: 1
Test "cos (M_PI_6l * 4.0) == -0.5":
double: 2
float: 1
idouble: 2
ifloat: 1
-Test "cos (pi/2) == 0":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
# cpow
Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
double: 1
float: 4
idouble: 1
ifloat: 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 "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
double: 2
float: 3
idouble: 2
ifloat: 3
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 1
+ldouble: 1
Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
double: 1
float: 5
@@ -229,11 +318,15 @@ ifloat: 5
Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
float: 2
ifloat: 2
+ildouble: 2
+ldouble: 2
Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
double: 2
float: 2
idouble: 2
ifloat: 2
+ildouble: 2
+ldouble: 2
# csinh
Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
@@ -242,9 +335,13 @@ idouble: 1
Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
# csqrt
Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
@@ -255,9 +352,9 @@ float: 1
ifloat: 1
# ctan
-Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
-double: 1
-idouble: 1
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
double: 1
idouble: 1
@@ -274,6 +371,8 @@ 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
# erf
Test "erf (1.25) == 0.922900128256458230136523481197281140":
@@ -291,29 +390,50 @@ Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
double: 1
idouble: 1
+# exp
+Test "exp (0.75) == 2.11700001661267466854536981983709561":
+ildouble: 1
+ldouble: 1
+Test "exp (50.0) == 5184705528587072464087.45332293348538":
+ildouble: 1
+ldouble: 1
+
# exp10
Test "exp10 (-1) == 0.1":
double: 2
float: 1
idouble: 2
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "exp10 (0.75) == 5.62341325190349080394951039776481231":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "exp10 (3) == 1000":
double: 6
float: 2
idouble: 6
ifloat: 2
+ildouble: 8
+ldouble: 8
+
+# exp2
+Test "exp2 (10) == 1024":
+ildouble: 2
+ldouble: 2
# expm1
Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
double: 1
idouble: 1
Test "expm1 (1) == M_El - 1.0":
+double: 1
float: 1
+idouble: 1
ifloat: 1
# hypot
@@ -335,6 +455,9 @@ ifloat: 1
Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
float: 1
ifloat: 1
+Test "hypot (0.75, 1.25) == 1.45773797371132511771853821938639577":
+ildouble: 1
+ldouble: 1
Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
float: 1
ifloat: 1
@@ -345,84 +468,121 @@ ifloat: 1
# j0
Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
double: 1
-float: 2
+float: 1
idouble: 1
-ifloat: 2
-Test "j0 (2.0) == 0.223890779141235668051827454649948626":
-float: 2
-ifloat: 2
+ifloat: 1
+ildouble: 43515227266289159395415763648
+ldouble: 43515227266289159395415763648
Test "j0 (10.0) == -0.245935764451348335197760862485328754":
-double: 3
+double: 2
float: 1
-idouble: 3
+idouble: 2
ifloat: 1
+ildouble: 17369667313819348747894233118595
+ldouble: 17369667313819348747894233118595
+Test "j0 (2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
double: 1
-float: 2
+float: 1
idouble: 1
-ifloat: 2
+ifloat: 1
+ildouble: 43515227266289159395415763648
+ldouble: 43515227266289159395415763648
Test "j0 (8.0) == 0.171650807137553906090869407851972001":
float: 1
ifloat: 1
+ildouble: 38324122909174090074461780712157
+ldouble: 38324122909174090074461780712157
# j1
Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
float: 2
ifloat: 2
+ildouble: 21475644881377747614143400473061
+ldouble: 21475644881377747614143400473061
Test "j1 (2.0) == 0.576724807756873387202448242269137087":
double: 1
idouble: 1
Test "j1 (8.0) == 0.234636346853914624381276651590454612":
double: 1
idouble: 1
+ildouble: 1790984160474480772420978558547
+ldouble: 1790984160474480772420978558547
# jn
Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
double: 1
-float: 2
+float: 1
idouble: 1
-ifloat: 2
-Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
-float: 2
-ifloat: 2
+ifloat: 1
+ildouble: 43515227266289159395415763648
+ldouble: 43515227266289159395415763648
Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
-double: 3
+double: 2
float: 1
-idouble: 3
+idouble: 2
ifloat: 1
+ildouble: 17369667313819348747894233118595
+ldouble: 17369667313819348747894233118595
+Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
double: 1
-float: 2
+float: 1
idouble: 1
-ifloat: 2
+ifloat: 1
+ildouble: 43515227266289159395415763648
+ldouble: 43515227266289159395415763648
Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
float: 1
ifloat: 1
+ildouble: 38324122909174090074461780712157
+ldouble: 38324122909174090074461780712157
Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
float: 2
ifloat: 2
+ildouble: 21475644881377747614143400473061
+ldouble: 21475644881377747614143400473061
Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
double: 1
idouble: 1
Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
double: 1
idouble: 1
+ildouble: 1790984160474480772420978558547
+ldouble: 1790984160474480772420978558547
+Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
double: 1
float: 1
idouble: 1
ifloat: 1
+Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
float: 1
ifloat: 1
+ildouble: 24853547691922812960150086146551
+ldouble: 24853547691922812960150086146551
Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
float: 4
ifloat: 4
+Test "jn (3, -1.0) == -0.0195633539826684059189053216217515083":
+ildouble: 1
+ldouble: 1
Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4":
double: 1
float: 1
@@ -431,16 +591,23 @@ ifloat: 1
Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2":
double: 1
idouble: 1
+Test "jn (3, 1.0) == 0.0195633539826684059189053216217515083":
+ildouble: 1
+ldouble: 1
Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
double: 3
-float: 2
+float: 1
idouble: 3
-ifloat: 2
+ifloat: 1
+ildouble: 47549060992978485557887362065694
+ldouble: 47549060992978485557887362065694
Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 2
+ldouble: 2
# lgamma
Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
@@ -453,6 +620,8 @@ double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 3
+ldouble: 3
# log10
Test "log10 (0.75) == -0.124938736608299953132449886193870744":
@@ -469,30 +638,41 @@ Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
float: 1
ifloat: 1
+# log2
+Test "log2 (e) == M_LOG2El":
+ildouble: 1
+ldouble: 1
+
# sincos
Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
double: 1
-float: 1
idouble: 1
-ifloat: 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
-Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
float: 1
ifloat: 1
+# sinh
+Test "sinh (0.75) == 0.822316731935829980703661634446913849":
+ildouble: 1
+ldouble: 1
+
# tan
Test "tan (pi/4) == 1":
-double: 1
-idouble: 1
+ildouble: 1
+ldouble: 1
+
+# tanh
+Test "tanh (-0.75) == -0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (0.75) == 0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
# tgamma
Test "tgamma (-0.5) == -2 sqrt (pi)":
@@ -510,29 +690,33 @@ idouble: 1
ifloat: 1
# y0
+Test "y0 (0.75) == -0.137172769385772397522814379396581855":
+ildouble: 1
+ldouble: 1
Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
double: 2
float: 1
idouble: 2
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "y0 (1.5) == 0.382448923797758843955068554978089862":
double: 2
float: 1
idouble: 2
ifloat: 1
Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
-double: 1
float: 1
-idouble: 1
ifloat: 1
-Test "y0 (2.0) == 0.510375672649745119596606592727157873":
-double: 1
-idouble: 1
+ildouble: 17987982955981951215498976719132
+ldouble: 17987982955981951215498976719132
Test "y0 (8.0) == 0.223521489387566220527323400498620359":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 59420910818072525464695270081
+ldouble: 59420910818072525464695270081
# y1
Test "y1 (0.125) == -5.19993611253477499595928744876579921":
@@ -546,6 +730,8 @@ double: 3
float: 1
idouble: 3
ifloat: 1
+ildouble: 17166751991147634677444869275635
+ldouble: 17166751991147634677444869275635
Test "y1 (2.0) == -0.107032431540937546888370772277476637":
double: 1
float: 1
@@ -556,42 +742,50 @@ double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 3843427930176871148105186605483
+ldouble: 3843427930176871148105186605483
# yn
+Test "yn (0, 0.75) == -0.137172769385772397522814379396581855":
+ildouble: 1
+ldouble: 1
Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
double: 2
float: 1
idouble: 2
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
double: 2
float: 1
idouble: 2
ifloat: 1
Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
-double: 1
float: 1
-idouble: 1
ifloat: 1
-Test "yn (0, 2.0) == 0.510375672649745119596606592727157873":
-double: 1
-idouble: 1
+ildouble: 17987982955981951215498976719132
+ldouble: 17987982955981951215498976719132
Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 59420910818072525464695270081
+ldouble: 59420910818072525464695270081
Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
double: 1
idouble: 1
Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
-float: 2
-ifloat: 2
+float: 1
+ifloat: 1
Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
double: 3
float: 1
idouble: 3
ifloat: 1
+ildouble: 17166751991147634677444869275635
+ldouble: 17166751991147634677444869275635
Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
double: 1
float: 1
@@ -602,9 +796,8 @@ double: 1
float: 2
idouble: 1
ifloat: 2
-Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
-double: 1
-idouble: 1
+ildouble: 3843427930176871148105186605483
+ldouble: 3843427930176871148105186605483
Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
double: 1
idouble: 1
@@ -618,14 +811,19 @@ float: 2
ifloat: 2
Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
double: 2
-float: 2
idouble: 2
-ifloat: 2
+ildouble: 799631964554876895122912847384
+ldouble: 799631964554876895122912847384
Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
-double: 3
+double: 2
float: 1
-idouble: 3
+idouble: 2
ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
+double: 1
+idouble: 1
Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
float: 1
ifloat: 1
@@ -634,182 +832,286 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 6997306768128814818664001056622
+ldouble: 6997306768128814818664001056622
Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
double: 1
idouble: 1
# Maximal error of functions:
+Function: "acos":
+ildouble: 1
+ldouble: 1
+
+Function: "acosh":
+ildouble: 1
+ldouble: 1
+
+Function: "asin":
+ildouble: 2
+ldouble: 2
+
+Function: "asinh":
+ildouble: 1
+ldouble: 1
+
Function: "atan2":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: "atanh":
float: 1
ifloat: 1
+Function: "cabs":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cacos":
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "cacos":
+ildouble: 1
+ldouble: 1
+
Function: Real part of "cacosh":
-double: 1
-float: 7
-idouble: 1
-ifloat: 7
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "cacosh":
-double: 1
-float: 3
-idouble: 1
-ifloat: 3
+float: 1
+ifloat: 1
Function: Real part of "casin":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "casin":
+ildouble: 1
+ldouble: 1
Function: Real part of "casinh":
double: 5
float: 1
idouble: 5
ifloat: 1
+ildouble: 4
+ldouble: 4
Function: Imaginary part of "casinh":
double: 3
float: 6
idouble: 3
ifloat: 6
+ildouble: 1
+ldouble: 1
Function: Real part of "catan":
-float: 4
-ifloat: 4
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "catan":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Real part of "catanh":
double: 4
idouble: 4
-Function: Imaginary part of "catanh":
-float: 6
-ifloat: 6
-
Function: "cbrt":
double: 1
idouble: 1
+ildouble: 1
+ldouble: 1
Function: Real part of "ccos":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "ccos":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Real part of "ccosh":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "ccosh":
float: 1
ifloat: 1
+ildouble: 2
+ldouble: 2
Function: Real part of "cexp":
float: 1
ifloat: 1
+ildouble: 2
+ldouble: 2
Function: Imaginary part of "cexp":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Real part of "clog":
float: 1
ifloat: 1
+ildouble: 2
+ldouble: 2
Function: Imaginary part of "clog":
-float: 3
-ifloat: 3
+ildouble: 1
+ldouble: 1
Function: Real part of "clog10":
float: 1
ifloat: 1
+ildouble: 2
+ldouble: 2
Function: Imaginary part of "clog10":
double: 1
-float: 5
+float: 1
idouble: 1
-ifloat: 5
+ifloat: 1
+ildouble: 1
+ldouble: 1
Function: "cos":
double: 2
float: 1
idouble: 2
ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "cosh":
+ildouble: 1
+ldouble: 1
Function: Real part of "cpow":
double: 2
float: 5
idouble: 2
ifloat: 5
+ildouble: 2
+ldouble: 2
Function: Imaginary part of "cpow":
double: 2
float: 2
idouble: 2
ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "cproj":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csin":
+ildouble: 1
+ldouble: 1
Function: Real part of "csinh":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "csinh":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Real part of "csqrt":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csqrt":
+ildouble: 1
+ldouble: 1
Function: Real part of "ctan":
-double: 1
-idouble: 1
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "ctan":
double: 1
idouble: 1
+ildouble: 1
+ldouble: 1
Function: Real part of "ctanh":
double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "ctanh":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: "erf":
double: 1
idouble: 1
+ildouble: 1
+ldouble: 1
Function: "erfc":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "exp":
+ildouble: 1
+ldouble: 1
Function: "exp10":
double: 6
float: 2
idouble: 6
ifloat: 2
+ildouble: 8
+ldouble: 8
+
+Function: "exp2":
+ildouble: 2
+ldouble: 2
Function: "expm1":
double: 1
@@ -817,76 +1119,130 @@ float: 1
idouble: 1
ifloat: 1
+Function: "gamma":
+ildouble: 1
+ldouble: 1
+
Function: "hypot":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: "j0":
-double: 3
+double: 2
float: 2
-idouble: 3
+idouble: 2
ifloat: 2
+ildouble: 38324122909174090074461780712157
+ldouble: 38324122909174090074461780712157
Function: "j1":
double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 21475644881377747614143400473061
+ldouble: 21475644881377747614143400473061
Function: "jn":
double: 3
float: 4
idouble: 3
ifloat: 4
+ildouble: 47549060992978485557887362065694
+ldouble: 47549060992978485557887362065694
Function: "lgamma":
double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: "log":
+ildouble: 1
+ldouble: 1
Function: "log10":
double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 1
+ldouble: 1
Function: "log1p":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2":
+ildouble: 1
+ldouble: 1
+
+Function: "pow":
+ildouble: 1
+ldouble: 1
+
+Function: "sin":
+ildouble: 1
+ldouble: 1
Function: "sincos":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sinh":
+ildouble: 1
+ldouble: 1
Function: "tan":
double: 1
idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "tanh":
+ildouble: 1
+ldouble: 1
Function: "tgamma":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: "y0":
double: 2
float: 1
idouble: 2
ifloat: 1
+ildouble: 17987982955981951215498976719132
+ldouble: 17987982955981951215498976719132
Function: "y1":
double: 3
float: 2
idouble: 3
ifloat: 2
+ildouble: 3843427930176871148105186605483
+ldouble: 3843427930176871148105186605483
Function: "yn":
double: 3
float: 2
idouble: 3
ifloat: 2
+ildouble: 3843427930176871148105186605483
+ldouble: 3843427930176871148105186605483
# end of automatic generation
diff --git a/sysdeps/powerpc/fpu/s_isnan.c b/sysdeps/powerpc/fpu/s_isnan.c
index 38ec821cc3..f3313c7b08 100644
--- a/sysdeps/powerpc/fpu/s_isnan.c
+++ b/sysdeps/powerpc/fpu/s_isnan.c
@@ -1,5 +1,5 @@
/* Return 1 if argument is a NaN, else 0.
- Copyright (C) 1997, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2000, 2002, 2006 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
@@ -23,6 +23,7 @@
#define __GI___isnanf __GI___Xisnanf
#include "math.h"
+#include <math_ldbl_opt.h>
#include <fenv_libc.h>
#undef __isnanf
diff --git a/sysdeps/powerpc/jmpbuf-offsets.h b/sysdeps/powerpc/jmpbuf-offsets.h
new file mode 100644
index 0000000000..5f74a85af6
--- /dev/null
+++ b/sysdeps/powerpc/jmpbuf-offsets.h
@@ -0,0 +1,39 @@
+/* Private macros for accessing __jmp_buf contents. PowerPC version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define JB_GPR1 0 /* Also known as the stack pointer */
+#define JB_GPR2 1
+#define JB_LR 2 /* The address we will return to */
+#if __WORDSIZE == 64
+# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18*2 words total. */
+# define JB_CR 21 /* Condition code registers with the VRSAVE at */
+ /* offset 172 (low half of the double word. */
+# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */
+# define JB_SIZE (64 * 8) /* As per PPC64-VMX ABI. */
+# define JB_VRSAVE 21 /* VRSAVE shares a double word with the CR at offset */
+ /* 168 (high half of the double word). */
+# define JB_VRS 40 /* VRs 20 through 31 are saved, 12*4 words total. */
+#else
+# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total. */
+# define JB_CR 21 /* Condition code registers. */
+# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */
+# define JB_SIZE ((64 + (12 * 4)) * 4)
+# define JB_VRSAVE 62
+# define JB_VRS 64
+#endif
diff --git a/nptl/sysdeps/powerpc/jmpbuf-unwind.h b/sysdeps/powerpc/jmpbuf-unwind.h
index d9090a591d..20bab7560e 100644
--- a/nptl/sysdeps/powerpc/jmpbuf-unwind.h
+++ b/sysdeps/powerpc/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -18,10 +18,16 @@
02111-1307 USA. */
#include <setjmp.h>
+#include <jmpbuf-offsets.h>
#include <stdint.h>
#include <unwind.h>
#include <sysdep.h>
+/* Test if longjmp to JMPBUF would unwind the frame
+ containing a local variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+ ((void *) (address) < (void *) demangle ((jmpbuf)[JB_GPR1]))
+
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
@@ -38,5 +44,5 @@ _jmpbuf_sp (__jmp_buf regs)
#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
-/* We use the normal lobngjmp for unwinding. */
+/* We use the normal longjmp for unwinding. */
#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/powerpc/powerpc32/Implies b/sysdeps/powerpc/powerpc32/Implies
index 9ef3ac175b..39a34c5f57 100644
--- a/sysdeps/powerpc/powerpc32/Implies
+++ b/sysdeps/powerpc/powerpc32/Implies
@@ -1,2 +1 @@
wordsize-32
-powerpc/soft-fp
diff --git a/sysdeps/powerpc/powerpc32/__longjmp-common.S b/sysdeps/powerpc/powerpc32/__longjmp-common.S
index d3f5545579..411b6a20cb 100644
--- a/sysdeps/powerpc/powerpc32/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/__longjmp-common.S
@@ -1,6 +1,6 @@
/* longjmp for PowerPC.
- Copyright (C) 1995-1997, 1999-2001, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright (C) 1995-1997, 1999-2001, 2003, 2004, 2005, 2006
+ 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
@@ -20,11 +20,10 @@
#include <sysdep.h>
#define _ASM
-#define _SETJMP_H
#ifdef __NO_VMX__
# include <novmxsetjmp.h>
#else
-# include <bits/setjmp.h>
+# include <jmpbuf-offsets.h>
#endif
#include <bp-sym.h>
#include <bp-asm.h>
diff --git a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
index 644e626aa8..aa24b059d1 100644
--- a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
@@ -19,11 +19,10 @@
#include <sysdep.h>
#define _ASM
-#define _SETJMP_H
#ifdef __NO_VMX__
# include <novmxsetjmp.h>
#else
-# include <bits/setjmp.h>
+# include <jmpbuf-offsets.h>
#endif
#include <bp-sym.h>
#include <bp-asm.h>
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
index 2e0e6a87a9..bc74d302fb 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
@@ -18,6 +18,7 @@
02110-1301 USA. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
.section .rodata.cst4,"aM",@progbits,4
.align 2
@@ -77,3 +78,6 @@ weak_alias (__ceil, ceil)
weak_alias (__ceil, ceill)
strong_alias (__ceil, __ceill)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __ceil, ceill, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S b/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
index 39d7d1c770..dd68b0869c 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
@@ -21,6 +21,7 @@
when it's coded in C. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
ENTRY(__copysign)
/* double [f1] copysign (double [f1] x, double [f2] y);
@@ -32,6 +33,7 @@ ENTRY(__copysign)
lwz r3,8(r1)
cmpwi r3,0
addi r1,r1,16
+ cfi_adjust_cfa_offset (-16)
blt L(0)
fabs fp1,fp1
blr
@@ -49,3 +51,10 @@ strong_alias(__copysign,__copysignf)
weak_alias (__copysign,copysignl)
strong_alias(__copysign,__copysignl)
#endif
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __copysign, copysignl, GLIBC_2_0)
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __copysign, copysignl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S b/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S
new file mode 100644
index 0000000000..64b6a45437
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S
@@ -0,0 +1,50 @@
+/* Copy a sign bit between floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ENTRY(__copysignl)
+/* long double [f1,f2] copysign (long double [f1,f2] x, long double [f3,f4] y);
+ copysign(x,y) returns a value with the magnitude of x and
+ with the sign bit of y. */
+ stwu r1,-16(r1)
+ cfi_adjust_cfa_offset (16)
+ stfd fp3,8(r1)
+ fmr fp0,fp1
+ fabs fp1,fp1
+ fcmpu cr7,fp0,fp1
+ lwz r3,8(r1)
+ cmpwi cr6,r3,0
+ addi r1,r1,16
+ cfi_adjust_cfa_offset (-16)
+ beq cr7,L(0)
+ fneg fp2,fp2
+L(0): bgelr cr6
+ fneg fp1,fp1
+ fneg fp2,fp2
+ blr
+END (__copysignl)
+
+#ifdef IS_IN_libm
+long_double_symbol (libm, __copysignl, copysignl)
+#else
+long_double_symbol (libc, __copysignl, copysignl)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fabs.S b/sysdeps/powerpc/powerpc32/fpu/s_fabs.S
new file mode 100644
index 0000000000..53d21301ee
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_fabs.S
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fabs.S>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fabs, fabsl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fabsl.S b/sysdeps/powerpc/powerpc32/fpu/s_fabsl.S
new file mode 100644
index 0000000000..3655e5b2f3
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_fabsl.S
@@ -0,0 +1,36 @@
+/* Copy a sign bit between floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2004, 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ENTRY(__fabsl)
+/* long double [f1,f2] fabs (long double [f1,f2] x);
+ fabs(x,y) returns a value with the magnitude of x and
+ with the sign bit of y. */
+ fmr fp0,fp1
+ fabs fp1,fp1
+ fcmpu cr1,fp0,fp1
+ beqlr cr1
+ fneg fp2,fp2
+ blr
+END (__fabsl)
+
+long_double_symbol (libm, __fabsl, fabsl)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fdim.c b/sysdeps/powerpc/powerpc32/fpu/s_fdim.c
new file mode 100644
index 0000000000..e34b51ee54
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_fdim.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fdim.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fdim, fdiml, GLIBC_2_1);
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floor.S b/sysdeps/powerpc/powerpc32/fpu/s_floor.S
index 5942d09181..a29e4791ea 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_floor.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_floor.S
@@ -18,6 +18,7 @@
02110-1301 USA. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
.section .rodata.cst4,"aM",@progbits,4
.align 2
@@ -77,3 +78,6 @@ weak_alias (__floor, floor)
weak_alias (__floor, floorl)
strong_alias (__floor, __floorl)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __floor, floorl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fmax.S b/sysdeps/powerpc/powerpc32/fpu/s_fmax.S
new file mode 100644
index 0000000000..69735761ab
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_fmax.S
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fmax.S>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fmax, fmaxl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fmin.S b/sysdeps/powerpc/powerpc32/fpu/s_fmin.S
new file mode 100644
index 0000000000..6d4a0a946c
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_fmin.S
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fmin.S>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fmin, fminl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_isnan.c b/sysdeps/powerpc/powerpc32/fpu/s_isnan.c
new file mode 100644
index 0000000000..397717ba9c
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_isnan.c
@@ -0,0 +1,7 @@
+#include <sysdeps/powerpc/fpu/s_isnan.c>
+#ifndef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
+compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
+# endif
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_llrint.c b/sysdeps/powerpc/powerpc32/fpu/s_llrint.c
index 7fdc296b0b..cb96be7c9b 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_llrint.c
+++ b/sysdeps/powerpc/powerpc32/fpu/s_llrint.c
@@ -1,5 +1,5 @@
/* Round a double value to a long long in the current rounding mode.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,7 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include "math.h"
+#include <math.h>
+#include <math_ldbl_opt.h>
long long int
__llrint (double x)
@@ -29,3 +30,6 @@ weak_alias (__llrint, llrint)
strong_alias (__llrint, __llrintl)
weak_alias (__llrint, llrintl)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __llrint, llrintl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lrint.S b/sysdeps/powerpc/powerpc32/fpu/s_lrint.S
index 57d56c48cd..55e9de7e2a 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_lrint.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_lrint.S
@@ -1,5 +1,5 @@
/* Round double to long int. PowerPC32 version.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 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
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
/* long int[r3] __lrint (double x[fp1]) */
ENTRY (__lrint)
@@ -39,3 +40,6 @@ weak_alias (__lrint, lrintf)
strong_alias (__lrint, __lrintl)
weak_alias (__lrint, lrintl)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __lrint, lrintl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lround.S b/sysdeps/powerpc/powerpc32/fpu/s_lround.S
index 67e58848d0..9c534ec2be 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_lround.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_lround.S
@@ -18,6 +18,7 @@
02110-1301 USA. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
.section .rodata.cst8,"aM",@progbits,8
.align 2
@@ -93,3 +94,6 @@ weak_alias (__lround, lroundf)
weak_alias (__lround, lroundl)
strong_alias (__lround, __lroundl)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __lround, lroundl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rint.S b/sysdeps/powerpc/powerpc32/fpu/s_rint.S
index 041cb58b84..c8dca313ae 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_rint.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_rint.S
@@ -21,6 +21,7 @@
when it's coded in C. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
.section .rodata.cst4,"aM",@progbits,4
.align 2
@@ -73,3 +74,6 @@ weak_alias (__rint, rint)
weak_alias (__rint, rintl)
strong_alias (__rint, __rintl)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __rint, rintl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_round.S b/sysdeps/powerpc/powerpc32/fpu/s_round.S
index 04ba9422d9..590c87ad8c 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_round.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_round.S
@@ -18,6 +18,7 @@
02110-1301 USA. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
.section .rodata.cst8,"aM",@progbits,8
.align 2
@@ -97,3 +98,6 @@ weak_alias (__round, round)
weak_alias (__round, roundl)
strong_alias (__round, __roundl)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __round, roundl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
index 4ea4e074c8..5bc0856b9f 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
@@ -18,6 +18,7 @@
02110-1301 USA. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
.section .rodata.cst4,"aM",@progbits,4
.align 2
@@ -65,7 +66,7 @@ ENTRY (__trunc)
fsub fp1,fp1,fp13 /* x-= TWO52; */
fabs fp1,fp1 /* if (x == 0.0) */
/* x = 0.0; */
- mtfsf 0x01,fp11 /* restore previous truncing mode. */
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
blr
.L4:
bge- cr6,.L9 /* if (x < 0.0) */
@@ -84,3 +85,6 @@ weak_alias (__trunc, trunc)
weak_alias (__trunc, truncl)
strong_alias (__trunc, __truncl)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __trunc, truncl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
index 0005d50160..e2e3bd6740 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
@@ -65,7 +65,7 @@ ENTRY (__truncf)
fsubs fp1,fp1,fp13 /* x-= TWO23; */
fabs fp1,fp1 /* if (x == 0.0) */
/* x = 0.0; */
- mtfsf 0x01,fp11 /* restore previous truncing mode. */
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
blr
.L4:
bge- cr6,.L9 /* if (x < 0.0) */
diff --git a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
index e38c7b8d6e..851480d2ef 100644
--- a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
@@ -19,11 +19,10 @@
#include <sysdep.h>
#define _ASM
-#define _SETJMP_H
#ifdef __NO_VMX__
# include <novmxsetjmp.h>
#else
-# include <bits/setjmp.h>
+# include <jmpbuf-offsets.h>
#endif
#include <bp-sym.h>
#include <bp-asm.h>
diff --git a/sysdeps/powerpc/powerpc32/setjmp-common.S b/sysdeps/powerpc/powerpc32/setjmp-common.S
index 69d36cce03..12ee14d788 100644
--- a/sysdeps/powerpc/powerpc32/setjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/setjmp-common.S
@@ -1,5 +1,5 @@
/* setjmp for PowerPC.
- Copyright (C) 1995-1997,1999-2001,2003,2004,2005
+ Copyright (C) 1995-1997,1999-2001,2003,2004,2005, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -20,11 +20,10 @@
#include <sysdep.h>
#define _ASM
-#define _SETJMP_H
#ifdef __NO_VMX__
# include <novmxsetjmp.h>
#else
-# include <bits/setjmp.h>
+# include <jmpbuf-offsets.h>
#endif
#include <bp-sym.h>
#include <bp-asm.h>
diff --git a/sysdeps/powerpc/powerpc64/__longjmp-common.S b/sysdeps/powerpc/powerpc64/__longjmp-common.S
index bf7e32446d..31b1af34f9 100644
--- a/sysdeps/powerpc/powerpc64/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc64/__longjmp-common.S
@@ -1,6 +1,6 @@
/* longjmp for PowerPC64.
- Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996,1997,1999,2000,2001,2002,2003,2004,2005,2006
+ 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
@@ -24,7 +24,7 @@
#ifdef __NO_VMX__
# include <novmxsetjmp.h>
#else
-# include <bits/setjmp.h>
+# include <jmpbuf-offsets.h>
#endif
#include <bp-sym.h>
#include <bp-asm.h>
diff --git a/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c
new file mode 100644
index 0000000000..0a229cbe27
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c
@@ -0,0 +1,29 @@
+/* Double-precision floating point square root.
+ Copyright (C) 1997, 2002, 2003, 2004, 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <math_private.h>
+
+double
+__ieee754_sqrt (double x)
+{
+ double z;
+ __asm __volatile ("fsqrt %0,%1" : "=f" (z) : "f" (x));
+ return z;
+}
diff --git a/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c
new file mode 100644
index 0000000000..0f17a64a8a
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c
@@ -0,0 +1,29 @@
+/* Single-precision floating point square root.
+ Copyright (C) 1997, 2003, 2004, 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <math_private.h>
+
+float
+__ieee754_sqrtf (float x)
+{
+ double z;
+ __asm ("fsqrts %0,%1" : "=f" (z) : "f" (x));
+ return z;
+}
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceil.S b/sysdeps/powerpc/powerpc64/fpu/s_ceil.S
index 9809e24d26..02b70940ee 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_ceil.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_ceil.S
@@ -1,5 +1,5 @@
/* ceil function. PowerPC64 version.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 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
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
.section ".toc","aw"
.LC0: /* 2**52 */
@@ -58,3 +59,6 @@ weak_alias (__ceil, ceil)
weak_alias (__ceil, ceill)
strong_alias (__ceil, __ceill)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __ceil, ceill, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceill.S b/sysdeps/powerpc/powerpc64/fpu/s_ceill.S
new file mode 100644
index 0000000000..a8f8a0afc5
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_ceill.S
@@ -0,0 +1,133 @@
+/* s_ceill.S IBM extended format long double version.
+ Copyright (C) 2004, 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ .section ".toc","aw"
+.LC0: /* 2**52 */
+ .tc FD_43300000_0[TC],0x4330000000000000
+
+ .section ".text"
+
+/* long double [fp1,fp2] ceill (long double x [fp1,fp2])
+ IEEE 1003.1 ceil function.
+
+ PowerPC64 long double uses the IBM extended format which is
+ represented two 64-floating point double values. The values are
+ non-overlapping giving an effective precision of 106 bits. The first
+ double contains the high order bits of mantisa and is always ceiled
+ to represent a normal ceiling of long double to double. Since the
+ long double value is sum of the high and low values, the low double
+ normally has the opposite sign to compensate for the this ceiling.
+
+ For long double there are two cases:
+ 1) |x| < 2**52, all the integer bits are in the high double.
+ ceil the high double and set the low double to -0.0.
+ 2) |x| >= 2**52, ceiling involves both doubles.
+ See the comment before lable .L2 for details.
+ */
+
+ENTRY (__ceill)
+ mffs fp11 /* Save current FPU rounding mode. */
+ lfd fp13,.LC0@toc(2)
+ fabs fp0,fp1
+ fabs fp9,fp2
+ fsub fp12,fp13,fp13 /* generate 0.0 */
+ fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
+ fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
+ bnl- cr7,.L2
+ mtfsfi 7,2 /* Set rounding mode toward +inf. */
+ fneg fp2,fp12
+ ble- cr6,.L1
+ fadd fp1,fp1,fp13 /* x+= TWO52; */
+ fsub fp1,fp1,fp13 /* x-= TWO52; */
+ fabs fp1,fp1 /* if (x == 0.0) */
+.L0:
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
+ blr /* x = 0.0; */
+.L1:
+ bge- cr6,.L0 /* if (x < 0.0) */
+ fsub fp1,fp1,fp13 /* x-= TWO52; */
+ fadd fp1,fp1,fp13 /* x+= TWO52; */
+ fcmpu cr5,fp1,fp12 /* if (x > 0.0) */
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
+ fnabs fp1,fp1 /* if (x == 0.0) */
+ blr /* x = -0.0; */
+
+/* The high double is > TWO52 so we need to round the low double and
+ perhaps the high double. In this case we have to round the low
+ double and handle any adjustment to the high double that may be
+ caused by rounding (up). This is complicated by the fact that the
+ high double may already be rounded and the low double may have the
+ opposite sign to compensate.This gets a bit tricky so we use the
+ following algorithm:
+
+ tau = floor(x_high/TWO52);
+ x0 = x_high - tau;
+ x1 = x_low + tau;
+ r1 = rint(x1);
+ y_high = x0 + r1;
+ y_low = x0 - y_high + r1;
+ return y; */
+.L2:
+ fcmpu cr7,fp9,fp13 /* if (|x_low| > TWO52) */
+ fcmpu cr0,fp9,fp12 /* || (|x_low| == 0.0) */
+ fcmpu cr5,fp2,fp12 /* if (x_low > 0.0) */
+ bgelr- cr7 /* return x; */
+ beqlr- cr0
+ mtfsfi 7,2 /* Set rounding mode toward +inf. */
+ fdiv fp8,fp1,fp13 /* x_high/TWO52 */
+
+ bng- cr6,.L6 /* if (x > 0.0) */
+ fctidz fp0,fp8
+ fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
+ bng cr5,.L4 /* if (x_low > 0.0) */
+ fmr fp3,fp1
+ fmr fp4,fp2
+ b .L5
+.L4: /* if (x_low < 0.0) */
+ fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
+ fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
+.L5:
+ fadd fp5,fp4,fp13 /* r1 = r1 + TWO52; */
+ fsub fp5,fp5,fp13 /* r1 = r1 - TWO52; */
+ b .L9
+.L6: /* if (x < 0.0) */
+ fctidz fp0,fp8
+ fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
+ bnl cr5,.L7 /* if (x_low < 0.0) */
+ fmr fp3,fp1
+ fmr fp4,fp2
+ b .L8
+.L7: /* if (x_low > 0.0) */
+ fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
+ fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
+.L8:
+ fsub fp5,fp4,fp13 /* r1-= TWO52; */
+ fadd fp5,fp5,fp13 /* r1+= TWO52; */
+.L9:
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
+ fadd fp1,fp3,fp5 /* y_high = x0 + r1; */
+ fsub fp2,fp3,fp1 /* y_low = x0 - y_high + r1; */
+ fadd fp2,fp2,fp5
+ blr
+END (__ceill)
+
+long_double_symbol (libm, __ceill, ceill)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S b/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
index c0fdf4196c..38171e31d7 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
@@ -1,5 +1,5 @@
/* Copy a sign bit between floating-point values. PowerPC64 version.
- Copyright (C) 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2000, 2002, 2006 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
@@ -21,6 +21,7 @@
when it's coded in C. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
ENTRY(__copysign)
CALL_MCOUNT 0
@@ -53,3 +54,10 @@ strong_alias(__copysign,__copysignf)
weak_alias (__copysign,copysignl)
strong_alias(__copysign,__copysignl)
#endif
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __copysign, copysignl, GLIBC_2_0)
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __copysign, copysignl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_copysignl.S b/sysdeps/powerpc/powerpc64/fpu/s_copysignl.S
new file mode 100644
index 0000000000..b2c62eacba
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_copysignl.S
@@ -0,0 +1,51 @@
+/* Copy a sign bit between floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2004, 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ENTRY(__copysignl)
+/* long double [f1,f2] copysign (long double [f1,f2] x, long double [f3,f4] y);
+ copysign(x,y) returns a value with the magnitude of x and
+ with the sign bit of y. */
+ stfd fp3,-16(r1)
+ ld r3,-16(r1)
+ cmpdi r3,0
+ blt L(0)
+ fmr fp0,fp1
+ fabs fp1,fp1
+ fcmpu cr1,fp0,fp1
+ beqlr cr1
+ fneg fp2,fp2
+ blr
+L(0):
+ fmr fp0,fp1
+ fnabs fp1,fp1
+ fcmpu cr1,fp0,fp1
+ beqlr cr1
+ fneg fp2,fp2
+ blr
+END (__copysignl)
+
+#ifdef IS_IN_libm
+long_double_symbol (libm, __copysignl, copysignl)
+#else
+long_double_symbol (libc, __copysignl, copysignl)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_fabs.S b/sysdeps/powerpc/powerpc64/fpu/s_fabs.S
new file mode 100644
index 0000000000..53d21301ee
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_fabs.S
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fabs.S>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fabs, fabsl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_fabsl.S b/sysdeps/powerpc/powerpc64/fpu/s_fabsl.S
new file mode 100644
index 0000000000..3655e5b2f3
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_fabsl.S
@@ -0,0 +1,36 @@
+/* Copy a sign bit between floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2004, 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ENTRY(__fabsl)
+/* long double [f1,f2] fabs (long double [f1,f2] x);
+ fabs(x,y) returns a value with the magnitude of x and
+ with the sign bit of y. */
+ fmr fp0,fp1
+ fabs fp1,fp1
+ fcmpu cr1,fp0,fp1
+ beqlr cr1
+ fneg fp2,fp2
+ blr
+END (__fabsl)
+
+long_double_symbol (libm, __fabsl, fabsl)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_fdim.c b/sysdeps/powerpc/powerpc64/fpu/s_fdim.c
new file mode 100644
index 0000000000..e34b51ee54
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_fdim.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fdim.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fdim, fdiml, GLIBC_2_1);
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_floor.S b/sysdeps/powerpc/powerpc64/fpu/s_floor.S
index 183423c2b3..65a2848b67 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_floor.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_floor.S
@@ -1,5 +1,5 @@
/* Floor function. PowerPC64 version.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 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
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
.section ".toc","aw"
.LC0: /* 2**52 */
@@ -58,3 +59,6 @@ weak_alias (__floor, floor)
weak_alias (__floor, floorl)
strong_alias (__floor, __floorl)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __floor, floorl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_floorl.S b/sysdeps/powerpc/powerpc64/fpu/s_floorl.S
new file mode 100644
index 0000000000..01b3c2101d
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_floorl.S
@@ -0,0 +1,134 @@
+/* long double floor function.
+ IBM extended format long double version.
+ Copyright (C) 2004, 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ .section ".toc","aw"
+.LC0: /* 2**52 */
+ .tc FD_43300000_0[TC],0x4330000000000000
+
+ .section ".text"
+/* long double [fp1,fp2] floorl (long double x [fp1,fp2])
+ IEEE 1003.1 floor function.
+
+ PowerPC64 long double uses the IBM extended format which is
+ represented two 64-floating point double values. The values are
+ non-overlapping giving an effective precision of 106 bits. The first
+ double contains the high order bits of mantisa and is always rounded
+ to represent a normal rounding of long double to double. Since the
+ long double value is sum of the high and low values, the low double
+ normally has the opposite sign to compensate for the this rounding.
+
+ For long double there are two cases:
+ 1) |x| < 2**52, all the integer bits are in the high double.
+ floor the high double and set the low double to -0.0.
+ 2) |x| >= 2**52, Rounding involves both doubles.
+ See the comment before lable .L2 for details.
+ */
+
+ENTRY (__floorl)
+ mffs fp11 /* Save current FPU rounding mode. */
+ lfd fp13,.LC0@toc(2)
+ fabs fp0,fp1
+ fabs fp9,fp2
+ fsub fp12,fp13,fp13 /* generate 0.0 */
+ fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
+ fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
+ bnl- cr7,.L2
+ mtfsfi 7,3 /* Set rounding mode toward -inf. */
+ fneg fp2,fp12 /* set low double to -0.0. */
+ ble- cr6,.L0
+ fadd fp1,fp1,fp13 /* x+= TWO52; */
+ fsub fp1,fp1,fp13 /* x-= TWO52; */
+ fcmpu cr5,fp1,fp12 /* if (x > 0.0) */
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
+ bnelr+ cr5
+ fmr fp1,fp12 /* x must be +0.0 for the 0.0 case. */
+ blr
+.L0:
+ bge- cr6,.L1 /* if (x < 0.0) */
+ fsub fp1,fp1,fp13 /* x-= TWO52; */
+ fadd fp1,fp1,fp13 /* x+= TWO52; */
+.L1:
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
+ blr
+
+
+/* The high double is > TWO52 so we need to round the low double and
+ perhaps the high double. In this case we have to round the low
+ double and handle any adjustment to the high double that may be
+ caused by rounding (up). This is complicated by the fact that the
+ high double may already be rounded and the low double may have the
+ opposite sign to compensate.This gets a bit tricky so we use the
+ following algorithm:
+
+ tau = floor(x_high/TWO52);
+ x0 = x_high - tau;
+ x1 = x_low + tau;
+ r1 = rint(x1);
+ y_high = x0 + r1;
+ y_low = x0 - y_high + r1;
+ return y; */
+.L2:
+ fcmpu cr7,fp9,fp13 /* if (|x_low| > TWO52) */
+ fcmpu cr0,fp9,fp12 /* || (|x_low| == 0.0) */
+ fcmpu cr5,fp2,fp12 /* if (x_low > 0.0) */
+ bgelr- cr7 /* return x; */
+ beqlr- cr0
+ mtfsfi 7,3 /* Set rounding mode toward -inf. */
+ fdiv fp8,fp1,fp13 /* x_high/TWO52 */
+
+ bng- cr6,.L6 /* if (x > 0.0) */
+ fctidz fp0,fp8
+ fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
+ bng cr5,.L4 /* if (x_low > 0.0) */
+ fmr fp3,fp1
+ fmr fp4,fp2
+ b .L5
+.L4: /* if (x_low < 0.0) */
+ fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
+ fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
+.L5:
+ fadd fp5,fp4,fp13 /* r1 = r1 + TWO52; */
+ fsub fp5,fp5,fp13 /* r1 = r1 - TWO52; */
+ b .L9
+.L6: /* if (x < 0.0) */
+ fctidz fp0,fp8
+ fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
+ bnl cr5,.L7 /* if (x_low < 0.0) */
+ fmr fp3,fp1
+ fmr fp4,fp2
+ b .L8
+.L7: /* if (x_low > 0.0) */
+ fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
+ fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
+.L8:
+ fsub fp5,fp4,fp13 /* r1-= TWO52; */
+ fadd fp5,fp5,fp13 /* r1+= TWO52; */
+.L9:
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
+ fadd fp1,fp3,fp5 /* y_high = x0 + r1; */
+ fsub fp2,fp3,fp1 /* y_low = x0 - y_high + r1; */
+ fadd fp2,fp2,fp5
+ blr
+END (__floorl)
+
+long_double_symbol (libm, __floorl, floorl)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_fmax.S b/sysdeps/powerpc/powerpc64/fpu/s_fmax.S
new file mode 100644
index 0000000000..69735761ab
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_fmax.S
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fmax.S>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fmax, fmaxl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_fmin.S b/sysdeps/powerpc/powerpc64/fpu/s_fmin.S
new file mode 100644
index 0000000000..6d4a0a946c
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_fmin.S
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fmin.S>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fmin, fminl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_isnan.c b/sysdeps/powerpc/powerpc64/fpu/s_isnan.c
new file mode 100644
index 0000000000..397717ba9c
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_isnan.c
@@ -0,0 +1,7 @@
+#include <sysdeps/powerpc/fpu/s_isnan.c>
+#ifndef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
+compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
+# endif
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/fpu/s_llrint.S
index 610b561f25..ff0ba948a5 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_llrint.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llrint.S
@@ -1,5 +1,5 @@
/* Round double to long int. PowerPC64 version.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 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
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
/* long long int[r3] __llrint (double x[fp1]) */
ENTRY (__llrint)
@@ -41,3 +42,7 @@ weak_alias (__llrint, llrintl)
strong_alias (__lrint, __lrintl)
weak_alias (__lrint, lrintl)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __llrint, llrintl, GLIBC_2_1)
+compat_symbol (libm, __lrint, lrintl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrintl.S b/sysdeps/powerpc/powerpc64/fpu/s_llrintl.S
new file mode 100644
index 0000000000..aa487775d4
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llrintl.S
@@ -0,0 +1,94 @@
+/* Round long double to long int.
+ IBM extended format long double version.
+ Copyright (C) 2004,2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ .section ".toc","aw"
+.LC0: /* 2**52 */
+ .tc FD_43300000_0[TC],0x4330000000000000
+.LC1: /* 2**63 */
+ .tc FD_43E00000_0[TC],0x43e0000000000000
+ .section ".text"
+
+/* long long int[r3] __llrintl (long double x[fp1,fp2]) */
+ENTRY (__llrintl)
+ lfd fp13,.LC0@toc(2)
+ lfd fp10,.LC1@toc(2)
+ fabs fp0,fp1
+ fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
+ fcmpu cr6,fp0,fp10 /* if (fabs(x) > TWO63) */
+ beq- cr6,.L2
+ fctid fp11,fp1 /* must delay this opperation to here */
+ fctid fp12,fp2 /* and avoid setting "invalid operation". */
+ li r0,0
+ stfd fp11,-16(r1)
+ bgt- cr6,.L9 /* if > TWO63 return "invalid operation". */
+ ble+ cr7,.L9 /* If < TWO52 only thy high double is used. */
+ stfd fp12,-8(r1)
+ nop /* Insure the following load is in a different dispatch group */
+ nop /* to avoid pipe stall on POWER4&5. */
+ nop
+.L8:
+ ld r0,-8(r1)
+.L9:
+ ld r3,-16(r1)
+ add r3,r3,r0
+ blr
+
+/* The high double is >= TWO63 so it looks like we are "out of range".
+ But this may be caused by rounding of the high double and the
+ negative low double may bring it back into range. So we need to
+ de-round the high double and invert the low double without changing
+ the effective long double value. To do this we compute a special
+ value (tau) that we can subtract from the high double and add to
+ the low double before conversion. The resulting integers can be
+ summed to get the total value.
+
+ tau = floor(x_high/TWO52);
+ x0 = x_high - tau;
+ x1 = x_low + tau; */
+.L2:
+ fdiv fp8,fp1,fp13 /* x_high/TWO52 */
+ fctidz fp0,fp8
+ fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
+ fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
+ fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
+ fctid fp11,fp3
+ fctid fp12,fp4
+ stfd fp11,-16(r1)
+ stfd fp12,-8(r1)
+ nop /* Insure the following load is in a different dispatch group */
+ nop /* to avoid pipe stall on POWER4&5. */
+ nop
+ ld r3,-16(r1)
+ ld r0,-8(r1)
+ addo. r3,r3,r0
+ bnslr+ cr0 /* if the sum does not overflow, return. */
+ fctid fp11,fp1 /* Otherwise we want to set "invalid operation". */
+ li r0,0
+ stfd fp11,-16(r1)
+ b .L9
+
+END (__llrintl)
+
+strong_alias (__llrintl, __lrintl)
+long_double_symbol (libm, __llrintl, llrintl)
+long_double_symbol (libm, __lrintl, lrintl)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/fpu/s_llround.S
index a3dcd4c33d..d023b8f2c0 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_llround.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llround.S
@@ -1,5 +1,5 @@
/* llround function. PowerPC64 version.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 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
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
.section ".toc","aw"
.LC0: /* -0.0 */
@@ -66,3 +67,7 @@ strong_alias (__llround, __llroundl)
weak_alias (__lround, lroundl)
strong_alias (__lround, __lroundl)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __llround, llroundl, GLIBC_2_1)
+compat_symbol (libm, __lround, lroundl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S b/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S
index b5ca43bf20..bbbd05492e 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S
@@ -1,5 +1,5 @@
/* llroundf function. PowerPC64 version.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -28,8 +28,8 @@
/* long long [r3] llroundf (float x [fp1])
IEEE 1003.1 llroundf function. IEEE specifies "roundf to the nearest
- integer value, roundfing halfway cases away from zero, regardless of
- the current roundfing mode." However PowerPC Architecture defines
+ integer value, rounding halfway cases away from zero, regardless of
+ the current rounding mode." However PowerPC Architecture defines
"roundf to Nearest" as "Choose the best approximation. In case of a
tie, choose the one that is even (least significant bit o).".
So we can't use the PowerPC "round to Nearest" mode. Instead we set
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llroundl.S b/sysdeps/powerpc/powerpc64/fpu/s_llroundl.S
new file mode 100644
index 0000000000..29eca11093
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llroundl.S
@@ -0,0 +1,167 @@
+/* llroundl function.
+ IBM extended format long double version.
+ Copyright (C) 2004, 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ .section ".toc","aw"
+.LC0: /* 0.0 */
+ .tc FD_00000000_0[TC],0x0000000000000000
+.LC1: /* 0.5 */
+ .tc FD_3fe00000_0[TC],0x3fe0000000000000
+.LC2: /* 2**52 */
+ .tc FD_43300000_0[TC],0x4330000000000000
+.LC3: /* 2**63 */
+ .tc FD_43E00000_0[TC],0x43e0000000000000
+ .section ".text"
+
+/* long long [r3] llround (long double x [fp1,fp2])
+ IEEE 1003.1 llroundl function. IEEE specifies "round to the nearest
+ integer value, rounding halfway cases away from zero, regardless of
+ the current rounding mode." However PowerPC Architecture defines
+ "round to Nearest" as "Choose the best approximation. In case of a
+ tie, choose the one that is even (least significant bit o).".
+ So we can't use the PowerPC "round to Nearest" mode. Instead we set
+ "round toward Zero" mode and round by adding +-0.5 before rounding
+ toward zero. The "Floating Convert To Integer Doubleword with round
+ toward zero" instruction handles the conversion including the
+ overflow cases and signalling "Invalid Operation".
+
+ PowerPC64 long double uses the IBM extended format which is
+ represented two 64-floating point double values. The values are
+ non-overlapping giving an effective precision of 106 bits. The first
+ double contains the high order bits of mantisa and is always rounded
+ to represent a normal rounding of long double to double. Since the
+ long double value is sum of the high and low values, the low double
+ normally has the opposite sign to compensate for the this rounding.
+
+ For long double there is 4 cases:
+ 1) |x| < 2**52, all the integer bits are in the high double.
+ Round and convert the high double to long long.
+ 2) 2**52 <= |x|< 2**63, Still fits but need bits from both doubles.
+ Round the low double, convert both, then sum the long long values.
+ 3) |x| == 2**63, Looks like an overflow but may not be due to rounding
+ of the high double.
+ See the description following lable L2.
+ 4) |x| > 2**63, This will overflow the 64-bit signed integer.
+ Treat like case #1. The fctidz instruction will generate the
+ appropriate and signal "invalid operation".
+
+ */
+
+ENTRY (__llroundl)
+ mffs fp7 /* Save current FPU rounding mode. */
+ fabs fp0,fp1
+ lfd fp13,.LC2@toc(2) /* 2**52 */
+ lfd fp12,.LC3@toc(2) /* 2**63 */
+ lfd fp11,.LC0@toc(2) /* 0.0 */
+ lfd fp10,.LC1@toc(2) /* 0.5 */
+ fabs fp9,fp2
+ fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
+ fcmpu cr6,fp1,fp11 /* if (x > 0.0) */
+ bnl- cr7,.L2
+ mtfsfi 7,1 /* Set rounding mode toward 0. */
+ ble- cr6,.L1
+ fadd fp9,fp1,fp10 /* x+= 0.5; */
+ b .L0
+.L1:
+ fsub fp9,fp1,fp10 /* x-= 0.5; */
+.L0:
+ fctid fp0,fp9
+ stfd fp0,-16(r1)
+ mtfsf 0x01,fp7 /* restore previous rounding mode. */
+ nop /* Insure the following load is in a different dispatch group */
+ nop /* to avoid pipe stall on POWER4&5. */
+ nop
+ ld r3,-16(r1)
+ blr
+
+/* The high double is > TWO52 so we need to round the low double and
+ perhaps the high double. In this case we have to round the low
+ double and handle any adjustment to the high double that may be
+ caused by rounding (up). This is complicated by the fact that the
+ high double may already be rounded and the low double may have the
+ opposite sign to compensate.This gets a bit tricky so we use the
+ following algorithm:
+
+ tau = trunc(x_high/TWO52);
+ x0 = x_high - tau;
+ x1 = x_low + tau;
+ r1 = round(x1);
+ y_high = x0 + r1;
+ y_low = x0 - y_high + r1;
+ return y; */
+.L2:
+ fcmpu cr7,fp0,fp12 /* if (|x_high| > TWO63) */
+ fcmpu cr0,fp9,fp11 /* || (|x_low| == 0.0) */
+ fmr fp9,fp1
+ fcmpu cr5,fp2,fp11 /* if (x_low > 0.0) */
+ bgt- cr7,.L0 /* return llround(x); */
+ mtfsfi 7,1 /* Set rounding mode toward 0. */
+ fdiv fp8,fp1,fp13 /* x_high/TWO52 */
+
+ bng- cr6,.L6 /* if (x > 0.0) */
+ fctidz fp0,fp8
+ fcfid fp8,fp0 /* tau = trunc(x_high/TWO52); */
+ bng cr5,.L4 /* if (x_low > 0.0) */
+ fmr fp3,fp1
+ fmr fp4,fp2
+ b .L5
+.L4: /* if (x_low < 0.0) */
+ fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
+ fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
+.L5:
+ fadd fp5,fp4,fp10 /* r1 = x1 + 0.5; */
+ b .L9
+.L6: /* if (x < 0.0) */
+ fctidz fp0,fp8
+ fcfid fp8,fp0 /* tau = trunc(x_high/TWO52); */
+ bnl cr5,.L7 /* if (x_low < 0.0) */
+ fmr fp3,fp1
+ fmr fp4,fp2
+ b .L8
+.L7: /* if (x_low > 0.0) */
+ fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
+ fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
+.L8:
+ fsub fp5,fp4,fp10 /* r1 = x1 - 0.5; */
+.L9:
+ fctid. fp11,fp3
+ fctid fp12,fp5
+ stfd fp11,-16(r1)
+ stfd fp12,-8(r1)
+ mtfsf 0x01,fp7 /* restore previous rounding mode. */
+ nop /* Insure the following load is in a different dispatch group */
+ nop /* to avoid pipe stall on POWER4&5. */
+ nop
+ ld r3,-16(r1)
+ bunlr cr1 /* if not overflow, return. */
+ ld r0,-8(r1)
+ addo. r3,r3,r0
+ bnslr cr0
+ fmr fp9,fp12
+ bng cr6,.L0
+ fneg fp9,fp12
+ b .L0
+END (__llroundl)
+
+strong_alias (__llroundl, __lroundl)
+long_double_symbol (libm, __llroundl, llroundl)
+long_double_symbol (libm, __lroundl, lroundl)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lrintl.S b/sysdeps/powerpc/powerpc64/fpu/s_lrintl.S
new file mode 100644
index 0000000000..6c82d2e222
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_lrintl.S
@@ -0,0 +1,2 @@
+/* __lrintl is in s_llrintl.c */
+/* __lrintl is in s_llrintl.c */
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lroundl.S b/sysdeps/powerpc/powerpc64/fpu/s_lroundl.S
new file mode 100644
index 0000000000..b24dfd8ded
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_lroundl.S
@@ -0,0 +1,2 @@
+/* __lroundl is in s_llroundl.S */
+/* __lroundl is in s_llroundl.S */
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S b/sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S
new file mode 100644
index 0000000000..0d0eb36f98
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S
@@ -0,0 +1,114 @@
+/* nearbyint long double.
+ IBM extended format long double version.
+ Copyright (C) 2004, 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ .section ".toc","aw"
+.LC0: /* 2**52 */
+ .tc FD_43300000_0[TC],0x4330000000000000
+ .section ".text"
+
+/* long double [fp1,fp2] nearbyintl (long double x [fp1,fp2])
+ IEEE 1003.1 nearbyintl function. nearbyintl is simular to the rintl
+ but does raise the "inexact" exception. This implementation is
+ based on rintl but explicitly maskes the inexact exception on entry
+ and clears any pending inexact before restoring the exception mask
+ on exit.
+
+ PowerPC64 long double uses the IBM extended format which is
+ represented two 64-floating point double values. The values are
+ non-overlapping giving an effective precision of 106 bits. The first
+ double contains the high order bits of mantisa and is always rounded
+ to represent a normal rounding of long double to double. Since the
+ long double value is sum of the high and low values, the low double
+ normally has the opposite sign to compensate for the this rounding.
+
+ For long double there are two cases:
+ 1) |x| < 2**52, all the integer bits are in the high double.
+ floor the high double and set the low double to -0.0.
+ 2) |x| >= 2**52, Rounding involves both doubles.
+ See the comment before lable .L2 for details.
+ */
+ENTRY (__nearbyintl)
+ mffs fp11 /* Save current FPSCR. */
+ lfd fp13,.LC0@toc(2)
+ fabs fp0,fp1
+ mtfsb0 28 /* Disable "inexact" exceptions. */
+ fsub fp12,fp13,fp13 /* generate 0.0 */
+ fabs fp9,fp2
+ fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
+ fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
+ bnl- cr7,.L2
+ fmr fp2,fp12
+ bng- cr6,.L4
+ fadd fp1,fp1,fp13 /* x+= TWO52; */
+ fsub fp1,fp1,fp13 /* x-= TWO52; */
+ b .L9
+.L4:
+ bnl- cr6,.L9 /* if (x < 0.0) */
+ fsub fp1,fp13,fp1 /* x = TWO52 - x; */
+ fsub fp0,fp1,fp13 /* x = - (x - TWO52); */
+ fneg fp1,fp0
+.L9:
+ mtfsb0 6 /* Clear any pending "inexact" exceptions. */
+ mtfsf 0x01,fp11 /* restore exception mask. */
+ blr
+
+/* The high double is > TWO52 so we need to round the low double and
+ perhaps the high double. This gets a bit tricky so we use the
+ following algorithm:
+
+ tau = floor(x_high/TWO52);
+ x0 = x_high - tau;
+ x1 = x_low + tau;
+ r1 = nearbyint(x1);
+ y_high = x0 + r1;
+ y_low = r1 - tau;
+ return y; */
+.L2:
+ fcmpu cr7,fp9,fp13 /* if (|x_low| > TWO52) */
+ fcmpu cr0,fp9,fp12 /* || (|x_low| == 0.0) */
+ bge- cr7,.L9 /* return x; */
+ beq- cr0,.L9
+ fdiv fp8,fp1,fp13 /* x_high/TWO52 */
+ fctidz fp0,fp8
+ fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
+ fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
+ fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
+
+ fcmpu cr6,fp4,fp12 /* if (x1 > 0.0) */
+ bng- cr6,.L8
+ fadd fp5,fp4,fp13 /* r1 = x1 + TWO52; */
+ fsub fp5,fp5,fp13 /* r1 = r1 - TWO52; */
+ b .L6
+.L8:
+ fmr fp5,fp4
+ bge- cr6,.L6 /* if (x1 < 0.0) */
+ fsub fp5,fp13,fp4 /* r1 = TWO52 - x1; */
+ fsub fp0,fp5,fp13 /* r1 = - (r1 - TWO52); */
+ fneg fp5,fp0
+.L6:
+ fadd fp1,fp3,fp5 /* y_high = x0 + r1; */
+ fsub fp2,fp5,fp8 /* y_low = r1 - tau; */
+ b .L9
+END (__nearbyintl)
+
+long_double_symbol (libm, __nearbyintl, nearbyintl)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_rint.S b/sysdeps/powerpc/powerpc64/fpu/s_rint.S
index 0c0e0ba67b..b4fbc0b51b 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_rint.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_rint.S
@@ -1,5 +1,5 @@
/* Round to int floating-point values. PowerPC64 version.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 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
@@ -21,6 +21,7 @@
when it's coded in C. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
.section ".toc","aw"
.LC0: /* 2**52 */
@@ -54,3 +55,6 @@ weak_alias (__rint, rint)
weak_alias (__rint, rintl)
strong_alias (__rint, __rintl)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __rint, rintl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_rintl.S b/sysdeps/powerpc/powerpc64/fpu/s_rintl.S
new file mode 100644
index 0000000000..2ca2d4481f
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_rintl.S
@@ -0,0 +1,113 @@
+/* Round to int long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2004, 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ .section ".toc","aw"
+.LC0: /* 2**52 */
+ .tc FD_43300000_0[TC],0x4330000000000000
+ .section ".text"
+
+ENTRY (__rintl)
+ lfd fp13,.LC0@toc(2)
+ fabs fp0,fp1
+ fsub fp12,fp13,fp13 /* generate 0.0 */
+ fabs fp9,fp2
+ fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
+ fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
+ bnl- cr7,.L2
+ fmr fp2,fp12
+ bng- cr6,.L1
+ fadd fp1,fp1,fp13 /* x+= TWO52; */
+ fsub fp1,fp1,fp13 /* x-= TWO52; */
+ fabs fp1,fp1 /* if (x == 0.0) */
+ blr /* x = 0.0; */
+.L1:
+ bnllr- cr6 /* if (x < 0.0) */
+ fsub fp1,fp1,fp13 /* x-= TWO52; */
+ fadd fp1,fp1,fp13 /* x+= TWO52; */
+ fnabs fp1,fp1 /* if (x == 0.0) */
+ blr /* x = -0.0; */
+
+/* The high double is > TWO52 so we need to round the low double and
+ perhaps the high double. In this case we have to round the low
+ double and handle any adjustment to the high double that may be
+ caused by rounding (up). This is complicated by the fact that the
+ high double may already be rounded and the low double may have the
+ opposite sign to compensate.This gets a bit tricky so we use the
+ following algorithm:
+
+ tau = floor(x_high/TWO52);
+ x0 = x_high - tau;
+ x1 = x_low + tau;
+ r1 = rint(x1);
+ y_high = x0 + r1;
+ y_low = x0 - y_high + r1;
+ return y; */
+.L2:
+ fcmpu cr7,fp9,fp13 /* if (|x_low| > TWO52) */
+ fcmpu cr0,fp9,fp12 /* || (|x_low| == 0.0) */
+ fcmpu cr5,fp2,fp12 /* if (x_low > 0.0) */
+ bgelr- cr7 /* return x; */
+ beqlr- cr0
+ fdiv fp8,fp1,fp13 /* x_high/TWO52 */
+
+ bng- cr6,.L6 /* if (x > 0.0) */
+ fctidz fp0,fp8
+ fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
+ fadd fp8,fp8,fp8 /* tau++; Make tau even */
+ bng cr5,.L4 /* if (x_low > 0.0) */
+ fmr fp3,fp1
+ fmr fp4,fp2
+ b .L5
+.L4: /* if (x_low < 0.0) */
+ fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
+ fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
+.L5:
+ fadd fp5,fp4,fp13 /* r1 = x1 + TWO52; */
+ fsub fp5,fp5,fp13 /* r1 = r1 - TWO52; */
+ b .L9
+.L6: /* if (x < 0.0) */
+ fctidz fp0,fp8
+ fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
+ fadd fp8,fp8,fp8 /* tau++; Make tau even */
+ bnl cr5,.L7 /* if (x_low < 0.0) */
+ fmr fp3,fp1
+ fmr fp4,fp2
+ b .L8
+.L7: /* if (x_low > 0.0) */
+ fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
+ fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
+.L8:
+ fsub fp5,fp13,fp4 /* r1 = TWO52 - x1; */
+ fsub fp0,fp5,fp13 /* r1 = - (r1 - TWO52); */
+ fneg fp5,fp0
+.L9:
+ fadd fp1,fp3,fp5 /* y_high = x0 + r1; */
+ fsub fp2,fp3,fp1 /* y_low = x0 - y_high + r1; */
+ fadd fp2,fp2,fp5
+ blr
+END (__rintl)
+
+long_double_symbol (libm, __rintl, rintl)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_round.S b/sysdeps/powerpc/powerpc64/fpu/s_round.S
index b07a7ea15a..15afca1543 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_round.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_round.S
@@ -1,5 +1,5 @@
/* round function. PowerPC64 version.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 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
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
.section ".toc","aw"
.LC0: /* 2**52 */
@@ -73,3 +74,6 @@ weak_alias (__round, round)
weak_alias (__round, roundl)
strong_alias (__round, __roundl)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __round, roundl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_roundl.S b/sysdeps/powerpc/powerpc64/fpu/s_roundl.S
new file mode 100644
index 0000000000..20da828a82
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_roundl.S
@@ -0,0 +1,133 @@
+/* long double round function.
+ IBM extended format long double version.
+ Copyright (C) 2004, 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ .section ".toc","aw"
+.LC0: /* 2**52 */
+ .tc FD_43300000_0[TC],0x4330000000000000
+.LC1: /* 0.5 */
+ .tc FD_3fe00000_0[TC],0x3fe0000000000000
+ .section ".text"
+
+/* long double [fp1,fp2] roundl (long double x [fp1,fp2])
+ IEEE 1003.1 round function. IEEE specifies "round to the nearest
+ integer value, rounding halfway cases away from zero, regardless of
+ the current rounding mode." However PowerPC Architecture defines
+ "Round to Nearest" as "Choose the best approximation. In case of a
+ tie, choose the one that is even (least significant bit o).".
+ So we can't use the PowerPC "Round to Nearest" mode. Instead we set
+ "Round toward Zero" mode and round by adding +-0.5 before rounding
+ to the integer value. */
+
+ENTRY (__roundl)
+ mffs fp11 /* Save current FPU rounding mode. */
+ lfd fp13,.LC0@toc(2)
+ fabs fp0,fp1
+ fabs fp9,fp2
+ fsub fp12,fp13,fp13 /* generate 0.0 */
+ fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
+ fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
+ bnl- cr7,.L2
+ mtfsfi 7,1 /* Set rounding mode toward 0. */
+ lfd fp10,.LC1@toc(2)
+ ble- cr6,.L1
+ fneg fp2,fp12
+ fadd fp1,fp1,fp10 /* x+= 0.5; */
+ fadd fp1,fp1,fp13 /* x+= TWO52; */
+ fsub fp1,fp1,fp13 /* x-= TWO52; */
+ fabs fp1,fp1 /* if (x == 0.0) x = 0.0; */
+.L0:
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
+ blr
+.L1:
+ fsub fp9,fp1,fp10 /* x-= 0.5; */
+ fneg fp2,fp12
+ bge- cr6,.L0 /* if (x < 0.0) */
+ fsub fp1,fp9,fp13 /* x-= TWO52; */
+ fadd fp1,fp1,fp13 /* x+= TWO52; */
+ fnabs fp1,fp1 /* if (x == 0.0) x = -0.0; */
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
+ blr
+
+/* The high double is > TWO52 so we need to round the low double and
+ perhaps the high double. In this case we have to round the low
+ double and handle any adjustment to the high double that may be
+ caused by rounding (up). This is complicated by the fact that the
+ high double may already be rounded and the low double may have the
+ opposite sign to compensate.This gets a bit tricky so we use the
+ following algorithm:
+
+ tau = floor(x_high/TWO52);
+ x0 = x_high - tau;
+ x1 = x_low + tau;
+ r1 = rint(x1);
+ y_high = x0 + r1;
+ y_low = x0 - y_high + r1;
+ return y; */
+.L2:
+ fcmpu cr7,fp9,fp13 /* if (|x_low| > TWO52) */
+ fcmpu cr0,fp9,fp12 /* || (|x_low| == 0.0) */
+ fcmpu cr5,fp2,fp12 /* if (x_low > 0.0) */
+ lfd fp10,.LC1@toc(2)
+ bgelr- cr7 /* return x; */
+ beqlr- cr0
+ mtfsfi 7,1 /* Set rounding mode toward 0. */
+ fdiv fp8,fp1,fp13 /* x_high/TWO52 */
+
+ bng- cr6,.L6 /* if (x > 0.0) */
+ fctidz fp0,fp8
+ fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
+ bng cr5,.L4 /* if (x_low > 0.0) */
+ fmr fp3,fp1
+ fmr fp4,fp2
+ b .L5
+.L4: /* if (x_low < 0.0) */
+ fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
+ fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
+.L5:
+ fadd fp5,fp4,fp10 /* r1 = x1 + 0.5; */
+ fadd fp5,fp5,fp13 /* r1 = r1 + TWO52; */
+ fsub fp5,fp5,fp13 /* r1 = r1 - TWO52; */
+ b .L9
+.L6: /* if (x < 0.0) */
+ fctidz fp0,fp8
+ fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
+ bnl cr5,.L7 /* if (x_low < 0.0) */
+ fmr fp3,fp1
+ fmr fp4,fp2
+ b .L8
+.L7: /* if (x_low > 0.0) */
+ fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
+ fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
+.L8:
+ fsub fp5,fp4,fp10 /* r1 = x1 - 0.5; */
+ fsub fp5,fp5,fp13 /* r1-= TWO52; */
+ fadd fp5,fp5,fp13 /* r1+= TWO52; */
+.L9:
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
+ fadd fp1,fp3,fp5 /* y_high = x0 + r1; */
+ fsub fp2,fp3,fp1 /* y_low = x0 - y_high + r1; */
+ fadd fp2,fp2,fp5
+ blr
+END (__roundl)
+
+long_double_symbol (libm, __roundl, roundl)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_trunc.S b/sysdeps/powerpc/powerpc64/fpu/s_trunc.S
index d69e371b61..086ed0025e 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_trunc.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_trunc.S
@@ -1,5 +1,5 @@
/* trunc function. PowerPC64 version.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 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
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <math_ldbl_opt.h>
.section ".toc","aw"
.LC0: /* 2**52 */
@@ -46,7 +47,7 @@ EALIGN (__trunc, 4, 0)
fsub fp1,fp1,fp13 /* x-= TWO52; */
fabs fp1,fp1 /* if (x == 0.0) */
/* x = 0.0; */
- mtfsf 0x01,fp11 /* restore previous truncing mode. */
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
blr
.L4:
bge- cr6,.L9 /* if (x < 0.0) */
@@ -65,3 +66,6 @@ weak_alias (__trunc, trunc)
weak_alias (__trunc, truncl)
strong_alias (__trunc, __truncl)
#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __trunc, truncl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_truncf.S b/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
index 15f53da8ca..1456e7f434 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
@@ -1,5 +1,5 @@
/* truncf function. PowerPC64 version.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 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
@@ -46,7 +46,7 @@ EALIGN (__truncf, 4, 0)
fsubs fp1,fp1,fp13 /* x-= TWO23; */
fabs fp1,fp1 /* if (x == 0.0) */
/* x = 0.0; */
- mtfsf 0x01,fp11 /* restore previous truncing mode. */
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
blr
.L4:
bge- cr6,.L9 /* if (x < 0.0) */
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_truncl.S b/sysdeps/powerpc/powerpc64/fpu/s_truncl.S
new file mode 100644
index 0000000000..1864fc14b7
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_truncl.S
@@ -0,0 +1,121 @@
+/* long double trunc function.
+ IBM extended format long double version.
+ Copyright (C) 2004, 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ .section ".toc","aw"
+.LC0: /* 2**52 */
+ .tc FD_43300000_0[TC],0x4330000000000000
+.LC1: /* 0.5 */
+ .tc FD_3fe00000_0[TC],0x3fe0000000000000
+ .section ".text"
+
+/* long double [fp1,fp2] truncl (long double x [fp1,fp2]) */
+
+ENTRY (__truncl)
+ mffs fp11 /* Save current FPU rounding mode. */
+ lfd fp13,.LC0@toc(2)
+ fabs fp0,fp1
+ fabs fp9,fp2
+ fsub fp12,fp13,fp13 /* generate 0.0 */
+ fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
+ fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
+ bnl- cr7,.L2
+ mtfsfi 7,1 /* Set rounding mode toward 0. */
+ ble- cr6,.L1
+ fneg fp2,fp12
+ fadd fp1,fp1,fp13 /* x+= TWO52; */
+ fsub fp1,fp1,fp13 /* x-= TWO52; */
+ fabs fp1,fp1 /* if (x == 0.0) x = 0.0; */
+.L0:
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
+ blr
+.L1:
+ fneg fp2,fp12
+ bge- cr6,.L0 /* if (x < 0.0) */
+ fsub fp1,fp1,fp13 /* x-= TWO52; */
+ fadd fp1,fp1,fp13 /* x+= TWO52; */
+ fnabs fp1,fp1 /* if (x == 0.0) x = -0.0; */
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
+ blr
+
+/* The high double is > TWO52 so we need to round the low double and
+ perhaps the high double. In this case we have to round the low
+ double and handle any adjustment to the high double that may be
+ caused by rounding (up). This is complicated by the fact that the
+ high double may already be rounded and the low double may have the
+ opposite sign to compensate.This gets a bit tricky so we use the
+ following algorithm:
+
+ tau = floor(x_high/TWO52);
+ x0 = x_high - tau;
+ x1 = x_low + tau;
+ r1 = rint(x1);
+ y_high = x0 + r1;
+ y_low = x0 - y_high + r1;
+ return y; */
+.L2:
+ fcmpu cr7,fp9,fp13 /* if (|x_low| > TWO52) */
+ fcmpu cr0,fp9,fp12 /* || (|x_low| == 0.0) */
+ fcmpu cr5,fp2,fp12 /* if (x_low > 0.0) */
+ bgelr- cr7 /* return x; */
+ beqlr- cr0
+ mtfsfi 7,1 /* Set rounding mode toward 0. */
+ fdiv fp8,fp1,fp13 /* x_high/TWO52 */
+
+ bng- cr6,.L6 /* if (x > 0.0) */
+ fctidz fp0,fp8
+ fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
+ fadd fp8,fp8,fp8 /* tau++; Make tau even */
+ bng cr5,.L4 /* if (x_low > 0.0) */
+ fmr fp3,fp1
+ fmr fp4,fp2
+ b .L5
+.L4: /* if (x_low < 0.0) */
+ fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
+ fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
+.L5:
+ fadd fp5,fp4,fp13 /* r1 = r1 + TWO52; */
+ fsub fp5,fp5,fp13 /* r1 = r1 - TWO52; */
+ b .L9
+.L6: /* if (x < 0.0) */
+ fctidz fp0,fp8
+ fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
+ fadd fp8,fp8,fp8 /* tau++; Make tau even */
+ bnl cr5,.L7 /* if (x_low < 0.0) */
+ fmr fp3,fp1
+ fmr fp4,fp2
+ b .L8
+.L7: /* if (x_low > 0.0) */
+ fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
+ fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
+.L8:
+ fsub fp5,fp4,fp13 /* r1-= TWO52; */
+ fadd fp5,fp5,fp13 /* r1+= TWO52; */
+.L9:
+ mtfsf 0x01,fp11 /* restore previous rounding mode. */
+ fadd fp1,fp3,fp5 /* y_high = x0 + r1; */
+ fsub fp2,fp3,fp1 /* y_low = x0 - y_high + r1; */
+ fadd fp2,fp2,fp5
+ blr
+END (__truncl)
+
+long_double_symbol (libm, __truncl, truncl)
diff --git a/sysdeps/powerpc/powerpc64/setjmp-common.S b/sysdeps/powerpc/powerpc64/setjmp-common.S
index 11ecedf2c1..606eef5935 100644
--- a/sysdeps/powerpc/powerpc64/setjmp-common.S
+++ b/sysdeps/powerpc/powerpc64/setjmp-common.S
@@ -1,5 +1,5 @@
/* setjmp for PowerPC64.
- Copyright (C) 1995-2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-2003, 2004, 2005, 2006 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
@@ -19,11 +19,10 @@
#include <sysdep.h>
#define _ASM
-#define _SETJMP_H
#ifdef __NO_VMX__
#include <novmxsetjmp.h>
#else
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
#endif
#include <bp-sym.h>
#include <bp-asm.h>
diff --git a/sysdeps/s390/bits/setjmp.h b/sysdeps/s390/bits/setjmp.h
index 37f600d0ad..5588c03301 100644
--- a/sysdeps/s390/bits/setjmp.h
+++ b/sysdeps/s390/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2001,2002,2005,2006 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
@@ -27,37 +27,22 @@
#include <bits/wordsize.h>
-#define __JB_GPR6 0
-#define __JB_GPR7 1
-#define __JB_GPR8 2
-#define __JB_GPR9 3
-#define __JB_GPR10 4
-#define __JB_GPR11 5
-#define __JB_GPR12 6
-#define __JB_GPR13 7
-#define __JB_GPR14 8
-#define __JB_GPR15 9
-
#ifndef _ASM
-typedef struct __s390_jmp_buf {
- /* We save registers 6-15. */
- long int __gregs[10];
-
-#if __WORDSIZE == 64
- /* We save fpu registers 1, 3, 5 and 7. */
- long __fpregs[8];
-#else
- /* We save fpu registers 4 and 6. */
- long __fpregs[4];
-#endif
+typedef struct __s390_jmp_buf
+{
+ /* We save registers 6-15. */
+ long int __gregs[10];
+
+# if __WORDSIZE == 64
+ /* We save fpu registers 1, 3, 5 and 7. */
+ long __fpregs[8];
+# else
+ /* We save fpu registers 4 and 6. */
+ long __fpregs[4];
+# endif
} __jmp_buf[1];
#endif
-/* Test if longjmp to JMPBUF would unwind the frame
- containing a local variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
- ((void *) (address) < (void *) demangle ((jmpbuf)->__gregs[__JB_GPR15]))
-
#endif /* __S390_SETJMP_H__ */
diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
index 552ad4afae..06b022a47b 100644
--- a/sysdeps/s390/fpu/libm-test-ulps
+++ b/sysdeps/s390/fpu/libm-test-ulps
@@ -17,12 +17,12 @@ float: 1
ifloat: 1
# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 7
idouble: 1
ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 3
idouble: 1
diff --git a/sysdeps/s390/jmpbuf-offsets.h b/sysdeps/s390/jmpbuf-offsets.h
new file mode 100644
index 0000000000..d99fc92a27
--- /dev/null
+++ b/sysdeps/s390/jmpbuf-offsets.h
@@ -0,0 +1,29 @@
+/* Private macros for accessing __jmp_buf contents. S/390 version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define __JB_GPR6 0
+#define __JB_GPR7 1
+#define __JB_GPR8 2
+#define __JB_GPR9 3
+#define __JB_GPR10 4
+#define __JB_GPR11 5
+#define __JB_GPR12 6
+#define __JB_GPR13 7
+#define __JB_GPR14 8
+#define __JB_GPR15 9
diff --git a/nptl/sysdeps/s390/jmpbuf-unwind.h b/sysdeps/s390/jmpbuf-unwind.h
index 81fa582540..c1a670fc7d 100644
--- a/nptl/sysdeps/s390/jmpbuf-unwind.h
+++ b/sysdeps/s390/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -18,11 +18,19 @@
02111-1307 USA. */
#include <setjmp.h>
+#include <jmpbuf-offsets.h>
#include <stdint.h>
#include <unwind.h>
#include <bits/wordsize.h>
#include <sysdep.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame
+ containing a local variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+ ((void *) (address) < (void *) demangle ((jmpbuf)->__gregs[__JB_GPR15]))
+
+
/* On s390{,x}, CFA is always 96 (resp. 160) bytes above actual
%r15. */
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
diff --git a/sysdeps/sh/bits/setjmp.h b/sysdeps/sh/bits/setjmp.h
index 8ebb5c598e..7e3fbd3394 100644
--- a/sysdeps/sh/bits/setjmp.h
+++ b/sysdeps/sh/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2000,2003,2005,2006 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
@@ -44,13 +44,4 @@ typedef struct
} __jmp_buf[1];
#endif
-#if defined __USE_MISC || defined _ASM
-# define JB_SIZE (4 * 15)
-#endif
-
-/* Test if longjmp to JMPBUF would unwind the frame
- containing a local variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
- ((void *) (address) < (void *) demangle ((jmpbuf)[0].__regs[7]))
-
#endif /* bits/setjmp.h */
diff --git a/sysdeps/sh/jmpbuf-offsets.h b/sysdeps/sh/jmpbuf-offsets.h
new file mode 100644
index 0000000000..312051e7eb
--- /dev/null
+++ b/sysdeps/sh/jmpbuf-offsets.h
@@ -0,0 +1,20 @@
+/* Private macros for accessing __jmp_buf contents. SH version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define JB_SIZE (4 * 15)
diff --git a/nptl/sysdeps/sh/jmpbuf-unwind.h b/sysdeps/sh/jmpbuf-unwind.h
index 3ef178b4d6..a69a465efc 100644
--- a/nptl/sysdeps/sh/jmpbuf-unwind.h
+++ b/sysdeps/sh/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -22,6 +22,11 @@
#include <unwind.h>
#include <sysdep.h>
+/* Test if longjmp to JMPBUF would unwind the frame
+ containing a local variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+ ((void *) (address) < (void *) demangle ((jmpbuf)[0].__regs[7]))
+
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
@@ -38,5 +43,5 @@ _jmpbuf_sp (__jmp_buf regs)
#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
-/* We use the normal lobngjmp for unwinding. */
+/* We use the normal longjmp for unwinding. */
#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/sh/sh3/__longjmp.S b/sysdeps/sh/sh3/__longjmp.S
index 08d39d02dd..c6d8a3214c 100644
--- a/sysdeps/sh/sh3/__longjmp.S
+++ b/sysdeps/sh/sh3/__longjmp.S
@@ -1,5 +1,5 @@
/* longjmp for SH.
- Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2005, 2006 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
@@ -30,19 +30,26 @@ ENTRY (__longjmp)
mov.l @r4+, r10
mov.l @r4+, r11
mov.l @r4+, r12
- mov.l @r4+, r13
- mov.l @r4+, r14
mov r5, r0 /* get the return value in place */
tst r0, r0
bf.s 1f
- mov.l @r4+, r15
+ mov.l @r4+, r13
mov #1,r0 /* can't let setjmp() return zero! */
1:
#ifdef PTR_DEMANGLE
mov.l @r4+, r2
- PTR_DEMANGLE (r2)
+ PTR_DEMANGLE (r2, r1)
+ mov r2, r14
+ mov.l @r4+, r2
+ PTR_DEMANGLE2 (r2, r1)
+ mov r2, r15
+ mov.l @r4+, r2
+ PTR_DEMANGLE2 (r2, r1)
lds r2, pr
+ mov #0, r1
#else
+ mov.l @r4+, r14
+ mov.l @r4+, r15
lds.l @r4+, pr
#endif
rts
diff --git a/sysdeps/sh/sh3/setjmp.S b/sysdeps/sh/sh3/setjmp.S
index f60ca874cf..d04e4b851f 100644
--- a/sysdeps/sh/sh3/setjmp.S
+++ b/sysdeps/sh/sh3/setjmp.S
@@ -1,5 +1,5 @@
/* setjmp for SH3.
- Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2005, 2006 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
@@ -18,9 +18,7 @@
02111-1307 USA. */
#include <sysdep.h>
-#define _SETJMP_H
-#define _ASM
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
ENTRY (__sigsetjmp)
/* Save registers */
@@ -28,13 +26,20 @@ ENTRY (__sigsetjmp)
stc.l gbr, @-r4
#ifdef PTR_MANGLE
sts pr, r2
- PTR_MANGLE (r2)
+ PTR_MANGLE (r2, r1)
mov.l r2, @-r4
+ mov r15, r2
+ PTR_MANGLE2 (r2, r1)
+ mov.l r2, @-r4
+ mov r14, r2
+ PTR_MANGLE2 (r2, r1)
+ mov.l r2, @-r4
+ mov #0, r1
#else
sts.l pr, @-r4
-#endif
mov.l r15, @-r4
mov.l r14, @-r4
+#endif
mov.l r13, @-r4
mov.l r12, @-r4
mov.l r11, @-r4
diff --git a/sysdeps/sh/sh4/__longjmp.S b/sysdeps/sh/sh4/__longjmp.S
index cc525952f7..320a7d11f7 100644
--- a/sysdeps/sh/sh4/__longjmp.S
+++ b/sysdeps/sh/sh4/__longjmp.S
@@ -1,5 +1,5 @@
/* longjmp for SH.
- Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2005, 2006 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
@@ -30,19 +30,26 @@ ENTRY (__longjmp)
mov.l @r4+, r10
mov.l @r4+, r11
mov.l @r4+, r12
- mov.l @r4+, r13
- mov.l @r4+, r14
mov r5, r0 /* get the return value in place */
tst r0, r0
bf.s 1f
- mov.l @r4+, r15
+ mov.l @r4+, r13
mov #1,r0 /* can't let setjmp() return zero! */
1:
#ifdef PTR_DEMANGLE
mov.l @r4+, r2
- PTR_DEMANGLE (r2)
+ PTR_DEMANGLE (r2, r1)
+ mov r2, r14
+ mov.l @r4+, r2
+ PTR_DEMANGLE2 (r2, r1)
+ mov r2, r15
+ mov.l @r4+, r2
+ PTR_DEMANGLE2 (r2, r1)
lds r2, pr
+ mov #0, r1
#else
+ mov.l @r4+, r14
+ mov.l @r4+, r15
lds.l @r4+, pr
#endif
ldc.l @r4+, gbr
diff --git a/sysdeps/sh/sh4/fpu/libm-test-ulps b/sysdeps/sh/sh4/fpu/libm-test-ulps
index 3dd37f1309..4831f4849b 100644
--- a/sysdeps/sh/sh4/fpu/libm-test-ulps
+++ b/sysdeps/sh/sh4/fpu/libm-test-ulps
@@ -60,12 +60,12 @@ float: 1
ifloat: 1
# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 7
idouble: 1
ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 3
idouble: 1
diff --git a/sysdeps/sh/sh4/setjmp.S b/sysdeps/sh/sh4/setjmp.S
index b8853496f1..f9a4f0a8ce 100644
--- a/sysdeps/sh/sh4/setjmp.S
+++ b/sysdeps/sh/sh4/setjmp.S
@@ -1,5 +1,5 @@
/* setjmp for SH4.
- Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2005, 2006 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
@@ -18,9 +18,7 @@
02111-1307 USA. */
#include <sysdep.h>
-#define _SETJMP_H
-#define _ASM
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
ENTRY (__sigsetjmp)
/* Save registers */
@@ -33,13 +31,20 @@ ENTRY (__sigsetjmp)
stc.l gbr, @-r4
#ifdef PTR_MANGLE
sts pr, r2
- PTR_MANGLE (r2)
+ PTR_MANGLE (r2, r1)
mov.l r2, @-r4
+ mov r15, r2
+ PTR_MANGLE2 (r2, r1)
+ mov.l r2, @-r4
+ mov r14, r2
+ PTR_MANGLE2 (r2, r1)
+ mov.l r2, @-r4
+ mov #0, r1
#else
sts.l pr, @-r4
-#endif
mov.l r15, @-r4
mov.l r14, @-r4
+#endif
mov.l r13, @-r4
mov.l r12, @-r4
mov.l r11, @-r4
diff --git a/sysdeps/sparc/Makefile b/sysdeps/sparc/Makefile
index e55e461423..40323a0643 100644
--- a/sysdeps/sparc/Makefile
+++ b/sysdeps/sparc/Makefile
@@ -1,3 +1,6 @@
+# The Sparc `long double' is a distinct type we support.
+long-double-fcts = yes
+
ifeq ($(subdir),db2)
CPPFLAGS += -DHAVE_SPINLOCKS=1 -DHAVE_ASSEM_SPARC_GCC=1
endif
diff --git a/sysdeps/sparc/fpu/bits/mathdef.h b/sysdeps/sparc/fpu/bits/mathdef.h
index e76735b55b..c8dcc9c93f 100644
--- a/sysdeps/sparc/fpu/bits/mathdef.h
+++ b/sysdeps/sparc/fpu/bits/mathdef.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2004, 2006
+ 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
@@ -55,14 +56,3 @@ typedef double double_t;
# define FP_ILOGBNAN (2147483647)
#endif /* ISO C99 */
-
-#ifndef __NO_LONG_DOUBLE_MATH
-
-# if __WORDSIZE == 32
-/* Signal that in 32bit ABI we do not really have a `long double'.
- The disables the declaration of all the `long double' function
- variants. */
-# define __NO_LONG_DOUBLE_MATH 1
-# endif
-
-#endif
diff --git a/sysdeps/sparc/fpu/bits/mathinline.h b/sysdeps/sparc/fpu/bits/mathinline.h
index 7add493660..9dd784d122 100644
--- a/sysdeps/sparc/fpu/bits/mathinline.h
+++ b/sysdeps/sparc/fpu/bits/mathinline.h
@@ -1,5 +1,6 @@
/* Inline math functions for SPARC.
- Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2004, 2006
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>.
@@ -36,23 +37,52 @@
# if __WORDSIZE == 32
-# define __unordered_cmp(x, y) \
+# ifndef __NO_LONG_DOUBLE_MATH
+
+# define __unordered_cmp(x, y) \
(__extension__ \
({ unsigned __r; \
- if (sizeof(x) == 4 && sizeof(y) == 4) \
+ if (sizeof (x) == 4 && sizeof (y) == 4) \
{ \
float __x = (x); float __y = (y); \
- __asm__("fcmps %1,%2; st %%fsr, %0" : "=m" (__r) : "f" (__x), \
- "f" (__y) : "cc"); \
+ __asm__ ("fcmps %1,%2; st %%fsr, %0" : "=m" (__r) : "f" (__x), \
+ "f" (__y) : "cc"); \
+ } \
+ else if (sizeof (x) <= 8 && sizeof (y) <= 8) \
+ { \
+ double __x = (x); double __y = (y); \
+ __asm__ ("fcmpd\t%1,%2\n\tst\t%%fsr,%0" : "=m" (__r) : "f" (__x), \
+ "f" (__y) : "cc"); \
+ } \
+ else \
+ { \
+ long double __x = (x); long double __y = (y); \
+ extern int _Q_cmp (const long double a, const long double b); \
+ __r = _Q_cmp (__x, __y) << 10; \
+ } \
+ __r; }))
+
+# else
+
+# define __unordered_cmp(x, y) \
+ (__extension__ \
+ ({ unsigned __r; \
+ if (sizeof (x) == 4 && sizeof (y) == 4) \
+ { \
+ float __x = (x); float __y = (y); \
+ __asm__ ("fcmps %1,%2; st %%fsr, %0" : "=m" (__r) : "f" (__x), \
+ "f" (__y) : "cc"); \
} \
else \
{ \
double __x = (x); double __y = (y); \
- __asm__("fcmpd\t%1,%2\n\tst\t%%fsr,%0" : "=m" (__r) : "f" (__x), \
- "f" (__y) : "cc"); \
+ __asm__ ("fcmpd\t%1,%2\n\tst\t%%fsr,%0" : "=m" (__r) : "f" (__x), \
+ "f" (__y) : "cc"); \
} \
__r; }))
+# endif
+
# define isgreater(x, y) ((__unordered_cmp (x, y) & (3 << 10)) == (2 << 10))
# define isgreaterequal(x, y) ((__unordered_cmp (x, y) & (1 << 10)) == 0)
# define isless(x, y) ((__unordered_cmp (x, y) & (3 << 10)) == (1 << 10))
@@ -65,22 +95,22 @@
# define __unordered_v9cmp(x, y, op, qop) \
(__extension__ \
({ unsigned __r; \
- if (sizeof(x) == 4 && sizeof(y) == 4) \
+ if (sizeof (x) == 4 && sizeof (y) == 4) \
{ \
float __x = (x); float __y = (y); \
- __asm__("fcmps\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0" \
- : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc"); \
+ __asm__ ("fcmps\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0" \
+ : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc"); \
} \
- else if (sizeof(x) <= 8 && sizeof(y) <= 8) \
+ else if (sizeof (x) <= 8 && sizeof (y) <= 8) \
{ \
double __x = (x); double __y = (y); \
- __asm__("fcmpd\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0" \
- : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc"); \
+ __asm__ ("fcmpd\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0" \
+ : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc"); \
} \
else \
{ \
long double __x = (x); long double __y = (y); \
- extern int _Qp_cmp(const long double *a, const long double *b); \
+ extern int _Qp_cmp (const long double *a, const long double *b); \
__r = qop; \
} \
__r; }))
@@ -127,11 +157,20 @@ __NTH (__signbit (double __x))
return __u.__i[0] < 0;
}
+# ifndef __NO_LONG_DOUBLE_MATH
+__MATH_INLINE int
+__NTH (__signbitl (long double __x))
+{
+ __extension__ union { long double __l; int __i[4]; } __u = { __l: __x };
+ return __u.__i[0] < 0;
+}
+# else
__MATH_INLINE int
__NTH (__signbitl (long double __x))
{
return __signbit ((double)__x);
}
+# endif
# else /* sparc64 */
@@ -180,6 +219,13 @@ __NTH (sqrtl (long double __x))
_Qp_sqrt (&__r, &__x);
return __r;
}
+# elif !defined __NO_LONG_DOUBLE_MATH
+__MATH_INLINE long double
+sqrtl (long double __x) __THROW
+{
+ extern long double _Q_sqrt (__const__ long double);
+ return _Q_sqrt (__x);
+}
# endif /* sparc64 */
# endif /* !__NO_MATH_INLINES && !GCC 3.2+ */
@@ -211,6 +257,13 @@ __ieee754_sqrtl (long double __x)
_Qp_sqrt(&__r, &__x);
return __r;
}
+# elif !defined __NO_LONG_DOUBLE_MATH
+__MATH_INLINE long double
+__ieee754_sqrtl (long double __x)
+{
+ extern long double _Q_sqrt (__const__ long double);
+ return _Q_sqrt (__x);
+}
# endif /* sparc64 */
# endif /* __LIBC_INTERNAL_MATH_INLINES */
# endif /* gcc 2.8+ */
diff --git a/sysdeps/sparc/sparc32/Implies b/sysdeps/sparc/sparc32/Implies
index 5312721497..436436a651 100644
--- a/sysdeps/sparc/sparc32/Implies
+++ b/sysdeps/sparc/sparc32/Implies
@@ -1,5 +1,6 @@
wordsize-32
# SPARC uses IEEE 754 floating point.
-ieee754/flt-32
+ieee754/ldbl-128
ieee754/dbl-64
+ieee754/flt-32
sparc/sparc32/soft-fp
diff --git a/sysdeps/sparc/sparc32/__longjmp.S b/sysdeps/sparc/sparc32/__longjmp.S
index 3b2c80b7c3..a5453b4294 100644
--- a/sysdeps/sparc/sparc32/__longjmp.S
+++ b/sysdeps/sparc/sparc32/__longjmp.S
@@ -19,9 +19,7 @@
#include <sysdep.h>
-#define _ASM 1
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
#define ENV(base,reg) [%base + (reg * 4)]
#define ST_FLUSH_WINDOWS 3
#define RW_FP [%fp + 0x48]
diff --git a/sysdeps/sparc/sparc32/bits/setjmp.h b/sysdeps/sparc/sparc32/bits/setjmp.h
index 12250d6980..86ccc20d20 100644
--- a/sysdeps/sparc/sparc32/bits/setjmp.h
+++ b/sysdeps/sparc/sparc32/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -22,17 +22,6 @@
# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
#endif
-#if defined __USE_MISC || defined _ASM
-# define JB_SP 0
-# define JB_FP 1
-# define JB_PC 2
-#endif
-
#ifndef _ASM
typedef int __jmp_buf[3];
#endif
-
-/* Test if longjmp to JMPBUF would unwind the frame
- containing a local variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
- ((int) (address) < demangle ((jmpbuf)[JB_SP]))
diff --git a/sysdeps/sparc/sparc32/fpu/e_sqrtl.c b/sysdeps/sparc/sparc32/fpu/e_sqrtl.c
new file mode 100644
index 0000000000..3c3acfee02
--- /dev/null
+++ b/sysdeps/sparc/sparc32/fpu/e_sqrtl.c
@@ -0,0 +1 @@
+/* __ieee754_sqrtl is defined in q_sqrt.c. */
diff --git a/sysdeps/sparc/sparc32/fpu/libm-test-ulps b/sysdeps/sparc/sparc32/fpu/libm-test-ulps
index 979e0e2c91..40d563971a 100644
--- a/sysdeps/sparc/sparc32/fpu/libm-test-ulps
+++ b/sysdeps/sparc/sparc32/fpu/libm-test-ulps
@@ -4,32 +4,49 @@
Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
float: 3
ifloat: 3
+ildouble: 1
+ldouble: 1
Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
float: 3
ifloat: 3
+ildouble: 1
+ldouble: 1
Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
float: 6
ifloat: 6
+ildouble: 1
+ldouble: 1
# atanh
Test "atanh (0.75) == 0.972955074527656652552676371721589865":
float: 1
ifloat: 1
+# cacos
+Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
+
# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 7
idouble: 1
ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+ildouble: 5
+ldouble: 5
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 3
idouble: 1
ifloat: 3
+ildouble: 1
+ldouble: 1
# casin
Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
@@ -37,6 +54,9 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
# casinh
Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
@@ -44,19 +64,27 @@ double: 5
float: 1
idouble: 5
ifloat: 1
+ildouble: 4
+ldouble: 4
Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
double: 3
float: 6
idouble: 3
ifloat: 6
+ildouble: 2
+ldouble: 2
Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
# catan
Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
@@ -70,6 +98,9 @@ ifloat: 1
Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
float: 4
ifloat: 4
+Test "Imaginary part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
+ildouble: 1
+ldouble: 1
# catanh
Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
@@ -81,11 +112,18 @@ ifloat: 4
Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
double: 1
idouble: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
float: 6
ifloat: 6
+ildouble: 1
+ldouble: 1
# cbrt
+Test "cbrt (-0.001) == -0.1":
+ildouble: 1
+ldouble: 1
Test "cbrt (-27.0) == -3.0":
double: 1
idouble: 1
@@ -97,9 +135,14 @@ double: 1
idouble: 1
# ccos
+Test "Real part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
double: 1
float: 1
@@ -113,9 +156,13 @@ ifloat: 1
Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
double: 1
float: 1
@@ -126,12 +173,20 @@ float: 1
ifloat: 1
# cexp
+Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 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
# clog
Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
@@ -140,57 +195,98 @@ ifloat: 3
Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
# clog10
Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
+Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
double: 1
float: 5
idouble: 1
ifloat: 5
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
float: 1
ifloat: 1
+Test "Imaginary part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
float: 1
+idouble: 1
ifloat: 1
# cos
@@ -199,16 +295,22 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "cos (M_PI_6l * 4.0) == -0.5":
double: 2
float: 1
idouble: 2
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "cos (pi/2) == 0":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
# cpow
Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
@@ -222,16 +324,31 @@ double: 1
float: 4
idouble: 1
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":
double: 2
float: 3
idouble: 2
ifloat: 3
+ildouble: 10
+ldouble: 10
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 2
+ldouble: 2
Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
double: 1
float: 4
idouble: 1
ifloat: 4
+ildouble: 3
+ldouble: 3
Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
float: 2
ifloat: 2
@@ -240,8 +357,21 @@ double: 2
float: 2
idouble: 2
ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# csin
+Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
+ildouble: 1
+ldouble: 1
# csinh
+Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
double: 1
idouble: 1
@@ -256,17 +386,31 @@ ifloat: 1
Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0.75 + 1.25 i) == 1.05065169626078392338656675760808326 + 0.594868882070379067881984030639932657 i":
+ildouble: 1
+ldouble: 1
# ctan
Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
double: 1
idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
double: 1
idouble: 1
+ildouble: 2
+ldouble: 2
# ctanh
Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
@@ -274,6 +418,11 @@ double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
float: 1
ifloat: 1
@@ -290,6 +439,9 @@ idouble: 1
Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
double: 1
idouble: 1
+Test "erfc (27.0) == 0.523704892378925568501606768284954709e-318":
+ildouble: 1
+ldouble: 1
Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
double: 1
idouble: 1
@@ -310,14 +462,25 @@ double: 6
float: 2
idouble: 6
ifloat: 2
+ildouble: 1
+ldouble: 1
# expm1
Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
double: 1
idouble: 1
Test "expm1 (1) == M_El - 1.0":
+double: 1
float: 1
+idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# gamma
+Test "gamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
# hypot
Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
@@ -359,9 +522,13 @@ double: 2
float: 1
idouble: 2
ifloat: 1
+ildouble: 2
+ldouble: 2
Test "j0 (2.0) == 0.223890779141235668051827454649948626":
float: 2
ifloat: 2
+ildouble: 2
+ldouble: 2
Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
double: 1
float: 1
@@ -370,17 +537,32 @@ ifloat: 1
Test "j0 (8.0) == 0.171650807137553906090869407851972001":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
# j1
+Test "j1 (-1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "j1 (0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "j1 (1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
float: 2
ifloat: 2
+ildouble: 2
+ldouble: 2
Test "j1 (2.0) == 0.576724807756873387202448242269137087":
double: 1
idouble: 1
Test "j1 (8.0) == 0.234636346853914624381276651590454612":
double: 1
idouble: 1
+ildouble: 4
+ldouble: 4
# jn
Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
@@ -396,9 +578,13 @@ double: 2
float: 1
idouble: 2
ifloat: 1
+ildouble: 2
+ldouble: 2
Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
float: 2
ifloat: 2
+ildouble: 2
+ldouble: 2
Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
double: 1
float: 1
@@ -407,30 +593,57 @@ ifloat: 1
Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (1, -1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
float: 2
ifloat: 2
+ildouble: 2
+ldouble: 2
Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
double: 1
idouble: 1
Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
double: 1
idouble: 1
+ildouble: 4
+ldouble: 4
+Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
double: 4
float: 3
idouble: 4
ifloat: 3
+ildouble: 2
+ldouble: 2
Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
float: 4
ifloat: 4
@@ -449,6 +662,8 @@ double: 3
float: 1
idouble: 3
ifloat: 1
+ildouble: 2
+ldouble: 2
Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
double: 1
float: 2
@@ -456,16 +671,23 @@ idouble: 1
ifloat: 2
# lgamma
+Test "lgamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 1
+ldouble: 1
# log10
Test "log10 (0.75) == -0.124938736608299953132449886193870744":
@@ -476,11 +698,21 @@ ifloat: 2
Test "log10 (e) == log10(e)":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
# log1p
Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
float: 1
ifloat: 1
+Test "log1p (M_El - 1.0) == 1":
+ildouble: 1
+ldouble: 1
+
+# log2
+Test "log2 (0.75) == -.415037499278843818546261056052183492":
+ildouble: 1
+ldouble: 1
# sincos
Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
@@ -488,31 +720,58 @@ double: 1
float: 1
idouble: 1
ifloat: 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/2, &sin_res, &cos_res) puts 0 in cos_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
+# sqrt
+Test "sqrt (2) == M_SQRT2l":
+ildouble: 1
+ldouble: 1
+
# tan
Test "tan (pi/4) == 1":
double: 1
idouble: 1
+# tanh
+Test "tanh (-0.75) == -0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (-1.0) == -0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+Test "tanh (0.75) == 0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (1.0) == 0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+
# tgamma
Test "tgamma (-0.5) == -2 sqrt (pi)":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "tgamma (0.5) == sqrt (pi)":
float: 1
ifloat: 1
@@ -521,6 +780,9 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+Test "tgamma (4) == 6":
+ildouble: 1
+ldouble: 1
# y0
Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
@@ -536,19 +798,28 @@ ifloat: 1
Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
float: 1
ifloat: 1
+ildouble: 3
+ldouble: 3
Test "y0 (8.0) == 0.223521489387566220527323400498620359":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 3
+ldouble: 3
# y1
Test "y1 (0.125) == -5.19993611253477499595928744876579921":
double: 1
idouble: 1
+Test "y1 (0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
Test "y1 (1.5) == -0.412308626973911295952829820633445323":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "y1 (10.0) == 0.249015424206953883923283474663222803":
double: 3
float: 1
@@ -559,11 +830,15 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "y1 (8.0) == -0.158060461731247494255555266187483550":
double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 1
+ldouble: 1
# yn
Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
@@ -579,17 +854,26 @@ ifloat: 1
Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
float: 1
ifloat: 1
+ildouble: 3
+ldouble: 3
Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 3
+ldouble: 3
Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
double: 1
idouble: 1
+Test "yn (1, 0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
double: 3
float: 1
@@ -600,30 +884,44 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 1
+ldouble: 1
Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
double: 1
idouble: 1
+ildouble: 2
+ldouble: 2
Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 5
+ldouble: 5
Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
double: 1
idouble: 1
+ildouble: 1
+ldouble: 1
Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 2
+ldouble: 2
Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
double: 2
idouble: 2
+ildouble: 2
+ldouble: 2
Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
double: 1
idouble: 1
@@ -632,11 +930,15 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 2
+ldouble: 2
Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
double: 1
idouble: 1
@@ -645,22 +947,32 @@ idouble: 1
Function: "atan2":
float: 6
ifloat: 6
+ildouble: 1
+ldouble: 1
Function: "atanh":
float: 1
ifloat: 1
+Function: Imaginary part of "cacos":
+ildouble: 1
+ldouble: 1
+
Function: Real part of "cacosh":
double: 1
float: 7
idouble: 1
ifloat: 7
+ildouble: 5
+ldouble: 5
Function: Imaginary part of "cacosh":
double: 1
float: 3
idouble: 1
ifloat: 3
+ildouble: 1
+ldouble: 1
Function: Real part of "casin":
double: 1
@@ -668,17 +980,25 @@ float: 1
idouble: 1
ifloat: 1
+Function: Imaginary part of "casin":
+ildouble: 1
+ldouble: 1
+
Function: Real part of "casinh":
double: 5
float: 1
idouble: 5
ifloat: 1
+ildouble: 4
+ldouble: 4
Function: Imaginary part of "casinh":
double: 3
float: 6
idouble: 3
ifloat: 6
+ildouble: 2
+ldouble: 2
Function: Real part of "catan":
float: 4
@@ -689,50 +1009,72 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Real part of "catanh":
double: 4
idouble: 4
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "catanh":
float: 6
ifloat: 6
+ildouble: 1
+ldouble: 1
Function: "cbrt":
double: 1
idouble: 1
+ildouble: 1
+ldouble: 1
Function: Real part of "ccos":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "ccos":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Real part of "ccosh":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "ccosh":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Real part of "cexp":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "cexp":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Real part of "clog":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "clog":
float: 3
@@ -741,34 +1083,54 @@ ifloat: 3
Function: Real part of "clog10":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "clog10":
double: 1
float: 5
idouble: 1
ifloat: 5
+ildouble: 1
+ldouble: 1
Function: "cos":
double: 2
float: 1
idouble: 2
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Real part of "cpow":
double: 2
float: 4
idouble: 2
ifloat: 4
+ildouble: 10
+ldouble: 10
Function: Imaginary part of "cpow":
double: 2
float: 2
idouble: 2
ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csin":
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csin":
+ildouble: 1
+ldouble: 1
Function: Real part of "csinh":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "csinh":
double: 1
@@ -779,24 +1141,38 @@ ifloat: 1
Function: Real part of "csqrt":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csqrt":
+ildouble: 1
+ldouble: 1
Function: Real part of "ctan":
double: 1
idouble: 1
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "ctan":
double: 1
idouble: 1
+ildouble: 2
+ldouble: 2
Function: Real part of "ctanh":
double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 1
+ldouble: 1
Function: Imaginary part of "ctanh":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: "erf":
double: 1
@@ -805,18 +1181,28 @@ idouble: 1
Function: "erfc":
double: 1
idouble: 1
+ildouble: 1
+ldouble: 1
Function: "exp10":
double: 6
float: 2
idouble: 6
ifloat: 2
+ildouble: 1
+ldouble: 1
Function: "expm1":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "gamma":
+ildouble: 1
+ldouble: 1
Function: "hypot":
float: 1
@@ -827,67 +1213,101 @@ double: 2
float: 2
idouble: 2
ifloat: 2
+ildouble: 2
+ldouble: 2
Function: "j1":
double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 4
+ldouble: 4
Function: "jn":
double: 4
float: 4
idouble: 4
ifloat: 4
+ildouble: 4
+ldouble: 4
Function: "lgamma":
double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 1
+ldouble: 1
Function: "log10":
double: 1
float: 2
idouble: 1
ifloat: 2
+ildouble: 1
+ldouble: 1
Function: "log1p":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2":
+ildouble: 1
+ldouble: 1
Function: "sincos":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sqrt":
+ildouble: 1
+ldouble: 1
Function: "tan":
double: 1
idouble: 1
+Function: "tanh":
+ildouble: 1
+ldouble: 1
+
Function: "tgamma":
double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Function: "y0":
double: 2
float: 1
idouble: 2
ifloat: 1
+ildouble: 3
+ldouble: 3
Function: "y1":
double: 3
float: 2
idouble: 3
ifloat: 2
+ildouble: 1
+ldouble: 1
Function: "yn":
double: 3
float: 2
idouble: 3
ifloat: 2
+ildouble: 5
+ldouble: 5
# end of automatic generation
diff --git a/sysdeps/sparc/sparc32/fpu/s_fabs.c b/sysdeps/sparc/sparc32/fpu/s_fabs.c
new file mode 100644
index 0000000000..db5ecf2162
--- /dev/null
+++ b/sysdeps/sparc/sparc32/fpu/s_fabs.c
@@ -0,0 +1,5 @@
+double __fabs (double x)
+{
+ return __builtin_fabs (x);
+}
+weak_alias (__fabs, fabs)
diff --git a/sysdeps/sparc/sparc32/fpu/s_fabsf.S b/sysdeps/sparc/sparc32/fpu/s_fabsf.S
new file mode 100644
index 0000000000..e1487247d1
--- /dev/null
+++ b/sysdeps/sparc/sparc32/fpu/s_fabsf.S
@@ -0,0 +1,29 @@
+/* Float absolute value, sparc32 version.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+ENTRY (__fabsf)
+ st %o0, [%sp+64]
+ ld [%sp+64], %f0
+ retl
+ fabss %f0, %f0
+END (__fabsf)
+weak_alias (__fabsf, fabsf)
diff --git a/sysdeps/sparc/sparc32/fpu/s_fabsl.c b/sysdeps/sparc/sparc32/fpu/s_fabsl.c
new file mode 100644
index 0000000000..67e9f47071
--- /dev/null
+++ b/sysdeps/sparc/sparc32/fpu/s_fabsl.c
@@ -0,0 +1,5 @@
+long double __fabsl (long double x)
+{
+ return __builtin_fabsl (x);
+}
+weak_alias (__fabsl, fabsl)
diff --git a/sysdeps/sparc/sparc32/jmpbuf-offsets.h b/sysdeps/sparc/sparc32/jmpbuf-offsets.h
new file mode 100644
index 0000000000..1c6f7a9d17
--- /dev/null
+++ b/sysdeps/sparc/sparc32/jmpbuf-offsets.h
@@ -0,0 +1,22 @@
+/* Private macros for accessing __jmp_buf contents. SPARC version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define JB_SP 0
+#define JB_FP 1
+#define JB_PC 2
diff --git a/nptl/sysdeps/alpha/jmpbuf-unwind.h b/sysdeps/sparc/sparc32/jmpbuf-unwind.h
index 83b7a01a0e..0f317b99d0 100644
--- a/nptl/sysdeps/alpha/jmpbuf-unwind.h
+++ b/sysdeps/sparc/sparc32/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -18,10 +18,16 @@
02111-1307 USA. */
#include <setjmp.h>
+#include <jmpbuf-offsets.h>
#include <stdint.h>
#include <unwind.h>
#include <sysdep.h>
+/* Test if longjmp to JMPBUF would unwind the frame
+ containing a local variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+ ((int) (address) < demangle ((jmpbuf)[JB_SP]))
+
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
diff --git a/sysdeps/sparc/sparc32/setjmp.S b/sysdeps/sparc/sparc32/setjmp.S
index 4ef8724e02..0a5d3cece8 100644
--- a/sysdeps/sparc/sparc32/setjmp.S
+++ b/sysdeps/sparc/sparc32/setjmp.S
@@ -20,9 +20,7 @@
#include <sysdep.h>
#include <sys/trap.h>
-#define _ASM 1
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
ENTRY(_setjmp)
b 1f
diff --git a/sysdeps/sparc/sparc32/soft-fp/Makefile b/sysdeps/sparc/sparc32/soft-fp/Makefile
index bba9bf7f86..d447b48285 100644
--- a/sysdeps/sparc/sparc32/soft-fp/Makefile
+++ b/sysdeps/sparc/sparc32/soft-fp/Makefile
@@ -1,6 +1,6 @@
# Software floating-point emulation.
# Makefile for SPARC v8 long double utility functions (_Q_*).
-# Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2006 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Jakub Jelinek (jj@ultra.linux.cz).
#
@@ -20,13 +20,11 @@
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA.
-# Currently gcc does not support TFmode long double on sparc32
-# so these routines are not used.
-#ifeq ($(subdir),soft-fp)
-#sparc32-quad-routines := q_add q_cmp q_cmpe q_div q_dtoq q_feq q_fge \
-# q_fgt q_fle q_flt q_fne q_itoq q_mul q_neg q_qtod q_qtoi \
-# q_qtos q_qtoui q_qtoux q_qtox q_sqrt q_stoq q_sub q_uitoq \
-# q_uxtoq q_xtoq q_util
-#sysdep_routines += $(sparc32-quad-routines)
-#
-#endif
+ifeq ($(subdir),soft-fp)
+sparc32-quad-routines := q_add q_cmp q_cmpe q_div q_dtoq q_feq q_fge \
+ q_fgt q_fle q_flt q_fne q_itoq q_mul q_neg q_qtod q_qtoi \
+ q_qtos q_qtou q_qtoull q_qtoll q_sqrt q_stoq q_sub q_utoq \
+ q_ulltoq q_lltoq q_util
+sysdep_routines += $(sparc32-quad-routines)
+
+endif
diff --git a/sysdeps/sparc/sparc32/soft-fp/Versions b/sysdeps/sparc/sparc32/soft-fp/Versions
new file mode 100644
index 0000000000..6a09249c46
--- /dev/null
+++ b/sysdeps/sparc/sparc32/soft-fp/Versions
@@ -0,0 +1,8 @@
+libc {
+ GLIBC_2.4 {
+ _Q_add; _Q_cmp; _Q_cmpe; _Q_div; _Q_dtoq; _Q_feq; _Q_fge; _Q_fgt;
+ _Q_fle; _Q_flt; _Q_fne; _Q_itoq; _Q_mul; _Q_neg; _Q_qtod; _Q_qtoi;
+ _Q_qtos; _Q_qtou; _Q_qtoull; _Q_qtoll; _Q_sqrt; _Q_stoq; _Q_sub;
+ _Q_utoq; _Q_ulltoq; _Q_lltoq;
+ }
+}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_div.c b/sysdeps/sparc/sparc32/soft-fp/q_div.c
index bb4e697236..86db5ed9e9 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_div.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_div.c
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return a / b
- Copyright (C) 1997,1999 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -35,5 +35,5 @@ long double _Q_div(const long double a, const long double b)
FP_DIV_Q(C, A, B);
FP_PACK_Q(c, C);
FP_HANDLE_EXCEPTIONS;
- return long double;
+ return c;
}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_xtoq.c b/sysdeps/sparc/sparc32/soft-fp/q_lltoq.c
index 867ef27131..c801ca86f1 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_xtoq.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_lltoq.c
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return (long double)a
- Copyright (C) 1997,1999 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -23,7 +23,7 @@
#include "soft-fp.h"
#include "quad.h"
-long double _Q_xtoq(const long long a)
+long double _Q_lltoq(const long long a)
{
FP_DECL_EX;
FP_DECL_Q(C);
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtox.c b/sysdeps/sparc/sparc32/soft-fp/q_qtoll.c
index 108373328e..af328bda1c 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtox.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtoll.c
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
- Return (long)a
- Copyright (C) 1997,1999 Free Software Foundation, Inc.
+ Return (long long)a
+ Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -24,7 +24,7 @@
#include "soft-fp.h"
#include "quad.h"
-long long _Q_qtox(const long double a)
+long long _Q_qtoll(const long double a)
{
FP_DECL_EX;
FP_DECL_Q(A);
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtoui.c b/sysdeps/sparc/sparc32/soft-fp/q_qtou.c
index bdbf052e09..041a78e28c 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtoui.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtou.c
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return (unsigned int)a
- Copyright (C) 1997,1999 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -24,7 +24,7 @@
#include "soft-fp.h"
#include "quad.h"
-unsigned int _Q_qtoui(const long double a)
+unsigned int _Q_qtou(const long double a)
{
FP_DECL_EX;
FP_DECL_Q(A);
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtoux.c b/sysdeps/sparc/sparc32/soft-fp/q_qtoull.c
index 3e6d40f220..8170e994f5 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtoux.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtoull.c
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
- Return (unsigned long)a
- Copyright (C) 1997,1999 Free Software Foundation, Inc.
+ Return (unsigned long long)a
+ Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -24,7 +24,7 @@
#include "soft-fp.h"
#include "quad.h"
-unsigned long long _Q_qtoux(const long double a)
+unsigned long long _Q_qtoull(const long double a)
{
FP_DECL_EX;
FP_DECL_Q(A);
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c b/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c
index 7516ed7c5c..373d02a639 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return sqrtl(a)
- Copyright (C) 1997,1999 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -36,3 +36,4 @@ long double _Q_sqrt(const long double a)
FP_HANDLE_EXCEPTIONS;
return c;
}
+strong_alias (_Q_sqrt, __ieee754_sqrtl);
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c b/sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c
index 8944e9614d..77e64b4de7 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return (long double)(a)
- Copyright (C) 1997,1999 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -23,7 +23,7 @@
#include "soft-fp.h"
#include "quad.h"
-long double _Q_uxtoq(const unsigned long long a)
+long double _Q_ulltoq(const unsigned long long a)
{
FP_DECL_EX;
FP_DECL_Q(C);
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_uitoq.c b/sysdeps/sparc/sparc32/soft-fp/q_utoq.c
index b716fabde2..6efb780cf1 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_uitoq.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_utoq.c
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
c = (long double)(a)
- Copyright (C) 1997,1999 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -23,7 +23,7 @@
#include "soft-fp.h"
#include "quad.h"
-long double _Q_uitoq(const unsigned int a)
+long double _Q_utoq(const unsigned int a)
{
FP_DECL_EX;
FP_DECL_Q(C);
diff --git a/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h b/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h
index 40bcbb4762..f1211705ef 100644
--- a/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h
+++ b/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h
@@ -1,6 +1,6 @@
/* Machine-dependent software floating-point definitions.
Sparc userland (_Q_*) version.
- Copyright (C) 1997,1998,1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,1999, 2002, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com),
Jakub Jelinek (jj@ultra.linux.cz) and
@@ -22,6 +22,7 @@
02111-1307 USA. */
#include <fpu_control.h>
+#include <stdlib.h>
#define _FP_W_TYPE_SIZE 32
#define _FP_W_TYPE unsigned long
@@ -208,14 +209,5 @@ do { \
" : : "r" (___Q_numbers) : "f30"); \
} \
else \
- { \
- __asm__ __volatile__("\
- mov %0, %%o0\n\
- mov %%o7, %%g1\n\
- call ___Q_simulate_exceptions\n\
- mov %%g1, %%o7\
- " : : "r" (_fex) : \
- "g1", "g2", "g3", "g4", "g5", "o0", \
- "o1", "o2", "o3", "o4", "o5", "cc"); \
- } \
+ ___Q_simulate_exceptions (_fex); \
} while (0)
diff --git a/sysdeps/sparc/sparc64/Makefile b/sysdeps/sparc/sparc64/Makefile
index 6335984c7d..c1df31727c 100644
--- a/sysdeps/sparc/sparc64/Makefile
+++ b/sysdeps/sparc/sparc64/Makefile
@@ -1,6 +1,3 @@
-# The Sparc `long double' is a distinct type we support.
-long-double-fcts = yes
-
ifeq ($(subdir),csu)
sysdep_routines += hp-timing
elide-routines.os += hp-timing
diff --git a/sysdeps/sparc/sparc64/fpu/libm-test-ulps b/sysdeps/sparc/sparc64/fpu/libm-test-ulps
index 4888dd2149..5719a7ca54 100644
--- a/sysdeps/sparc/sparc64/fpu/libm-test-ulps
+++ b/sysdeps/sparc/sparc64/fpu/libm-test-ulps
@@ -33,14 +33,14 @@ ildouble: 1
ldouble: 1
# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 7
idouble: 1
ifloat: 7
ildouble: 5
ldouble: 5
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 3
idouble: 1
diff --git a/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h b/sysdeps/sparc/sparc64/jmpbuf-unwind.h
index efb6918c14..b7e327d0f6 100644
--- a/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h
+++ b/sysdeps/sparc/sparc64/jmpbuf-unwind.h
@@ -18,9 +18,15 @@
02111-1307 USA. */
#include <setjmp.h>
+#include <jmpbuf-offsets.h>
#include <stdint.h>
#include <unwind.h>
+/* Test if longjmp to JMPBUF would unwind the frame
+ containing a local variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+ ((unsigned long int) (address) < (jmpbuf)->uc_mcontext.mc_fp + 2047)
+
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
diff --git a/sysdeps/sparc/sparc64/soft-fp/sfp-machine.h b/sysdeps/sparc/sparc64/soft-fp/sfp-machine.h
index 42e6aa8506..449e955c16 100644
--- a/sysdeps/sparc/sparc64/soft-fp/sfp-machine.h
+++ b/sysdeps/sparc/sparc64/soft-fp/sfp-machine.h
@@ -1,6 +1,6 @@
/* Machine-dependent software floating-point definitions.
Sparc64 userland (_Q_* and _Qp_*) version.
- Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com),
Jakub Jelinek (jj@ultra.linux.cz) and
@@ -23,6 +23,7 @@
#include <fpu_control.h>
#include <fenv.h>
+#include <stdlib.h>
#define _FP_W_TYPE_SIZE 64
#define _FP_W_TYPE unsigned long
diff --git a/sysdeps/unix/alpha/sysdep.h b/sysdeps/unix/alpha/sysdep.h
index a154db8e41..2260ec5480 100644
--- a/sysdeps/unix/alpha/sysdep.h
+++ b/sysdeps/unix/alpha/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1996, 2000, 2003, 2004
+/* Copyright (C) 1992, 1995, 1996, 2000, 2003, 2004, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Brendan Kehoe (brendan@zen.org).
@@ -397,4 +397,42 @@ __LABEL(name) \
_sc_ret = _sc_0, _sc_err = _sc_19; \
}
+/* Pointer mangling support. Note that tls access is slow enough that
+ we don't deoptimize things by placing the pointer check value there. */
+
+#include <stdint.h>
+
+#if defined NOT_IN_libc && defined IS_IN_rtld
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(dst, src, tmp) \
+ ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \
+ ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \
+ xor src, tmp, dst
+# define PTR_MANGLE2(dst, src, tmp) \
+ xor src, tmp, dst
+# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
+# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
+# else
+extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
+# define PTR_MANGLE(var) \
+ (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
+# define PTR_DEMANGLE(var) PTR_MANGLE(var)
+# endif
+#elif defined PIC
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(dst, src, tmp) \
+ ldq tmp, __pointer_chk_guard; \
+ xor src, tmp, dst
+# define PTR_MANGLE2(dst, src, tmp) \
+ xor src, tmp, dst
+# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
+# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
+# else
+extern uintptr_t __pointer_chk_guard attribute_relro;
+# define PTR_MANGLE(var) \
+ (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
+# define PTR_DEMANGLE(var) PTR_MANGLE(var)
+# endif
+#endif
+
#endif /* ASSEMBLER */
diff --git a/sysdeps/unix/fdopendir.c b/sysdeps/unix/fdopendir.c
index 23d08fd7fd..528f180fcb 100644
--- a/sysdeps/unix/fdopendir.c
+++ b/sysdeps/unix/fdopendir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 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
@@ -36,6 +36,7 @@ fdopendir (int fd)
__set_errno (ENOTDIR);
return NULL;
}
+
/* Make sure the descriptor allows for reading. */
int flags = __fcntl (fd, F_GETFL);
if (__builtin_expect (flags == -1, 0))
diff --git a/sysdeps/unix/sysv/linux/alpha/fxstatat.c b/sysdeps/unix/sysv/linux/alpha/fxstatat.c
index 127f7f3c57..4cb304cb40 100644
--- a/sysdeps/unix/sysv/linux/alpha/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/alpha/fxstatat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 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
@@ -94,4 +94,5 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
return -1;
}
-strong_alias (__fxstatat, __fxstatat64);
+strong_alias (__fxstatat, __fxstatat64)
+strong_alias (__fxstatat64, __GI___fxstatat64)
diff --git a/sysdeps/unix/sysv/linux/alpha/sysdep.h b/sysdeps/unix/sysv/linux/alpha/sysdep.h
index c3de78f4bb..a22da71d60 100644
--- a/sysdeps/unix/sysv/linux/alpha/sysdep.h
+++ b/sysdeps/unix/sysv/linux/alpha/sysdep.h
@@ -22,10 +22,8 @@
#define _LINUX_ALPHA_SYSDEP_H 1
#ifdef __ASSEMBLER__
-
#include <asm/pal.h>
#include <alpha/regdef.h>
-
#endif
/* There is some commonality. */
diff --git a/sysdeps/unix/sysv/linux/bits/sched.h b/sysdeps/unix/sysv/linux/bits/sched.h
index 69462bf61c..2ca7df0d13 100644
--- a/sysdeps/unix/sysv/linux/bits/sched.h
+++ b/sysdeps/unix/sysv/linux/bits/sched.h
@@ -1,6 +1,6 @@
/* Definitions of constants and data structure for POSIX 1003.1b-1993
scheduling interface.
- Copyright (C) 1996-1999,2001-2003,2005 Free Software Foundation, Inc.
+ Copyright (C) 1996-1999,2001-2003,2005,2006 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
@@ -29,6 +29,9 @@
#define SCHED_OTHER 0
#define SCHED_FIFO 1
#define SCHED_RR 2
+#ifdef __USE_GNU
+# define SCHED_BATCH 3
+#endif
#ifdef __USE_MISC
/* Cloning flags. */
diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c
index 80b3b240f7..10b903d076 100644
--- a/sysdeps/unix/sysv/linux/faccessat.c
+++ b/sysdeps/unix/sysv/linux/faccessat.c
@@ -25,8 +25,10 @@
#include <unistd.h>
#include <sys/types.h>
#include <alloca.h>
+#include <kernel-features.h>
#include <sysdep.h>
+
int
faccessat (fd, file, mode, flag)
int fd;
@@ -40,42 +42,59 @@ faccessat (fd, file, mode, flag)
return -1;
}
- char *buf = NULL;
-
- if (fd != AT_FDCWD && file[0] != '/')
+#ifdef __NR_faccessat
+ if ((flag == 0 || ((flag & ~AT_EACCESS) == 0 && ! __libc_enable_secure))
+# ifndef __ASSUME_ATFCTS
+ && __have_atfcts >= 0
+# endif
+ )
{
- size_t filelen = strlen (file);
- static const char procfd[] = "/proc/self/fd/%d/%s";
- /* Buffer for the path name we are going to use. It consists of
- - the string /proc/self/fd/
- - the file descriptor number
- - the file name provided.
- The final NUL is included in the sizeof. A bit of overhead
- due to the format elements compensates for possible negative
- numbers. */
- size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
- buf = alloca (buflen);
-
- __snprintf (buf, buflen, procfd, fd, file);
- file = buf;
+ int result = INLINE_SYSCALL (faccessat, 3, fd, file, mode);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
}
+#endif
+#ifndef __ASSUME_ATFCTS
if ((!(flag & AT_EACCESS) || ! __libc_enable_secure)
-#ifndef __NR_laccess /* Linux so far has no laccess syscall. */
+# ifndef __NR_laccess /* Linux so far has no laccess syscall. */
&& !(flag & AT_SYMLINK_NOFOLLOW)
-#endif
+# endif
)
{
/* If we are not set-uid or set-gid, access does the same. */
+ char *buf = NULL;
+
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ size_t filelen = strlen (file);
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ buf = alloca (buflen);
+
+ __snprintf (buf, buflen, procfd, fd, file);
+ file = buf;
+ }
int result;
INTERNAL_SYSCALL_DECL (err);
-#ifdef __NR_laccess
+# ifdef __NR_laccess
if (flag & AT_SYMLINK_NOFOLLOW)
result = INTERNAL_SYSCALL (laccess, err, 2, file, mode);
else
-#endif
+# endif
result = INTERNAL_SYSCALL (access, err, 2, file, mode);
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
@@ -86,6 +105,7 @@ faccessat (fd, file, mode, flag)
return result;
}
+#endif
struct stat64 stats;
if (fstatat64 (fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW))
diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c
index de35e4376f..8b420153f1 100644
--- a/sysdeps/unix/sysv/linux/fchmodat.c
+++ b/sysdeps/unix/sysv/linux/fchmodat.c
@@ -25,6 +25,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <alloca.h>
+#include <kernel-features.h>
#include <sysdep.h>
int
@@ -47,6 +48,24 @@ fchmodat (fd, file, mode, flag)
}
#endif
+ int result;
+
+#ifdef __NR_fchmodat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (fchmodat, 3, fd, file, mode);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
char *buf = NULL;
if (fd != AT_FDCWD && file[0] != '/')
@@ -67,14 +86,13 @@ fchmodat (fd, file, mode, flag)
file = buf;
}
- int result;
INTERNAL_SYSCALL_DECL (err);
-#ifdef __NR_lchmod
+# ifdef __NR_lchmod
if (flag & AT_SYMLINK_NOFOLLOW)
result = INTERNAL_SYSCALL (lchmod, err, 2, file, mode);
else
-#endif
+# endif
result = INTERNAL_SYSCALL (chmod, err, 2, file, mode);
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
@@ -84,4 +102,5 @@ fchmodat (fd, file, mode, flag)
}
return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/fchownat.c b/sysdeps/unix/sysv/linux/fchownat.c
index 10d87e87fc..0f731775b3 100644
--- a/sysdeps/unix/sysv/linux/fchownat.c
+++ b/sysdeps/unix/sysv/linux/fchownat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 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
@@ -25,6 +25,8 @@
#include <sys/types.h>
#include <alloca.h>
#include <sysdep.h>
+#include <kernel-features.h>
+
/* Change the owner and group of FILE. */
int
@@ -35,6 +37,24 @@ fchownat (fd, file, owner, group, flag)
gid_t group;
int flag;
{
+ int result;
+
+#ifdef __NR_fchownat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (fchownat, 5, fd, file, owner, group, flag);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
if (flag & ~AT_SYMLINK_NOFOLLOW)
{
__set_errno (EINVAL);
@@ -61,7 +81,6 @@ fchownat (fd, file, owner, group, flag)
file = buf;
}
- int result;
INTERNAL_SYSCALL_DECL (err);
if (flag & AT_SYMLINK_NOFOLLOW)
@@ -76,4 +95,5 @@ fchownat (fd, file, owner, group, flag)
}
return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/futimesat.c b/sysdeps/unix/sysv/linux/futimesat.c
index be148b8d7a..514f456927 100644
--- a/sysdeps/unix/sysv/linux/futimesat.c
+++ b/sysdeps/unix/sysv/linux/futimesat.c
@@ -35,6 +35,24 @@ futimesat (fd, file, tvp)
const char *file;
const struct timeval tvp[2];
{
+ int result;
+
+#ifdef __NR_futimesat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (futimesat, 3, fd, file, tvp);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
char *buf = NULL;
if (file == NULL)
@@ -70,24 +88,23 @@ futimesat (fd, file, tvp)
file = buf;
}
- int result;
INTERNAL_SYSCALL_DECL (err);
-#ifdef __NR_utimes
+# ifdef __NR_utimes
result = INTERNAL_SYSCALL (utimes, err, 2, file, tvp);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return result;
-# ifndef __ASSUME_UTIMES
+# ifndef __ASSUME_UTIMES
if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
goto fail;
+# endif
# endif
-#endif
/* The utimes() syscall does not exist or is not available in the
used kernel. Use utime(). For this we have to convert to the
data format utime() expects. */
-#ifndef __ASSUME_UTIMES
+# ifndef __ASSUME_UTIMES
struct utimbuf tmp;
struct utimbuf *times;
@@ -105,9 +122,10 @@ futimesat (fd, file, tvp)
return result;
fail:
-#endif
+# endif
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
return -1;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/fxstatat.c b/sysdeps/unix/sysv/linux/fxstatat.c
index 9bc3dbc459..c73037b805 100644
--- a/sysdeps/unix/sysv/linux/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/fxstatat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 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
@@ -78,10 +78,12 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return result;
}
-
#ifdef STAT_IS_KERNEL_STAT
- __set_errno (EINVAL);
- return -1;
+ else
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
#else
struct kernel_stat kst;
diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c b/sysdeps/unix/sysv/linux/fxstatat64.c
index 83a8816697..220d4abfcf 100644
--- a/sysdeps/unix/sysv/linux/fxstatat64.c
+++ b/sysdeps/unix/sysv/linux/fxstatat64.c
@@ -134,3 +134,4 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
return -1;
}
+libc_hidden_def (__fxstatat64)
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
index 985a0860cb..d655ba3b27 100644
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -1,5 +1,5 @@
/* Determine various system internal values, Linux version.
- Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1996-2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -34,75 +34,6 @@
#include <atomic.h>
-/* The default value for the /proc filesystem mount point. */
-static const char path_proc[] = "/proc";
-
-/* Actual mount point of /proc filesystem. */
-libc_freeres_ptr (static char *mount_proc);
-
-/* Determine the path to the /proc filesystem if available. */
-static const char *
-internal_function
-get_proc_path (char *buffer, size_t bufsize)
-{
- struct mntent mount_point;
- struct mntent *entry;
- char *result = NULL;
- char *copy_result;
- FILE *fp;
-
- /* First find the mount point of the proc filesystem. */
- fp = __setmntent (_PATH_MOUNTED, "r");
- if (fp == NULL)
- fp = __setmntent (_PATH_MNTTAB, "r");
- if (fp != NULL)
- {
- /* We don't need locking. */
- (void) __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
- while ((entry = __getmntent_r (fp, &mount_point, buffer, bufsize))
- != NULL)
- if (strcmp (mount_point.mnt_type, "proc") == 0)
- {
- result = mount_point.mnt_dir;
- break;
- }
- __endmntent (fp);
- }
-
- /* If we haven't found anything this is generally a bad sign but we
- handle it gracefully. We return what is hopefully the right
- answer (/proc) but we don't remember this. This will enable
- programs which started before the system is fully running to
- adjust themselves. */
- if (result == NULL)
- return path_proc;
-
- /* Make a copy we can keep around. */
- copy_result = __strdup (result);
- if (copy_result == NULL)
- return result;
-
- /* Now store the copied value. But do it atomically. */
- assert (sizeof (long int) == sizeof (void *__unbounded));
- if (atomic_compare_and_exchange_bool_acq (&mount_proc, copy_result, NULL))
- /* Replacing the value failed. This means another thread was
- faster and we don't need the copy anymore. */
- free (copy_result);
-#if __BOUNDED_POINTERS__
- else
- {
- /* compare_and_swap only copied the pointer value, so we must
- now copy the bounds as well. */
- __ptrlow (mount_proc) = __ptrlow (copy_result);
- __ptrhigh (mount_proc) = __ptrhigh (copy_result);
- }
-#endif
-
- return mount_proc;
-}
-
-
/* How we can determine the number of available processors depends on
the configuration. There is currently (as of version 2.0.21) no
system call to determine the number. It is planned for the 2.1.x
@@ -136,50 +67,35 @@ get_proc_path (char *buffer, size_t bufsize)
int
__get_nprocs ()
{
- FILE *fp;
char buffer[8192];
- const char *proc_path;
int result = 1;
/* XXX Here will come a test for the new system call. */
- /* Get mount point of proc filesystem. */
- proc_path = get_proc_path (buffer, sizeof buffer);
-
- /* If we haven't found an appropriate entry return 1. */
- if (proc_path != NULL)
+ /* The /proc/stat format is more uniform, use it by default. */
+ FILE *fp = fopen ("/proc/stat", "rc");
+ if (fp != NULL)
{
- char *proc_fname = alloca (strlen (proc_path) + sizeof ("/cpuinfo"));
+ /* No threads use this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
- /* The /proc/stat format is more uniform, use it by default. */
- __stpcpy (__stpcpy (proc_fname, proc_path), "/stat");
+ result = 0;
+ while (fgets_unlocked (buffer, sizeof (buffer), fp) != NULL)
+ if (strncmp (buffer, "cpu", 3) == 0 && isdigit (buffer[3]))
+ ++result;
- fp = fopen (proc_fname, "rc");
+ fclose (fp);
+ }
+ else
+ {
+ fp = fopen ("/proc/cpuinfo", "rc");
if (fp != NULL)
{
/* No threads use this stream. */
__fsetlocking (fp, FSETLOCKING_BYCALLER);
-
- result = 0;
- while (fgets_unlocked (buffer, sizeof (buffer), fp) != NULL)
- if (strncmp (buffer, "cpu", 3) == 0 && isdigit (buffer[3]))
- ++result;
-
+ GET_NPROCS_PARSER (fp, buffer, result);
fclose (fp);
}
- else
- {
- __stpcpy (__stpcpy (proc_fname, proc_path), "/cpuinfo");
-
- fp = fopen (proc_fname, "rc");
- if (fp != NULL)
- {
- /* No threads use this stream. */
- __fsetlocking (fp, FSETLOCKING_BYCALLER);
- GET_NPROCS_PARSER (fp, buffer, result);
- fclose (fp);
- }
- }
}
return result;
@@ -193,30 +109,19 @@ weak_alias (__get_nprocs, get_nprocs)
int
__get_nprocs_conf ()
{
- FILE *fp;
char buffer[8192];
- const char *proc_path;
int result = 1;
/* XXX Here will come a test for the new system call. */
- /* Get mount point of proc filesystem. */
- proc_path = get_proc_path (buffer, sizeof buffer);
-
/* If we haven't found an appropriate entry return 1. */
- if (proc_path != NULL)
+ FILE *fp = fopen ("/proc/cpuinfo", "rc");
+ if (fp != NULL)
{
- char *proc_cpuinfo = alloca (strlen (proc_path) + sizeof ("/cpuinfo"));
- __stpcpy (__stpcpy (proc_cpuinfo, proc_path), "/cpuinfo");
-
- fp = fopen (proc_cpuinfo, "rc");
- if (fp != NULL)
- {
- /* No threads use this stream. */
- __fsetlocking (fp, FSETLOCKING_BYCALLER);
- GET_NPROCS_CONF_PARSER (fp, buffer, result);
- fclose (fp);
- }
+ /* No threads use this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+ GET_NPROCS_CONF_PARSER (fp, buffer, result);
+ fclose (fp);
}
return result;
@@ -235,40 +140,29 @@ static long int
internal_function
phys_pages_info (const char *format)
{
- FILE *fp;
char buffer[8192];
- const char *proc_path;
long int result = -1;
- /* Get mount point of proc filesystem. */
- proc_path = get_proc_path (buffer, sizeof buffer);
-
/* If we haven't found an appropriate entry return 1. */
- if (proc_path != NULL)
+ FILE *fp = fopen ("/proc/meminfo", "rc");
+ if (fp != NULL)
{
- char *proc_meminfo = alloca (strlen (proc_path) + sizeof ("/meminfo"));
- __stpcpy (__stpcpy (proc_meminfo, proc_path), "/meminfo");
-
- fp = fopen (proc_meminfo, "rc");
- if (fp != NULL)
- {
- /* No threads use this stream. */
- __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
- result = 0;
- /* Read all lines and count the lines starting with the
- string "processor". We don't have to fear extremely long
- lines since the kernel will not generate them. 8192
- bytes are really enough. */
- while (fgets_unlocked (buffer, sizeof buffer, fp) != NULL)
- if (sscanf (buffer, format, &result) == 1)
- {
- result /= (__getpagesize () / 1024);
- break;
- }
+ /* No threads use this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
+ result = 0;
+ /* Read all lines and count the lines starting with the
+ string "processor". We don't have to fear extremely long
+ lines since the kernel will not generate them. 8192
+ bytes are really enough. */
+ while (fgets_unlocked (buffer, sizeof buffer, fp) != NULL)
+ if (sscanf (buffer, format, &result) == 1)
+ {
+ result /= (__getpagesize () / 1024);
+ break;
+ }
- fclose (fp);
- }
+ fclose (fp);
}
if (result == -1)
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index 7db3e3eeac..9e84975635 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -1,5 +1,5 @@
ifeq ($(subdir),misc)
-sysdep_routines += ioperm iopl vm86
+sysdep_routines += ioperm iopl vm86 call_pselect6
sysdep_headers += sys/elf.h sys/perm.h sys/reg.h sys/vm86.h sys/debugreg.h sys/io.h
endif
diff --git a/sysdeps/unix/sysv/linux/i386/call_pselect6.S b/sysdeps/unix/sysv/linux/i386/call_pselect6.S
new file mode 100644
index 0000000000..a356f1dfa9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/call_pselect6.S
@@ -0,0 +1,65 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#ifdef __NR_pselect6
+ .text
+ENTRY(__call_pselect6)
+ .hidden __call_pselect6
+ pushl %ebx
+ cfi_adjust_cfa_offset (4)
+ pushl %esi
+ cfi_adjust_cfa_offset (4)
+ pushl %edi
+ cfi_adjust_cfa_offset (4)
+ pushl %ebp
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (ebp, 0)
+ cfi_rel_offset (edi, 4)
+ cfi_rel_offset (esi, 8)
+ cfi_rel_offset (ebx, 12)
+
+ movl $__NR_pselect6, %eax
+ movl 20(%esp), %ebx
+ movl 24(%esp), %ecx
+ movl 28(%esp), %edx
+ movl 32(%esp), %esi
+ movl 36(%esp), %edi
+ movl 40(%esp), %ebp
+
+ /* The syscall handling cannot handle 6 parameters. Yet. */
+ int $0x80
+
+ popl %ebp
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebp)
+ popl %edi
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (edi)
+ popl %esi
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (esi)
+ popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+
+ ret
+END(__call_pselect6)
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/pselect.c b/sysdeps/unix/sysv/linux/i386/pselect.c
new file mode 100644
index 0000000000..2646608786
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/pselect.c
@@ -0,0 +1,18 @@
+#include <sys/select.h>
+
+extern int __call_pselect6 (int nfds, fd_set *readfds, fd_set *writefds,
+ fd_set *exceptfds, const struct timespec *timeout,
+ void *data) attribute_hidden;
+
+
+#define CALL_PSELECT6(nfds, readfds, writefds, exceptfds, timeout, data) \
+ ({ int r = __call_pselect6 (nfds, readfds, writefds, exceptfds, timeout, \
+ data); \
+ if (r < 0 && r > -4096) \
+ { \
+ __set_errno (-r); \
+ r = -1; \
+ } \
+ r; })
+
+#include "../pselect.c"
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h b/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h
index 80543976bb..8bd675e4ec 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h
@@ -1,5 +1,5 @@
/* Define the machine-dependent type `jmp_buf'. Linux/IA-64 version.
- Copyright (C) 1999, 2000, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999,2000,2003,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
@@ -32,9 +32,4 @@
/* the __jmp_buf element type should be __float80 per ABI... */
typedef long __jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */
-/* Test if longjmp to JMPBUF would unwind the frame containing a local
- variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \
- ((void *) (_address) < (void *) (((long int *) _jmpbuf)[0]))
-
#endif /* bits/setjmp.h */
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index b28cb73626..837a1c14fb 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -456,3 +456,34 @@
&& defined __arch64__
# define __ASSUME_STAT64_SYSCALL 1
#endif
+
+/* Early kernel used "shm" as the filesystem name for the filesystem used
+ for shm_open etc. Later it is "tmpfs". 2.4.20 is a safe bet for the
+ cutover. */
+#if __LINUX_KERNEL_VERSION >= 0x02041a
+# define __ASSUME_TMPFS_NAME 1
+#endif
+
+/* pselect was introduced just after 2.6.16-rc1. Due to the way the
+ kernel versions are advertised we can only rely on 2.6.17 to have
+ the code. */
+#if __LINUX_KERNEL_VERSION >= 0x020611 \
+ && (defined __i386__ || defined __powerpc__)
+# define __ASSUME_PSELECT 1
+#endif
+
+/* ppoll was introduced just after 2.6.16-rc1. Due to the way the
+ kernel versions are advertised we can only rely on 2.6.17 to have
+ the code. */
+#if __LINUX_KERNEL_VERSION >= 0x020611 \
+ && (defined __i386__ || defined __powerpc__)
+# define __ASSUME_PPOLL 1
+#endif
+
+/* The *at syscalls were introduced just after 2.6.16-rc1. Due to the way the
+ kernel versions are advertised we can only rely on 2.6.17 to have
+ the code. */
+#if __LINUX_KERNEL_VERSION >= 0x020611 \
+ && (defined __i386__ || defined __x86_64__)
+# define __ASSUME_ATFCTS 1
+#endif
diff --git a/sysdeps/unix/sysv/linux/linkat.c b/sysdeps/unix/sysv/linux/linkat.c
index 8ebff74215..5485b3f61c 100644
--- a/sysdeps/unix/sysv/linux/linkat.c
+++ b/sysdeps/unix/sysv/linux/linkat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <sysdep.h>
#include <unistd.h>
+#include <kernel-features.h>
/* Make a link to FROM named TO but relative paths in TO and FROM are
@@ -33,6 +34,24 @@ linkat (fromfd, from, tofd, to)
int tofd;
const char *to;
{
+ int result;
+
+#ifdef __NR_linkat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (linkat, 4, fromfd, from, tofd, to);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
static const char procfd[] = "/proc/self/fd/%d/%s";
char *buffrom = NULL;
@@ -74,7 +93,7 @@ linkat (fromfd, from, tofd, to)
INTERNAL_SYSCALL_DECL (err);
- int result = INTERNAL_SYSCALL (link, err, 2, from, to);
+ result = INTERNAL_SYSCALL (link, err, 2, from, to);
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
{
@@ -84,4 +103,5 @@ linkat (fromfd, from, tofd, to)
}
return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/mkdirat.c b/sysdeps/unix/sysv/linux/mkdirat.c
index 367441b05b..3c190085ce 100644
--- a/sysdeps/unix/sysv/linux/mkdirat.c
+++ b/sysdeps/unix/sysv/linux/mkdirat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
+#include <kernel-features.h>
#include <sysdep-cancel.h>
@@ -33,6 +34,24 @@ mkdirat (fd, file, mode)
const char *file;
mode_t mode;
{
+ int res;
+
+#ifdef __NR_mkdirat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ res = INLINE_SYSCALL (mkdirat, 3, fd, file, mode);
+# ifndef __ASSUME_ATFCTS
+ if (res == -1 && res == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return res;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
char *buf = NULL;
if (fd != AT_FDCWD && file[0] != '/')
@@ -54,7 +73,7 @@ mkdirat (fd, file, mode)
}
INTERNAL_SYSCALL_DECL (err);
- int res = INTERNAL_SYSCALL (mkdir, err, 2, file, mode);
+ res = INTERNAL_SYSCALL (mkdir, err, 2, file, mode);
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
{
@@ -63,4 +82,5 @@ mkdirat (fd, file, mode)
}
return res;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
index d5d976cbc4..67e9df2e45 100644
--- a/sysdeps/unix/sysv/linux/openat.c
+++ b/sysdeps/unix/sysv/linux/openat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 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
@@ -23,36 +23,54 @@
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
+#include <kernel-features.h>
#include <sysdep-cancel.h>
-#ifndef OPENAT
+#if !defined OPENAT && !defined __ASSUME_ATFCTS
# define OPENAT openat
-# define MORE_OFLAGS 0
void
attribute_hidden
__atfct_seterrno (int errval, int fd, const char *buf)
{
- if (buf != NULL && errval == ENOTDIR)
+ if (buf != NULL)
{
- /* This can mean either the file descriptor is invalid or
- /proc is not mounted. */
struct stat64 st;
- if (__fxstat64 (_STAT_VER, fd, &st) != 0)
- /* errno is already set correctly. */
- return;
-
- /* If /proc is not mounted there is nothing we can do. */
- if (S_ISDIR (st.st_mode)
- && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
- || !S_ISDIR (st.st_mode)))
- errval = ENOSYS;
+
+ if (errval == ENOTDIR)
+ {
+ /* This can mean either the file descriptor is invalid or
+ /proc is not mounted. */
+ if (__fxstat64 (_STAT_VER, fd, &st) != 0)
+ /* errno is already set correctly. */
+ return;
+
+ /* If /proc is not mounted there is nothing we can do. */
+ if (S_ISDIR (st.st_mode)
+ && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+ || !S_ISDIR (st.st_mode)))
+ errval = ENOSYS;
+ }
+ else if (errval == ENOENT)
+ {
+ /* This could mean the file descriptor is not valid. We
+ reuse BUF for the stat call. Find the slash after the
+ file descriptor number. */
+ *(char *) strchr (buf + sizeof "/proc/self/fd", '/') = '\0';
+
+ int e = __lxstat64 (_STAT_VER, buf, &st);
+ if ((e == -1 && errno == ENOENT)
+ ||(e == 0 && !S_ISLNK (st.st_mode)))
+ errval = EBADF;
+ }
}
__set_errno (errval);
}
+
+int __have_atfcts;
#endif
/* Open FILE with access OFLAG. Interpret relative paths relative to
@@ -64,6 +82,49 @@ OPENAT (fd, file, oflag)
const char *file;
int oflag;
{
+ mode_t mode = 0;
+ if (oflag & O_CREAT)
+ {
+ va_list arg;
+ va_start (arg, oflag);
+ mode = va_arg (arg, mode_t);
+ va_end (arg);
+ }
+
+ /* We have to add the O_LARGEFILE flag for openat64. */
+#ifdef MORE_OFLAGS
+ oflag |= MORE_OFLAGS;
+#endif
+
+ INTERNAL_SYSCALL_DECL (err);
+ int res;
+
+#ifdef __NR_openat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ if (SINGLE_THREAD_P)
+ res = INLINE_SYSCALL (openat, 4, fd, file, oflag, mode);
+ else
+ {
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ res = INLINE_SYSCALL (openat, 4, fd, file, oflag, mode);
+
+ LIBC_CANCEL_RESET (oldtype);
+ }
+
+# ifndef __ASSUME_ATFCTS
+ if (res == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return res;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
char *buf = NULL;
if (fd != AT_FDCWD && file[0] != '/')
@@ -84,25 +145,13 @@ OPENAT (fd, file, oflag)
file = buf;
}
- mode_t mode = 0;
- if (oflag & O_CREAT)
- {
- va_list arg;
- va_start (arg, oflag);
- mode = va_arg (arg, mode_t);
- va_end (arg);
- }
-
- INTERNAL_SYSCALL_DECL (err);
- int res;
-
if (SINGLE_THREAD_P)
- res = INTERNAL_SYSCALL (open, err, 3, file, oflag | MORE_OFLAGS, mode);
+ res = INTERNAL_SYSCALL (open, err, 3, file, oflag, mode);
else
{
int oldtype = LIBC_CANCEL_ASYNC ();
- res = INTERNAL_SYSCALL (open, err, 3, file, oflag | MORE_OFLAGS, mode);
+ res = INTERNAL_SYSCALL (open, err, 3, file, oflag, mode);
LIBC_CANCEL_RESET (oldtype);
}
@@ -114,4 +163,5 @@ OPENAT (fd, file, oflag)
}
return res;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/powerpc/Implies b/sysdeps/unix/sysv/linux/powerpc/Implies
new file mode 100644
index 0000000000..ff27cdb568
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/Implies
@@ -0,0 +1,4 @@
+# Make sure these routines come before ldbl-opt.
+ieee754/ldbl-128ibm
+# These supply the ABI compatibility for when long double was double.
+ieee754/ldbl-opt
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
new file mode 100644
index 0000000000..cf934234f1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
@@ -0,0 +1,19 @@
+/* Determine the wordsize from the preprocessor defines. */
+
+#if defined __powerpc64__
+# define __WORDSIZE 64
+# define __WORDSIZE_COMPAT32 1
+#else
+# define __WORDSIZE 32
+#endif
+
+#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
+
+/* Signal the glibc ABI didn't used to have a `long double'.
+ The changes all the `long double' function variants to be redirects
+ to the double functions. */
+# define __LONG_DOUBLE_MATH_OPTIONAL 1
+# ifndef __LONG_DOUBLE_128__
+# define __NO_LONG_DOUBLE_MATH 1
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/configure b/sysdeps/unix/sysv/linux/powerpc/configure
new file mode 100644
index 0000000000..070bf5caeb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/configure
@@ -0,0 +1,135 @@
+# This file is generated from configure.in by Autoconf. DO NOT EDIT!
+ # Local configure fragment for sysdeps/unix/sysv/linux/powerpc/.
+
+
+echo "$as_me:$LINENO: checking whether $CC $CFLAGS -mlong-double-128 uses IBM extended format" >&5
+echo $ECHO_N "checking whether $CC $CFLAGS -mlong-double-128 uses IBM extended format... $ECHO_C" >&6
+if test "${libc_cv_mlong_double_128ibm+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mlong-double-128"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <float.h>
+int
+main ()
+{
+
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ libc_cv_mlong_double_128ibm=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libc_cv_mlong_double_128ibm=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $libc_cv_mlong_double_128ibm" >&5
+echo "${ECHO_T}$libc_cv_mlong_double_128ibm" >&6
+
+if test "$libc_cv_mlong_double_128ibm" = no; then
+ echo "$as_me:$LINENO: checking whether $CC $CFLAGS supports -mabi=ibmlongdouble" >&5
+echo $ECHO_N "checking whether $CC $CFLAGS supports -mabi=ibmlongdouble... $ECHO_C" >&6
+if test "${libc_cv_mabi_ibmlongdouble+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -mlong-double-128 -mabi=ibmlongdouble"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <float.h>
+int
+main ()
+{
+
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ libc_cv_mabi_ibmlongdouble=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libc_cv_mabi_ibmlongdouble=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $libc_cv_mabi_ibmlongdouble" >&5
+echo "${ECHO_T}$libc_cv_mabi_ibmlongdouble" >&6
+
+ if test "$libc_cv_mabi_ibmlongdouble" = yes; then
+ CFLAGS="$CFLAGS -mabi=ibmlongdouble"
+ else
+ { { echo "$as_me:$LINENO: error: this configuration requires -mlong-double-128 IBM extended format support" >&5
+echo "$as_me: error: this configuration requires -mlong-double-128 IBM extended format support" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+fi
diff --git a/sysdeps/unix/sysv/linux/powerpc/configure.in b/sysdeps/unix/sysv/linux/powerpc/configure.in
new file mode 100644
index 0000000000..1768ab1f99
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/configure.in
@@ -0,0 +1,37 @@
+sinclude(./aclocal.m4)dnl Autoconf lossage
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/unix/sysv/linux/powerpc/.
+
+AC_CACHE_CHECK(whether $CC $CFLAGS -mlong-double-128 uses IBM extended format,
+ libc_cv_mlong_double_128ibm, [dnl
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mlong-double-128"
+AC_TRY_COMPILE([#include <float.h>], [
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }],
+ libc_cv_mlong_double_128ibm=yes,
+ libc_cv_mlong_double_128ibm=no)
+CFLAGS="$save_CFLAGS"])
+
+if test "$libc_cv_mlong_double_128ibm" = no; then
+ AC_CACHE_CHECK(whether $CC $CFLAGS supports -mabi=ibmlongdouble,
+ libc_cv_mabi_ibmlongdouble, [dnl
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -mlong-double-128 -mabi=ibmlongdouble"
+ AC_TRY_COMPILE([#include <float.h>], [
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }],
+ libc_cv_mabi_ibmlongdouble=yes,
+ libc_cv_mabi_ibmlongdouble=no)
+ CFLAGS="$save_CFLAGS"])
+
+ if test "$libc_cv_mabi_ibmlongdouble" = yes; then
+ CFLAGS="$CFLAGS -mabi=ibmlongdouble"
+ else
+ AC_MSG_ERROR([this configuration requires -mlong-double-128 IBM extended format support])
+ fi
+fi
diff --git a/sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h b/sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h
new file mode 100644
index 0000000000..bd985cc59c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h
@@ -0,0 +1,8 @@
+/* ABI version for long double switch.
+ This is used by the Versions and math_ldbl_opt.h files in
+ sysdeps/ieee754/ldbl-opt/. It gives the ABI version where
+ long double == double was replaced with proper long double
+ for libm *l functions and libc functions using long double. */
+
+#define NLDBL_VERSION GLIBC_2.4
+#define LONG_DOUBLE_COMPAT_VERSION GLIBC_2_4
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies
new file mode 100644
index 0000000000..9f70f795bc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies
@@ -0,0 +1,2 @@
+# Override ldbl-opt with powerpc32 specific routines.
+powerpc/powerpc32/fpu
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies
new file mode 100644
index 0000000000..6243d2ef27
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies
@@ -0,0 +1,2 @@
+# Override ldbl-opt with powerpc64 specific routines.
+powerpc/powerpc64/fpu
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index 858b5c4757..fd67f56983 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1997,1998,1999,2000,2001,2002,2003,2004,2005
+/* Copyright (C) 1992,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -303,7 +303,7 @@
# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
# else
# define PTR_MANGLE(var) \
- (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+ (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
# define PTR_DEMANGLE(var) PTR_MANGLE (var)
# endif
#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h b/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
index bb9a08b3f6..d2d5972411 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1999, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1999, 2002, 2006 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
@@ -38,7 +38,11 @@ __BEGIN_DECLS
#ifndef __PPC64_ELF_H
#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */
#define ELF_NFPREG 33 /* includes fpscr */
-#define ELF_NVRREG 33 /* includes vscr */
+#if __WORDSIZE == 32
+# define ELF_NVRREG 33 /* includes vscr */
+#else
+# define ELF_NVRREG 34 /* includes vscr */
+#endif
typedef unsigned long elf_greg_t;
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
diff --git a/sysdeps/unix/sysv/linux/ppoll.c b/sysdeps/unix/sysv/linux/ppoll.c
new file mode 100644
index 0000000000..cfc86ba806
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ppoll.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+#include <time.h>
+#include <sys/poll.h>
+#include <kernel-features.h>
+#include <sysdep-cancel.h>
+
+
+#ifdef __NR_ppoll
+static int __generic_ppoll (struct pollfd *fds, nfds_t nfds,
+ const struct timespec *timeout,
+ const sigset_t *sigmask);
+
+
+int
+ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
+ const sigset_t *sigmask)
+{
+ /* The Linux kernel can in some situations update the timeout value.
+ We do not want that so use a local variable. */
+ struct timespec tval;
+ if (timeout != NULL)
+ {
+ tval = *timeout;
+ timeout = &tval;
+ }
+
+ int result;
+
+ if (SINGLE_THREAD_P)
+ result = INLINE_SYSCALL (ppoll, 5, fds, nfds, timeout, sigmask, _NSIG / 8);
+ else
+ {
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ result = INLINE_SYSCALL (ppoll, 5, fds, nfds, timeout, sigmask,
+ _NSIG / 8);
+
+ LIBC_CANCEL_RESET (oldtype);
+ }
+
+# ifndef __ASSUME_PPOLL
+ if (result == -1 && errno == ENOSYS)
+ result = __generic_ppoll (fds, nfds, timeout, sigmask);
+# endif
+
+ return result;
+}
+
+# ifndef __ASSUME_PPOLL
+# define ppoll static __generic_ppoll
+# endif
+#endif
+
+#ifndef __ASSUME_PPOLL
+# include <io/ppoll.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/pselect.c b/sysdeps/unix/sysv/linux/pselect.c
new file mode 100644
index 0000000000..0dd744f527
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/pselect.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+#include <time.h>
+#include <sys/poll.h>
+#include <kernel-features.h>
+#include <sysdep-cancel.h>
+
+
+#ifdef __NR_pselect6
+static int __generic_pselect (int nfds, fd_set *readfds, fd_set *writefds,
+ fd_set *exceptfds,
+ const struct timespec *timeout,
+ const sigset_t *sigmask);
+
+
+int
+__pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+ const struct timespec *timeout, const sigset_t *sigmask)
+{
+ /* The Linux kernel can in some situations update the timeout value.
+ We do not want that so use a local variable. */
+ struct timespec tval;
+ if (timeout != NULL)
+ {
+ tval = *timeout;
+ timeout = &tval;
+ }
+
+ /* Note: the system call expects 7 values but on most architectures
+ we can only pass in 6 directly. If there is an architecture with
+ support for more parameters a new version of this file needs to
+ be created. */
+ struct
+ {
+ const sigset_t *ss;
+ size_t ss_len;
+ } data;
+
+ data.ss = sigmask;
+ data.ss_len = _NSIG / 8;
+
+ int result;
+
+#ifndef CALL_PSELECT6
+# define CALL_PSELECT6(nfds, readfds, writefds, exceptfds, timeout, data) \
+ INLINE_SYSCALL (pselect6, 6, nfds, readfds, writefds, exceptfds, \
+ timeout, data)
+#endif
+
+ if (SINGLE_THREAD_P)
+ result = CALL_PSELECT6 (nfds, readfds, writefds, exceptfds, timeout,
+ &data);
+ else
+ {
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ result = CALL_PSELECT6 (nfds, readfds, writefds, exceptfds, timeout,
+ &data);
+
+ LIBC_CANCEL_RESET (oldtype);
+ }
+
+# ifndef __ASSUME_PSELECT
+ if (result == -1 && errno == ENOSYS)
+ result = __generic_pselect (nfds, readfds, writefds, exceptfds, timeout,
+ sigmask);
+# endif
+
+ return result;
+}
+weak_alias (__pselect, pselect)
+strong_alias (__pselect, __libc_pselect)
+
+# ifndef __ASSUME_PSELECT
+# define __pselect static __generic_pselect
+# endif
+#endif
+
+#ifndef __ASSUME_PSELECT
+# include <misc/pselect.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/readlinkat.c b/sysdeps/unix/sysv/linux/readlinkat.c
index 42c3877bd7..c2f21ee4ca 100644
--- a/sysdeps/unix/sysv/linux/readlinkat.c
+++ b/sysdeps/unix/sysv/linux/readlinkat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 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
@@ -24,6 +24,7 @@
#include <string.h>
#include <sysdep.h>
#include <unistd.h>
+#include <kernel-features.h>
/* Read the contents of the symbolic link PATH relative to FD into no
@@ -35,6 +36,24 @@ readlinkat (fd, path, buf, len)
char *buf;
size_t len;
{
+ int result;
+
+#ifdef __NR_readlinkat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (readlinkat, 4, fd, path, buf, len);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
char *pathbuf = NULL;
if (fd != AT_FDCWD && path[0] != '/')
@@ -57,7 +76,7 @@ readlinkat (fd, path, buf, len)
INTERNAL_SYSCALL_DECL (err);
- int result = INTERNAL_SYSCALL (readlink, err, 3, path, buf, len);
+ result = INTERNAL_SYSCALL (readlink, err, 3, path, buf, len);
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
{
@@ -66,4 +85,5 @@ readlinkat (fd, path, buf, len)
}
return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/renameat.c b/sysdeps/unix/sysv/linux/renameat.c
index 849c67b5d6..86bb75a7b0 100644
--- a/sysdeps/unix/sysv/linux/renameat.c
+++ b/sysdeps/unix/sysv/linux/renameat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 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
@@ -20,53 +20,87 @@
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
+#include <kernel-features.h>
#include <sysdep.h>
+#ifndef __ASSUME_ATFCTS
void
attribute_hidden
__atfct_seterrno_2 (int errval, int fd1, const char *buf1, int fd2,
const char *buf2)
{
- if (errval == ENOTDIR && (buf1 != NULL || buf2 != NULL))
+ if (buf1 != NULL || buf2 != NULL)
{
- /* This can mean either the file descriptor is invalid or
- /proc is not mounted. */
struct stat64 st;
- if (buf1 != NULL)
+ if (errval == ENOTDIR)
{
- if (__fxstat64 (_STAT_VER, fd1, &st) != 0)
- /* errno is already set correctly. */
- return;
-
- /* If /proc is not mounted there is nothing we can do. */
- if (S_ISDIR (st.st_mode)
- && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
- || !S_ISDIR (st.st_mode)))
+ /* This can mean either the file descriptor is invalid or
+ /proc is not mounted. */
+ if (buf1 != NULL)
{
- errval = ENOSYS;
- goto out;
+ if (__fxstat64 (_STAT_VER, fd1, &st) != 0)
+ /* errno is already set correctly. */
+ return;
+
+ /* If /proc is not mounted there is nothing we can do. */
+ if (S_ISDIR (st.st_mode)
+ && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+ || !S_ISDIR (st.st_mode)))
+ {
+ errval = ENOSYS;
+ goto out;
+ }
}
- }
- if (buf2 != NULL)
+ if (buf2 != NULL)
+ {
+ if (__fxstat64 (_STAT_VER, fd2, &st) != 0)
+ /* errno is already set correctly. */
+ return;
+
+ /* If /proc is not mounted there is nothing we can do. */
+ if (S_ISDIR (st.st_mode)
+ && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+ || !S_ISDIR (st.st_mode)))
+ errval = ENOSYS;
+ }
+ }
+ else if (errval == ENOENT)
{
- if (__fxstat64 (_STAT_VER, fd2, &st) != 0)
- /* errno is already set correctly. */
- return;
-
- /* If /proc is not mounted there is nothing we can do. */
- if (S_ISDIR (st.st_mode)
- && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
- || !S_ISDIR (st.st_mode)))
- errval = ENOSYS;
+ /* This could mean the file descriptor is not valid. We
+ reuse BUF for the stat call. Find the slash after the
+ file descriptor number. */
+ if (buf1 != NULL)
+ {
+ *(char *) strchr (buf1 + sizeof "/proc/self/fd", '/') = '\0';
+
+ int e = __lxstat64 (_STAT_VER, buf1, &st);
+ if ((e == -1 && errno == ENOENT)
+ ||(e == 0 && !S_ISLNK (st.st_mode)))
+ {
+ errval = EBADF;
+ goto out;
+ }
+ }
+
+ if (buf2 != NULL)
+ {
+ *(char *) strchr (buf2 + sizeof "/proc/self/fd", '/') = '\0';
+
+ int e = __lxstat64 (_STAT_VER, buf2, &st);
+ if ((e == -1 && errno == ENOENT)
+ ||(e == 0 && !S_ISLNK (st.st_mode)))
+ errval = EBADF;
+ }
}
}
out:
__set_errno (errval);
}
+#endif
/* Rename the file OLD relative to OLDFD to NEW relative to NEWFD. */
@@ -77,6 +111,24 @@ renameat (oldfd, old, newfd, new)
int newfd;
const char *new;
{
+ int result;
+
+#ifdef __NR_renameat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (renameat, 4, oldfd, old, newfd, new);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
static const char procfd[] = "/proc/self/fd/%d/%s";
char *bufold = NULL;
@@ -118,7 +170,7 @@ renameat (oldfd, old, newfd, new)
INTERNAL_SYSCALL_DECL (err);
- int result = INTERNAL_SYSCALL (rename, err, 2, old, new);
+ result = INTERNAL_SYSCALL (rename, err, 2, old, new);
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
{
@@ -128,4 +180,5 @@ renameat (oldfd, old, newfd, new)
}
return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.h b/sysdeps/unix/sysv/linux/sh/sysdep.h
index b41236299d..f0be37edc8 100644
--- a/sysdeps/unix/sysv/linux/sh/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sh/sysdep.h
@@ -1,5 +1,5 @@
/* Copyright (C) 1992,1993,1995,1996,1997,1998,1999,2000,2002,2003,2004,
- 2005 Free Software Foundation, Inc.
+ 2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
Changed by Kaz Kojima, <kkojima@rr.iij4u.or.jp>.
@@ -376,9 +376,11 @@
is too complicated here since we have no PC-relative addressing mode. */
#else
# ifdef __ASSEMBLER__
-# define PTR_MANGLE(reg) \
- stc gbr,r1; mov.l @(POINTER_GUARD,r1),r1; xor r1,reg
-# define PTR_DEMANGLE(reg) PTR_MANGLE (reg)
+# define PTR_MANGLE(reg, tmp) \
+ stc gbr,tmp; mov.l @(POINTER_GUARD,tmp),tmp; xor tmp,reg
+# define PTR_MANGLE2(reg, tmp) xor tmp,reg
+# define PTR_DEMANGLE(reg, tmp) PTR_MANGLE (reg, tmp)
+# define PTR_DEMANGLE2(reg, tmp) PTR_MANGLE2 (reg, tmp)
# else
# define PTR_MANGLE(var) \
(var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
diff --git a/sysdeps/unix/sysv/linux/shm_open.c b/sysdeps/unix/sysv/linux/shm_open.c
index 2e94b76cdb..0d40632e5f 100644
--- a/sysdeps/unix/sysv/linux/shm_open.c
+++ b/sysdeps/unix/sysv/linux/shm_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2001,2002,2003,2004,2006 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
@@ -29,6 +29,8 @@
#include <bits/libc-lock.h>
#include "linux_fsinfo.h"
+#include <kernel-features.h>
+
/* Mount point of the shared memory filesystem. */
static struct
@@ -81,7 +83,10 @@ where_is_shmfs (void)
/* The original name is "shm" but this got changed in early Linux
2.4.x to "tmpfs". */
if (strcmp (mp->mnt_type, "tmpfs") == 0
- || strcmp (mp->mnt_type, "shm") == 0)
+#ifndef __ASSUME_TMPFS_NAME
+ || strcmp (mp->mnt_type, "shm") == 0
+#endif
+ )
{
/* Found it. There might be more than one place where the
filesystem is mounted but one is enough for us. */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h b/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
index 4fb7c90fd5..b44cc0fcd5 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
@@ -58,28 +58,12 @@ typedef struct __sparc64_jmp_buf
} __jmp_buf[1];
#endif
-/* Test if longjmp to JMPBUF would unwind the frame
- containing a local variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
- ((unsigned long int) (address) < (jmpbuf)->uc_mcontext.mc_fp + 2047)
-
#else
-#if defined __USE_MISC || defined _ASM
-# define JB_SP 0
-# define JB_FP 1
-# define JB_PC 2
-#endif
-
#ifndef _ASM
typedef int __jmp_buf[3];
#endif
-/* Test if longjmp to JMPBUF would unwind the frame
- containing a local variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
- ((int) (address) < demangle ((jmpbuf)[JB_SP]))
-
#endif
#endif /* bits/setjmp.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
new file mode 100644
index 0000000000..2d958d29e5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
@@ -0,0 +1,20 @@
+/* Determine the wordsize from the preprocessor defines. */
+
+#if defined __arch64__ || defined __sparcv9
+# define __WORDSIZE 64
+#else
+# define __WORDSIZE 32
+#endif
+
+#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
+
+# if __WORDSIZE == 32
+/* Signal that in 32bit ABI we didn't used to have a `long double'.
+ The changes all the `long double' function variants to be redirects
+ to the double functions. */
+# define __LONG_DOUBLE_MATH_OPTIONAL 1
+# ifndef __LONG_DOUBLE_128__
+# define __NO_LONG_DOUBLE_MATH 1
+# endif
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Implies b/sysdeps/unix/sysv/linux/sparc/sparc32/Implies
new file mode 100644
index 0000000000..efda9d27c0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Implies
@@ -0,0 +1,3 @@
+# These supply the ABI compatibility for when long double was double.
+ieee754/ldbl-64-128
+ieee754/ldbl-opt
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h b/sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h
new file mode 100644
index 0000000000..bd985cc59c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h
@@ -0,0 +1,8 @@
+/* ABI version for long double switch.
+ This is used by the Versions and math_ldbl_opt.h files in
+ sysdeps/ieee754/ldbl-opt/. It gives the ABI version where
+ long double == double was replaced with proper long double
+ for libm *l functions and libc functions using long double. */
+
+#define NLDBL_VERSION GLIBC_2.4
+#define LONG_DOUBLE_COMPAT_VERSION GLIBC_2_4
diff --git a/sysdeps/unix/sysv/linux/symlinkat.c b/sysdeps/unix/sysv/linux/symlinkat.c
index 211b49c299..4cfc924bfc 100644
--- a/sysdeps/unix/sysv/linux/symlinkat.c
+++ b/sysdeps/unix/sysv/linux/symlinkat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 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
@@ -24,6 +24,7 @@
#include <string.h>
#include <sysdep.h>
#include <unistd.h>
+#include <kernel-features.h>
/* Make a symbolic link to FROM named TO relative to TOFD. */
@@ -33,6 +34,24 @@ symlinkat (from, tofd, to)
int tofd;
const char *to;
{
+ int result;
+
+#ifdef __NR_symlinkat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (symlinkat, 3, from, tofd, to);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
char *buf = NULL;
if (tofd != AT_FDCWD && to[0] != '/')
@@ -55,7 +74,7 @@ symlinkat (from, tofd, to)
INTERNAL_SYSCALL_DECL (err);
- int result = INTERNAL_SYSCALL (symlink, err, 2, from, to);
+ result = INTERNAL_SYSCALL (symlink, err, 2, from, to);
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
{
@@ -64,4 +83,5 @@ symlinkat (from, tofd, to)
}
return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/unlinkat.c b/sysdeps/unix/sysv/linux/unlinkat.c
index 821029f5e5..0a07a8a875 100644
--- a/sysdeps/unix/sysv/linux/unlinkat.c
+++ b/sysdeps/unix/sysv/linux/unlinkat.c
@@ -1,5 +1,5 @@
/* unlinkat -- Remove a link by relative name.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 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
@@ -25,6 +25,7 @@
#include <string.h>
#include <sysdep.h>
#include <unistd.h>
+#include <kernel-features.h>
/* Remove the link named NAME. */
@@ -34,6 +35,24 @@ unlinkat (fd, file, flag)
const char *file;
int flag;
{
+ int result;
+
+#ifdef __NR_unlinkat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (unlinkat, 3, fd, file, flag);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
if (flag & ~AT_REMOVEDIR)
{
__set_errno (EINVAL);
@@ -60,7 +79,6 @@ unlinkat (fd, file, flag)
file = buf;
}
- int result;
INTERNAL_SYSCALL_DECL (err);
if (flag & AT_REMOVEDIR)
@@ -75,4 +93,5 @@ unlinkat (fd, file, flag)
}
return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
index faa028cf26..0c37495575 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -28,15 +28,40 @@
#include <sys/stat.h>
#include <sysdep.h>
+#include <kernel-features.h>
#include <sys/syscall.h>
#include <bp-checks.h>
+
/* Get information about the file NAME relative to FD in ST. */
int
__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
{
- if ((vers != _STAT_VER_KERNEL && vers != _STAT_VER_LINUX)
- || (flag & ~AT_SYMLINK_NOFOLLOW) != 0)
+ if (vers != _STAT_VER_KERNEL && vers != _STAT_VER_LINUX)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ int res;
+
+#ifdef __NR_newfstatat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ res = INLINE_SYSCALL (newfstatat, 4, fd, file, st, flag);
+# ifndef __ASSUME_ATFCTS
+ if (res == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return res;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+ if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
{
__set_errno (EINVAL);
return -1;
@@ -63,7 +88,6 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
}
INTERNAL_SYSCALL_DECL (err);
- int res;
if (flag & AT_SYMLINK_NOFOLLOW)
res = INTERNAL_SYSCALL (lstat, err, 2, file, CHECK_1 (st));
@@ -77,6 +101,8 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
}
return res;
+#endif
}
#undef __fxstatat64
strong_alias (__fxstatat, __fxstatat64);
+strong_alias (__fxstatat64, __GI___fxstatat64)
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h b/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
index 08d4c52b2f..c0d5fe72d4 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
@@ -70,6 +70,14 @@ struct _fpstate
__uint32_t padding[56];
};
+#ifndef sigcontext_struct
+/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
+ we need sigcontext. Some packages have come to rely on
+ sigcontext_struct being defined on 32-bit x86, so define this for
+ their benefit. */
+# define sigcontext_struct sigcontext
+#endif
+
struct sigcontext
{
unsigned short gs, __gsh;
diff --git a/sysdeps/unix/sysv/linux/xmknodat.c b/sysdeps/unix/sysv/linux/xmknodat.c
index 9332ae683e..ef27b686cc 100644
--- a/sysdeps/unix/sysv/linux/xmknodat.c
+++ b/sysdeps/unix/sysv/linux/xmknodat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 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
@@ -25,9 +25,11 @@
#include <sys/sysmacros.h>
#include <sysdep.h>
+#include <kernel-features.h>
#include <sys/syscall.h>
#include <bp-checks.h>
+
/* Create a device file named PATH relative to FD, with permission and
special bits MODE and device number DEV (which can be constructed
from major and minor device numbers with the `makedev' macro above). */
@@ -40,6 +42,31 @@ __xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev)
return -1;
}
+ /* We must convert the value to dev_t type used by the kernel. */
+ unsigned long long int k_dev = (*dev) & ((1ULL << 32) - 1);
+ if (k_dev != *dev)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+#ifdef __NR_mknodat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ int res = INLINE_SYSCALL (mknodat, 4, fd, file, mode,
+ (unsigned int) k_dev);
+# ifndef __ASSUME_ATFCTS
+ if (res == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return res;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
char *buf = NULL;
if (fd != AT_FDCWD && file[0] != '/')
@@ -60,16 +87,9 @@ __xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev)
file = buf;
}
- /* We must convert the value to dev_t type used by the kernel. */
- unsigned long long int k_dev = (*dev) & ((1ULL << 32) - 1);
- if (k_dev != *dev)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
return INLINE_SYSCALL (mknod, 3, CHECK_STRING (file), mode,
(unsigned int) k_dev);
+#endif
}
libc_hidden_def (__xmknodat)
diff --git a/sysdeps/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S
index 6e21092451..a68e7a8a4f 100644
--- a/sysdeps/x86_64/__longjmp.S
+++ b/sysdeps/x86_64/__longjmp.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2001,2004,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,9 +17,7 @@
02111-1307 USA. */
#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
#include <asm-syntax.h>
/* Jump to the position specified by ENV, causing the
diff --git a/sysdeps/x86_64/bits/setjmp.h b/sysdeps/x86_64/bits/setjmp.h
index 1031d5027b..c9b98b2e3b 100644
--- a/sysdeps/x86_64/bits/setjmp.h
+++ b/sysdeps/x86_64/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2001,2002,2003,2005,2006 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
@@ -26,36 +26,6 @@
#include <bits/wordsize.h>
-#if __WORDSIZE == 64
-
-/* We only need to save callee-saved registers plus stackpointer and
- program counter. */
-# if defined __USE_MISC || defined _ASM
-# define JB_RBX 0
-# define JB_RBP 1
-# define JB_R12 2
-# define JB_R13 3
-# define JB_R14 4
-# define JB_R15 5
-# define JB_RSP 6
-# define JB_PC 7
-# define JB_SIZE (8*8)
-# endif
-
-#else
-
-# if defined __USE_MISC || defined _ASM
-# define JB_BX 0
-# define JB_SI 1
-# define JB_DI 2
-# define JB_BP 3
-# define JB_SP 4
-# define JB_PC 5
-# define JB_SIZE 24
-# endif
-
-#endif
-
#ifndef _ASM
# if __WORDSIZE == 64
@@ -64,15 +34,6 @@ typedef long int __jmp_buf[8];
typedef int __jmp_buf[6];
# endif
-/* Test if longjmp to JMPBUF would unwind the frame
- containing a local variable at ADDRESS. */
-# if __WORDSIZE == 64
-# define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
- ((void *) (address) < (void *) demangle ((jmpbuf)[JB_RSP]))
-# else
-# define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
- ((void *) (address) < (void *) demangle ((jmpbuf)[JB_SP]))
-# endif
#endif
#endif /* bits/setjmp.h */
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index 425549dd0e..0ced4be7b8 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -48,14 +48,14 @@ ildouble: 2
ldouble: 2
# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 7
idouble: 1
ifloat: 7
ildouble: 6
ldouble: 6
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 3
idouble: 1
diff --git a/sysdeps/x86_64/jmpbuf-offsets.h b/sysdeps/x86_64/jmpbuf-offsets.h
new file mode 100644
index 0000000000..46c7768013
--- /dev/null
+++ b/sysdeps/x86_64/jmpbuf-offsets.h
@@ -0,0 +1,30 @@
+/* Private macros for accessing __jmp_buf contents. x86-64 version.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* We only need to save callee-saved registers plus stackpointer and
+ program counter. */
+#define JB_RBX 0
+#define JB_RBP 1
+#define JB_R12 2
+#define JB_R13 3
+#define JB_R14 4
+#define JB_R15 5
+#define JB_RSP 6
+#define JB_PC 7
+#define JB_SIZE (8*8)
diff --git a/nptl/sysdeps/x86_64/jmpbuf-unwind.h b/sysdeps/x86_64/jmpbuf-unwind.h
index 1a36c53d11..299a4a8d14 100644
--- a/nptl/sysdeps/x86_64/jmpbuf-unwind.h
+++ b/sysdeps/x86_64/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -18,10 +18,16 @@
02111-1307 USA. */
#include <setjmp.h>
+#include <jmpbuf-offsets.h>
#include <stdint.h>
#include <unwind.h>
#include <sysdep.h>
+/* Test if longjmp to JMPBUF would unwind the frame
+ containing a local variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+ ((void *) (address) < (void *) demangle ((jmpbuf)[JB_RSP]))
+
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
@@ -38,5 +44,5 @@ _jmpbuf_sp (__jmp_buf regs)
#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
-/* We use the normal lobngjmp for unwinding. */
+/* We use the normal longjmp for unwinding. */
#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/x86_64/setjmp.S b/sysdeps/x86_64/setjmp.S
index 39c78c9981..a66b0e61e5 100644
--- a/sysdeps/x86_64/setjmp.S
+++ b/sysdeps/x86_64/setjmp.S
@@ -1,5 +1,5 @@
/* setjmp for x86-64.
- Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2005, 2006 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
@@ -18,9 +18,7 @@
02111-1307 USA. */
#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
#include <asm-syntax.h>
ENTRY (__sigsetjmp)
diff --git a/sysdeps/x86_64/strtok.S b/sysdeps/x86_64/strtok.S
index de427dc6f3..4037f0b850 100644
--- a/sysdeps/x86_64/strtok.S
+++ b/sysdeps/x86_64/strtok.S
@@ -1,6 +1,6 @@
/* strtok (str, delim) -- Return next DELIM separated token from STR.
For AMD x86-64.
- Copyright (C) 1998,2000,2001,2002,2003,2005 Free Software Foundation, Inc.
+ Copyright (C) 1998,2000-2003,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Based on i686 version contributed by Ulrich Drepper
<drepper@cygnus.com>, 1998.
@@ -205,6 +205,8 @@ L(epilogue):
L(returnNULL):
xorl %eax, %eax
+ /* Store the pointer to the next character. */
+ movq %rdx, SAVE_PTR
jmp L(epilogue)
END (BP_SYM (FUNCTION))
diff --git a/time/time.h b/time/time.h
index 27e0d8bc36..6c8f79d422 100644
--- a/time/time.h
+++ b/time/time.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-1999,2000,2001,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999,2000,2001,2002,2003,2006
+ 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
@@ -113,6 +114,8 @@ typedef __timer_t timer_t;
defined __need_timespec)
# define __timespec_defined 1
+# include <bits/types.h> /* This defines __time_t for us. */
+
/* POSIX.1b structure for a time value. This is like a `struct timeval' but
has nanoseconds instead of microseconds. */
struct timespec
diff --git a/timezone/africa b/timezone/africa
index 87ae9e36e5..153e2546b3 100644
--- a/timezone/africa
+++ b/timezone/africa
@@ -1,4 +1,5 @@
-# @(#)africa 7.39
+# @(#)africa 7.40
+# <pre>
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
diff --git a/timezone/antarctica b/timezone/antarctica
index c11d24e7d5..f3efe19b68 100644
--- a/timezone/antarctica
+++ b/timezone/antarctica
@@ -1,4 +1,5 @@
-# @(#)antarctica 7.25
+# @(#)antarctica 7.30
+# <pre>
# From Paul Eggert (1999-11-15):
# To keep things manageable, we list only locations occupied year-round; see
@@ -59,7 +60,7 @@ Rule ChileAQ 2000 max - Mar Sun>=9 0:00 0 -
# Australia - territories
# Heard Island, McDonald Islands (uninhabited)
# previously sealers and scientific personnel wintered
-# <a href="http://www.dstc.qut.edu.au/DST/marg/daylight.html">
+# <a href="http://web.archive.org/web/20021204222245/http://www.dstc.qut.edu.au/DST/marg/daylight.html">
# Margaret Turner reports
# </a> (1999-09-30) that they're UTC+5, with no DST;
# presumably this is when they have visitors.
@@ -106,7 +107,7 @@ Zone Antarctica/Mawson 0 - zzz 1954 Feb 13
# France - year-round bases
#
-# From Antoine Leca <Antoine.Leca@Renault.FR> (1997-01-20):
+# From Antoine Leca (1997-01-20):
# Time data are from Nicole Pailleau at the IFRTP
# (French Institute for Polar Research and Technology).
# She confirms that French Southern Territories and Terre Adelie bases
@@ -139,11 +140,10 @@ Zone Antarctica/DumontDUrville 0 - zzz 1947
0 - zzz 1956 Nov
10:00 - DDUT # Dumont-d'Urville Time
# Reference:
-# <a href="http://www.icair.iac.org.nz/science/reports/fr/IFRTP.html">
-# Support and Development of Polar Research and Technology (1997-02-03)
+# <a href="http://en.wikipedia.org/wiki/Dumont_d'Urville_Station">
+# Dumont d'Urville Station (2005-12-05)
# </a>
-
# Germany - year-round base
# Georg von Neumayer, -7039-00815
@@ -155,9 +155,7 @@ Zone Antarctica/DumontDUrville 0 - zzz 1947
# Syowa, -690022+0393524
#
# From Hideyuki Suzuki (1999-02-06):
-# In all Japanese stations, +0300 is used as the standard time. [See]
-# <a href="http://www.crl.go.jp/uk/uk201/basyo.htm">[reference in Japanese]</a>
-# and information from KAMO Hiroyasu.
+# In all Japanese stations, +0300 is used as the standard time.
#
# Syowa station, which is the first antarctic station of Japan,
# was established on 1957-01-29. Since Syowa station is still the main
@@ -296,7 +294,7 @@ Zone Antarctica/McMurdo 0 - zzz 1956
# Normally it wouldn't have a separate entry, since it's like the
# larger Antarctica/McMurdo since 1970, but it's too famous to omit.
#
-# From Chris Carrier <72157.3334@CompuServe.COM> (1996-06-27):
+# From Chris Carrier (1996-06-27):
# Siple, the first commander of the South Pole station,
# stated that he would have liked to have kept GMT at the station,
# but that he found it more convenient to keep GMT+12
diff --git a/timezone/asia b/timezone/asia
index 52ba32338e..59e62dde4f 100644
--- a/timezone/asia
+++ b/timezone/asia
@@ -1,4 +1,5 @@
-# @(#)asia 7.85
+# @(#)asia 7.90
+# <pre>
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
@@ -85,7 +86,7 @@ Zone Asia/Kabul 4:36:48 - LMT 1890
# Shanks has Yerevan switching to 3:00 (with Russian DST) in spring 1991,
# then to 4:00 with no DST in fall 1995, then readopting Russian DST in 1997.
# Go with Shanks, even when he disagrees with others. Edgar Der-Danieliantz
-# <edd@AIC.NET> reported (1996-05-04) that Yerevan probably wouldn't use DST
+# reported (1996-05-04) that Yerevan probably wouldn't use DST
# in 1996, though it did use DST in 1995. IATA SSIM (1991/1998) reports that
# Armenia switched from 3:00 to 4:00 in 1998 and observed DST after 1991,
# but started switching at 3:00s in 1998.
@@ -99,9 +100,12 @@ Zone Asia/Yerevan 2:58:00 - LMT 1924 May 2
4:00 RussiaAsia AM%sT
# Azerbaijan
+# From Rustam Aliyev of the Azerbaijan Internet Forum (2005-10-23):
+# According to the resolution of Cabinet of Ministers, 1997
+# Resolution available at: http://aif.az/docs/daylight_res.pdf
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
-Rule Azer 1997 max - Mar lastSun 1:00 1:00 S
-Rule Azer 1997 max - Oct lastSun 1:00 0 -
+Rule Azer 1997 max - Mar lastSun 4:00 1:00 S
+Rule Azer 1997 max - Oct lastSun 5:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Baku 3:19:24 - LMT 1924 May 2
3:00 - BAKT 1957 Mar # Baku Time
@@ -348,6 +352,17 @@ Link Asia/Nicosia Europe/Nicosia
# Mikhail Saakashvili, who said the change was partly prompted by the process
# of integration into Europe.
+# From Teimuraz Abashidze (2005-11-07):
+# Government of Georgia ... decided to NOT CHANGE daylight savings time on
+# [Oct.] 30, as it was done before during last more than 10 years.
+# Currently, we are in fact GMT +4:00, as before 30 October it was GMT
+# +3:00.... The problem is, there is NO FORMAL LAW or governmental document
+# about it. As far as I can find, I was told, that there is no document,
+# because we just DIDN'T ISSUE document about switching to winter time....
+# I don't know what can be done, especially knowing that some years ago our
+# DST rules where changed THREE TIMES during one month.
+
+
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Tbilisi 2:59:16 - LMT 1880
2:59:16 - TBMT 1924 May 2 # Tbilisi Mean Time
@@ -359,7 +374,8 @@ Zone Asia/Tbilisi 2:59:16 - LMT 1880
4:00 E-EurAsia GE%sT 1996 Oct lastSun
4:00 1:00 GEST 1997 Mar lastSun
4:00 E-EurAsia GE%sT 2004 Jun 27
- 3:00 RussiaAsia GE%sT
+ 3:00 RussiaAsia GE%sT 2005 Mar lastSun 2:00
+ 4:00 - GET
# East Timor
@@ -915,6 +931,9 @@ Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 31 15:00u
# The decision was taken because of the increase in working hours in
# government's departments from six to seven hours.
#
+# From Paul Eggert (2005-11-22):
+# Starting 2003 transitions are from Steffen Thorsen's web site timeanddate.com.
+#
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Jordan 1973 only - Jun 6 0:00 1:00 S
Rule Jordan 1973 1975 - Oct 1 0:00 0 -
@@ -937,8 +956,11 @@ Rule Jordan 1993 1998 - Apr Fri>=1 0:00 1:00 S
Rule Jordan 1994 only - Sep Fri>=15 0:00 0 -
Rule Jordan 1995 1998 - Sep Fri>=15 0:00s 0 -
Rule Jordan 1999 only - Jul 1 0:00s 1:00 S
-Rule Jordan 1999 max - Sep lastThu 0:00s 0 -
+Rule Jordan 1999 2002 - Sep lastThu 0:00s 0 -
Rule Jordan 2000 max - Mar lastThu 0:00s 1:00 S
+Rule Jordan 2003 only - Oct 24 0:00s 0 -
+Rule Jordan 2004 only - Oct 15 0:00s 0 -
+Rule Jordan 2005 max - Sep lastFri 0:00s 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Amman 2:23:44 - LMT 1931
2:00 Jordan EE%sT
@@ -1044,18 +1066,22 @@ Zone Asia/Oral 3:25:24 - LMT 1924 May 2 # or Ural'sk
# <http://eng.gateway.kg/cgi-bin/page.pl?id=1&story_name=doc9979.shtml>
# Kyrgyzstan is canceling the daylight saving time system. I take the article
# to mean that they will leave their clocks at 6 hours ahead of UTC.
+# From Malik Abdugaliev (2005-09-21):
+# Our government cancels daylight saving time 6th of August 2005.
+# From 2005-08-12 our GMT-offset is +6, w/o any daylight saving.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
-Rule Kirgiz 1992 1996 - Apr Sun>=7 0:00s 1:00 S
-Rule Kirgiz 1992 1996 - Sep lastSun 0:00 0 -
-Rule Kirgiz 1997 max - Mar lastSun 2:30 1:00 S
-Rule Kirgiz 1997 max - Oct lastSun 2:30 0 -
+Rule Kyrgyz 1992 1996 - Apr Sun>=7 0:00s 1:00 S
+Rule Kyrgyz 1992 1996 - Sep lastSun 0:00 0 -
+Rule Kyrgyz 1997 2005 - Mar lastSun 2:30 1:00 S
+Rule Kyrgyz 1997 2004 - Oct lastSun 2:30 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Bishkek 4:58:24 - LMT 1924 May 2
5:00 - FRUT 1930 Jun 21 # Frunze Time
6:00 RussiaAsia FRU%sT 1991 Mar 31 2:00s
5:00 1:00 FRUST 1991 Aug 31 2:00 # independence
- 5:00 Kirgiz KG%sT # Kirgizstan Time
+ 5:00 Kyrgyz KG%sT 2005 Aug 12 # Kyrgyzstan Time
+ 6:00 - KGT
###############################################################################
@@ -1404,6 +1430,9 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
# For now, let's assume that the spring switch was at 24:00,
# and that they switch at 0:00 on the 3rd Fridays of April and October.
+# From Paul Eggert (2005-11-22):
+# Starting 2004 transitions are from Steffen Thorsen's web site timeanddate.com.
+
# The rules for Egypt are stolen from the `africa' file.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
@@ -1414,7 +1443,9 @@ Rule EgyptAsia 1959 1965 - Sep 30 3:00 0 -
Rule EgyptAsia 1966 only - Oct 1 3:00 0 -
Rule Palestine 1999 max - Apr Fri>=15 0:00 1:00 S
-Rule Palestine 1999 max - Oct Fri>=15 0:00 0 -
+Rule Palestine 1999 2003 - Oct Fri>=15 0:00 0 -
+Rule Palestine 2004 only - Oct 1 1:00 0 -
+Rule Palestine 2005 max - Oct 4 1:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
diff --git a/timezone/australasia b/timezone/australasia
index 57bd60adb4..6cf9761012 100644
--- a/timezone/australasia
+++ b/timezone/australasia
@@ -1,4 +1,6 @@
-# @(#)australasia 7.73
+# @(#)australasia 7.78
+# <pre>
+
# This file also includes Pacific islands.
# Notes are at the end of this file
@@ -551,9 +553,15 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# Australia
-# <a href="http://www.dstc.qut.edu.au/DST/marg/daylight.html">
-# Australia's Daylight Saving Times
-# </a>, by Margaret Turner, summarizes daylight saving issues in Australia.
+# From Paul Eggert (2005-12-08):
+# <a href="http://www.bom.gov.au/climate/averages/tables/dst_times.shtml">
+# Implementation Dates of Daylight Saving Time within Australia
+# </a> summarizes daylight saving issues in Australia.
+
+# From Arthur David Olson (2005-12-12):
+# <a href="http://www.lawlink.nsw.gov.au/lawlink/Corporate/ll_agdinfo.nsf/pages/community_relations_daylight_saving">
+# Lawlink NSW:Daylight Saving in New South Wales
+# </a> covers New South Wales in particular.
# From John Mackin (1991-03-06):
# We in Australia have _never_ referred to DST as `daylight' time.
@@ -960,17 +968,6 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# legislation. This is very important to understand.
# I have researched New South Wales time only...
-# From Paul Eggert (1999-09-27):
-# The Information Service of the Australian National Standards Commission
-# <a href="http://www.nsc.gov.au/InfoServ/Ileaflet/il27.htm">
-# Daylight Saving
-# </a> page (1995-04) has an excellent overall history of Australian DST.
-# The Community Relations Division of the NSW Attorney General's Department
-# publishes a history of daylight saving in NSW. See:
-# <a href="http://www.lawlink.nsw.gov.au/crd.nsf/pages/time2">
-# Lawlink NSW: Daylight Saving in New South Wales
-# </a>
-
# From Eric Ulevik (1999-05-26):
# DST will start in NSW on the last Sunday of August, rather than the usual
# October in 2000. [See: Matthew Moore,
@@ -1048,7 +1045,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# Lord Howe Island
# From George Shepherd via Simon Woodhead via Robert Elz (1991-03-06):
-# LHI... [ Courtesy of Pauline Van Winsen.. pauline@Aus ]
+# LHI... [ Courtesy of Pauline Van Winsen ]
# [ Dec 1990 ]
# Lord Howe Island is located off the New South Wales coast, and is half an
# hour ahead of NSW time.
@@ -1088,7 +1085,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# From George Shepherd via Simon Woodhead via Robert Elz (1991-03-06):
# # The Country of New Zealand (Australia's east island -) Gee they hate that!
# # or is Australia the west island of N.Z.
-# # [ courtesy of Geoff Tribble.. Geofft@Aus.. Auckland N.Z. ]
+# # [ courtesy of Geoff Tribble.. Auckland N.Z. ]
# # [ Nov 1990 ]
# ...
# Rule NZ 1974 1988 - Oct lastSun 2:00 1:00 D
@@ -1375,16 +1372,26 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# mapmakers redrew the IDL following the boundary of Kiribati. Even that line
# has a rather arbitrary nature. The straight-line boundaries between Pacific
# island nations that are shown on many maps are based on an international
-# convention, but are not legally binding national borders.
-#
-# An Anglo-French Conference on Time-Keeping at Sea (June, 1917) agreed that
-# legal time on the high seas would be zone time, i.e., the standard time at
-# the nearest meridian that is a multiple of fifteen degrees. The date is
+# convention, but are not legally binding national borders.... The date is
# governed by the IDL; therefore, even on the high seas, there may be some
# places as late as fourteen hours later than UTC. And, since the IDL is not
# an international standard, there are some places on the high seas where the
# correct date is ambiguous.
+# From Wikipedia <http://en.wikipedia.org/wiki/Time_zone> (2005-08-31):
+# Before 1920, all ships kept local apparent time on the high seas by setting
+# their clocks at night or at the morning sight so that, given the ship's
+# speed and direction, it would be 12 o'clock when the Sun crossed the ship's
+# meridian (12 o'clock = local apparent noon). During 1917, at the
+# Anglo-French Conference on Time-keeping at Sea, it was recommended that all
+# ships, both military and civilian, should adopt hourly standard time zones
+# on the high seas. Whenever a ship was within the territorial waters of any
+# nation it would use that nation's standard time. The captain was permitted
+# to change his ship's clocks at a time of his choice following his ship's
+# entry into another zone time--he often chose midnight. These zones were
+# adopted by all major fleets between 1920 and 1925 but not by many
+# independent merchant ships until World War II.
+
# From Paul Eggert, using references suggested by Oscar van Vlijmen
# (2005-03-20):
#
diff --git a/timezone/backward b/timezone/backward
index ca22dfeaee..4ddfe41e99 100644
--- a/timezone/backward
+++ b/timezone/backward
@@ -1,4 +1,4 @@
-# @(#)backward 7.29
+# @(#)backward 7.30
# This file provides links between current names for time zones
# and their old names. Many names changed in late 1993.
@@ -42,7 +42,6 @@ Link America/Rio_Branco Brazil/Acre
Link America/Noronha Brazil/DeNoronha
Link America/Sao_Paulo Brazil/East
Link America/Manaus Brazil/West
-Link America/Chicago CST6CDT
Link America/Halifax Canada/Atlantic
Link America/Winnipeg Canada/Central
Link America/Regina Canada/East-Saskatchewan
@@ -55,8 +54,6 @@ Link America/Whitehorse Canada/Yukon
Link America/Santiago Chile/Continental
Link Pacific/Easter Chile/EasterIsland
Link America/Havana Cuba
-Link America/Panama EST
-Link America/New_York EST5EDT
Link Africa/Cairo Egypt
Link Europe/Dublin Eire
Link Europe/London Europe/Belfast
@@ -67,7 +64,6 @@ Link Etc/GMT GMT+0
Link Etc/GMT GMT-0
Link Etc/GMT GMT0
Link Etc/GMT Greenwich
-Link Pacific/Honolulu HST
Link Asia/Hong_Kong Hongkong
Link Atlantic/Reykjavik Iceland
Link Asia/Tehran Iran
@@ -76,8 +72,6 @@ Link America/Jamaica Jamaica
Link Asia/Tokyo Japan
Link Pacific/Kwajalein Kwajalein
Link Africa/Tripoli Libya
-Link America/Phoenix MST
-Link America/Denver MST7MDT
Link America/Tijuana Mexico/BajaNorte
Link America/Mazatlan Mexico/BajaSur
Link America/Mexico_City Mexico/General
@@ -85,7 +79,6 @@ Link Pacific/Auckland NZ
Link Pacific/Chatham NZ-CHAT
Link America/Denver Navajo
Link Asia/Shanghai PRC
-Link America/Los_Angeles PST8PDT
Link Pacific/Pago_Pago Pacific/Samoa
Link Pacific/Truk Pacific/Yap
Link Europe/Warsaw Poland
diff --git a/timezone/europe b/timezone/europe
index ec6720a804..8782860e86 100644
--- a/timezone/europe
+++ b/timezone/europe
@@ -1,4 +1,5 @@
-# @(#)europe 7.95
+# @(#)europe 7.96
+# <pre>
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
diff --git a/timezone/northamerica b/timezone/northamerica
index 40a2ce269d..9f9b98b09c 100644
--- a/timezone/northamerica
+++ b/timezone/northamerica
@@ -1,4 +1,6 @@
-# @(#)northamerica 7.79
+# @(#)northamerica 7.87
+# <pre>
+
# also includes Central America and the Caribbean
# This data is by no means authoritative; if you think you know better,
@@ -131,6 +133,26 @@ Rule US 1987 2006 - Apr Sun>=1 2:00 1:00 D
Rule US 2007 max - Mar Sun>=8 2:00 1:00 D
Rule US 2007 max - Nov Sun>=1 2:00 0 S
+# From Arthur David Olson, 2005-12-19
+# We generate the files specified below to guard against old files with
+# obsolete information being left in the time zone binary directory.
+# We limit the list to names that have appeared in previous versions of
+# this time zone package.
+# We do these as separate Zones rather than as Links to avoid problems if
+# a particular place changes whether it observes DST.
+# We put these specifications here in the northamerica file both to
+# increase the chances that they'll actually get compiled and to
+# avoid the need to duplicate the US rules in another file.
+
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone EST -5:00 - EST
+Zone MST -7:00 - MST
+Zone HST -10:00 - HST
+Zone EST5EDT -5:00 US E%sT
+Zone CST6CDT -6:00 US C%sT
+Zone MST7MDT -7:00 US M%sT
+Zone PST8PDT -8:00 US P%sT
+
# From Bob Devine (1988-01-28):
# ...Alaska (and Hawaii) had the timezone names changed in 1967.
# old new
@@ -244,6 +266,16 @@ Rule US 2007 max - Nov Sun>=1 2:00 0 S
# and didn't change their clocks for Daylight Saving ... so that their
# reports will always have times which are 5 hours behind UTC.
+# From Paul Eggert (2005-08-26):
+# According to today's Huntsville Times
+# <http://www.al.com/news/huntsvilletimes/index.ssf?/base/news/1125047783228320.xml&coll=1>
+# a few towns on Alabama's "eastern border with Georgia, such as Phenix City
+# in Russell County, Lanett in Chambers County and some towns in Lee County,
+# set their watches and clocks on Eastern time." It quotes H.H. "Bubba"
+# Roberts, city administrator in Phenix City. as saying "We are in the Central
+# time zone, but we do go by the Eastern time zone because so many people work
+# in Columbus."
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER
Rule NYC 1920 only - Mar lastSun 2:00 1:00 D
Rule NYC 1920 only - Oct lastSun 2:00 0 S
@@ -790,18 +822,37 @@ Zone America/Menominee -5:50:27 - LMT 1885 Sep 18 12:00
# Unless otherwise specified, the data for Canada are all from Shanks.
-# From Paul Eggert (2000-10-02):
+# From Paul Eggert (2005-12-21):
# H. David Matthews and Mary Vincent's map
-# <a href="http://www.canadiangeographic.ca/SO98/geomap.htm">
+# <a href="http://www.canadiangeographic.ca/Magazine/SO98/geomap.asp">
# "It's about TIME", _Canadian Geographic_ (September-October 1998)
# </a> contains detailed boundaries for regions observing nonstandard
# time and daylight saving time arrangements in Canada circa 1998.
#
-# INMS, the Institute for National Measurement Standards in Ottawa, has
-# <a href="http://www.nrc.ca/inms/time/tze.html">
+# INMS, the Institute for National Measurement Standards in Ottawa, has <a
+# href="http://inms-ienm.nrc-cnrc.gc.ca/en/time_services/daylight_saving_e.php">
# information about standard and daylight saving time zones in Canada.
# </a> (updated periodically).
# Its unofficial information is often taken from Matthews and Vincent.
+#
+# CBC News reported that Ontario and Manitoba have announced plans to
+# follow the US change, and that Nova Scotia is considering it; see
+# <http://www.cbc.ca/news/background/daylightsavingtime/> (2005-10-21).
+# CBC news also reported that Prince Edward Island is the first
+# province in Atlantic Canada to follow the US change, and that Quebec
+# had agreed; see <http://www.cbc.ca/pei/story/pe_daylight_20051207.html>
+# (2005-12-07).
+#
+# To reflect all this, the Canada and Winn rules have been adjusted to
+# agree with the 2007 US change. This means we assume most of Canada
+# will fall into line. However, Alberta, British Columbia,
+# Newfoundland, Northwest Territories, and Yukon already have separate
+# rules in our database, so for now we'll leave them alone, which
+# means that we currently assume these regions will not change their
+# rules and will disagree with the US starting in 2007. This
+# assumption is probably incorrect, with the possible exception of
+# Newfoundland. We plan to adjust the Edm, Vanc, StJohns, and NT_YK
+# rules as the corresponding provinces make their announcements.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Canada 1918 only - Apr 14 2:00 1:00 D
@@ -810,8 +861,10 @@ Rule Canada 1942 only - Feb 9 2:00 1:00 W # War
Rule Canada 1945 only - Aug 14 23:00u 1:00 P # Peace
Rule Canada 1945 only - Sep 30 2:00 0 S
Rule Canada 1974 1986 - Apr lastSun 2:00 1:00 D
-Rule Canada 1974 max - Oct lastSun 2:00 0 S
-Rule Canada 1987 max - Apr Sun>=1 2:00 1:00 D
+Rule Canada 1974 2006 - Oct lastSun 2:00 0 S
+Rule Canada 1987 2006 - Apr Sun>=1 2:00 1:00 D
+Rule Canada 2007 max - Mar Sun>=8 2:00 1:00 D
+Rule Canada 2007 max - Nov Sun>=1 2:00 0 S
# Newfoundland (and far southeast Labrador)
@@ -1137,11 +1190,13 @@ Rule Winn 1963 only - Apr lastSun 2:00 1:00 D
Rule Winn 1963 only - Sep 22 2:00 0 S
Rule Winn 1966 1986 - Apr lastSun 2:00 1:00 D
Rule Winn 1966 1986 - Oct lastSun 2:00 0 S
-Rule Winn 1987 max - Apr Sun>=1 2:00 1:00 D
+Rule Winn 1987 2006 - Apr Sun>=1 2:00s 1:00 D
# From Paul Eggert (2000-10-02):
# INMS (2000-09-12) says that, since 1988 at least, Manitoba switches from
# DST at 03:00 local time. For now, assume it started in 1987.
-Rule Winn 1987 max - Oct lastSun 2:00s 0 S
+Rule Winn 1987 2006 - Oct lastSun 2:00s 0 S
+Rule Winn 2007 max - Mar Sun>=8 2:00s 1:00 D
+Rule Winn 2007 max - Nov Sun>=1 2:00s 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Winnipeg -6:28:36 - LMT 1887 Jul 16
-6:00 Winn C%sT
@@ -1805,6 +1860,11 @@ Zone America/Costa_Rica -5:36:20 - LMT 1890 # San Jose
# to normal hours (after daylight saving time)".
# For now, let's assume that it's a one-year temporary measure.
+# From Carlos A. Carnero Delgado (2005-11-12):
+# This year (just like in 2004-2005) there's no change in time zone
+# adjustment in Cuba. We will stay in daylight saving time:
+# http://www.granma.cu/espanol/2005/noviembre/mier9/horario.html
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Cuba 1928 only - Jun 10 0:00 1:00 D
Rule Cuba 1928 only - Oct 10 0:00 0 S
@@ -1835,7 +1895,7 @@ Rule Cuba 1997 only - Oct 12 0:00s 0 S
Rule Cuba 1998 1999 - Mar lastSun 0:00s 1:00 D
Rule Cuba 1998 2003 - Oct lastSun 0:00s 0 S
Rule Cuba 2000 max - Apr Sun>=1 0:00s 1:00 D
-Rule Cuba 2005 max - Oct lastSun 0:00s 0 S
+Rule Cuba 2006 max - Oct lastSun 0:00s 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Havana -5:29:28 - LMT 1890
@@ -2021,13 +2081,18 @@ Zone America/Montserrat -4:08:52 - LMT 1911 Jul 1 0:01 # Olveston
# changes in 2000. Perhaps a note could be added to the northamerica file, to
# the effect that we have indirect evidence that DST was observed in 2000.
#
+# From Jesper Norgaard Welen (2005-11-02):
+# Nicaragua left DST the 2005-10-02 at 00:00 (local time).
+# http://www.presidencia.gob.ni/presidencia/files_index/secretaria/comunicados/2005/septiembre/26septiembre-cambio-hora.htm
+# (2005-09-26)
+#
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Nic 1979 1980 - Mar Sun>=16 0:00 1:00 D
Rule Nic 1979 1980 - Jun Mon>=23 0:00 0 S
-Rule Nic 1992 only - Jan 1 4:00 1:00 D
+Rule Nic 1992 only - Jan 1 4:00 1:00 D
Rule Nic 1992 only - Sep 24 0:00 0 S
Rule Nic 2005 only - Apr 10 0:00 1:00 D
-Rule Nic 2005 only - Sep 18 0:00 0 S
+Rule Nic 2005 only - Oct 2 0:00 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Managua -5:45:08 - LMT 1890
-5:45:12 - MMT 1934 Jun 23 # Managua Mean Time?
diff --git a/timezone/private.h b/timezone/private.h
index 9a1ef22abb..33dc4c3de9 100644
--- a/timezone/private.h
+++ b/timezone/private.h
@@ -4,7 +4,7 @@
/*
** This file is in the public domain, so clarified as of
-** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
+** 1996-06-05 by Arthur David Olson.
*/
/*
diff --git a/timezone/southamerica b/timezone/southamerica
index 9bf068ba9e..eb7b5c7d84 100644
--- a/timezone/southamerica
+++ b/timezone/southamerica
@@ -1,4 +1,5 @@
-# @(#)southamerica 7.61
+# @(#)southamerica 7.66
+# <pre>
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
@@ -525,12 +526,6 @@ Rule Brazil 1997 only - Feb 16 0:00 0 -
# This year, the ending date of DS was postponed to March 1
# to help dealing with the shortages of electric power.
#
-# From Paul Eggert (1998-02-25):
-# <a href="http://churchnet.ucsm.ac.uk/news/files2/news165.htm">
-# Brazil Prepares for Papal Visit
-# </a>,
-# Church Net UK (1997-10-02).
-#
# Decree 2,317 (1997-09-04), adopted by same states.
Rule Brazil 1997 only - Oct 6 0:00 1:00 S
# Decree <a href="http://pcdsh01.on.br/figuras/HV2495.JPG">2,495</a>
@@ -565,11 +560,12 @@ Rule Brazil 2003 only - Oct 19 0:00 1:00 S
# Decree 5,223 (2004-10-01) reestablishes DST in MT.
# <a href="http://www.planalto.gov.br/ccivil_03/_Ato2004-2006/2004/Decreto/D5223.htm"></a>
Rule Brazil 2004 only - Nov 2 0:00 1:00 S
+# Decree <a href="http://pcdsh01.on.br/DecHV5539.gif">5,539</a> (2005-09-19),
+# adopted by the same states as before.
+Rule Brazil 2005 max - Oct Sun>=15 0:00 1:00 S
# The latest ruleset listed above says that the following states observe DST:
# DF, ES, GO, MG, MS, MT, PR, RJ, RS, SC, SP.
-#
-Rule Brazil 2005 max - Oct Sun>=15 0:00 1:00 S
-# For dates after mid-2005, the above rules with TO="max" are guesses
+# For dates after mid-2006, the above rules with TO="max" are guesses
# and are quite possibly wrong, but are more likely than no DST at all.
@@ -1055,6 +1051,12 @@ Rule Uruguay 2004 only - Sep 19 0:00 1:00 S
# save energy ... it was postponed two weeks....
# http://www.presidencia.gub.uy/_Web/noticias/2005/03/2005031005.htm
Rule Uruguay 2005 only - Mar 27 2:00 0 -
+# From Eduardo Cota (2005-09-27):
+# http://www.presidencia.gub.uy/_Web/decretos/2005/09/CM%20119_09%2009%202005_00001.PDF
+# This means that from 2005-10-09 at 02:00 local time, until 2006-03-12 at
+# 02:00 local time, official time in Uruguay will be at GMT -2.
+Rule Uruguay 2005 only - Oct 9 2:00 1:00 S
+Rule Uruguay 2006 only - Mar 12 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Montevideo -3:44:44 - LMT 1898 Jun 28
-3:44:44 - MMT 1920 May 1 # Montevideo MT
diff --git a/timezone/systemv b/timezone/systemv
index c6a6b6404b..a5b4209c3f 100644
--- a/timezone/systemv
+++ b/timezone/systemv
@@ -1,24 +1,24 @@
-# @(#)systemv 7.3
+# @(#)systemv 7.5
# Old rules, should the need arise.
# No attempt is made to handle Newfoundland, since it cannot be expressed
# using the System V "TZ" scheme (half-hour offset), or anything outside
# North America (no support for non-standard DST start/end dates), nor
-# the change in the DST rules in the US in 1987 (which occurred before
+# the changes in the DST rules in the US after 1976 (which occurred after
# the old rules were written).
#
-# If you need the old rules, uncomment ## lines and comment-out Link lines.
+# If you need the old rules, uncomment ## lines.
# Compile this *without* leap second correction for true conformance.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
-## Rule SystemV min 1973 - Apr lastSun 2:00 1:00 D
-## Rule SystemV min 1973 - Oct lastSun 2:00 0 S
-## Rule SystemV 1974 only - Jan 6 2:00 1:00 D
-## Rule SystemV 1974 only - Nov lastSun 2:00 0 S
-## Rule SystemV 1975 only - Feb 23 2:00 1:00 D
-## Rule SystemV 1975 only - Oct lastSun 2:00 0 S
-## Rule SystemV 1976 max - Apr lastSun 2:00 1:00 D
-## Rule SystemV 1976 max - Oct lastSun 2:00 0 S
+Rule SystemV min 1973 - Apr lastSun 2:00 1:00 D
+Rule SystemV min 1973 - Oct lastSun 2:00 0 S
+Rule SystemV 1974 only - Jan 6 2:00 1:00 D
+Rule SystemV 1974 only - Nov lastSun 2:00 0 S
+Rule SystemV 1975 only - Feb 23 2:00 1:00 D
+Rule SystemV 1975 only - Oct lastSun 2:00 0 S
+Rule SystemV 1976 max - Apr lastSun 2:00 1:00 D
+Rule SystemV 1976 max - Oct lastSun 2:00 0 S
# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL]
## Zone SystemV/AST4ADT -4:00 SystemV A%sT
@@ -34,17 +34,3 @@
## Zone SystemV/PST8 -8:00 - PST
## Zone SystemV/YST9 -9:00 - YST
## Zone SystemV/HST10 -10:00 - HST
-# For now...
-Link America/Halifax SystemV/AST4ADT
-Link America/New_York SystemV/EST5EDT
-Link America/Chicago SystemV/CST6CDT
-Link America/Denver SystemV/MST7MDT
-Link America/Los_Angeles SystemV/PST8PDT
-Link America/Anchorage SystemV/YST9YDT
-Link America/Puerto_Rico SystemV/AST4
-Link America/Indianapolis SystemV/EST5
-Link America/Regina SystemV/CST6
-Link America/Phoenix SystemV/MST7
-Link Pacific/Pitcairn SystemV/PST8
-Link Pacific/Gambier SystemV/YST9
-Link Pacific/Honolulu SystemV/HST10
diff --git a/timezone/test-tz.c b/timezone/test-tz.c
index 55613654c7..642b45a0ed 100644
--- a/timezone/test-tz.c
+++ b/timezone/test-tz.c
@@ -7,7 +7,7 @@ struct {
const char * env;
time_t expected;
} tests[] = {
- {"MST", 832910115},
+ {"MST", 832935315},
{"", 832910115},
{":UTC", 832910115},
{"UTC", 832910115},
diff --git a/timezone/tzfile.h b/timezone/tzfile.h
index 2dad932ef4..fb6ca9880f 100644
--- a/timezone/tzfile.h
+++ b/timezone/tzfile.h
@@ -4,7 +4,7 @@
/*
** This file is in the public domain, so clarified as of
-** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
+** 1996-06-05 by Arthur David Olson.
*/
/*
@@ -21,7 +21,7 @@
#ifndef lint
#ifndef NOID
-static char tzfilehid[] = "@(#)tzfile.h 7.17";
+static char tzfilehid[] = "@(#)tzfile.h 7.18";
#endif /* !defined NOID */
#endif /* !defined lint */
@@ -105,7 +105,7 @@ struct tzhead {
#ifdef NOSOLAR
/*
** Must be at least 14 for Europe/Riga as of Jan 12 1995,
-** as noted by Earl Chew <earl@hpato.aus.hp.com>.
+** as noted by Earl Chew.
*/
#define TZ_MAX_TYPES 20 /* Maximum number of local time types */
#endif /* !defined NOSOLAR */
diff --git a/timezone/zdump.c b/timezone/zdump.c
index d767d75fb7..45ce64157c 100644
--- a/timezone/zdump.c
+++ b/timezone/zdump.c
@@ -1,4 +1,4 @@
-static char elsieid[] = "@(#)zdump.c 7.66";
+static char elsieid[] = "@(#)zdump.c 7.74";
/*
** This code has been made independent of the rest of the time
@@ -12,7 +12,10 @@ static char elsieid[] = "@(#)zdump.c 7.66";
#include "time.h" /* for struct tm */
#include "stdlib.h" /* for exit, malloc, atoi */
#include "float.h" /* for FLT_MAX and DBL_MAX */
-#include <ctype.h> /* for isascii, isalpha, isdigit */
+#include "ctype.h" /* for isalpha et al. */
+#ifndef isascii
+#define isascii(x) 1
+#endif
#ifndef ZDUMP_LO_YEAR
#define ZDUMP_LO_YEAR (-500)
@@ -148,7 +151,7 @@ static char * progname;
static int warned;
static char * abbr P((struct tm * tmp));
-static void abbrok P((const char * abbr, const char * zone));
+static void abbrok P((const char * abbrp, const char * zone));
static long delta P((struct tm * newp, struct tm * oldp));
static void dumptime P((const struct tm * tmp));
static time_t hunt P((char * name, time_t lot, time_t hit));
@@ -195,8 +198,8 @@ time_t * tp;
#endif /* !defined TYPECHECK */
static void
-abbrok(abbr, zone)
-const char * const abbr;
+abbrok(abbrp, zone)
+const char * const abbrp;
const char * const zone;
{
register const char * cp;
@@ -204,30 +207,31 @@ const char * const zone;
if (warned)
return;
- cp = abbr;
+ cp = abbrp;
wp = NULL;
- while (isascii(*cp) && isalpha(*cp))
+ while (isascii((unsigned char) *cp) && isalpha((unsigned char) *cp))
++cp;
- if (cp - abbr == 0)
+ if (cp - abbrp == 0)
wp = _("lacks alphabetic at start");
- if (cp - abbr < 3)
+ else if (cp - abbrp < 3)
wp = _("has fewer than 3 alphabetics");
- if (cp - abbr > 6)
+ else if (cp - abbrp > 6)
wp = _("has more than 6 alphabetics");
if (wp == NULL && (*cp == '+' || *cp == '-')) {
++cp;
- if (isascii(*cp) && isdigit(*cp))
- if (*cp++ == '1' && *cp >= '0' && *cp <= '4')
- ++cp;
+ if (isascii((unsigned char) *cp) &&
+ isdigit((unsigned char) *cp))
+ if (*cp++ == '1' && *cp >= '0' && *cp <= '4')
+ ++cp;
+ if (*cp != '\0')
+ wp = _("differs from POSIX standard");
}
- if (*cp != '\0')
- wp = _("differs from POSIX standard");
if (wp == NULL)
return;
(void) fflush(stdout);
(void) fprintf(stderr,
- "%s: warning: zone \"%s\" abbreviation \"%s\" %s\n",
- progname, zone, abbr, wp);
+ _("%s: warning: zone \"%s\" abbreviation \"%s\" %s\n"),
+ progname, zone, abbrp, wp);
warned = TRUE;
}
@@ -266,7 +270,7 @@ char * argv[];
for (i = 1; i < argc; ++i)
if (strcmp(argv[i], "--version") == 0) {
(void) printf("%s\n", elsieid);
- (void) exit(EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
vflag = 0;
cutarg = NULL;
@@ -279,7 +283,7 @@ char * argv[];
(void) fprintf(stderr,
_("%s: usage is %s [ --version ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n"),
progname, progname);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
if (vflag) {
if (cutarg != NULL) {
@@ -296,7 +300,7 @@ _("%s: usage is %s [ --version ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n"),
} else {
(void) fprintf(stderr, _("%s: wild -c argument %s\n"),
progname, cutarg);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
}
setabsolutes();
@@ -319,7 +323,7 @@ _("%s: usage is %s [ --version ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n"),
if (fakeenv == NULL ||
(fakeenv[0] = (char *) malloc(longest + 4)) == NULL) {
(void) perror(progname);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
to = 0;
(void) strcpy(fakeenv[to++], "TZ=");
@@ -386,7 +390,7 @@ _("%s: usage is %s [ --version ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n"),
if (fflush(stdout) || ferror(stdout)) {
(void) fprintf(stderr, "%s: ", progname);
(void) perror(_("Error writing standard output"));
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
/* If exit fails to exit... */
@@ -410,7 +414,7 @@ setabsolutes()
(void) fprintf(stderr,
_("%s: use of -v on system with floating time_t other than float or double\n"),
progname);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
} else if (0 > (time_t) -1) {
/*
@@ -510,7 +514,7 @@ time_t hit;
}
/*
-** Thanks to Paul Eggert (eggert@twinsun.com) for logic used in delta.
+** Thanks to Paul Eggert for logic used in delta.
*/
static long
diff --git a/timezone/zic.c b/timezone/zic.c
index 4e3f42f2cc..acb76fb3ba 100644
--- a/timezone/zic.c
+++ b/timezone/zic.c
@@ -1,4 +1,4 @@
-static char elsieid[] = "@(#)zic.c 7.124";
+static char elsieid[] = "@(#)zic.c 7.128";
/*
** Regardless of the type of time_t, we do our work using this type.
@@ -370,7 +370,7 @@ char * const ptr;
(void) fprintf(stderr, _("%s: Memory exhausted: %s\n"),
progname, e);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
return ptr;
}
@@ -456,7 +456,7 @@ usage P((void))
[ --version ] [ -s ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\
\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n"),
progname, progname);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
static const char * psxrules;
@@ -489,7 +489,7 @@ char * argv[];
for (i = 1; i < argc; ++i)
if (strcmp(argv[i], "--version") == 0) {
(void) printf("%s\n", elsieid);
- (void) exit(EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
while ((c = getopt(argc, argv, "d:l:p:L:vsy:")) != EOF && c != -1)
switch (c) {
@@ -502,7 +502,7 @@ char * argv[];
(void) fprintf(stderr,
_("%s: More than one -d option specified\n"),
progname);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
break;
case 'l':
@@ -512,7 +512,7 @@ _("%s: More than one -d option specified\n"),
(void) fprintf(stderr,
_("%s: More than one -l option specified\n"),
progname);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
break;
case 'p':
@@ -522,7 +522,7 @@ _("%s: More than one -l option specified\n"),
(void) fprintf(stderr,
_("%s: More than one -p option specified\n"),
progname);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
break;
case 'y':
@@ -532,7 +532,7 @@ _("%s: More than one -p option specified\n"),
(void) fprintf(stderr,
_("%s: More than one -y option specified\n"),
progname);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
break;
case 'L':
@@ -542,7 +542,7 @@ _("%s: More than one -y option specified\n"),
(void) fprintf(stderr,
_("%s: More than one -L option specified\n"),
progname);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
break;
case 'v':
@@ -569,7 +569,7 @@ _("%s: More than one -L option specified\n"),
for (i = optind; i < argc; ++i)
infile(argv[i]);
if (errors)
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
associate();
for (i = 0; i < nzones; i = j) {
/*
@@ -634,7 +634,7 @@ const char * const tofile;
int result;
if (mkdirs(toname) != 0)
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
result = link(fromname, toname);
#if HAVE_SYMLINK
@@ -648,14 +648,14 @@ const char * const tofile;
symlinkcontents =
ecatalloc(symlinkcontents,
"../");
- symlinkcontents =
- ecatalloc(symlinkcontents,
- fromname);
- result = symlink(symlinkcontents,
- toname);
- if (result == 0)
+ symlinkcontents =
+ ecatalloc(symlinkcontents,
+ fromname);
+ result = symlink(symlinkcontents,
+ toname);
+ if (result == 0)
warning(_("hard link failed, symbolic link used"));
- ifree(symlinkcontents);
+ ifree(symlinkcontents);
}
#endif /* HAVE_SYMLINK */
if (result != 0) {
@@ -664,7 +664,7 @@ warning(_("hard link failed, symbolic link used"));
(void) fprintf(stderr,
_("%s: Can't link from %s to %s: %s\n"),
progname, fromname, toname, e);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
}
ifree(fromname);
@@ -825,7 +825,7 @@ associate P((void))
}
}
if (errors)
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
static void
@@ -849,7 +849,7 @@ const char * name;
(void) fprintf(stderr, _("%s: Can't open %s: %s\n"),
progname, name, e);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
wantcont = FALSE;
for (num = 1; ; ++num) {
@@ -859,7 +859,7 @@ const char * name;
cp = strchr(buf, '\n');
if (cp == NULL) {
error(_("line too long"));
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
*cp = '\0';
fields = getfields(buf);
@@ -903,7 +903,7 @@ _("%s: Leap line in non leap seconds file %s\n"),
(void) fprintf(stderr,
_("%s: panic: Invalid l_value %d\n"),
progname, lp->l_value);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
}
ifree((char *) fields);
@@ -911,14 +911,14 @@ _("%s: panic: Invalid l_value %d\n"),
if (ferror(fp)) {
(void) fprintf(stderr, _("%s: Error reading %s\n"),
progname, filename);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
if (fp != stdin && fclose(fp)) {
const char *e = strerror(errno);
(void) fprintf(stderr, _("%s: Error closing %s: %s\n"),
progname, filename, e);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
if (wantcont)
error(_("expected continuation line not found"));
@@ -1324,7 +1324,7 @@ const char * const timep;
(void) fprintf(stderr,
_("%s: panic: Invalid l_value %d\n"),
progname, lp->l_value);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
} else if (sscanf(cp, scheck(cp, "%d"), &rp->r_loyear) != 1) {
error(_("invalid starting year"));
return;
@@ -1349,7 +1349,7 @@ const char * const timep;
(void) fprintf(stderr,
_("%s: panic: Invalid l_value %d\n"),
progname, lp->l_value);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
} else if (sscanf(cp, scheck(cp, "%d"), &rp->r_hiyear) != 1) {
error(_("invalid ending year"));
return;
@@ -1520,17 +1520,17 @@ const char * const name;
(void) fprintf(stderr, _("%s: Can't remove %s: %s\n"),
progname, fullname, e);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
if ((fp = fopen(fullname, "wb")) == NULL) {
if (mkdirs(fullname) != 0)
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
if ((fp = fopen(fullname, "wb")) == NULL) {
const char *e = strerror(errno);
(void) fprintf(stderr, _("%s: Can't create %s: %s\n"),
progname, fullname, e);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
}
convert(eitol(typecnt), tzh.tzh_ttisgmtcnt);
@@ -1597,7 +1597,7 @@ const char * const name;
if (ferror(fp) || fclose(fp)) {
(void) fprintf(stderr, _("%s: Error writing %s\n"),
progname, fullname);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
}
@@ -1648,7 +1648,7 @@ const int zonecount;
typecnt = 0;
charcnt = 0;
/*
- ** Thanks to Earl Chew (earl@dnd.icp.nec.com.au)
+ ** Thanks to Earl Chew
** for noting the need to unconditionally initialize startttisstd.
*/
startttisstd = FALSE;
@@ -1830,7 +1830,7 @@ int type;
}
if (timecnt >= TZ_MAX_TIMES) {
error(_("too many transitions?!"));
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
attypes[timecnt].at = starttime;
attypes[timecnt].type = type;
@@ -1849,15 +1849,15 @@ const int ttisgmt;
if (isdst != TRUE && isdst != FALSE) {
error(_("internal error - addtype called with bad isdst"));
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
if (ttisstd != TRUE && ttisstd != FALSE) {
error(_("internal error - addtype called with bad ttisstd"));
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
if (ttisgmt != TRUE && ttisgmt != FALSE) {
error(_("internal error - addtype called with bad ttisgmt"));
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
/*
** See if there's already an entry for this zone type.
@@ -1876,7 +1876,7 @@ const int ttisgmt;
*/
if (typecnt >= TZ_MAX_TYPES) {
error(_("too many local time types"));
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
gmtoffs[i] = gmtoff;
isdsts[i] = isdst;
@@ -1904,13 +1904,13 @@ int count;
if (leapcnt + (positive ? count : 1) > TZ_MAX_LEAPS) {
error(_("too many leap seconds"));
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
for (i = 0; i < leapcnt; ++i)
if (t <= trans[i]) {
if (t == trans[i]) {
error(_("repeated leap second moment"));
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
break;
}
@@ -1965,7 +1965,7 @@ const char * const type;
(void) fprintf(stderr, _("%s: command was '%s', result was %d\n"),
progname, buf, result);
for ( ; ; )
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
static int
@@ -2046,8 +2046,9 @@ register char * cp;
emalloc((int) ((strlen(cp) + 1) * sizeof *array));
nsubs = 0;
for ( ; ; ) {
- while (isascii(*cp) && isspace((unsigned char) *cp))
- ++cp;
+ while (isascii((unsigned char) *cp) &&
+ isspace((unsigned char) *cp))
+ ++cp;
if (*cp == '\0' || *cp == '#')
break;
array[nsubs++] = dp = cp;
@@ -2080,7 +2081,7 @@ const long t2;
t = t1 + t2;
if ((t2 > 0 && t <= t1) || (t2 < 0 && t >= t1)) {
error(_("time overflow"));
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
return t;
}
@@ -2099,7 +2100,7 @@ const long t2;
t = t1 + t2;
if ((t2 > 0 && t <= t1) || (t2 < 0 && t >= t1)) {
error(_("time overflow"));
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
return t;
}
@@ -2146,7 +2147,7 @@ register const int wantedy;
--i;
else {
error(_("use of 2/29 in non leap-year"));
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
}
--i;
@@ -2210,8 +2211,9 @@ const char * const string;
*/
cp = string;
wp = NULL;
- while (isascii(*cp) && isalpha(*cp))
- ++cp;
+ while (isascii((unsigned char) *cp) &&
+ isalpha((unsigned char) *cp))
+ ++cp;
if (cp - string == 0)
wp = _("time zone abbreviation lacks alphabetic at start");
if (noise && cp - string > 3)
@@ -2220,9 +2222,11 @@ wp = _("time zone abbreviation has more than 3 alphabetics");
wp = _("time zone abbreviation has too many alphabetics");
if (wp == NULL && (*cp == '+' || *cp == '-')) {
++cp;
- if (isascii(*cp) && isdigit(*cp))
- if (*cp++ == '1' && *cp >= '0' && *cp <= '4')
- ++cp;
+ if (isascii((unsigned char) *cp) &&
+ isdigit((unsigned char) *cp))
+ if (*cp++ == '1' &&
+ *cp >= '0' && *cp <= '4')
+ ++cp;
}
if (*cp != '\0')
wp = _("time zone abbreviation differs from POSIX standard");
@@ -2238,7 +2242,7 @@ wp = _("time zone abbreviation differs from POSIX standard");
i = strlen(string) + 1;
if (charcnt + i > TZ_MAX_CHARS) {
error(_("too many, or too long, time zone abbreviations"));
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
(void) strcpy(&chars[charcnt], string);
charcnt += eitol(i);
@@ -2302,7 +2306,7 @@ const int i;
(void) fprintf(stderr,
_("%s: %d did not sign extend correctly\n"),
progname, i);
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
return l;
}
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index 7446bda89e..7a289a8dc7 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -1,4 +1,5 @@
-# Copyright (C) 1995-2000,2002,2003,2004,2005 Free Software Foundation, Inc.
+# Copyright (C) 1995-2000,2002,2003,2004,2005,2006
+# 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
@@ -21,7 +22,7 @@
#
subdir := wcsmbs
-headers := wchar.h bits/wchar.h bits/wchar2.h
+headers := wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h
distribute := wcwidth.h wcsmbsload.h
routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
new file mode 100644
index 0000000000..5e4894567c
--- /dev/null
+++ b/wcsmbs/bits/wchar-ldbl.h
@@ -0,0 +1,62 @@
+/* -mlong-double-64 compatibility mode for <wchar.h> functions.
+ Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _WCHAR_H
+# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
+#endif
+
+#if defined __USE_ISOC99 || defined __USE_UNIX98
+__BEGIN_NAMESPACE_C99
+__LDBL_REDIR_DECL (fwprintf);
+__LDBL_REDIR_DECL (wprintf);
+__LDBL_REDIR_DECL (swprintf);
+__LDBL_REDIR_DECL (vfwprintf);
+__LDBL_REDIR_DECL (vwprintf);
+__LDBL_REDIR_DECL (vswprintf);
+__LDBL_REDIR_DECL (fwscanf);
+__LDBL_REDIR_DECL (wscanf);
+__LDBL_REDIR_DECL (swscanf);
+__END_NAMESPACE_C99
+#endif
+
+#ifdef __USE_ISOC99
+__BEGIN_NAMESPACE_C99
+__LDBL_REDIR1_DECL (wcstold, wcstod);
+__LDBL_REDIR_DECL (vfwscanf);
+__LDBL_REDIR_DECL (vwscanf);
+__LDBL_REDIR_DECL (vswscanf);
+__END_NAMESPACE_C99
+#endif
+
+#ifdef __USE_GNU
+__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
+#endif
+
+__LDBL_REDIR1_DECL (__wcstold_internal, __wcstod_internal);
+
+#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
+__LDBL_REDIR_DECL (__swprintf_chk)
+__LDBL_REDIR_DECL (__vswprintf_chk)
+# if __USE_FORTIFY_LEVEL > 1
+__LDBL_REDIR_DECL (__fwprintf_chk)
+__LDBL_REDIR_DECL (__wprintf_chk)
+__LDBL_REDIR_DECL (__vfwprintf_chk)
+__LDBL_REDIR_DECL (__vwprintf_chk)
+# endif
+#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index 6eac952ac9..00216ec059 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -1,5 +1,5 @@
/* Checking macros for wchar functions.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 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
@@ -210,22 +210,11 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
__const wchar_t *__restrict __format,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-extern int __REDIRECT_NTH (__vswprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- __const wchar_t *__restrict __format,
- __gnuc_va_list __arg), vswprintf)
- /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-extern __always_inline int
-__NTH (vswprintf (wchar_t *__s, size_t __n, __const wchar_t *__format,
- __gnuc_va_list __arg))
-{
- if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
- return __vswprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, __bos (__s),
- __format, __arg);
- return vswprintf (__s, __n, __format, __arg);
-}
+#define vswprintf(s, n, fmt, ap) \
+ (__bos (s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1 \
+ ? __vswprintf_chk (s, n, __USE_FORTIFY_LEVEL - 1, __bos (s), fmt, ap) \
+ : vswprintf (s, n, fmt, ap))
#if __USE_FORTIFY_LEVEL > 1
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 0c02dcc574..670dc79c4a 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2004,2005,2006 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
@@ -561,12 +561,12 @@ extern __inline float
__NTH (wcstof (__const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr))
{ return __wcstof_internal (__nptr, __endptr, 0); }
+# ifndef __LDBL_COMPAT
extern __inline long double
__NTH (wcstold (__const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr))
{ return __wcstold_internal (__nptr, __endptr, 0); }
-
-
+# endif
__extension__
extern __inline long long int
__NTH (wcstoq (__const wchar_t *__restrict __nptr,
@@ -833,12 +833,14 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
# include <wctype.h>
#endif
-
/* Define some macros helping to catch buffer overflows. */
#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
# include <bits/wchar2.h>
#endif
+#ifdef __LDBL_COMPAT
+# include <bits/wchar-ldbl.h>
+#endif
__END_DECLS