diff options
author | Andreas Jaeger <aj@suse.de> | 2012-03-07 08:55:31 +0100 |
---|---|---|
committer | Andreas Jaeger <aj@suse.de> | 2012-03-07 08:55:31 +0100 |
commit | 580716898d5e80784f1993a0129d1b821bc6e3bf (patch) | |
tree | c346faaab5b1f4005f3c0dd8f16ba701a30ad541 | |
parent | 625d134f42d65ebc0349c03a0d9592400e86d084 (diff) | |
parent | 3bd2c723160f04b1c151daffb8f6596dbd633f5e (diff) | |
download | glibc-580716898d5e80784f1993a0129d1b821bc6e3bf.zip glibc-580716898d5e80784f1993a0129d1b821bc6e3bf.tar.gz glibc-580716898d5e80784f1993a0129d1b821bc6e3bf.tar.bz2 |
Merge branch 'master' into bug13658-branch
191 files changed, 7333 insertions, 2512 deletions
@@ -1,3 +1,432 @@ +2012-03-05 David S. Miller <davem@davemloft.net> + + * sysdeps/sparc/fpu/libm-test-ulps: Update. + +2012-03-05 Andreas Schwab <schwab@linux-m68k.org> + + * sysdeps/powerpc/fpu/libm-test-ulps: Update. + + * sysdeps/ieee754/ldbl-128ibm/e_coshl.c: Drop exp(-x) term + only for |x| >= 40. + * sysdeps/ieee754/ldbl-128ibm/e_sinhl.c: Likewise. + +2012-03-05 H.J. Lu <hongjiu.lu@intel.com> + + * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c (gettimeofday_ifunc): + Replace gettimeofday with __vdso_gettimeofday. + + * sysdeps/unix/sysv/linux/x86_64/init-first.c + (_libc_vdso_platform_setup): Replace clock_gettime and getcpu with + __vdso_clock_gettime and __vdso_getcpu. + + * sysdeps/unix/sysv/linux/x86_64/time.c (time_ifunc): Replace + time with __vdso_time. + +2012-03-05 Joseph Myers <joseph@codesourcery.com> + + * manual/lang.texi (size_t): Note types to which size_t may be + equivalent with the GNU C Library, but do not describe when + differences between them are significant. + +2012-03-05 Andreas Jaeger <aj@suse.de> + + * sysdeps/i386/fpu/libm-test-ulps: Update. + +2012-03-05 Joseph Myers <joseph@codesourcery.com> + + [BZ #3976] + * sysdeps/ieee754/dbl-64/e_pow.c: Include <fenv.h>. + (__ieee754_pow): Save and restore rounding mode and use + round-to-nearest for main computations. + * math/libm-test.inc (pow_test_tonearest): New function. + (pow_test_towardzero): Likewise. + (pow_test_downward): Likewise. + (pow_test_upward): Likewise. + (main): Call the new functions. + * sysdeps/i386/fpu/libm-test-ulps: Update. + * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. + + [BZ #3976] + * math/libm-test.inc (cosh_test_tonearest): New function. + (cosh_test_towardzero): Likewise. + (cosh_test_downward): Likewise. + (cosh_test_upward): Likewise. + (sinh_test_tonearest): Likewise. + (sinh_test_towardzero): Likewise. + (sinh_test_downward): Likewise. + (sinh_test_upward): Likewise. + (main): Call the new functions. + * sysdeps/i386/fpu/libm-test-ulps: Update. + * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. + +2012-03-05 Tom de Vries <tom@codesourcery.com> + + * sysdeps/generic/dl-osinfo.h (_dl_setup_stack_chk_guard): Ensure + default stack guard is set in last bytes. + * sysdeps/unix/sysv/linux/dl-osinfo.h (_dl_setup_stack_chk_guard): Same. + +2012-03-05 Kees Cook <keescook@chromium.org> + + * stdio-common/vfprintf.c (vfprintf): add missing errno settings. + + [BZ #13656] + * stdio-common/vfprintf.c (vfprintf): Check for nargs overflow and + possibly allocate from heap instead of stack. + * stdio-common/bug-vfprintf-nargs.c: New file. + * stdio-common/Makefile (tests): Add nargs overflow test. + +2012-03-03 Andreas Schwab <schwab@linux-m68k.org> + + * sysdeps/powerpc/fpu/libm-test-ulps: Update. + +2012-03-03 Marek Polacek <polacek@redhat.com> + + * include/sys/cdefs.h: Remove __GNUC_PREREQ macro. + * math/math_private.h: Likewise. + * stdlib/tst-strtod.c: Likewise. + * sysdeps/i386/i486/bits/atomic.h: Likewise. + * sysdeps/x86_64/bits/atomic.h: Likewise. + +2012-03-02 David S. Miller <davem@davemloft.net> + + * sysdeps/sparc/sparc32/sparcv9/fpu/s_llrint.S: New file. + * sysdeps/sparc/sparc32/sparcv9/fpu/s_llrintf.S: New file. + * sysdeps/sparc/sparc32/sparcv9/fpu/s_lrint.S: New file. + * sysdeps/sparc/sparc32/sparcv9/fpu/s_lrintf.S: New file. + * sysdeps/sparc/sparc64/fpu/s_llrint.S: New file. + * sysdeps/sparc/sparc64/fpu/s_llrintf.S: New file. + * sysdeps/sparc/sparc64/fpu/s_lrint.S: New file. + * sysdeps/sparc/sparc64/fpu/s_lrintf.S: New file. + +2012-03-02 Roland McGrath <roland@hack.frob.com> + + [BZ #13792] + * manual/examples/README: New file, says the example source files + can be used under GPL>=2. + * manual/Makefile (%.c.texi): Eat the leading part of the file until a + line containing just "*/". + * manual/examples/add.c: Add copyright header (GPL>=2). + * manual/examples/argp-ex1.c: Likewise. + * manual/examples/argp-ex2.c: Likewise. + * manual/examples/argp-ex3.c: Likewise. + * manual/examples/argp-ex4.c: Likewise. + * manual/examples/atexit.c: Likewise. + * manual/examples/db.c: Likewise. + * manual/examples/dir.c: Likewise. + * manual/examples/dir2.c: Likewise. + * manual/examples/execinfo.c: Likewise. + * manual/examples/filecli.c: Likewise. + * manual/examples/filesrv.c: Likewise. + * manual/examples/fmtmsgexpl.c: Likewise. + * manual/examples/genpass.c: Likewise. + * manual/examples/inetcli.c: Likewise. + * manual/examples/inetsrv.c: Likewise. + * manual/examples/isockad.c: Likewise. + * manual/examples/longopt.c: Likewise. + * manual/examples/memopen.c: Likewise. + * manual/examples/memstrm.c: Likewise. + * manual/examples/mkfsock.c: Likewise. + * manual/examples/mkisock.c: Likewise. + * manual/examples/mygetpass.c: Likewise. + * manual/examples/pipe.c: Likewise. + * manual/examples/popen.c: Likewise. + * manual/examples/rprintf.c: Likewise. + * manual/examples/search.c: Likewise. + * manual/examples/select.c: Likewise. + * manual/examples/setjmp.c: Likewise. + * manual/examples/sigh1.c: Likewise. + * manual/examples/sigusr.c: Likewise. + * manual/examples/stpcpy.c: Likewise. + * manual/examples/strdupa.c: Likewise. + * manual/examples/strftim.c: Likewise. + * manual/examples/strncat.c: Likewise. + * manual/examples/subopt.c: Likewise. + * manual/examples/swapcontext.c: Likewise. + * manual/examples/termios.c: Likewise. + * manual/examples/testopt.c: Likewise. + * manual/examples/testpass.c: Likewise. + * manual/examples/timeval_subtract.c: Likewise. + + [BZ #13792] + * manual/time.texi (Elapsed Time): Move timeval_subtract example + function to ... + * manual/timeval_subtract.c.texi: ... here, new file. + +2012-03-02 David S. Miller <davem@davemloft.net> + + * sysdeps/sparc/fpu/libm-test-ulps: Update for recently added tests. + +2012-03-02 Joseph Myers <joseph@codesourcery.com> + + [BZ #3976] + * sysdeps/ieee754/dbl-64/s_sin.c: Include <fenv.h> + (__sin): Save and restore rounding mode and use round-to-nearest + for all computations. + (__cos): Save and restore rounding mode and use round-to-nearest + for all computations. + * sysdeps/ieee754/dbl-64/s_tan.c: Include "math_private.h" and + <fenv.h>. + (tan): Save and restore rounding mode and use round-to-nearest for + all computations. + * math/libm-test.inc (cos_test_tonearest): New function. + (cos_test_towardzero): Likewise. + (cos_test_downward): Likewise. + (cos_test_upward): Likewise. + (sin_test_tonearest): Likewise. + (sin_test_towardzero): Likewise. + (sin_test_downward): Likewise. + (sin_test_upward): Likewise. + (tan_test_tonearest): Likewise. + (tan_test_towardzero): Likewise. + (tan_test_downward): Likewise. + (tan_test_upward): Likewise. + (main): Call the new functions. + * sysdeps/i386/fpu/libm-test-ulps: Update. + * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. + + [BZ #10135] + * sysdeps/ieee754/dbl-64/s_scalbln.c (__scalbln): First test for + small n, then large n, before computing and testing k+n. + * sysdeps/ieee754/dbl-64/s_scalbn.c (__scalbn): Likewise. + * sysdeps/ieee754/dbl-64/wordsize-64/s_scalbln.c (__scalbln): + Likewise. + * sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c (__scalbn): + Likewise. + * sysdeps/ieee754/flt-32/s_scalblnf.c (__scalblnf): Likewise. + * sysdeps/ieee754/flt-32/s_scalbnf.c (__scalbnf): Likewise. + * sysdeps/ieee754/ldbl-128/s_scalblnl.c (__scalblnl): Likewise. + * sysdeps/ieee754/ldbl-128/s_scalbnl.c (__scalbnl): Likewise. + * sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c (__scalblnl): Likewise. + * sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c (__scalbnl): Likewise. + * sysdeps/ieee754/ldbl-96/s_scalblnl.c (__scalblnl): Likewise. + * sysdeps/ieee754/ldbl-96/s_scalbnl.c (__scalbnl): Likewise. + * math/libm-test.inc (scalbn_test): Add more tests. + (scalbln_test): Likewise. + + * manual/filesys.texi (mode_t): Describe constraints on size and + signedness, not exact equivalence to a particular type. + (ino_t): Likewise. + (ino64_t): Likewise. + (dev_t): Likewise. + (nlink_t): Likewise. + (blkcnt_t): Likewise. + (blkcnt64_t): Likewise. + * manual/llio.texi (off_t): Likewise. + + [BZ #3976] + * sysdeps/ieee754/dbl-64/e_exp.c: Include <fenv.h>. + (__ieee754_exp): Save and restore rounding mode and use + round-to-nearest for all computations. + * math/libm-test.inc (exp_test_tonearest): New function. + (exp_test_towardzero): Likewise. + (exp_test_downward): Likewise. + (exp_test_upward): Likewise. + (main): Call the new functions. + * sysdeps/i386/fpu/libm-test-ulps: Update. + * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. + +2012-03-01 Chris Demetriou <cgd@google.com> + + * sysdeps/gnu/errlist-compat.awk: Don't depend on AWK internals to + have predictable order. + +2012-03-01 David S. Miller <davem@davemloft.net> + + * sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c: Delete. + + * sysdeps/sparc/sparc64/fpu/s_finite.S: New file. + * sysdeps/sparc/sparc64/fpu/s_finitef.S: New file. + * sysdeps/sparc/sparc64/fpu/s_isinf.S: New file. + * sysdeps/sparc/sparc64/fpu/s_isinff.S: New file. + + * sysdeps/sparc/sparc32/fpu/s_signbit.S: New file. + * sysdeps/sparc/sparc32/fpu/s_signbitf.S: New file. + * sysdeps/sparc/sparc32/fpu/s_signbitl.S: New file. + * sysdeps/sparc/sparc32/sparcv9/fpu/s_isnan.S: New file. + * sysdeps/sparc/sparc64/fpu/s_isnan.S: New file. + * sysdeps/sparc/sparc64/fpu/s_isnanf.S: New file. + * sysdeps/sparc/sparc64/fpu/s_signbit.S: New file. + * sysdeps/sparc/sparc64/fpu/s_signbitf.S: New file. + * sysdeps/sparc/sparc64/fpu/s_signbitl.S: New file. + + * sysdeps/sparc/fpu/libm-test-ulps: Update. + + * sysdeps/sparc/sparc32/fpu/libm-test-ulps: Move... + * sysdeps/sparc/fpu/libm-test-ulps: to here. + * sysdeps/sparc/sparc64/fpu/libm-test-ulps: Delete. + + * sysdeps/sparc/crti.S: Remove HAVE_BINUTILS_GOTDATA checks. + * sysdeps/sparc/sparc32/dl-machine.h: Likewise. + * sysdeps/sparc/sparc32/elf/start.S: Likewise. + * sysdeps/sparc/sparc32/fpu/w_sqrt.S: Likewise. + * sysdeps/sparc/sparc32/fpu/w_sqrtf.S: Likewise. + * sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt.S: Likewise. + * sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf.S: Likewise. + * sysdeps/sparc/sparc64/dl-machine.h: Likewise. + * sysdeps/sparc/sparc64/elf/start.S: Likewise. + * sysdeps/sparc/sparc64/fpu/w_sqrt.S: Likewise. + * sysdeps/sparc/sparc64/fpu/w_sqrtf.S: Likewise. + * sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S: Likewise. + * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h: Likewise. + * sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S: Likewise. + * sysdeps/unix/sysv/linux/sparc/sparc64/brk.S: Likewise. + * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h: Likewise. + * config.h.in (HAVE_BINUTILS_GOTDATA): Delete. + * sysdeps/sparc/elf/configure.in: Remove binutils GOTDATA checks. + * sysdeps/sparc/elf/configure: Regenerated. + +2012-03-01 Joseph Myers <joseph@codesourcery.com> + + * configure.in (AS, LD): Require binutils 2.20 or later. + * configure: Regenerated. + * manual/install.texi (Tools for Compilation): Give binutils 2.20 + as required minimum version. + * INSTALL: Regenerated. + + [BZ #2541] + [BZ #4108] + * sysdeps/ieee754/flt-32/s_erff.c (__erfcf): Mask out one more bit + before squaring exponent. + * sysdeps/ieee754/ldbl-128ibm/s_erfl.c (__erfcl): Mask out whole + bottom long double and 27 bits of top long double before squaring + exponent. + * math/libm-test.inc (erfc_test): Add more tests. + * sysdeps/i386/fpu/libm-test-ulps: Update. + * sysdeps/powerpc/fpu/libm-test-ulps: Likewise. + * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. + +2012-03-01 Kai Tietz <ktietz@redhat.com> + + * soft-fp/soft-fp.h (_FP_STRUCT_LAYOUT): New macro. + * soft-fp/quad.h (_FP_UNION_Q): Use _FP_STRUCT_LAYOUT on struct + containing bit-fields. + * soft-fp/extended.h (_FP_UNION_E): Likewise. + * soft-fp/single.h (_FP_UNION_S): Likewise. + * soft-fp/double.h (_FP_UNION_D): Likewise. + +2012-02-29 Joseph Myers <joseph@codesourcery.com> + + [BZ #13786] + * sysdeps/i386/i686/multiarch/strcmp.S [USE_AS_STRCASECMP_L]: Do + not include ../strcmp.S. + [USE_AS_STRNCASECMP_L]: Likewise. + * sysdeps/i386/i686/multiarch/strcasecmp_l-c.c + (__strcasecmp_l_ia32): Define as alias to __strcasecmp_l_nonascii. + * sysdeps/i386/i686/multiarch/strncase_l-c.c + (__strncasecmp_l_ia32): Define as alias to + __strncasecmp_l_nonascii. + + [BZ #5794] + * math/libm-test.inc (expm1_test): Add test for bug 5794. + * sysdeps/i386/fpu/libm-test-ulps: Update. + * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. + + * sysdeps/i386/fpu/libm-test-ulps: Reduce some expected errors. + * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. + +2012-02-29 Jeff Law <law@redhat.com> + + * resolv/res_query.c (__libc_res_nquerydomain): Avoid + out of bounds read. + +2012-02-29 Marek Polacek <polacek@redhat.com> + + [BZ #13706] + * elf/rtld.c (dl_main): Always set l_used to 1 for vDSO. + * elf/Makefile: Add rules to run tst-unused-dep.out. + +2012-02-28 David S. Miller <davem@davemloft.net> + + * sysdeps/sparc/sparc32/fpu/w_sqrt.S: New file. + * sysdeps/sparc/sparc32/fpu/w_sqrtf.S: New file. + * sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt.S: New file. + * sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf.S: New file. + * sysdeps/sparc/sparc64/fpu/w_sqrt.S: New file. + * sysdeps/sparc/sparc64/fpu/w_sqrtf.S: New file. + +2012-02-29 Joseph Myers <joseph@codesourcery.com> + + * math/libm-test.inc (llround_test): Move one test from + lround_test. Use TEST_f_L in moved test. + (lround_test): Move misplaced test to llround_test. Add testcase + from bug 2561. + +2012-02-28 Ulrich Drepper <drepper@gmail.com> + + * sysdeps/x86_64/fpu/e_expf.S: New file. + Contributed by Dmitrieva Liubov <liubov.dmitrieva@gmail.com>. + +2012-02-28 Stanislav Brabec <sbrabec@suse.cz> + + [BZ #13637] + * posix/regex_internal.c (re_string_skip_chars): Fix miscomputation + of remain_len that may cause incomplete multi-byte character and + false match. + * posix/bug-regex33.c: New file. + * posix/Makefile (tests): Add bug-regex33. + +2012-02-28 Joseph Myers <joseph@codesourcery.com> + + * manual/macros.texi: New file. + * Makefile (INSTALL, NOTES): Depend on manual/macros.texi. + * manual/libc.texinfo: Include macros.texi. + * manual/creatute.texi: Likewise. + * manual/install.texi: Likewise. + * manual/arith.texi: Use macros @Theglibc{}, @theglibc{} and + @glibcadj{} in references to the GNU C Library. + * manual/charset.texi: Likewise. + * manual/conf.texi: Likewise. + * manual/contrib.texi: Likewise. Consistently use "GNU C Library" + when not using those macros. + * manual/creature.texi: Likewise. + * manual/crypt.texi: Likewise. + * manual/errno.texi: Likewise. + * manual/filesys.texi: Likewise. + * manual/header.texi: Likewise. + * manual/install.texi: Likewise. + * manual/intro.texi: Likewise. + * manual/io.texi: Likewise. + * manual/job.texi: Likewise. + * manual/lang.texi: Likewise. + * manual/libc.texiinfo: Likewise. + * manual/llio.texi: Likewise. + * manual/locale.texi: Likewise. + * manual/maint.texi: Likewise. + * manual/math.texi: Likewise. + * manual/memory.texi: Likewise. + * manual/message.texi: Likewise. + * manual/nss.texi: Likewise. + * manual/pattern.texi: Likewise. + * manual/process.texi: Likewise. + * manual/resource.texi: Likewise. + * manual/search.texi: Likewise. + * manual/setjmp.texi: Likewise. + * manual/signal.texi: Likewise. + * manual/socket.texi: Likewise. + * manual/startup.texi: Likewise. + * manual/stdio.texi: Likewise. + * manual/string.texi: Likewise. + * manual/sysinfo.texi: Likewise. + * manual/syslog.texi: Likewise. + * manual/terminal.texi: Likewise. + * manual/time.texi: Likewise. + * manual/users.texi: Likewise. + * INSTALL: Regenerated. + * NOTES: Regenerated. + * sysdeps/gnu/errlist.c: Regenerated. + +2012-02-28 Andreas Schwab <schwab@linux-m68k.org> + + * include/dirent.h: Include <dirstream.h> before + <dirent/dirent.h>. + +2012-02-28 David S. Miller <davem@davemloft.net> + + * sysdeps/sparc/sparc32/fpu/s_copysign.S: New file. + * sysdeps/sparc/sparc32/fpu/s_copysignf.S: New file. + * sysdeps/sparc/sparc64/fpu/s_copysign.S: New file. + * sysdeps/sparc/sparc64/fpu/s_copysignf.S: New file. + 2012-02-27 David S. Miller <davem@davemloft.net> * sysdeps/sparc/sparc32/sparcv9/fpu/s_floor.S: New file. @@ -6,24 +6,24 @@ the top level of the source tree. This file answers common questions and describes problems you may experience with compilation and installation. It is updated more frequently than this manual. - Features can be added to GNU Libc via "add-on" bundles. These are -separate tar files, which you unpack into the top level of the source -tree. Then you give `configure' the `--enable-add-ons' option to -activate them, and they will be compiled into the library. + Features can be added to the GNU C Library via "add-on" bundles. +These are separate tar files, which you unpack into the top level of +the source tree. Then you give `configure' the `--enable-add-ons' +option to activate them, and they will be compiled into the library. You will need recent versions of several GNU tools: definitely GCC and GNU Make, and possibly others. *Note Tools for Compilation::, below. -Configuring and compiling GNU Libc -================================== +Configuring and compiling the GNU C Library +=========================================== -GNU libc cannot be compiled in the source directory. You must build it -in a separate build directory. For example, if you have unpacked the -glibc sources in `/src/gnu/glibc-VERSION', create a directory -`/src/gnu/glibc-build' to put the object files in. This allows -removing the whole build directory in case an error occurs, which is -the safest way to get a fresh start and should always be done. +The GNU C Library cannot be compiled in the source directory. You must +build it in a separate build directory. For example, if you have +unpacked the GNU C Library sources in `/src/gnu/glibc-VERSION', create +a directory `/src/gnu/glibc-build' to put the object files in. This +allows removing the whole build directory in case an error occurs, +which is the safest way to get a fresh start and should always be done. From your object directory, run the shell script `configure' located at the top level of the source tree. In the scenario above, you'd type @@ -36,10 +36,10 @@ directory, especially some files in the manual subdirectory. `configure' takes many options, but the only one that is usually mandatory is `--prefix'. This option tells `configure' where you want -glibc installed. This defaults to `/usr/local', but the normal setting -to install as the standard system library is `--prefix=/usr' for -GNU/Linux systems and `--prefix=' (an empty prefix) for GNU/Hurd -systems. +the GNU C Library installed. This defaults to `/usr/local', but the +normal setting to install as the standard system library is +`--prefix=/usr' for GNU/Linux systems and `--prefix=' (an empty prefix) +for GNU/Hurd systems. It may also be useful to set the CC and CFLAGS variables in the environment when running `configure'. CC selects the C compiler that @@ -59,16 +59,16 @@ will be used, and CFLAGS sets optimization options for the compiler. `--with-headers=DIRECTORY' Look for kernel header files in DIRECTORY, not `/usr/include'. - Glibc needs information from the kernel's header files describing - the interface to the kernel. Glibc will normally look in - `/usr/include' for them, but if you specify this option, it will - look in DIRECTORY instead. + The GNU C Library needs information from the kernel's header files + describing the interface to the kernel. The GNU C Library will + normally look in `/usr/include' for them, but if you specify this + option, it will look in DIRECTORY instead. This option is primarily of use on a system where the headers in - `/usr/include' come from an older version of glibc. Conflicts can - occasionally happen in this case. You can also use this option if - you want to compile glibc with a newer set of kernel headers than - the ones found in `/usr/include'. + `/usr/include' come from an older version of the GNU C Library. + Conflicts can occasionally happen in this case. You can also use + this option if you want to compile the GNU C Library with a newer + set of kernel headers than the ones found in `/usr/include'. `--enable-add-ons[=LIST]' Specify add-on packages to include in the build. If this option is @@ -93,7 +93,7 @@ will be used, and CFLAGS sets optimization options for the compiler. Use the binutils (assembler and linker) in `DIRECTORY', not the ones the C compiler would default to. You can use this option if the default binutils on your system cannot deal with all the - constructs in the GNU C library. In that case, `configure' will + constructs in the GNU C Library. In that case, `configure' will detect the problem and suppress these constructs, so that the library will still be usable, but functionality may be lost--for example, you can't build a shared libc with old binutils. @@ -132,10 +132,10 @@ will be used, and CFLAGS sets optimization options for the compiler. `--host=HOST-SYSTEM' These options are for cross-compiling. If you specify both options and BUILD-SYSTEM is different from HOST-SYSTEM, `configure' - will prepare to cross-compile glibc from BUILD-SYSTEM to be used - on HOST-SYSTEM. You'll probably need the `--with-headers' option - too, and you may have to override CONFIGURE's selection of the - compiler and/or binutils. + will prepare to cross-compile the GNU C Library from BUILD-SYSTEM + to be used on HOST-SYSTEM. You'll probably need the + `--with-headers' option too, and you may have to override + CONFIGURE's selection of the compiler and/or binutils. If you only specify `--host', `configure' will prepare for a native compile but use what you specify instead of guessing what @@ -167,8 +167,8 @@ facilities, type `make check'. If it does not complete successfully, do not use the built library, and report a bug after verifying that the problem is not already known. *Note Reporting Bugs::, for instructions on reporting bugs. Note that some of the tests assume they are not -being run by `root'. We recommend you compile and test glibc as an -unprivileged user. +being run by `root'. We recommend you compile and test the GNU C +Library as an unprivileged user. Before reporting bugs make sure there is no problem with your system. The tests (and later installation) use some pre-existing files of the @@ -188,7 +188,7 @@ build directory and add values as appropriate for your system. The file is included and parsed by `make' and has to follow the conventions for makefiles. - It is easy to configure the GNU C library for cross-compilation by + It is easy to configure the GNU C Library for cross-compilation by setting a few variables in `configparms'. Set `CC' to the cross-compiler for the target you configured the library for; it is important to use this same `CC' value when running `configure', like @@ -204,16 +204,16 @@ Installing the C Library To install the library and its header files, and the Info files of the manual, type `env LANGUAGE=C LC_ALL=C make install'. This will build things, if necessary, before installing them; however, you should still -compile everything first. If you are installing glibc as your primary -C library, we recommend that you shut the system down to single-user -mode first, and reboot afterward. This minimizes the risk of breaking -things when the library changes out from underneath. +compile everything first. If you are installing the GNU C Library as +your primary C library, we recommend that you shut the system down to +single-user mode first, and reboot afterward. This minimizes the risk +of breaking things when the library changes out from underneath. `make install' will do the entire job of upgrading from a previous -installation of glibc 2.x. There may sometimes be headers left behind -from the previous installation, but those are generally harmless. If -you want to avoid leaving headers behind you can do things in the -following order. +installation of the GNU C Library version 2.x. There may sometimes be +headers left behind from the previous installation, but those are +generally harmless. If you want to avoid leaving headers behind you +can do things in the following order. You must first build the library (`make'), optionally check it (`make check'), switch the include directories and then install (`make @@ -224,19 +224,20 @@ library requires the ability to compile and run programs against the old library. The new `/usr/include', after switching the include directories and before installing the library should contain the Linux headers, but nothing else. If you do this, you will need to restore -any headers from non-glibc libraries youself after installing the -library. +any headers from libraries other than the GNU C Library yourself after +installing the library. - You can install glibc somewhere other than where you configured it -to go by setting the `install_root' variable on the command line for -`make install'. The value of this variable is prepended to all the -paths for installation. This is useful when setting up a chroot -environment or preparing a binary distribution. The directory should be -specified with an absolute file name. + You can install the GNU C Library somewhere other than where you +configured it to go by setting the `install_root' variable on the +command line for `make install'. The value of this variable is +prepended to all the paths for installation. This is useful when +setting up a chroot environment or preparing a binary distribution. +The directory should be specified with an absolute file name. - Glibc includes a daemon called `nscd', which you may or may not want -to run. `nscd' caches name service lookups; it can dramatically -improve performance with NIS+, and may help with DNS as well. + The GNU C Library includes a daemon called `nscd', which you may or +may not want to run. `nscd' caches name service lookups; it can +dramatically improve performance with NIS+, and may help with DNS as +well. One auxiliary program, `/usr/libexec/pt_chown', is installed setuid `root'. This program is invoked by the `grantpt' function; it sets the @@ -249,12 +250,12 @@ this program; otherwise you do. The source for `pt_chown' is in `login/programs/pt_chown.c'. After installation you might want to configure the timezone and -locale installation of your system. The GNU C library comes with a +locale installation of your system. The GNU C Library comes with a locale database which gets configured with `localedef'. For example, to set up a German locale with name `de_DE', simply issue the command `localedef -i de_DE -f ISO-8859-1 de_DE'. To configure all locales -that are supported by glibc, you can issue from your build directory the -command `make localedata/install-locales'. +that are supported by the GNU C Library, you can issue from your build +directory the command `make localedata/install-locales'. To configure the locally used timezone, set the `TZ' environment variable. The script `tzselect' helps you to select the right value. @@ -269,7 +270,7 @@ Recommended Tools for Compilation ================================= We recommend installing the following GNU tools before attempting to -build the GNU C library: +build the GNU C Library: * GNU `make' 3.79 or newer @@ -282,17 +283,17 @@ build the GNU C library: * GCC 4.3 or newer, GCC 4.6 recommended GCC 4.3 or higher is required; as of this writing, GCC 4.6 is the - compiler we advise to use to build the GNU C library. + compiler we advise to use to build the GNU C Library. - You can use whatever compiler you like to compile programs that - use GNU libc. + You can use whatever compiler you like to compile programs that use + the GNU C Library. Check the FAQ for any special compiler issues on particular platforms. - * GNU `binutils' 2.15 or later + * GNU `binutils' 2.20 or later - You must use GNU `binutils' (as and ld) to build the GNU C library. + You must use GNU `binutils' (as and ld) to build the GNU C Library. No other assembler or linker has the necessary functionality at the moment. @@ -338,41 +339,42 @@ patches, although we try to avoid this. Specific advice for GNU/Linux systems ===================================== -If you are installing GNU libc on a GNU/Linux system, you need to have -the header files from a 2.6.19.1 or newer kernel around for reference. -These headers must be installed using `make headers_install'; the -headers present in the kernel source directory are not suitable for -direct use by GNU libc. You do not need to use that kernel, just have -its headers installed where glibc can access them, referred to here as -INSTALL-DIRECTORY. The easiest way to do this is to unpack it in a -directory such as `/usr/src/linux-VERSION'. In that directory, run -`make headers_install INSTALL_HDR_PATH=INSTALL-DIRECTORY'. Finally, -configure glibc with the option -`--with-headers=INSTALL-DIRECTORY/include'. Use the most recent kernel -you can get your hands on. (If you are cross-compiling GNU libc, you -need to specify `ARCH=ARCHITECTURE' in the `make headers_install' -command, where ARCHITECTURE is the architecture name used by the Linux -kernel, such as `x86' or `powerpc'.) - - After installing GNU libc, you may need to remove or rename +If you are installing the GNU C Library on a GNU/Linux system, you need +to have the header files from a 2.6.19.1 or newer kernel around for +reference. These headers must be installed using `make +headers_install'; the headers present in the kernel source directory +are not suitable for direct use by the GNU C Library. You do not need +to use that kernel, just have its headers installed where the GNU C +Library can access them, referred to here as INSTALL-DIRECTORY. The +easiest way to do this is to unpack it in a directory such as +`/usr/src/linux-VERSION'. In that directory, run `make headers_install +INSTALL_HDR_PATH=INSTALL-DIRECTORY'. Finally, configure the GNU C +Library with the option `--with-headers=INSTALL-DIRECTORY/include'. +Use the most recent kernel you can get your hands on. (If you are +cross-compiling the GNU C Library, you need to specify +`ARCH=ARCHITECTURE' in the `make headers_install' command, where +ARCHITECTURE is the architecture name used by the Linux kernel, such as +`x86' or `powerpc'.) + + After installing the GNU C Library, you may need to remove or rename directories such as `/usr/include/linux' and `/usr/include/asm', and replace them with copies of directories such as `linux' and `asm' from `INSTALL-DIRECTORY/include'. All directories present in -`INSTALL-DIRECTORY/include' should be copied, except that GNU libc -provides its own version of `/usr/include/scsi'; the files provided by -the kernel should be copied without replacing those provided by GNU -libc. The `linux', `asm' and `asm-generic' directories are required to -compile programs using GNU libc; the other directories describe -interfaces to the kernel but are not required if not compiling programs -using those interfaces. You do not need to copy kernel headers if you -did not specify an alternate kernel header source using -`--with-headers'. - - GNU/Linux expects some components of the libc installation to be in -`/lib' and some in `/usr/lib'. This is handled automatically if you -configure glibc with `--prefix=/usr'. If you set some other prefix or -allow it to default to `/usr/local', then all the components are -installed there. +`INSTALL-DIRECTORY/include' should be copied, except that the GNU C +Library provides its own version of `/usr/include/scsi'; the files +provided by the kernel should be copied without replacing those +provided by the GNU C Library. The `linux', `asm' and `asm-generic' +directories are required to compile programs using the GNU C Library; +the other directories describe interfaces to the kernel but are not +required if not compiling programs using those interfaces. You do not +need to copy kernel headers if you did not specify an alternate kernel +header source using `--with-headers'. + + GNU/Linux expects some components of the GNU C Library installation +to be in `/lib' and some in `/usr/lib'. This is handled automatically +if you configure the GNU C Library with `--prefix=/usr'. If you set +some other prefix or allow it to default to `/usr/local', then all the +components are installed there. You cannot use `nscd' with 2.0 kernels, due to bugs in the kernel-side thread support. `nscd' happens to hit these bugs @@ -382,7 +384,7 @@ program. Reporting Bugs ============== -There are probably bugs in the GNU C library. There are certainly +There are probably bugs in the GNU C Library. There are certainly errors and omissions in this manual. If you report them, they will get fixed. If you don't, no one will ever know about them and they will remain unfixed for all eternity, if not longer. @@ -396,14 +398,14 @@ includes a patch or a hint on solving the problem. To report a bug, first you must find it. With any luck, this will be the hard part. Once you've found a bug, make sure it's really a -bug. A good way to do this is to see if the GNU C library behaves the +bug. A good way to do this is to see if the GNU C Library behaves the same way some other C library does. If so, probably you are wrong and the libraries are right (but not necessarily). If not, one of the -libraries is probably wrong. It might not be the GNU library. Many +libraries is probably wrong. It might not be the GNU C Library. Many historical Unix C libraries permit things that we don't, such as closing a file twice. - If you think you have found some way in which the GNU C library does + If you think you have found some way in which the GNU C Library does not conform to the ISO and POSIX standards (*note Standards and Portability::), that is definitely a bug. Report it! @@ -398,8 +398,8 @@ define format-me makeinfo --no-validate --plaintext --no-number-sections $< -o $@ -chmod a-w $@ endef -INSTALL: manual/install.texi; $(format-me) -NOTES: manual/creature.texi; $(format-me) +INSTALL: manual/install.texi manual/macros.texi; $(format-me) +NOTES: manual/creature.texi manual/macros.texi; $(format-me) manual/dir-add.texi manual/dir-add.info: FORCE $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F) FAQ: scripts/gen-FAQ.pl FAQ.in @@ -9,11 +9,12 @@ Version 2.16 * The following bugs are resolved with this release: - 174, 350, 411, 2547, 2548, 3335, 3992, 4026, 4596, 4822, 5077, 5461, 5805, - 5993, 6884, 6907, 9739, 9902, 10110, 10140, 10210, 11174, 11322, 11365, - 11494, 12047, 13058, 13525, 13526, 13527, 13528, 13529, 13530, 13531, - 13532, 13533, 13547, 13551, 13552, 13553, 13555, 13559, 13583, 13618, - 13695, 13704, 13738 + 174, 350, 411, 2541, 2547, 2548, 3335, 3976, 3992, 4026, 4108, 4596, 4822, + 5077, 5461, 5805, 5993, 6884, 6907, 9739, 9902, 10110, 10135, 10140, + 10210, 11174, 11322, 11365, 11494, 12047, 13058, 13525, 13526, 13527, + 13528, 13529, 13530, 13531, 13532, 13533, 13547, 13551, 13552, 13553, + 13555, 13559, 13583, 13618, 13637, 13656, 13695, 13704, 13706, 13738, + 13786 * ISO C11 support: @@ -164,9 +164,9 @@ relying on semantics undefined within the standard. -- Macro: _ISOC99_SOURCE Until the revised ISO C standard is widely adopted the new features - are not automatically enabled. The GNU libc nevertheless has a - complete implementation of the new standard and to enable the new - features the macro `_ISOC99_SOURCE' should be defined. + are not automatically enabled. The GNU C Library nevertheless has + a complete implementation of the new standard and to enable the + new features the macro `_ISOC99_SOURCE' should be defined. -- Macro: _GNU_SOURCE If you define this macro, everything is included: ISO C89, @@ -184,7 +184,7 @@ relying on semantics undefined within the standard. Note that if you do this, you must link your program with the BSD compatibility library by passing the `-lbsd-compat' option to the - compiler or linker. *Note:* If you forget to do this, you may get + compiler or linker. *NB:* If you forget to do this, you may get very strange errors at run time. -- Macro: _REENTRANT @@ -192,8 +192,8 @@ relying on semantics undefined within the standard. If you define one of these macros, reentrant versions of several functions get declared. Some of the functions are specified in POSIX.1c but many others are only available on a few other systems - or are unique to GNU libc. The problem is the delay in the - standardization of the thread safe C library interface. + or are unique to the GNU C Library. The problem is the delay in + the standardization of the thread safe C library interface. Unlike on some other systems, no special version of the C library must be used for linking. There is only one version but while diff --git a/config.h.in b/config.h.in index b503454..7e5f4d4 100644 --- a/config.h.in +++ b/config.h.in @@ -87,9 +87,6 @@ certain registers (CR0, MQ, CTR, LR) in asm statements. */ #undef BROKEN_PPC_ASM_CR0 -/* Defined on SPARC if as and ld both support GOTDATA relocations. */ -#undef HAVE_BINUTILS_GOTDATA - /* Defined on SPARC if GCC emits GOTDATA relocations. */ #undef HAVE_GCC_GOTDATA @@ -4618,7 +4618,7 @@ $as_echo "$libc_cv_prog_ld_gnu" >&6; } gnu_ld=$libc_cv_prog_ld_gnu -# Accept binutils 2.13 or newer. +# Accept binutils 2.20 or newer. for ac_prog in $AS do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -4670,7 +4670,7 @@ $as_echo_n "checking version of $AS... " >&6; } ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 2.1[3-9]*|2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*) + 2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*) ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; @@ -4733,7 +4733,7 @@ $as_echo_n "checking version of $LD... " >&6; } ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 2.1[3-9]*|2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*) + 2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*) ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; diff --git a/configure.in b/configure.in index 3300055..7ebeba4 100644 --- a/configure.in +++ b/configure.in @@ -921,13 +921,13 @@ AC_PROG_LN_S LIBC_PROG_BINUTILS AC_SUBST(MIG)dnl Needed by sysdeps/mach/configure.in -# Accept binutils 2.13 or newer. +# Accept binutils 2.20 or newer. AC_CHECK_PROG_VER(AS, $AS, --version, [GNU assembler.* \([0-9]*\.[0-9.]*\)], - [2.1[3-9]*|2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as") + [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as") AC_CHECK_PROG_VER(LD, $LD, --version, [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)], - [2.1[3-9]*|2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld") + [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld") # These programs are version sensitive. AC_CHECK_TOOL_PREFIX diff --git a/elf/Makefile b/elf/Makefile index 8234ba7..25ffc57 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -1203,3 +1203,14 @@ $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so $(objpfx)tst-relsort1mod2.so: $(libm) $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \ $(objpfx)tst-relsort1mod2.so + +tests: $(objpfx)tst-unused-dep.out + +$(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so + LD_TRACE_LOADED_OBJECTS=1 \ + LD_DEBUG=unused \ + LD_PRELOAD= \ + $(elf-objpfx)${rtld-installed-name} \ + --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \ + $< > $@ + cmp $@ /dev/null > /dev/null @@ -1,5 +1,5 @@ /* Run time dynamic linker. - Copyright (C) 1995-2010, 2011 Free Software Foundation, Inc. + Copyright (C) 1995-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -1375,6 +1375,9 @@ of this helper program; chances are you did not intend to run this program.\n\ _dl_setup_hash (l); l->l_relocated = 1; + /* The vDSO is always used. */ + l->l_used = 1; + /* Initialize l_local_scope to contain just this map. This allows the use of dl_lookup_symbol_x to resolve symbols within the vdso. So we create a single entry list pointing to l_real as its only diff --git a/include/dirent.h b/include/dirent.h index 80199d6..36e7651 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -1,7 +1,9 @@ #ifndef _DIRENT_H +# ifndef _ISOMAC +# include <dirstream.h> +# endif # include <dirent/dirent.h> # ifndef _ISOMAC -# include <dirstream.h> # include <sys/stat.h> # include <stdbool.h> diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index fa93982..71baa1a 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -14,11 +14,7 @@ libc_hidden_proto (__chk_fail) rtld_hidden_proto (__chk_fail) -# if __GNUC_PREREQ (4,3) -# define __attribute_alloc_size(...) __attribute__ ((alloc_size (__VA_ARGS__))) -# else -# define __attribute_alloc_size(...) -# endif +# define __attribute_alloc_size(...) __attribute__ ((alloc_size (__VA_ARGS__))) #endif #endif diff --git a/manual/Makefile b/manual/Makefile index 0137afd..e291509 100644 --- a/manual/Makefile +++ b/manual/Makefile @@ -122,7 +122,8 @@ stamp-version: $(common-objpfx)config.make # Generate Texinfo files from the C source for the example programs. %.c.texi: examples/%.c - sed -e 's,[{}],@&,g' \ + sed -e '1,/^\*\/$$/d' \ + -e 's,[{}],@&,g' \ -e 's,/\*\(@.*\)\*/,\1,g' \ -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \ -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\ diff --git a/manual/arith.texi b/manual/arith.texi index e59da41..572808c 100644 --- a/manual/arith.texi +++ b/manual/arith.texi @@ -40,9 +40,9 @@ this is that a program often needs to be written for a particular range of integers, and sometimes must be written for a particular size of storage, regardless of what machine the program runs on. -To address this problem, the GNU C library contains C type definitions +To address this problem, @theglibc{} contains C type definitions you can use to declare integers that meet your exact needs. Because the -GNU C library header files are customized to a specific machine, your +@glibcadj{} header files are customized to a specific machine, your program source code doesn't have to be. These @code{typedef}s are in @file{stdint.h}. @@ -105,7 +105,7 @@ of the integer. @item uintmax_t @end itemize -The GNU C library also provides macros that tell you the maximum and +@Theglibc{} also provides macros that tell you the maximum and minimum possible values for each integer data type. The macro names follow these examples: @code{INT32_MAX}, @code{UINT8_MAX}, @code{INT_FAST32_MIN}, @code{INT_LEAST64_MIN}, @code{UINTMAX_MAX}, @@ -388,7 +388,7 @@ to @end deftypefn Another set of floating-point classification functions was provided by -BSD. The GNU C library also supports these functions; however, we +BSD. @Theglibc{} also supports these functions; however, we recommend that you use the ISO C99 macros in new code. Those are standard and will be available more widely. Also, since they are macros, you do not have to worry about the type of their argument. @@ -1019,7 +1019,7 @@ Implementation defined macros with names starting with @code{FE_} and having type @code{fenv_t *}. @vindex FE_NOMASK_ENV -If possible, the GNU C Library defines a macro @code{FE_NOMASK_ENV} +If possible, @theglibc{} defines a macro @code{FE_NOMASK_ENV} which represents an environment where every exception raised causes a trap to occur. You can test for this macro using @code{#ifdef}. It is only defined if @code{_GNU_SOURCE} is defined. @@ -1813,7 +1813,7 @@ On processors which do not implement multiply-add in hardware, @file{math.h} defines the symbols @code{FP_FAST_FMA}, @code{FP_FAST_FMAF}, and @code{FP_FAST_FMAL} when the corresponding version of @code{fma} is no slower than the expression @samp{x*y + z}. -In the GNU C library, this always means the operation is implemented in +In @theglibc{}, this always means the operation is implemented in hardware. @end deftypefun @@ -2445,7 +2445,7 @@ is provided mostly for compatibility with existing code; using @code{strtod} is more robust. @end deftypefun -The GNU C library also provides @samp{_l} versions of these functions, +@Theglibc{} also provides @samp{_l} versions of these functions, which take an additional argument, the locale to use in conversion. @xref{Parsing of Integers}. @@ -2453,10 +2453,10 @@ which take an additional argument, the locale to use in conversion. @section Old-fashioned System V number-to-string functions The old @w{System V} C library provided three functions to convert -numbers to strings, with unusual and hard-to-use semantics. The GNU C -library also provides these functions and some natural extensions. +numbers to strings, with unusual and hard-to-use semantics. @Theglibc{} +also provides these functions and some natural extensions. -These functions are only available in glibc and on systems descended +These functions are only available in @theglibc{} and on systems descended from AT&T Unix. Therefore, unless these functions do precisely what you need, it is better to use @code{sprintf}, which is standard. @@ -2516,7 +2516,7 @@ If @var{ndigit} decimal digits would exceed the precision of a @code{double} it is reduced to a system-specific value. @end deftypefun -As extensions, the GNU C library provides versions of these three +As extensions, @theglibc{} provides versions of these three functions that take @code{long double} arguments. @comment stdlib.h @@ -2547,7 +2547,7 @@ restricted by the precision of a @code{long double}. @cindex gcvt_r The @code{ecvt} and @code{fcvt} functions, and their @code{long double} equivalents, all return a string located in a static buffer which is -overwritten by the next call to the function. The GNU C library +overwritten by the next call to the function. @Theglibc{} provides another set of extended functions which write the converted string into a user-supplied buffer. These have the conventional @code{_r} suffix. diff --git a/manual/charset.texi b/manual/charset.texi index d7d82ad..610db90 100644 --- a/manual/charset.texi +++ b/manual/charset.texi @@ -361,7 +361,7 @@ the @code{LC_CTYPE} category of the current locale is used; see The functions handling more than one character at a time require NUL terminated strings as the argument (i.e., converting blocks of text does not work unless one can add a NUL byte at an appropriate place). -The GNU C library contains some extensions to the standard that allow +@Theglibc{} contains some extensions to the standard that allow specifying a size, but basically they also expect terminated strings. @end itemize @@ -418,7 +418,7 @@ a compile-time constant and is defined in @file{limits.h}. maximum number of bytes in a multibyte character in the current locale. The value is never greater than @code{MB_LEN_MAX}. Unlike @code{MB_LEN_MAX} this macro need not be a compile-time constant, and in -the GNU C library it is not. +@theglibc{} it is not. @pindex stdlib.h @code{MB_CUR_MAX} is defined in @file{stdlib.h}. @@ -793,7 +793,7 @@ character sequence but the one representing the NUL wide character. Therefore, the @code{mbrlen} function will never read invalid memory. Now that this function is available (just to make this clear, this -function is @emph{not} part of the GNU C library) we can compute the +function is @emph{not} part of @theglibc{}) we can compute the number of wide character required to store the converted multibyte character string @var{s} using @@ -949,7 +949,7 @@ The functions described in the previous section only convert a single character at a time. Most operations to be performed in real-world programs include strings and therefore the @w{ISO C} standard also defines conversions on entire strings. However, the defined set of -functions is quite limited; therefore, the GNU C library contains a few +functions is quite limited; therefore, @theglibc{} contains a few extensions that can help in some important situations. @comment wchar.h @@ -1030,7 +1030,7 @@ therefore, should never be used in generally used code. The generic conversion interface (@pxref{Generic Charset Conversion}) does not have this limitation (it simply works on buffers, not -strings), and the GNU C library contains a set of functions that take +strings), and @theglibc{} contains a set of functions that take additional parameters specifying the maximal number of bytes that are consumed from the input string. This way the problem of @code{mbsrtowcs}'s example above could be solved by determining the line @@ -1528,8 +1528,8 @@ The conversion functions mentioned so far in this chapter all had in common that they operate on character sets that are not directly specified by the functions. The multibyte encoding used is specified by the currently selected locale for the @code{LC_CTYPE} category. The -wide character set is fixed by the implementation (in the case of GNU C -library it is always UCS-4 encoded @w{ISO 10646}. +wide character set is fixed by the implementation (in the case of @theglibc{} +it is always UCS-4 encoded @w{ISO 10646}. This has of course several problems when it comes to general character conversion: @@ -1648,7 +1648,7 @@ An @code{iconv} descriptor is like a file descriptor as for every use a new descriptor must be created. The descriptor does not stand for all of the conversions from @var{fromset} to @var{toset}. -The GNU C library implementation of @code{iconv_open} has one +The @glibcadj{} implementation of @code{iconv_open} has one significant extension to other implementations. To ease the extension of the set of available conversions, the implementation allows storing the necessary files with data and code in an arbitrary number of @@ -1740,7 +1740,7 @@ from the initial state. It is important that the programmer never makes any assumption as to whether the conversion has to deal with states. Even if the input and output character sets are not stateful, the implementation might still have to keep states. This is due to the -implementation chosen for the GNU C library as it is described below. +implementation chosen for @theglibc{} as it is described below. Therefore an @code{iconv} call to reset the state should always be performed if some protocol requires this for the output text. @@ -1761,7 +1761,7 @@ Since the character sets selected in the @code{iconv_open} call can be almost arbitrary, there can be situations where the input buffer contains valid characters, which have no identical representation in the output character set. The behavior in this situation is undefined. The -@emph{current} behavior of the GNU C library in this situation is to +@emph{current} behavior of @theglibc{} in this situation is to return with an error immediately. This certainly is not the most desirable solution; therefore, future versions will provide better ones, but they are not yet finished. @@ -1980,7 +1980,7 @@ the door open for extensions and improvements, but this design is also limiting on some platforms since not many platforms support dynamic loading in statically linked programs. On platforms without this capability it is therefore not possible to use this interface in -statically linked programs. The GNU C library has, on ELF platforms, no +statically linked programs. @Theglibc{} has, on ELF platforms, no problems with dynamic loading in these situations; therefore, this point is moot. The danger is that one gets acquainted with this situation and forgets about the restrictions on other systems. @@ -2054,38 +2054,38 @@ such conversion, one could make sure this also is true for indirect routes. @node glibc iconv Implementation -@subsection The @code{iconv} Implementation in the GNU C library +@subsection The @code{iconv} Implementation in @theglibc{} After reading about the problems of @code{iconv} implementations in the last section it is certainly good to note that the implementation in -the GNU C library has none of the problems mentioned above. What +@theglibc{} has none of the problems mentioned above. What follows is a step-by-step analysis of the points raised above. The evaluation is based on the current state of the development (as of January 1999). The development of the @code{iconv} functions is not complete, but basic functionality has solidified. -The GNU C library's @code{iconv} implementation uses shared loadable +@Theglibc{}'s @code{iconv} implementation uses shared loadable modules to implement the conversions. A very small number of conversions are built into the library itself but these are only rather trivial conversions. -All the benefits of loadable modules are available in the GNU C library +All the benefits of loadable modules are available in the @glibcadj{} implementation. This is especially appealing since the interface is well documented (see below), and it, therefore, is easy to write new conversion modules. The drawback of using loadable objects is not a -problem in the GNU C library, at least on ELF systems. Since the +problem in @theglibc{}, at least on ELF systems. Since the library is able to load shared objects even in statically linked binaries, static linking need not be forbidden in case one wants to use @code{iconv}. The second mentioned problem is the number of supported conversions. -Currently, the GNU C library supports more than 150 character sets. The +Currently, @theglibc{} supports more than 150 character sets. The way the implementation is designed the number of supported conversions is greater than 22350 (@math{150} times @math{149}). If any conversion from or to a character set is missing, it can be added easily. Particularly impressive as it may be, this high number is due to the -fact that the GNU C library implementation of @code{iconv} does not have +fact that the @glibcadj{} implementation of @code{iconv} does not have the third problem mentioned above (i.e., whenever there is a conversion from a character set @math{@cal{A}} to @math{@cal{B}} and from @math{@cal{B}} to @math{@cal{C}} it is always possible to convert from @@ -2115,7 +2115,7 @@ the input to @w{ISO 10646} first. The two character sets of interest are much more similar to each other than to @w{ISO 10646}. In such a situation one easily can write a new conversion and provide it -as a better alternative. The GNU C library @code{iconv} implementation +as a better alternative. The @glibcadj{} @code{iconv} implementation would automatically use the module implementing the conversion if it is specified to be more efficient. @@ -2207,7 +2207,7 @@ file, however, specifies that the new conversion modules can perform this conversion with only the cost of @math{1}. A mysterious item about the @file{gconv-modules} file above (and also -the file coming with the GNU C library) are the names of the character +the file coming with @theglibc{}) are the names of the character sets specified in the @code{module} lines. Why do almost all the names end in @code{//}? And this is not all: the names can actually be regular expressions. At this point in time this mystery should not be @@ -2423,7 +2423,7 @@ loads the objects with the conversions. It is often the case that one conversion is used more than once (i.e., there are several @code{iconv_open} calls for the same set of character sets during one program run). The @code{mbsrtowcs} et.al.@: functions in -the GNU C library also use the @code{iconv} functionality, which +@theglibc{} also use the @code{iconv} functionality, which increases the number of uses of the same functions even more. Because of this multiple use of conversions, the modules do not get @@ -2888,8 +2888,8 @@ gconv (struct __gconv_step *step, struct __gconv_step_data *data, @end deftypevr This information should be sufficient to write new modules. Anybody -doing so should also take a look at the available source code in the GNU -C library sources. It contains many examples of working and optimized +doing so should also take a look at the available source code in the +@glibcadj{} sources. It contains many examples of working and optimized modules. @c File charset.texi edited October 2001 by Dennis Grace, IBM Corporation diff --git a/manual/conf.texi b/manual/conf.texi index 30499d9..bc5b928 100644 --- a/manual/conf.texi +++ b/manual/conf.texi @@ -147,7 +147,7 @@ should always be defined even if there is no specific imposed limit. POSIX defines certain system-specific options that not all POSIX systems support. Since these options are provided in the kernel, not in the -library, simply using the GNU C library does not guarantee any of these +library, simply using @theglibc{} does not guarantee any of these features is supported; it depends on the system you are using. @pindex unistd.h @@ -190,7 +190,7 @@ to find out. @xref{Sysconf}. @comment POSIX.2 @deftypevr Macro int _POSIX2_C_DEV If this symbol is defined, it indicates that the system has the POSIX.2 -C compiler command, @code{c89}. The GNU C library always defines this +C compiler command, @code{c89}. @Theglibc{} always defines this as @code{1}, on the assumption that you would not have installed it if you didn't have a C compiler. @end deftypevr @@ -199,7 +199,7 @@ you didn't have a C compiler. @comment POSIX.2 @deftypevr Macro int _POSIX2_FORT_DEV If this symbol is defined, it indicates that the system has the POSIX.2 -Fortran compiler command, @code{fort77}. The GNU C library never +Fortran compiler command, @code{fort77}. @Theglibc{} never defines this, because we don't know what the system has. @end deftypevr @@ -207,15 +207,15 @@ defines this, because we don't know what the system has. @comment POSIX.2 @deftypevr Macro int _POSIX2_FORT_RUN If this symbol is defined, it indicates that the system has the POSIX.2 -@code{asa} command to interpret Fortran carriage control. The GNU C -library never defines this, because we don't know what the system has. +@code{asa} command to interpret Fortran carriage control. @Theglibc{} +never defines this, because we don't know what the system has. @end deftypevr @comment unistd.h @comment POSIX.2 @deftypevr Macro int _POSIX2_LOCALEDEF If this symbol is defined, it indicates that the system has the POSIX.2 -@code{localedef} command. The GNU C library never defines this, because +@code{localedef} command. @Theglibc{} never defines this, because we don't know what the system has. @end deftypevr @@ -223,7 +223,7 @@ we don't know what the system has. @comment POSIX.2 @deftypevr Macro int _POSIX2_SW_DEV If this symbol is defined, it indicates that the system has the POSIX.2 -commands @code{ar}, @code{make}, and @code{strip}. The GNU C library +commands @code{ar}, @code{make}, and @code{strip}. @Theglibc{} always defines this as @code{1}, on the assumption that you had to have @code{ar} and @code{make} to install the library, and it's unlikely that @code{strip} would be absent when those are present. @@ -728,7 +728,7 @@ utilities can handle. @item _SC_EQUIV_CLASS_MAX Inquire about the maximum number of weights that can be assigned to an entry of the @code{LC_COLLATE} category @samp{order} keyword in a locale -definition. The GNU C library does not presently support locale +definition. @Theglibc{} does not presently support locale definitions. @comment unistd.h @@ -1198,7 +1198,7 @@ that big! Use dynamic allocation (@pxref{Memory Allocation}) instead. POSIX defines certain system-specific options in the system calls for operating on files. Some systems support these options and others do not. Since these options are provided in the kernel, not in the -library, simply using the GNU C library does not guarantee that any of these +library, simply using @theglibc{} does not guarantee that any of these features is supported; it depends on the system you are using. They can also vary between file systems on a single machine. @@ -1210,11 +1210,10 @@ corresponding feature is supported. (A value of @code{-1} indicates no; any other value indicates yes.) If the macro is undefined, it means particular files may or may not support the feature. -Since all the machines that support the GNU C library also support NFS, +Since all the machines that support @theglibc{} also support NFS, one can never make a general statement about whether all file systems support the @code{_POSIX_CHOWN_RESTRICTED} and @code{_POSIX_NO_TRUNC} -features. So these names are never defined as macros in the GNU C -library. +features. So these names are never defined as macros in @theglibc{}. @comment unistd.h @comment POSIX.1 @@ -1482,7 +1481,7 @@ The POSIX.2 standard specifies certain system limits that you can access through @code{sysconf} that apply to utility behavior rather than the behavior of the library or the operating system. -The GNU C library defines macros for these limits, and @code{sysconf} +@Theglibc{} defines macros for these limits, and @code{sysconf} returns values for them if you ask; but these values convey no meaningful information. They are simply the smallest values that POSIX.2 permits. @@ -1543,7 +1542,7 @@ memory, but there is no way that the library can tell you this.) @deftypevr Macro int EQUIV_CLASS_MAX The maximum number of weights that can be assigned to an entry of the @code{LC_COLLATE} category @samp{order} keyword in a locale definition. -The GNU C library does not presently support locale definitions. +@Theglibc{} does not presently support locale definitions. @end deftypevr @node Utility Minimums @@ -1601,7 +1600,7 @@ a text line that the text utilities can handle. Its value is The most restrictive limit permitted by POSIX.2 for the maximum number of weights that can be assigned to an entry of the @code{LC_COLLATE} category @samp{order} keyword in a locale definition. Its value is -@code{2}. The GNU C library does not presently support locale +@code{2}. @Theglibc{} does not presently support locale definitions. @end table diff --git a/manual/contrib.texi b/manual/contrib.texi index 597635a..ed10656 100644 --- a/manual/contrib.texi +++ b/manual/contrib.texi @@ -1,8 +1,8 @@ @node Contributors, Free Manuals, Maintenance, Top -@c %MENU% Who wrote what parts of the GNU C library -@appendix Contributors to the GNU C Library +@c %MENU% Who wrote what parts of the GNU C Library +@appendix Contributors to @theglibc{} -The GNU C library was written originally by Roland McGrath, and is +@Theglibc{} was written originally by Roland McGrath, and is currently maintained by Ulrich Drepper. Some parts of the library were contributed or worked on by other people. @@ -93,7 +93,7 @@ Roland McGrath, based on a backend interface defined by Peter Eriksson. @item The port to Linux i386/ELF (@code{i386-@var{anything}-linux}) was contributed by Ulrich Drepper, based in large part on work done in -Hongjiu Lu's Linux version of the GNU C Library. +Hongjiu Lu's Linux version of @theglibc{}. @item The port to Linux/m68k (@code{m68k-@var{anything}-linux}) was @@ -178,7 +178,7 @@ The random number generation functions @code{random}, @code{srandom}, @code{rand} and @code{srand} functions, were written by Earl T. Cohen for the University of California at Berkeley and are copyrighted by the Regents of the University of California. They have undergone minor -changes to fit into the GNU C library and to fit the @w{ISO C} standard, +changes to fit into @theglibc{} and to fit the @w{ISO C} standard, but the functional code is Berkeley's.@refill @item diff --git a/manual/creature.texi b/manual/creature.texi index 9650156..cc09e33 100644 --- a/manual/creature.texi +++ b/manual/creature.texi @@ -1,5 +1,6 @@ @node Feature Test Macros @subsection Feature Test Macros +@include macros.texi @cindex feature test macros The exact set of features available when you compile a source file @@ -65,7 +66,7 @@ then the functionality from the 1993 edition of the POSIX.1b standard Greater values for @code{_POSIX_C_SOURCE} will enable future extensions. The POSIX standards process will define these values as necessary, and -the GNU C Library should support them some time after they become standardized. +@theglibc{} should support them some time after they become standardized. The 1996 edition of POSIX.1 (ISO/IEC 9945-1: 1996) states that if you define @code{_POSIX_C_SOURCE} to a value greater than or equal to @code{199506L}, then the functionality from the 1996 @@ -192,7 +193,7 @@ This macro was introduced as part of the Large File Support extension @comment GNU @defvr Macro _ISOC99_SOURCE Until the revised @w{ISO C} standard is widely adopted the new features -are not automatically enabled. The GNU libc nevertheless has a complete +are not automatically enabled. @Theglibc{} nevertheless has a complete implementation of the new standard and to enable the new features the macro @code{_ISOC99_SOURCE} should be defined. @end defvr @@ -227,7 +228,7 @@ get very strange errors at run time. @defvrx Macro _THREAD_SAFE If you define one of these macros, reentrant versions of several functions get declared. Some of the functions are specified in POSIX.1c but many others -are only available on a few other systems or are unique to GNU libc. +are only available on a few other systems or are unique to @theglibc{}. The problem is the delay in the standardization of the thread safe C library interface. diff --git a/manual/crypt.texi b/manual/crypt.texi index 0ea5ff8..ef90590 100644 --- a/manual/crypt.texi +++ b/manual/crypt.texi @@ -23,7 +23,7 @@ through a @dfn{one-way function}, a function which makes it difficult to work out what its input was by looking at its output, before storing in the file. -The GNU C library provides a one-way function that is compatible with +@Theglibc{} provides a one-way function that is compatible with the behavior of the @code{crypt} function introduced in FreeBSD 2.0. It supports two one-way algorithms: one based on the MD5 message-digest algorithm that is compatible with modern BSD systems, @@ -103,7 +103,7 @@ The terminal is flushed before and after @code{getpass}, so that characters of a mistyped password are not accidentally visible. In other C libraries, @code{getpass} may only return the first -@code{PASS_MAX} bytes of a password. The GNU C library has no limit, so +@code{PASS_MAX} bytes of a password. @Theglibc{} has no limit, so @code{PASS_MAX} is undefined. The prototype for this function is in @file{unistd.h}. @code{PASS_MAX} diff --git a/manual/ctype.texi b/manual/ctype.texi index b275a54..3d13571 100644 --- a/manual/ctype.texi +++ b/manual/ctype.texi @@ -273,7 +273,7 @@ The general design of the classification functions for wide characters is more general. It allows extensions to the set of available classifications, beyond those which are always available. The POSIX standard specifies how extensions can be made, and this is already -implemented in the GNU C library implementation of the @code{localedef} +implemented in the @glibcadj{} implementation of the @code{localedef} program. The character class functions are normally implemented with bitsets, @@ -589,7 +589,7 @@ iswctype (wc, wctype ("xdigit")) It is declared in @file{wctype.h}. @end deftypefun -The GNU C library also provides a function which is not defined in the +@Theglibc{} also provides a function which is not defined in the @w{ISO C} standard but which is available as a version for single byte characters as well. @@ -607,7 +607,7 @@ It is declared in @file{wchar.h}. The first note is probably not astonishing but still occasionally a cause of problems. The @code{isw@var{XXX}} functions can be implemented -using macros and in fact, the GNU C library does this. They are still +using macros and in fact, @theglibc{} does this. They are still available as real functions but when the @file{wctype.h} header is included the macros will be used. This is the same as the @code{char} type versions of these functions. diff --git a/manual/errno.texi b/manual/errno.texi index 868a28a..f155db7 100644 --- a/manual/errno.texi +++ b/manual/errno.texi @@ -6,7 +6,7 @@ @cindex error codes @cindex status codes -Many functions in the GNU C library detect and report error conditions, +Many functions in @theglibc{} detect and report error conditions, and sometimes your programs need to check for these error conditions. For example, when you open an input file, you should verify that the file was actually opened correctly, and print an error message or take @@ -67,7 +67,7 @@ function returns an error. ``modifiable lvalue'' rather than as a variable, permitting it to be implemented as a macro. For example, its expansion might involve a function call, like @w{@code{*_errno ()}}. In fact, that is what it is -on the GNU system itself. The GNU library, on non-GNU systems, does +on the GNU system itself. @Theglibc{}, on non-GNU systems, does whatever is right for the particular system. There are a few library functions, like @code{sqrt} and @code{atan}, @@ -114,8 +114,8 @@ allocated memory instead of stack memory on that system. @pindex errno.h The error code macros are defined in the header file @file{errno.h}. All of them expand into integer constant values. Some of these error -codes can't occur on the GNU system, but they can occur using the GNU -library on other systems. +codes can't occur on the GNU system, but they can occur using @theglibc{} +on other systems. @comment errno.h @comment POSIX.1: Operation not permitted @@ -419,7 +419,7 @@ not representable because of overflow or underflow. @comment errno 35 @c DO NOT REMOVE Resource temporarily unavailable; the call might work if you try again later. The macro @code{EWOULDBLOCK} is another name for @code{EAGAIN}; -they are always the same in the GNU C library. +they are always the same in @theglibc{}. This error can happen in a few different situations: @@ -452,7 +452,7 @@ and return to its command loop. @comment BSD: Operation would block @deftypevr Macro int EWOULDBLOCK @comment errno EAGAIN @c DO NOT REMOVE -In the GNU C library, this is another name for @code{EAGAIN} (above). +In @theglibc{}, this is another name for @code{EAGAIN} (above). The values are always the same, on every operating system. C libraries in many older Unix systems have @code{EWOULDBLOCK} as a @@ -1572,7 +1572,7 @@ like this: @code{error} and @code{error_at_line} are clearly the functions of choice and enable the programmer to write applications which follow the -GNU coding standard. The GNU libc additionally contains functions which +GNU coding standard. @Theglibc{} additionally contains functions which are used in BSD for the same purpose. These functions are declared in @file{err.h}. It is generally advised to not use these functions. They are included only for compatibility. diff --git a/manual/examples/README b/manual/examples/README new file mode 100644 index 0000000..7d0070f --- /dev/null +++ b/manual/examples/README @@ -0,0 +1,8 @@ +These are source files for example code that appears in The GNU C +Library Reference Manual. + +While the manual itself is licensed under the terms of the GNU Free +Documentation License, you can use these source files on their own +under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License, or (at your +option) any later version. diff --git a/manual/examples/add.c b/manual/examples/add.c index e4b1bba..d4b9af9 100644 --- a/manual/examples/add.c +++ b/manual/examples/add.c @@ -1,3 +1,20 @@ +/* Example of a Variadic Function + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdarg.h> #include <stdio.h> diff --git a/manual/examples/argp-ex1.c b/manual/examples/argp-ex1.c index 931a826..01c3639 100644 --- a/manual/examples/argp-ex1.c +++ b/manual/examples/argp-ex1.c @@ -1,4 +1,19 @@ -/* Argp example #1 -- a minimal program using argp */ +/* Argp example #1 -- a minimal program using argp + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ /* This is (probably) the smallest possible program that uses argp. It won't do much except give an error diff --git a/manual/examples/argp-ex2.c b/manual/examples/argp-ex2.c index 097ce76..0e038bb 100644 --- a/manual/examples/argp-ex2.c +++ b/manual/examples/argp-ex2.c @@ -1,4 +1,19 @@ -/* Argp example #2 -- a pretty minimal program using argp */ +/* Argp example #2 -- a pretty minimal program using argp + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ /* This program doesn't use any options or arguments, but uses argp to be compliant with the GNU standard command line diff --git a/manual/examples/argp-ex3.c b/manual/examples/argp-ex3.c index d5896ee..689d7cf 100644 --- a/manual/examples/argp-ex3.c +++ b/manual/examples/argp-ex3.c @@ -1,4 +1,19 @@ -/* Argp example #3 -- a program with options and arguments using argp */ +/* Argp example #3 -- a program with options and arguments using argp + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ /* This program uses the same features as example 2, and uses options and arguments. diff --git a/manual/examples/argp-ex4.c b/manual/examples/argp-ex4.c index 2b61358..b946dd1 100644 --- a/manual/examples/argp-ex4.c +++ b/manual/examples/argp-ex4.c @@ -1,4 +1,19 @@ -/* Argp example #4 -- a program with somewhat more complicated options */ +/* Argp example #4 -- a program with somewhat more complicated options + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ /* This program uses the same features as example 3, but has more options, and somewhat more structure in the -help output. It diff --git a/manual/examples/atexit.c b/manual/examples/atexit.c index 42bba71..5f07c87 100644 --- a/manual/examples/atexit.c +++ b/manual/examples/atexit.c @@ -1,7 +1,24 @@ +/* Cleanups on Exit + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <stdlib.h> -void +void bye (void) { puts ("Goodbye, cruel world...."); diff --git a/manual/examples/db.c b/manual/examples/db.c index 1a1cb0c..d6405e5 100644 --- a/manual/examples/db.c +++ b/manual/examples/db.c @@ -1,3 +1,20 @@ +/* User and Group Database Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <grp.h> #include <pwd.h> #include <sys/types.h> diff --git a/manual/examples/dir.c b/manual/examples/dir.c index 8ab77dc..9ca63fe 100644 --- a/manual/examples/dir.c +++ b/manual/examples/dir.c @@ -1,3 +1,20 @@ +/* Simple Program to List a Directory + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + /*@group*/ #include <stdio.h> #include <sys/types.h> diff --git a/manual/examples/dir2.c b/manual/examples/dir2.c index a75c885..7f095c8 100644 --- a/manual/examples/dir2.c +++ b/manual/examples/dir2.c @@ -1,3 +1,20 @@ +/* Simple Program to List a Directory, Mark II + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + /*@group*/ #include <stdio.h> #include <dirent.h> diff --git a/manual/examples/execinfo.c b/manual/examples/execinfo.c index 5a04901..18a3a29 100644 --- a/manual/examples/execinfo.c +++ b/manual/examples/execinfo.c @@ -1,3 +1,20 @@ +/* Obtain a backtrace and print it. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <execinfo.h> #include <stdio.h> #include <stdlib.h> diff --git a/manual/examples/filecli.c b/manual/examples/filecli.c index 9f64445..71dc461 100644 --- a/manual/examples/filecli.c +++ b/manual/examples/filecli.c @@ -1,3 +1,20 @@ +/* Example of Reading Datagrams + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <errno.h> #include <unistd.h> diff --git a/manual/examples/filesrv.c b/manual/examples/filesrv.c index 32507c6..e1f80aa 100644 --- a/manual/examples/filesrv.c +++ b/manual/examples/filesrv.c @@ -1,3 +1,20 @@ +/* Datagram Socket Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <errno.h> #include <stdlib.h> diff --git a/manual/examples/fmtmsgexpl.c b/manual/examples/fmtmsgexpl.c index 42b8bb5..fd7b16b 100644 --- a/manual/examples/fmtmsgexpl.c +++ b/manual/examples/fmtmsgexpl.c @@ -1,3 +1,20 @@ +/* How to use fmtmsg and addseverity. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <fmtmsg.h> int diff --git a/manual/examples/genpass.c b/manual/examples/genpass.c index a7626db..cb4d99f 100644 --- a/manual/examples/genpass.c +++ b/manual/examples/genpass.c @@ -1,31 +1,48 @@ +/* Encrypting Passwords + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <time.h> #include <unistd.h> #include <crypt.h> -int +int main(void) { unsigned long seed[2]; char salt[] = "$1$........"; - const char *const seedchars = + const char *const seedchars = "./0123456789ABCDEFGHIJKLMNOPQRST" "UVWXYZabcdefghijklmnopqrstuvwxyz"; char *password; int i; - - /* Generate a (not very) random seed. + + /* Generate a (not very) random seed. You should do it better than this... */ seed[0] = time(NULL); seed[1] = getpid() ^ (seed[0] >> 14 & 0x30000); - + /* Turn it into printable characters from `seedchars'. */ for (i = 0; i < 8; i++) salt[3+i] = seedchars[(seed[i/5] >> (i%5)*6) & 0x3f]; - + /* Read in the user's password and encrypt it. */ password = crypt(getpass("Password:"), salt); - + /* Print the results. */ puts(password); return 0; diff --git a/manual/examples/inetcli.c b/manual/examples/inetcli.c index 35dfb37..afd4a91 100644 --- a/manual/examples/inetcli.c +++ b/manual/examples/inetcli.c @@ -1,3 +1,20 @@ +/* Byte Stream Socket Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <errno.h> #include <stdlib.h> @@ -11,7 +28,7 @@ #define MESSAGE "Yow!!! Are we having fun yet?!?" #define SERVERHOST "mescaline.gnu.org" -void +void write_to_server (int filedes) { int nbytes; diff --git a/manual/examples/inetsrv.c b/manual/examples/inetsrv.c index 3d544c0..d245f0d 100644 --- a/manual/examples/inetsrv.c +++ b/manual/examples/inetsrv.c @@ -1,3 +1,20 @@ +/* Byte Stream Connection Server Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <errno.h> #include <stdlib.h> diff --git a/manual/examples/isockad.c b/manual/examples/isockad.c index 9c21149..b7c73a7 100644 --- a/manual/examples/isockad.c +++ b/manual/examples/isockad.c @@ -1,10 +1,27 @@ +/* Internet Socket Example using sockaddr_in. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> -void +void init_sockaddr (struct sockaddr_in *name, const char *hostname, uint16_t port) @@ -14,7 +31,7 @@ init_sockaddr (struct sockaddr_in *name, name->sin_family = AF_INET; name->sin_port = htons (port); hostinfo = gethostbyname (hostname); - if (hostinfo == NULL) + if (hostinfo == NULL) { fprintf (stderr, "Unknown host %s.\n", hostname); exit (EXIT_FAILURE); diff --git a/manual/examples/longopt.c b/manual/examples/longopt.c index 989e887..6e7d4d9 100644 --- a/manual/examples/longopt.c +++ b/manual/examples/longopt.c @@ -1,3 +1,20 @@ +/* Example of Parsing Long Options with getopt_long. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <stdlib.h> #include <getopt.h> diff --git a/manual/examples/memopen.c b/manual/examples/memopen.c index 682830f..3fa29d5 100644 --- a/manual/examples/memopen.c +++ b/manual/examples/memopen.c @@ -1,3 +1,20 @@ +/* String Streams + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> static char buffer[] = "foobar"; diff --git a/manual/examples/memstrm.c b/manual/examples/memstrm.c index 1674c36..be83660 100644 --- a/manual/examples/memstrm.c +++ b/manual/examples/memstrm.c @@ -1,3 +1,20 @@ +/* open_memstream example. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> int diff --git a/manual/examples/mkfsock.c b/manual/examples/mkfsock.c index 615ecd8..e5c3b28 100644 --- a/manual/examples/mkfsock.c +++ b/manual/examples/mkfsock.c @@ -1,3 +1,20 @@ +/* Example of Local-Namespace Sockets + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stddef.h> #include <stdio.h> #include <errno.h> diff --git a/manual/examples/mkisock.c b/manual/examples/mkisock.c index 2fd8b3d..68cf348 100644 --- a/manual/examples/mkisock.c +++ b/manual/examples/mkisock.c @@ -1,9 +1,26 @@ +/* Internet Socket Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> -int +int make_socket (uint16_t port) { int sock; diff --git a/manual/examples/mygetpass.c b/manual/examples/mygetpass.c index 6fe06f4..a927a13 100644 --- a/manual/examples/mygetpass.c +++ b/manual/examples/mygetpass.c @@ -1,3 +1,20 @@ +/* Reading Passwords + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <termios.h> #include <stdio.h> @@ -14,12 +31,12 @@ my_getpass (char **lineptr, size_t *n, FILE *stream) new.c_lflag &= ~ECHO; if (tcsetattr (fileno (stream), TCSAFLUSH, &new) != 0) return -1; - + /* Read the password. */ nread = getline (lineptr, n, stream); /* Restore terminal. */ (void) tcsetattr (fileno (stream), TCSAFLUSH, &old); - + return nread; } diff --git a/manual/examples/pipe.c b/manual/examples/pipe.c index 92d339a..b03c90f 100644 --- a/manual/examples/pipe.c +++ b/manual/examples/pipe.c @@ -1,3 +1,20 @@ +/* Creating a Pipe + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <sys/types.h> #include <unistd.h> #include <stdio.h> diff --git a/manual/examples/popen.c b/manual/examples/popen.c index 1b9ee82..6716dc2 100644 --- a/manual/examples/popen.c +++ b/manual/examples/popen.c @@ -1,3 +1,20 @@ +/* Pipe to a Subprocess + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <stdlib.h> diff --git a/manual/examples/rprintf.c b/manual/examples/rprintf.c index 2b8f6bf..14de9d2 100644 --- a/manual/examples/rprintf.c +++ b/manual/examples/rprintf.c @@ -1,3 +1,20 @@ +/* Printf Extension Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <stdlib.h> #include <printf.h> diff --git a/manual/examples/search.c b/manual/examples/search.c index 182e6e4..e376567 100644 --- a/manual/examples/search.c +++ b/manual/examples/search.c @@ -1,3 +1,20 @@ +/* Searching and Sorting Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -35,7 +52,7 @@ int count = sizeof (muppets) / sizeof (struct critter); /* This is the comparison function used for sorting and searching. */ -int +int critter_cmp (const struct critter *c1, const struct critter *c2) { return strcmp (c1->name, c2->name); @@ -44,7 +61,7 @@ critter_cmp (const struct critter *c1, const struct critter *c2) /* Print information about a critter. */ -void +void print_critter (const struct critter *c) { printf ("%s, the %s\n", c->name, c->species); @@ -54,7 +71,7 @@ print_critter (const struct critter *c) /*@group*/ /* Do the lookup into the sorted array. */ -void +void find_critter (const char *name) { struct critter target, *result; diff --git a/manual/examples/select.c b/manual/examples/select.c index a65ed77..6351630 100644 --- a/manual/examples/select.c +++ b/manual/examples/select.c @@ -1,3 +1,20 @@ +/* Waiting for Input or Output + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + /*@group*/ #include <errno.h> #include <stdio.h> diff --git a/manual/examples/setjmp.c b/manual/examples/setjmp.c index 023339c..ffd7744 100644 --- a/manual/examples/setjmp.c +++ b/manual/examples/setjmp.c @@ -1,10 +1,27 @@ +/* Introduction to Non-Local Exits + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <setjmp.h> #include <stdlib.h> #include <stdio.h> jmp_buf main_loop; -void +void abort_to_main_loop (int status) { longjmp (main_loop, status); @@ -21,7 +38,7 @@ main (void) } -void +void do_command (void) { char buffer[128]; diff --git a/manual/examples/sigh1.c b/manual/examples/sigh1.c index 2c6e95b..d05afd9 100644 --- a/manual/examples/sigh1.c +++ b/manual/examples/sigh1.c @@ -1,3 +1,20 @@ +/* Signal Handlers that Return + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -6,14 +23,14 @@ volatile sig_atomic_t keep_going = 1; /* The signal handler just clears the flag and re-enables itself. */ -void +void catch_alarm (int sig) { keep_going = 0; signal (sig, catch_alarm); } -void +void do_stuff (void) { puts ("Doing stuff while waiting for alarm...."); diff --git a/manual/examples/sigusr.c b/manual/examples/sigusr.c index 11e3cee..5bfbc80 100644 --- a/manual/examples/sigusr.c +++ b/manual/examples/sigusr.c @@ -1,3 +1,20 @@ +/* Using kill for Communication + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + /*@group*/ #include <signal.h> #include <stdio.h> @@ -8,14 +25,14 @@ /* When a @code{SIGUSR1} signal arrives, set this variable. */ volatile sig_atomic_t usr_interrupt = 0; -void +void synch_signal (int sig) { usr_interrupt = 1; } /* The child process executes this function. */ -void +void child_function (void) { /* Perform initialization. */ diff --git a/manual/examples/stpcpy.c b/manual/examples/stpcpy.c index b832263..f94cb63 100644 --- a/manual/examples/stpcpy.c +++ b/manual/examples/stpcpy.c @@ -1,3 +1,20 @@ +/* stpcpy example. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <string.h> #include <stdio.h> diff --git a/manual/examples/strdupa.c b/manual/examples/strdupa.c index 7d6ef39..f01e115 100644 --- a/manual/examples/strdupa.c +++ b/manual/examples/strdupa.c @@ -1,3 +1,20 @@ +/* strdupa example. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <paths.h> #include <string.h> #include <stdio.h> diff --git a/manual/examples/strftim.c b/manual/examples/strftim.c index 7f95ef0..9342817 100644 --- a/manual/examples/strftim.c +++ b/manual/examples/strftim.c @@ -1,3 +1,20 @@ +/* Time Functions Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <time.h> #include <stdio.h> diff --git a/manual/examples/strncat.c b/manual/examples/strncat.c index 948d662..fb7b707 100644 --- a/manual/examples/strncat.c +++ b/manual/examples/strncat.c @@ -1,3 +1,20 @@ +/* strncat example. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <string.h> #include <stdio.h> diff --git a/manual/examples/subopt.c b/manual/examples/subopt.c index a87bee1..ecf75f9 100644 --- a/manual/examples/subopt.c +++ b/manual/examples/subopt.c @@ -1,3 +1,20 @@ +/* Parsing of Suboptions Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <stdlib.h> #include <unistd.h> diff --git a/manual/examples/swapcontext.c b/manual/examples/swapcontext.c index f733510..c993d14 100644 --- a/manual/examples/swapcontext.c +++ b/manual/examples/swapcontext.c @@ -1,3 +1,20 @@ +/* Complete Context Control + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <signal.h> #include <stdio.h> #include <stdlib.h> diff --git a/manual/examples/termios.c b/manual/examples/termios.c index 6db5990..40d4325 100644 --- a/manual/examples/termios.c +++ b/manual/examples/termios.c @@ -1,3 +1,20 @@ +/* Noncanonical Mode Example + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <unistd.h> #include <stdio.h> #include <stdlib.h> @@ -7,13 +24,13 @@ struct termios saved_attributes; -void +void reset_input_mode (void) { tcsetattr (STDIN_FILENO, TCSANOW, &saved_attributes); } -void +void set_input_mode (void) { struct termios tattr; diff --git a/manual/examples/testopt.c b/manual/examples/testopt.c index 44ca8e4..081742d 100644 --- a/manual/examples/testopt.c +++ b/manual/examples/testopt.c @@ -1,3 +1,20 @@ +/* Example of Parsing Arguments with getopt. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + /*@group*/ #include <ctype.h> #include <stdio.h> diff --git a/manual/examples/testpass.c b/manual/examples/testpass.c index 5bd616d..4e05a90 100644 --- a/manual/examples/testpass.c +++ b/manual/examples/testpass.c @@ -1,9 +1,26 @@ +/* Verify a password. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdio.h> #include <string.h> #include <unistd.h> #include <crypt.h> -int +int main(void) { /* Hashed form of "GNU libc manual". */ @@ -11,7 +28,7 @@ main(void) char *result; int ok; - + /*@group*/ /* Read in the user's password and encrypt it, passing the expected password in as the salt. */ diff --git a/manual/examples/timeval_subtract.c b/manual/examples/timeval_subtract.c new file mode 100644 index 0000000..f0f2375 --- /dev/null +++ b/manual/examples/timeval_subtract.c @@ -0,0 +1,45 @@ +/* struct timeval subtraction. + Copyright (C) 1991-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, if not, see <http://www.gnu.org/licenses/>. +*/ + +/* Subtract the `struct timeval' values X and Y, + storing the result in RESULT. + Return 1 if the difference is negative, otherwise 0. */ + +int +timeval_subtract (result, x, y) + struct timeval *result, *x, *y; +{ + /* Perform the carry for the later subtraction by updating @var{y}. */ + if (x->tv_usec < y->tv_usec) { + int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; + y->tv_usec -= 1000000 * nsec; + y->tv_sec += nsec; + } + if (x->tv_usec - y->tv_usec > 1000000) { + int nsec = (x->tv_usec - y->tv_usec) / 1000000; + y->tv_usec += 1000000 * nsec; + y->tv_sec -= nsec; + } + + /* Compute the time remaining to wait. + @code{tv_usec} is certainly positive. */ + result->tv_sec = x->tv_sec - y->tv_sec; + result->tv_usec = x->tv_usec - y->tv_usec; + + /* Return 1 if result is negative. */ + return x->tv_sec < y->tv_sec; +} diff --git a/manual/filesys.texi b/manual/filesys.texi index 049e7e0..872e371 100644 --- a/manual/filesys.texi +++ b/manual/filesys.texi @@ -2,7 +2,7 @@ @c %MENU% Functions for manipulating files @chapter File System Interface -This chapter describes the GNU C library's functions for manipulating +This chapter describes @theglibc{}'s functions for manipulating files. Unlike the input and output functions (@pxref{I/O on Streams}; @pxref{Low-Level I/O}), these functions are concerned with operating on the files themselves rather than on their contents. @@ -63,7 +63,7 @@ the current working directory, storing it in the character array @var{buffer} that you provide. The @var{size} argument is how you tell the system the allocation size of @var{buffer}. -The GNU library version of this function also permits you to specify a +The @glibcadj{} version of this function also permits you to specify a null pointer for the @var{buffer} argument. Then @code{getcwd} allocates a buffer automatically, as with @code{malloc} (@pxref{Unconstrained Allocation}). If the @var{size} is greater than @@ -117,7 +117,7 @@ software. @comment BSD @deftypefn {Deprecated Function} {char *} getwd (char *@var{buffer}) This is similar to @code{getcwd}, but has no way to specify the size of -the buffer. The GNU library provides @code{getwd} only +the buffer. @Theglibc{} provides @code{getwd} only for backwards compatibility with BSD. The @var{buffer} argument should be a pointer to an array at least @@ -413,7 +413,7 @@ descriptor which is created by the @code{opendir} call. For instance, to switch the current working directory to the directory just read the @code{fchdir} function could be used. Historically the @code{DIR} type was exposed and programs could access the fields. This does not happen -in the GNU C library. Instead a separate function is provided to allow +in @theglibc{}. Instead a separate function is provided to allow access. @comment dirent.h @@ -634,7 +634,7 @@ the global variable @code{errno} contains more information on the error. As described above the fourth argument to the @code{scandir} function must be a pointer to a sorting function. For the convenience of the -programmer the GNU C library contains implementations of functions which +programmer @theglibc{} contains implementations of functions which are very helpful for this purpose. @comment dirent.h @@ -1770,17 +1770,18 @@ Here is a list of them. @comment sys/types.h @comment POSIX.1 @deftp {Data Type} mode_t -This is an integer data type used to represent file modes. In the -GNU system, this is equivalent to @code{unsigned int}. +This is an integer data type used to represent file modes. In +@theglibc{}, this is an unsigned type no narrower than @code{unsigned +int}. @end deftp @cindex inode number @comment sys/types.h @comment POSIX.1 @deftp {Data Type} ino_t -This is an arithmetic data type used to represent file serial numbers. +This is an unsigned integer type used to represent file serial numbers. (In Unix jargon, these are sometimes called @dfn{inode numbers}.) -In the GNU system, this type is equivalent to @code{unsigned long int}. +In @theglibc{}, this type is no narrower than @code{unsigned int}. If the source is compiled with @code{_FILE_OFFSET_BITS == 64} this type is transparently replaced by @code{ino64_t}. @@ -1789,9 +1790,9 @@ is transparently replaced by @code{ino64_t}. @comment sys/types.h @comment Unix98 @deftp {Data Type} ino64_t -This is an arithmetic data type used to represent file serial numbers -for the use in LFS. In the GNU system, this type is equivalent to -@code{unsigned long long int}. +This is an unsigned integer type used to represent file serial numbers +for the use in LFS. In @theglibc{}, this type is no narrower than +@code{unsigned int}. When compiling with @code{_FILE_OFFSET_BITS == 64} this type is available under the name @code{ino_t}. @@ -1801,21 +1802,20 @@ available under the name @code{ino_t}. @comment POSIX.1 @deftp {Data Type} dev_t This is an arithmetic data type used to represent file device numbers. -In the GNU system, this is equivalent to @code{int}. +In @theglibc{}, this is an integer type no narrower than @code{int}. @end deftp @comment sys/types.h @comment POSIX.1 @deftp {Data Type} nlink_t -This is an arithmetic data type used to represent file link counts. -In the GNU system, this is equivalent to @code{unsigned short int}. +This is an integer type used to represent file link counts. @end deftp @comment sys/types.h @comment Unix98 @deftp {Data Type} blkcnt_t -This is an arithmetic data type used to represent block counts. -In the GNU system, this is equivalent to @code{unsigned long int}. +This is a signed integer type used to represent block counts. +In @theglibc{}, this type is no narrower than @code{int}. If the source is compiled with @code{_FILE_OFFSET_BITS == 64} this type is transparently replaced by @code{blkcnt64_t}. @@ -1824,9 +1824,8 @@ is transparently replaced by @code{blkcnt64_t}. @comment sys/types.h @comment Unix98 @deftp {Data Type} blkcnt64_t -This is an arithmetic data type used to represent block counts for the -use in LFS. In the GNU system, this is equivalent to @code{unsigned -long long int}. +This is a signed integer type used to represent block counts for the +use in LFS. In @theglibc{}, this type is no narrower than @code{int}. When compiling with @code{_FILE_OFFSET_BITS == 64} this type is available under the name @code{blkcnt_t}. @@ -3035,7 +3034,7 @@ set the real size of the file. @cindex special files The @code{mknod} function is the primitive for making special files, -such as files that correspond to devices. The GNU library includes +such as files that correspond to devices. @Theglibc{} includes this function for compatibility with BSD. The prototype for @code{mknod} is declared in @file{sys/stat.h}. @@ -3176,7 +3175,7 @@ you can create with @code{tmpnam}. You can rely on being able to call @code{tmpnam} at least this many times before it might fail saying you have made too many temporary file names. -With the GNU library, you can create a very large number of temporary +With @theglibc{}, you can create a very large number of temporary file names. If you actually created the files, you would probably run out of disk space before you ran out of names. Some other systems have a fixed, small limit on the number of temporary files. The limit is diff --git a/manual/header.texi b/manual/header.texi index 7a4cb05..2a551cd 100644 --- a/manual/header.texi +++ b/manual/header.texi @@ -3,7 +3,7 @@ @appendix Summary of Library Facilities This appendix is a complete list of the facilities declared within the -header files supplied with the GNU C library. Each entry also lists the +header files supplied with @theglibc{}. Each entry also lists the standard or other source from which each facility is derived, and tells you where in the manual you can find more information about how to use it. diff --git a/manual/install.texi b/manual/install.texi index a525cf0..03cab71 100644 --- a/manual/install.texi +++ b/manual/install.texi @@ -1,17 +1,18 @@ @c This is for making the `INSTALL' file for the distribution. @c Makeinfo ignores it when processing the file from the include. @setfilename INSTALL +@include macros.texi @node Installation, Maintenance, Library Summary, Top -@c %MENU% How to install the GNU C library -@appendix Installing the GNU C Library +@c %MENU% How to install the GNU C Library +@appendix Installing @theglibc{} Before you do anything else, you should read the file @file{FAQ} located at the top level of the source tree. This file answers common questions and describes problems you may experience with compilation and installation. It is updated more frequently than this manual. -Features can be added to GNU Libc via @dfn{add-on} bundles. These are +Features can be added to @theglibc{} via @dfn{add-on} bundles. These are separate tar files, which you unpack into the top level of the source tree. Then you give @code{configure} the @samp{--enable-add-ons} option to activate them, and they will be compiled into the library. @@ -29,13 +30,14 @@ GNU Make, and possibly others. @xref{Tools for Compilation}, below. @end menu @node Configuring and compiling -@appendixsec Configuring and compiling GNU Libc +@appendixsec Configuring and compiling @theglibc{} @cindex configuring @cindex compiling -GNU libc cannot be compiled in the source directory. You must build +@Theglibc{} cannot be compiled in the source directory. You must build it in a separate build directory. For example, if you have unpacked -the glibc sources in @file{/src/gnu/glibc-@var{version}}, create a directory +the @glibcadj{} sources in @file{/src/gnu/glibc-@var{version}}, +create a directory @file{/src/gnu/glibc-build} to put the object files in. This allows removing the whole build directory in case an error occurs, which is the safest way to get a fresh start and should always be done. @@ -54,7 +56,7 @@ directory, especially some files in the manual subdirectory. @noindent @code{configure} takes many options, but the only one that is usually mandatory is @samp{--prefix}. This option tells @code{configure} -where you want glibc installed. This defaults to @file{/usr/local}, +where you want @theglibc{} installed. This defaults to @file{/usr/local}, but the normal setting to install as the standard system library is @samp{--prefix=/usr} for GNU/Linux systems and @samp{--prefix=} (an empty prefix) for GNU/Hurd systems. @@ -79,15 +81,15 @@ directory if that option is specified, or @file{/usr/local} otherwise. @item --with-headers=@var{directory} Look for kernel header files in @var{directory}, not -@file{/usr/include}. Glibc needs information from the kernel's header -files describing the interface to the kernel. Glibc will normally +@file{/usr/include}. @Theglibc{} needs information from the kernel's header +files describing the interface to the kernel. @Theglibc{} will normally look in @file{/usr/include} for them, but if you specify this option, it will look in @var{DIRECTORY} instead. This option is primarily of use on a system where the headers in -@file{/usr/include} come from an older version of glibc. Conflicts can +@file{/usr/include} come from an older version of @theglibc{}. Conflicts can occasionally happen in this case. You can also use this option if you want to -compile glibc with a newer set of kernel headers than the ones found in +compile @theglibc{} with a newer set of kernel headers than the ones found in @file{/usr/include}. @item --enable-add-ons[=@var{list}] @@ -112,7 +114,7 @@ compatibility code is added, and the faster the code gets. Use the binutils (assembler and linker) in @file{@var{directory}}, not the ones the C compiler would default to. You can use this option if the default binutils on your system cannot deal with all the constructs -in the GNU C library. In that case, @code{configure} will detect the +in @theglibc{}. In that case, @code{configure} will detect the problem and suppress these constructs, so that the library will still be usable, but functionality may be lost---for example, you can't build a shared libc with old binutils. @@ -156,7 +158,7 @@ compatibility problems. @itemx --host=@var{host-system} These options are for cross-compiling. If you specify both options and @var{build-system} is different from @var{host-system}, @code{configure} -will prepare to cross-compile glibc from @var{build-system} to be used +will prepare to cross-compile @theglibc{} from @var{build-system} to be used on @var{host-system}. You'll probably need the @samp{--with-headers} option too, and you may have to override @var{configure}'s selection of the compiler and/or binutils. @@ -193,7 +195,7 @@ successfully, do not use the built library, and report a bug after verifying that the problem is not already known. @xref{Reporting Bugs}, for instructions on reporting bugs. Note that some of the tests assume they are not being run by @code{root}. We recommend you compile and -test glibc as an unprivileged user. +test @theglibc{} as an unprivileged user. Before reporting bugs make sure there is no problem with your system. The tests (and later installation) use some pre-existing files of the @@ -213,7 +215,7 @@ the file @file{configparms}. To change them, create a for your system. The file is included and parsed by @code{make} and has to follow the conventions for makefiles. -It is easy to configure the GNU C library for cross-compilation by +It is easy to configure @theglibc{} for cross-compilation by setting a few variables in @file{configparms}. Set @code{CC} to the cross-compiler for the target you configured the library for; it is important to use this same @code{CC} value when running @@ -232,13 +234,14 @@ object files for the target you configured for. To install the library and its header files, and the Info files of the manual, type @code{env LANGUAGE=C LC_ALL=C make install}. This will build things, if necessary, before installing them; however, you should -still compile everything first. If you are installing glibc as your +still compile everything first. If you are installing @theglibc{} as your primary C library, we recommend that you shut the system down to single-user mode first, and reboot afterward. This minimizes the risk of breaking things when the library changes out from underneath. @samp{make install} will do the entire job of upgrading from a -previous installation of glibc 2.x. There may sometimes be headers +previous installation of @theglibc{} version 2.x. There may sometimes +be headers left behind from the previous installation, but those are generally harmless. If you want to avoid leaving headers behind you can do things in the following order. @@ -252,17 +255,17 @@ library requires the ability to compile and run programs against the old library. The new @file{/usr/include}, after switching the include directories and before installing the library should contain the Linux headers, but nothing else. If you do this, you will need to restore -any headers from non-glibc libraries youself after installing the +any headers from libraries other than @theglibc{} yourself after installing the library. -You can install glibc somewhere other than where you configured it to go +You can install @theglibc{} somewhere other than where you configured it to go by setting the @code{install_root} variable on the command line for @samp{make install}. The value of this variable is prepended to all the paths for installation. This is useful when setting up a chroot environment or preparing a binary distribution. The directory should be specified with an absolute file name. -Glibc includes a daemon called @code{nscd}, which you +@Theglibc{} includes a daemon called @code{nscd}, which you may or may not want to run. @code{nscd} caches name service lookups; it can dramatically improve performance with NIS+, and may help with DNS as well. @@ -278,11 +281,11 @@ providing pty slaves, you don't need this program; otherwise you do. The source for @file{pt_chown} is in @file{login/programs/pt_chown.c}. After installation you might want to configure the timezone and locale -installation of your system. The GNU C library comes with a locale +installation of your system. @Theglibc{} comes with a locale database which gets configured with @code{localedef}. For example, to set up a German locale with name @code{de_DE}, simply issue the command @samp{localedef -i de_DE -f ISO-8859-1 de_DE}. To configure all locales -that are supported by glibc, you can issue from your build directory the +that are supported by @theglibc{}, you can issue from your build directory the command @samp{make localedata/install-locales}. To configure the locally used timezone, set the @code{TZ} environment @@ -300,14 +303,14 @@ timezone file which is in @file{/usr/share/zoneinfo} to the file @cindex tools, for installing library We recommend installing the following GNU tools before attempting to -build the GNU C library: +build @theglibc{}: @itemize @bullet @item GNU @code{make} 3.79 or newer -You need the latest version of GNU @code{make}. Modifying the GNU C -Library to work with other @code{make} programs would be so difficult that +You need the latest version of GNU @code{make}. Modifying @theglibc{} +to work with other @code{make} programs would be so difficult that we recommend you port GNU @code{make} instead. @strong{Really.} We recommend GNU @code{make} version 3.79. All earlier versions have severe bugs or lack features. @@ -316,17 +319,17 @@ bugs or lack features. GCC 4.3 or newer, GCC 4.6 recommended GCC 4.3 or higher is required; as of this writing, GCC 4.6 is the -compiler we advise to use to build the GNU C library. +compiler we advise to use to build @theglibc{}. -You can use whatever compiler you like to compile programs that use GNU -libc. +You can use whatever compiler you like to compile programs that use +@theglibc{}. Check the FAQ for any special compiler issues on particular platforms. @item -GNU @code{binutils} 2.15 or later +GNU @code{binutils} 2.20 or later -You must use GNU @code{binutils} (as and ld) to build the GNU C library. +You must use GNU @code{binutils} (as and ld) to build @theglibc{}. No other assembler or linker has the necessary functionality at the moment. @@ -386,41 +389,41 @@ patches, although we try to avoid this. @appendixsec Specific advice for GNU/Linux systems @cindex kernel header files -If you are installing GNU libc on a GNU/Linux system, you need to have +If you are installing @theglibc{} on a GNU/Linux system, you need to have the header files from a 2.6.19.1 or newer kernel around for reference. These headers must be installed using @samp{make headers_install}; the headers present in the kernel source directory are not suitable for -direct use by GNU libc. You do not need to use that kernel, just have -its headers installed where glibc can access them, referred to here as +direct use by @theglibc{}. You do not need to use that kernel, just have +its headers installed where @theglibc{} can access them, referred to here as @var{install-directory}. The easiest way to do this is to unpack it in a directory such as @file{/usr/src/linux-@var{version}}. In that directory, run @samp{make headers_install -INSTALL_HDR_PATH=@var{install-directory}}. Finally, configure glibc +INSTALL_HDR_PATH=@var{install-directory}}. Finally, configure @theglibc{} with the option @samp{--with-headers=@var{install-directory}/include}. Use the most recent kernel you can get your hands on. (If you are -cross-compiling GNU libc, you need to specify +cross-compiling @theglibc{}, you need to specify @samp{ARCH=@var{architecture}} in the @samp{make headers_install} command, where @var{architecture} is the architecture name used by the Linux kernel, such as @samp{x86} or @samp{powerpc}.) -After installing GNU libc, you may need to remove or rename +After installing @theglibc{}, you may need to remove or rename directories such as @file{/usr/include/linux} and @file{/usr/include/asm}, and replace them with copies of directories such as @file{linux} and @file{asm} from @file{@var{install-directory}/include}. All directories present in @file{@var{install-directory}/include} should be copied, except that -GNU libc provides its own version of @file{/usr/include/scsi}; the +@theglibc{} provides its own version of @file{/usr/include/scsi}; the files provided by the kernel should be copied without replacing those -provided by GNU libc. The @file{linux}, @file{asm} and +provided by @theglibc{}. The @file{linux}, @file{asm} and @file{asm-generic} directories are required to compile programs using -GNU libc; the other directories describe interfaces to the kernel but +@theglibc{}; the other directories describe interfaces to the kernel but are not required if not compiling programs using those interfaces. You do not need to copy kernel headers if you did not specify an alternate kernel header source using @samp{--with-headers}. -GNU/Linux expects some components of the libc installation to be in +GNU/Linux expects some components of the @glibcadj{} installation to be in @file{/lib} and some in @file{/usr/lib}. This is handled automatically -if you configure glibc with @samp{--prefix=/usr}. If you set some other +if you configure @theglibc{} with @samp{--prefix=/usr}. If you set some other prefix or allow it to default to @file{/usr/local}, then all the components are installed there. @@ -434,7 +437,7 @@ program. @cindex reporting bugs @cindex bugs, reporting -There are probably bugs in the GNU C library. There are certainly +There are probably bugs in @theglibc{}. There are certainly errors and omissions in this manual. If you report them, they will get fixed. If you don't, no one will ever know about them and they will remain unfixed for all eternity, if not longer. @@ -449,14 +452,14 @@ normally includes a patch or a hint on solving the problem. To report a bug, first you must find it. With any luck, this will be the hard part. Once you've found a bug, make sure it's really a bug. A -good way to do this is to see if the GNU C library behaves the same way +good way to do this is to see if @theglibc{} behaves the same way some other C library does. If so, probably you are wrong and the libraries are right (but not necessarily). If not, one of the libraries -is probably wrong. It might not be the GNU library. Many historical +is probably wrong. It might not be @theglibc{}. Many historical Unix C libraries permit things that we don't, such as closing a file twice. -If you think you have found some way in which the GNU C library does not +If you think you have found some way in which @theglibc{} does not conform to the ISO and POSIX standards (@pxref{Standards and Portability}), that is definitely a bug. Report it! diff --git a/manual/intro.texi b/manual/intro.texi index d97e262..bfe30d7 100644 --- a/manual/intro.texi +++ b/manual/intro.texi @@ -9,13 +9,13 @@ in a standard @dfn{library}, which you compile and link with your programs. @cindex library -The GNU C library, described in this document, defines all of the +@Theglibc{}, described in this document, defines all of the library functions that are specified by the @w{ISO C} standard, as well as additional features specific to POSIX and other derivatives of the Unix operating system, and extensions specific to the GNU system. The purpose of this manual is to tell you how to use the facilities -of the GNU library. We have mentioned which features belong to which +of @theglibc{}. We have mentioned which features belong to which standards to help you identify things that are potentially non-portable to other systems. But the emphasis in this manual is not on strict portability. @@ -38,7 +38,7 @@ concepts. Specifically, familiarity with ISO standard C (@pxref{ISO C}), rather than ``traditional'' pre-ISO C dialects, is assumed. -The GNU C library includes several @dfn{header files}, each of which +@Theglibc{} includes several @dfn{header files}, each of which provides definitions and declarations for a group of related facilities; this information is used by the C compiler when processing your program. For example, the header file @file{stdio.h} declares facilities for @@ -48,7 +48,7 @@ generally follows the same division as the header files. If you are reading this manual for the first time, you should read all of the introductory material and skim the remaining chapters. There are -a @emph{lot} of functions in the GNU C library and it's not realistic to +a @emph{lot} of functions in @theglibc{} and it's not realistic to expect that you will be able to remember exactly @emph{how} to use each and every one of them. It's more important to become generally familiar with the kinds of facilities that the library provides, so that when you @@ -61,12 +61,12 @@ specific information about them. @section Standards and Portability @cindex standards -This section discusses the various standards and other sources that the -GNU C library is based upon. These sources include the @w{ISO C} and +This section discusses the various standards and other sources that @theglibc{} +is based upon. These sources include the @w{ISO C} and POSIX standards, and the System V and Berkeley Unix implementations. The primary focus of this manual is to tell you how to make effective -use of the GNU library facilities. But if you are concerned about +use of the @glibcadj{} facilities. But if you are concerned about making your programs compatible with these standards, or portable to operating systems other than GNU, this can affect how you use the library. This section gives you an overview of these standards, so that @@ -91,14 +91,14 @@ standards each function or symbol comes from. @subsection ISO C @cindex ISO C -The GNU C library is compatible with the C standard adopted by the +@Theglibc{} is compatible with the C standard adopted by the American National Standards Institute (ANSI): @cite{American National Standard X3.159-1989---``ANSI C''} and later by the International Standardization Organization (ISO): @cite{ISO/IEC 9899:1990, ``Programming languages---C''}. We here refer to the standard as @w{ISO C} since this is the more general standard in respect of ratification. -The header files and library facilities that make up the GNU library are +The header files and library facilities that make up @theglibc{} are a superset of those specified by the @w{ISO C} standard.@refill @pindex gcc @@ -131,7 +131,7 @@ not aim for completeness. @cindex IEEE Std 1003.2 @cindex ISO/IEC 9945-2 -The GNU library is also compatible with the ISO @dfn{POSIX} family of +@Theglibc{} is also compatible with the ISO @dfn{POSIX} family of standards, known more formally as the @dfn{Portable Operating System Interface for Computer Environments} (ISO/IEC 9945). They were also published as ANSI/IEEE Std 1003. POSIX is derived mostly from various @@ -146,7 +146,7 @@ particular kind of operating system environment, rather than general programming language support which can run in many diverse operating system environments.@refill -The GNU C library implements all of the functions specified in +@Theglibc{} implements all of the functions specified in @cite{ISO/IEC 9945-1:1996, the POSIX System Application Program Interface}, commonly referred to as POSIX.1. The primary extensions to the @w{ISO C} facilities specified by this standard include file system @@ -155,7 +155,7 @@ terminal control functions (@pxref{Low-Level Terminal Interface}), and process control functions (@pxref{Processes}). Some facilities from @cite{ISO/IEC 9945-2:1993, the POSIX Shell and -Utilities standard} (POSIX.2) are also implemented in the GNU library. +Utilities standard} (POSIX.2) are also implemented in @theglibc{}. These include utilities for dealing with regular expressions and other pattern matching facilities (@pxref{Pattern Matching}). @@ -181,7 +181,7 @@ pattern matching facilities (@pxref{Pattern Matching}). @cindex SunOS @cindex Unix, Berkeley -The GNU C library defines facilities from some versions of Unix which +@Theglibc{} defines facilities from some versions of Unix which are not formally standardized, specifically from the 4.2 BSD, 4.3 BSD, and 4.4 BSD Unix systems (also known as @dfn{Berkeley Unix}) and from @dfn{SunOS} (a popular 4.2 BSD derivative that includes some Unix System @@ -202,7 +202,7 @@ The @dfn{System V Interface Description} (SVID) is a document describing the AT&T Unix System V operating system. It is to some extent a superset of the POSIX standard (@pxref{POSIX}). -The GNU C library defines most of the facilities required by the SVID +@Theglibc{} defines most of the facilities required by the SVID that are not also required by the @w{ISO C} or POSIX standards, for compatibility with System V Unix and other Unix systems (such as SunOS) which include these facilities. However, many of the more @@ -222,7 +222,7 @@ a more general standard than POSIX. X/Open owns the Unix copyright and the XPG specifies the requirements for systems which are intended to be a Unix system. -The GNU C library complies to the X/Open Portability Guide, Issue 4.2, +@Theglibc{} complies to the X/Open Portability Guide, Issue 4.2, with all extensions common to XSI (X/Open System Interface) compliant systems and also all X/Open UNIX extensions. @@ -238,7 +238,7 @@ functionality is available on commercial systems. @section Using the Library This section describes some of the practical issues involved in using -the GNU C library. +@theglibc{}. @menu * Header Files:: How to include the header files in your @@ -269,7 +269,7 @@ variable or says what a function does.) @cindex definition (compared to declaration) @cindex declaration (compared to definition) -In order to use the facilities in the GNU C library, you should be sure +In order to use the facilities in @theglibc{}, you should be sure that your program source files include the appropriate header files. This is so that the compiler has declarations of these facilities available and can correctly process references to them. Once your @@ -310,7 +310,7 @@ For more information about the use of header files and @samp{#include} directives, @pxref{Header Files,,, cpp.info, The GNU C Preprocessor Manual}.@refill -The GNU C library provides several header files, each of which contains +@Theglibc{} provides several header files, each of which contains the type and macro definitions and variable and function declarations for a group of related facilities. This means that your programs may need to include several header files, depending on exactly which @@ -319,8 +319,8 @@ facilities you are using. Some library header files include other library header files automatically. However, as a matter of programming style, you should not rely on this; it is better to explicitly include all the header -files required for the library facilities you are using. The GNU C -library header files have been written in such a way that it doesn't +files required for the library facilities you are using. The @glibcadj{} +header files have been written in such a way that it doesn't matter if a header file is accidentally included more than once; including a header file a second time has no effect. Likewise, if your program needs to include multiple header files, the order in which they @@ -572,7 +572,7 @@ debugging mechanism which allows you to put assertions in your code, and have diagnostic messages printed if the tests fail. @item -@ref{Memory}, describes the GNU library's facilities for managing and +@ref{Memory}, describes @theglibc{}'s facilities for managing and using virtual and real memory, including dynamic allocation of virtual memory. If you do not know in advance how much memory your program needs, you can allocate it dynamically instead, and manipulate it via @@ -714,7 +714,7 @@ macros in the library, with complete data types and function prototypes, and says what standard or system each is derived from. @item -@ref{Installation}, explains how to build and install the GNU C library on +@ref{Installation}, explains how to build and install @theglibc{} on your system, and how to report any bugs you might find. @item diff --git a/manual/io.texi b/manual/io.texi index f839138..0286fa4 100644 --- a/manual/io.texi +++ b/manual/io.texi @@ -3,8 +3,8 @@ @chapter Input/Output Overview Most programs need to do either input (reading data) or output (writing -data), or most frequently both, in order to do anything useful. The GNU -C library provides such a large selection of input and output functions +data), or most frequently both, in order to do anything useful. @Theglibc{} +provides such a large selection of input and output functions that the hardest part is often deciding which function is most appropriate! @@ -65,7 +65,7 @@ closed a stream or file descriptor, you cannot do any more input or output operations on it. @menu -* Streams and File Descriptors:: The GNU Library provides two ways +* Streams and File Descriptors:: The GNU C Library provides two ways to access the contents of files. * File Position:: The number of bytes from the beginning of the file. @@ -123,8 +123,8 @@ than GNU, you should also be aware that file descriptors are not as portable as streams. You can expect any system running @w{ISO C} to support streams, but non-GNU systems may not support file descriptors at all, or may only implement a subset of the GNU functions that operate on -file descriptors. Most of the file descriptor functions in the GNU -library are included in the POSIX.1 standard, however. +file descriptors. Most of the file descriptor functions in @theglibc{} +are included in the POSIX.1 standard, however. @node File Position, , Streams and File Descriptors, I/O Concepts @subsection File Position @@ -236,7 +236,7 @@ in @ref{File System Interface}. @subsection File Name Resolution A file name consists of file name components separated by slash -(@samp{/}) characters. On the systems that the GNU C library supports, +(@samp{/}) characters. On the systems that @theglibc{} supports, multiple successive @samp{/} characters are equivalent to a single @samp{/} character. diff --git a/manual/job.texi b/manual/job.texi index fbc7ace..cd16c6c 100644 --- a/manual/job.texi +++ b/manual/job.texi @@ -107,7 +107,7 @@ controlling terminal, @cindex job control is optional Not all operating systems support job control. The GNU system does -support job control, but if you are using the GNU library on some other +support job control, but if you are using @theglibc{} on some other system, that system may not support job control itself. You can use the @code{_POSIX_JOB_CONTROL} macro to test at compile-time @@ -1026,7 +1026,7 @@ to job control. @cindex controlling terminal, determining You can use the @code{ctermid} function to get a file name that you can -use to open the controlling terminal. In the GNU library, it returns +use to open the controlling terminal. In @theglibc{}, it returns the same string all the time: @code{"/dev/tty"}. That is a special ``magic'' file name that refers to the controlling terminal of the current process (if it has one). To find the name of the specific diff --git a/manual/lang.texi b/manual/lang.texi index b93ad5b..6cb7371 100644 --- a/manual/lang.texi +++ b/manual/lang.texi @@ -454,7 +454,7 @@ This ends the use of @var{ap}. After a @code{va_end} call, further @code{va_end} before returning from the function in which @code{va_start} was invoked with the same @var{ap} argument. -In the GNU C library, @code{va_end} does nothing, and you need not ever +In @theglibc{}, @code{va_end} does nothing, and you need not ever use it except for reasons of portability. @refill @end deftypefn @@ -629,27 +629,13 @@ This is an unsigned integer type used to represent the sizes of objects. The result of the @code{sizeof} operator is of this type, and functions such as @code{malloc} (@pxref{Unconstrained Allocation}) and @code{memcpy} (@pxref{Copying and Concatenation}) accept arguments of -this type to specify object sizes. +this type to specify object sizes. On systems using @theglibc{}, this +will be @w{@code{unsigned int}} or @w{@code{unsigned long int}}. @strong{Usage Note:} @code{size_t} is the preferred way to declare any arguments or variables that hold the size of an object. @end deftp -In the GNU system @code{size_t} is equivalent to either -@w{@code{unsigned int}} or @w{@code{unsigned long int}}. These types -have identical properties on the GNU system and, for most purposes, you -can use them interchangeably. However, they are distinct as data types, -which makes a difference in certain contexts. - -For example, when you specify the type of a function argument in a -function prototype, it makes a difference which one you use. If the -system header files declare @code{malloc} with an argument of type -@code{size_t} and you declare @code{malloc} with an argument of type -@code{unsigned int}, you will get a compilation error if @code{size_t} -happens to be @code{unsigned long int} on your system. To avoid any -possibility of error, when a function argument or value is supposed to -have type @code{size_t}, never declare its type in any other way. - @strong{Compatibility Note:} Implementations of C before the advent of @w{ISO C} generally used @code{unsigned int} for representing object sizes and @code{int} for pointer subtraction results. They did not @@ -776,7 +762,7 @@ It's equal to @code{SCHAR_MAX} if @code{char} is signed, or @item SHRT_MIN This is the minimum value that can be represented by a @w{@code{signed -short int}}. On most machines that the GNU C library runs on, +short int}}. On most machines that @theglibc{} runs on, @code{short} integers are 16-bit quantities. @comment limits.h @@ -795,7 +781,7 @@ respectively. @item INT_MIN This is the minimum value that can be represented by a @w{@code{signed -int}}. On most machines that the GNU C system runs on, an @code{int} is +int}}. On most machines that @theglibc{} runs on, an @code{int} is a 32-bit quantity. @comment limits.h @@ -813,7 +799,7 @@ the type @w{@code{signed int}} and the type @w{@code{unsigned int}}. @item LONG_MIN This is the minimum value that can be represented by a @w{@code{signed -long int}}. On most machines that the GNU C system runs on, @code{long} +long int}}. On most machines that @theglibc{} runs on, @code{long} integers are 32-bit quantities, the same size as @code{int}. @comment limits.h @@ -831,7 +817,7 @@ These are the maximum values that can be represented by a @item LLONG_MIN This is the minimum value that can be represented by a @w{@code{signed -long long int}}. On most machines that the GNU C system runs on, +long long int}}. On most machines that @theglibc{} runs on, @w{@code{long long}} integers are 64-bit quantities. @comment limits.h @@ -939,8 +925,8 @@ Sometimes, in the actual bits representing the floating point number, the exponent is @dfn{biased} by adding a constant to it, to make it always be represented as an unsigned quantity. This is only important if you have some reason to pick apart the bit fields making up the -floating point number by hand, which is something for which the GNU -library provides no support. So this is ignored in the discussion that +floating point number by hand, which is something for which @theglibc{} +provides no support. So this is ignored in the discussion that follows. @item @@ -961,7 +947,7 @@ the mantissa. This is a bit which is present virtually in the mantissa, but not stored in memory because its value is always 1 in a normalized number. The precision figure (see above) includes any hidden bits. -Again, the GNU library provides no facilities for dealing with such +Again, @theglibc{} provides no facilities for dealing with such low-level aspects of the representation. @end itemize diff --git a/manual/libc.texinfo b/manual/libc.texinfo index f1c4301..2c1344a 100644 --- a/manual/libc.texinfo +++ b/manual/libc.texinfo @@ -4,6 +4,8 @@ @settitle The GNU C Library @c setchapternewpage odd +@include macros.texi + @comment Tell install-info what to do. @dircategory Software libraries @direntry @@ -29,7 +31,7 @@ @set FDL_VERSION 1.3 @copying -This file documents the GNU C library. +This file documents @theglibc{}. This is @c Disabled (printed editions, see above). @@ -94,7 +96,7 @@ This is @c Disabled (printed editions, see above). @c Edition @value{EDITION} of @cite{The GNU C Library Reference Manual}, for Version @value{VERSION} -of the GNU C Library. +of @theglibc{}. @end ifnottex @include top-menu.texi diff --git a/manual/llio.texi b/manual/llio.texi index 281d1e0..f3ed542 100644 --- a/manual/llio.texi +++ b/manual/llio.texi @@ -332,7 +332,7 @@ some input. But if the @code{O_NONBLOCK} flag is set for the file reading any data, and reports this error. @strong{Compatibility Note:} Most versions of BSD Unix use a different -error code for this: @code{EWOULDBLOCK}. In the GNU library, +error code for this: @code{EWOULDBLOCK}. In @theglibc{}, @code{EWOULDBLOCK} is an alias for @code{EAGAIN}, so it doesn't matter which name you use. @@ -483,7 +483,7 @@ flow control, where output has been suspended by receipt of a STOP character. @strong{Compatibility Note:} Most versions of BSD Unix use a different -error code for this: @code{EWOULDBLOCK}. In the GNU library, +error code for this: @code{EWOULDBLOCK}. In @theglibc{}, @code{EWOULDBLOCK} is an alias for @code{EAGAIN}, so it doesn't matter which name you use. @@ -776,8 +776,8 @@ character. @comment sys/types.h @comment POSIX.1 @deftp {Data Type} off_t -This is an arithmetic data type used to represent file sizes. -In the GNU system, this is equivalent to @code{fpos_t} or @code{long int}. +This is a signed integer type used to represent file sizes. In +@theglibc{}, this type is no narrower than @code{int}. If the source is compiled with @code{_FILE_OFFSET_BITS == 64} this type is transparently replaced by @code{off64_t}. @@ -844,7 +844,7 @@ null pointer is returned instead. In some other systems, @code{fdopen} may fail to detect that the modes for file descriptor do not permit the access specified by -@code{opentype}. The GNU C library always checks for this. +@code{opentype}. @Theglibc{} always checks for this. @end deftypefun For an example showing the use of the @code{fdopen} function, @@ -1043,8 +1043,8 @@ with multiple calls to @code{read} and @code{write}, it is inefficient because there is overhead associated with each kernel call. Instead, many platforms provide special high-speed primitives to perform -these @dfn{scatter-gather} operations in a single kernel call. The GNU C -library will provide an emulation on any system that lacks these +these @dfn{scatter-gather} operations in a single kernel call. @Theglibc{} +will provide an emulation on any system that lacks these primitives, so they are not a portability threat. They are defined in @code{sys/uio.h}. @@ -1216,7 +1216,7 @@ systems. They are also useful to share data between multiple tasks without creating a file. On some systems using private anonymous mmaps is more efficient than using -@code{malloc} for large blocks. This is not an issue with the GNU C library, +@code{malloc} for large blocks. This is not an issue with @theglibc{}, as the included @code{malloc} automatically uses @code{mmap} where appropriate. @c Linux has some other MAP_ options, which I have not discussed here. @@ -2498,7 +2498,7 @@ At the point of this writing, the available implementation is a userlevel implementation which uses threads for handling the enqueued requests. While this implementation requires making some decisions about limitations, hard limitations are something which is best avoided -in the GNU C library. Therefore, the GNU C library provides a means +in @theglibc{}. Therefore, @theglibc{} provides a means for tuning the AIO implementation according to the individual use. @comment aio.h diff --git a/manual/locale.texi b/manual/locale.texi index 23ad8bc..2f10fcd 100644 --- a/manual/locale.texi +++ b/manual/locale.texi @@ -350,8 +350,8 @@ The empty name says to select a locale based on environment variables. @end table Defining and installing named locales is normally a responsibility of -the system administrator at your site (or the person who installed the -GNU C library). It is also possible for the user to create private +the system administrator at your site (or the person who installed +@theglibc{}). It is also possible for the user to create private locales. All this will be discussed later when describing the tool to do so. @comment (@pxref{Building Locale Files}). @@ -889,7 +889,7 @@ The same as the value returned by @code{localeconv} in the @item YESEXPR The return value is a regular expression which can be used with the @code{regex} function to recognize a positive response to a yes/no -question. The GNU C library provides the @code{rpmatch} function for +question. @Theglibc{} provides the @code{rpmatch} function for easier handling in applications. @item NOEXPR The return value is a regular expression which can be used with the @@ -1048,7 +1048,7 @@ than given by the field width, the displayed value is rounded. If the number of fractional digits is selected to be zero, no decimal point is printed. -As a GNU extension, the @code{strfmon} implementation in the GNU libc +As a GNU extension, the @code{strfmon} implementation in @theglibc{} allows an optional @samp{L} next as a format modifier. If this modifier is given, the argument is expected to be a @code{long double} instead of a @code{double} value. @@ -1179,7 +1179,7 @@ sure that you localize the answers too. It would be very bad habit to ask a question in one language and request the answer in another, often English. -The GNU C library contains @code{rpmatch} to give applications easy +@Theglibc{} contains @code{rpmatch} to give applications easy access to the corresponding locale definitions. @comment GNU @@ -1203,7 +1203,7 @@ The answer matched neither the @code{YESEXPR} nor the @code{NOEXPR} regular expression. @end table -This function is not standardized but available beside in GNU libc at +This function is not standardized but available beside in @theglibc{} at least also in the IBM AIX library. @end deftypefun diff --git a/manual/macros.texi b/manual/macros.texi new file mode 100644 index 0000000..c9b73d3 --- /dev/null +++ b/manual/macros.texi @@ -0,0 +1,20 @@ +@c Define common macros used to keep phrasing consistent in the manual. + +@ifclear MACROS +@set MACROS + +@c Names used to refer to the library, as noun phrases at the start or +@c not at the start of a sentence. +@macro Theglibc +The GNU C Library +@end macro +@macro theglibc +the GNU C Library +@end macro + +@c Name used to refer to the library as an adjective. +@macro glibcadj +GNU C Library +@end macro + +@end ifclear diff --git a/manual/maint.texi b/manual/maint.texi index 567db98..0c2ed59 100644 --- a/manual/maint.texi +++ b/manual/maint.texi @@ -4,8 +4,8 @@ @menu * Source Layout:: How to add new functions or header files - to the GNU C library. -* Porting:: How to port the GNU C library to + to the GNU C Library. +* Porting:: How to port the GNU C Library to a new machine or operating system. @end menu @@ -105,9 +105,9 @@ This variable is used for secondary object files needed to build @end table @node Porting -@appendixsec Porting the GNU C Library +@appendixsec Porting @theglibc{} -The GNU C library is written to be easily portable to a variety of +@Theglibc{} is written to be easily portable to a variety of machines and operating systems. Machine- and operating system-dependent functions are well separated to make it easy to add implementations for new machines or operating systems. This section describes the layout of @@ -405,7 +405,7 @@ the @file{sysdeps} hierarchy, parallel to @file{unix} and @file{mach}. @end table @node Porting to Unix -@appendixsubsec Porting the GNU C Library to Unix Systems +@appendixsubsec Porting @theglibc{} to Unix Systems Most Unix systems are fundamentally very similar. There are variations between different machines, and variations in what facilities are @@ -452,10 +452,10 @@ generated are @file{ioctls.h}, @file{errnos.h}, @file{sys/param.h}, and @c It's not anymore true. glibc 2.1 cannot be used with K&R compilers. @c --drepper -Although the GNU C library implements the @w{ISO C} library facilities, you -@emph{can} use the GNU C library with traditional, ``pre-ISO'' C +Although @theglibc{} implements the @w{ISO C} library facilities, you +@emph{can} use @theglibc{} with traditional, ``pre-ISO'' C compilers. However, you need to be careful because the content and -organization of the GNU C library header files differs from that of +organization of the @glibcadj{} header files differs from that of traditional C implementations. This means you may need to make changes to your program in order to get it to compile. @end ignore diff --git a/manual/math.texi b/manual/math.texi index 01e258f..9242b53 100644 --- a/manual/math.texi +++ b/manual/math.texi @@ -111,8 +111,8 @@ These constants come from the Unix98 standard and were also available in defined. The default set of features includes these constants. @xref{Feature Test Macros}. -All values are of type @code{double}. As an extension, the GNU C -library also defines these constants with type @code{long double}. The +All values are of type @code{double}. As an extension, @theglibc{} +also defines these constants with type @code{long double}. The @code{long double} macros have a lowercase @samp{l} appended to their names: @code{M_El}, @code{M_PIl}, and so forth. These are only available if @code{_GNU_SOURCE} is defined. @@ -121,7 +121,7 @@ available if @code{_GNU_SOURCE} is defined. @emph{Note:} Some programs use a constant named @code{PI} which has the same value as @code{M_PI}. This constant is not standard; it may have appeared in some old AT&T headers, and is mentioned in Stroustrup's book -on C++. It infringes on the user's name space, so the GNU C library +on C++. It infringes on the user's name space, so @theglibc{} does not define it. Fixing programs written to expect it is simple: replace @code{PI} with @code{M_PI} throughout, or put @samp{-DPI=M_PI} on the compiler command line. @@ -217,7 +217,7 @@ to cope with its absence. @cindex complex trigonometric functions @w{ISO C99} defines variants of the trig functions which work on -complex numbers. The GNU C library provides these functions, but they +complex numbers. @Theglibc{} provides these functions, but they are only useful if your compiler supports the new complex types defined by the standard. @c XXX Change this when gcc is fixed. -zw @@ -1275,7 +1275,7 @@ generator. There is no standard meaning for a particular seed value; the same seed, used in different C libraries or on different CPU types, will give you different random numbers. -The GNU library supports the standard @w{ISO C} random number functions +@Theglibc{} supports the standard @w{ISO C} random number functions plus two other sets derived from BSD and SVID. The BSD and @w{ISO C} functions provide identical, somewhat limited functionality. If only a small number of random bits are required, we recommend you use the @@ -1306,7 +1306,7 @@ To use these facilities, you should include the header file @comment ISO @deftypevr Macro int RAND_MAX The value of this macro is an integer constant representing the largest -value the @code{rand} function can return. In the GNU library, it is +value the @code{rand} function can return. In @theglibc{}, it is @code{2147483647}, which is the largest signed integer representable in 32 bits. In other libraries, it may be as low as @code{32767}. @end deftypevr @@ -1355,7 +1355,7 @@ available. This section describes a set of random number generation functions that are derived from BSD. There is no advantage to using these functions -with the GNU C library; we support them for BSD compatibility only. +with @theglibc{}; we support them for BSD compatibility only. The prototypes for these functions are in @file{stdlib.h}. @pindex stdlib.h @@ -1419,7 +1419,7 @@ the user and can only be modified by these functions. This makes it hard to deal with situations where each thread should have its own pseudo-random number generator. -The GNU C library contains four additional functions which contain the +@Theglibc{} contains four additional functions which contain the state as an explicit parameter and therefore make it possible to handle thread-local PRNGs. Beside this there is no difference. In fact, the four functions already discussed are implemented internally using the @@ -1824,7 +1824,7 @@ that the cost of the function calls themselves is not negligible. Modern processors can often execute the operations themselves very fast, but the function call disrupts the instruction pipeline. -For this reason the GNU C Library provides optimizations for many of the +For this reason @theglibc{} provides optimizations for many of the frequently-used math functions. When GNU CC is used and the user activates the optimizer, several new inline functions and macros are defined. These new functions and macros have the same names as the diff --git a/manual/memory.texi b/manual/memory.texi index da1656c..ce32af0 100644 --- a/manual/memory.texi +++ b/manual/memory.texi @@ -5,9 +5,9 @@ @cindex storage allocation This chapter describes how processes manage and use memory in a system -that uses the GNU C library. +that uses @theglibc{}. -The GNU C Library has several functions for dynamically allocating +@Theglibc{} has several functions for dynamically allocating virtual memory in various ways. They vary in generality and in efficiency. The library also provides functions for controlling paging and allocation of real memory. @@ -47,7 +47,7 @@ just a flag saying it is all zeroes. The same frame of real memory or backing store can back multiple virtual pages belonging to multiple processes. This is normally the case, for -example, with virtual memory occupied by GNU C library code. The same +example, with virtual memory occupied by @glibcadj{} code. The same real memory frame containing the @code{printf} function backs a virtual memory page in each of the existing processes that has a @code{printf} call in its program. @@ -100,7 +100,7 @@ Allocation and C}). @cindex constants Once that program begins to execute, it uses programmatic allocation to -gain additional memory. In a C program with the GNU C library, there +gain additional memory. In a C program with @theglibc{}, there are two kinds of programmatic allocation: automatic and dynamic. @xref{Memory Allocation and C}. @@ -158,7 +158,7 @@ grows, but doesn't shrink when the stack shrinks. This section covers how ordinary programs manage storage for their data, including the famous @code{malloc} function and some fancier facilities -special the GNU C library and GNU Compiler. +special @theglibc{} and GNU Compiler. @menu * Memory Allocation and C:: How to get different kinds of allocation in C. @@ -202,7 +202,7 @@ that varies. In other C implementations, it must be a constant. @end itemize A third important kind of memory allocation, @dfn{dynamic allocation}, -is not supported by C variables but is available via GNU C library +is not supported by C variables but is available via @glibcadj{} functions. @cindex dynamic memory allocation @@ -234,8 +234,8 @@ as you want. Dynamic allocation is not supported by C variables; there is no storage class ``dynamic'', and there can never be a C variable whose value is stored in dynamically allocated space. The only way to get dynamically -allocated memory is via a system call (which is generally via a GNU C -library function call), and the only way to refer to dynamically +allocated memory is via a system call (which is generally via a @glibcadj{} +function call), and the only way to refer to dynamically allocated space is through a pointer. Because it is less convenient, and because the actual process of dynamic allocation requires more computation time, programmers generally use dynamic allocation only when @@ -591,7 +591,7 @@ more time to minimize the wasted space. @end ignore -As opposed to other versions, the @code{malloc} in the GNU C Library +As opposed to other versions, the @code{malloc} in @theglibc{} does not round up block sizes to powers of two, neither for large nor for small sizes. Neighboring chunks can be coalesced on a @code{free} no matter what their size is. This makes the implementation suitable @@ -620,7 +620,7 @@ power of two than that, use @code{memalign}, @code{posix_memalign}, or @code{valloc}. @code{memalign} is declared in @file{malloc.h} and @code{posix_memalign} is declared in @file{stdlib.h}. -With the GNU library, you can use @code{free} to free the blocks that +With @theglibc{}, you can use @code{free} to free the blocks that @code{memalign}, @code{posix_memalign}, and @code{valloc} return. That does not work in BSD, however---BSD does not provide any way to free such blocks. @@ -834,7 +834,7 @@ recompile your application. @subsubsection Memory Allocation Hooks @cindex allocation hooks, for @code{malloc} -The GNU C library lets you modify the behavior of @code{malloc}, +@Theglibc{} lets you modify the behavior of @code{malloc}, @code{realloc}, and @code{free} by specifying appropriate hook functions. You can use these hooks to help you debug programs that use dynamic memory allocation, for example. @@ -1149,7 +1149,7 @@ Long running programs must assure that dynamically allocated objects are freed at the end of their lifetime. If this does not happen the system runs out of memory, sooner or later. -The @code{malloc} implementation in the GNU C library provides some +The @code{malloc} implementation in @theglibc{} provides some simple means to detect such leaks and obtain some information to find the location. To do this the application must be started in a special mode which is enabled by an environment variable. There are no speed @@ -1313,8 +1313,8 @@ If you take a look at the output it will look similar to this: What this all means is not really important since the trace file is not meant to be read by a human. Therefore no attention is given to -readability. Instead there is a program which comes with the GNU C -library which interprets the traces and outputs a summary in an +readability. Instead there is a program which comes with @theglibc{} +which interprets the traces and outputs a summary in an user-friendly way. The program is called @code{mtrace} (it is in fact a Perl script) and it takes one or two arguments. In any case the name of the file with the trace output must be specified. If an optional @@ -2344,7 +2344,7 @@ The symbols in this section are declared in @file{unistd.h}. You will not normally use the functions in this section, because the functions described in @ref{Memory Allocation} are easier to use. Those -are interfaces to a GNU C Library memory allocator that uses the +are interfaces to a @glibcadj{} memory allocator that uses the functions below itself. The functions below are simple interfaces to system calls. @@ -2526,7 +2526,7 @@ define the macro @code{_POSIX_MEMLOCK_RANGE} and the file @code{limits.h} define the macro @code{PAGESIZE} to be the size of a memory page in bytes. It requires that when the @code{mlockall} and @code{munlockall} functions are available, the @file{unistd.h} file -define the macro @code{_POSIX_MEMLOCK}. The GNU C library conforms to +define the macro @code{_POSIX_MEMLOCK}. @Theglibc{} conforms to this requirement. @comment sys/mman.h diff --git a/manual/message.texi b/manual/message.texi index e44545a..3fc6d24 100644 --- a/manual/message.texi +++ b/manual/message.texi @@ -17,7 +17,7 @@ A better solution is to keep the message sets for each language are kept in separate files which are loaded at runtime depending on the language selection of the user. -The GNU C Library provides two different sets of functions to support +@Theglibc{} provides two different sets of functions to support message translation. The problem is that neither of the interfaces is officially defined by the POSIX standard. The @code{catgets} family of functions is defined in the X/Open standard but this is derived from @@ -170,8 +170,8 @@ is @end smallexample @noindent -where @var{prefix} is given to @code{configure} while installing the GNU -C Library (this value is in many cases @code{/usr} or the empty string). +where @var{prefix} is given to @code{configure} while installing @theglibc{} +(this value is in many cases @code{/usr} or the empty string). The remaining problem is to decide which must be used. The value decides about the substitution of the format elements mentioned above. @@ -439,11 +439,11 @@ detail in the next section. Files in this other format are not human readable. To be easy to use by programs it is a binary file. But the format is byte order independent so translation files can be shared by systems of arbitrary architecture -(as long as they use the GNU C Library). +(as long as they use @theglibc{}). Details about the binary file format are not important to know since these files are always created by the @code{gencat} program. The -sources of the GNU C Library also provide the sources for the +sources of @theglibc{} also provide the sources for the @code{gencat} program and so the interested reader can look through these source files to learn about the file format. @@ -730,11 +730,10 @@ translation in the Uniforum group. There never was a real standard defined but still the interface was used in Sun's operation systems. Since this approach fits better in the development process of free software it is also used throughout the GNU project and the GNU -@file{gettext} package provides support for this outside the GNU C -Library. +@file{gettext} package provides support for this outside @theglibc{}. The code of the @file{libintl} from GNU @file{gettext} is the same as -the code in the GNU C Library. So the documentation in the GNU +the code in @theglibc{}. So the documentation in the GNU @file{gettext} manual is also valid for the functionality here. The following text will describe the library functions in detail. But the numerous helper programs are not described in this manual. Instead @@ -982,7 +981,7 @@ As the functions described in the last sections already mention separate sets of messages can be selected by a @dfn{domain name}. This is a simple string which should be unique for each program part with uses a separate domain. It is possible to use in one program arbitrary many -domains at the same time. E.g., the GNU C Library itself uses a domain +domains at the same time. E.g., @theglibc{} itself uses a domain named @code{libc} while the program using the C Library could use a domain named @code{foo}. The important point is that at any time exactly one domain is active. This is controlled with the following @@ -1128,7 +1127,7 @@ form, the second the plural form. This has the consequence that programs without language catalogs can display the correct strings only if the program itself is written using -a Germanic language. This is a limitation but since the GNU C library +a Germanic language. This is a limitation but since @theglibc{} (as well as the GNU @code{gettext} package) are written as part of the GNU package and the coding standards for the GNU project require program being written in English, this solution nevertheless fulfills its @@ -1552,7 +1551,7 @@ functions as well which look almost identical, except for the parameters and the call to the underlying function. Now there is of course the question why such functions do not exist in -the GNU C library? There are two parts of the answer to this question. +@theglibc{}? There are two parts of the answer to this question. @itemize @bullet @item @@ -1666,8 +1665,8 @@ The @var{domain_name} part is the name which was either registered using the @code{textdomain} function or which was given to @code{dgettext} or @code{dcgettext} as the first parameter. Now it becomes obvious that a good choice for the domain name in the program code is a string which is -closely related to the program/package name. E.g., for the GNU C -Library the domain name is @code{libc}. +closely related to the program/package name. E.g., for @theglibc{} +the domain name is @code{libc}. @noindent A limit piece of example code should show how the programmer is supposed @@ -1787,7 +1786,7 @@ different character sets the user has to be careful. @node Helper programs for gettext @subsection Programs to handle message catalogs for @code{gettext} -The GNU C Library does not contain the source code for the programs to +@Theglibc{} does not contain the source code for the programs to handle message catalogs for the @code{gettext} functions. As part of the GNU project the GNU gettext package contains everything the developer needs. The functionality provided by the tools in this diff --git a/manual/nss.texi b/manual/nss.texi index 9627583..29fa4cc 100644 --- a/manual/nss.texi +++ b/manual/nss.texi @@ -12,9 +12,9 @@ Network Information Service (NIS) and the Domain Name Service (DNS)) became popular, and were hacked into the C library, usually with a fixed search order (@pxref{frobnicate, , ,jargon, The Jargon File}). -The GNU C Library contains a cleaner solution of this problem. It is +@Theglibc{} contains a cleaner solution of this problem. It is designed after a method used by Sun Microsystems in the C library of -@w{Solaris 2}. GNU C Library follows their name and calls this +@w{Solaris 2}. @Theglibc{} follows their name and calls this scheme @dfn{Name Service Switch} (NSS). Though the interface might be similar to Sun's version there is no @@ -39,7 +39,7 @@ advantages: @enumerate @item -Contributors can add new services without adding them to GNU C Library. +Contributors can add new services without adding them to @theglibc{}. @item The modules can be updated separately. @item @@ -364,7 +364,7 @@ system @file{nss_files.so.2}. This is the difference mentioned above. Sun's NSS modules are usable as modules which get indirectly loaded only. -The NSS modules in the GNU C Library are prepared to be used as normal +The NSS modules in @theglibc{} are prepared to be used as normal libraries themselves. This is @emph{not} true at the moment, though. However, the organization of the name space in the modules does not make it impossible like it is for Solaris. Now you can see why the modules are @@ -528,8 +528,8 @@ completely aside). @node Adding another Service to NSS, NSS Module Function Internals, Extending NSS, Extending NSS @subsection Adding another Service to NSS -The sources for a new service need not (and should not) be part of the -GNU C Library itself. The developer retains complete control over the +The sources for a new service need not (and should not) be part of @theglibc{} +itself. The developer retains complete control over the sources and its development. The links between the C library and the new service module consists solely of the interface functions. diff --git a/manual/pattern.texi b/manual/pattern.texi index c2a42cd..48eba75 100644 --- a/manual/pattern.texi +++ b/manual/pattern.texi @@ -2,7 +2,7 @@ @c %MENU% Matching shell ``globs'' and regular expressions @chapter Pattern Matching -The GNU C Library provides pattern matching facilities for two kinds of +@Theglibc{} provides pattern matching facilities for two kinds of patterns: regular expressions and file-name wildcards. The library also provides a facility for expanding variable and command references and parsing text into words in the way the shell does. @@ -36,7 +36,7 @@ returns the nonzero value @code{FNM_NOMATCH}. The arguments The argument @var{flags} is a combination of flag bits that alter the details of matching. See below for a list of the defined flags. -In the GNU C Library, @code{fnmatch} cannot experience an ``error''---it +In @theglibc{}, @code{fnmatch} cannot experience an ``error''---it always returns an answer for whether the match succeeds. However, other implementations of @code{fnmatch} might sometimes report ``errors''. They would do so by returning nonzero values that are not equal to @@ -668,7 +668,7 @@ type @code{glob64_t} which were allocated by @code{glob64}. @node Regular Expressions @section Regular Expression Matching -The GNU C library supports two interfaces for matching regular +@Theglibc{} supports two interfaces for matching regular expressions. One is the standard POSIX.2 interface, and the other is what the GNU system has had for many years. diff --git a/manual/process.texi b/manual/process.texi index 53d467c..45d3ed4 100644 --- a/manual/process.texi +++ b/manual/process.texi @@ -55,8 +55,8 @@ until the subprogram terminates before you can do anything else. @comment ISO @deftypefun int system (const char *@var{command}) @pindex sh -This function executes @var{command} as a shell command. In the GNU C -library, it always uses the default shell @code{sh} to run the command. +This function executes @var{command} as a shell command. In @theglibc{}, +it always uses the default shell @code{sh} to run the command. In particular, it searches the directories in @code{PATH} to find programs to execute. The return value is @code{-1} if it wasn't possible to create the shell process, and otherwise is the status of the @@ -151,7 +151,7 @@ program should include the header files @file{unistd.h} and @comment POSIX.1 @deftp {Data Type} pid_t The @code{pid_t} data type is a signed integer type which is capable -of representing a process ID. In the GNU library, this is an @code{int}. +of representing a process ID. In @theglibc{}, this is an @code{int}. @end deftp @comment unistd.h @@ -260,8 +260,8 @@ do a long jump out of) the function that called @code{vfork}! This would leave the parent process's control information very confused. If in doubt, use @code{fork} instead. -Some operating systems don't really implement @code{vfork}. The GNU C -library permits you to use @code{vfork} on all systems, but actually +Some operating systems don't really implement @code{vfork}. @Theglibc{} +permits you to use @code{vfork} on all systems, but actually executes @code{fork} if @code{vfork} isn't available. If you follow the proper precautions for using @code{vfork}, your program will still work even if the system uses @code{fork} instead. @@ -694,11 +694,11 @@ signal number of the signal that caused the child process to stop. @node BSD Wait Functions @section BSD Process Wait Functions -The GNU library also provides these related facilities for compatibility +@Theglibc{} also provides these related facilities for compatibility with BSD Unix. BSD uses the @code{union wait} data type to represent status values rather than an @code{int}. The two representations are -actually interchangeable; they describe the same bit patterns. The GNU -C Library defines macros such as @code{WEXITSTATUS} so that they will +actually interchangeable; they describe the same bit patterns. @Theglibc{} +defines macros such as @code{WEXITSTATUS} so that they will work on either kind of object, and the @code{wait} function is defined to accept either type of pointer as its @var{status-ptr} argument. diff --git a/manual/resource.texi b/manual/resource.texi index 173ed41..1e2fcaf 100644 --- a/manual/resource.texi +++ b/manual/resource.texi @@ -522,7 +522,7 @@ The process tried to set its current limit beyond its maximum limit. When multiple processes simultaneously require CPU time, the system's scheduling policy and process CPU priorities determine which processes get it. This section describes how that determination is made and -GNU C library functions to control it. +@glibcadj{} functions to control it. It is common to refer to CPU scheduling simply as scheduling and a process' CPU priority simply as the process' priority, with the CPU @@ -537,7 +537,7 @@ CPU scheduling is a complex issue and different systems do it in wildly different ways. New ideas continually develop and find their way into the intricacies of the various systems' scheduling algorithms. This section discusses the general concepts, some specifics of systems -that commonly use the GNU C library, and some standards. +that commonly use @theglibc{}, and some standards. For simplicity, we talk about CPU contention as if there is only one CPU in the system. But all the same principles apply when a processor has @@ -746,7 +746,7 @@ that has absolute priority higher than 0. @node Basic Scheduling Functions @subsection Basic Scheduling Functions -This section describes functions in the GNU C library for setting the +This section describes functions in @theglibc{} for setting the absolute priority and scheduling policy of a process. @strong{Portability Note:} On systems that have the functions in this @@ -759,7 +759,7 @@ functions to fine tune the scheduling are in @ref{Traditional Scheduling}. Don't try to make too much out of the naming and structure of these functions. They don't match the concepts described in this manual because the functions are as defined by POSIX.1b, but the implementation -on systems that use the GNU C library is the inverse of what the POSIX +on systems that use @theglibc{} is the inverse of what the POSIX structure contemplates. The POSIX scheme assumes that the primary scheduling parameter is the scheduling policy and that the priority value, if any, is a parameter of the scheduling policy. In the @@ -1107,7 +1107,7 @@ other process owned by the same user (or effective user). But only a privileged process can lower its nice value. A privileged process can also raise or lower another process' nice value. -GNU C Library functions for getting and setting nice values are described in +@glibcadj{} functions for getting and setting nice values are described in @xref{Traditional Scheduling Functions}. @node Traditional Scheduling Functions @@ -1289,7 +1289,7 @@ The POSIX standard up to this date is of not much help to solve this problem. The Linux kernel provides a set of interfaces to allow specifying @emph{affinity sets} for a process. The scheduler will schedule the thread or process on CPUs specified by the affinity -masks. The interfaces which the GNU C library define follow to some +masks. The interfaces which @theglibc{} define follow to some extend the Linux kernel interface. @comment sched.h @@ -1554,7 +1554,7 @@ increases its memory usage). The value returned for If all applications together constantly use more than that amount of memory the system is in trouble. -The GNU C library provides in addition to these already described way to +@Theglibc{} provides in addition to these already described way to get this information two functions. They are declared in the file @file{sys/sysinfo.h}. Programmers should prefer to use the @code{sysconf} method described above. @@ -1610,7 +1610,7 @@ processors and so the call returns the number of processors which are currently online (i.e., available). -For these two pieces of information the GNU C library also provides +For these two pieces of information @theglibc{} also provides functions to get the information directly. The functions are declared in @file{sys/sysinfo.h}. diff --git a/manual/search.texi b/manual/search.texi index 0afd0ae..498832b 100644 --- a/manual/search.texi +++ b/manual/search.texi @@ -65,7 +65,7 @@ int comparison_fn_t (const void *, const void *); @cindex array search function Generally searching for a specific element in an array means that -potentially all elements must be checked. The GNU C library contains +potentially all elements must be checked. @Theglibc{} contains functions to perform linear search. The prototypes for the following two functions can be found in @file{search.h}. @@ -269,8 +269,8 @@ information. The weakest aspect of this function is that there can be at most one hashing table used through the whole program. The table is allocated -in local memory out of control of the programmer. As an extension the -GNU C library provides an additional set of functions with an reentrant +in local memory out of control of the programmer. As an extension @theglibc{} +provides an additional set of functions with an reentrant interface which provide a similar interface but which allow to keep arbitrarily many hashing tables. @@ -417,7 +417,7 @@ Another common form to organize data for efficient search is to use trees. The @code{tsearch} function family provides a nice interface to functions to organize possibly large amounts of data by providing a mean access time proportional to the logarithm of the number of elements. -The GNU C library implementation even guarantees that this bound is +@Theglibc{} implementation even guarantees that this bound is never exceeded even for input data which cause problems for simple binary tree implementations. diff --git a/manual/setjmp.texi b/manual/setjmp.texi index 0cf8b84..cc76352 100644 --- a/manual/setjmp.texi +++ b/manual/setjmp.texi @@ -180,7 +180,7 @@ change the set of blocked signals, and provides an additional pair of functions (@code{sigsetjmp} and @code{siglongjmp}) to get the BSD behavior. -The behavior of @code{setjmp} and @code{longjmp} in the GNU library is +The behavior of @code{setjmp} and @code{longjmp} in @theglibc{} is controlled by feature test macros; see @ref{Feature Test Macros}. The default in the GNU system is the POSIX.1 behavior rather than the BSD behavior. @@ -221,7 +221,7 @@ and these functions are more powerful than those discussed in this chapter so far. These function were part of the original @w{System V} API and by this route were added to the Unix API. Beside on branded Unix implementations these interfaces are not widely available. Not all -platforms and/or architectures the GNU C Library is available on provide +platforms and/or architectures @theglibc{} is available on provide this interface. Use @file{configure} to detect the availability. Similar to the @code{jmp_buf} and @code{sigjmp_buf} types used for the @@ -325,7 +325,7 @@ execution using (@pxref{Memory-mapped I/O}). @strong{Compatibility note}: The current Unix standard is very imprecise about the way the stack is allocated. All implementations seem to agree that the @code{uc_stack} element must be used but the values stored in -the elements of the @code{stack_t} value are unclear. The GNU C library +the elements of the @code{stack_t} value are unclear. @Theglibc{} and most other Unix implementations require the @code{ss_sp} value of the @code{uc_stack} element to point to the base of the memory region allocated for the stack and the size of the memory region is stored in diff --git a/manual/signal.texi b/manual/signal.texi index 2fa5254..9d5e26c 100644 --- a/manual/signal.texi +++ b/manual/signal.texi @@ -9,7 +9,7 @@ executing program. Some signals report errors such as references to invalid memory addresses; others report asynchronous events, such as disconnection of a phone line. -The GNU C library defines a variety of signal types, each for a +@Theglibc{} defines a variety of signal types, each for a particular kind of event. Some kinds of events make it inadvisable or impossible for the program to proceed as usual, and the corresponding signals normally abort the program. Other kinds of signals that report @@ -307,7 +307,7 @@ BSD systems provide the @code{SIGFPE} handler with an extra argument that distinguishes various causes of the exception. In order to access this argument, you must define the handler to accept two arguments, which means you must cast it to a one-argument function type in order to -establish the handler. The GNU library does provide this extra +establish the handler. @Theglibc{} does provide this extra argument, but the value is meaningful only on operating systems that provide the information (BSD systems and GNU systems). @@ -933,7 +933,7 @@ The simplest way to change the action for a signal is to use the @code{signal} function. You can specify a built-in action (such as to ignore the signal), or you can @dfn{establish a handler}. -The GNU library also implements the more versatile @code{sigaction} +@Theglibc{} also implements the more versatile @code{sigaction} facility. This section describes both facilities and gives suggestions on which to use when. @@ -1044,7 +1044,7 @@ a handler for @code{SIGKILL} or @code{SIGSTOP}. @code{signal} function is that it has different semantics on BSD and SVID systems. The difference is that on SVID systems the signal handler is deinstalled after signal delivery. On BSD systems the -handler must be explicitly deinstalled. In the GNU C Library we use the +handler must be explicitly deinstalled. In @theglibc{} we use the BSD version by default. To use the SVID version you can either use the function @code{sysv_signal} (see below) or use the @code{_XOPEN_SOURCE} feature select macro (@pxref{Feature Test Macros}). In general, use of these @@ -1320,7 +1320,7 @@ Each signal number has its own set of flags. Each call to @code{sigaction} affects one particular signal number, and the flags that you specify apply only to that particular signal. -In the GNU C library, establishing a handler with @code{signal} sets all +In @theglibc{}, establishing a handler with @code{signal} sets all the flags to zero except for @code{SA_RESTART}, whose value depends on the settings you have made with @code{siginterrupt}. @xref{Interrupted Primitives}, to see what this is about. @@ -2032,7 +2032,7 @@ atomically. In practice, you can assume that @code{int} is atomic. You can also assume that pointer types are atomic; that is very convenient. Both of these assumptions -are true on all of the machines that the GNU C library supports and on +are true on all of the machines that @theglibc{} supports and on all POSIX systems we know of. @c ??? This might fail on a 386 that uses 64-bit pointers. @@ -2077,7 +2077,7 @@ handlers must check for @code{EINTR} after each library function that can return it, in order to try the call again. Often programmers forget to check, which is a common source of error. -The GNU library provides a convenient way to retry a call after a +@Theglibc{} provides a convenient way to retry a call after a temporary failure, with the macro @code{TEMP_FAILURE_RETRY}: @comment unistd.h @@ -2099,7 +2099,7 @@ approach: to restart the interrupted primitive, instead of making it fail. If you choose this approach, you need not be concerned with @code{EINTR}. -You can choose either approach with the GNU library. If you use +You can choose either approach with @theglibc{}. If you use @code{sigaction} to establish a signal handler, you can specify how that handler should behave. If you specify the @code{SA_RESTART} flag, return from that handler will resume a primitive; otherwise, return from @@ -2111,7 +2111,7 @@ function. @xref{BSD Handler}. @c !!! not true now about _BSD_SOURCE When you don't specify with @code{sigaction} or @code{siginterrupt} what a particular handler should do, it uses a default choice. The default -choice in the GNU library depends on the feature test macros you have +choice in @theglibc{} depends on the feature test macros you have defined. If you define @code{_BSD_SOURCE} or @code{_GNU_SOURCE} before calling @code{signal}, the default is to resume primitives; otherwise, the default is to make them fail with @code{EINTR}. (The library diff --git a/manual/socket.texi b/manual/socket.texi index 3e3410e..a08ac4c 100644 --- a/manual/socket.texi +++ b/manual/socket.texi @@ -15,7 +15,7 @@ network. Sockets are the primary means of communicating with other machines; @code{telnet}, @code{rlogin}, @code{ftp}, @code{talk} and the other familiar network programs use sockets. -Not all operating systems support sockets. In the GNU library, the +Not all operating systems support sockets. In @theglibc{}, the header file @file{sys/socket.h} exists regardless of the operating system, and the socket functions always exist, but if the system does not really support sockets these functions always fail. @@ -155,7 +155,7 @@ happy as implementations which use 64-bit values. @node Communication Styles @section Communication Styles -The GNU library includes support for several different kinds of sockets, +@Theglibc{} includes support for several different kinds of sockets, each with different characteristics. This section describes the supported socket types. The symbolic constants listed here are defined in @file{sys/socket.h}. @@ -1276,7 +1276,7 @@ associated Internet address. The lookup functions above all have one in common: they are not reentrant and therefore unusable in multi-threaded applications. -Therefore provides the GNU C library a new set of functions which can be +Therefore provides @theglibc{} a new set of functions which can be used in this context. @comment netdb.h diff --git a/manual/startup.texi b/manual/startup.texi index d5695bf..caf8156 100644 --- a/manual/startup.texi +++ b/manual/startup.texi @@ -135,8 +135,8 @@ other words, the whitespace separating them is optional.) Thus, @item Options typically precede other non-option arguments. -The implementations of @code{getopt} and @code{argp_parse} in the GNU C -library normally make it appear as if all the option arguments were +The implementations of @code{getopt} and @code{argp_parse} in @theglibc{} +normally make it appear as if all the option arguments were specified before all the non-option arguments for the purposes of parsing, even if the user of your program intermixed option and non-option arguments. They do this by reordering the elements of the @@ -319,7 +319,7 @@ can be safely used in multi-threaded programs @deftypefun {char *} getenv (const char *@var{name}) This function returns a string that is the value of the environment variable @var{name}. You must not modify this string. In some non-Unix -systems not using the GNU library, it might be overwritten by subsequent +systems not using @theglibc{}, it might be overwritten by subsequent calls to @code{getenv} (but not by any other library function). If the environment variable @var{name} is not defined, the value is a null pointer. @@ -591,30 +591,30 @@ A system call is a request for service that a program makes of the kernel. The service is generally something that only the kernel has the privilege to do, such as doing I/O. Programmers don't normally need to be concerned with system calls because there are functions in -the GNU C library to do virtually everything that system calls do. +@theglibc{} to do virtually everything that system calls do. These functions work by making system calls themselves. For example, there is a system call that changes the permissions of a file, but -you don't need to know about it because you can just use the GNU C -library's @code{chmod} function. +you don't need to know about it because you can just use @theglibc{}'s +@code{chmod} function. @cindex kernel call System calls are sometimes called kernel calls. However, there are times when you want to make a system call explicitly, -and for that, the GNU C library provides the @code{syscall} function. +and for that, @theglibc{} provides the @code{syscall} function. @code{syscall} is harder to use and less portable than functions like @code{chmod}, but easier and more portable than coding the system call in assembler instructions. @code{syscall} is most useful when you are working with a system call -which is special to your system or is newer than the GNU C library you +which is special to your system or is newer than @theglibc{} you are using. @code{syscall} is implemented in an entirely generic way; the function does not know anything about what a particular system call does or even if it is valid. The description of @code{syscall} in this section assumes a certain -protocol for system calls on the various platforms on which the GNU C -library runs. That protocol is not defined by any strong authority, but +protocol for system calls on the various platforms on which @theglibc{} +runs. That protocol is not defined by any strong authority, but we won't describe it here either because anyone who is coding @code{syscall} probably won't accept anything less than kernel and C library source code as a specification of the interface between them @@ -864,7 +864,7 @@ pointer @var{arg}. At normal program termination, the @var{function} is called with two arguments: the @var{status} value passed to @code{exit}, and the @var{arg}. -This function is included in the GNU C library only for compatibility +This function is included in @theglibc{} only for compatibility for SunOS, and may not be supported by other implementations. @end deftypefun diff --git a/manual/stdio.texi b/manual/stdio.texi index 2f27e31..dd4d064 100644 --- a/manual/stdio.texi +++ b/manual/stdio.texi @@ -116,7 +116,7 @@ shell. (The primitives shells use to implement these facilities are described in @ref{File System Interface}.) Most other operating systems provide similar mechanisms, but the details of how to use them can vary. -In the GNU C library, @code{stdin}, @code{stdout}, and @code{stderr} are +In @theglibc{}, @code{stdin}, @code{stdout}, and @code{stderr} are normal variables which you can set just like any others. For example, to redirect the standard output to a file, you could do: @@ -196,7 +196,7 @@ Additional characters may appear after these to specify flags for the call. Always put the mode (@samp{r}, @samp{w+}, etc.) first; that is the only part you are guaranteed will be understood by all systems. -The GNU C library defines one additional character for use in +@Theglibc{} defines one additional character for use in @var{opentype}: the character @samp{x} insists on creating a new file---if a file @var{filename} already exists, @code{fopen} fails rather than opening it. If you use @samp{x} you are guaranteed that @@ -290,7 +290,7 @@ If the operation fails, a null pointer is returned; otherwise, @code{freopen} has traditionally been used to connect a standard stream such as @code{stdin} with a file of your own choice. This is useful in programs in which use of a standard stream for certain purposes is -hard-coded. In the GNU C library, you can simply close the standard +hard-coded. In @theglibc{}, you can simply close the standard streams and open new ones with @code{fopen}. But other systems lack this ability, so using @code{freopen} is more portable. @@ -318,7 +318,7 @@ In some situations it is useful to know whether a given stream is available for reading or writing. This information is normally not available and would have to be remembered separately. Solaris introduced a few functions to get this information from the stream -descriptor and these functions are also available in the GNU C library. +descriptor and these functions are also available in @theglibc{}. @comment stdio_ext.h @comment GNU @@ -394,7 +394,7 @@ you are using NFS. The function @code{fclose} is declared in @file{stdio.h}. @end deftypefun -To close all streams currently available the GNU C Library provides +To close all streams currently available @theglibc{} provides another function. @comment stdio.h @@ -562,7 +562,7 @@ conservative and use locking. There are two basic mechanisms to avoid locking. The first is to use the @code{_unlocked} variants of the stream operations. The POSIX -standard defines quite a few of those and the GNU library adds a few +standard defines quite a few of those and @theglibc{} adds a few more. These variants of the functions behave just like the functions with the name without the suffix except that they do not lock the stream. Using these functions is very desirable since they are @@ -598,7 +598,7 @@ the loop terminates. Writing it the way illustrated above allows the manipulation of the buffer of the stream. A second way to avoid locking is by using a non-standard function which -was introduced in Solaris and is available in the GNU C library as well. +was introduced in Solaris and is available in @theglibc{} as well. @comment stdio_ext.h @comment GNU @@ -1143,7 +1143,7 @@ convenient to have functions to read a line of text from a stream. Standard C has functions to do this, but they aren't very safe: null characters and even (for @code{gets}) long lines can confuse them. So -the GNU library provides the nonstandard @code{getline} function that +@theglibc{} provides the nonstandard @code{getline} function that makes it easy to read lines reliably. Another GNU extension, @code{getdelim}, generalizes @code{getline}. It @@ -1289,7 +1289,7 @@ returns a null pointer; otherwise it returns @var{s}. @strong{Warning:} The @code{gets} function is @strong{very dangerous} because it provides no protection against overflowing the string -@var{s}. The GNU library includes it for compatibility only. You +@var{s}. @Theglibc{} includes it for compatibility only. You should @strong{always} use @code{fgets} or @code{getline} instead. To remind you of this, the linker (if using GNU @code{ld}) will issue a warning whenever you use @code{gets}. @@ -1383,10 +1383,10 @@ character that was actually read from the stream. In fact, it isn't necessary to actually read any characters from the stream before unreading them with @code{ungetc}! But that is a strange way to write a program; usually @code{ungetc} is used only to unread a character that -was just read from the same stream. The GNU C library supports this +was just read from the same stream. @Theglibc{} supports this even on files opened in binary mode, but other systems might not. -The GNU C library only supports one character of pushback---in other +@Theglibc{} only supports one character of pushback---in other words, it does not work to call @code{ungetc} twice without doing input in between. Other systems might let you push back multiple characters; then reading from the stream retrieves the characters in the reverse @@ -1658,7 +1658,7 @@ actual value in effect at runtime can be retrieved by using Definition}. Some system have a quite low limit such as @math{9} for @w{System V} -systems. The GNU C library has no real limit. +systems. @Theglibc{} has no real limit. @end defvr If any of the formats has a specification for the parameter position all @@ -2149,7 +2149,7 @@ prints @samp{ nowhere }. If there is a @samp{l} modifier present the argument is expected to be of type @code{wchar_t} (or @code{const wchar_t *}). If you accidentally pass a null pointer as the argument for a @samp{%s} -conversion, the GNU library prints it as @samp{(null)}. We think this +conversion, @theglibc{} prints it as @samp{(null)}. We think this is more useful than crashing. But it's not good practice to pass a null argument intentionally. @@ -2168,7 +2168,7 @@ fprintf (stderr, "can't open `%s': %s\n", filename, strerror (errno)); @end smallexample @noindent -The @samp{%m} conversion is a GNU C library extension. +The @samp{%m} conversion is a @glibcadj{} extension. The @samp{%p} conversion prints a pointer value. The corresponding argument must be of type @code{void *}. In practice, you can use any @@ -2371,7 +2371,7 @@ make_message (char *name, char *value) In practice, it is often easier just to use @code{asprintf}, below. -@strong{Attention:} In versions of the GNU C library prior to 2.1 the +@strong{Attention:} In versions of @theglibc{} prior to 2.1 the return value is the number of characters stored, not including the terminating null; unless there was not enough space in @var{s} to store the result in which case @code{-1} is returned. This was @@ -2814,7 +2814,7 @@ validate_args (char *format, int nargs, OBJECT *args) @cindex defining new @code{printf} conversions @cindex extending @code{printf} -The GNU C library lets you define your own custom conversion specifiers +@Theglibc{} lets you define your own custom conversion specifiers for @code{printf} template strings, to teach @code{printf} clever ways to print the important data structures of your program. @@ -2887,7 +2887,7 @@ about this. @c but if you are never going to call @code{parse_printf_format}, you do @c not need to define an arginfo function. -@strong{Attention:} In the GNU C library versions before 2.0 the +@strong{Attention:} In @theglibc{} versions before 2.0 the @var{arginfo-function} function did not need to be installed unless the user used the @code{parse_printf_format} function. This has changed. Now a call to any of the @code{printf} functions will call this @@ -3000,7 +3000,7 @@ width. The value is @code{'0'} if the @samp{0} flag was specified, and Now let's look at how to define the handler and arginfo functions which are passed as arguments to @code{register_printf_function}. -@strong{Compatibility Note:} The interface changed in GNU libc +@strong{Compatibility Note:} The interface changed in @theglibc{} version 2.0. Previously the third argument was of type @code{va_list *}. @@ -3098,7 +3098,7 @@ The output produced by this program looks like: @node Predefined Printf Handlers @subsection Predefined @code{printf} Handlers -The GNU libc also contains a concrete and useful application of the +@Theglibc{} also contains a concrete and useful application of the @code{printf} handler extension. There are two functions available which implement a special way to print floating-point numbers. @@ -3926,7 +3926,7 @@ previous I/O operation on that stream. @deftypevr Macro int EOF This macro is an integer value that is returned by a number of narrow stream functions to indicate an end-of-file condition, or some other -error situation. With the GNU library, @code{EOF} is @code{-1}. In +error situation. With @theglibc{}, @code{EOF} is @code{-1}. In other libraries, its value may be some other negative number. This symbol is declared in @file{stdio.h}. @@ -3937,7 +3937,7 @@ This symbol is declared in @file{stdio.h}. @deftypevr Macro int WEOF This macro is an integer value that is returned by a number of wide stream functions to indicate an end-of-file condition, or some other -error situation. With the GNU library, @code{WEOF} is @code{-1}. In +error situation. With @theglibc{}, @code{WEOF} is @code{-1}. In other libraries, its value may be some other negative number. This symbol is declared in @file{wchar.h}. @@ -4094,7 +4094,7 @@ systems, text and binary streams use different file formats, and the only way to read or write ``an ordinary file of text'' that can work with other text-oriented programs is through a text stream. -In the GNU library, and on all POSIX systems, there is no difference +In @theglibc{}, and on all POSIX systems, there is no difference between text streams and binary streams. When you open a stream, you get the same kind of stream regardless of whether you ask for binary. This stream can handle any file content, and has none of the @@ -4562,7 +4562,7 @@ necessary since it might be done in situations when terminal input is required and the program wants to be sure that all output is visible on the terminal. But this means that only line buffered streams have to be flushed. Solaris introduced a function especially for this. It was -always available in the GNU C library in some form but never officially +always available in @theglibc{} in some form but never officially exported. @comment stdio_ext.h @@ -4584,7 +4584,7 @@ In some situations it might be useful to not flush the output pending for a stream but instead simply forget it. If transmission is costly and the output is not needed anymore this is valid reasoning. In this situation a non-standard function introduced in Solaris and available in -the GNU C library can be used. +@theglibc{} can be used. @comment stdio_ext.h @comment GNU @@ -4722,8 +4722,8 @@ This function is provided for compatibility with old BSD code. Use @end deftypefun It is possible to query whether a given stream is line buffered or not -using a non-standard function introduced in Solaris and available in the -GNU C library. +using a non-standard function introduced in Solaris and available in +@theglibc{}. @comment stdio_ext.h @comment GNU @@ -4762,7 +4762,7 @@ This function is declared in the @file{stdio_ext.h} header. @node Other Kinds of Streams @section Other Kinds of Streams -The GNU library provides ways for you to define additional kinds of +@Theglibc{} provides ways for you to define additional kinds of streams that do not necessarily correspond to an open file. One such type of stream takes input from or writes output to a string. diff --git a/manual/string.texi b/manual/string.texi index e02c17f..af21bcc 100644 --- a/manual/string.texi +++ b/manual/string.texi @@ -3,7 +3,7 @@ @chapter String and Array Utilities Operations on strings (or arrays of characters) are an important part of -many programs. The GNU C library provides an extensive set of string +many programs. @Theglibc{} provides an extensive set of string utility functions, including functions for copying, concatenating, comparing, and searching strings. Many of these functions can also operate on arbitrary regions of storage; for example, the @code{memcpy} @@ -669,7 +669,7 @@ the end of the string @var{wto} (that is, the address of the terminating null character @code{wto + strlen (wfrom)}) rather than the beginning. This function is not part of ISO or POSIX but was found useful while -developing the GNU C Library itself. +developing @theglibc{} itself. The behavior of @code{wcpcpy} is undefined if the strings overlap. @@ -695,7 +695,7 @@ is implemented to be useful in contexts where this behavior of the @emph{first} written null character. This function is not part of ISO or POSIX but was found useful while -developing the GNU C Library itself. +developing @theglibc{} itself. Its behavior is undefined if the strings overlap. The function is declared in @file{string.h}. @@ -721,7 +721,7 @@ is implemented to be useful in contexts where this behavior of the @emph{first} written null character. This function is not part of ISO or POSIX but was found useful while -developing the GNU C Library itself. +developing @theglibc{} itself. Its behavior is undefined if the strings overlap. @@ -1712,7 +1712,7 @@ There is no restriction on the second parameter of @code{strchr} so it could very well also be the NUL character. Those readers thinking very hard about this might now point out that the @code{strchr} function is more expensive than the @code{strlen} function since we have two abort -criteria. This is right. But in the GNU C library the implementation of +criteria. This is right. But in @theglibc{} the implementation of @code{strchr} is optimized in a special way so that @code{strchr} actually is faster. @@ -2027,7 +2027,7 @@ when @code{strtok} or @code{wcstok} tries to modify it, your program will get a fatal signal for writing in read-only memory. @xref{Program Error Signals}. Even if the operation of @code{strtok} or @code{wcstok} would not require a modification of the string (e.g., if there is -exactly one token) the string can (and in the GNU libc case will) be +exactly one token) the string can (and in the @glibcadj{} case will) be modified. This is a special case of a general principle: if a part of a program @@ -2064,7 +2064,7 @@ token = strtok (NULL, delimiters); /* token => "punctuation" */ token = strtok (NULL, delimiters); /* token => NULL */ @end smallexample -The GNU C library contains two more functions for tokenizing a string +@Theglibc{} contains two more functions for tokenizing a string which overcome the limitation of non-reentrancy. They are only available for multibyte character strings. @@ -2220,8 +2220,8 @@ function can be found in @file{libgen.h}. The function below addresses the perennial programming quandary: ``How do I take good data in string form and painlessly turn it into garbage?'' This is actually a fairly simple task for C programmers who do not use -the GNU C library string functions, but for programs based on the GNU C -library, the @code{strfry} function is the preferred method for +@theglibc{} string functions, but for programs based on @theglibc{}, +the @code{strfry} function is the preferred method for destroying string data. The prototype for this function is in @file{string.h}. @@ -2237,7 +2237,7 @@ input with the anagram in place. For each position in the string, The return value of @code{strfry} is always @var{string}. -@strong{Portability Note:} This function is unique to the GNU C library. +@strong{Portability Note:} This function is unique to @theglibc{}. @end deftypefun @@ -2278,7 +2278,7 @@ want to see it or doesn't want to see it very much. To really prevent people from retrieving the information, use stronger encryption such as that described in @xref{Cryptographic Functions}. -@strong{Portability Note:} This function is unique to the GNU C library. +@strong{Portability Note:} This function is unique to @theglibc{}. @end deftypefun diff --git a/manual/sysinfo.texi b/manual/sysinfo.texi index bf8b138..1733bc3 100644 --- a/manual/sysinfo.texi +++ b/manual/sysinfo.texi @@ -97,7 +97,7 @@ this array, in bytes. Note that this is @emph{not} the DNS hostname. If the system participates in DNS, this is the FQDN (see above). The return value is @code{0} on success and @code{-1} on failure. In -the GNU C library, @code{gethostname} fails if @var{size} is not large +@theglibc{}, @code{gethostname} fails if @var{size} is not large enough; then you can try again with a larger array. The following @code{errno} error condition is defined for this function: @@ -251,8 +251,8 @@ system. This is a description of the type of hardware that is in use. Some systems provide a mechanism to interrogate the kernel directly for -this information. On systems without such a mechanism, the GNU C -library fills in this field based on the configuration name that was +this information. On systems without such a mechanism, @theglibc{} +fills in this field based on the configuration name that was specified when building and installing the library. GNU uses a three-part name to describe a system configuration; the three @@ -276,8 +276,8 @@ hardware, it consists of the first two parts of the configuration name: @end quotation @item char nodename[] -This is the host name of this particular computer. In the GNU C -library, the value is the same as that returned by @code{gethostname}; +This is the host name of this particular computer. In @theglibc{}, +the value is the same as that returned by @code{gethostname}; see @ref{Host Identification}. @ gethostname() is implemented with a call to uname(). @@ -344,7 +344,7 @@ gets stored. For some programs it is desirable and necessary to access information about whether a certain filesystem is mounted and, if it is, where, or -simply to get lists of all the available filesystems. The GNU libc +simply to get lists of all the available filesystems. @Theglibc{} provides some functions to retrieve this information portably. Traditionally Unix systems have a file named @file{/etc/fstab} which @@ -465,7 +465,7 @@ related to the @code{dump} utility used on Unix systems. @end deftp -To read the entire content of the of the @file{fstab} file the GNU libc +To read the entire content of the of the @file{fstab} file @theglibc{} contains a set of three functions which are designed in the usual way. @comment fstab.h @@ -634,8 +634,8 @@ which is uninteresting for all programs beside @code{dump}. For accessing the @file{mtab} file there is again a set of three functions to access all entries in a row. Unlike the functions to handle @file{fstab} these functions do not access a fixed file and there -is even a thread safe variant of the get function. Beside this the GNU -libc contains functions to alter the file and test for specific options. +is even a thread safe variant of the get function. Beside this @theglibc +contains functions to alter the file and test for specific options. @comment mntent.h @comment BSD @@ -1184,7 +1184,7 @@ cat /proc/sys/vm/freepages @c possible to create a sysctl-only parameter. Some more traditional and more widely available, though less general, -GNU C library functions for getting and setting some of the same system +@glibcadj{} functions for getting and setting some of the same system parameters are: @itemize @bullet diff --git a/manual/syslog.texi b/manual/syslog.texi index 4699978..6d338ec 100644 --- a/manual/syslog.texi +++ b/manual/syslog.texi @@ -107,11 +107,11 @@ Syslog facility/priority (It can be both because the facility code for the kernel is zero, and that makes priority and facility/priority the same value). -The GNU C library provides functions to submit messages to Syslog. They +@Theglibc{} provides functions to submit messages to Syslog. They do it by writing to the @file{/dev/log} socket. @xref{Submitting Syslog Messages}. -The GNU C library functions only work to submit messages to the Syslog +The @glibcadj{} functions only work to submit messages to the Syslog facility on the same system. To submit a message to the Syslog facility on another system, use the socket I/O functions to write a UDP datagram to the @code{syslog} UDP port on that system. @xref{Sockets}. @@ -120,7 +120,7 @@ to the @code{syslog} UDP port on that system. @xref{Sockets}. @node Submitting Syslog Messages @section Submitting Syslog Messages -The GNU C library provides functions to submit messages to the Syslog +@Theglibc{} provides functions to submit messages to the Syslog facility: @menu @@ -341,7 +341,7 @@ Results are undefined if the facility code is anything else. the kernel. But you can't specify that facility code with these functions. If you try, it looks the same to @code{syslog} as if you are requesting the default facility. But you wouldn't want to anyway, -because any program that uses the GNU C library is not the kernel. +because any program that uses @theglibc{} is not the kernel. You can use just a priority code as @var{facility_priority}. In that case, @code{syslog} assumes the default facility established when the @@ -429,8 +429,8 @@ to @var{ident}. The default identification string is the program name taken from argv[0]. If you are writing shared library code that uses @code{openlog} to -generate custom syslog output, you should use @code{closelog} to drop the -GNU C library's internal reference to the @var{ident} pointer when you are +generate custom syslog output, you should use @code{closelog} to drop +@theglibc{}'s internal reference to the @var{ident} pointer when you are done. Please read the section on @code{openlog} for more information: @xref{openlog}. diff --git a/manual/terminal.texi b/manual/terminal.texi index db7780f..c93082d 100644 --- a/manual/terminal.texi +++ b/manual/terminal.texi @@ -1068,7 +1068,7 @@ which device you plan to set the speed for. If you use @code{tcsetattr} to set the speed of a particular device to a value that it cannot handle, @code{tcsetattr} returns @math{-1}. -@strong{Portability note:} In the GNU library, the functions above +@strong{Portability note:} In @theglibc{}, the functions above accept speeds measured in bits per second as input, and return speed values measured in bits per second. Other libraries require speeds to be indicated by special codes. For POSIX.1 portability, you must use @@ -1612,7 +1612,7 @@ system for a subsequent call to @code{read}. actually the same as the EOF and EOL slots. This causes no serious problem because the MIN and TIME slots are used only in noncanonical input and the EOF and EOL slots are used only in canonical input, but it -isn't very clean. The GNU library allocates separate slots for these +isn't very clean. @Theglibc{} allocates separate slots for these uses. @comment termios.h @@ -1642,7 +1642,7 @@ It does exactly this: The usual way to get and set terminal modes is with the functions described in @ref{Terminal Modes}. However, on some systems you can use the BSD-derived functions in this section to do some of the same thing. On -many systems, these functions do not exist. Even with the GNU C library, +many systems, these functions do not exist. Even with @theglibc{}, the functions simply fail with @code{errno} = @code{ENOSYS} with many kernels, including Linux. diff --git a/manual/time.texi b/manual/time.texi index f1f4254..a2e11a1 100644 --- a/manual/time.texi +++ b/manual/time.texi @@ -89,8 +89,8 @@ other systems, the @code{time_t} data type might use some other encoding where subtraction doesn't work directly. @end deftypefun -The GNU C library provides two data types specifically for representing -an elapsed time. They are used by various GNU C library functions, and +@Theglibc{} provides two data types specifically for representing +an elapsed time. They are used by various @glibcadj{} functions, and you can use them for your own purposes too. They're exactly the same except that one has a resolution in microseconds, and the other, newer one, is in nanoseconds. @@ -139,41 +139,14 @@ this. It works even on some peculiar operating systems where the @code{tv_sec} member has an unsigned type. @smallexample -/* @r{Subtract the `struct timeval' values X and Y,} - @r{storing the result in RESULT.} - @r{Return 1 if the difference is negative, otherwise 0.} */ - -int -timeval_subtract (result, x, y) - struct timeval *result, *x, *y; -@{ - /* @r{Perform the carry for the later subtraction by updating @var{y}.} */ - if (x->tv_usec < y->tv_usec) @{ - int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; - y->tv_usec -= 1000000 * nsec; - y->tv_sec += nsec; - @} - if (x->tv_usec - y->tv_usec > 1000000) @{ - int nsec = (x->tv_usec - y->tv_usec) / 1000000; - y->tv_usec += 1000000 * nsec; - y->tv_sec -= nsec; - @} - - /* @r{Compute the time remaining to wait.} - @r{@code{tv_usec} is certainly positive.} */ - result->tv_sec = x->tv_sec - y->tv_sec; - result->tv_usec = x->tv_usec - y->tv_usec; - - /* @r{Return 1 if result is negative.} */ - return x->tv_sec < y->tv_sec; -@} +@include timeval_subtract.c.texi @end smallexample Common functions that use @code{struct timeval} are @code{gettimeofday} and @code{settimeofday}. -There are no GNU C library functions specifically oriented toward +There are no @glibcadj{} functions specifically oriented toward dealing with elapsed times, but the calendar time, processor time, and alarm and sleeping functions have a lot to do with them. @@ -356,7 +329,7 @@ and @code{tms_stime} fields returned by @code{times}. This section describes facilities for keeping track of calendar time. @xref{Time Basics}. -The GNU C library represents calendar time three ways: +@Theglibc{} represents calendar time three ways: @itemize @bullet @item @@ -423,7 +396,7 @@ Note that a simple time has no concept of local time zone. Calendar Time @var{T} is the same instant in time regardless of where on the globe the computer is. -In the GNU C library, @code{time_t} is equivalent to @code{long int}. +In @theglibc{}, @code{time_t} is equivalent to @code{long int}. In other systems, @code{time_t} might be either an integer or floating-point type. @end deftp @@ -474,7 +447,7 @@ The process is not superuser. The @code{time_t} data type used to represent simple times has a resolution of only one second. Some applications need more precision. -So, the GNU C library also contains functions which are capable of +So, @theglibc{} also contains functions which are capable of representing calendar times to a higher resolution than one second. The functions and the associated data types described in this section are declared in @file{sys/time.h}. @@ -616,7 +589,7 @@ This function is present only with a Linux kernel. @cindex broken-down time @cindex calendar time and broken-down time -Calendar time is represented by the usual GNU C library functions as an +Calendar time is represented by the usual @glibcadj{} functions as an elapsed time since a fixed base calendar time. This is convenient for computation, but has no relation to the way people normally think of calendar time. By contrast, @dfn{broken-down time} is a binary @@ -1018,7 +991,7 @@ The process specified a settings update, but is not superuser. For more details see RFC1305 (Network Time Protocol, Version 3) and related documents. -@strong{Portability note:} Early versions of the GNU C library did not +@strong{Portability note:} Early versions of @theglibc{} did not have this function but did have the synonymous @code{adjtimex}. @end deftypefun @@ -1775,7 +1748,7 @@ which can match zero or more whitespace characters in the format string. @strong{Portability Note:} The XPG standard advises applications to use at least one whitespace character (as specified by @code{isspace}) or other non-alphanumeric characters between any two conversion -specifications. The @w{GNU C Library} does not have this limitation but +specifications. @Theglibc{} does not have this limitation but other libraries might have trouble parsing formats like @code{"%d%m%Y%H%M%S"}. @@ -1800,7 +1773,7 @@ does not specify what happens to those elements of @var{tm} which are not directly initialized by the different formats. The implementations on different Unix systems vary here. -The GNU libc implementation does not touch those fields which are not +The @glibcadj{} implementation does not touch those fields which are not directly initialized. Exceptions are the @code{tm_wday} and @code{tm_yday} elements, which are recomputed if any of the year, month, or date elements changed. This has two implications: @@ -2036,7 +2009,7 @@ different time zone, and would like times reported to you in the time zone local to you, rather than what is local to the computer. In POSIX.1 systems the value of the @code{TZ} variable can be in one of -three formats. With the GNU C library, the most common format is the +three formats. With @theglibc{}, the most common format is the last one, which can specify a selection from a large database of time zone information for many regions of the world. The first two formats are used to describe the time zone information directly, which is both @@ -2137,16 +2110,16 @@ The third format looks like this: :@var{characters} @end smallexample -Each operating system interprets this format differently; in the GNU C -library, @var{characters} is the name of a file which describes the time +Each operating system interprets this format differently; in +@theglibc{}, @var{characters} is the name of a file which describes the time zone. @pindex /etc/localtime @pindex localtime If the @code{TZ} environment variable does not have a value, the -operation chooses a time zone by default. In the GNU C library, the +operation chooses a time zone by default. In @theglibc{}, the default time zone is like the specification @samp{TZ=:/etc/localtime} -(or @samp{TZ=:/usr/local/etc/localtime}, depending on how GNU C library +(or @samp{TZ=:/usr/local/etc/localtime}, depending on how @theglibc{} was configured; @pxref{Installation}). Other C libraries use their own rule for choosing the default time zone, so there is little we can say about them. @@ -2163,7 +2136,7 @@ subdirectories for geographical areas; for example, @file{America/New_York}, @file{Europe/London}, @file{Asia/Hong_Kong}. These data files are installed by the system administrator, who also sets @file{/etc/localtime} to point to the data file for the local time -zone. The GNU C library comes with a large database of time zone +zone. @Theglibc{} comes with a large database of time zone information for most regions of the world, which is maintained by a community of volunteers and put in the public domain. diff --git a/manual/users.texi b/manual/users.texi index bdc2d68..819d35f 100644 --- a/manual/users.texi +++ b/manual/users.texi @@ -207,15 +207,15 @@ facilities, you must include the header files @file{sys/types.h} and @comment sys/types.h @comment POSIX.1 @deftp {Data Type} uid_t -This is an integer data type used to represent user IDs. In the GNU -library, this is an alias for @code{unsigned int}. +This is an integer data type used to represent user IDs. In +@theglibc{}, this is an alias for @code{unsigned int}. @end deftp @comment sys/types.h @comment POSIX.1 @deftp {Data Type} gid_t -This is an integer data type used to represent group IDs. In the GNU -library, this is an alias for @code{unsigned int}. +This is an integer data type used to represent group IDs. In +@theglibc{}, this is an alias for @code{unsigned int}. @end deftp @comment unistd.h @@ -1118,7 +1118,7 @@ the user accounting database. All the @code{get*} functions mentioned before store the information they return in a static buffer. This can be a problem in multi-threaded programs since the data returned for the request is overwritten by the -return value data in another thread. Therefore the GNU C Library +return value data in another thread. Therefore @theglibc{} provides as extensions three more functions which return the data in a user-provided buffer. @@ -1202,7 +1202,7 @@ therefore the return value does not say anything about whether the database can be successfully opened. @end deftypefun -Specially for maintaining log-like databases the GNU C Library provides +Specially for maintaining log-like databases @theglibc{} provides the following function: @comment utmp.h @@ -1941,7 +1941,7 @@ without loops. Sun's implementation allows netgroups only for the @code{nis} or @code{nisplus} service, @pxref{Services in the NSS configuration}. The -implementation in the GNU C library has no such restriction. An entry +implementation in @theglibc{} has no such restriction. An entry in either of the input services must have the following form: @smallexample diff --git a/math/libm-test.inc b/math/libm-test.inc index 1016753..9bdbc4c 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -2017,6 +2017,142 @@ cos_test (void) static void +cos_test_tonearest (void) +{ + int save_round_mode; + errno = 0; + FUNC(cos) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (cos_tonearest); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TONEAREST)) + { + TEST_f_f (cos, 1, 0.5403023058681397174009366074429766037323L); + TEST_f_f (cos, 2, -0.4161468365471423869975682295007621897660L); + TEST_f_f (cos, 3, -0.9899924966004454572715727947312613023937L); + TEST_f_f (cos, 4, -0.6536436208636119146391681830977503814241L); + TEST_f_f (cos, 5, 0.2836621854632262644666391715135573083344L); + TEST_f_f (cos, 6, 0.9601702866503660205456522979229244054519L); + TEST_f_f (cos, 7, 0.7539022543433046381411975217191820122183L); + TEST_f_f (cos, 8, -0.1455000338086135258688413818311946826093L); + TEST_f_f (cos, 9, -0.9111302618846769883682947111811653112463L); + TEST_f_f (cos, 10, -0.8390715290764524522588639478240648345199L); + } + + fesetround (save_round_mode); + + END (cos_tonearest); +} + + +static void +cos_test_towardzero (void) +{ + int save_round_mode; + errno = 0; + FUNC(cos) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (cos_towardzero); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TOWARDZERO)) + { + TEST_f_f (cos, 1, 0.5403023058681397174009366074429766037323L); + TEST_f_f (cos, 2, -0.4161468365471423869975682295007621897660L); + TEST_f_f (cos, 3, -0.9899924966004454572715727947312613023937L); + TEST_f_f (cos, 4, -0.6536436208636119146391681830977503814241L); + TEST_f_f (cos, 5, 0.2836621854632262644666391715135573083344L); + TEST_f_f (cos, 6, 0.9601702866503660205456522979229244054519L); + TEST_f_f (cos, 7, 0.7539022543433046381411975217191820122183L); + TEST_f_f (cos, 8, -0.1455000338086135258688413818311946826093L); + TEST_f_f (cos, 9, -0.9111302618846769883682947111811653112463L); + TEST_f_f (cos, 10, -0.8390715290764524522588639478240648345199L); + } + + fesetround (save_round_mode); + + END (cos_towardzero); +} + + +static void +cos_test_downward (void) +{ + int save_round_mode; + errno = 0; + FUNC(cos) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (cos_downward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_DOWNWARD)) + { + TEST_f_f (cos, 1, 0.5403023058681397174009366074429766037323L); + TEST_f_f (cos, 2, -0.4161468365471423869975682295007621897660L); + TEST_f_f (cos, 3, -0.9899924966004454572715727947312613023937L); + TEST_f_f (cos, 4, -0.6536436208636119146391681830977503814241L); + TEST_f_f (cos, 5, 0.2836621854632262644666391715135573083344L); + TEST_f_f (cos, 6, 0.9601702866503660205456522979229244054519L); + TEST_f_f (cos, 7, 0.7539022543433046381411975217191820122183L); + TEST_f_f (cos, 8, -0.1455000338086135258688413818311946826093L); + TEST_f_f (cos, 9, -0.9111302618846769883682947111811653112463L); + TEST_f_f (cos, 10, -0.8390715290764524522588639478240648345199L); + } + + fesetround (save_round_mode); + + END (cos_downward); +} + + +static void +cos_test_upward (void) +{ + int save_round_mode; + errno = 0; + FUNC(cos) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (cos_upward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_UPWARD)) + { + TEST_f_f (cos, 1, 0.5403023058681397174009366074429766037323L); + TEST_f_f (cos, 2, -0.4161468365471423869975682295007621897660L); + TEST_f_f (cos, 3, -0.9899924966004454572715727947312613023937L); + TEST_f_f (cos, 4, -0.6536436208636119146391681830977503814241L); + TEST_f_f (cos, 5, 0.2836621854632262644666391715135573083344L); + TEST_f_f (cos, 6, 0.9601702866503660205456522979229244054519L); + TEST_f_f (cos, 7, 0.7539022543433046381411975217191820122183L); + TEST_f_f (cos, 8, -0.1455000338086135258688413818311946826093L); + TEST_f_f (cos, 9, -0.9111302618846769883682947111811653112463L); + TEST_f_f (cos, 10, -0.8390715290764524522588639478240648345199L); + } + + fesetround (save_round_mode); + + END (cos_upward); +} + + +static void cosh_test (void) { errno = 0; @@ -2042,6 +2178,114 @@ cosh_test (void) static void +cosh_test_tonearest (void) +{ + int save_round_mode; + errno = 0; + FUNC(cosh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (cosh_tonearest); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TONEAREST)) + { + TEST_f_f (cosh, 22, 1792456423.065795780980053377632656584997L); + TEST_f_f (cosh, 23, 4872401723.124451300068625740569997090344L); + TEST_f_f (cosh, 24, 13244561064.92173614708845674912733665919L); + } + + fesetround (save_round_mode); + + END (cosh_tonearest); +} + + +static void +cosh_test_towardzero (void) +{ + int save_round_mode; + errno = 0; + FUNC(cosh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (cosh_towardzero); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TOWARDZERO)) + { + TEST_f_f (cosh, 22, 1792456423.065795780980053377632656584997L); + TEST_f_f (cosh, 23, 4872401723.124451300068625740569997090344L); + TEST_f_f (cosh, 24, 13244561064.92173614708845674912733665919L); + } + + fesetround (save_round_mode); + + END (cosh_towardzero); +} + + +static void +cosh_test_downward (void) +{ + int save_round_mode; + errno = 0; + FUNC(cosh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (cosh_downward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_DOWNWARD)) + { + TEST_f_f (cosh, 22, 1792456423.065795780980053377632656584997L); + TEST_f_f (cosh, 23, 4872401723.124451300068625740569997090344L); + TEST_f_f (cosh, 24, 13244561064.92173614708845674912733665919L); + } + + fesetround (save_round_mode); + + END (cosh_downward); +} + + +static void +cosh_test_upward (void) +{ + int save_round_mode; + errno = 0; + FUNC(cosh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (cosh_upward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_UPWARD)) + { + TEST_f_f (cosh, 22, 1792456423.065795780980053377632656584997L); + TEST_f_f (cosh, 23, 4872401723.124451300068625740569997090344L); + TEST_f_f (cosh, 24, 13244561064.92173614708845674912733665919L); + } + + fesetround (save_round_mode); + + END (cosh_upward); +} + + +static void cpow_test (void) { errno = 0; @@ -2478,12 +2722,18 @@ erfc_test (void) TEST_f_f (erfc, 0.75L, 0.288844366346484868401062165408589223L); TEST_f_f (erfc, 1.25L, 0.0770998717435417698634765188027188596L); TEST_f_f (erfc, 2.0L, 0.00467773498104726583793074363274707139L); + TEST_f_f (erfc, 0x1.f7303cp+1L, 2.705500297238986897105236321218861842255e-8L); TEST_f_f (erfc, 4.125L, 0.542340079956506600531223408575531062e-8L); + TEST_f_f (erfc, 0x1.ffa002p+2L, 1.233585992097580296336099501489175967033e-29L); + TEST_f_f (erfc, 0x1.ffffc8p+2L, 1.122671365033056305522366683719541099329e-29L); #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 +# if LDBL_MANT_DIG >= 106 + TEST_f_f (erfc, 0x1.ffff56789abcdef0123456789a8p+2L, 1.123161416304655390092138725253789378459e-29L); +# endif #endif END (erfc); @@ -2526,6 +2776,114 @@ exp_test (void) static void +exp_test_tonearest (void) +{ + int save_round_mode; + errno = 0; + FUNC(exp) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (exp_tonearest); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TONEAREST)) + { + TEST_f_f (exp, 1, M_El); + TEST_f_f (exp, 2, M_E2l); + TEST_f_f (exp, 3, M_E3l); + } + + fesetround (save_round_mode); + + END (exp_tonearest); +} + + +static void +exp_test_towardzero (void) +{ + int save_round_mode; + errno = 0; + FUNC(exp) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (exp_towardzero); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TOWARDZERO)) + { + TEST_f_f (exp, 1, M_El); + TEST_f_f (exp, 2, M_E2l); + TEST_f_f (exp, 3, M_E3l); + } + + fesetround (save_round_mode); + + END (exp_towardzero); +} + + +static void +exp_test_downward (void) +{ + int save_round_mode; + errno = 0; + FUNC(exp) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (exp_downward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_DOWNWARD)) + { + TEST_f_f (exp, 1, M_El); + TEST_f_f (exp, 2, M_E2l); + TEST_f_f (exp, 3, M_E3l); + } + + fesetround (save_round_mode); + + END (exp_downward); +} + + +static void +exp_test_upward (void) +{ + int save_round_mode; + errno = 0; + FUNC(exp) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (exp_upward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_UPWARD)) + { + TEST_f_f (exp, 1, M_El); + TEST_f_f (exp, 2, M_E2l); + TEST_f_f (exp, 3, M_E3l); + } + + fesetround (save_round_mode); + + END (exp_upward); +} + + +static void exp10_test (void) { errno = 0; @@ -2602,6 +2960,10 @@ expm1_test (void) TEST_f_f (expm1, 1, M_El - 1.0); TEST_f_f (expm1, 0.75L, 1.11700001661267466854536981983709561L); +#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384 + TEST_f_f (expm1, 11356.25L, 9.05128237311923300051376115753226014206e+4931L); +#endif + errno = 0; TEST_f_f (expm1, 100000.0, plus_infty); check_int ("errno for expm1(large) == ERANGE", errno, ERANGE, 0, 0, 0); @@ -4395,7 +4757,7 @@ lround_test (void) TEST_f_l (lround, 1073741824.01, 1073741824); # if LONG_MAX > 281474976710656 TEST_f_l (lround, 281474976710656.025, 281474976710656); - TEST_f_l (llround, -3.65309740835E17, -365309740835000000); + TEST_f_l (lround, 18014398509481974, 18014398509481974); # endif TEST_f_l (lround, 2097152.5, 2097153); TEST_f_l (lround, -2097152.5, -2097153); @@ -4438,6 +4800,7 @@ llround_test (void) TEST_f_L (llround, -2097152.5, -2097153); TEST_f_L (llround, 34359738368.5, 34359738369ll); TEST_f_L (llround, -34359738368.5, -34359738369ll); + TEST_f_L (llround, -3.65309740835E17, -365309740835000000LL); #endif /* Test boundary conditions. */ @@ -4955,6 +5318,111 @@ pow_test (void) END (pow); } + +static void +pow_test_tonearest (void) +{ + int save_round_mode; + errno = 0; + FUNC(pow) (0, 0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (pow_tonearest); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TONEAREST)) + { + TEST_ff_f (pow, 1.0625L, 1.125L, 1.070582293028761362162622578677070098674L); + TEST_ff_f (pow, 1.5L, 1.03125L, 1.519127098714743184071644334163037684948L); + } + + fesetround (save_round_mode); + + END (pow_tonearest); +} + + +static void +pow_test_towardzero (void) +{ + int save_round_mode; + errno = 0; + FUNC(pow) (0, 0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (pow_towardzero); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TOWARDZERO)) + { + TEST_ff_f (pow, 1.0625L, 1.125L, 1.070582293028761362162622578677070098674L); + TEST_ff_f (pow, 1.5L, 1.03125L, 1.519127098714743184071644334163037684948L); + } + + fesetround (save_round_mode); + + END (pow_towardzero); +} + + +static void +pow_test_downward (void) +{ + int save_round_mode; + errno = 0; + FUNC(pow) (0, 0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (pow_downward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_DOWNWARD)) + { + TEST_ff_f (pow, 1.0625L, 1.125L, 1.070582293028761362162622578677070098674L); + TEST_ff_f (pow, 1.5L, 1.03125L, 1.519127098714743184071644334163037684948L); + } + + fesetround (save_round_mode); + + END (pow_downward); +} + + +static void +pow_test_upward (void) +{ + int save_round_mode; + errno = 0; + FUNC(pow) (0, 0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (pow_upward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_UPWARD)) + { + TEST_ff_f (pow, 1.0625L, 1.125L, 1.070582293028761362162622578677070098674L); + TEST_ff_f (pow, 1.5L, 1.03125L, 1.519127098714743184071644334163037684948L); + } + + fesetround (save_round_mode); + + END (pow_upward); +} + + static void remainder_test (void) { @@ -5671,6 +6139,15 @@ scalbn_test (void) TEST_fi_f (scalbn, 1, 0L, 1); + TEST_fi_f (scalbn, 1, INT_MAX, plus_infty); + TEST_fi_f (scalbn, 1, INT_MIN, plus_zero); + TEST_fi_f (scalbn, max_value, INT_MAX, plus_infty); + TEST_fi_f (scalbn, max_value, INT_MIN, plus_zero); + TEST_fi_f (scalbn, min_value, INT_MAX, plus_infty); + TEST_fi_f (scalbn, min_value, INT_MIN, plus_zero); + TEST_fi_f (scalbn, min_value / 4, INT_MAX, plus_infty); + TEST_fi_f (scalbn, min_value / 4, INT_MIN, plus_zero); + END (scalbn); } @@ -5693,6 +6170,35 @@ scalbln_test (void) TEST_fl_f (scalbln, 1, 0L, 1); + TEST_fi_f (scalbln, 1, INT_MAX, plus_infty); + TEST_fi_f (scalbln, 1, INT_MIN, plus_zero); + TEST_fi_f (scalbln, max_value, INT_MAX, plus_infty); + TEST_fi_f (scalbln, max_value, INT_MIN, plus_zero); + TEST_fi_f (scalbln, min_value, INT_MAX, plus_infty); + TEST_fi_f (scalbln, min_value, INT_MIN, plus_zero); + TEST_fi_f (scalbln, min_value / 4, INT_MAX, plus_infty); + TEST_fi_f (scalbln, min_value / 4, INT_MIN, plus_zero); + + TEST_fi_f (scalbln, 1, LONG_MAX, plus_infty); + TEST_fi_f (scalbln, 1, LONG_MIN, plus_zero); + TEST_fi_f (scalbln, max_value, LONG_MAX, plus_infty); + TEST_fi_f (scalbln, max_value, LONG_MIN, plus_zero); + TEST_fi_f (scalbln, min_value, LONG_MAX, plus_infty); + TEST_fi_f (scalbln, min_value, LONG_MIN, plus_zero); + TEST_fi_f (scalbln, min_value / 4, LONG_MAX, plus_infty); + TEST_fi_f (scalbln, min_value / 4, LONG_MIN, plus_zero); + +#if LONG_MAX >= 0x100000000 + TEST_fi_f (scalbln, 1, 0x88000000L, plus_infty); + TEST_fi_f (scalbln, 1, -0x88000000L, plus_zero); + TEST_fi_f (scalbln, max_value, 0x88000000L, plus_infty); + TEST_fi_f (scalbln, max_value, -0x88000000L, plus_zero); + TEST_fi_f (scalbln, min_value, 0x88000000L, plus_infty); + TEST_fi_f (scalbln, min_value, -0x88000000L, plus_zero); + TEST_fi_f (scalbln, min_value / 4, 0x88000000L, plus_infty); + TEST_fi_f (scalbln, min_value / 4, -0x88000000L, plus_zero); +#endif + END (scalbn); } @@ -5757,6 +6263,142 @@ sin_test (void) static void +sin_test_tonearest (void) +{ + int save_round_mode; + errno = 0; + FUNC(sin) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (sin_tonearest); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TONEAREST)) + { + TEST_f_f (sin, 1, 0.8414709848078965066525023216302989996226L); + TEST_f_f (sin, 2, 0.9092974268256816953960198659117448427023L); + TEST_f_f (sin, 3, 0.1411200080598672221007448028081102798469L); + TEST_f_f (sin, 4, -0.7568024953079282513726390945118290941359L); + TEST_f_f (sin, 5, -0.9589242746631384688931544061559939733525L); + TEST_f_f (sin, 6, -0.2794154981989258728115554466118947596280L); + TEST_f_f (sin, 7, 0.6569865987187890903969990915936351779369L); + TEST_f_f (sin, 8, 0.9893582466233817778081235982452886721164L); + TEST_f_f (sin, 9, 0.4121184852417565697562725663524351793439L); + TEST_f_f (sin, 10, -0.5440211108893698134047476618513772816836L); + } + + fesetround (save_round_mode); + + END (sin_tonearest); +} + + +static void +sin_test_towardzero (void) +{ + int save_round_mode; + errno = 0; + FUNC(sin) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (sin_towardzero); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TOWARDZERO)) + { + TEST_f_f (sin, 1, 0.8414709848078965066525023216302989996226L); + TEST_f_f (sin, 2, 0.9092974268256816953960198659117448427023L); + TEST_f_f (sin, 3, 0.1411200080598672221007448028081102798469L); + TEST_f_f (sin, 4, -0.7568024953079282513726390945118290941359L); + TEST_f_f (sin, 5, -0.9589242746631384688931544061559939733525L); + TEST_f_f (sin, 6, -0.2794154981989258728115554466118947596280L); + TEST_f_f (sin, 7, 0.6569865987187890903969990915936351779369L); + TEST_f_f (sin, 8, 0.9893582466233817778081235982452886721164L); + TEST_f_f (sin, 9, 0.4121184852417565697562725663524351793439L); + TEST_f_f (sin, 10, -0.5440211108893698134047476618513772816836L); + } + + fesetround (save_round_mode); + + END (sin_towardzero); +} + + +static void +sin_test_downward (void) +{ + int save_round_mode; + errno = 0; + FUNC(sin) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (sin_downward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_DOWNWARD)) + { + TEST_f_f (sin, 1, 0.8414709848078965066525023216302989996226L); + TEST_f_f (sin, 2, 0.9092974268256816953960198659117448427023L); + TEST_f_f (sin, 3, 0.1411200080598672221007448028081102798469L); + TEST_f_f (sin, 4, -0.7568024953079282513726390945118290941359L); + TEST_f_f (sin, 5, -0.9589242746631384688931544061559939733525L); + TEST_f_f (sin, 6, -0.2794154981989258728115554466118947596280L); + TEST_f_f (sin, 7, 0.6569865987187890903969990915936351779369L); + TEST_f_f (sin, 8, 0.9893582466233817778081235982452886721164L); + TEST_f_f (sin, 9, 0.4121184852417565697562725663524351793439L); + TEST_f_f (sin, 10, -0.5440211108893698134047476618513772816836L); + } + + fesetround (save_round_mode); + + END (sin_downward); +} + + +static void +sin_test_upward (void) +{ + int save_round_mode; + errno = 0; + FUNC(sin) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (sin_upward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_UPWARD)) + { + TEST_f_f (sin, 1, 0.8414709848078965066525023216302989996226L); + TEST_f_f (sin, 2, 0.9092974268256816953960198659117448427023L); + TEST_f_f (sin, 3, 0.1411200080598672221007448028081102798469L); + TEST_f_f (sin, 4, -0.7568024953079282513726390945118290941359L); + TEST_f_f (sin, 5, -0.9589242746631384688931544061559939733525L); + TEST_f_f (sin, 6, -0.2794154981989258728115554466118947596280L); + TEST_f_f (sin, 7, 0.6569865987187890903969990915936351779369L); + TEST_f_f (sin, 8, 0.9893582466233817778081235982452886721164L); + TEST_f_f (sin, 9, 0.4121184852417565697562725663524351793439L); + TEST_f_f (sin, 10, -0.5440211108893698134047476618513772816836L); + } + + fesetround (save_round_mode); + + END (sin_upward); +} + + +static void sincos_test (void) { FLOAT sin_res, cos_res; @@ -5814,6 +6456,115 @@ sinh_test (void) END (sinh); } + +static void +sinh_test_tonearest (void) +{ + int save_round_mode; + errno = 0; + FUNC(sinh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (sinh_tonearest); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TONEAREST)) + { + TEST_f_f (sinh, 22, 1792456423.065795780701106568345764104225L); + TEST_f_f (sinh, 23, 4872401723.124451299966006944252978187305L); + TEST_f_f (sinh, 24, 13244561064.92173614705070540368454568168L); + } + + fesetround (save_round_mode); + + END (sinh_tonearest); +} + + +static void +sinh_test_towardzero (void) +{ + int save_round_mode; + errno = 0; + FUNC(sinh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (sinh_towardzero); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TOWARDZERO)) + { + TEST_f_f (sinh, 22, 1792456423.065795780701106568345764104225L); + TEST_f_f (sinh, 23, 4872401723.124451299966006944252978187305L); + TEST_f_f (sinh, 24, 13244561064.92173614705070540368454568168L); + } + + fesetround (save_round_mode); + + END (sinh_towardzero); +} + + +static void +sinh_test_downward (void) +{ + int save_round_mode; + errno = 0; + FUNC(sinh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (sinh_downward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_DOWNWARD)) + { + TEST_f_f (sinh, 22, 1792456423.065795780701106568345764104225L); + TEST_f_f (sinh, 23, 4872401723.124451299966006944252978187305L); + TEST_f_f (sinh, 24, 13244561064.92173614705070540368454568168L); + } + + fesetround (save_round_mode); + + END (sinh_downward); +} + + +static void +sinh_test_upward (void) +{ + int save_round_mode; + errno = 0; + FUNC(sinh) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (sinh_upward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_UPWARD)) + { + TEST_f_f (sinh, 22, 1792456423.065795780701106568345764104225L); + TEST_f_f (sinh, 23, 4872401723.124451299966006944252978187305L); + TEST_f_f (sinh, 24, 13244561064.92173614705070540368454568168L); + } + + fesetround (save_round_mode); + + END (sinh_upward); +} + + static void sqrt_test (void) { @@ -5877,6 +6628,143 @@ tan_test (void) END (tan); } + +static void +tan_test_tonearest (void) +{ + int save_round_mode; + errno = 0; + FUNC(tan) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (tan_tonearest); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TONEAREST)) + { + TEST_f_f (tan, 1, 1.5574077246549022305069748074583601730873L); + TEST_f_f (tan, 2, -2.1850398632615189916433061023136825434320L); + TEST_f_f (tan, 3, -0.1425465430742778052956354105339134932261L); + TEST_f_f (tan, 4, 1.1578212823495775831373424182673239231198L); + TEST_f_f (tan, 5, -3.3805150062465856369827058794473439087096L); + TEST_f_f (tan, 6, -0.2910061913847491570536995888681755428312L); + TEST_f_f (tan, 7, 0.8714479827243187364564508896003135663222L); + TEST_f_f (tan, 8, -6.7997114552203786999252627596086333648814L); + TEST_f_f (tan, 9, -0.4523156594418098405903708757987855343087L); + TEST_f_f (tan, 10, 0.6483608274590866712591249330098086768169L); + } + + fesetround (save_round_mode); + + END (tan_tonearest); +} + + +static void +tan_test_towardzero (void) +{ + int save_round_mode; + errno = 0; + FUNC(tan) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (tan_towardzero); + + save_round_mode = fegetround (); + + if (!fesetround (FE_TOWARDZERO)) + { + TEST_f_f (tan, 1, 1.5574077246549022305069748074583601730873L); + TEST_f_f (tan, 2, -2.1850398632615189916433061023136825434320L); + TEST_f_f (tan, 3, -0.1425465430742778052956354105339134932261L); + TEST_f_f (tan, 4, 1.1578212823495775831373424182673239231198L); + TEST_f_f (tan, 5, -3.3805150062465856369827058794473439087096L); + TEST_f_f (tan, 6, -0.2910061913847491570536995888681755428312L); + TEST_f_f (tan, 7, 0.8714479827243187364564508896003135663222L); + TEST_f_f (tan, 8, -6.7997114552203786999252627596086333648814L); + TEST_f_f (tan, 9, -0.4523156594418098405903708757987855343087L); + TEST_f_f (tan, 10, 0.6483608274590866712591249330098086768169L); + } + + fesetround (save_round_mode); + + END (tan_towardzero); +} + + +static void +tan_test_downward (void) +{ + int save_round_mode; + errno = 0; + FUNC(tan) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (tan_downward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_DOWNWARD)) + { + TEST_f_f (tan, 1, 1.5574077246549022305069748074583601730873L); + TEST_f_f (tan, 2, -2.1850398632615189916433061023136825434320L); + TEST_f_f (tan, 3, -0.1425465430742778052956354105339134932261L); + TEST_f_f (tan, 4, 1.1578212823495775831373424182673239231198L); + TEST_f_f (tan, 5, -3.3805150062465856369827058794473439087096L); + TEST_f_f (tan, 6, -0.2910061913847491570536995888681755428312L); + TEST_f_f (tan, 7, 0.8714479827243187364564508896003135663222L); + TEST_f_f (tan, 8, -6.7997114552203786999252627596086333648814L); + TEST_f_f (tan, 9, -0.4523156594418098405903708757987855343087L); + TEST_f_f (tan, 10, 0.6483608274590866712591249330098086768169L); + } + + fesetround (save_round_mode); + + END (tan_downward); +} + + +static void +tan_test_upward (void) +{ + int save_round_mode; + errno = 0; + FUNC(tan) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + START (tan_upward); + + save_round_mode = fegetround (); + + if (!fesetround (FE_UPWARD)) + { + TEST_f_f (tan, 1, 1.5574077246549022305069748074583601730873L); + TEST_f_f (tan, 2, -2.1850398632615189916433061023136825434320L); + TEST_f_f (tan, 3, -0.1425465430742778052956354105339134932261L); + TEST_f_f (tan, 4, 1.1578212823495775831373424182673239231198L); + TEST_f_f (tan, 5, -3.3805150062465856369827058794473439087096L); + TEST_f_f (tan, 6, -0.2910061913847491570536995888681755428312L); + TEST_f_f (tan, 7, 0.8714479827243187364564508896003135663222L); + TEST_f_f (tan, 8, -6.7997114552203786999252627596086333648814L); + TEST_f_f (tan, 9, -0.4523156594418098405903708757987855343087L); + TEST_f_f (tan, 10, 0.6483608274590866712591249330098086768169L); + } + + fesetround (save_round_mode); + + END (tan_upward); +} + + static void tanh_test (void) { @@ -6375,20 +7263,44 @@ main (int argc, char **argv) atan_test (); atan2_test (); cos_test (); + cos_test_tonearest (); + cos_test_towardzero (); + cos_test_downward (); + cos_test_upward (); sin_test (); + sin_test_tonearest (); + sin_test_towardzero (); + sin_test_downward (); + sin_test_upward (); sincos_test (); tan_test (); + tan_test_tonearest (); + tan_test_towardzero (); + tan_test_downward (); + tan_test_upward (); /* Hyperbolic functions: */ acosh_test (); asinh_test (); atanh_test (); cosh_test (); + cosh_test_tonearest (); + cosh_test_towardzero (); + cosh_test_downward (); + cosh_test_upward (); sinh_test (); + sinh_test_tonearest (); + sinh_test_towardzero (); + sinh_test_downward (); + sinh_test_upward (); tanh_test (); /* Exponential and logarithmic functions: */ exp_test (); + exp_test_tonearest (); + exp_test_towardzero (); + exp_test_downward (); + exp_test_upward (); exp10_test (); exp2_test (); expm1_test (); @@ -6411,6 +7323,10 @@ main (int argc, char **argv) fabs_test (); hypot_test (); pow_test (); + pow_test_tonearest (); + pow_test_towardzero (); + pow_test_downward (); + pow_test_upward (); sqrt_test (); /* Error and gamma functions: */ diff --git a/math/math_private.h b/math/math_private.h index e4108d8..777762d 100644 --- a/math/math_private.h +++ b/math/math_private.h @@ -211,10 +211,8 @@ extern int __kernel_rem_pio2 (double*,double*,int,int,int, const int32_t*); /* internal functions. */ extern double __copysign (double x, double __y); -#if __GNUC_PREREQ (4, 0) extern inline double __copysign (double x, double y) { return __builtin_copysign (x, y); } -#endif /* ieee style elementary float functions */ extern float __ieee754_sqrtf (float); @@ -258,10 +256,8 @@ extern int __kernel_rem_pio2f (float*,float*,int,int,int, const int32_t*); /* internal functions. */ extern float __copysignf (float x, float __y); -#if __GNUC_PREREQ (4, 0) extern inline float __copysignf (float x, float y) { return __builtin_copysignf (x, y); } -#endif /* ieee style elementary long double functions */ extern long double __ieee754_sqrtl (long double); @@ -326,10 +322,8 @@ extern void __sincosl (long double, long double *, long double *); extern long double __logbl (long double x); extern long double __significandl (long double x); -#if __GNUC_PREREQ (4, 0) extern inline long double __copysignl (long double x, long double y) { return __builtin_copysignl (x, y); } -#endif #endif diff --git a/posix/Makefile b/posix/Makefile index ba892f1..565861f 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -82,7 +82,7 @@ tests := tstgetopt testfnm runtests runptests \ bug-regex21 bug-regex22 bug-regex23 bug-regex24 \ bug-regex25 bug-regex26 bug-regex27 bug-regex28 \ bug-regex29 bug-regex30 bug-regex31 bug-regex32 \ - tst-nice tst-nanosleep tst-regex2 \ + bug-regex33 tst-nice tst-nanosleep tst-regex2 \ transbug tst-rxspencer tst-pcre tst-boost \ bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \ tst-getaddrinfo2 bug-glob1 bug-glob2 bug-glob3 tst-sysconf \ @@ -208,6 +208,7 @@ bug-regex25-ENV = LOCPATH=$(common-objpfx)localedata bug-regex26-ENV = LOCPATH=$(common-objpfx)localedata bug-regex30-ENV = LOCPATH=$(common-objpfx)localedata bug-regex32-ENV = LOCPATH=$(common-objpfx)localedata +bug-regex33-ENV = LOCPATH=$(common-objpfx)localedata tst-rxspencer-ARGS = --utf8 rxspencer/tests tst-rxspencer-ENV = LOCPATH=$(common-objpfx)localedata tst-pcre-ARGS = PCRE.tests diff --git a/posix/bug-regex33.c b/posix/bug-regex33.c new file mode 100644 index 0000000..c0c94aa --- /dev/null +++ b/posix/bug-regex33.c @@ -0,0 +1,120 @@ +/* Test re_search with multi-byte characters in EUC-JP. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Stanislav Brabec <sbrabec@suse.cz>, 2012. + + 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 _GNU_SOURCE 1 +#include <locale.h> +#include <regex.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "regex_internal.h" + +static int +do_test (void) +{ + struct re_pattern_buffer r; + struct re_registers s; + int e, rc = 0; + if (setlocale (LC_CTYPE, "ja_JP.EUC-JP") == NULL) + { + puts ("setlocale failed"); + return 1; + } + memset (&r, 0, sizeof (r)); + memset (&s, 0, sizeof (s)); + + /* The bug cannot be reproduced without initialized fastmap. */ + r.fastmap = malloc (SBC_MAX); + + /* åœ */ + re_compile_pattern ("\xb7\xbd", 2, &r); + + /* aaaaa件a新処, \xb7\xbd constitutes a false match */ + e = re_search (&r, "\x61\x61\x61\x61\x61\xb7\xef\x61\xbf\xb7\xbd\xe8", + 12, 0, 12, &s); + if (e != -1) + { + printf ("bug-regex33.1: false match or error: re_search() returned %d, should return -1\n", e); + rc = 1; + } + + /* aaaa件a新処, \xb7\xbd constitutes a false match, + * this is a reproducer of BZ #13637 */ + e = re_search (&r, "\x61\x61\x61\x61\xb7\xef\x61\xbf\xb7\xbd\xe8", + 11, 0, 11, &s); + if (e != -1) + { + printf ("bug-regex33.2: false match or error: re_search() returned %d, should return -1\n", e); + rc = 1; + } + + /* aaa件a新処, \xb7\xbd constitutes a false match, + * this is a reproducer of BZ #13637 */ + e = re_search (&r, "\x61\x61\x61\xb7\xef\x61\xbf\xb7\xbd\xe8", + 10, 0, 10, &s); + if (e != -1) + { + printf ("bug-regex33.3: false match or error: re_search() returned %d, should return -1\n", e); + rc = 1; + } + + /* aa件a新処, \xb7\xbd constitutes a false match */ + e = re_search (&r, "\x61\x61\xb7\xef\x61\xbf\xb7\xbd\xe8", + 9, 0, 9, &s); + if (e != -1) + { + printf ("bug-regex33.4: false match or error: re_search() returned %d, should return -1\n", e); + rc = 1; + } + + /* a件a新処, \xb7\xbd constitutes a false match */ + e = re_search (&r, "\x61\xb7\xef\x61\xbf\xb7\xbd\xe8", + 8, 0, 8, &s); + if (e != -1) + { + printf ("bug-regex33.5: false match or error: re_search() returned %d, should return -1\n", e); + rc = 1; + } + + /* 新処åœæ–°å‡¦, \xb7\xbd here really matches åœ, but second occurrence is a false match, + * this is a reproducer of bug-regex25 and BZ #13637 */ + e = re_search (&r, "\xbf\xb7\xbd\xe8\xb7\xbd\xbf\xb7\xbd\xe8", + 10, 0, 10, &s); + if (e != 4) + { + printf ("bug-regex33.6: no match or false match: re_search() returned %d, should return 4\n", e); + rc = 1; + } + + /* 新処åœæ–°, \xb7\xbd here really matches åœ, + * this is a reproducer of bug-regex25 */ + e = re_search (&r, "\xbf\xb7\xbd\xe8\xb7\xbd\xbf\xb7", + 10, 0, 10, &s); + if (e != 4) + { + printf ("bug-regex33.7: no match or false match: re_search() returned %d, should return 4\n", e); + rc = 1; + } + + return rc; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/posix/regex_internal.c b/posix/regex_internal.c index b71eae4..9be8a53 100644 --- a/posix/regex_internal.c +++ b/posix/regex_internal.c @@ -499,7 +499,7 @@ re_string_skip_chars (re_string_t *pstr, int new_raw_idx, wint_t *last_wc) rawbuf_idx < new_raw_idx;) { wchar_t wc2; - int remain_len = pstr->len - rawbuf_idx; + int remain_len = pstr->raw_len - rawbuf_idx; prev_st = pstr->cur_state; mbclen = __mbrtowc (&wc2, (const char *) pstr->raw_mbs + rawbuf_idx, remain_len, &pstr->cur_state); diff --git a/resolv/res_query.c b/resolv/res_query.c index 947c651..abccd4a 100644 --- a/resolv/res_query.c +++ b/resolv/res_query.c @@ -556,12 +556,16 @@ __libc_res_nquerydomain(res_state statp, * copy without '.' if present. */ n = strlen(name); - if (n >= MAXDNAME) { + + /* Decrement N prior to checking it against MAXDNAME + so that we detect a wrap to SIZE_MAX and return + a reasonable error. */ + n--; + if (n >= MAXDNAME - 1) { RES_SET_H_ERRNO(statp, NO_RECOVERY); return (-1); } - n--; - if (n >= 0 && name[n] == '.') { + if (name[n] == '.') { strncpy(nbuf, name, n); nbuf[n] = '\0'; } else diff --git a/soft-fp/double.h b/soft-fp/double.h index e247e6e..5bad49c 100644 --- a/soft-fp/double.h +++ b/soft-fp/double.h @@ -1,6 +1,6 @@ /* Software floating-point emulation. Definitions for IEEE Double Precision - Copyright (C) 1997, 1998, 1999, 2006, 2007, 2008, 2009 + Copyright (C) 1997, 1998, 1999, 2006, 2007, 2008, 2009, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson (rth@cygnus.com), @@ -67,7 +67,7 @@ typedef float DFtype __attribute__((mode(DF))); union _FP_UNION_D { DFtype flt; - struct { + struct _FP_STRUCT_LAYOUT { #if __BYTE_ORDER == __BIG_ENDIAN unsigned sign : 1; unsigned exp : _FP_EXPBITS_D; @@ -166,7 +166,7 @@ union _FP_UNION_D union _FP_UNION_D { DFtype flt; - struct { + struct _FP_STRUCT_LAYOUT { #if __BYTE_ORDER == __BIG_ENDIAN unsigned sign : 1; unsigned exp : _FP_EXPBITS_D; diff --git a/soft-fp/extended.h b/soft-fp/extended.h index 3ab6b6a..af9c6e6 100644 --- a/soft-fp/extended.h +++ b/soft-fp/extended.h @@ -1,6 +1,6 @@ /* Software floating-point emulation. Definitions for IEEE Extended Precision. - Copyright (C) 1999,2006,2007 Free Software Foundation, Inc. + Copyright (C) 1999,2006,2007,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek (jj@ultra.linux.cz). @@ -63,7 +63,7 @@ typedef float XFtype __attribute__((mode(XF))); union _FP_UNION_E { XFtype flt; - struct + struct _FP_STRUCT_LAYOUT { #if __BYTE_ORDER == __BIG_ENDIAN unsigned long pad1 : _FP_W_TYPE_SIZE; @@ -262,7 +262,7 @@ union _FP_UNION_E union _FP_UNION_E { XFtype flt; - struct { + struct _FP_STRUCT_LAYOUT { #if __BYTE_ORDER == __BIG_ENDIAN _FP_W_TYPE pad : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E); unsigned sign : 1; diff --git a/soft-fp/quad.h b/soft-fp/quad.h index ea70138..b05bd2d 100644 --- a/soft-fp/quad.h +++ b/soft-fp/quad.h @@ -1,6 +1,6 @@ /* Software floating-point emulation. Definitions for IEEE Quad Precision. - Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc. + Copyright (C) 1997,1998,1999,2006,2007,2012 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), @@ -66,7 +66,7 @@ typedef float TFtype __attribute__((mode(TF))); union _FP_UNION_Q { TFtype flt; - struct + struct _FP_STRUCT_LAYOUT { #if __BYTE_ORDER == __BIG_ENDIAN unsigned sign : 1; @@ -170,10 +170,10 @@ union _FP_UNION_Q union _FP_UNION_Q { TFtype flt /* __attribute__((mode(TF))) */ ; - struct { + struct _FP_STRUCT_LAYOUT { _FP_W_TYPE a, b; } longs; - struct { + struct _FP_STRUCT_LAYOUT { #if __BYTE_ORDER == __BIG_ENDIAN unsigned sign : 1; unsigned exp : _FP_EXPBITS_Q; diff --git a/soft-fp/single.h b/soft-fp/single.h index c10d25a..119d0db 100644 --- a/soft-fp/single.h +++ b/soft-fp/single.h @@ -1,6 +1,6 @@ /* Software floating-point emulation. Definitions for IEEE Single Precision. - Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc. + Copyright (C) 1997,1998,1999,2006,2012 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), @@ -57,7 +57,7 @@ typedef float SFtype __attribute__((mode(SF))); union _FP_UNION_S { SFtype flt; - struct { + struct _FP_STRUCT_LAYOUT { #if __BYTE_ORDER == __BIG_ENDIAN unsigned sign : 1; unsigned exp : _FP_EXPBITS_S; diff --git a/soft-fp/soft-fp.h b/soft-fp/soft-fp.h index ed4d39d..46cb1cf 100644 --- a/soft-fp/soft-fp.h +++ b/soft-fp/soft-fp.h @@ -1,5 +1,5 @@ /* Software floating-point emulation. - Copyright (C) 1997,1998,1999,2000,2002,2003,2005,2006,2007 + Copyright (C) 1997,1998,1999,2000,2002,2003,2005,2006,2007,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson (rth@cygnus.com), @@ -84,6 +84,16 @@ #define FP_EX_DENORM 0 #endif +/* _FP_STRUCT_LAYOUT may be defined as an attribute to determine the + struct layout variant used for structures where bit-fields are used + to access specific parts of binary floating-point numbers. This is + required for systems where the default ABI uses struct layout with + differences in how consecutive bit-fields are laid out from the + default expected by soft-fp. */ +#ifndef _FP_STRUCT_LAYOUT +#define _FP_STRUCT_LAYOUT +#endif + #ifdef _FP_DECL_EX #define FP_DECL_EX \ int _fex = 0; \ diff --git a/stdio-common/Makefile b/stdio-common/Makefile index a847b28..080badc 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -59,7 +59,8 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \ tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \ tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \ bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \ - scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 + scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 \ + bug-vfprintf-nargs test-srcs = tst-unbputc tst-printf diff --git a/stdio-common/bug-vfprintf-nargs.c b/stdio-common/bug-vfprintf-nargs.c new file mode 100644 index 0000000..13c66c0 --- /dev/null +++ b/stdio-common/bug-vfprintf-nargs.c @@ -0,0 +1,78 @@ +/* Test for vfprintf nargs allocation overflow (BZ #13656). + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Kees Cook <keescook@chromium.org>, 2012. + + 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 <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <unistd.h> +#include <inttypes.h> +#include <string.h> +#include <signal.h> + +static int +format_failed (const char *fmt, const char *expected) +{ + char output[80]; + + printf ("%s : ", fmt); + + memset (output, 0, sizeof output); + /* Having sprintf itself detect a failure is good. */ + if (sprintf (output, fmt, 1, 2, 3, "test") > 0 + && strcmp (output, expected) != 0) + { + printf ("FAIL (output '%s' != expected '%s')\n", output, expected); + return 1; + } + puts ("ok"); + return 0; +} + +static int +do_test (void) +{ + int rc = 0; + char buf[64]; + + /* Regular positionals work. */ + if (format_failed ("%1$d", "1") != 0) + rc = 1; + + /* Regular width positionals work. */ + if (format_failed ("%1$*2$d", " 1") != 0) + rc = 1; + + /* Positional arguments are constructed via read_int, so nargs can only + overflow on 32-bit systems. On 64-bit systems, it will attempt to + allocate a giant amount of memory and possibly crash, which is the + expected situation. Since the 64-bit behavior is arch-specific, only + test this on 32-bit systems. */ + if (sizeof (long int) == 4) + { + sprintf (buf, "%%1$d %%%" PRIdPTR "$d", UINT32_MAX / sizeof (int)); + if (format_failed (buf, "1 %$d") != 0) + rc = 1; + } + + return rc; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index 863cd5d..85d1900 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -235,6 +235,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) 0 if unknown. */ int readonly_format = 0; + /* For the argument descriptions, which may be allocated on the heap. */ + void *args_malloced = NULL; + /* This table maps a character into a number representing a class. In each step there is a destination label for each class. */ @@ -819,7 +822,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) \ if (function_done < 0) \ { \ - /* Error in print handler. */ \ + /* Error in print handler; up to handler to set errno. */ \ done = -1; \ goto all_done; \ } \ @@ -873,7 +876,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) \ if (function_done < 0) \ { \ - /* Error in print handler. */ \ + /* Error in print handler; up to handler to set errno. */ \ done = -1; \ goto all_done; \ } \ @@ -1114,7 +1117,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) &mbstate); \ if (len == (size_t) -1) \ { \ - /* Something went wron gduring the conversion. Bail out. */ \ + /* Something went wrong during the conversion. Bail out. */ \ done = -1; \ goto all_done; \ } \ @@ -1185,6 +1188,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) if (__mbsnrtowcs (ignore, &str2, strend - str2, \ ignore_size, &ps) == (size_t) -1) \ { \ + /* Conversion function has set errno. */ \ done = -1; \ goto all_done; \ } \ @@ -1602,6 +1606,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) if (spec == L_('\0')) { /* The format string ended before the specifier is complete. */ + __set_errno (EINVAL); done = -1; goto all_done; } @@ -1647,9 +1652,10 @@ do_positional: determine the size of the array needed to store the argument attributes. */ size_t nargs = 0; - int *args_type; - union printf_arg *args_value = NULL; + size_t bytes_per_arg; + union printf_arg *args_value; int *args_size; + int *args_type; /* Positional parameters refer to arguments directly. This could also determine the maximum number of arguments. Track the @@ -1698,13 +1704,38 @@ do_positional: /* Determine the number of arguments the format string consumes. */ nargs = MAX (nargs, max_ref_arg); + /* Calculate total size needed to represent a single argument across + all three argument-related arrays. */ + bytes_per_arg = sizeof (*args_value) + sizeof (*args_size) + + sizeof (*args_type); + + /* Check for potential integer overflow. */ + if (__builtin_expect (nargs > SIZE_MAX / bytes_per_arg, 0)) + { + __set_errno (ERANGE); + done = -1; + goto all_done; + } - /* Allocate memory for the argument descriptions. */ - args_type = alloca (nargs * sizeof (int)); + /* Allocate memory for all three argument arrays. */ + if (__libc_use_alloca (nargs * bytes_per_arg)) + args_value = alloca (nargs * bytes_per_arg); + else + { + args_value = args_malloced = malloc (nargs * bytes_per_arg); + if (args_value == NULL) + { + done = -1; + goto all_done; + } + } + + /* Set up the remaining two arrays to each point past the end of the + prior array, since space for all three has been allocated now. */ + args_size = &args_value[nargs].pa_int; + args_type = &args_size[nargs]; memset (args_type, s->_flags2 & _IO_FLAGS2_FORTIFY ? '\xff' : '\0', - nargs * sizeof (int)); - args_value = alloca (nargs * sizeof (union printf_arg)); - args_size = alloca (nargs * sizeof (int)); + nargs * sizeof (*args_type)); /* XXX Could do sanity check here: If any element in ARGS_TYPE is still zero after this loop, format is invalid. For now we @@ -1919,6 +1950,7 @@ do_positional: about # of chars. */ if (function_done < 0) { + /* Function has set errno. */ done = -1; goto all_done; } @@ -1953,6 +1985,7 @@ do_positional: of chars. */ if (function_done < 0) { + /* Function has set errno. */ done = -1; goto all_done; } @@ -1973,8 +2006,8 @@ do_positional: } all_done: - if (__builtin_expect (workstart != NULL, 0)) - free (workstart); + free (args_malloced); + free (workstart); /* Unlock the stream. */ _IO_funlockfile (s); _IO_cleanup_region_end (0); diff --git a/stdlib/tst-strtod.c b/stdlib/tst-strtod.c index 9be7835..25bee78 100644 --- a/stdlib/tst-strtod.c +++ b/stdlib/tst-strtod.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,1996-2001,2003,2009,2011 Free Software Foundation, Inc. +/* Copyright (C) 1991-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -64,12 +64,9 @@ static const struct ltest tests[] = { "0x0.8p-1022", 1.11253692925360069154511635866620203210960799023116591527666e-308, '\0', ERANGE }, -#if __GNUC_PREREQ(2,96) - /* For older GCC release HUGE_VAL is not a constant. */ { "Inf", HUGE_VAL, '\0', 0 }, { "-Inf", -HUGE_VAL, '\0', 0 }, { "+InFiNiTy", HUGE_VAL, '\0', 0 }, -#endif { "0x80000Ap-23", 0x80000Ap-23, '\0', 0 }, { "1e-324", 0, '\0', ERANGE }, { NULL, 0, '\0', 0 } diff --git a/sysdeps/generic/dl-osinfo.h b/sysdeps/generic/dl-osinfo.h index 2eaab3b..548fc46 100644 --- a/sysdeps/generic/dl-osinfo.h +++ b/sysdeps/generic/dl-osinfo.h @@ -30,8 +30,8 @@ _dl_setup_stack_chk_guard (void *dl_random) if (dl_random == NULL) { - ret.bytes[sizeof (ret) - 2] = 255; - ret.bytes[sizeof (ret) - 3] = '\n'; + ret.bytes[sizeof (ret) - 1] = 255; + ret.bytes[sizeof (ret) - 2] = '\n'; } else { diff --git a/sysdeps/gnu/errlist-compat.awk b/sysdeps/gnu/errlist-compat.awk index 0e97d05..4f70e92 100644 --- a/sysdeps/gnu/errlist-compat.awk +++ b/sysdeps/gnu/errlist-compat.awk @@ -84,7 +84,10 @@ END { printf "#define ERR_MAX %d\n\n", highest; } - for (old in compat) { + # same regardless of awk's ordering of the associative array. + num_compat_elems = asorti(compat, compat_indices) + for (i = 1; i <= num_compat_elems; i++) { + old = compat_indices[i] new = compat[old]; n = vcount[old]; printf "#if SHLIB_COMPAT (libc, %s, %s)\n", old, new; diff --git a/sysdeps/gnu/errlist.c b/sysdeps/gnu/errlist.c index 75085c0..62613ff 100644 --- a/sysdeps/gnu/errlist.c +++ b/sysdeps/gnu/errlist.c @@ -386,7 +386,7 @@ TRANS not representable because of overflow or underflow. */ /* TRANS Resource temporarily unavailable; the call might work if you try again TRANS later. The macro @code{EWOULDBLOCK} is another name for @code{EAGAIN}; -TRANS they are always the same in the GNU C library. +TRANS they are always the same in @theglibc{}. TRANS TRANS This error can happen in a few different situations: TRANS @@ -421,7 +421,7 @@ TRANS @end itemize */ #endif #if defined (EWOULDBLOCK) && EWOULDBLOCK != EAGAIN /* -TRANS In the GNU C library, this is another name for @code{EAGAIN} (above). +TRANS In @theglibc{}, this is another name for @code{EAGAIN} (above). TRANS The values are always the same, on every operating system. TRANS TRANS C libraries in many older Unix systems have @code{EWOULDBLOCK} as a diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps index 83a68af..c5568b9 100644 --- a/sysdeps/i386/fpu/libm-test-ulps +++ b/sysdeps/i386/fpu/libm-test-ulps @@ -280,10 +280,173 @@ ifloat: 1 ildouble: 1 ldouble: 1 +# cos_downward +Test "cos_downward (1) == 0.5403023058681397174009366074429766037323": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "cos_downward (10) == -0.8390715290764524522588639478240648345199": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "cos_downward (3) == -0.9899924966004454572715727947312613023937": +double: 1 +idouble: 1 +Test "cos_downward (4) == -0.6536436208636119146391681830977503814241": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_downward (5) == 0.2836621854632262644666391715135573083344": +float: 1 +ifloat: 1 +Test "cos_downward (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_downward (8) == -0.1455000338086135258688413818311946826093": +ildouble: 1 +ldouble: 1 +Test "cos_downward (9) == -0.9111302618846769883682947111811653112463": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cos_tonearest +Test "cos_tonearest (8) == -0.1455000338086135258688413818311946826093": +ildouble: 1 +ldouble: 1 +Test "cos_tonearest (9) == -0.9111302618846769883682947111811653112463": +ildouble: 1 +ldouble: 1 + +# cos_towardzero +Test "cos_towardzero (1) == 0.5403023058681397174009366074429766037323": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (10) == -0.8390715290764524522588639478240648345199": +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (2) == -0.4161468365471423869975682295007621897660": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (3) == -0.9899924966004454572715727947312613023937": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (4) == -0.6536436208636119146391681830977503814241": +double: 1 +idouble: 1 +Test "cos_towardzero (5) == 0.2836621854632262644666391715135573083344": +float: 1 +ifloat: 1 +Test "cos_towardzero (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (8) == -0.1455000338086135258688413818311946826093": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# cos_upward +Test "cos_upward (1) == 0.5403023058681397174009366074429766037323": +float: 1 +ifloat: 1 +Test "cos_upward (10) == -0.8390715290764524522588639478240648345199": +ildouble: 1 +ldouble: 1 +Test "cos_upward (2) == -0.4161468365471423869975682295007621897660": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_upward (3) == -0.9899924966004454572715727947312613023937": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_upward (4) == -0.6536436208636119146391681830977503814241": +double: 1 +idouble: 1 +Test "cos_upward (5) == 0.2836621854632262644666391715135573083344": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "cos_upward (6) == 0.9601702866503660205456522979229244054519": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_upward (7) == 0.7539022543433046381411975217191820122183": +double: 1 +idouble: 1 +Test "cos_upward (8) == -0.1455000338086135258688413818311946826093": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + # cosh Test "cosh (0.75) == 1.29468328467684468784170818539018176": ildouble: 1 +# cosh_downward +Test "cosh_downward (22) == 1792456423.065795780980053377632656584997": +double: 1 +float: 1 +ldouble: 2 +Test "cosh_downward (23) == 4872401723.124451300068625740569997090344": +double: 1 +float: 1 +ldouble: 1 +Test "cosh_downward (24) == 13244561064.92173614708845674912733665919": +float: 1 +ldouble: 1 + +# cosh_tonearest +Test "cosh_tonearest (22) == 1792456423.065795780980053377632656584997": +ldouble: 1 + +# cosh_towardzero +Test "cosh_towardzero (22) == 1792456423.065795780980053377632656584997": +double: 1 +float: 1 +ldouble: 2 +Test "cosh_towardzero (23) == 4872401723.124451300068625740569997090344": +double: 1 +float: 1 +ldouble: 1 +Test "cosh_towardzero (24) == 13244561064.92173614708845674912733665919": +float: 1 +ldouble: 1 + +# cosh_upward +Test "cosh_upward (23) == 4872401723.124451300068625740569997090344": +ldouble: 1 +Test "cosh_upward (24) == 13244561064.92173614708845674912733665919": +double: 1 + # cpow Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": float: 1 @@ -370,8 +533,8 @@ ifloat: 1 Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": double: 1 idouble: 1 -ildouble: 439 -ldouble: 439 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": float: 1 ifloat: 1 @@ -390,13 +553,13 @@ ldouble: 3 # ctanh Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": -ildouble: 5 -ldouble: 5 +ildouble: 3 +ldouble: 3 Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": float: 1 ifloat: 1 -ildouble: 25 -ldouble: 25 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i": float: 1 ifloat: 1 @@ -422,6 +585,17 @@ idouble: 1 Test "erfc (0.75) == 0.288844366346484868401062165408589223": float: 1 ifloat: 1 +Test "erfc (0x1.f7303cp+1) == 2.705500297238986897105236321218861842255e-8": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "erfc (0x1.ffa002p+2) == 1.233585992097580296336099501489175967033e-29": +ildouble: 1 +ldouble: 1 +Test "erfc (0x1.ffffc8p+2) == 1.122671365033056305522366683719541099329e-29": +double: 1 +idouble: 1 Test "erfc (1.25) == 0.0770998717435417698634765188027188596": ildouble: 1 ldouble: 1 @@ -437,10 +611,6 @@ ldouble: 1 # exp Test "exp (0.75) == 2.11700001661267466854536981983709561": ildouble: 1 -Test "exp (1000.0) == 0.197007111401704699388887935224332313e435": -ildouble: 754 -Test "exp (50.0) == 5184705528587072464087.45332293348538": -ildouble: 16 # exp10 Test "exp10 (-1) == 0.1": @@ -453,9 +623,56 @@ Test "exp10 (3) == 1000": ildouble: 8 ldouble: 8 +# exp_downward +Test "exp_downward (1) == e": +ildouble: 1 +ldouble: 1 +Test "exp_downward (2) == e^2": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "exp_downward (3) == e^3": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# exp_towardzero +Test "exp_towardzero (1) == e": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (2) == e^2": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "exp_towardzero (3) == e^3": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# exp_upward +Test "exp_upward (1) == e": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + # expm1 Test "expm1 (1) == M_El - 1.0": ildouble: 1 +Test "expm1 (11356.25) == 9.05128237311923300051376115753226014206e+4931": +ldouble: 1 # gamma Test "gamma (-0.5) == log(2*sqrt(pi))": @@ -719,6 +936,174 @@ ifloat: 1 ildouble: 1 ldouble: 1 +# pow_downward +Test "pow_downward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "pow_downward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# pow_towardzero +Test "pow_towardzero (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "pow_towardzero (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# pow_upward +Test "pow_upward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "pow_upward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# sin_downward +Test "sin_downward (1) == 0.8414709848078965066525023216302989996226": +ildouble: 1 +ldouble: 1 +Test "sin_downward (10) == -0.5440211108893698134047476618513772816836": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "sin_downward (2) == 0.9092974268256816953960198659117448427023": +double: 1 +idouble: 1 +Test "sin_downward (3) == 0.1411200080598672221007448028081102798469": +ildouble: 1 +ldouble: 1 +Test "sin_downward (4) == -0.7568024953079282513726390945118290941359": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "sin_downward (5) == -0.9589242746631384688931544061559939733525": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "sin_downward (6) == -0.2794154981989258728115554466118947596280": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sin_downward (7) == 0.6569865987187890903969990915936351779369": +ildouble: 1 +ldouble: 1 +Test "sin_downward (8) == 0.9893582466233817778081235982452886721164": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "sin_downward (9) == 0.4121184852417565697562725663524351793439": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# sin_tonearest +Test "sin_tonearest (10) == -0.5440211108893698134047476618513772816836": +ildouble: 1 +ldouble: 1 +Test "sin_tonearest (4) == -0.7568024953079282513726390945118290941359": +ildouble: 1 +ldouble: 1 +Test "sin_tonearest (9) == 0.4121184852417565697562725663524351793439": +ildouble: 1 +ldouble: 1 + +# sin_towardzero +Test "sin_towardzero (1) == 0.8414709848078965066525023216302989996226": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (10) == -0.5440211108893698134047476618513772816836": +float: 1 +ifloat: 1 +Test "sin_towardzero (2) == 0.9092974268256816953960198659117448427023": +double: 1 +idouble: 1 +Test "sin_towardzero (3) == 0.1411200080598672221007448028081102798469": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (4) == -0.7568024953079282513726390945118290941359": +float: 1 +ifloat: 1 +Test "sin_towardzero (5) == -0.9589242746631384688931544061559939733525": +float: 1 +ifloat: 1 +Test "sin_towardzero (6) == -0.2794154981989258728115554466118947596280": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (7) == 0.6569865987187890903969990915936351779369": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (8) == 0.9893582466233817778081235982452886721164": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (9) == 0.4121184852417565697562725663524351793439": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# sin_upward +Test "sin_upward (1) == 0.8414709848078965066525023216302989996226": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sin_upward (10) == -0.5440211108893698134047476618513772816836": +float: 1 +ifloat: 1 +Test "sin_upward (2) == 0.9092974268256816953960198659117448427023": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sin_upward (3) == 0.1411200080598672221007448028081102798469": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sin_upward (4) == -0.7568024953079282513726390945118290941359": +float: 1 +ifloat: 1 +Test "sin_upward (5) == -0.9589242746631384688931544061559939733525": +float: 1 +ifloat: 1 +Test "sin_upward (6) == -0.2794154981989258728115554466118947596280": +ildouble: 1 +ldouble: 1 +Test "sin_upward (7) == 0.6569865987187890903969990915936351779369": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sin_upward (8) == 0.9893582466233817778081235982452886721164": +float: 1 +ifloat: 1 + # sincos Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": double: 1 @@ -745,11 +1130,216 @@ Test "sinh (0.75) == 0.822316731935829980703661634446913849": double: 1 ildouble: 1 +# sinh_downward +Test "sinh_downward (22) == 1792456423.065795780701106568345764104225": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ldouble: 4 +Test "sinh_downward (23) == 4872401723.124451299966006944252978187305": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sinh_downward (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 +ldouble: 5 + +# sinh_tonearest +Test "sinh_tonearest (22) == 1792456423.065795780701106568345764104225": +ldouble: 3 +Test "sinh_tonearest (23) == 4872401723.124451299966006944252978187305": +ldouble: 1 +Test "sinh_tonearest (24) == 13244561064.92173614705070540368454568168": +ldouble: 6 + +# sinh_towardzero +Test "sinh_towardzero (22) == 1792456423.065795780701106568345764104225": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ldouble: 4 +Test "sinh_towardzero (23) == 4872401723.124451299966006944252978187305": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sinh_towardzero (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 +ldouble: 5 + +# sinh_upward +Test "sinh_upward (22) == 1792456423.065795780701106568345764104225": +ldouble: 16 +Test "sinh_upward (23) == 4872401723.124451299966006944252978187305": +ldouble: 27 +Test "sinh_upward (24) == 13244561064.92173614705070540368454568168": +double: 1 +idouble: 1 +ldouble: 7 + # tan Test "tan (pi/4) == 1": double: 1 idouble: 1 +# tan_downward +Test "tan_downward (1) == 1.5574077246549022305069748074583601730873": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tan_downward (10) == 0.6483608274590866712591249330098086768169": +float: 1 +ifloat: 1 +Test "tan_downward (2) == -2.1850398632615189916433061023136825434320": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tan_downward (3) == -0.1425465430742778052956354105339134932261": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "tan_downward (4) == 1.1578212823495775831373424182673239231198": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_downward (5) == -3.3805150062465856369827058794473439087096": +ildouble: 1 +ldouble: 1 +Test "tan_downward (6) == -0.2910061913847491570536995888681755428312": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tan_downward (7) == 0.8714479827243187364564508896003135663222": +double: 1 +idouble: 1 +Test "tan_downward (8) == -6.7997114552203786999252627596086333648814": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_downward (9) == -0.4523156594418098405903708757987855343087": +float: 1 +ifloat: 1 + +# tan_tonearest +Test "tan_tonearest (1) == 1.5574077246549022305069748074583601730873": +ildouble: 1 +ldouble: 1 +Test "tan_tonearest (2) == -2.1850398632615189916433061023136825434320": +ildouble: 1 +ldouble: 1 +Test "tan_tonearest (6) == -0.2910061913847491570536995888681755428312": +ildouble: 1 +ldouble: 1 +Test "tan_tonearest (8) == -6.7997114552203786999252627596086333648814": +ildouble: 1 +ldouble: 1 +Test "tan_tonearest (9) == -0.4523156594418098405903708757987855343087": +ildouble: 1 +ldouble: 1 + +# tan_towardzero +Test "tan_towardzero (1) == 1.5574077246549022305069748074583601730873": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tan_towardzero (10) == 0.6483608274590866712591249330098086768169": +float: 1 +ifloat: 1 +Test "tan_towardzero (2) == -2.1850398632615189916433061023136825434320": +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (3) == -0.1425465430742778052956354105339134932261": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (4) == 1.1578212823495775831373424182673239231198": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (5) == -3.3805150062465856369827058794473439087096": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (6) == -0.2910061913847491570536995888681755428312": +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (7) == 0.8714479827243187364564508896003135663222": +double: 1 +idouble: 1 +Test "tan_towardzero (8) == -6.7997114552203786999252627596086333648814": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 +Test "tan_towardzero (9) == -0.4523156594418098405903708757987855343087": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# tan_upward +Test "tan_upward (1) == 1.5574077246549022305069748074583601730873": +ildouble: 1 +ldouble: 1 +Test "tan_upward (10) == 0.6483608274590866712591249330098086768169": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "tan_upward (2) == -2.1850398632615189916433061023136825434320": +ildouble: 1 +ldouble: 1 +Test "tan_upward (3) == -0.1425465430742778052956354105339134932261": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_upward (4) == 1.1578212823495775831373424182673239231198": +double: 1 +idouble: 1 +Test "tan_upward (5) == -3.3805150062465856369827058794473439087096": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_upward (6) == -0.2910061913847491570536995888681755428312": +ildouble: 1 +ldouble: 1 +Test "tan_upward (7) == 0.8714479827243187364564508896003135663222": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_upward (8) == -6.7997114552203786999252627596086333648814": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 +Test "tan_upward (9) == -0.4523156594418098405903708757987855343087": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + # tgamma Test "tgamma (-0.5) == -2 sqrt (pi)": double: 2 @@ -943,8 +1533,8 @@ ifloat: 1 # Maximal error of functions: Function: "acos": -ildouble: 622 -ldouble: 622 +ildouble: 1 +ldouble: 1 Function: "asin": ildouble: 1 @@ -1088,16 +1678,61 @@ ifloat: 1 ildouble: 1 ldouble: 1 +Function: "cos_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cos_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "cos_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cos_upward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + Function: "cosh": ildouble: 1 +Function: "cosh_downward": +double: 1 +float: 1 +ldouble: 2 + +Function: "cosh_tonearest": +ldouble: 1 + +Function: "cosh_towardzero": +double: 1 +float: 1 +ldouble: 2 + +Function: "cosh_upward": +double: 1 +ldouble: 1 + Function: Real part of "cpow": double: 1 float: 4 idouble: 1 ifloat: 4 -ildouble: 763 -ldouble: 763 +ildouble: 6 +ldouble: 6 Function: Imaginary part of "cpow": double: 2 @@ -1136,8 +1771,8 @@ ldouble: 2 Function: Real part of "ctan": double: 1 idouble: 1 -ildouble: 439 -ldouble: 439 +ildouble: 1 +ldouble: 1 Function: Imaginary part of "ctan": double: 1 @@ -1152,16 +1787,16 @@ double: 1 float: 1 idouble: 1 ifloat: 1 -ildouble: 5 -ldouble: 5 +ildouble: 3 +ldouble: 3 Function: Imaginary part of "ctanh": double: 1 float: 1 idouble: 1 ifloat: 1 -ildouble: 25 -ldouble: 25 +ildouble: 1 +ldouble: 1 Function: "erf": double: 1 @@ -1175,15 +1810,35 @@ ifloat: 1 ildouble: 1 ldouble: 1 -Function: "exp": -ildouble: 754 - Function: "exp10": ildouble: 8 ldouble: 8 +Function: "exp_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "exp_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "exp_upward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + Function: "expm1": ildouble: 1 +ldouble: 1 Function: "gamma": double: 1 @@ -1236,6 +1891,58 @@ ifloat: 1 ildouble: 1 ldouble: 1 +Function: "pow_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_upward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sin_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sin_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "sin_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sin_upward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + Function: "sincos": double: 1 float: 1 @@ -1248,10 +1955,60 @@ Function: "sinh": double: 1 ildouble: 1 +Function: "sinh_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ldouble: 5 + +Function: "sinh_tonearest": +ldouble: 6 + +Function: "sinh_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ldouble: 5 + +Function: "sinh_upward": +double: 1 +idouble: 1 +ldouble: 27 + Function: "tan": double: 1 idouble: 1 +Function: "tan_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "tan_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "tan_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "tan_upward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + Function: "tgamma": double: 2 float: 1 diff --git a/sysdeps/i386/i486/bits/atomic.h b/sysdeps/i386/i486/bits/atomic.h index b633ce9..b59a556 100644 --- a/sysdeps/i386/i486/bits/atomic.h +++ b/sysdeps/i386/i486/bits/atomic.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2004,2006,2007,2009,2011 Free Software Foundation, Inc. +/* Copyright (C) 2002-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -55,33 +55,10 @@ typedef uintmax_t uatomic_max_t; #endif -#if __GNUC_PREREQ (4, 1) -# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ +#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ __sync_val_compare_and_swap (mem, oldval, newval) -# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ +#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ (! __sync_bool_compare_and_swap (mem, oldval, newval)) -#else -# define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgb %b2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "q" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) - -# define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgw %w2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) - -# define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgl %2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) -#endif #define __arch_c_compare_and_exchange_val_8_acq(mem, newval, oldval) \ @@ -254,13 +231,8 @@ typedef uintmax_t uatomic_max_t; } \ __result; }) -#if __GNUC_PREREQ (4, 1) -# define atomic_exchange_and_add(mem, value) \ +#define atomic_exchange_and_add(mem, value) \ __sync_fetch_and_add (mem, value) -#else -# define atomic_exchange_and_add(mem, value) \ - __arch_exchange_and_add_body (LOCK_PREFIX, __arch, mem, value) -#endif #define __arch_exchange_and_add_cprefix \ "cmpl $0, %%gs:%P4\n\tje 0f\n\tlock\n0:\t" diff --git a/sysdeps/i386/i686/multiarch/strcasecmp_l-c.c b/sysdeps/i386/i686/multiarch/strcasecmp_l-c.c index d10e872..d4fcd2b 100644 --- a/sysdeps/i386/i686/multiarch/strcasecmp_l-c.c +++ b/sysdeps/i386/i686/multiarch/strcasecmp_l-c.c @@ -6,6 +6,8 @@ extern __typeof (strcasecmp_l) __strcasecmp_l_nonascii; #define USE_IN_EXTENDED_LOCALE_MODEL 1 #include <string/strcasecmp.c> +strong_alias (__strcasecmp_l_nonascii, __strcasecmp_l_ia32) + /* The needs of strcasecmp in libc are minimal, no need to go through the IFUNC. */ strong_alias (__strcasecmp_l_nonascii, __GI___strcasecmp_l) diff --git a/sysdeps/i386/i686/multiarch/strcmp.S b/sysdeps/i386/i686/multiarch/strcmp.S index 5410d17..b3b9eb8 100644 --- a/sysdeps/i386/i686/multiarch/strcmp.S +++ b/sysdeps/i386/i686/multiarch/strcmp.S @@ -111,6 +111,7 @@ END(STRCMP) # endif #endif -#ifndef USE_AS_STRNCMP +#if !defined USE_AS_STRNCMP && !defined USE_AS_STRCASECMP_L \ + && !defined USE_AS_STRNCASECMP_L # include "../strcmp.S" #endif diff --git a/sysdeps/i386/i686/multiarch/strncase_l-c.c b/sysdeps/i386/i686/multiarch/strncase_l-c.c index 0c68b8d..7e601af 100644 --- a/sysdeps/i386/i686/multiarch/strncase_l-c.c +++ b/sysdeps/i386/i686/multiarch/strncase_l-c.c @@ -6,6 +6,8 @@ extern __typeof (strncasecmp_l) __strncasecmp_l_nonascii; #define USE_IN_EXTENDED_LOCALE_MODEL 1 #include <string/strncase.c> +strong_alias (__strncasecmp_l_nonascii, __strncasecmp_l_ia32) + /* The needs of strcasecmp in libc are minimal, no need to go through the IFUNC. */ strong_alias (__strncasecmp_l_nonascii, __GI___strncasecmp_l) diff --git a/sysdeps/ieee754/dbl-64/e_exp.c b/sysdeps/ieee754/dbl-64/e_exp.c index cfdb8e2..8231c56 100644 --- a/sysdeps/ieee754/dbl-64/e_exp.c +++ b/sysdeps/ieee754/dbl-64/e_exp.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001, 2011 Free Software Foundation + * Copyright (C) 2001-2012 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 @@ -38,6 +38,7 @@ #include "MathLib.h" #include "uexp.tbl" #include "math_private.h" +#include <fenv.h> #ifndef SECTION # define SECTION @@ -58,6 +59,10 @@ __ieee754_exp(double x) { int4 k; #endif int4 i,j,m,n,ex; + fenv_t env; + double retval; + + libc_feholdexcept_setround (&env, FE_TONEAREST); junk1.x = x; m = junk1.i[HIGH_HALF]; @@ -90,18 +95,19 @@ __ieee754_exp(double x) { rem=(bet + bet*eps)+al*eps; res = al + rem; cor = (al - res) + rem; - if (res == (res+cor*err_0)) return res*binexp.x; - else return __slowexp(x); /*if error is over bound */ + if (res == (res+cor*err_0)) { retval = res*binexp.x; goto ret; } + else { retval = __slowexp(x); goto ret; } /*if error is over bound */ } - if (n <= smallint) return 1.0; + if (n <= smallint) { retval = 1.0; goto ret; } if (n >= badint) { - if (n > infint) return(x+x); /* x is NaN */ - if (n < infint) return ( (x>0) ? (hhuge*hhuge) : (tiny*tiny) ); + if (n > infint) { retval = x+x; goto ret; } /* x is NaN */ + if (n < infint) { retval = (x>0) ? (hhuge*hhuge) : (tiny*tiny); goto ret; } /* x is finite, cause either overflow or underflow */ - if (junk1.i[LOW_HALF] != 0) return (x+x); /* x is NaN */ - return ((x>0)?inf.x:zero ); /* |x| = inf; return either inf or 0 */ + if (junk1.i[LOW_HALF] != 0) { retval = x+x; goto ret; } /* x is NaN */ + retval = (x>0)?inf.x:zero; /* |x| = inf; return either inf or 0 */ + goto ret; } y = x*log2e.x + three51.x; @@ -126,8 +132,8 @@ __ieee754_exp(double x) { if (res < 1.0) {res+=res; cor+=cor; ex-=1;} if (ex >=-1022) { binexp.i[HIGH_HALF] = (1023+ex)<<20; - if (res == (res+cor*err_0)) return res*binexp.x; - else return __slowexp(x); /*if error is over bound */ + if (res == (res+cor*err_0)) { retval = res*binexp.x; goto ret; } + else { retval = __slowexp(x); goto ret; } /*if error is over bound */ } ex = -(1022+ex); binexp.i[HIGH_HALF] = (1023-ex)<<20; @@ -140,15 +146,19 @@ __ieee754_exp(double x) { cor = (t-res)+y; if (res == (res + eps*cor)) { binexp.i[HIGH_HALF] = 0x00100000; - return (res-1.0)*binexp.x; + retval = (res-1.0)*binexp.x; + goto ret; } - else return __slowexp(x); /* if error is over bound */ + else { retval = __slowexp(x); goto ret; } /* if error is over bound */ } else { binexp.i[HIGH_HALF] =(junk1.i[LOW_HALF]+767)<<20; - if (res == (res+cor*err_0)) return res*binexp.x*t256.x; - else return __slowexp(x); + if (res == (res+cor*err_0)) { retval = res*binexp.x*t256.x; goto ret; } + else { retval = __slowexp(x); goto ret; } } + ret: + libc_feupdateenv (&env); + return retval; } #ifndef __ieee754_exp strong_alias (__ieee754_exp, __exp_finite) diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c index 28435fd..f668b4b 100644 --- a/sysdeps/ieee754/dbl-64/e_pow.c +++ b/sysdeps/ieee754/dbl-64/e_pow.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001, 2002, 2004, 2011 Free Software Foundation + * Copyright (C) 2001-2012 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 @@ -41,6 +41,7 @@ #include "MathLib.h" #include "upow.tbl" #include "math_private.h" +#include <fenv.h> #ifndef SECTION # define SECTION @@ -84,6 +85,11 @@ __ieee754_pow(double x, double y) { (u.i[HIGH_HALF]==0 && u.i[LOW_HALF]!=0)) && /* 2^-1023< x<= 2^-1023 * 0x1.0000ffffffff */ (v.i[HIGH_HALF]&0x7fffffff) < 0x4ff00000) { /* if y<-1 or y>1 */ + fenv_t env; + double retval; + + libc_feholdexcept_setround (&env, FE_TONEAREST); + z = log1(x,&aa,&error); /* x^y =e^(y log (X)) */ t = y*134217729.0; y1 = t - (t-y); @@ -97,7 +103,10 @@ __ieee754_pow(double x, double y) { a2 = (a-a1)+aa; error = error*ABS(y); t = __exp1(a1,a2,1.9e16*error); /* return -10 or 0 if wasn't computed exactly */ - return (t>0)?t:power1(x,y); + retval = (t>0)?t:power1(x,y); + + libc_feupdateenv (&env); + return retval; } if (x == 0) { diff --git a/sysdeps/ieee754/dbl-64/s_scalbln.c b/sysdeps/ieee754/dbl-64/s_scalbln.c index 89174b4..b5903c9 100644 --- a/sysdeps/ieee754/dbl-64/s_scalbln.c +++ b/sysdeps/ieee754/dbl-64/s_scalbln.c @@ -38,11 +38,13 @@ __scalbln (double x, long int n) k = ((hx&0x7ff00000)>>20) - 54; } if (__builtin_expect(k==0x7ff, 0)) return x+x; /* NaN or Inf */ - k = k+n; - if (__builtin_expect(n> 50000 || k > 0x7fe, 0)) - return huge*__copysign(huge,x); /* overflow */ if (__builtin_expect(n< -50000, 0)) return tiny*__copysign(tiny,x); /*underflow*/ + if (__builtin_expect(n> 50000 || k+n > 0x7fe, 0)) + return huge*__copysign(huge,x); /* overflow */ + /* Now k and n are bounded we know that k = k+n does not + overflow. */ + k = k+n; if (__builtin_expect(k > 0, 1)) /* normal result */ {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;} if (k <= -54) diff --git a/sysdeps/ieee754/dbl-64/s_scalbn.c b/sysdeps/ieee754/dbl-64/s_scalbn.c index 1e67dbe..c2488fb 100644 --- a/sysdeps/ieee754/dbl-64/s_scalbn.c +++ b/sysdeps/ieee754/dbl-64/s_scalbn.c @@ -38,11 +38,13 @@ __scalbn (double x, int n) k = ((hx&0x7ff00000)>>20) - 54; } if (__builtin_expect(k==0x7ff, 0)) return x+x; /* NaN or Inf */ - k = k+n; - if (__builtin_expect(n> 50000 || k > 0x7fe, 0)) - return huge*__copysign(huge,x); /* overflow */ if (__builtin_expect(n< -50000, 0)) return tiny*__copysign(tiny,x); /*underflow*/ + if (__builtin_expect(n> 50000 || k+n > 0x7fe, 0)) + return huge*__copysign(huge,x); /* overflow */ + /* Now k and n are bounded we know that k = k+n does not + overflow. */ + k = k+n; if (__builtin_expect(k > 0, 1)) /* normal result */ {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;} if (k <= -54) diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c index 5b79854..32ba66d 100644 --- a/sysdeps/ieee754/dbl-64/s_sin.c +++ b/sysdeps/ieee754/dbl-64/s_sin.c @@ -53,6 +53,7 @@ #include "usncs.h" #include "MathLib.h" #include "math_private.h" +#include <fenv.h> #ifndef SECTION # define SECTION @@ -107,12 +108,16 @@ __sin(double x){ #if 0 int4 nn; #endif + fenv_t env; + double retval = 0; + + libc_feholdexcept_setround (&env, FE_TONEAREST); u.x = x; m = u.i[HIGH_HALF]; k = 0x7fffffff&m; /* no sign */ if (k < 0x3e500000) /* if x->0 =>sin(x)=x */ - return x; + { retval = x; goto ret; } /*---------------------------- 2^-26 < |x|< 0.25 ----------------------*/ else if (k < 0x3fd00000){ xx = x*x; @@ -120,7 +125,8 @@ __sin(double x){ t = ((((s5.x*xx + s4.x)*xx + s3.x)*xx + s2.x)*xx + s1.x)*(xx*x); res = x+t; cor = (x-res)+t; - return (res == res + 1.07*cor)? res : slow(x); + retval = (res == res + 1.07*cor)? res : slow(x); + goto ret; } /* else if (k < 0x3fd00000) */ /*---------------------------- 0.25<|x|< 0.855469---------------------- */ else if (k < 0x3feb6000) { @@ -137,7 +143,8 @@ __sin(double x){ cor=(ssn+s*ccs-sn*c)+cs*s; res=sn+cor; cor=(sn-res)+cor; - return (res==res+1.096*cor)? res : slow1(x); + retval = (res==res+1.096*cor)? res : slow1(x); + goto ret; } /* else if (k < 0x3feb6000) */ /*----------------------- 0.855469 <|x|<2.426265 ----------------------*/ @@ -163,7 +170,8 @@ __sin(double x){ cor=(ccs-s*ssn-cs*c)-sn*s; res=cs+cor; cor=(cs-res)+cor; - return (res==res+1.020*cor)? ((m>0)?res:-res) : slow2(x); + retval = (res==res+1.020*cor)? ((m>0)?res:-res) : slow2(x); + goto ret; } /* else if (k < 0x400368fd) */ /*-------------------------- 2.426265<|x|< 105414350 ----------------------*/ @@ -189,7 +197,8 @@ __sin(double x){ res = a+t; cor = (a-res)+t; cor = (cor>0)? 1.02*cor+eps : 1.02*cor -eps; - return (res == res + cor)? res : sloww(a,da,x); + retval = (res == res + cor)? res : sloww(a,da,x); + goto ret; } else { if (a>0) @@ -210,7 +219,8 @@ __sin(double x){ res=sn+cor; cor=(sn-res)+cor; cor = (cor>0)? 1.035*cor+eps : 1.035*cor-eps; - return (res==res+cor)? ((m)?res:-res) : sloww1(a,da,x); + retval = (res==res+cor)? ((m)?res:-res) : sloww1(a,da,x); + goto ret; } break; @@ -232,7 +242,8 @@ __sin(double x){ res=cs+cor; cor=(cs-res)+cor; cor = (cor>0)? 1.025*cor+eps : 1.025*cor-eps; - return (res==res+cor)? ((n&2)?-res:res) : sloww2(a,da,x,n); + retval = (res==res+cor)? ((n&2)?-res:res) : sloww2(a,da,x,n); + goto ret; break; @@ -268,7 +279,8 @@ __sin(double x){ res = a+t; cor = (a-res)+t; cor = (cor>0)? 1.02*cor+eps : 1.02*cor -eps; - return (res == res + cor)? res : bsloww(a,da,x,n); + retval = (res == res + cor)? res : bsloww(a,da,x,n); + goto ret; } else { if (a>0) {m=1;t=a;db=da;} @@ -287,7 +299,8 @@ __sin(double x){ res=sn+cor; cor=(sn-res)+cor; cor = (cor>0)? 1.035*cor+eps : 1.035*cor-eps; - return (res==res+cor)? ((m)?res:-res) : bsloww1(a,da,x,n); + retval = (res==res+cor)? ((m)?res:-res) : bsloww1(a,da,x,n); + goto ret; } break; @@ -309,7 +322,8 @@ __sin(double x){ res=cs+cor; cor=(cs-res)+cor; cor = (cor>0)? 1.025*cor+eps : 1.025*cor-eps; - return (res==res+cor)? ((n&2)?-res:res) : bsloww2(a,da,x,n); + retval = (res==res+cor)? ((n&2)?-res:res) : bsloww2(a,da,x,n); + goto ret; break; @@ -323,17 +337,20 @@ __sin(double x){ n = __branred(x,&a,&da); switch (n) { case 0: - if (a*a < 0.01588) return bsloww(a,da,x,n); - else return bsloww1(a,da,x,n); + if (a*a < 0.01588) retval = bsloww(a,da,x,n); + else retval = bsloww1(a,da,x,n); + goto ret; break; case 2: - if (a*a < 0.01588) return bsloww(-a,-da,x,n); - else return bsloww1(-a,-da,x,n); + if (a*a < 0.01588) retval = bsloww(-a,-da,x,n); + else retval = bsloww1(-a,-da,x,n); + goto ret; break; case 1: case 3: - return bsloww2(a,da,x,n); + retval = bsloww2(a,da,x,n); + goto ret; break; } @@ -343,9 +360,13 @@ __sin(double x){ else { if (k == 0x7ff00000 && u.i[LOW_HALF] == 0) __set_errno (EDOM); - return x / x; + retval = x / x; + goto ret; } - return 0; /* unreachable */ + + ret: + libc_feupdateenv (&env); + return retval; } @@ -362,11 +383,16 @@ __cos(double x) mynumber u,v; int4 k,m,n; + fenv_t env; + double retval = 0; + + libc_feholdexcept_setround (&env, FE_TONEAREST); + u.x = x; m = u.i[HIGH_HALF]; k = 0x7fffffff&m; - if (k < 0x3e400000 ) return 1.0; /* |x|<2^-27 => cos(x)=1 */ + if (k < 0x3e400000 ) { retval = 1.0; goto ret; } /* |x|<2^-27 => cos(x)=1 */ else if (k < 0x3feb6000 ) {/* 2^-27 < |x| < 0.855469 */ y=ABS(x); @@ -383,7 +409,8 @@ __cos(double x) cor=(ccs-s*ssn-cs*c)-sn*s; res=cs+cor; cor=(cs-res)+cor; - return (res==res+1.020*cor)? res : cslow2(x); + retval = (res==res+1.020*cor)? res : cslow2(x); + goto ret; } /* else if (k < 0x3feb6000) */ @@ -397,7 +424,8 @@ __cos(double x) res = a+t; cor = (a-res)+t; cor = (cor>0)? 1.02*cor+1.0e-31 : 1.02*cor -1.0e-31; - return (res == res + cor)? res : csloww(a,da,x); + retval = (res == res + cor)? res : csloww(a,da,x); + goto ret; } else { if (a>0) {m=1;t=a;db=da;} @@ -416,7 +444,8 @@ __cos(double x) res=sn+cor; cor=(sn-res)+cor; cor = (cor>0)? 1.035*cor+1.0e-31 : 1.035*cor-1.0e-31; - return (res==res+cor)? ((m)?res:-res) : csloww1(a,da,x); + retval = (res==res+cor)? ((m)?res:-res) : csloww1(a,da,x); + goto ret; } } /* else if (k < 0x400368fd) */ @@ -443,7 +472,8 @@ __cos(double x) res = a+t; cor = (a-res)+t; cor = (cor>0)? 1.02*cor+eps : 1.02*cor -eps; - return (res == res + cor)? res : csloww(a,da,x); + retval = (res == res + cor)? res : csloww(a,da,x); + goto ret; } else { if (a>0) {m=1;t=a;db=da;} @@ -462,7 +492,8 @@ __cos(double x) res=sn+cor; cor=(sn-res)+cor; cor = (cor>0)? 1.035*cor+eps : 1.035*cor-eps; - return (res==res+cor)? ((m)?res:-res) : csloww1(a,da,x); + retval = (res==res+cor)? ((m)?res:-res) : csloww1(a,da,x); + goto ret; } break; @@ -483,7 +514,8 @@ __cos(double x) res=cs+cor; cor=(cs-res)+cor; cor = (cor>0)? 1.025*cor+eps : 1.025*cor-eps; - return (res==res+cor)? ((n)?-res:res) : csloww2(a,da,x,n); + retval = (res==res+cor)? ((n)?-res:res) : csloww2(a,da,x,n); + goto ret; break; @@ -518,7 +550,8 @@ __cos(double x) res = a+t; cor = (a-res)+t; cor = (cor>0)? 1.02*cor+eps : 1.02*cor -eps; - return (res == res + cor)? res : bsloww(a,da,x,n); + retval = (res == res + cor)? res : bsloww(a,da,x,n); + goto ret; } else { if (a>0) {m=1;t=a;db=da;} @@ -537,7 +570,8 @@ __cos(double x) res=sn+cor; cor=(sn-res)+cor; cor = (cor>0)? 1.035*cor+eps : 1.035*cor-eps; - return (res==res+cor)? ((m)?res:-res) : bsloww1(a,da,x,n); + retval = (res==res+cor)? ((m)?res:-res) : bsloww1(a,da,x,n); + goto ret; } break; @@ -558,7 +592,8 @@ __cos(double x) res=cs+cor; cor=(cs-res)+cor; cor = (cor>0)? 1.025*cor+eps : 1.025*cor-eps; - return (res==res+cor)? ((n)?-res:res) : bsloww2(a,da,x,n); + retval = (res==res+cor)? ((n)?-res:res) : bsloww2(a,da,x,n); + goto ret; break; } @@ -570,17 +605,20 @@ __cos(double x) n = __branred(x,&a,&da); switch (n) { case 1: - if (a*a < 0.01588) return bsloww(-a,-da,x,n); - else return bsloww1(-a,-da,x,n); + if (a*a < 0.01588) retval = bsloww(-a,-da,x,n); + else retval = bsloww1(-a,-da,x,n); + goto ret; break; case 3: - if (a*a < 0.01588) return bsloww(a,da,x,n); - else return bsloww1(a,da,x,n); + if (a*a < 0.01588) retval = bsloww(a,da,x,n); + else retval = bsloww1(a,da,x,n); + goto ret; break; case 0: case 2: - return bsloww2(a,da,x,n); + retval = bsloww2(a,da,x,n); + goto ret; break; } @@ -592,10 +630,13 @@ __cos(double x) else { if (k == 0x7ff00000 && u.i[LOW_HALF] == 0) __set_errno (EDOM); - return x / x; /* |x| > 2^1024 */ + retval = x / x; /* |x| > 2^1024 */ + goto ret; } - return 0; + ret: + libc_feupdateenv (&env); + return retval; } /************************************************************************/ diff --git a/sysdeps/ieee754/dbl-64/s_tan.c b/sysdeps/ieee754/dbl-64/s_tan.c index 962a4eb..2c26756 100644 --- a/sysdeps/ieee754/dbl-64/s_tan.c +++ b/sysdeps/ieee754/dbl-64/s_tan.c @@ -39,6 +39,8 @@ #include "mpa.h" #include "MathLib.h" #include "math.h" +#include "math_private.h" +#include <fenv.h> #ifndef SECTION # define SECTION @@ -66,21 +68,27 @@ tan(double x) { mp_no mpy; #endif + fenv_t env; + double retval; + int __branred(double, double *, double *); int __mpranred(double, mp_no *, int); + libc_feholdexcept_setround (&env, FE_TONEAREST); + /* x=+-INF, x=NaN */ num.d = x; ux = num.i[HIGH_HALF]; if ((ux&0x7ff00000)==0x7ff00000) { if ((ux&0x7fffffff)==0x7ff00000) __set_errno (EDOM); - return x-x; + retval = x-x; + goto ret; } w=(x<ZERO) ? -x : x; /* (I) The case abs(x) <= 1.259e-8 */ - if (w<=g1.d) return x; + if (w<=g1.d) { retval = x; goto ret; } /* (II) The case 1.259e-8 < abs(x) <= 0.0608 */ if (w<=g2.d) { @@ -88,7 +96,7 @@ tan(double x) { /* First stage */ x2 = x*x; t2 = x*x2*(d3.d+x2*(d5.d+x2*(d7.d+x2*(d9.d+x2*d11.d)))); - if ((y=x+(t2-u1.d*t2)) == x+(t2+u1.d*t2)) return y; + if ((y=x+(t2-u1.d*t2)) == x+(t2+u1.d*t2)) { retval = y; goto ret; } /* Second stage */ c1 = x2*(a15.d+x2*(a17.d+x2*(a19.d+x2*(a21.d+x2*(a23.d+x2*(a25.d+ @@ -108,8 +116,9 @@ tan(double x) { MUL2(x2,xx2,c2,cc2,c1,cc1,t1,t2,t3,t4,t5,t6,t7,t8) MUL2(x ,zero.d,c1,cc1,c2,cc2,t1,t2,t3,t4,t5,t6,t7,t8) ADD2(x ,zero.d,c2,cc2,c1,cc1,t1,t2) - if ((y=c1+(cc1-u2.d*c1)) == c1+(cc1+u2.d*c1)) return y; - return tanMp(x); + if ((y=c1+(cc1-u2.d*c1)) == c1+(cc1+u2.d*c1)) { retval = y; goto ret; } + retval = tanMp(x); + goto ret; } /* (III) The case 0.0608 < abs(x) <= 0.787 */ @@ -120,10 +129,10 @@ tan(double x) { z = w-xfg[i][0].d; z2 = z*z; s = (x<ZERO) ? MONE : ONE; pz = z+z*z2*(e0.d+z2*e1.d); fi = xfg[i][1].d; gi = xfg[i][2].d; t2 = pz*(gi+fi)/(gi-pz); - if ((y=fi+(t2-fi*u3.d))==fi+(t2+fi*u3.d)) return (s*y); + if ((y=fi+(t2-fi*u3.d))==fi+(t2+fi*u3.d)) { retval = (s*y); goto ret; } t3 = (t2<ZERO) ? -t2 : t2; t4 = fi*ua3.d+t3*ub3.d; - if ((y=fi+(t2-t4))==fi+(t2+t4)) return (s*y); + if ((y=fi+(t2-t4))==fi+(t2+t4)) { retval = (s*y); goto ret; } /* Second stage */ ffi = xfg[i][3].d; @@ -141,8 +150,9 @@ tan(double x) { SUB2(one.d,zero.d,c3,cc3,c1,cc1,t1,t2) DIV2(c2,cc2,c1,cc1,c3,cc3,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) - if ((y=c3+(cc3-u4.d*c3))==c3+(cc3+u4.d*c3)) return (s*y); - return tanMp(x); + if ((y=c3+(cc3-u4.d*c3))==c3+(cc3+u4.d*c3)) { retval = (s*y); goto ret; } + retval = tanMp(x); + goto ret; } /* (---) The case 0.787 < abs(x) <= 25 */ @@ -160,7 +170,7 @@ tan(double x) { else {ya= a; yya= da; sy= ONE;} /* (IV),(V) The case 0.787 < abs(x) <= 25, abs(y) <= 1e-7 */ - if (ya<=gy1.d) return tanMp(x); + if (ya<=gy1.d) { retval = tanMp(x); goto ret; } /* (VI) The case 0.787 < abs(x) <= 25, 1e-7 < abs(y) <= 0.0608 */ if (ya<=gy2.d) { @@ -170,10 +180,10 @@ tan(double x) { /* First stage -cot */ EADD(a,t2,b,db) DIV2(one.d,zero.d,b,db,c,dc,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) - if ((y=c+(dc-u6.d*c))==c+(dc+u6.d*c)) return (-y); } + if ((y=c+(dc-u6.d*c))==c+(dc+u6.d*c)) { retval = (-y); goto ret; } } else { /* First stage tan */ - if ((y=a+(t2-u5.d*a))==a+(t2+u5.d*a)) return y; } + if ((y=a+(t2-u5.d*a))==a+(t2+u5.d*a)) { retval = y; goto ret; } } /* Second stage */ /* Range reduction by algorithm ii */ t = (x*hpinv.d + toint.d); @@ -211,11 +221,12 @@ tan(double x) { if (n) { /* Second stage -cot */ DIV2(one.d,zero.d,c1,cc1,c2,cc2,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) - if ((y=c2+(cc2-u8.d*c2)) == c2+(cc2+u8.d*c2)) return (-y); } + if ((y=c2+(cc2-u8.d*c2)) == c2+(cc2+u8.d*c2)) { retval = (-y); goto ret; } } else { /* Second stage tan */ - if ((y=c1+(cc1-u7.d*c1)) == c1+(cc1+u7.d*c1)) return y; } - return tanMp(x); + if ((y=c1+(cc1-u7.d*c1)) == c1+(cc1+u7.d*c1)) { retval = y; goto ret; } } + retval = tanMp(x); + goto ret; } /* (VII) The case 0.787 < abs(x) <= 25, 0.0608 < abs(y) <= 0.787 */ @@ -229,17 +240,17 @@ tan(double x) { if (n) { /* -cot */ t2 = pz*(fi+gi)/(fi+pz); - if ((y=gi-(t2-gi*u10.d))==gi-(t2+gi*u10.d)) return (-sy*y); + if ((y=gi-(t2-gi*u10.d))==gi-(t2+gi*u10.d)) { retval = (-sy*y); goto ret; } t3 = (t2<ZERO) ? -t2 : t2; t4 = gi*ua10.d+t3*ub10.d; - if ((y=gi-(t2-t4))==gi-(t2+t4)) return (-sy*y); } + if ((y=gi-(t2-t4))==gi-(t2+t4)) { retval = (-sy*y); goto ret; } } else { /* tan */ t2 = pz*(gi+fi)/(gi-pz); - if ((y=fi+(t2-fi*u9.d))==fi+(t2+fi*u9.d)) return (sy*y); + if ((y=fi+(t2-fi*u9.d))==fi+(t2+fi*u9.d)) { retval = (sy*y); goto ret; } t3 = (t2<ZERO) ? -t2 : t2; t4 = fi*ua9.d+t3*ub9.d; - if ((y=fi+(t2-t4))==fi+(t2+t4)) return (sy*y); } + if ((y=fi+(t2-t4))==fi+(t2+t4)) { retval = (sy*y); goto ret; } } /* Second stage */ ffi = xfg[i][3].d; @@ -260,13 +271,14 @@ tan(double x) { if (n) { /* -cot */ DIV2(c1,cc1,c2,cc2,c3,cc3,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) - if ((y=c3+(cc3-u12.d*c3))==c3+(cc3+u12.d*c3)) return (-sy*y); } + if ((y=c3+(cc3-u12.d*c3))==c3+(cc3+u12.d*c3)) { retval = (-sy*y); goto ret; } } else { /* tan */ DIV2(c2,cc2,c1,cc1,c3,cc3,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) - if ((y=c3+(cc3-u11.d*c3))==c3+(cc3+u11.d*c3)) return (sy*y); } + if ((y=c3+(cc3-u11.d*c3))==c3+(cc3+u11.d*c3)) { retval = (sy*y); goto ret; } } - return tanMp(x); + retval = tanMp(x); + goto ret; } /* (---) The case 25 < abs(x) <= 1e8 */ @@ -288,7 +300,7 @@ tan(double x) { else {ya= a; yya= da; sy= ONE;} /* (+++) The case 25 < abs(x) <= 1e8, abs(y) <= 1e-7 */ - if (ya<=gy1.d) return tanMp(x); + if (ya<=gy1.d) { retval = tanMp(x); goto ret; } /* (VIII) The case 25 < abs(x) <= 1e8, 1e-7 < abs(y) <= 0.0608 */ if (ya<=gy2.d) { @@ -298,10 +310,10 @@ tan(double x) { /* First stage -cot */ EADD(a,t2,b,db) DIV2(one.d,zero.d,b,db,c,dc,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) - if ((y=c+(dc-u14.d*c))==c+(dc+u14.d*c)) return (-y); } + if ((y=c+(dc-u14.d*c))==c+(dc+u14.d*c)) { retval = (-y); goto ret; } } else { /* First stage tan */ - if ((y=a+(t2-u13.d*a))==a+(t2+u13.d*a)) return y; } + if ((y=a+(t2-u13.d*a))==a+(t2+u13.d*a)) { retval = y; goto ret; } } /* Second stage */ MUL2(a,da,a,da,x2,xx2,t1,t2,t3,t4,t5,t6,t7,t8) @@ -325,11 +337,12 @@ tan(double x) { if (n) { /* Second stage -cot */ DIV2(one.d,zero.d,c1,cc1,c2,cc2,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) - if ((y=c2+(cc2-u16.d*c2)) == c2+(cc2+u16.d*c2)) return (-y); } + if ((y=c2+(cc2-u16.d*c2)) == c2+(cc2+u16.d*c2)) { retval = (-y); goto ret; } } else { /* Second stage tan */ - if ((y=c1+(cc1-u15.d*c1)) == c1+(cc1+u15.d*c1)) return (y); } - return tanMp(x); + if ((y=c1+(cc1-u15.d*c1)) == c1+(cc1+u15.d*c1)) { retval = (y); goto ret; } } + retval = tanMp(x); + goto ret; } /* (IX) The case 25 < abs(x) <= 1e8, 0.0608 < abs(y) <= 0.787 */ @@ -342,17 +355,17 @@ tan(double x) { if (n) { /* -cot */ t2 = pz*(fi+gi)/(fi+pz); - if ((y=gi-(t2-gi*u18.d))==gi-(t2+gi*u18.d)) return (-sy*y); + if ((y=gi-(t2-gi*u18.d))==gi-(t2+gi*u18.d)) { retval = (-sy*y); goto ret; } t3 = (t2<ZERO) ? -t2 : t2; t4 = gi*ua18.d+t3*ub18.d; - if ((y=gi-(t2-t4))==gi-(t2+t4)) return (-sy*y); } + if ((y=gi-(t2-t4))==gi-(t2+t4)) { retval = (-sy*y); goto ret; } } else { /* tan */ t2 = pz*(gi+fi)/(gi-pz); - if ((y=fi+(t2-fi*u17.d))==fi+(t2+fi*u17.d)) return (sy*y); + if ((y=fi+(t2-fi*u17.d))==fi+(t2+fi*u17.d)) { retval = (sy*y); goto ret; } t3 = (t2<ZERO) ? -t2 : t2; t4 = fi*ua17.d+t3*ub17.d; - if ((y=fi+(t2-t4))==fi+(t2+t4)) return (sy*y); } + if ((y=fi+(t2-t4))==fi+(t2+t4)) { retval = (sy*y); goto ret; } } /* Second stage */ ffi = xfg[i][3].d; @@ -373,12 +386,13 @@ tan(double x) { if (n) { /* -cot */ DIV2(c1,cc1,c2,cc2,c3,cc3,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) - if ((y=c3+(cc3-u20.d*c3))==c3+(cc3+u20.d*c3)) return (-sy*y); } + if ((y=c3+(cc3-u20.d*c3))==c3+(cc3+u20.d*c3)) { retval = (-sy*y); goto ret; } } else { /* tan */ DIV2(c2,cc2,c1,cc1,c3,cc3,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) - if ((y=c3+(cc3-u19.d*c3))==c3+(cc3+u19.d*c3)) return (sy*y); } - return tanMp(x); + if ((y=c3+(cc3-u19.d*c3))==c3+(cc3+u19.d*c3)) { retval = (sy*y); goto ret; } } + retval = tanMp(x); + goto ret; } /* (---) The case 1e8 < abs(x) < 2**1024 */ @@ -389,7 +403,7 @@ tan(double x) { else {ya= a; yya= da; sy= ONE;} /* (+++) The case 1e8 < abs(x) < 2**1024, abs(y) <= 1e-7 */ - if (ya<=gy1.d) return tanMp(x); + if (ya<=gy1.d) { retval = tanMp(x); goto ret; } /* (X) The case 1e8 < abs(x) < 2**1024, 1e-7 < abs(y) <= 0.0608 */ if (ya<=gy2.d) { @@ -399,10 +413,10 @@ tan(double x) { /* First stage -cot */ EADD(a,t2,b,db) DIV2(one.d,zero.d,b,db,c,dc,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) - if ((y=c+(dc-u22.d*c))==c+(dc+u22.d*c)) return (-y); } + if ((y=c+(dc-u22.d*c))==c+(dc+u22.d*c)) { retval = (-y); goto ret; } } else { /* First stage tan */ - if ((y=a+(t2-u21.d*a))==a+(t2+u21.d*a)) return y; } + if ((y=a+(t2-u21.d*a))==a+(t2+u21.d*a)) { retval = y; goto ret; } } /* Second stage */ /* Reduction by algorithm iv */ @@ -431,11 +445,12 @@ tan(double x) { if (n) { /* Second stage -cot */ DIV2(one.d,zero.d,c1,cc1,c2,cc2,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) - if ((y=c2+(cc2-u24.d*c2)) == c2+(cc2+u24.d*c2)) return (-y); } + if ((y=c2+(cc2-u24.d*c2)) == c2+(cc2+u24.d*c2)) { retval = (-y); goto ret; } } else { /* Second stage tan */ - if ((y=c1+(cc1-u23.d*c1)) == c1+(cc1+u23.d*c1)) return y; } - return tanMp(x); + if ((y=c1+(cc1-u23.d*c1)) == c1+(cc1+u23.d*c1)) { retval = y; goto ret; } } + retval = tanMp(x); + goto ret; } /* (XI) The case 1e8 < abs(x) < 2**1024, 0.0608 < abs(y) <= 0.787 */ @@ -448,17 +463,17 @@ tan(double x) { if (n) { /* -cot */ t2 = pz*(fi+gi)/(fi+pz); - if ((y=gi-(t2-gi*u26.d))==gi-(t2+gi*u26.d)) return (-sy*y); + if ((y=gi-(t2-gi*u26.d))==gi-(t2+gi*u26.d)) { retval = (-sy*y); goto ret; } t3 = (t2<ZERO) ? -t2 : t2; t4 = gi*ua26.d+t3*ub26.d; - if ((y=gi-(t2-t4))==gi-(t2+t4)) return (-sy*y); } + if ((y=gi-(t2-t4))==gi-(t2+t4)) { retval = (-sy*y); goto ret; } } else { /* tan */ t2 = pz*(gi+fi)/(gi-pz); - if ((y=fi+(t2-fi*u25.d))==fi+(t2+fi*u25.d)) return (sy*y); + if ((y=fi+(t2-fi*u25.d))==fi+(t2+fi*u25.d)) { retval = (sy*y); goto ret; } t3 = (t2<ZERO) ? -t2 : t2; t4 = fi*ua25.d+t3*ub25.d; - if ((y=fi+(t2-t4))==fi+(t2+t4)) return (sy*y); } + if ((y=fi+(t2-t4))==fi+(t2+t4)) { retval = (sy*y); goto ret; } } /* Second stage */ ffi = xfg[i][3].d; @@ -479,14 +494,18 @@ tan(double x) { if (n) { /* -cot */ DIV2(c1,cc1,c2,cc2,c3,cc3,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) - if ((y=c3+(cc3-u28.d*c3))==c3+(cc3+u28.d*c3)) return (-sy*y); } + if ((y=c3+(cc3-u28.d*c3))==c3+(cc3+u28.d*c3)) { retval = (-sy*y); goto ret; } } else { /* tan */ DIV2(c2,cc2,c1,cc1,c3,cc3,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) - if ((y=c3+(cc3-u27.d*c3))==c3+(cc3+u27.d*c3)) return (sy*y); } - return tanMp(x); -} + if ((y=c3+(cc3-u27.d*c3))==c3+(cc3+u27.d*c3)) { retval = (sy*y); goto ret; } } + retval = tanMp(x); + goto ret; + ret: + libc_feupdateenv (&env); + return retval; +} /* multiple precision stage */ /* Convert x to multi precision number,compute tan(x) by mptan() routine */ diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbln.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbln.c index d6b97b5..1d0da68 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbln.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbln.c @@ -39,11 +39,13 @@ __scalbln (double x, long int n) k = ((ix >> 52) & 0x7ff) - 54; } if (__builtin_expect(k==0x7ff, 0)) return x+x; /* NaN or Inf */ - k = k+n; - if (__builtin_expect(n> 50000 || k > 0x7fe, 0)) - return huge*__copysign(huge,x); /* overflow */ if (__builtin_expect(n< -50000, 0)) return tiny*__copysign(tiny,x); /*underflow*/ + if (__builtin_expect(n> 50000 || k+n > 0x7fe, 0)) + return huge*__copysign(huge,x); /* overflow */ + /* Now k and n are bounded we know that k = k+n does not + overflow. */ + k = k+n; if (__builtin_expect(k > 0, 1)) /* normal result */ {INSERT_WORDS64(x,(ix&UINT64_C(0x800fffffffffffff))|(k<<52)); return x;} diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c index 7f0e21f..e183c38 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c @@ -39,11 +39,13 @@ __scalbn (double x, int n) k = ((ix >> 52) & 0x7ff) - 54; } if (__builtin_expect(k==0x7ff, 0)) return x+x; /* NaN or Inf */ - k = k+n; - if (__builtin_expect(n> 50000 || k > 0x7fe, 0)) - return huge*__copysign(huge,x); /* overflow */ if (__builtin_expect(n< -50000, 0)) return tiny*__copysign(tiny,x); /*underflow*/ + if (__builtin_expect(n> 50000 || k+n > 0x7fe, 0)) + return huge*__copysign(huge,x); /* overflow */ + /* Now k and n are bounded we know that k = k+n does not + overflow. */ + k = k+n; if (__builtin_expect(k > 0, 1)) /* normal result */ {INSERT_WORDS64(x,(ix&UINT64_C(0x800fffffffffffff))|(k<<52)); return x;} diff --git a/sysdeps/ieee754/flt-32/s_erff.c b/sysdeps/ieee754/flt-32/s_erff.c index 5766183..8a0610d 100644 --- a/sysdeps/ieee754/flt-32/s_erff.c +++ b/sysdeps/ieee754/flt-32/s_erff.c @@ -200,7 +200,7 @@ float __erfcf(float x) sb5+s*(sb6+s*sb7)))))); } GET_FLOAT_WORD(ix,x); - SET_FLOAT_WORD(z,ix&0xfffff000); + SET_FLOAT_WORD(z,ix&0xffffe000); r = __ieee754_expf(-z*z-(float)0.5625)* __ieee754_expf((z-x)*(z+x)+R/S); if(hx>0) return r/x; else return two-r/x; diff --git a/sysdeps/ieee754/flt-32/s_scalblnf.c b/sysdeps/ieee754/flt-32/s_scalblnf.c index 5256c32..2a2d7ab 100644 --- a/sysdeps/ieee754/flt-32/s_scalblnf.c +++ b/sysdeps/ieee754/flt-32/s_scalblnf.c @@ -35,11 +35,13 @@ __scalblnf (float x, long int n) k = ((ix&0x7f800000)>>23) - 25; } if (__builtin_expect(k==0xff, 0)) return x+x; /* NaN or Inf */ - k = k+n; - if (__builtin_expect(n> 50000 || k > 0xfe, 0)) - return huge*copysignf(huge,x); /* overflow */ if (__builtin_expect(n< -50000, 0)) return tiny*copysignf(tiny,x); /*underflow*/ + if (__builtin_expect(n> 50000 || k+n > 0xfe, 0)) + return huge*copysignf(huge,x); /* overflow */ + /* Now k and n are bounded we know that k = k+n does not + overflow. */ + k = k+n; if (__builtin_expect(k > 0, 1)) /* normal result */ {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;} if (k <= -25) diff --git a/sysdeps/ieee754/flt-32/s_scalbnf.c b/sysdeps/ieee754/flt-32/s_scalbnf.c index 3be2925..a7cb1a1 100644 --- a/sysdeps/ieee754/flt-32/s_scalbnf.c +++ b/sysdeps/ieee754/flt-32/s_scalbnf.c @@ -35,11 +35,13 @@ __scalbnf (float x, int n) k = ((ix&0x7f800000)>>23) - 25; } if (__builtin_expect(k==0xff, 0)) return x+x; /* NaN or Inf */ - k = k+n; - if (__builtin_expect(n> 50000 || k > 0xfe, 0)) - return huge*__copysignf(huge,x); /* overflow */ if (__builtin_expect(n< -50000, 0)) return tiny*__copysignf(tiny,x); /*underflow*/ + if (__builtin_expect(n> 50000 || k+n > 0xfe, 0)) + return huge*__copysignf(huge,x); /* overflow */ + /* Now k and n are bounded we know that k = k+n does not + overflow. */ + k = k+n; if (__builtin_expect(k > 0, 1)) /* normal result */ {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;} if (k <= -25) diff --git a/sysdeps/ieee754/ldbl-128/s_scalblnl.c b/sysdeps/ieee754/ldbl-128/s_scalblnl.c index f5624e2..9ad976b 100644 --- a/sysdeps/ieee754/ldbl-128/s_scalblnl.c +++ b/sysdeps/ieee754/ldbl-128/s_scalblnl.c @@ -46,10 +46,12 @@ long double __scalblnl (long double x, long int n) k = ((hx>>48)&0x7fff) - 114; } if (k==0x7fff) return x+x; /* NaN or Inf */ - k = k+n; - if (n> 50000 || k > 0x7ffe) - return huge*__copysignl(huge,x); /* overflow */ if (n< -50000) return tiny*__copysignl(tiny,x); /*underflow*/ + if (n> 50000 || k+n > 0x7ffe) + return huge*__copysignl(huge,x); /* overflow */ + /* Now k and n are bounded we know that k = k+n does not + overflow. */ + k = k+n; if (k > 0) /* normal result */ {SET_LDOUBLE_MSW64(x,(hx&0x8000ffffffffffffULL)|(k<<48)); return x;} if (k <= -114) diff --git a/sysdeps/ieee754/ldbl-128/s_scalbnl.c b/sysdeps/ieee754/ldbl-128/s_scalbnl.c index b9de0f7..a928ecc 100644 --- a/sysdeps/ieee754/ldbl-128/s_scalbnl.c +++ b/sysdeps/ieee754/ldbl-128/s_scalbnl.c @@ -46,10 +46,12 @@ long double __scalbnl (long double x, int n) k = ((hx>>48)&0x7fff) - 114; } if (k==0x7fff) return x+x; /* NaN or Inf */ - k = k+n; - if (n> 50000 || k > 0x7ffe) - return huge*__copysignl(huge,x); /* overflow */ if (n< -50000) return tiny*__copysignl(tiny,x); /*underflow*/ + if (n> 50000 || k+n > 0x7ffe) + return huge*__copysignl(huge,x); /* overflow */ + /* Now k and n are bounded we know that k = k+n does not + overflow. */ + k = k+n; if (k > 0) /* normal result */ {SET_LDOUBLE_MSW64(x,(hx&0x8000ffffffffffffULL)|(k<<48)); return x;} if (k <= -114) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_coshl.c b/sysdeps/ieee754/ldbl-128ibm/e_coshl.c index ebc9436..569b841 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_coshl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_coshl.c @@ -20,9 +20,9 @@ * 2*exp(x) * * exp(x) + 1/exp(x) - * ln2/2 <= x <= 22 : cosh(x) := ------------------- + * ln2/2 <= x <= 40 : cosh(x) := ------------------- * 2 - * 22 <= x <= lnovft : cosh(x) := exp(x)/2 + * 40 <= 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) * @@ -57,13 +57,13 @@ __ieee754_coshl (long double x) return one+(t*t)/(w+w); } - /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */ - if (ix < 0x4036000000000000LL) { + /* |x| in [0.5*ln2,40], return (exp(|x|)+1/exp(|x|)/2; */ + if (ix < 0x4044000000000000LL) { t = __ieee754_expl(fabsl(x)); return half*t+half/t; } - /* |x| in [22, log(maxdouble)] return half*exp(|x|) */ + /* |x| in [40, log(maxdouble)] return half*exp(|x|) */ if (ix < 0x40862e42fefa39efLL) return half*__ieee754_expl(fabsl(x)); /* |x| in [log(maxdouble), overflowthresold] */ diff --git a/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c b/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c index b8e86b1..4b53d90 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c @@ -16,10 +16,10 @@ * 1. Replace x by |x| (sinh(-x) = -sinh(x)). * 2. * E + E/(E+1) - * 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x) + * 0 <= x <= 40 : sinh(x) := --------------, E=expm1(x) * 2 * - * 22 <= x <= lnovft : sinh(x) := exp(x)/2 + * 40 <= 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) * @@ -48,8 +48,8 @@ __ieee754_sinhl(long double 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 */ + /* |x| in [0,40], return sign(x)*0.5*(E+E/(E+1))) */ + if (ix < 0x4044000000000000LL) { /* |x|<40 */ if (ix<0x3e20000000000000LL) /* |x|<2**-29 */ if(shuge+x>one) return x;/* sinhl(tiny) = tiny with inexact */ t = __expm1l(fabsl(x)); @@ -57,7 +57,7 @@ __ieee754_sinhl(long double x) return h*(t+t/(t+one)); } - /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */ + /* |x| in [40, log(maxdouble)] return 0.5*exp(|x|) */ if (ix < 0x40862e42fefa39efLL) return h*__ieee754_expl(fabsl(x)); /* |x| in [log(maxdouble), overflowthresold] */ diff --git a/sysdeps/ieee754/ldbl-128ibm/s_erfl.c b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c index 85cdbe0..8868f7e 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_erfl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c @@ -920,7 +920,8 @@ __erfcl (long double x) } u.value = x; u.parts32.w3 = 0; - u.parts32.w2 &= 0xffffe000; + u.parts32.w2 = 0; + u.parts32.w1 &= 0xf8000000; z = u.value; r = __ieee754_expl (-z * z - 0.5625) * __ieee754_expl ((z - x) * (z + x) + p); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c b/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c index a1632e7..2c30d1c 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c @@ -52,10 +52,12 @@ long double __scalblnl (long double x, long int n) 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 (n> 50000 || k+n > 0x7fe) + return huge*__copysignl(huge,x); /* overflow */ + /* Now k and n are bounded we know that k = k+n does not + overflow. */ + k = k+n; if (k > 0) { /* normal result */ hx = (hx&0x800fffffffffffffULL)|(k<<52); if ((lx & 0x7fffffffffffffffULL) == 0) { /* low part +-0 */ diff --git a/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c b/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c index a52cd42..48102ef 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c @@ -52,10 +52,12 @@ long double __scalbnl (long double x, int n) 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 (n> 50000 || k+n > 0x7fe) + return huge*__copysignl(huge,x); /* overflow */ + /* Now k and n are bounded we know that k = k+n does not + overflow. */ + k = k+n; if (k > 0) { /* normal result */ hx = (hx&0x800fffffffffffffULL)|(k<<52); if ((lx & 0x7fffffffffffffffULL) == 0) { /* low part +-0 */ diff --git a/sysdeps/ieee754/ldbl-96/s_scalblnl.c b/sysdeps/ieee754/ldbl-96/s_scalblnl.c index ada587b..755a212 100644 --- a/sysdeps/ieee754/ldbl-96/s_scalblnl.c +++ b/sysdeps/ieee754/ldbl-96/s_scalblnl.c @@ -43,11 +43,13 @@ __scalblnl (long double x, long int n) k = (hx&0x7fff) - 63; } if (__builtin_expect(k==0x7fff, 0)) return x+x; /* NaN or Inf */ - k = k+n; - if (__builtin_expect(n> 50000 || k > 0x7ffe, 0)) - return huge*__copysignl(huge,x); /* overflow */ if (__builtin_expect(n< -50000, 0)) return tiny*__copysignl(tiny,x); + if (__builtin_expect(n> 50000 || k+n > 0x7ffe, 0)) + return huge*__copysignl(huge,x); /* overflow */ + /* Now k and n are bounded we know that k = k+n does not + overflow. */ + k = k+n; if (__builtin_expect(k > 0, 1)) /* normal result */ {SET_LDOUBLE_EXP(x,(es&0x8000)|k); return x;} if (k <= -63) diff --git a/sysdeps/ieee754/ldbl-96/s_scalbnl.c b/sysdeps/ieee754/ldbl-96/s_scalbnl.c index 6a41920..6946cf2 100644 --- a/sysdeps/ieee754/ldbl-96/s_scalbnl.c +++ b/sysdeps/ieee754/ldbl-96/s_scalbnl.c @@ -43,11 +43,13 @@ __scalbnl (long double x, int n) k = (hx&0x7fff) - 64; } if (__builtin_expect(k==0x7fff, 0)) return x+x; /* NaN or Inf */ - k = k+n; - if (__builtin_expect(n> 50000 || k > 0x7ffe, 0)) - return huge*__copysignl(huge,x); /* overflow */ if (__builtin_expect(n< -50000, 0)) return tiny*__copysignl(tiny,x); + if (__builtin_expect(n> 50000 || k+n > 0x7ffe, 0)) + return huge*__copysignl(huge,x); /* overflow */ + /* Now k and n are bounded we know that k = k+n does not + overflow. */ + k = k+n; if (__builtin_expect(k > 0, 1)) /* normal result */ {SET_LDOUBLE_EXP(x,(es&0x8000)|k); return x;} if (k <= -64) diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps index 589bae1..f3d4dd9 100644 --- a/sysdeps/powerpc/fpu/libm-test-ulps +++ b/sysdeps/powerpc/fpu/libm-test-ulps @@ -32,9 +32,26 @@ float: 1 ifloat: 1 # cabs +Test "cabs (-0.75 + 12.390625 i) == 12.4133028598606664302388810868156657": +float: 1 +ifloat: 1 +Test "cabs (-0.75 - 12.390625 i) == 12.4133028598606664302388810868156657": +float: 1 +ifloat: 1 +Test "cabs (-12.390625 + 0.75 i) == 12.4133028598606664302388810868156657": +float: 1 +ifloat: 1 +Test "cabs (-12.390625 - 0.75 i) == 12.4133028598606664302388810868156657": +float: 1 +ifloat: 1 Test "cabs (0.75 + 1.25 i) == 1.45773797371132511771853821938639577": +float: 1 +ifloat: 1 ildouble: 1 ldouble: 1 +Test "cabs (0.75 + 12.390625 i) == 12.4133028598606664302388810868156657": +float: 1 +ifloat: 1 # cacosh Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": @@ -172,8 +189,8 @@ 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 +float: 2 +ifloat: 2 ildouble: 2 ldouble: 2 Test "Imaginary part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": @@ -195,6 +212,9 @@ idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 +Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": +double: 1 +idouble: 1 Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": double: 1 float: 5 @@ -262,8 +282,8 @@ 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 +float: 2 +ifloat: 2 ildouble: 3 ldouble: 3 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i": @@ -315,6 +335,152 @@ float: 1 idouble: 1 ifloat: 1 +# cos_downward +Test "cos_downward (1) == 0.5403023058681397174009366074429766037323": +float: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 +Test "cos_downward (10) == -0.8390715290764524522588639478240648345199": +ildouble: 1 +ldouble: 1 +Test "cos_downward (2) == -0.4161468365471423869975682295007621897660": +float: 1 +ifloat: 1 +Test "cos_downward (3) == -0.9899924966004454572715727947312613023937": +float: 1 +ifloat: 1 +Test "cos_downward (4) == -0.6536436208636119146391681830977503814241": +float: 1 +ifloat: 1 +Test "cos_downward (5) == 0.2836621854632262644666391715135573083344": +float: 1 +ifloat: 1 +Test "cos_downward (6) == 0.9601702866503660205456522979229244054519": +ildouble: 1 +ldouble: 1 +Test "cos_downward (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +Test "cos_downward (8) == -0.1455000338086135258688413818311946826093": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "cos_downward (9) == -0.9111302618846769883682947111811653112463": +ildouble: 1 +ldouble: 1 + +# cos_tonearest +Test "cos_tonearest (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 + +# cos_towardzero +Test "cos_towardzero (1) == 0.5403023058681397174009366074429766037323": +ildouble: 2 +ldouble: 2 +Test "cos_towardzero (10) == -0.8390715290764524522588639478240648345199": +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (2) == -0.4161468365471423869975682295007621897660": +float: 1 +ifloat: 1 +Test "cos_towardzero (3) == -0.9899924966004454572715727947312613023937": +float: 1 +ifloat: 1 +Test "cos_towardzero (4) == -0.6536436208636119146391681830977503814241": +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (5) == 0.2836621854632262644666391715135573083344": +float: 1 +ifloat: 1 +Test "cos_towardzero (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +Test "cos_towardzero (8) == -0.1455000338086135258688413818311946826093": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +# cos_upward +Test "cos_upward (1) == 0.5403023058681397174009366074429766037323": +ildouble: 2 +ldouble: 2 +Test "cos_upward (10) == -0.8390715290764524522588639478240648345199": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_upward (4) == -0.6536436208636119146391681830977503814241": +ildouble: 1 +ldouble: 1 +Test "cos_upward (5) == 0.2836621854632262644666391715135573083344": +ildouble: 1 +ldouble: 1 +Test "cos_upward (6) == 0.9601702866503660205456522979229244054519": +float: 1 +ifloat: 1 +Test "cos_upward (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_upward (9) == -0.9111302618846769883682947111811653112463": +float: 2 +ifloat: 2 + +# cosh_downward +Test "cosh_downward (22) == 1792456423.065795780980053377632656584997": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cosh_downward (23) == 4872401723.124451300068625740569997090344": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cosh_downward (24) == 13244561064.92173614708845674912733665919": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cosh_tonearest +Test "cosh_tonearest (24) == 13244561064.92173614708845674912733665919": +ildouble: 1 +ldouble: 1 + +# cosh_towardzero +Test "cosh_towardzero (22) == 1792456423.065795780980053377632656584997": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cosh_towardzero (23) == 4872401723.124451300068625740569997090344": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cosh_towardzero (24) == 13244561064.92173614708845674912733665919": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cosh_upward +Test "cosh_upward (22) == 1792456423.065795780980053377632656584997": +ildouble: 2 +ldouble: 2 +Test "cosh_upward (23) == 4872401723.124451300068625740569997090344": +ildouble: 2 +ldouble: 2 +Test "cosh_upward (24) == 13244561064.92173614708845674912733665919": +ildouble: 2 +ldouble: 2 + # cpow Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": float: 1 @@ -322,8 +488,8 @@ 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 +float: 2 +ifloat: 2 ildouble: 1 ldouble: 1 Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i": @@ -331,14 +497,22 @@ double: 1 float: 4 idouble: 1 ifloat: 4 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i": +float: 1 +ifloat: 1 Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": +float: 1 +ifloat: 1 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 +float: 4 idouble: 2 -ifloat: 3 +ifloat: 4 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i": +float: 1 +ifloat: 1 Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i": ildouble: 1 ldouble: 1 @@ -381,9 +555,21 @@ ldouble: 1 Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i": float: 1 ifloat: 1 +Test "Imaginary part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i": float: 1 ifloat: 1 +Test "Imaginary part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 +Test "Real part of: csqrt (0 - 1 i) == M_SQRT_2_2 - M_SQRT_2_2 i": +double: 1 +idouble: 1 +Test "Imaginary part of: csqrt (0 - 1 i) == M_SQRT_2_2 - M_SQRT_2_2 i": +double: 1 +idouble: 1 # ctan Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": @@ -422,6 +608,15 @@ idouble: 1 Test "erfc (0.75) == 0.288844366346484868401062165408589223": float: 1 ifloat: 1 +Test "erfc (0x1.f7303cp+1) == 2.705500297238986897105236321218861842255e-8": +double: 1 +idouble: 1 +Test "erfc (0x1.ffa002p+2) == 1.233585992097580296336099501489175967033e-29": +float: 1 +ifloat: 1 +Test "erfc (0x1.ffff56789abcdef0123456789a8p+2) == 1.123161416304655390092138725253789378459e-29": +ildouble: 1 +ldouble: 1 Test "erfc (2.0) == 0.00467773498104726583793074363274707139": double: 1 idouble: 1 @@ -465,6 +660,33 @@ Test "exp2 (10) == 1024": ildouble: 2 ldouble: 2 +# exp_downward +Test "exp_downward (2) == e^2": +float: 1 +ifloat: 1 +Test "exp_downward (3) == e^3": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# exp_towardzero +Test "exp_towardzero (2) == e^2": +float: 1 +ifloat: 1 +Test "exp_towardzero (3) == e^3": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# exp_upward +Test "exp_upward (1) == e": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + # expm1 Test "expm1 (0.75) == 1.11700001661267466854536981983709561": double: 1 @@ -477,31 +699,49 @@ ifloat: 1 # hypot Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "hypot (0.75, 1.25) == 1.45773797371132511771853821938639577": +float: 1 +ifloat: 1 ildouble: 1 ldouble: 1 Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +double: 1 float: 1 +idouble: 1 ifloat: 1 # j0 @@ -520,7 +760,9 @@ ifloat: 1 ildouble: 1 ldouble: 1 Test "j0 (2.0) == 0.223890779141235668051827454649948626": +double: 1 float: 2 +idouble: 1 ifloat: 2 Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1": double: 1 @@ -530,7 +772,9 @@ ifloat: 2 ildouble: 1 ldouble: 1 Test "j0 (8.0) == 0.171650807137553906090869407851972001": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -566,7 +810,9 @@ ifloat: 1 ildouble: 1 ldouble: 1 Test "jn (0, 2.0) == 0.223890779141235668051827454649948626": +double: 1 float: 2 +idouble: 1 ifloat: 2 Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1": double: 1 @@ -576,7 +822,9 @@ ifloat: 2 ildouble: 1 ldouble: 1 Test "jn (0, 8.0) == 0.171650807137553906090869407851972001": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -612,7 +860,9 @@ Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9": ildouble: 1 ldouble: 1 Test "jn (10, 10.0) == 0.207486106633358857697278723518753428": +double: 2 float: 1 +idouble: 2 ifloat: 1 ildouble: 4 ldouble: 4 @@ -693,9 +943,9 @@ ifloat: 2 ildouble: 4 ldouble: 4 Test "jn (9, 2.4048255576957729) == 0.12517270977961513005428966643852564E-4": -double: 1 +double: 2 float: 2 -idouble: 1 +idouble: 2 ifloat: 2 ildouble: 7 ldouble: 7 @@ -734,11 +984,124 @@ Test "log2 (e) == M_LOG2El": ildouble: 1 ldouble: 1 +# pow_downward +Test "pow_downward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +ildouble: 1 +ldouble: 1 +Test "pow_downward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 + +# pow_towardzero +Test "pow_towardzero (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +ildouble: 1 +ldouble: 1 +Test "pow_towardzero (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 + +# pow_upward +Test "pow_upward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +float: 1 +ifloat: 1 +Test "pow_upward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +ildouble: 1 +ldouble: 1 + # sin Test "sin (16.0) == -0.2879033166650652947844562482186175296207": ildouble: 2 ldouble: 2 +# sin_downward +Test "sin_downward (1) == 0.8414709848078965066525023216302989996226": +ildouble: 4 +ldouble: 4 +Test "sin_downward (10) == -0.5440211108893698134047476618513772816836": +float: 1 +ifloat: 1 +Test "sin_downward (2) == 0.9092974268256816953960198659117448427023": +ildouble: 1 +ldouble: 1 +Test "sin_downward (3) == 0.1411200080598672221007448028081102798469": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "sin_downward (4) == -0.7568024953079282513726390945118290941359": +ildouble: 1 +ldouble: 1 +Test "sin_downward (5) == -0.9589242746631384688931544061559939733525": +float: 1 +ifloat: 1 +Test "sin_downward (6) == -0.2794154981989258728115554466118947596280": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "sin_downward (8) == 0.9893582466233817778081235982452886721164": +ildouble: 1 +ldouble: 1 + +# sin_tonearest +Test "sin_tonearest (1) == 0.8414709848078965066525023216302989996226": +float: 1 +ifloat: 1 + +# sin_towardzero +Test "sin_towardzero (1) == 0.8414709848078965066525023216302989996226": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "sin_towardzero (10) == -0.5440211108893698134047476618513772816836": +float: 1 +ifloat: 1 +Test "sin_towardzero (2) == 0.9092974268256816953960198659117448427023": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (3) == 0.1411200080598672221007448028081102798469": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (4) == -0.7568024953079282513726390945118290941359": +float: 1 +ifloat: 1 +Test "sin_towardzero (5) == -0.9589242746631384688931544061559939733525": +float: 1 +ifloat: 1 +Test "sin_towardzero (8) == 0.9893582466233817778081235982452886721164": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (9) == 0.4121184852417565697562725663524351793439": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# sin_upward +Test "sin_upward (1) == 0.8414709848078965066525023216302989996226": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "sin_upward (2) == 0.9092974268256816953960198659117448427023": +float: 2 +ifloat: 2 +Test "sin_upward (3) == 0.1411200080598672221007448028081102798469": +ildouble: 1 +ldouble: 1 +Test "sin_upward (4) == -0.7568024953079282513726390945118290941359": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sin_upward (6) == -0.2794154981989258728115554466118947596280": +ildouble: 1 +ldouble: 1 +Test "sin_upward (9) == 0.4121184852417565697562725663524351793439": +float: 1 +ifloat: 1 + # sincos Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": double: 1 @@ -764,6 +1127,52 @@ Test "sinh (0.75) == 0.822316731935829980703661634446913849": ildouble: 1 ldouble: 1 +# sinh_downward +Test "sinh_downward (22) == 1792456423.065795780701106568345764104225": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "sinh_downward (23) == 4872401723.124451299966006944252978187305": +float: 1 +ifloat: 1 +Test "sinh_downward (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# sinh_towardzero +Test "sinh_towardzero (22) == 1792456423.065795780701106568345764104225": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "sinh_towardzero (23) == 4872401723.124451299966006944252978187305": +float: 1 +ifloat: 1 +Test "sinh_towardzero (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# sinh_upward +Test "sinh_upward (23) == 4872401723.124451299966006944252978187305": +ildouble: 1 +ldouble: 1 +Test "sinh_upward (24) == 13244561064.92173614705070540368454568168": +ildouble: 1 +ldouble: 1 + +# sqrt +Test "sqrt (0.75) == 0.866025403784438646763723170752936183": +double: 1 +idouble: 1 +Test "sqrt (2) == M_SQRT2l": +double: 1 +idouble: 1 + # tan Test "tan (pi/4) == 1": double: 1 @@ -771,6 +1180,102 @@ idouble: 1 ildouble: 1 ldouble: 1 +# tan_downward +Test "tan_downward (1) == 1.5574077246549022305069748074583601730873": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "tan_downward (10) == 0.6483608274590866712591249330098086768169": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "tan_downward (2) == -2.1850398632615189916433061023136825434320": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_downward (6) == -0.2910061913847491570536995888681755428312": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_downward (8) == -6.7997114552203786999252627596086333648814": +float: 1 +ifloat: 1 +Test "tan_downward (9) == -0.4523156594418098405903708757987855343087": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# tan_tonearest +Test "tan_tonearest (10) == 0.6483608274590866712591249330098086768169": +ildouble: 1 +ldouble: 1 +Test "tan_tonearest (4) == 1.1578212823495775831373424182673239231198": +ildouble: 1 +ldouble: 1 +Test "tan_tonearest (7) == 0.8714479827243187364564508896003135663222": +ildouble: 1 +ldouble: 1 + +# tan_towardzero +Test "tan_towardzero (10) == 0.6483608274590866712591249330098086768169": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "tan_towardzero (3) == -0.1425465430742778052956354105339134932261": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "tan_towardzero (4) == 1.1578212823495775831373424182673239231198": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (5) == -3.3805150062465856369827058794473439087096": +float: 1 +ifloat: 1 +Test "tan_towardzero (6) == -0.2910061913847491570536995888681755428312": +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (7) == 0.8714479827243187364564508896003135663222": +ildouble: 2 +ldouble: 2 +Test "tan_towardzero (9) == -0.4523156594418098405903708757987855343087": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# tan_upward +Test "tan_upward (10) == 0.6483608274590866712591249330098086768169": +ildouble: 1 +ldouble: 1 +Test "tan_upward (3) == -0.1425465430742778052956354105339134932261": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "tan_upward (5) == -3.3805150062465856369827058794473439087096": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_upward (6) == -0.2910061913847491570536995888681755428312": +ildouble: 1 +ldouble: 1 +Test "tan_upward (7) == 0.8714479827243187364564508896003135663222": +ildouble: 1 +ldouble: 1 +Test "tan_upward (9) == -0.4523156594418098405903708757987855343087": +ildouble: 1 +ldouble: 1 + # tanh Test "tanh (-0.75) == -0.635148952387287319214434357312496495": ildouble: 1 @@ -846,7 +1351,7 @@ ifloat: 1 ildouble: 2 ldouble: 2 Test "y1 (2.0) == -0.107032431540937546888370772277476637": -double: 1 +double: 2 float: 1 idouble: 2 ifloat: 2 @@ -908,9 +1413,9 @@ ifloat: 1 ildouble: 2 ldouble: 2 Test "yn (1, 2.0) == -0.107032431540937546888370772277476637": -double: 1 +double: 2 float: 1 -idouble: 1 +idouble: 2 ifloat: 1 Test "yn (1, 8.0) == -0.158060461731247494255555266187483550": double: 1 @@ -989,6 +1494,8 @@ float: 1 ifloat: 1 Function: "cabs": +float: 1 +ifloat: 1 ildouble: 1 ldouble: 1 @@ -1111,8 +1618,8 @@ ildouble: 1 ldouble: 1 Function: Real part of "clog": -float: 1 -ifloat: 1 +float: 2 +ifloat: 2 ildouble: 2 ldouble: 2 @@ -1123,16 +1630,18 @@ ildouble: 1 ldouble: 1 Function: Real part of "clog10": -float: 1 -ifloat: 1 +double: 1 +float: 2 +idouble: 1 +ifloat: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "clog10": double: 1 -float: 5 +float: 1 idouble: 1 -ifloat: 5 +ifloat: 1 ildouble: 1 ldouble: 1 @@ -1144,10 +1653,54 @@ ifloat: 1 ildouble: 1 ldouble: 1 +Function: "cos_downward": +float: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 + +Function: "cos_tonearest": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cos_towardzero": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "cos_upward": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 + Function: "cosh": ildouble: 1 ldouble: 1 +Function: "cosh_downward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cosh_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "cosh_towardzero": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cosh_upward": +ildouble: 2 +ldouble: 2 + Function: Real part of "cpow": double: 2 float: 5 @@ -1187,12 +1740,18 @@ ildouble: 1 ldouble: 1 Function: Real part of "csqrt": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 Function: Imaginary part of "csqrt": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 ildouble: 1 ldouble: 1 @@ -1252,6 +1811,28 @@ Function: "exp2": ildouble: 2 ldouble: 2 +Function: "exp_downward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "exp_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "exp_towardzero": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "exp_upward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + Function: "expm1": double: 1 float: 1 @@ -1263,7 +1844,9 @@ ildouble: 1 ldouble: 1 Function: "hypot": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -1326,10 +1909,52 @@ Function: "pow": ildouble: 1 ldouble: 1 +Function: "pow_downward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_towardzero": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_upward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + Function: "sin": ildouble: 1 ldouble: 1 +Function: "sin_downward": +float: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 + +Function: "sin_tonearest": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sin_towardzero": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "sin_upward": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 + Function: "sincos": double: 1 float: 1 @@ -1342,12 +1967,58 @@ Function: "sinh": ildouble: 1 ldouble: 1 +Function: "sinh_downward": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "sinh_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "sinh_towardzero": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "sinh_upward": +ildouble: 1 +ldouble: 1 + +Function: "sqrt": +double: 1 +idouble: 1 + Function: "tan": double: 1 idouble: 1 ildouble: 1 ldouble: 1 +Function: "tan_downward": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "tan_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "tan_towardzero": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +Function: "tan_upward": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + Function: "tanh": ildouble: 1 ldouble: 1 diff --git a/sysdeps/sparc/crti.S b/sysdeps/sparc/crti.S index caed362..7aa5453 100644 --- a/sysdeps/sparc/crti.S +++ b/sysdeps/sparc/crti.S @@ -71,15 +71,9 @@ _init: save %sp, -STACKFRAME_SIZE, %sp #if PREINIT_FUNCTION_WEAK SETUP_PIC_REG(l7) -#ifdef HAVE_BINUTILS_GOTDATA sethi %gdop_hix22(PREINIT_FUNCTION), %g1 xor %g1, %gdop_lox10(PREINIT_FUNCTION), %g1 GOT_LOAD [%l7 + %g1], %g1, %gdop(PREINIT_FUNCTION) -#else - sethi %hi(PREINIT_FUNCTION), %g1 - or %g1, %lo(PREINIT_FUNCTION), %g1 - GOT_LOAD [%l7 + %g1], %g1 -#endif cmp %g1, 0 be 1f nop diff --git a/sysdeps/sparc/elf/configure b/sysdeps/sparc/elf/configure index a254540..3553444 100644 --- a/sysdeps/sparc/elf/configure +++ b/sysdeps/sparc/elf/configure @@ -137,45 +137,6 @@ if test $libc_cv_sparc_tls = no; then as_fn_error $? "the assembler must support TLS" "$LINENO" 5 fi -# Check for GOTDATA relocation support in assembler and linker. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sparc binutils GOTDATA reloc support" >&5 -$as_echo_n "checking for sparc binutils GOTDATA reloc support... " >&6; } -if ${libc_cv_sparc_gotdata+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.S <<\EOF - .data - .globl data -data: .word 0 - .text - .globl foo -foo: sethi %gdop_hix22(data), %g1 - xor %g1, %gdop_lox10(data), %g1 -#ifdef __arch64__ - ldx [%l7 + %g1], %g1, %gdop(data) -#else - ld [%l7 + %g1], %g1, %gdop(data) -#endif -EOF -if { ac_try='${CC-cc} -c $CFLAGS conftest.S 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - libc_cv_sparc_gotdata=yes -else - libc_cv_sparc_gotdata=no -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_sparc_gotdata" >&5 -$as_echo "$libc_cv_sparc_gotdata" >&6; } -if test $libc_cv_sparc_gotdata = yes; then - $as_echo "#define HAVE_BINUTILS_GOTDATA 1" >>confdefs.h - -fi - # Check for a GCC emitting GOTDATA relocations. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sparc gcc GOTDATA reloc support" >&5 $as_echo_n "checking for sparc gcc GOTDATA reloc support... " >&6; } @@ -210,8 +171,7 @@ if test $libc_cv_sparc_gcc_gotdata = yes; then fi -if test $libc_cv_sparc_gcc_gotdata = yes \ - && test $libc_cv_sparc_gotdata = yes; then +if test $libc_cv_sparc_gcc_gotdata = yes; then $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h fi diff --git a/sysdeps/sparc/elf/configure.in b/sysdeps/sparc/elf/configure.in index 1a2f61a..ec68345 100644 --- a/sysdeps/sparc/elf/configure.in +++ b/sysdeps/sparc/elf/configure.in @@ -46,35 +46,6 @@ if test $libc_cv_sparc_tls = no; then AC_MSG_ERROR([the assembler must support TLS]) fi -# Check for GOTDATA relocation support in assembler and linker. -AC_CACHE_CHECK(for sparc binutils GOTDATA reloc support, libc_cv_sparc_gotdata, [dnl -changequote(,)dnl -cat > conftest.S <<\EOF - .data - .globl data -data: .word 0 - .text - .globl foo -foo: sethi %gdop_hix22(data), %g1 - xor %g1, %gdop_lox10(data), %g1 -#ifdef __arch64__ - ldx [%l7 + %g1], %g1, %gdop(data) -#else - ld [%l7 + %g1], %g1, %gdop(data) -#endif -EOF -changequote([,])dnl -dnl -if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.S 1>&AS_MESSAGE_LOG_FD); then - libc_cv_sparc_gotdata=yes -else - libc_cv_sparc_gotdata=no -fi -rm -f conftest*]) -if test $libc_cv_sparc_gotdata = yes; then - AC_DEFINE(HAVE_BINUTILS_GOTDATA) -fi - # Check for a GCC emitting GOTDATA relocations. AC_CACHE_CHECK(for sparc gcc GOTDATA reloc support, libc_cv_sparc_gcc_gotdata, [dnl changequote(,)dnl @@ -99,7 +70,6 @@ if test $libc_cv_sparc_gcc_gotdata = yes; then AC_DEFINE(HAVE_GCC_GOTDATA) fi -if test $libc_cv_sparc_gcc_gotdata = yes \ - && test $libc_cv_sparc_gotdata = yes; then +if test $libc_cv_sparc_gcc_gotdata = yes; then AC_DEFINE(PI_STATIC_AND_HIDDEN) fi diff --git a/sysdeps/sparc/sparc32/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps index 91e6760..178c197 100644 --- a/sysdeps/sparc/sparc32/fpu/libm-test-ulps +++ b/sysdeps/sparc/fpu/libm-test-ulps @@ -312,6 +312,131 @@ ifloat: 1 ildouble: 1 ldouble: 1 +# cos_downward +Test "cos_downward (1) == 0.5403023058681397174009366074429766037323": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_downward (10) == -0.8390715290764524522588639478240648345199": +ildouble: 1 +ldouble: 1 +Test "cos_downward (2) == -0.4161468365471423869975682295007621897660": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_downward (3) == -0.9899924966004454572715727947312613023937": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_downward (4) == -0.6536436208636119146391681830977503814241": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_downward (5) == 0.2836621854632262644666391715135573083344": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_downward (6) == 0.9601702866503660205456522979229244054519": +ildouble: 1 +ldouble: 1 +Test "cos_downward (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_downward (8) == -0.1455000338086135258688413818311946826093": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +# cos_tonearest +Test "cos_tonearest (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 + +# cos_towardzero +Test "cos_towardzero (1) == 0.5403023058681397174009366074429766037323": +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (10) == -0.8390715290764524522588639478240648345199": +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (2) == -0.4161468365471423869975682295007621897660": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (3) == -0.9899924966004454572715727947312613023937": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (4) == -0.6536436208636119146391681830977503814241": +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (5) == 0.2836621854632262644666391715135573083344": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (6) == 0.9601702866503660205456522979229244054519": +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (8) == -0.1455000338086135258688413818311946826093": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +# cos_upward +Test "cos_upward (10) == -0.8390715290764524522588639478240648345199": +float: 1 +ifloat: 1 +Test "cos_upward (6) == 0.9601702866503660205456522979229244054519": +float: 1 +ifloat: 1 +Test "cos_upward (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +Test "cos_upward (9) == -0.9111302618846769883682947111811653112463": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# cosh_downward +Test "cosh_downward (22) == 1792456423.065795780980053377632656584997": +float: 1 +ifloat: 1 +Test "cosh_downward (23) == 4872401723.124451300068625740569997090344": +float: 1 +ifloat: 1 +Test "cosh_downward (24) == 13244561064.92173614708845674912733665919": +float: 1 +ifloat: 1 + +# cosh_towardzero +Test "cosh_towardzero (22) == 1792456423.065795780980053377632656584997": +float: 1 +ifloat: 1 +Test "cosh_towardzero (23) == 4872401723.124451300068625740569997090344": +float: 1 +ifloat: 1 +Test "cosh_towardzero (24) == 13244561064.92173614708845674912733665919": +float: 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 @@ -436,6 +561,17 @@ double: 1 idouble: 1 # erfc +Test "erfc (0x1.f7303cp+1) == 2.705500297238986897105236321218861842255e-8": +double: 1 +idouble: 1 +Test "erfc (0x1.ffa002p+2) == 1.233585992097580296336099501489175967033e-29": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "erfc (0x1.ffffc8p+2) == 1.122671365033056305522366683719541099329e-29": +ildouble: 1 +ldouble: 1 Test "erfc (2.0) == 0.00467773498104726583793074363274707139": double: 1 idouble: 1 @@ -470,6 +606,37 @@ Test "exp2 (10) == 1024": ildouble: 2 ldouble: 2 +# exp_downward +Test "exp_downward (2) == e^2": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "exp_downward (3) == e^3": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# exp_towardzero +Test "exp_towardzero (2) == e^2": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (3) == e^3": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# exp_upward +Test "exp_upward (1) == e": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + # expm1 Test "expm1 (0.75) == 1.11700001661267466854536981983709561": double: 1 @@ -773,6 +940,131 @@ Test "log2 (0.75) == -.415037499278843818546261056052183492": ildouble: 1 ldouble: 1 +# pow_downward +Test "pow_downward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 + +# pow_towardzero +Test "pow_towardzero (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 + +# pow_upward +Test "pow_upward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +float: 1 +ifloat: 1 + +# sin_downward +Test "sin_downward (1) == 0.8414709848078965066525023216302989996226": +ildouble: 1 +ldouble: 1 +Test "sin_downward (10) == -0.5440211108893698134047476618513772816836": +float: 1 +ifloat: 1 +Test "sin_downward (2) == 0.9092974268256816953960198659117448427023": +ildouble: 1 +ldouble: 1 +Test "sin_downward (3) == 0.1411200080598672221007448028081102798469": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sin_downward (4) == -0.7568024953079282513726390945118290941359": +ildouble: 1 +ldouble: 1 +Test "sin_downward (5) == -0.9589242746631384688931544061559939733525": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sin_downward (6) == -0.2794154981989258728115554466118947596280": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sin_downward (8) == 0.9893582466233817778081235982452886721164": +ildouble: 1 +ldouble: 1 + +# sin_tonearest +Test "sin_tonearest (1) == 0.8414709848078965066525023216302989996226": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sin_tonearest (3) == 0.1411200080598672221007448028081102798469": +ildouble: 1 +ldouble: 1 +Test "sin_tonearest (6) == -0.2794154981989258728115554466118947596280": +ildouble: 1 +ldouble: 1 +Test "sin_tonearest (9) == 0.4121184852417565697562725663524351793439": +ildouble: 1 +ldouble: 1 + +# sin_towardzero +Test "sin_towardzero (1) == 0.8414709848078965066525023216302989996226": +float: 1 +ifloat: 1 +Test "sin_towardzero (10) == -0.5440211108893698134047476618513772816836": +float: 1 +ifloat: 1 +Test "sin_towardzero (2) == 0.9092974268256816953960198659117448427023": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (3) == 0.1411200080598672221007448028081102798469": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (4) == -0.7568024953079282513726390945118290941359": +float: 1 +ifloat: 1 +Test "sin_towardzero (5) == -0.9589242746631384688931544061559939733525": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (6) == -0.2794154981989258728115554466118947596280": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (8) == 0.9893582466233817778081235982452886721164": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (9) == 0.4121184852417565697562725663524351793439": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +# sin_upward +Test "sin_upward (1) == 0.8414709848078965066525023216302989996226": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sin_upward (10) == -0.5440211108893698134047476618513772816836": +ildouble: 1 +ldouble: 1 +Test "sin_upward (2) == 0.9092974268256816953960198659117448427023": +float: 2 +ifloat: 2 +Test "sin_upward (3) == 0.1411200080598672221007448028081102798469": +ildouble: 1 +ldouble: 1 +Test "sin_upward (4) == -0.7568024953079282513726390945118290941359": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sin_upward (7) == 0.6569865987187890903969990915936351779369": +ildouble: 1 +ldouble: 1 +Test "sin_upward (9) == 0.4121184852417565697562725663524351793439": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + # sincos Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": double: 1 @@ -799,6 +1091,28 @@ Test "sincos (pi/6, &sin_res, &cos_res) puts 0.866025403784438646763723170752936 float: 1 ifloat: 1 +# sinh_downward +Test "sinh_downward (22) == 1792456423.065795780701106568345764104225": +float: 1 +ifloat: 1 +Test "sinh_downward (23) == 4872401723.124451299966006944252978187305": +float: 1 +ifloat: 1 +Test "sinh_downward (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 + +# sinh_towardzero +Test "sinh_towardzero (22) == 1792456423.065795780701106568345764104225": +float: 1 +ifloat: 1 +Test "sinh_towardzero (23) == 4872401723.124451299966006944252978187305": +float: 1 +ifloat: 1 +Test "sinh_towardzero (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 + # sqrt Test "sqrt (2) == M_SQRT2l": ildouble: 1 @@ -809,6 +1123,92 @@ Test "tan (pi/4) == 1": double: 1 idouble: 1 +# tan_downward +Test "tan_downward (1) == 1.5574077246549022305069748074583601730873": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_downward (10) == 0.6483608274590866712591249330098086768169": +float: 1 +ifloat: 1 +Test "tan_downward (2) == -2.1850398632615189916433061023136825434320": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_downward (6) == -0.2910061913847491570536995888681755428312": +float: 1 +ifloat: 1 +Test "tan_downward (8) == -6.7997114552203786999252627596086333648814": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_downward (9) == -0.4523156594418098405903708757987855343087": +float: 1 +ifloat: 1 + +# tan_towardzero +Test "tan_towardzero (10) == 0.6483608274590866712591249330098086768169": +float: 1 +ifloat: 1 +Test "tan_towardzero (3) == -0.1425465430742778052956354105339134932261": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (4) == 1.1578212823495775831373424182673239231198": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (5) == -3.3805150062465856369827058794473439087096": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (6) == -0.2910061913847491570536995888681755428312": +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (9) == -0.4523156594418098405903708757987855343087": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# tan_upward +Test "tan_upward (1) == 1.5574077246549022305069748074583601730873": +float: 1 +ifloat: 1 +Test "tan_upward (10) == 0.6483608274590866712591249330098086768169": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_upward (2) == -2.1850398632615189916433061023136825434320": +ildouble: 1 +ldouble: 1 +Test "tan_upward (3) == -0.1425465430742778052956354105339134932261": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_upward (4) == 1.1578212823495775831373424182673239231198": +ildouble: 1 +ldouble: 1 +Test "tan_upward (5) == -3.3805150062465856369827058794473439087096": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_upward (6) == -0.2910061913847491570536995888681755428312": +ildouble: 1 +ldouble: 1 +Test "tan_upward (9) == -0.4523156594418098405903708757987855343087": +ildouble: 1 +ldouble: 1 + # tanh Test "tanh (-0.75) == -0.635148952387287319214434357312496495": ildouble: 1 @@ -1161,6 +1561,36 @@ ifloat: 1 ildouble: 1 ldouble: 1 +Function: "cos_downward": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "cos_tonearest": +float: 1 +ifloat: 1 + +Function: "cos_towardzero": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "cos_upward": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "cosh_downward": +float: 1 +ifloat: 1 + +Function: "cosh_towardzero": +float: 1 +ifloat: 1 + Function: Real part of "cpow": double: 2 float: 4 @@ -1239,7 +1669,9 @@ idouble: 1 Function: "erfc": double: 1 +float: 1 idouble: 1 +ifloat: 1 ildouble: 1 ldouble: 1 @@ -1255,6 +1687,24 @@ Function: "exp2": ildouble: 2 ldouble: 2 +Function: "exp_downward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "exp_towardzero": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "exp_upward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + Function: "expm1": double: 1 float: 1 @@ -1321,6 +1771,42 @@ Function: "log2": ildouble: 1 ldouble: 1 +Function: "pow_downward": +float: 1 +ifloat: 1 + +Function: "pow_towardzero": +float: 1 +ifloat: 1 + +Function: "pow_upward": +float: 1 +ifloat: 1 + +Function: "sin_downward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sin_tonearest": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sin_towardzero": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "sin_upward": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + Function: "sincos": double: 1 float: 1 @@ -1329,6 +1815,14 @@ ifloat: 1 ildouble: 1 ldouble: 1 +Function: "sinh_downward": +float: 1 +ifloat: 1 + +Function: "sinh_towardzero": +float: 1 +ifloat: 1 + Function: "sqrt": ildouble: 1 ldouble: 1 @@ -1337,6 +1831,24 @@ Function: "tan": double: 1 idouble: 1 +Function: "tan_downward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "tan_towardzero": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "tan_upward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + Function: "tanh": ildouble: 1 ldouble: 1 diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index 7ea97fb..1620ca5 100644 --- a/sysdeps/sparc/sparc32/dl-machine.h +++ b/sysdeps/sparc/sparc32/dl-machine.h @@ -216,17 +216,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) The C function `_dl_start' is the real entry point; its return value is the user program's entry point. */ -#ifdef HAVE_BINUTILS_GOTDATA #define RTLD_GOT_ADDRESS(pic_reg, reg, symbol) \ "sethi %gdop_hix22(" #symbol "), " #reg "\n\t" \ "xor " #reg ", %gdop_lox10(" #symbol "), " #reg "\n\t" \ "ld [" #pic_reg " + " #reg "], " #reg ", %gdop(" #symbol ")" -#else -#define RTLD_GOT_ADDRESS(pic_reg, reg, symbol) \ - "sethi %hi(" #symbol "), " #reg "\n\t" \ - "or " #reg ", %lo(" #symbol "), " #reg "\n\t" \ - "ld [" #pic_reg " + " #reg "], " #reg -#endif #define RTLD_START __asm__ ("\ .text\n\ diff --git a/sysdeps/sparc/sparc32/elf/start.S b/sysdeps/sparc/sparc32/elf/start.S index 0426714..1efa8e8 100644 --- a/sysdeps/sparc/sparc32/elf/start.S +++ b/sysdeps/sparc/sparc32/elf/start.S @@ -66,7 +66,6 @@ _start: or %o3, %lo(__libc_csu_init), %o3 or %o4, %lo(__libc_csu_fini), %o4 #else -#ifdef HAVE_BINUTILS_GOTDATA sethi %gdop_hix22(main), %o0 sethi %gdop_hix22(__libc_csu_init), %o3 sethi %gdop_hix22(__libc_csu_fini), %o4 @@ -76,17 +75,6 @@ _start: ld [%l7 + %o0], %o0, %gdop(main) ld [%l7 + %o3], %o3, %gdop(__libc_csu_init) ld [%l7 + %o4], %o4, %gdop(__libc_csu_fini) -#else - sethi %hi(main), %o0 - sethi %hi(__libc_csu_init), %o3 - sethi %hi(__libc_csu_fini), %o4 - or %o0, %lo(main), %o0 - or %o3, %lo(__libc_csu_init), %o3 - or %o4, %lo(__libc_csu_fini), %o4 - ld [%l7 + %o0], %o0 - ld [%l7 + %o3], %o3 - ld [%l7 + %o4], %o4 -#endif #endif /* When starting a binary via the dynamic linker, %g1 contains the diff --git a/sysdeps/sparc/sparc32/fpu/s_copysign.S b/sysdeps/sparc/sparc32/fpu/s_copysign.S new file mode 100644 index 0000000..18c44c5 --- /dev/null +++ b/sysdeps/sparc/sparc32/fpu/s_copysign.S @@ -0,0 +1,31 @@ +/* copysign function, sparc32 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__copysign) + sethi %hi(0x80000000), %g1 + and %o2, %g1, %o4 + andn %o0, %g1, %o0 + or %o0, %o4, %o0 + std %o0, [%sp + 72] + retl + ldd [%sp + 72], %f0 +END (__copysign) +weak_alias (__copysign, copysign)
\ No newline at end of file diff --git a/sysdeps/sparc/sparc32/fpu/s_copysignf.S b/sysdeps/sparc/sparc32/fpu/s_copysignf.S new file mode 100644 index 0000000..7753c35 --- /dev/null +++ b/sysdeps/sparc/sparc32/fpu/s_copysignf.S @@ -0,0 +1,31 @@ +/* float copysign function, sparc32 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__copysignf) + sethi %hi(0x80000000), %g1 + and %o1, %g1, %o4 + andn %o0, %g1, %o0 + or %o0, %o4, %o0 + st %o0, [%sp + 68] + retl + ld [%sp + 68], %f0 +END (__copysignf) +weak_alias (__copysignf, copysignf)
\ No newline at end of file diff --git a/sysdeps/sparc/sparc32/fpu/s_signbit.S b/sysdeps/sparc/sparc32/fpu/s_signbit.S new file mode 100644 index 0000000..3756bf4 --- /dev/null +++ b/sysdeps/sparc/sparc32/fpu/s_signbit.S @@ -0,0 +1,32 @@ +/* signbit(). sparc32 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__signbit) + retl + srl %o0, 31, %o0 +END (__signbit) +weak_alias (__signbit, signbit) + +/* On 32-bit the double version will also always work for + single-precision since in both cases the word with the + sign bit in it is passed always in register %o0. */ +strong_alias (__signbit, __signbitf) +hidden_def (__signbitf) +weak_alias (__signbitf, signbitf) diff --git a/sysdeps/sparc/sparc32/fpu/s_signbitf.S b/sysdeps/sparc/sparc32/fpu/s_signbitf.S new file mode 100644 index 0000000..91886af --- /dev/null +++ b/sysdeps/sparc/sparc32/fpu/s_signbitf.S @@ -0,0 +1 @@ +/* signbitf is implemented in s_signbit.S */
\ No newline at end of file diff --git a/sysdeps/sparc/sparc32/fpu/s_signbitl.S b/sysdeps/sparc/sparc32/fpu/s_signbitl.S new file mode 100644 index 0000000..2feaee0 --- /dev/null +++ b/sysdeps/sparc/sparc32/fpu/s_signbitl.S @@ -0,0 +1,32 @@ +/* signbitl(). sparc32 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> +#include <math_ldbl_opt.h> + +ENTRY (___signbitl) + ld [%o0], %o1 + retl + srl %o1, 31, %o0 +END (___signbitl) + +#ifdef IS_IN_libm +long_double_symbol (libm, ___signbitl, __signbitl); +#else +long_double_symbol (libc, ___signbitl, __signbitl); +#endif diff --git a/sysdeps/sparc/sparc32/fpu/w_sqrt.S b/sysdeps/sparc/sparc32/fpu/w_sqrt.S new file mode 100644 index 0000000..667c71c --- /dev/null +++ b/sysdeps/sparc/sparc32/fpu/w_sqrt.S @@ -0,0 +1,53 @@ +/* sqrt function. sparc32 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__sqrt) + clr %g1 + std %g0, [%sp + 72] + std %o0, [%sp + 80] + ldd [%sp + 72], %f8 + ldd [%sp + 80], %f0 + fcmpd %f0, %f8 + fbl 1f + nop +8: retl + fsqrtd %f0, %f0 +1: +#ifdef SHARED + SETUP_PIC_REG_LEAF(o5, g1) + sethi %gdop_hix22(_LIB_VERSION), %g1 + xor %g1, %gdop_lox10(_LIB_VERSION), %g1 + ld [%o5 + %g1], %g1, %gdop(_LIB_VERSION) +#else + sethi %hi(_LIB_VERSION), %g1 + or %g1, %lo(_LIB_VERSION), %g1 +#endif + ld [%g1], %g1 + cmp %g1, -1 + be 8b + mov %o0, %o2 + mov %o1, %o3 + mov 26, %o4 + mov %o7, %g1 + call __kernel_standard + mov %g1, %o7 +END (__sqrt) + +weak_alias (__sqrt, sqrt) diff --git a/sysdeps/sparc/sparc32/fpu/w_sqrtf.S b/sysdeps/sparc/sparc32/fpu/w_sqrtf.S new file mode 100644 index 0000000..5260bec --- /dev/null +++ b/sysdeps/sparc/sparc32/fpu/w_sqrtf.S @@ -0,0 +1,51 @@ +/* sqrtf function. sparc32 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__sqrtf) + st %g0, [%sp + 68] + st %o0, [%sp + 72] + ld [%sp + 68], %f8 + ld [%sp + 72], %f0 + fcmps %f0, %f8 + fbl 1f + nop +8: retl + fsqrts %f0, %f0 +1: +#ifdef SHARED + SETUP_PIC_REG_LEAF(o5, g1) + sethi %gdop_hix22(_LIB_VERSION), %g1 + xor %g1, %gdop_lox10(_LIB_VERSION), %g1 + ld [%o5 + %g1], %g1, %gdop(_LIB_VERSION) +#else + sethi %hi(_LIB_VERSION), %g1 + or %g1, %lo(_LIB_VERSION), %g1 +#endif + ld [%g1], %g1 + cmp %g1, -1 + be 8b + mov %o0, %o1 + mov 126, %o2 + mov %o7, %g1 + call __kernel_standard_f + mov %g1, %o7 +END (__sqrtf) + +weak_alias (__sqrtf, sqrtf) diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_isnan.S b/sysdeps/sparc/sparc32/sparcv9/fpu/s_isnan.S new file mode 100644 index 0000000..3122528 --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/s_isnan.S @@ -0,0 +1,32 @@ +/* isnan(). sparc32 v9 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__isnan) + sethi %hi(0x7ff00000), %g1 + sllx %o0, 33, %o0 + sllx %g1, 32, %g1 + srlx %o0, 1, %o0 + or %o0, %o1, %o0 + sub %g1, %o0, %o0 + retl + srlx %o0, 63, %o0 +END (__isnan) +hidden_def (__isnan) +weak_alias (__isnan, isnan) diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_llrint.S b/sysdeps/sparc/sparc32/sparcv9/fpu/s_llrint.S new file mode 100644 index 0000000..8ec9b4d --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/s_llrint.S @@ -0,0 +1,67 @@ +/* llrint(), sparc32 v9 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + + /* We pop constants into the FPU registers using the incoming + argument stack slots, since this avoid having to use any PIC + references. We also thus avoid having to allocate a register + window. + + VIS instructions are used to facilitate the formation of + easier constants, and the propagation of the sign bit. */ + +#define TWO_FIFTYTWO 0x43300000 /* 2**52 */ + +#define ZERO %f10 /* 0.0 */ +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__llrint) + sethi %hi(TWO_FIFTYTWO), %o2 + sllx %o0, 32, %o0 + + or %o0, %o1, %o0 + fzero ZERO + + stx %o0, [%sp + 72] + sllx %o2, 32, %o2 + fnegd ZERO, SIGN_BIT + + ldd [%sp + 72], %f0 + + stx %o2, [%sp + 72] + fabsd %f0, %f14 + + ldd [%sp + 72], %f16 + fcmpd %fcc3, %f14, %f16 + + fmovduge %fcc3, ZERO, %f16 + fand %f0, SIGN_BIT, SIGN_BIT + + for %f16, SIGN_BIT, %f16 + faddd %f0, %f16, %f6 + fsubd %f6, %f16, %f0 + fabsd %f0, %f0 + for %f0, SIGN_BIT, %f0 + fdtox %f0, %f4 + std %f4, [%sp + 72] + retl + ldd [%sp + 72], %o0 +END (__llrint) +weak_alias (__llrint, llrint) diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_llrintf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/s_llrintf.S new file mode 100644 index 0000000..73e9d64 --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/s_llrintf.S @@ -0,0 +1,62 @@ +/* llrintf(), sparc32 v9 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + + /* We pop constants into the FPU registers using the incoming + argument stack slots, since this avoid having to use any PIC + references. We also thus avoid having to allocate a register + window. + + VIS instructions are used to facilitate the formation of + easier constants, and the propagation of the sign bit. */ + +#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */ + +#define ZERO %f10 /* 0.0 */ +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__llrintf) + st %o0, [%sp + 68] + sethi %hi(TWO_TWENTYTHREE), %o2 + fzeros ZERO + + ld [%sp + 68], %f1 + fnegs ZERO, SIGN_BIT + + st %o2, [%sp + 68] + fabss %f1, %f14 + + ld [%sp + 68], %f16 + fcmps %fcc3, %f14, %f16 + + fmovsuge %fcc3, ZERO, %f16 + fands %f1, SIGN_BIT, SIGN_BIT + + fors %f16, SIGN_BIT, %f16 + fadds %f1, %f16, %f5 + fsubs %f5, %f16, %f0 + fabss %f0, %f0 + fors %f0, SIGN_BIT, %f0 + fstox %f0, %f4 + std %f4, [%sp + 72] + retl + ldd [%sp + 72], %o0 +END (__llrintf) +weak_alias (__llrintf, llrintf) diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_lrint.S b/sysdeps/sparc/sparc32/sparcv9/fpu/s_lrint.S new file mode 100644 index 0000000..062faba --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/s_lrint.S @@ -0,0 +1,67 @@ +/* lrint(), sparc32 v9 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + + /* We pop constants into the FPU registers using the incoming + argument stack slots, since this avoid having to use any PIC + references. We also thus avoid having to allocate a register + window. + + VIS instructions are used to facilitate the formation of + easier constants, and the propagation of the sign bit. */ + +#define TWO_FIFTYTWO 0x43300000 /* 2**52 */ + +#define ZERO %f10 /* 0.0 */ +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__lrint) + sethi %hi(TWO_FIFTYTWO), %o2 + sllx %o0, 32, %o0 + + or %o0, %o1, %o0 + fzero ZERO + + stx %o0, [%sp + 72] + sllx %o2, 32, %o2 + fnegd ZERO, SIGN_BIT + + ldd [%sp + 72], %f0 + + stx %o2, [%sp + 72] + fabsd %f0, %f14 + + ldd [%sp + 72], %f16 + fcmpd %fcc3, %f14, %f16 + + fmovduge %fcc3, ZERO, %f16 + fand %f0, SIGN_BIT, SIGN_BIT + + for %f16, SIGN_BIT, %f16 + faddd %f0, %f16, %f6 + fsubd %f6, %f16, %f0 + fabsd %f0, %f0 + for %f0, SIGN_BIT, %f0 + fdtoi %f0, %f3 + st %f3, [%sp + 72] + retl + ld [%sp + 72], %o0 +END (__lrint) +weak_alias (__lrint, lrint) diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_lrintf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/s_lrintf.S new file mode 100644 index 0000000..c546e67 --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/s_lrintf.S @@ -0,0 +1,62 @@ +/* lrintf(), sparc32 v9 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + + /* We pop constants into the FPU registers using the incoming + argument stack slots, since this avoid having to use any PIC + references. We also thus avoid having to allocate a register + window. + + VIS instructions are used to facilitate the formation of + easier constants, and the propagation of the sign bit. */ + +#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */ + +#define ZERO %f10 /* 0.0 */ +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__lrintf) + st %o0, [%sp + 68] + sethi %hi(TWO_TWENTYTHREE), %o2 + fzeros ZERO + + ld [%sp + 68], %f1 + fnegs ZERO, SIGN_BIT + + st %o2, [%sp + 68] + fabss %f1, %f14 + + ld [%sp + 68], %f16 + fcmps %fcc3, %f14, %f16 + + fmovsuge %fcc3, ZERO, %f16 + fands %f1, SIGN_BIT, SIGN_BIT + + fors %f16, SIGN_BIT, %f16 + fadds %f1, %f16, %f5 + fsubs %f5, %f16, %f0 + fabss %f0, %f0 + fors %f0, SIGN_BIT, %f0 + fstoi %f0, %f3 + st %f3, [%sp + 68] + retl + ld [%sp + 68], %o0 +END (__lrintf) +weak_alias (__lrintf, lrintf) diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt.S b/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt.S new file mode 100644 index 0000000..ce7491e --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt.S @@ -0,0 +1,51 @@ +/* sqrt function. sparc32 v9 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__sqrt) + std %o0, [%sp + 80] + fzero %f8 + ldd [%sp + 80], %f0 + fcmpd %f0, %f8 + fbl 1f + nop +8: retl + fsqrtd %f0, %f0 +1: +#ifdef SHARED + SETUP_PIC_REG_LEAF(o5, g1) + sethi %gdop_hix22(_LIB_VERSION), %g1 + xor %g1, %gdop_lox10(_LIB_VERSION), %g1 + ld [%o5 + %g1], %g1, %gdop(_LIB_VERSION) +#else + sethi %hi(_LIB_VERSION), %g1 + or %g1, %lo(_LIB_VERSION), %g1 +#endif + ld [%g1], %g1 + cmp %g1, -1 + be 8b + mov %o0, %o2 + mov %o1, %o3 + mov 26, %o4 + mov %o7, %g1 + call __kernel_standard + mov %g1, %o7 +END (__sqrt) + +weak_alias (__sqrt, sqrt) diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf.S new file mode 100644 index 0000000..0e00b66 --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf.S @@ -0,0 +1,50 @@ +/* sqrtf function. sparc32 v9 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__sqrtf) + st %o0, [%sp + 72] + fzeros %f8 + ld [%sp + 72], %f0 + fcmps %f0, %f8 + fbl 1f + nop +8: retl + fsqrts %f0, %f0 +1: +#ifdef SHARED + SETUP_PIC_REG_LEAF(o5, g1) + sethi %gdop_hix22(_LIB_VERSION), %g1 + xor %g1, %gdop_lox10(_LIB_VERSION), %g1 + ld [%o5 + %g1], %g1, %gdop(_LIB_VERSION) +#else + sethi %hi(_LIB_VERSION), %g1 + or %g1, %lo(_LIB_VERSION), %g1 +#endif + ld [%g1], %g1 + cmp %g1, -1 + be 8b + mov %o0, %o1 + mov 126, %o2 + mov %o7, %g1 + call __kernel_standard_f + mov %g1, %o7 +END (__sqrtf) + +weak_alias (__sqrtf, sqrtf) diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h index 6bab5ce..87655d2 100644 --- a/sysdeps/sparc/sparc64/dl-machine.h +++ b/sysdeps/sparc/sparc64/dl-machine.h @@ -264,17 +264,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) The C function `_dl_start' is the real entry point; its return value is the user program's entry point. */ -#ifdef HAVE_BINUTILS_GOTDATA #define RTLD_GOT_ADDRESS(pic_reg, reg, symbol) \ "sethi %gdop_hix22(" #symbol "), " #reg "\n\t" \ "xor " #reg ", %gdop_lox10(" #symbol "), " #reg "\n\t" \ "ldx [" #pic_reg " + " #reg "], " #reg ", %gdop(" #symbol ")\n" -#else -#define RTLD_GOT_ADDRESS(pic_reg, reg, symbol) \ - "sethi %hi(" #symbol "), " #reg "\n\t" \ - "or " #reg ", %lo(" #symbol "), " #reg "\n\t" \ - "ldx [" #pic_reg " + " #reg "], " #reg "\n" -#endif #define __S1(x) #x #define __S(x) __S1(x) diff --git a/sysdeps/sparc/sparc64/elf/start.S b/sysdeps/sparc/sparc64/elf/start.S index 50f2df2..7924fb4 100644 --- a/sysdeps/sparc/sparc64/elf/start.S +++ b/sysdeps/sparc/sparc64/elf/start.S @@ -67,7 +67,6 @@ _start: or %o3, %lo(__libc_csu_init), %o3 or %o4, %lo(__libc_csu_fini), %o4 #else -#ifdef HAVE_BINUTILS_GOTDATA sethi %gdop_hix22(main), %o0 sethi %gdop_hix22(__libc_csu_init), %o3 sethi %gdop_hix22(__libc_csu_fini), %o4 @@ -77,17 +76,6 @@ _start: ldx [%l7 + %o0], %o0, %gdop(main) ldx [%l7 + %o3], %o3, %gdop(__libc_csu_init) ldx [%l7 + %o4], %o4, %gdop(__libc_csu_fini) -#else - sethi %hi(main), %o0 - sethi %hi(__libc_csu_init), %o3 - sethi %hi(__libc_csu_fini), %o4 - or %o0, %lo(main), %o0 - or %o3, %lo(__libc_csu_init), %o3 - or %o4, %lo(__libc_csu_fini), %o4 - ldx [%l7 + %o0], %o0 - ldx [%l7 + %o3], %o3 - ldx [%l7 + %o4], %o4 -#endif #endif /* When starting a binary via the dynamic linker, %g1 contains the diff --git a/sysdeps/sparc/sparc64/fpu/libm-test-ulps b/sysdeps/sparc/sparc64/fpu/libm-test-ulps deleted file mode 100644 index 91e6760..0000000 --- a/sysdeps/sparc/sparc64/fpu/libm-test-ulps +++ /dev/null @@ -1,1376 +0,0 @@ -# Begin of automatic generation - -# atan2 -Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112": -float: 6 -ifloat: 6 -ildouble: 1 -ldouble: 1 -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 - -# 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": -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": -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": -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": -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": -float: 3 -ifloat: 3 -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 -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": -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 -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 -Test "cbrt (0.75) == 0.908560296416069829445605878163630251": -double: 1 -idouble: 1 -Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217": -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 -idouble: 1 -ifloat: 1 -Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i": -float: 1 -ifloat: 1 - -# ccosh -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 -idouble: 1 -ifloat: 1 -Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": -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": -float: 3 -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 -Test "cos (M_PI_6l * 2.0) == 0.5": -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": -float: 1 -ifloat: 1 -Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": -float: 1 -ifloat: 1 -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 -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 -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: 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 -Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": -float: 1 -ifloat: 1 -Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": -float: 1 -ifloat: 1 - -# csqrt -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": -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 -Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": -double: 1 -idouble: 1 - -# erf -Test "erf (1.25) == 0.922900128256458230136523481197281140": -double: 1 -idouble: 1 - -# erfc -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 - -# exp10 -Test "exp10 (-1) == 0.1": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 -Test "exp10 (0.75) == 5.62341325190349080394951039776481231": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 -Test "exp10 (3) == 1000": -double: 6 -float: 2 -idouble: 6 -ifloat: 2 -ildouble: 1 -ldouble: 1 - -# 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 -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": -float: 1 -ifloat: 1 -Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": -float: 1 -ifloat: 1 -Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": -float: 1 -ifloat: 1 -Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": -float: 1 -ifloat: 1 -Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": -float: 1 -ifloat: 1 -Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": -float: 1 -ifloat: 1 -Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": -float: 1 -ifloat: 1 -Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": -float: 1 -ifloat: 1 - -# j0 -Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 -Test "j0 (0.75) == 0.864242275166648623555731103820923211": -float: 1 -ifloat: 1 -Test "j0 (10.0) == -0.245935764451348335197760862485328754": -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 -idouble: 1 -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": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 -Test "jn (0, 0.75) == 0.864242275166648623555731103820923211": -float: 1 -ifloat: 1 -Test "jn (0, 10.0) == -0.245935764451348335197760862485328754": -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 -idouble: 1 -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": -double: 1 -float: 4 -idouble: 1 -ifloat: 4 -Test "jn (2, 2.4048255576957729) == 0.43175480701968038399746111312430703": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 -ildouble: 1 -ldouble: 1 -Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 -Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 -Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563": -double: 3 -float: 1 -idouble: 3 -ifloat: 1 -ildouble: 2 -ldouble: 2 -Test "jn (3, 2.0) == 0.128943249474402051098793332969239835": -double: 1 -float: 2 -idouble: 1 -ifloat: 2 -Test "jn (3, 2.4048255576957729) == 0.19899990535769083404042146764530813": -double: 3 -idouble: 3 -ildouble: 1 -ldouble: 1 -Test "jn (4, 2.4048255576957729) == 0.647466661641779720084932282551219891E-1": -double: 1 -idouble: 1 -ildouble: 1 -ldouble: 1 -Test "jn (5, 2.4048255576957729) == 0.163892432048058525099230549946147698E-1": -double: 3 -float: 1 -idouble: 3 -ifloat: 1 -ildouble: 2 -ldouble: 2 -Test "jn (6, 2.4048255576957729) == 0.34048184720278336646673682895929161E-2": -double: 4 -float: 3 -idouble: 4 -ifloat: 3 -ildouble: 5 -ldouble: 5 -Test "jn (7, 2.4048255576957729) == 0.60068836573295394221291569249883076E-3": -double: 3 -float: 5 -idouble: 3 -ifloat: 5 -ildouble: 3 -ldouble: 3 -Test "jn (8, 2.4048255576957729) == 0.92165786705344923232879022467054148E-4": -double: 3 -float: 2 -idouble: 3 -ifloat: 2 -ildouble: 8 -ldouble: 8 -Test "jn (9, 2.4048255576957729) == 0.12517270977961513005428966643852564E-4": -double: 1 -float: 2 -idouble: 1 -ifloat: 2 -ildouble: 3 -ldouble: 3 - -# 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": -double: 1 -float: 2 -idouble: 1 -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": -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 -Test "tgamma (0.7) == 1.29805533264755778568117117915281162": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 -Test "tgamma (4) == 6": -ildouble: 1 -ldouble: 1 - -# y0 -Test "y0 (1.0) == 0.0882569642156769579829267660235151628": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 -Test "y0 (1.5) == 0.382448923797758843955068554978089862": -double: 2 -float: 1 -idouble: 2 -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 -idouble: 3 -ifloat: 1 -Test "y1 (2.0) == -0.107032431540937546888370772277476637": -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": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 -Test "yn (0, 1.5) == 0.382448923797758843955068554978089862": -double: 2 -float: 1 -idouble: 2 -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 -idouble: 3 -ifloat: 1 -Test "yn (1, 2.0) == -0.107032431540937546888370772277476637": -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 -Test "yn (3, 0.75) == -12.9877176234475433186319774484809207": -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 - -# Maximal error of functions: -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 -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 -ifloat: 4 - -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 -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 -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 -float: 1 -idouble: 1 -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 -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: "exp2": -ildouble: 2 -ldouble: 2 - -Function: "expm1": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 -ildouble: 1 -ldouble: 1 - -Function: "gamma": -ildouble: 1 -ldouble: 1 - -Function: "hypot": -float: 1 -ifloat: 1 - -Function: "j0": -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: 5 -idouble: 4 -ifloat: 5 -ildouble: 8 -ldouble: 8 - -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/sparc64/fpu/s_copysign.S b/sysdeps/sparc/sparc64/fpu/s_copysign.S new file mode 100644 index 0000000..571f57c --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_copysign.S @@ -0,0 +1,31 @@ +/* copysign function, sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__copysign) + sethi %hi(0x80000000), %g1 + st %g1, [%sp + STACK_BIAS + 128] + ld [%sp + STACK_BIAS + 128], %f7 + fands %f2, %f7, %f9 + fandnot2s %f0, %f7, %f0 + retl + fors %f0, %f9, %f0 +END (__copysign) +weak_alias (__copysign, copysign)
\ No newline at end of file diff --git a/sysdeps/sparc/sparc64/fpu/s_copysignf.S b/sysdeps/sparc/sparc64/fpu/s_copysignf.S new file mode 100644 index 0000000..db6a384 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_copysignf.S @@ -0,0 +1,31 @@ +/* float copysign function, sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__copysignf) + sethi %hi(0x80000000), %g1 + st %g1, [%sp + STACK_BIAS + 128] + ld [%sp + STACK_BIAS + 128], %f7 + fands %f3, %f7, %f9 + fandnot2s %f1, %f7, %f1 + retl + fors %f1, %f9, %f0 +END (__copysignf) +weak_alias (__copysignf, copysignf)
\ No newline at end of file diff --git a/sysdeps/sparc/sparc64/fpu/s_finite.S b/sysdeps/sparc/sparc64/fpu/s_finite.S new file mode 100644 index 0000000..f93297e --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_finite.S @@ -0,0 +1,31 @@ +/* finite(). sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__finite) + fabsd %f0, %f0 + st %f0, [%sp + STACK_BIAS + 128] + sethi %hi(0x7ff00000), %o2 + ld [%sp + STACK_BIAS + 128], %o0 + sub %o0, %o2, %o0 + retl + srl %o0, 31, %o0 +END (__finite) +hidden_def (__finite) +weak_alias (__finite, finite) diff --git a/sysdeps/sparc/sparc64/fpu/s_finitef.S b/sysdeps/sparc/sparc64/fpu/s_finitef.S new file mode 100644 index 0000000..2ebac99 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_finitef.S @@ -0,0 +1,31 @@ +/* finitef(). sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__finitef) + fabss %f1, %f0 + st %f0, [%sp + STACK_BIAS + 128] + sethi %hi(0x7f800000), %o2 + ld [%sp + STACK_BIAS + 128], %o0 + sub %o0, %o2, %o0 + retl + srl %o0, 31, %o0 +END (__finitef) +hidden_def (__finitef) +weak_alias (__finitef, finitef) diff --git a/sysdeps/sparc/sparc64/fpu/s_isinf.S b/sysdeps/sparc/sparc64/fpu/s_isinf.S new file mode 100644 index 0000000..20b54c0 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_isinf.S @@ -0,0 +1,34 @@ +/* isinf(). sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__isinf) + std %f0, [%sp + STACK_BIAS + 128] + sethi %hi(0x7ff00000), %o2 + ldx [%sp + STACK_BIAS + 128], %g1 + sllx %o2, 32, %o2 + sllx %g1, 1, %o4 + srlx %o4, 1, %o5 + srax %g1, 62, %o0 + xor %o5, %o2, %o3 + retl + movrne %o3, %g0, %o0 +END (__isinf) +hidden_def (__isinf) +weak_alias (__isinf, isinf) diff --git a/sysdeps/sparc/sparc64/fpu/s_isinff.S b/sysdeps/sparc/sparc64/fpu/s_isinff.S new file mode 100644 index 0000000..302ff8d --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_isinff.S @@ -0,0 +1,33 @@ +/* isinff(). sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__isinff) + st %f1, [%sp + STACK_BIAS + 128] + sethi %hi(0x7f800000), %o2 + lduw [%sp + STACK_BIAS + 128], %g1 + sll %g1, 1, %o4 + srl %o4, 1, %o5 + sra %g1, 30, %o0 + xor %o5, %o2, %o3 + retl + movrne %o3, %g0, %o0 +END (__isinff) +hidden_def (__isinff) +weak_alias (__isinff, isinff) diff --git a/sysdeps/sparc/sparc64/fpu/s_isnan.S b/sysdeps/sparc/sparc64/fpu/s_isnan.S new file mode 100644 index 0000000..00041ca --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_isnan.S @@ -0,0 +1,33 @@ +/* isnan(). sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__isnan) + std %f0, [%sp + STACK_BIAS + 128] + sethi %hi(0x7ff00000), %g1 + ldx [%sp + STACK_BIAS + 128], %o0 + sllx %g1, 32, %g1 + sllx %o0, 1, %o0 + srlx %o0, 1, %o0 + sub %g1, %o0, %o0 + retl + srlx %o0, 63, %o0 +END (__isnan) +hidden_def (__isnan) +weak_alias (__isnan, isnan) diff --git a/sysdeps/sparc/sparc64/fpu/s_isnanf.S b/sysdeps/sparc/sparc64/fpu/s_isnanf.S new file mode 100644 index 0000000..f82c819 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_isnanf.S @@ -0,0 +1,32 @@ +/* isnanf(). sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__isnanf) + st %f1, [%sp + STACK_BIAS + 128] + sethi %hi(0x7f800000), %g1 + lduw [%sp + STACK_BIAS + 128], %o0 + sll %o0, 1, %o0 + srl %o0, 1, %o0 + sub %g1, %o0, %o0 + retl + srl %o0, 31, %o0 +END (__isnanf) +hidden_def (__isnanf) +weak_alias (__isnanf, isnanf) diff --git a/sysdeps/sparc/sparc64/fpu/s_llrint.S b/sysdeps/sparc/sparc64/fpu/s_llrint.S new file mode 100644 index 0000000..7c8e941 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_llrint.S @@ -0,0 +1 @@ +/* llrint is implemented in s_lrint.S */ diff --git a/sysdeps/sparc/sparc64/fpu/s_llrintf.S b/sysdeps/sparc/sparc64/fpu/s_llrintf.S new file mode 100644 index 0000000..abab3b9 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_llrintf.S @@ -0,0 +1 @@ +/* llrintf is implemented in s_lrint.S */ diff --git a/sysdeps/sparc/sparc64/fpu/s_lrint.S b/sysdeps/sparc/sparc64/fpu/s_lrint.S new file mode 100644 index 0000000..6bf56e4 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_lrint.S @@ -0,0 +1,63 @@ +/* lrint(), sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + + /* We pop constants into the FPU registers using the incoming + argument stack slots, since this avoid having to use any PIC + references. We also thus avoid having to allocate a register + window. + + VIS instructions are used to facilitate the formation of + easier constants, and the propagation of the sign bit. */ + +#define TWO_FIFTYTWO 0x43300000 /* 2**52 */ + +#define ZERO %f10 /* 0.0 */ +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__lrint) + sethi %hi(TWO_FIFTYTWO), %o2 + sllx %o2, 32, %o2 + fzero ZERO + + fnegd ZERO, SIGN_BIT + stx %o2, [%sp + STACK_BIAS + 128] + fabsd %f0, %f14 + + ldd [%sp + STACK_BIAS + 128], %f16 + fcmpd %fcc3, %f14, %f16 + + fmovduge %fcc3, ZERO, %f16 + fand %f0, SIGN_BIT, SIGN_BIT + + for %f16, SIGN_BIT, %f16 + faddd %f0, %f16, %f6 + fsubd %f6, %f16, %f0 + fabsd %f0, %f0 + for %f0, SIGN_BIT, %f0 + fdtox %f0, %f4 + std %f4, [%sp + STACK_BIAS + 128] + retl + ldx [%sp + STACK_BIAS + 128], %o0 +END (__lrint) +weak_alias (__lrint, lrint) + +strong_alias (__lrint, __llrint) +weak_alias (__llrint, llrint) diff --git a/sysdeps/sparc/sparc64/fpu/s_lrintf.S b/sysdeps/sparc/sparc64/fpu/s_lrintf.S new file mode 100644 index 0000000..2f2938b --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_lrintf.S @@ -0,0 +1,62 @@ +/* lrintf(), sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller <davem@davemloft.net>, 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + + /* We pop constants into the FPU registers using the incoming + argument stack slots, since this avoid having to use any PIC + references. We also thus avoid having to allocate a register + window. + + VIS instructions are used to facilitate the formation of + easier constants, and the propagation of the sign bit. */ + +#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */ + +#define ZERO %f10 /* 0.0 */ +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__lrintf) + sethi %hi(TWO_TWENTYTHREE), %o2 + fzeros ZERO + + fnegs ZERO, SIGN_BIT + st %o2, [%sp + STACK_BIAS + 128] + fabss %f1, %f14 + + ld [%sp + STACK_BIAS + 128], %f16 + fcmps %fcc3, %f14, %f16 + + fmovsuge %fcc3, ZERO, %f16 + fands %f1, SIGN_BIT, SIGN_BIT + + fors %f16, SIGN_BIT, %f16 + fadds %f1, %f16, %f5 + fsubs %f5, %f16, %f0 + fabss %f0, %f0 + fors %f0, SIGN_BIT, %f0 + fstox %f0, %f4 + std %f4, [%sp + STACK_BIAS + 128] + retl + ldx [%sp + STACK_BIAS + 128], %o0 +END (__lrintf) +weak_alias (__lrintf, lrintf) + +strong_alias (__lrintf, __llrintf) +weak_alias (__llrintf, llrintf) diff --git a/sysdeps/sparc/sparc64/fpu/s_signbit.S b/sysdeps/sparc/sparc64/fpu/s_signbit.S new file mode 100644 index 0000000..3c1ea00 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_signbit.S @@ -0,0 +1,34 @@ +/* signbit(). sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__signbit) + st %f0, [%sp + STACK_BIAS + 128] + ld [%sp + STACK_BIAS + 128], %o0 + retl + srl %o0, 31, %o0 +END (__signbit) +weak_alias (__signbit, signbit) + +/* On 64-bit the double version will also always work for + long-double-precision since in both cases the word with the + sign bit in it is passed always in register %f0. */ +strong_alias (__signbit, __signbitl) +hidden_def (__signbitl) +weak_alias (__signbitl, signbitl) diff --git a/sysdeps/sparc/sparc64/fpu/s_signbitf.S b/sysdeps/sparc/sparc64/fpu/s_signbitf.S new file mode 100644 index 0000000..d2a7aa5 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_signbitf.S @@ -0,0 +1,27 @@ +/* signbitf(). sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__signbitf) + st %f1, [%sp + STACK_BIAS + 128] + ld [%sp + STACK_BIAS + 128], %o0 + retl + srl %o0, 31, %o0 +END (__signbitf) +weak_alias (__signbitf, signbitf) diff --git a/sysdeps/sparc/sparc64/fpu/s_signbitl.S b/sysdeps/sparc/sparc64/fpu/s_signbitl.S new file mode 100644 index 0000000..f5e5fb9 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_signbitl.S @@ -0,0 +1 @@ +/* signbitl is implemented in s_signbit.S */ diff --git a/sysdeps/sparc/sparc64/fpu/w_sqrt.S b/sysdeps/sparc/sparc64/fpu/w_sqrt.S new file mode 100644 index 0000000..dd6039a --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/w_sqrt.S @@ -0,0 +1,48 @@ +/* sqrt function. sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__sqrt) + fzero %f8 + fcmpd %fcc2, %f0, %f8 + fbl,pn %fcc2, 1f + nop +8: retl + fsqrtd %f0, %f0 +1: +#ifdef SHARED + SETUP_PIC_REG_LEAF(o5, g1) + sethi %gdop_hix22(_LIB_VERSION), %g1 + xor %g1, %gdop_lox10(_LIB_VERSION), %g1 + ldx [%o5 + %g1], %g1, %gdop(_LIB_VERSION) +#else + sethi %hi(_LIB_VERSION), %g1 + or %g1, %lo(_LIB_VERSION), %g1 +#endif + ld [%g1], %g1 + cmp %g1, -1 + be,pt %icc, 8b + fmovd %f0, %f2 + mov 26, %o2 + mov %o7, %g1 + call __kernel_standard + mov %g1, %o7 +END (__sqrt) + +weak_alias (__sqrt, sqrt) diff --git a/sysdeps/sparc/sparc64/fpu/w_sqrtf.S b/sysdeps/sparc/sparc64/fpu/w_sqrtf.S new file mode 100644 index 0000000..1472e34 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/w_sqrtf.S @@ -0,0 +1,48 @@ +/* sqrtf function. sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +ENTRY (__sqrtf) + fzeros %f8 + fcmps %fcc2, %f1, %f8 + fbl,pn %fcc2, 1f + nop +8: retl + fsqrts %f1, %f0 +1: +#ifdef SHARED + SETUP_PIC_REG_LEAF(o5, g1) + sethi %gdop_hix22(_LIB_VERSION), %g1 + xor %g1, %gdop_lox10(_LIB_VERSION), %g1 + ldx [%o5 + %g1], %g1, %gdop(_LIB_VERSION) +#else + sethi %hi(_LIB_VERSION), %g1 + or %g1, %lo(_LIB_VERSION), %g1 +#endif + ld [%g1], %g1 + cmp %g1, -1 + be,pt %icc, 8b + fmovs %f1, %f3 + mov 126, %o2 + mov %o7, %g1 + call __kernel_standard_f + mov %g1, %o7 +END (__sqrtf) + +weak_alias (__sqrtf, sqrtf) diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h index 874660b..780b20a 100644 --- a/sysdeps/unix/sysv/linux/dl-osinfo.h +++ b/sysdeps/unix/sysv/linux/dl-osinfo.h @@ -84,8 +84,8 @@ _dl_setup_stack_chk_guard (void *dl_random) return ret.num; } # endif - ret.bytes[filllen - 2] = 255; - ret.bytes[filllen - 3] = '\n'; + ret.bytes[filllen] = 255; + ret.bytes[filllen - 1] = '\n'; } else #endif diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S b/sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S index 7246e89..0b3361b 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S @@ -67,15 +67,9 @@ ENTRY (____longjmp_chk) or %o0, %lo(longjmp_msg), %o0 #else SETUP_PIC_REG(l7) -#ifdef HAVE_BINUTILS_GOTDATA sethi %gdop_hix22(longjmp_msg), %o0 xor %o0, %gdop_lox10(longjmp_msg), %o0 ld [%l7 + %o0], %o0, %gdop(longjmp_msg) -#else - sethi %hi(longjmp_msg), %o0 - or %o0, %lo(longjmp_msg), %o0 - ld [%l7 + %o0], %o0 -#endif #endif call HIDDEN_JUMPTARGET(__fortify_fail) nop diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c b/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c deleted file mode 100644 index c30d8e0..0000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 1997, 2002, 2003, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <unistd.h> -#include <sys/param.h> -#include <ldsodefs.h> -#include <sysdep.h> - -/* Return the system page size. This value will either be 4k or 8k depending - on whether or not we are running on Sparc v9 machine. */ - -/* If we are not a static program, this value is collected from the system - via the AT_PAGESZ auxiliary argument. If we are a static program, we - use the getpagesize system call. */ - -int -__getpagesize () -{ - int ret = GLRO(dl_pagesize); - if (ret == 0) - { - INTERNAL_SYSCALL_DECL (err); - ret = INTERNAL_SYSCALL (getpagesize, err, 0); -#ifndef SHARED - GLRO(dl_pagesize) = ret; -#endif - } - return ret; -} -libc_hidden_def (__getpagesize) -weak_alias (__getpagesize, getpagesize) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h index 3d6042e..3424598 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h @@ -88,8 +88,7 @@ ENTRY(name); \ mov %g1, %o7; #else # if RTLD_PRIVATE_ERRNO -# ifdef HAVE_BINUTILS_GOTDATA -# define SYSCALL_ERROR_HANDLER \ +# define SYSCALL_ERROR_HANDLER \ 0: SETUP_PIC_REG_LEAF(o2,g1) \ sethi %gdop_hix22(rtld_errno), %g1; \ xor %g1, %gdop_lox10(rtld_errno), %g1;\ @@ -97,16 +96,6 @@ ENTRY(name); \ st %o0, [%g1]; \ jmp %o7 + 8; \ mov -1, %o0; -# else -# define SYSCALL_ERROR_HANDLER \ -0: SETUP_PIC_REG_LEAF(o2,g1) \ - sethi %hi(rtld_errno), %g1; \ - or %g1, %lo(rtld_errno), %g1; \ - ld [%o2 + %g1], %g1; \ - st %o0, [%g1]; \ - jmp %o7 + 8; \ - mov -1, %o0; -# endif # elif defined _LIBC_REENTRANT # ifndef NOT_IN_libc @@ -123,8 +112,7 @@ ENTRY(name); \ jmp %o7 + 8; \ mov -1, %o0; # else -# ifdef HAVE_BINUTILS_GOTDATA -# define SYSCALL_ERROR_HANDLER \ +# define SYSCALL_ERROR_HANDLER \ 0: SETUP_PIC_REG_LEAF(o2,g1) \ sethi %gdop_hix22(errno), %g1;\ xor %g1, %gdop_lox10(errno), %g1;\ @@ -132,16 +120,6 @@ ENTRY(name); \ st %o0, [%g1]; \ jmp %o7 + 8; \ mov -1, %o0; -# else -# define SYSCALL_ERROR_HANDLER \ -0: SETUP_PIC_REG_LEAF(o2,g1) \ - sethi %hi(errno), %g1; \ - or %g1, %lo(errno), %g1; \ - ld [%o2 + %g1], %g1; \ - st %o0, [%g1]; \ - jmp %o7 + 8; \ - mov -1, %o0; -# endif # endif /* _LIBC_REENTRANT */ #endif /* PIC */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S b/sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S index 69cf5ac..9b4e1e7 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S @@ -67,15 +67,9 @@ ENTRY (____longjmp_chk) or %o0, %lo(longjmp_msg), %o0 #else SETUP_PIC_REG(l7) -#ifdef HAVE_BINUTILS_GOTDATA sethi %gdop_hix22(longjmp_msg), %o0 xor %o0, %gdop_lox10(longjmp_msg), %o0 ldx [%l7 + %o0], %o0, %gdop(longjmp_msg) -#else - sethi %hi(longjmp_msg), %o0 - or %o0, %lo(longjmp_msg), %o0 - ldx [%l7 + %o0], %o0 -#endif #endif call HIDDEN_JUMPTARGET(__fortify_fail) nop diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S index a89d877..14b2967 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S @@ -64,15 +64,9 @@ ENTRY (__brk) sethi %hi(__curbrk), %g1 or %g1, %lo(__curbrk), %g1 #else -#ifdef HAVE_BINUTILS_GOTDATA sethi %gdop_hix22(__curbrk), %g1 xor %g1, %gdop_lox10(__curbrk), %g1 ldx [%l7 + %g1], %g1, %gdop(__curbrk) -#else - sethi %hi(__curbrk), %g1 - or %g1, %lo(__curbrk), %g1 - ldx [%l7 + %g1], %g1 -#endif #endif stx %o0, [%g1] mov %g0, %i0 @@ -89,15 +83,9 @@ ENTRY (__brk) sethi %hi(errno), %g1 or %g1, %lo(errno), %g1 #else -#ifdef HAVE_BINUTILS_GOTDATA sethi %gdop_hix22(errno), %g1 xor %g1, %gdop_lox10(errno), %g1 ldx [%l7 + %g1], %g1, %gdop(errno) -#else - sethi %hi(errno), %g1 - or %g1, %lo(errno), %g1 - ldx [%l7 + %g1], %g1 -#endif #endif st %o0, [%g1] #else diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h index 33e1a41..1bf7597 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h @@ -95,8 +95,7 @@ ENTRY(name); \ mov %g1, %o7; #else # if RTLD_PRIVATE_ERRNO -# ifdef HAVE_BINUTILS_GOTDATA -# define SYSCALL_ERROR_HANDLER \ +# define SYSCALL_ERROR_HANDLER \ 0: SETUP_PIC_REG_LEAF(o2,g1) \ sethi %gdop_hix22(rtld_errno), %g1; \ xor %g1, %gdop_lox10(rtld_errno), %g1;\ @@ -104,16 +103,6 @@ ENTRY(name); \ st %o0, [%g1]; \ jmp %o7 + 8; \ mov -1, %o0; -# else -# define SYSCALL_ERROR_HANDLER \ -0: SETUP_PIC_REG_LEAF(o2,g1) \ - sethi %hi(rtld_errno), %g1; \ - or %g1, %lo(rtld_errno), %g1; \ - ldx [%o2 + %g1], %g1; \ - st %o0, [%g1]; \ - jmp %o7 + 8; \ - mov -1, %o0; -# endif # elif defined _LIBC_REENTRANT # ifndef NOT_IN_libc @@ -130,8 +119,7 @@ ENTRY(name); \ jmp %o7 + 8; \ mov -1, %o0; # else -# ifdef HAVE_BINUTILS_GOTDATA -# define SYSCALL_ERROR_HANDLER \ +# define SYSCALL_ERROR_HANDLER \ 0: SETUP_PIC_REG_LEAF(o2,g1) \ sethi %gdop_hix22(errno), %g1;\ xor %g1, %gdop_lox10(errno), %g1;\ @@ -139,16 +127,6 @@ ENTRY(name); \ st %o0, [%g1]; \ jmp %o7 + 8; \ mov -1, %o0; -# else -# define SYSCALL_ERROR_HANDLER \ -0: SETUP_PIC_REG_LEAF(o2,g1) \ - sethi %hi(errno), %g1; \ - or %g1, %lo(errno), %g1; \ - ldx [%o2 + %g1], %g1; \ - st %o0, [%g1]; \ - jmp %o7 + 8; \ - mov -1, %o0; -# endif # endif /* _LIBC_REENTRANT */ #endif /* PIC */ diff --git a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c index a13948b..e41fddb 100644 --- a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c @@ -30,7 +30,7 @@ gettimeofday_ifunc (void) PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); /* If the vDSO is not available we fall back on the old vsyscall. */ - return (_dl_vdso_vsym ("gettimeofday", &linux26) + return (_dl_vdso_vsym ("__vdso_gettimeofday", &linux26) ?: (void *) VSYSCALL_ADDR_vgettimeofday); } __asm (".type __gettimeofday, %gnu_indirect_function"); diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c index 0a9948b..e8b52ea 100644 --- a/sysdeps/unix/sysv/linux/x86_64/init-first.c +++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c @@ -36,13 +36,13 @@ _libc_vdso_platform_setup (void) { PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); - void *p = _dl_vdso_vsym ("clock_gettime", &linux26); + void *p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26); if (p == NULL) p = __syscall_clock_gettime; PTR_MANGLE (p); __GI___vdso_clock_gettime = p; - p = _dl_vdso_vsym ("getcpu", &linux26); + p = _dl_vdso_vsym ("__vdso_getcpu", &linux26); /* If the vDSO is not available we fall back on the old vsyscall. */ #define VSYSCALL_ADDR_vgetcpu 0xffffffffff600800 if (p == NULL) diff --git a/sysdeps/unix/sysv/linux/x86_64/time.c b/sysdeps/unix/sysv/linux/x86_64/time.c index 67afff3..0e05ddd 100644 --- a/sysdeps/unix/sysv/linux/x86_64/time.c +++ b/sysdeps/unix/sysv/linux/x86_64/time.c @@ -28,7 +28,7 @@ time_ifunc (void) PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); /* If the vDSO is not available we fall back on the old vsyscall. */ - return _dl_vdso_vsym ("time", &linux26) ?: (void *) VSYSCALL_ADDR_vtime; + return _dl_vdso_vsym ("__vdso_time", &linux26) ?: (void *) VSYSCALL_ADDR_vtime; } __asm (".type time, %gnu_indirect_function"); diff --git a/sysdeps/x86_64/bits/atomic.h b/sysdeps/x86_64/bits/atomic.h index 4a0d40b..4b8d2ab 100644 --- a/sysdeps/x86_64/bits/atomic.h +++ b/sysdeps/x86_64/bits/atomic.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2004, 2006, 2007, 2009 Free Software Foundation, Inc. +/* Copyright (C) 2002-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -55,41 +55,10 @@ typedef uintmax_t uatomic_max_t; #endif -#if __GNUC_PREREQ (4, 1) -# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ +#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ __sync_val_compare_and_swap (mem, oldval, newval) -# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ +#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ (! __sync_bool_compare_and_swap (mem, oldval, newval)) -#else -# define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgb %b2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "q" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) - -# define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgw %w2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) - -# define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgl %2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "m" (*mem), "0" (oldval)); \ - ret; }) - -# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ - ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK_PREFIX "cmpxchgq %q2, %1" \ - : "=a" (ret), "=m" (*mem) \ - : "r" ((long int) (newval)), "m" (*mem), \ - "0" ((long int) (oldval))); \ - ret; }) -#endif #define __arch_c_compare_and_exchange_val_8_acq(mem, newval, oldval) \ @@ -184,13 +153,8 @@ typedef uintmax_t uatomic_max_t; "i" (offsetof (tcbhead_t, multiple_threads))); \ result; }) -#if __GNUC_PREREQ (4, 1) -# define atomic_exchange_and_add(mem, value) \ +#define atomic_exchange_and_add(mem, value) \ __sync_fetch_and_add (mem, value) -#else -# define atomic_exchange_and_add(mem, value) \ - __arch_exchange_and_add_body (LOCK_PREFIX, mem, value) -#endif #define __arch_exchange_and_add_cprefix \ "cmpl $0, %%fs:%P4\n\tje 0f\n\tlock\n0:\t" diff --git a/sysdeps/x86_64/fpu/e_expf.S b/sysdeps/x86_64/fpu/e_expf.S new file mode 100644 index 0000000..f1ce285 --- /dev/null +++ b/sysdeps/x86_64/fpu/e_expf.S @@ -0,0 +1,340 @@ +/* Optimized __ieee754_expf function. + Copyright (C) 2012 Free Software Foundation, Inc. + Contributed by Intel Corporation. + 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> + +/* Short algorithm description: + * + * Let K = 64 (table size). + * e^x = 2^(x/log(2)) = 2^n * T[j] * (1 + P(y)) + * where + * x = m*log(2)/K + y, y in [0.0..log(2)/K] + * m = n*K + j, m,n,j - signed integer, j in [0..K-1] + * values of 2^(j/K) are tabulated as T[j]. + * + * P(y) is a minimax polynomial approximation of expf(x)-1 + * on small interval [0.0..log(2)/K]. + * + * P(y) = P3*y*y*y*y + P2*y*y*y + P1*y*y + P0*y, calculated as + * z = y*y; P(y) = (P3*z + P1)*z + (P2*z + P0)*y + * + * Special cases: + * expf(NaN) = NaN + * expf(+INF) = +INF + * expf(-INF) = 0 + * expf(x) = 1 for subnormals + * for finite argument, only expf(0)=1 is exact + * expf(x) overflows if x>88.7228317260742190 + * expf(x) underflows if x<-103.972076416015620 + */ + + .text +ENTRY(__ieee754_expf) + /* Input: single precision x in %xmm0 */ + cvtss2sd %xmm0, %xmm1 /* Convert x to double precision */ + movd %xmm0, %ecx /* Copy x */ + movsd L(DP_KLN2)(%rip), %xmm2 /* DP K/log(2) */ + movsd L(DP_P2)(%rip), %xmm3 /* DP P2 */ + movl %ecx, %eax /* x */ + mulsd %xmm1, %xmm2 /* DP x*K/log(2) */ + andl $0x7fffffff, %ecx /* |x| */ + lea L(DP_T)(%rip), %rsi /* address of table T[j] */ + cmpl $0x42ad496b, %ecx /* |x|<125*log(2) ? */ + movsd L(DP_P3)(%rip), %xmm4 /* DP P3 */ + addsd L(DP_RS)(%rip), %xmm2 /* DP x*K/log(2)+RS */ + jae L(special_paths) + + /* Here if |x|<125*log(2) */ + cmpl $0x31800000, %ecx /* |x|<2^(-28) ? */ + jb L(small_arg) + + /* Main path: here if 2^(-28)<=|x|<125*log(2) */ + cvtsd2ss %xmm2, %xmm2 /* SP x*K/log(2)+RS */ + movd %xmm2, %eax /* bits of n*K+j with trash */ + subss L(SP_RS)(%rip), %xmm2 /* SP t=round(x*K/log(2)) */ + movl %eax, %edx /* n*K+j with trash */ + cvtss2sd %xmm2, %xmm2 /* DP t */ + andl $0x3f, %eax /* bits of j */ + mulsd L(DP_NLN2K)(%rip), %xmm2/* DP -t*log(2)/K */ + andl $0xffffffc0, %edx /* bits of n */ +#ifdef __AVX__ + vaddsd %xmm1, %xmm2, %xmm0 /* DP y=x-t*log(2)/K */ + vmulsd %xmm0, %xmm0, %xmm2 /* DP z=y*y */ +#else + addsd %xmm1, %xmm2 /* DP y=x-t*log(2)/K */ + movaps %xmm2, %xmm0 /* DP y */ + mulsd %xmm2, %xmm2 /* DP z=y*y */ +#endif + mulsd %xmm2, %xmm4 /* DP P3*z */ + addl $0x1fc0, %edx /* bits of n + SP exponent bias */ + mulsd %xmm2, %xmm3 /* DP P2*z */ + shll $17, %edx /* SP 2^n */ + addsd L(DP_P1)(%rip), %xmm4 /* DP P3*z+P1 */ + addsd L(DP_P0)(%rip), %xmm3 /* DP P2*z+P0 */ + movd %edx, %xmm1 /* SP 2^n */ + mulsd %xmm2, %xmm4 /* DP (P3*z+P1)*z */ + mulsd %xmm3, %xmm0 /* DP (P2*z+P0)*y */ + addsd %xmm4, %xmm0 /* DP P(y) */ + mulsd (%rsi,%rax,8), %xmm0 /* DP P(y)*T[j] */ + addsd (%rsi,%rax,8), %xmm0 /* DP T[j]*(P(y)+1) */ + cvtsd2ss %xmm0, %xmm0 /* SP T[j]*(P(y)+1) */ + mulss %xmm1, %xmm0 /* SP result=2^n*(T[j]*(P(y)+1)) */ + ret + + .p2align 4 +L(small_arg): + /* Here if 0<=|x|<2^(-28) */ + addss L(SP_ONE)(%rip), %xmm0 /* 1.0 + x */ + /* Return 1.0 with inexact raised, except for x==0 */ + ret + + .p2align 4 +L(special_paths): + /* Here if 125*log(2)<=|x| */ + shrl $31, %eax /* Get sign bit of x, and depending on it: */ + lea L(SP_RANGE)(%rip), %rdx /* load over/underflow bound */ + cmpl (%rdx,%rax,4), %ecx /* |x|<under/overflow bound ? */ + jbe L(near_under_or_overflow) + + /* Here if |x|>under/overflow bound */ + cmpl $0x7f800000, %ecx /* |x| is finite ? */ + jae L(arg_inf_or_nan) + + /* Here if |x|>under/overflow bound, and x is finite */ + testq %rax, %rax /* sign of x nonzero ? */ + je L(res_overflow) + + /* Here if -inf<x<underflow bound (x<0) */ + movss L(SP_SMALL)(%rip), %xmm0/* load small value 2^(-100) */ + mulss %xmm0, %xmm0 /* Return underflowed result (zero or subnormal) */ + ret + + .p2align 4 +L(res_overflow): + /* Here if overflow bound<x<inf (x>0) */ + movss L(SP_LARGE)(%rip), %xmm0/* load large value 2^100 */ + mulss %xmm0, %xmm0 /* Return overflowed result (Inf or max normal) */ + ret + + .p2align 4 +L(arg_inf_or_nan): + /* Here if |x| is Inf or NAN */ + jne L(arg_nan) /* |x| is Inf ? */ + + /* Here if |x| is Inf */ + lea L(SP_INF_0)(%rip), %rdx /* depending on sign of x: */ + movss (%rdx,%rax,4), %xmm0 /* return zero or Inf */ + ret + + .p2align 4 +L(arg_nan): + /* Here if |x| is NaN */ + addss %xmm0, %xmm0 /* Return x+x (raise invalid) */ + ret + + .p2align 4 +L(near_under_or_overflow): + /* Here if 125*log(2)<=|x|<under/overflow bound */ + cvtsd2ss %xmm2, %xmm2 /* SP x*K/log(2)+RS */ + movd %xmm2, %eax /* bits of n*K+j with trash */ + subss L(SP_RS)(%rip), %xmm2 /* SP t=round(x*K/log(2)) */ + movl %eax, %edx /* n*K+j with trash */ + cvtss2sd %xmm2, %xmm2 /* DP t */ + andl $0x3f, %eax /* bits of j */ + mulsd L(DP_NLN2K)(%rip), %xmm2/* DP -t*log(2)/K */ + andl $0xffffffc0, %edx /* bits of n */ +#ifdef __AVX__ + vaddsd %xmm1, %xmm2, %xmm0 /* DP y=x-t*log(2)/K */ + vmulsd %xmm0, %xmm0, %xmm2 /* DP z=y*y */ +#else + addsd %xmm1, %xmm2 /* DP y=x-t*log(2)/K */ + movaps %xmm2, %xmm0 /* DP y */ + mulsd %xmm2, %xmm2 /* DP z=y*y */ +#endif + mulsd %xmm2, %xmm4 /* DP P3*z */ + addl $0xffc0, %edx /* bits of n + DP exponent bias */ + mulsd %xmm2, %xmm3 /* DP P2*z */ + shlq $46, %rdx /* DP 2^n */ + addsd L(DP_P1)(%rip), %xmm4 /* DP P3*z+P1 */ + addsd L(DP_P0)(%rip), %xmm3 /* DP P2*z+P0 */ + movd %rdx, %xmm1 /* DP 2^n */ + mulsd %xmm2, %xmm4 /* DP (P3*z+P1)*z */ + mulsd %xmm3, %xmm0 /* DP (P2*z+P0)*y */ + addsd %xmm4, %xmm0 /* DP P(y) */ + mulsd (%rsi,%rax,8), %xmm0 /* DP P(y)*T[j] */ + addsd (%rsi,%rax,8), %xmm0 /* DP T[j]*(P(y)+1) */ + mulsd %xmm1, %xmm0 /* DP result=2^n*(T[j]*(P(y)+1)) */ + cvtsd2ss %xmm0, %xmm0 /* convert result to single precision */ + ret +END(__ieee754_expf) + + .section .rodata, "a" + .p2align 3 +L(DP_T): /* table of double precision values 2^(j/K) for j=[0..K-1] */ + .long 0x00000000, 0x3ff00000 + .long 0x3e778061, 0x3ff02c9a + .long 0xd3158574, 0x3ff059b0 + .long 0x18759bc8, 0x3ff08745 + .long 0x6cf9890f, 0x3ff0b558 + .long 0x32d3d1a2, 0x3ff0e3ec + .long 0xd0125b51, 0x3ff11301 + .long 0xaea92de0, 0x3ff1429a + .long 0x3c7d517b, 0x3ff172b8 + .long 0xeb6fcb75, 0x3ff1a35b + .long 0x3168b9aa, 0x3ff1d487 + .long 0x88628cd6, 0x3ff2063b + .long 0x6e756238, 0x3ff2387a + .long 0x65e27cdd, 0x3ff26b45 + .long 0xf51fdee1, 0x3ff29e9d + .long 0xa6e4030b, 0x3ff2d285 + .long 0x0a31b715, 0x3ff306fe + .long 0xb26416ff, 0x3ff33c08 + .long 0x373aa9cb, 0x3ff371a7 + .long 0x34e59ff7, 0x3ff3a7db + .long 0x4c123422, 0x3ff3dea6 + .long 0x21f72e2a, 0x3ff4160a + .long 0x6061892d, 0x3ff44e08 + .long 0xb5c13cd0, 0x3ff486a2 + .long 0xd5362a27, 0x3ff4bfda + .long 0x769d2ca7, 0x3ff4f9b2 + .long 0x569d4f82, 0x3ff5342b + .long 0x36b527da, 0x3ff56f47 + .long 0xdd485429, 0x3ff5ab07 + .long 0x15ad2148, 0x3ff5e76f + .long 0xb03a5585, 0x3ff6247e + .long 0x82552225, 0x3ff66238 + .long 0x667f3bcd, 0x3ff6a09e + .long 0x3c651a2f, 0x3ff6dfb2 + .long 0xe8ec5f74, 0x3ff71f75 + .long 0x564267c9, 0x3ff75feb + .long 0x73eb0187, 0x3ff7a114 + .long 0x36cf4e62, 0x3ff7e2f3 + .long 0x994cce13, 0x3ff82589 + .long 0x9b4492ed, 0x3ff868d9 + .long 0x422aa0db, 0x3ff8ace5 + .long 0x99157736, 0x3ff8f1ae + .long 0xb0cdc5e5, 0x3ff93737 + .long 0x9fde4e50, 0x3ff97d82 + .long 0x82a3f090, 0x3ff9c491 + .long 0x7b5de565, 0x3ffa0c66 + .long 0xb23e255d, 0x3ffa5503 + .long 0x5579fdbf, 0x3ffa9e6b + .long 0x995ad3ad, 0x3ffae89f + .long 0xb84f15fb, 0x3ffb33a2 + .long 0xf2fb5e47, 0x3ffb7f76 + .long 0x904bc1d2, 0x3ffbcc1e + .long 0xdd85529c, 0x3ffc199b + .long 0x2e57d14b, 0x3ffc67f1 + .long 0xdcef9069, 0x3ffcb720 + .long 0x4a07897c, 0x3ffd072d + .long 0xdcfba487, 0x3ffd5818 + .long 0x03db3285, 0x3ffda9e6 + .long 0x337b9b5f, 0x3ffdfc97 + .long 0xe78b3ff6, 0x3ffe502e + .long 0xa2a490da, 0x3ffea4af + .long 0xee615a27, 0x3ffefa1b + .long 0x5b6e4540, 0x3fff5076 + .long 0x819e90d8, 0x3fffa7c1 + ASM_TYPE_DIRECTIVE(L(DP_T), @object) + ASM_SIZE_DIRECTIVE(L(DP_T)) + + .section .rodata.cst8,"aM",@progbits,8 + .p2align 3 +L(DP_KLN2): /* double precision K/log(2) */ + .long 0x652b82fe, 0x40571547 + ASM_TYPE_DIRECTIVE(L(DP_KLN2), @object) + ASM_SIZE_DIRECTIVE(L(DP_KLN2)) + + .p2align 3 +L(DP_NLN2K): /* double precision -log(2)/K */ + .long 0xfefa39ef, 0xbf862e42 + ASM_TYPE_DIRECTIVE(L(DP_NLN2K), @object) + ASM_SIZE_DIRECTIVE(L(DP_NLN2K)) + + .p2align 3 +L(DP_RS): /* double precision 2^23+2^22 */ + .long 0x00000000, 0x41680000 + ASM_TYPE_DIRECTIVE(L(DP_RS), @object) + ASM_SIZE_DIRECTIVE(L(DP_RS)) + + .p2align 3 +L(DP_P3): /* double precision polynomial coefficient P3 */ + .long 0xeb78fa85, 0x3fa56420 + ASM_TYPE_DIRECTIVE(L(DP_P3), @object) + ASM_SIZE_DIRECTIVE(L(DP_P3)) + + .p2align 3 +L(DP_P1): /* double precision polynomial coefficient P1 */ + .long 0x008d6118, 0x3fe00000 + ASM_TYPE_DIRECTIVE(L(DP_P1), @object) + ASM_SIZE_DIRECTIVE(L(DP_P1)) + + .p2align 3 +L(DP_P2): /* double precision polynomial coefficient P2 */ + .long 0xda752d4f, 0x3fc55550 + ASM_TYPE_DIRECTIVE(L(DP_P2), @object) + ASM_SIZE_DIRECTIVE(L(DP_P2)) + + .p2align 3 +L(DP_P0): /* double precision polynomial coefficient P0 */ + .long 0xffffe7c6, 0x3fefffff + ASM_TYPE_DIRECTIVE(L(DP_P0), @object) + ASM_SIZE_DIRECTIVE(L(DP_P0)) + + .p2align 2 +L(SP_RANGE): /* single precision overflow/underflow bounds */ + .long 0x42b17217 /* if x>this bound, then result overflows */ + .long 0x42cff1b4 /* if x<this bound, then result underflows */ + ASM_TYPE_DIRECTIVE(L(SP_RANGE), @object) + ASM_SIZE_DIRECTIVE(L(SP_RANGE)) + + .p2align 2 +L(SP_INF_0): + .long 0x7f800000 /* single precision Inf */ + .long 0 /* single precision zero */ + ASM_TYPE_DIRECTIVE(L(SP_INF_0), @object) + ASM_SIZE_DIRECTIVE(L(SP_INF_0)) + + .section .rodata.cst4,"aM",@progbits,4 + .p2align 2 +L(SP_RS): /* single precision 2^23+2^22 */ + .long 0x4b400000 + ASM_TYPE_DIRECTIVE(L(SP_RS), @object) + ASM_SIZE_DIRECTIVE(L(SP_RS)) + + .p2align 2 +L(SP_SMALL): /* single precision small value 2^(-100) */ + .long 0x0d800000 + ASM_TYPE_DIRECTIVE(L(SP_SMALL), @object) + ASM_SIZE_DIRECTIVE(L(SP_SMALL)) + + .p2align 2 +L(SP_LARGE): /* single precision large value 2^100 */ + .long 0x71800000 + ASM_TYPE_DIRECTIVE(L(SP_LARGE), @object) + ASM_SIZE_DIRECTIVE(L(SP_LARGE)) + + .p2align 2 +L(SP_ONE): /* single precision 1.0 */ + .long 0x3f800000 + ASM_TYPE_DIRECTIVE(L(SP_ONE), @object) + ASM_SIZE_DIRECTIVE(L(SP_ONE)) + +strong_alias (__ieee754_expf, __expf_finite) diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps index a2a82e6..269dca6 100644 --- a/sysdeps/x86_64/fpu/libm-test-ulps +++ b/sysdeps/x86_64/fpu/libm-test-ulps @@ -327,6 +327,151 @@ ifloat: 1 ildouble: 1 ldouble: 1 +# cos_downward +Test "cos_downward (1) == 0.5403023058681397174009366074429766037323": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_downward (2) == -0.4161468365471423869975682295007621897660": +float: 1 +ifloat: 1 +Test "cos_downward (3) == -0.9899924966004454572715727947312613023937": +float: 1 +ifloat: 1 +Test "cos_downward (4) == -0.6536436208636119146391681830977503814241": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_downward (5) == 0.2836621854632262644666391715135573083344": +float: 1 +ifloat: 1 +Test "cos_downward (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_downward (8) == -0.1455000338086135258688413818311946826093": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_downward (9) == -0.9111302618846769883682947111811653112463": +ildouble: 1 +ldouble: 1 + +# cos_tonearest +Test "cos_tonearest (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +Test "cos_tonearest (8) == -0.1455000338086135258688413818311946826093": +ildouble: 1 +ldouble: 1 +Test "cos_tonearest (9) == -0.9111302618846769883682947111811653112463": +ildouble: 1 +ldouble: 1 + +# cos_towardzero +Test "cos_towardzero (1) == 0.5403023058681397174009366074429766037323": +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (10) == -0.8390715290764524522588639478240648345199": +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (2) == -0.4161468365471423869975682295007621897660": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (3) == -0.9899924966004454572715727947312613023937": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (5) == 0.2836621854632262644666391715135573083344": +float: 1 +ifloat: 1 +Test "cos_towardzero (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_towardzero (8) == -0.1455000338086135258688413818311946826093": +float: 1 +ifloat: 1 + +# cos_upward +Test "cos_upward (10) == -0.8390715290764524522588639478240648345199": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_upward (2) == -0.4161468365471423869975682295007621897660": +ildouble: 1 +ldouble: 1 +Test "cos_upward (3) == -0.9899924966004454572715727947312613023937": +ildouble: 1 +ldouble: 1 +Test "cos_upward (5) == 0.2836621854632262644666391715135573083344": +ildouble: 1 +ldouble: 1 +Test "cos_upward (6) == 0.9601702866503660205456522979229244054519": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos_upward (7) == 0.7539022543433046381411975217191820122183": +float: 1 +ifloat: 1 +Test "cos_upward (9) == -0.9111302618846769883682947111811653112463": +float: 2 +ifloat: 2 + +# cosh_downward +Test "cosh_downward (22) == 1792456423.065795780980053377632656584997": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "cosh_downward (23) == 4872401723.124451300068625740569997090344": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cosh_downward (24) == 13244561064.92173614708845674912733665919": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cosh_tonearest +Test "cosh_tonearest (22) == 1792456423.065795780980053377632656584997": +ildouble: 1 +ldouble: 1 + +# cosh_towardzero +Test "cosh_towardzero (22) == 1792456423.065795780980053377632656584997": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "cosh_towardzero (23) == 4872401723.124451300068625740569997090344": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cosh_towardzero (24) == 13244561064.92173614708845674912733665919": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cosh_upward +Test "cosh_upward (23) == 4872401723.124451300068625740569997090344": +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": float: 1 @@ -420,8 +565,8 @@ ifloat: 1 Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": double: 1 idouble: 1 -ildouble: 439 -ldouble: 439 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": float: 1 ifloat: 1 @@ -444,11 +589,11 @@ double: 1 float: 2 idouble: 1 ifloat: 2 -ildouble: 5 -ldouble: 5 +ildouble: 3 +ldouble: 3 Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": -ildouble: 25 -ldouble: 25 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i": float: 1 ifloat: 1 @@ -467,6 +612,16 @@ double: 1 idouble: 1 # erfc +Test "erfc (0x1.f7303cp+1) == 2.705500297238986897105236321218861842255e-8": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "erfc (0x1.ffa002p+2) == 1.233585992097580296336099501489175967033e-29": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 Test "erfc (1.25) == 0.0770998717435417698634765188027188596": ildouble: 1 ldouble: 1 @@ -502,6 +657,41 @@ ifloat: 2 ildouble: 8 ldouble: 8 +# exp_downward +Test "exp_downward (1) == e": +ildouble: 1 +ldouble: 1 +Test "exp_downward (2) == e^2": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "exp_downward (3) == e^3": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# exp_towardzero +Test "exp_towardzero (1) == e": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (2) == e^2": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "exp_towardzero (3) == e^3": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# exp_upward +Test "exp_upward (1) == e": +float: 1 +ifloat: 1 + # expm1 Test "expm1 (0.75) == 1.11700001661267466854536981983709561": double: 1 @@ -511,6 +701,9 @@ double: 1 float: 1 idouble: 1 ifloat: 1 +Test "expm1 (11356.25) == 9.05128237311923300051376115753226014206e+4931": +ildouble: 1 +ldouble: 1 # gamma Test "gamma (-0.5) == log(2*sqrt(pi))": @@ -783,6 +976,137 @@ Test "log1p (-0.25) == -0.287682072451780927439219005993827432": float: 1 ifloat: 1 +# pow_downward +Test "pow_downward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +ildouble: 1 +ldouble: 1 +Test "pow_downward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# pow_towardzero +Test "pow_towardzero (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +ildouble: 1 +ldouble: 1 +Test "pow_towardzero (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# pow_upward +Test "pow_upward (1.0625, 1.125) == 1.070582293028761362162622578677070098674": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "pow_upward (1.5, 1.03125) == 1.519127098714743184071644334163037684948": +ildouble: 1 +ldouble: 1 + +# sin_downward +Test "sin_downward (1) == 0.8414709848078965066525023216302989996226": +ildouble: 1 +ldouble: 1 +Test "sin_downward (10) == -0.5440211108893698134047476618513772816836": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sin_downward (3) == 0.1411200080598672221007448028081102798469": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sin_downward (4) == -0.7568024953079282513726390945118290941359": +ildouble: 1 +ldouble: 1 +Test "sin_downward (5) == -0.9589242746631384688931544061559939733525": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sin_downward (6) == -0.2794154981989258728115554466118947596280": +float: 1 +ifloat: 1 +Test "sin_downward (7) == 0.6569865987187890903969990915936351779369": +ildouble: 1 +ldouble: 1 +Test "sin_downward (8) == 0.9893582466233817778081235982452886721164": +ildouble: 1 +ldouble: 1 +Test "sin_downward (9) == 0.4121184852417565697562725663524351793439": +ildouble: 1 +ldouble: 1 + +# sin_tonearest +Test "sin_tonearest (1) == 0.8414709848078965066525023216302989996226": +float: 1 +ifloat: 1 +Test "sin_tonearest (10) == -0.5440211108893698134047476618513772816836": +ildouble: 1 +ldouble: 1 +Test "sin_tonearest (4) == -0.7568024953079282513726390945118290941359": +ildouble: 1 +ldouble: 1 +Test "sin_tonearest (9) == 0.4121184852417565697562725663524351793439": +ildouble: 1 +ldouble: 1 + +# sin_towardzero +Test "sin_towardzero (1) == 0.8414709848078965066525023216302989996226": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (10) == -0.5440211108893698134047476618513772816836": +float: 1 +ifloat: 1 +Test "sin_towardzero (3) == 0.1411200080598672221007448028081102798469": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (4) == -0.7568024953079282513726390945118290941359": +float: 1 +ifloat: 1 +Test "sin_towardzero (5) == -0.9589242746631384688931544061559939733525": +float: 1 +ifloat: 1 +Test "sin_towardzero (6) == -0.2794154981989258728115554466118947596280": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (7) == 0.6569865987187890903969990915936351779369": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (8) == 0.9893582466233817778081235982452886721164": +ildouble: 1 +ldouble: 1 +Test "sin_towardzero (9) == 0.4121184852417565697562725663524351793439": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# sin_upward +Test "sin_upward (1) == 0.8414709848078965066525023216302989996226": +float: 1 +ifloat: 1 +Test "sin_upward (2) == 0.9092974268256816953960198659117448427023": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "sin_upward (4) == -0.7568024953079282513726390945118290941359": +float: 1 +ifloat: 1 +Test "sin_upward (6) == -0.2794154981989258728115554466118947596280": +ildouble: 1 +ldouble: 1 +Test "sin_upward (9) == 0.4121184852417565697562725663524351793439": +float: 1 +ifloat: 1 + # sincos Test "sincos (0.80190127184058835, &sin_res, &cos_res) puts 0.69534156199418473 in cos_res": double: 1 @@ -815,11 +1139,169 @@ Test "sinh (0x8p-32) == 1.86264514923095703232705808926175479e-9": ildouble: 1 ldouble: 1 +# sinh_downward +Test "sinh_downward (22) == 1792456423.065795780701106568345764104225": +float: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 +Test "sinh_downward (23) == 4872401723.124451299966006944252978187305": +float: 1 +ifloat: 1 +Test "sinh_downward (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 +ildouble: 5 +ldouble: 5 + +# sinh_tonearest +Test "sinh_tonearest (22) == 1792456423.065795780701106568345764104225": +ildouble: 3 +ldouble: 3 +Test "sinh_tonearest (23) == 4872401723.124451299966006944252978187305": +ildouble: 1 +ldouble: 1 +Test "sinh_tonearest (24) == 13244561064.92173614705070540368454568168": +ildouble: 6 +ldouble: 6 + +# sinh_towardzero +Test "sinh_towardzero (22) == 1792456423.065795780701106568345764104225": +float: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 +Test "sinh_towardzero (23) == 4872401723.124451299966006944252978187305": +float: 1 +ifloat: 1 +Test "sinh_towardzero (24) == 13244561064.92173614705070540368454568168": +float: 1 +ifloat: 1 +ildouble: 5 +ldouble: 5 + +# sinh_upward +Test "sinh_upward (22) == 1792456423.065795780701106568345764104225": +ildouble: 16 +ldouble: 16 +Test "sinh_upward (23) == 4872401723.124451299966006944252978187305": +ildouble: 27 +ldouble: 27 +Test "sinh_upward (24) == 13244561064.92173614705070540368454568168": +ildouble: 7 +ldouble: 7 + # tan Test "tan (pi/4) == 1": double: 1 idouble: 1 +# tan_downward +Test "tan_downward (1) == 1.5574077246549022305069748074583601730873": +float: 1 +ifloat: 1 +Test "tan_downward (10) == 0.6483608274590866712591249330098086768169": +float: 1 +ifloat: 1 +Test "tan_downward (2) == -2.1850398632615189916433061023136825434320": +float: 1 +ifloat: 1 +Test "tan_downward (4) == 1.1578212823495775831373424182673239231198": +ildouble: 1 +ldouble: 1 +Test "tan_downward (5) == -3.3805150062465856369827058794473439087096": +ildouble: 1 +ldouble: 1 +Test "tan_downward (6) == -0.2910061913847491570536995888681755428312": +float: 1 +ifloat: 1 +Test "tan_downward (8) == -6.7997114552203786999252627596086333648814": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_downward (9) == -0.4523156594418098405903708757987855343087": +float: 1 +ifloat: 1 + +# tan_tonearest +Test "tan_tonearest (6) == -0.2910061913847491570536995888681755428312": +ildouble: 1 +ldouble: 1 +Test "tan_tonearest (8) == -6.7997114552203786999252627596086333648814": +ildouble: 1 +ldouble: 1 +Test "tan_tonearest (9) == -0.4523156594418098405903708757987855343087": +ildouble: 1 +ldouble: 1 + +# tan_towardzero +Test "tan_towardzero (10) == 0.6483608274590866712591249330098086768169": +float: 1 +ifloat: 1 +Test "tan_towardzero (2) == -2.1850398632615189916433061023136825434320": +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (3) == -0.1425465430742778052956354105339134932261": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (4) == 1.1578212823495775831373424182673239231198": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (5) == -3.3805150062465856369827058794473439087096": +float: 1 +ifloat: 1 +Test "tan_towardzero (6) == -0.2910061913847491570536995888681755428312": +ildouble: 1 +ldouble: 1 +Test "tan_towardzero (8) == -6.7997114552203786999252627596086333648814": +ildouble: 2 +ldouble: 2 +Test "tan_towardzero (9) == -0.4523156594418098405903708757987855343087": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# tan_upward +Test "tan_upward (1) == 1.5574077246549022305069748074583601730873": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_upward (10) == 0.6483608274590866712591249330098086768169": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_upward (2) == -2.1850398632615189916433061023136825434320": +ildouble: 1 +ldouble: 1 +Test "tan_upward (3) == -0.1425465430742778052956354105339134932261": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tan_upward (5) == -3.3805150062465856369827058794473439087096": +float: 1 +ifloat: 1 +Test "tan_upward (6) == -0.2910061913847491570536995888681755428312": +ildouble: 1 +ldouble: 1 +Test "tan_upward (7) == 0.8714479827243187364564508896003135663222": +ildouble: 1 +ldouble: 1 +Test "tan_upward (8) == -6.7997114552203786999252627596086333648814": +ildouble: 2 +ldouble: 2 +Test "tan_upward (9) == -0.4523156594418098405903708757987855343087": +ildouble: 1 +ldouble: 1 + # tgamma Test "tgamma (-0.5) == -2 sqrt (pi)": double: 1 @@ -1166,6 +1648,50 @@ ifloat: 1 ildouble: 1 ldouble: 1 +Function: "cos_downward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cos_tonearest": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cos_towardzero": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cos_upward": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "cosh_downward": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "cosh_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "cosh_towardzero": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "cosh_upward": +ildouble: 1 +ldouble: 1 + Function: Real part of "cpow": double: 2 float: 5 @@ -1215,8 +1741,8 @@ ifloat: 1 Function: Real part of "ctan": double: 1 idouble: 1 -ildouble: 439 -ldouble: 439 +ildouble: 1 +ldouble: 1 Function: Imaginary part of "ctan": double: 1 @@ -1231,16 +1757,16 @@ double: 1 float: 2 idouble: 1 ifloat: 2 -ildouble: 5 -ldouble: 5 +ildouble: 3 +ldouble: 3 Function: Imaginary part of "ctanh": double: 1 float: 1 idouble: 1 ifloat: 1 -ildouble: 25 -ldouble: 25 +ildouble: 1 +ldouble: 1 Function: "erf": double: 1 @@ -1248,7 +1774,9 @@ idouble: 1 Function: "erfc": double: 1 +float: 1 idouble: 1 +ifloat: 1 ildouble: 1 ldouble: 1 @@ -1260,11 +1788,29 @@ ifloat: 2 ildouble: 8 ldouble: 8 +Function: "exp_downward": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "exp_towardzero": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "exp_upward": +float: 1 +ifloat: 1 + Function: "expm1": double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: "gamma": ildouble: 1 @@ -1318,6 +1864,48 @@ Function: "log1p": float: 1 ifloat: 1 +Function: "pow_downward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_towardzero": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_upward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sin_downward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sin_tonearest": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sin_towardzero": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sin_upward": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + Function: "sincos": double: 1 float: 1 @@ -1330,10 +1918,52 @@ Function: "sinh": ildouble: 1 ldouble: 1 +Function: "sinh_downward": +float: 1 +ifloat: 1 +ildouble: 5 +ldouble: 5 + +Function: "sinh_tonearest": +ildouble: 6 +ldouble: 6 + +Function: "sinh_towardzero": +float: 1 +ifloat: 1 +ildouble: 5 +ldouble: 5 + +Function: "sinh_upward": +ildouble: 27 +ldouble: 27 + Function: "tan": double: 1 idouble: 1 +Function: "tan_downward": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "tan_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "tan_towardzero": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "tan_upward": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + Function: "tgamma": double: 1 float: 1 |