Commit Graph

26233 Commits

Author SHA1 Message Date
Alan Modra 4cf69995e2 Fix for [BZ #15680] IBM long double inaccuracy
http://sourceware.org/ml/libc-alpha/2013-06/msg00919.html

I discovered a number of places where denormals and other corner cases
were being handled wrongly.

- printf_fphex.c: Testing for the low double exponent being zero is
unnecessary.  If the difference in exponents is less than 53 then the
high double exponent must be nearing the low end of its range, and the
low double exponent hit rock bottom.

- ldbl2mpn.c: A denormal (ie. exponent of zero) value is treated as
if the exponent was one, so shift mantissa left by one.  Code handling
normalisation of the low double mantissa lacked a test for shift count
greater than bits in type being shifted, and lacked anything to handle
the case where the difference in exponents is less than 53 as in
printf_fphex.c.

- math_ldbl.h (ldbl_extract_mantissa): Same as above, but worse, with
code testing for exponent > 1 for some reason, probably a typo for >= 1.

- math_ldbl.h (ldbl_insert_mantissa): Round the high double as per
mpn2ldbl.c (hi is odd or explicit mantissas non-zero) so that the
number we return won't change when applying ldbl_canonicalize().
Add missing overflow checks and normalisation of high mantissa.
Correct misleading comment: "The hidden bit of the lo mantissa is
zero" is not always true as can be seen from the code rounding the hi
mantissa.  Also by inspection, lzcount can never be less than zero so
remove that test.  Lastly, masking bitfields to their widths can be
left to the compiler.

- mpn2ldbl.c: The overflow checks here on rounding of high double were
just plain wrong.  Incrementing the exponent must be accompanied by a
shift right of the mantissa to keep the value unchanged.  Above notes
for ldbl_insert_mantissa are also relevant.

	[BZ #15680]
	* sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c: Comment fix.
	* sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
	(PRINT_FPHEX_LONG_DOUBLE): Tidy code by moving -53 into ediff
	calculation.  Remove unnecessary test for denormal exponent.
	* sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c (__mpn_extract_long_double):
	Correct handling of denormals.  Avoid undefined shift behaviour.
	Correct normalisation of low mantissa when low double is denormal.
	* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
	(ldbl_extract_mantissa): Likewise.  Comment.  Use uint64_t* for hi64.
	(ldbl_insert_mantissa): Make both hi64 and lo64 parms uint64_t.
	Correct normalisation of low mantissa.  Test for overflow of high
	mantissa and normalise.
	(ldbl_nearbyint): Use more readable constant for two52.
	* sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
	(__mpn_construct_long_double): Fix test for overflow of high
	mantissa and correct normalisation.  Avoid undefined shift.
2013-10-04 10:30:56 +09:30
Alan Modra 9605ca6c08 IBM long double mechanical changes to support little-endian
http://sourceware.org/ml/libc-alpha/2013-07/msg00001.html

This patch starts the process of supporting powerpc64 little-endian
long double in glibc.  IBM long double is an array of two ieee
doubles, so making union ibm_extended_long_double reflect this fact is
the correct way to access fields of the doubles.

	* sysdeps/ieee754/ldbl-128ibm/ieee754.h
	(union ibm_extended_long_double): Define as an array of ieee754_double.
	(IBM_EXTENDED_LONG_DOUBLE_BIAS): Delete.
	* sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: Update all references
	to ibm_extended_long_double and IBM_EXTENDED_LONG_DOUBLE_BIAS.
	* sysdeps/ieee754/ldbl-128ibm/e_exp10l.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/strtold_l.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c: Likewise.
2013-10-04 10:28:42 +09:30
Joseph Myers d3d237560b Hardcode locale archive page size as 4096. 2013-10-03 22:00:05 +00:00
Joseph Myers 975569d0d9 Remove locale file dependence on int32_t alignment. 2013-10-03 21:51:32 +00:00
Steve Ellcey bc543b02c7 2013-09-26 Steve Ellcey <sellcey@mips.com>
[BZ #15632]
	* sysdeps/mips/mips32/fpu/e_sqrt.c: New.
	* sysdeps/mips/mips32/fpu/e_sqrtf.c: New.
	* sysdeps/mips/mips64/n32/fpu/e_sqrt.c: New.
	* sysdeps/mips/mips64/n32/fpu/e_sqrtf.c: New.
	* sysdeps/mips/mips64/n64/fpu/e_sqrt.c: New.
	* sysdeps/mips/mips64/n64/fpu/e_sqrtf.c: New.
2013-10-03 12:56:34 -07:00
Steve Ellcey c4264185ab 2013-09-26 Steve Ellcey <sellcey@mips.com>
[BZ #15632]
	* sysdeps/mips/mips32/fpu/e_sqrt.c: New.
	* sysdeps/mips/mips32/fpu/e_sqrtf.c: New.
	* sysdeps/mips/mips64/n32/fpu/e_sqrt.c: New.
	* sysdeps/mips/mips64/n32/fpu/e_sqrtf.c: New.
	* sysdeps/mips/mips64/n64/fpu/e_sqrt.c: New.
	* sysdeps/mips/mips64/n64/fpu/e_sqrtf.c: New.
2013-10-03 12:55:36 -07:00
Ondřej Bílka b1fe1f2b83 BZ #431 Fix manual of strncat/wcsncat. 2013-10-03 19:54:23 +02:00
Brooks Moses 5f855e3598 Fix erroneous (and circular) implied pattern rule for linkobj/libc.so.
[BZ #15915] As described in the bug, the pattern rule for lib%.so files
in Makerules includes linkobj/libc.so as a dependency.  However, the
explicit rule for linkobj/libc.so is in the top-level Makefile.

Thus, the subdirectory makefiles that include Makerules end up with an
erroneous makefile pattern rule for linkobj/libc.so that includes
itself as a dependency.  The result is make warnings whenever rules
for other .so files are resolved -- and, on occasion, actual makefile
failures when a race condition causes the implicit rule to actually be
used.

This patch moves the explicit rules for linkobj/libc.so into Makerules
to clear up this problem.  It also elaborates a couple of comments
that I'd initially found confusing.
2013-10-03 10:38:14 -07:00
Will Newton b7f2d27dbd ARM: Add pointer encryption support.
Add support for pointer encryption in glibc internal structures in C
and assembler code. Pointer encryption is a glibc security feature
described here:

https://sourceware.org/glibc/wiki/PointerEncryption

The ARM implementation uses global variables instead of thread pointer
relative accesses to get the value of the pointer encryption guard
because accessing the thread pointer can be very expensive on older
ARM cores.

ports/ChangeLog.arm:

2013-10-03  Will Newton  <will.newton@linaro.org>

	* sysdeps/arm/__longjmp.S (__longjmp): Demangle fp, sp
	and lr when restoring register values.
	* sysdeps/arm/include/bits/setjmp.h (JMP_BUF_REGLIST): Remove
	sp and lr from list and replace fp with a4.
	* sysdeps/arm/jmpbuf-unwind.h (_jmpbuf_sp): New function.
	(_JMPBUF_UNWINDS_ADJ): Call _jmpbuf_sp.
	* sysdeps/arm/setjmp.S (__sigsetjmp): Mangle fp, sp and lr
	before storing register values.
	* sysdeps/arm/sysdep.h (LDST_GLOBAL): New macro.
	* sysdeps/unix/sysv/linux/arm/sysdep.h (PTR_MANGLE): New macro.
	(PTR_DEMANGLE): Likewise. (PTR_MANGLE2): Likewise.
	(PTR_DEMANGLE2): Likewise.
2013-10-03 11:35:50 +01:00
Eric Blake 29c793b3c2 maint: correct changelog
* ChangeLog: List my previous commit in correct location.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-10-02 05:55:09 -06:00
Will Newton 3cef60098c malloc: Add pvalloc test.
ChangeLog:

2013-10-02  Will Newton  <will.newton@linaro.org>

	* malloc/Makefile: Add tst-pvalloc.
	* malloc/tst-pvalloc.c: New file.
2013-10-02 10:45:40 +01:00
Will Newton 7815420bc9 malloc/tst-valloc.c: Improve test coverage and use test-skeleton.c.
ChangeLog:

2013-10-02  Will Newton  <will.newton@linaro.org>

	* malloc/tst-valloc.c: Rewrite to use test-skeleton.c and
	improve test coverage.
2013-10-02 10:43:40 +01:00
Will Newton 4868b204aa malloc: Add posix_memalign test.
ChangeLog:

2013-10-02  Will Newton  <will.newton@linaro.org>

	* malloc/Makefile: Add tst-posix_memalign.
	* malloc/tst-posix_memalign.c: New file.
2013-10-02 10:42:36 +01:00
Eric Blake e833b53fe6 glob: silence -Wattribute warnings
Colin Watson reported that some versions of gcc warn about
attribute leaf used on a static function, since it has no
effect on anything but external functions.

* posix/glob.c (next_brace_sub, prefix_array, collated_compare):
Use __THROWNL rather than __THROW on static functions.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-10-01 13:50:29 -06:00
Chris Metcalf c17fdf95b6 Mention bug 15760 in NEWS (duplicate of 15988, just added to NEWS) 2013-10-01 15:35:12 -04:00
Richard Henderson b8123ef5b1 alpha: Improve conditions under which PTR_MANGLE is defined
After 0b1f8e3564, we now have
a __pointer_chk_guard_local for the static libc.
2013-10-01 12:27:02 -07:00
Siddhesh Poyarekar ad4e70da03 Fix PI mutex check in pthread_cond_broadcast and pthread_cond_signal
Fixes BZ #15988.

The check had a typo - it checked for PTHREAD_MUTEX_ROBUST_NP instead
of PTHREAD_MUTEX_ROBUST_NORMAL_NP.  It has now been replaced by the
already existing convenience macro USE_REQUEUE_PI.
2013-10-01 20:35:28 +05:30
Petr Machata fd96752258 Add AArch64 relocation definitions. 2013-09-30 12:38:10 +01:00
Andrew Pinski 995a05b173 [AArch64] Fix BE access to errno. 2013-09-30 10:58:26 +01:00
Andreas Schwab b2179107f3 Properly cache the result from looking up the nss database config 2013-09-30 10:29:13 +02:00
Mike Frysinger 47f28d0a66 tst-fanotify: fix style
Reported-by: Andreas Jaeger <aj@suse.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-09-28 23:53:50 -04:00
Patrick 'P. J.' McDermott 0a834ddecb don't use Bash-specific ${parameter/pattern/string} expansion
sysdeps/unix/make-syscalls.sh and sysdeps/unix/Makefile use GNU Bash's
${parameter/pattern/string} parameter expansion.  Non-Bash shells (e.g.
dash or BusyBox ash when built with CONFIG_ASH_BASH_COMPAT disabled)
don't support this expansion syntax.  So glibc will fail to build when
$(SHELL) expands to a path that isn't provided by Bash.

An example build failure:

    for dir in [...]; do \
      test -f $dir/syscalls.list && \
      { sysdirs='[...]' \
        asm_CPP='gcc -c    -I[...]   -D_LIBC_REENTRANT -include include/libc-symbols.h       -DASSEMBLER  -g -Wa,--noexecstack   -E -x assembler-with-cpp' \
        /bin/sh sysdeps/unix/make-syscalls.sh $dir || exit 1; }; \
      test $dir = sysdeps/unix && break; \
    done > [build-dir]/sysd-syscallsT
    sysdeps/unix/make-syscalls.sh: line 273: syntax error: bad substitution

This patch simply replaces the three instances of the Bash-only syntax
in these files with an echo and sed command substitution.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-09-28 23:03:09 -04:00
Chris Leonard e74a6fd906 Fix ayc_PE.UTF-8 and lzh_TW.UTF-8 build issues 2013-09-28 20:32:16 -04:00
Allan McRae 3d2abe798d Revert "Remove references to non-existent content items in install.texi"
This reverts commit 583c76a7ce which
breaks building info pages during "make install".

Conflicts:
	ChangeLog
2013-09-28 13:10:59 +10:00
Siddhesh Poyarekar c04d498c12 Move ChangeLog entry 2013-09-27 23:02:57 +05:30
Allan McRae 583c76a7ce Remove references to non-existent content items in install.texi
These were left in when the installation section was split out
into its own file.
2013-09-27 14:47:56 +10:00
Siddhesh Poyarekar c8886d0abf Use the mutex member of the argumen in __libc_lock_*_recursive 2013-09-27 07:59:26 +05:30
Kaz Kojima f4518a17e3 Add ChangeLog entry for new sysdeps/sh/stackguard-macros.h. 2013-09-27 11:05:41 +09:00
Kaz Kojima 80a83dd70e Add SH implementation of stackguard-macros.h. 2013-09-27 10:59:02 +09:00
Ondřej Bílka dc1a95c730 Faster strrchr. 2013-09-26 19:23:01 +02:00
Adhemerval Zanella 5ebbff8fd1 PowerPC: Fix POINTER_CHK_GUARD thread register for PPC64 2013-09-25 13:43:04 -05:00
Michael Bauer c5f840fd4f Version 1.2 of gd_GB locale 2013-09-25 11:57:34 -04:00
Joseph Myers 4fd2cf9f5e conformtest: Clean up expectations for POSIX for sched.h. 2013-09-25 00:51:42 +00:00
Olivier Langlois 12c22bc4e3 Fix tst-long-dbl-fphex swprintf length calculation. 2013-09-24 16:12:12 -07:00
Joseph Myers a03d8ea77f conformtest: Clean up expectations for POSIX for pthread.h. 2013-09-24 22:09:04 +00:00
Joseph Myers 6055173a0f Add localedef --big-endian and --little-endian options. 2013-09-24 22:07:47 +00:00
Roland McGrath 39bf0bb44c Update to canonical freemanuals.texi file. 2013-09-24 14:06:56 -07:00
Marcus Shawcroft 8f5a90c270 [AArch64] Support __mcount profiling. 2013-09-24 13:03:02 +01:00
Marcus Shawcroft cfa4df9500 [AArch64] Adding sigcontextinfo.h 2013-09-24 12:59:06 +01:00
Will Newton 82c93a0ffe ports/sysdeps/arm/nptl/tls.h: Remove TLS_INIT_TP_EXPENSIVE.
This define was removed from the rest of the tree eight years ago.

ports/ChangeLog.arm:

2013-09-24  Will Newton  <will.newton@linaro.org>

	* ports/sysdeps/arm/nptl/tls.h (TLS_INIT_TP_EXPENSIVE): Remove
	macro.
2013-09-24 09:29:04 +01:00
Will Newton f02eed105c sysdeps/mach/hurd/i386/tls.h: Remove TLS_INIT_TP_EXPENSIVE.
This define was removed from the rest of the tree eight years ago.

ChangeLog:

2013-09-24  Will Newton  <will.newton@linaro.org>

	* sysdeps/mach/hurd/i386/tls.h (TLS_INIT_TP_EXPENSIVE): Remove
	macro.
2013-09-24 09:25:53 +01:00
Wei-Lun Chao 77eb79caa4 New locale for cmn_TW 2013-09-23 22:36:14 -04:00
Wei-Lun Chao 90e44a6fdd New locale for hak_TW 2013-09-23 20:24:27 -04:00
Joseph Myers a3a6c3129f Make locale archive hash function architecture-independent. 2013-09-23 23:03:34 +00:00
Wei-Lun Chao 5057e7ce82 New locale for lzh_TW 2013-09-23 18:51:59 -04:00
Wei-Lun Chao d61ed70042 New locale for nan_TW 2013-09-23 18:23:21 -04:00
Maciej W. Rozycki 107375acff manual: Fix a typo in `POSIX Threads' section 2013-09-23 21:15:45 +01:00
Steve Ellcey c79fb0ed65 2013-09-23 Steve Ellcey <sellcey@mips.com>
* sysdeps/mips/math_private.h (libc_feholdexcept_mips): New function.
	(libc_feholdexcept): New macro.
	(libc_feholdexceptf): New macro.
	(libc_feholdexceptl): New macro.
	(libc_fesetround_mips): New function.
	(libc_fesetround): New macro.
	(libc_fesetroundf): New macro.
	(libc_fesetroundl): New macro.
	(libc_feholdexcept_setround_mips): New function.
	(libc_feholdexcept_setround): New macro.
	(libc_feholdexcept_setroundf): New macro.
	(libc_feholdexcept_setroundl): New macro.
	(libc_fesetenv_mips): New function.
	(libc_fesetenv): New macro.
	(libc_fesetenvf): New macro.
	(libc_fesetenvl): New macro.
	(libc_feupdateenv_mips): New function.
	(libc_feupdateenv): New macro.
	(libc_feupdateenvf): New macro.
	(libc_feupdateenvl): New macro.
2013-09-23 09:58:30 -07:00
Maciej W. Rozycki d93fa6592b MIPS: bits/atomic.h: Fix comment typo 2013-09-23 17:45:34 +01:00
Steve Ellcey 6b9a5fe450 2013-09-23 Steve Ellcey <sellcey@mips.com>
* sysdeps/mips/fpu/fegetround.c (fegetround): Use _FPU_RC_MASK.
	* sysdeps/mips/fpu/fesetround.c (fesetround): Use _FPU_RC_MASK.
2013-09-23 09:39:32 -07:00