platform/upstream/glibc.git
8 years agoImprove test coverage of real libm functions [a-e]*.
Joseph Myers [Wed, 30 Sep 2015 18:06:02 +0000 (18:06 +0000)]
Improve test coverage of real libm functions [a-e]*.

This patch improves test coverage of the real libm functions [a-e]*,
ensuring that special cases and ranges of input values of potential
significance (such as close to overflow and underflow thresholds) are
more systematically covered.

This is a followup to
<https://sourceware.org/ml/libc-alpha/2013-12/msg00757.html> which
covered [a-c]* (however, I found more weaknesses in the coverage of
those functions when preparing this patch, hence the additional tests
being added for them here).

Addition of a test for acosh (-qNaN) is temporarily deferred, to be
included as part of a fix for bug 19032 which was discovered in the
course of adding these tests (and which illustrates the use of testing
-qNaN as well as +qNaN as input even to functions for which the sign
of a NaN isn't meant to be significant).

Tested for x86_64 and x86.

* math/auto-libm-test-in: Add more tests of acos, acosh, asin,
atan, atan2, atanh, cbrt, cos, cosh, erf, erfc, exp, exp10, exp2
and expm1.
* math/auto-libm-test-out: Regenerated.
* math/libm-test.inc (acos_test_data): Add more tests.
(asin_test_data): Likewise.
(asinh_test_data): Likewise.
(atan_test_data): Likewise.
(atanh_test_data): Likewise.
(atan2_test_data): Likewise.
(cbrt_test_data): Likewise.
(ceil_test_data): Likewise.
(copysign_test_data): Likewise.
(cos_test_data): Likewise.
(cosh_test_data): Likewise.
(erf_test_data): Likewise.
(erfc_test_data): Likewise.
(exp_test_data): Likewise.
(exp10_test_data): Likewise.
(exp2_test_data): Likewise.
(expm1_test_data): Likewise.
* sysdeps/x86_64/fpu/libm-test-ulps: Update.

8 years agoMove sysdeps/unix/sysv/linux/i386/i486/*.? to i386
H.J. Lu [Wed, 30 Sep 2015 17:12:26 +0000 (10:12 -0700)]
Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386

Since glibc doesn't support i386 any more, we can move
sysdeps/unix/sysv/linux/i386/i486/*.? to i386.

[BZ #19006]
* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Moved
to ...
* sysdeps/unix/sysv/linux/i386/libc-lowlevellock.S: Here.
* sysdeps/unix/sysv/linux/i386/i486/lll_timedlock_wait.c: Moved
to ...
* sysdeps/unix/sysv/linux/i386/lll_timedlock_wait.c: Here.
* sysdeps/unix/sysv/linux/i386/i486/lll_timedwait_tid.c: Moved
to ...
* sysdeps/unix/sysv/linux/i386/lll_timedwait_tid.c: Here.
* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Moved to ...
* sysdeps/unix/sysv/linux/i386/lowlevellock.S: Here.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S: Moved
to ...
* sysdeps/unix/sysv/linux/i386/lowlevelrobustlock.S: Here.
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S:
Moved to ...
* sysdeps/unix/sysv/linux/i386/pthread_barrier_wait.S: Here.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S:
Moved to ...
* sysdeps/unix/sysv/linux/i386/pthread_cond_broadcast.S: Here.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Moved
to ...
* sysdeps/unix/sysv/linux/i386/pthread_cond_signal.S: Here.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S:
Moved to ...
* sysdeps/unix/sysv/linux/i386/pthread_cond_timedwait.S: Here.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Moved
to ...
* sysdeps/unix/sysv/linux/i386/pthread_cond_wait.S: Here.
* sysdeps/unix/sysv/linux/i386/i586/libc-lowlevellock.S:
Removed.
* sysdeps/unix/sysv/linux/i386/i586/lll_timedlock_wait.c:
Likewise.
* sysdeps/unix/sysv/linux/i386/i586/lll_timedwait_tid.c:
Likewise.
* sysdeps/unix/sysv/linux/i386/i586/lowlevellock.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i586/lowlevelrobustlock.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i586/pthread_barrier_wait.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i586/pthread_cond_broadcast.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i586/pthread_cond_signal.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i586/pthread_cond_timedwait.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i586/pthread_cond_wait.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i686/libc-lowlevellock.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i686/lll_timedlock_wait.c:
Likewise.
* sysdeps/unix/sysv/linux/i386/i686/lll_timedwait_tid.c:
Likewise.
* sysdeps/unix/sysv/linux/i386/i686/lowlevellock.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i686/lowlevelrobustlock.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i686/pthread_barrier_wait.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i686/pthread_cond_broadcast.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i686/pthread_cond_signal.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i686/pthread_cond_wait.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S:
Replace ../i486/pthread_cond_timedwait.S with
../pthread_cond_timedwait.S.

8 years agoRefine errno / "inexact" expectations in libm-test.inc.
Joseph Myers [Wed, 30 Sep 2015 15:30:41 +0000 (15:30 +0000)]
Refine errno / "inexact" expectations in libm-test.inc.

This patch makes math/libm-test.inc more consistent regarding
including expectations for errno setting and "inexact" exceptions
where expected test results are given manually.  Mostly this is a
matter of including ERRNO_UNCHANGED in expectations, but there are
also some cases where expectations regarding "inexact" were missing
for exactly determined functions (especially in cases where some other
exception was expected and it should also have been expected that
"inexact" was not set with that other exception), and one case for pow
where the NO_INEXACT_EXCEPTION expectation should not have been there
(the rule about not having "inexact" exceptions for NaN arguments is
only when those NaN arguments produce NaN results).

I deferred making such changes for complex functions and scalb.

Tested for x86_64 and x86.

* math/libm-test.inc (acos_test_data): Refine expectations for
errno and "inexact" exceptions.
(acosh_test_data): Likewise.
(asin_test_data): Likewise.
(asinh_test_data): Likewise.
(atan_test_data): Likewise.
(atanh_test_data): Likewise.
(atan2_test_data): Likewise.
(cbrt_test_data): Likewise.
(ceil_test_data): Likewise.
(copysign_test_data): Likewise.
(cosh_test_data): Likewise.
(erf_test_data): Likewise.
(erfc_test_data): Likewise.
(exp_test_data): Likewise.
(exp10_test_data): Likewise.
(exp2_test_data): Likewise.
(expm1_test_data): Likewise.
(fabs_test_data): Likewise.
(floor_test_data): Likewise.
(fma_test_data): Likewise.
(fmax_test_data): Likewise.
(fmin_test_data): Likewise.
(fmod_test_data): Likewise.
(fpclassify_test_data): Likewise.
(frexp_test_data): Likewise.
(hypot_test_data): Likewise.
(ilogb_test_data): Likewise.
(isgreater_test_data): Likewise.
(isgreaterequal_test_data): Likewise.
(isinf_test_data): Likewise.
(isless_test_data): Likewise.
(islessequal_test_data): Likewise.
(islessgreater_test_data): Likewise.
(isnan_test_data): Likewise.
(isnormal_test_data): Likewise.
(issignaling_test_data): Likewise.
(isunordered_test_data): Likewise.
(j0_test_data): Likewise.
(j1_test_data): Likewise.
(jn_test_data): Likewise.
(lgamma_test_data): Likewise.
(lrint_test_data): Likewise.
(llrint_test_data): Likewise.
(log_test_data): Likewise.
(log10_test_data): Likewise.
(log1p_test_data): Likewise.
(log2_test_data): Likewise.
(logb_test_data): Likewise.
(lround_test_data): Likewise.
(llround_test_data): Likewise.
(modf_test_data): Likewise.
(nearbyint_test_data): Likewise.
(nextafter_test_data): Likewise.
(nexttoward_test_data): Likewise.
(pow_test_data): Likewise.
(remainder_test_data): Likewise.
(remquo_test_data): Likewise.
(rint_test_data): Likewise.
(round_test_data): Likewise.
(signbit_test_data): Likewise.
(sinh_test_data): Likewise.
(sqrt_test_data): Likewise.
(tanh_test_data): Likewise.
(tgamma_test_data): Likewise.
(trunc_test_data): Likewise.
(y0_test_data): Likewise.
(y1_test_data): Likewise.
(yn_test_data): Likewise.
(significand_test_data): Likewise.

8 years agoFiles open O_WRONLY not supported in fallocate emulation.
Carlos O'Donell [Tue, 29 Sep 2015 15:32:36 +0000 (11:32 -0400)]
Files open O_WRONLY not supported in fallocate emulation.

In the posix_fallocate description in the manual we list various
drawbacks with the emulation, including the fact that a file opened
with O_APPEND fails with EBADF. Similarly a file opened with O_WRONLY
fails with EBADF. We must be able to emulate a compare-and-swap via
pread/compare/pwrite in order to make the emulation as safe as possible.
It is not acceptable to ignore the read failure because it could result
in significant data loss across all of the blocks. There is no other way
to make this work without a true atomic CAS and SIGBUS handler (which
is looking more attractive as a way to remove the race condition).

This patch adds O_WRONLY to the manual as another bullet to clarify the
limits of the emulation.

Manual looks good in PDF.

8 years agoFix clog, clog10 inaccuracy (bug 19016).
Joseph Myers [Mon, 28 Sep 2015 22:11:22 +0000 (22:11 +0000)]
Fix clog, clog10 inaccuracy (bug 19016).

For arguments with X^2 + Y^2 close to 1, clog and clog10 avoid large
errors from log(hypot) by computing X^2 + Y^2 - 1 in a way that avoids
cancellation error and then using log1p.

However, the thresholds for using that approach still result in log
being used on argument as large as sqrt(13/16) > 0.9, leading to
significant errors, in some cases above the 9ulp maximum allowed in
glibc libm.  This patch arranges for the approach using log1p to be
used in any cases where |X|, |Y| < 1 and X^2 + Y^2 >= 0.5 (with the
existing allowance for cases where one of X and Y is very small),
adjusting the __x2y2m1 functions to work with the wider range of
inputs.  This way, log only gets used on arguments below sqrt(1/2) (or
substantially above 1), where the error involved is much less.

Tested for x86_64, x86, mips64 and powerpc.  For the ulps regeneration
I removed the existing clog and clog10 ulps before regenerating to
allow any reduced ulps to appear.  Tests added include those found by
random test generation to produce large ulps either before or after
the patch, and some found by trying inputs close to the (0.75, 0.5)
threshold where the potential errors from using log are largest.

[BZ #19016]
* sysdeps/generic/math_private.h (__x2y2m1f): Update comment to
allow more cases with X^2 + Y^2 >= 0.5.
* sysdeps/ieee754/dbl-64/x2y2m1.c (__x2y2m1): Likewise.  Add -1 as
normal element in sum instead of special-casing based on values of
arguments.
* sysdeps/ieee754/dbl-64/x2y2m1f.c (__x2y2m1f): Update comment.
* sysdeps/ieee754/ldbl-128/x2y2m1l.c (__x2y2m1l): Likewise.  Add
-1 as normal element in sum instead of special-casing based on
values of arguments.
* sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c (__x2y2m1l): Likewise.
* sysdeps/ieee754/ldbl-96/x2y2m1.c [FLT_EVAL_METHOD != 0]
(__x2y2m1): Update comment.
* sysdeps/ieee754/ldbl-96/x2y2m1l.c (__x2y2m1l): Likewise.  Add -1
as normal element in sum instead of special-casing based on values
of arguments.
* math/s_clog.c (__clog): Handle more cases using log1p without
hypot.
* math/s_clog10.c (__clog10): Likewise.
* math/s_clog10f.c (__clog10f): Likewise.
* math/s_clog10l.c (__clog10l): Likewise.
* math/s_clogf.c (__clogf): Likewise.
* math/s_clogl.c (__clogl): Likewise.
* math/auto-libm-test-in: Add more tests of clog and clog10.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

8 years agoLet 'make check subdirs=string' succeed even when it's invoked
Martin Sebor [Mon, 28 Sep 2015 20:55:57 +0000 (16:55 -0400)]
Let 'make check subdirs=string' succeed even when it's invoked
immediately after glibc has been built and before 'make check'
(or after 'make clean').

8 years agoFix BZ #18985 -- out of range data to strftime() causes a segfault
Paul Pluzhnikov [Sat, 26 Sep 2015 20:27:48 +0000 (13:27 -0700)]
Fix BZ #18985 -- out of range data to strftime() causes a segfault

8 years agoFix powf inaccuracy (bug 18956).
Joseph Myers [Sat, 26 Sep 2015 00:27:06 +0000 (00:27 +0000)]
Fix powf inaccuracy (bug 18956).

The flt-32 version of powf can be inaccurate because of bugs in the
extra-precision calculation of (x-1)/(x+1) or (x-1.5)/(x+1.5) as part
of calculating log(x) with extra precision: a constant used (as part
of adding 1 or 1.5 through integer arithmetic) is incorrect, and then
the code fails to mask a computed high part before using it in
arithmetic that relies on s_h*t_h being exactly representable.  This
patch fixes these bugs.

Tested for x86_64 and x86.  x86_64 ulps for powf removed and
regenerated to reflect reduced ulps from the increased accuracy for
existing tests.

[BZ #18956]
* sysdeps/ieee754/flt-32/e_powf.c (__ieee754_powf): Add 0x00400000
not 0x0040000 for high bit of mantissa.  Mask with 0xfffff000 when
extracting high part.
* math/auto-libm-test-in: Add another test of pow.
* math/auto-libm-test-out: Regenerated.
* sysdeps/x86_64/fpu/libm-test-ulps: Update.

8 years agoFix pow missing underflows (bug 18825).
Joseph Myers [Fri, 25 Sep 2015 22:29:10 +0000 (22:29 +0000)]
Fix pow missing underflows (bug 18825).

Similar to various other bugs in this area, pow functions can fail to
raise the underflow exception when the result is tiny and inexact but
one or more low bits of the intermediate result that is scaled down
(or, in the i386 case, converted from a wider evaluation format) are
zero.  This patch forces the exception in a similar way to previous
fixes, thereby concluding the fixes for known bugs with missing
underflow exceptions currently filed in Bugzilla.

Tested for x86_64, x86, mips64 and powerpc.

[BZ #18825]
* sysdeps/i386/fpu/i386-math-asm.h (FLT_NARROW_EVAL_UFLOW_NONNAN):
New macro.
(DBL_NARROW_EVAL_UFLOW_NONNAN): Likewise.
(LDBL_CHECK_FORCE_UFLOW_NONNAN): Likewise.
* sysdeps/i386/fpu/e_pow.S: Use DEFINE_DBL_MIN.
(__ieee754_pow): Use DBL_NARROW_EVAL_UFLOW_NONNAN instead of
DBL_NARROW_EVAL, reloading the PIC register as needed.
* sysdeps/i386/fpu/e_powf.S: Use DEFINE_FLT_MIN.
(__ieee754_powf): Use FLT_NARROW_EVAL_UFLOW_NONNAN instead of
FLT_NARROW_EVAL.  Use separate return path for case when first
argument is NaN.
* sysdeps/i386/fpu/e_powl.S: Include <i386-math-asm.h>.  Use
DEFINE_LDBL_MIN.
(__ieee754_powl): Use LDBL_CHECK_FORCE_UFLOW_NONNAN, reloading the
PIC register.
* sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/flt-32/e_powf.c (__ieee754_powf): Force
underflow for subnormal result.
* sysdeps/ieee754/ldbl-128/e_powl.c (__ieee754_powl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_powl.c (__ieee754_powl): Use
math_check_force_underflow_nonneg.
* sysdeps/x86/fpu/powl_helper.c (__powl_helper): Use
math_check_force_underflow.
* sysdeps/x86_64/fpu/x86_64-math-asm.h
(LDBL_CHECK_FORCE_UFLOW_NONNAN): New macro.
* sysdeps/x86_64/fpu/e_powl.S: Include <x86_64-math-asm.h>.  Use
DEFINE_LDBL_MIN.
(__ieee754_powl): Use LDBL_CHECK_FORCE_UFLOW_NONNAN.
* math/auto-libm-test-in: Add more tests of pow.
* math/auto-libm-test-out: Regenerated.

8 years agoFix inconsistent passwd compensation in nss/bug17079.c
Florian Weimer [Fri, 25 Sep 2015 18:20:33 +0000 (20:20 +0200)]
Fix inconsistent passwd compensation in nss/bug17079.c

It used to be common practice to have a statically linked shell for an
alternative root account, as in:

root:x:0:0:root:/root:/bin/bash
toor:x:0:0:root recovery account:/root:/sbin/sash

This causes problems with passwd NSS tests because a UID-based lookup
will only retrieve one of those entries.  The original version of
nss/bug17079.c detected this, but failed to use this information later
on.

8 years agoUse soft-fp fma for no-FPU ColdFire (bug 13304).
Joseph Myers [Fri, 25 Sep 2015 17:30:56 +0000 (17:30 +0000)]
Use soft-fp fma for no-FPU ColdFire (bug 13304).

Systems without floating-point exceptions and rounding modes should
use the soft-fp versions of fmaf and fma, not the sysdeps/ieee754
versions that rely on setting rounding to zero and testing for the
"inexact" exception; this has been noted on
<https://sourceware.org/glibc/wiki/PortStatus> for some time.  This
patch makes no-FPU ColdFire use the soft-fp files; sfp-machine.h is
made to include the nios2 version of sfp-machine.h which seems
sufficiently generic for 32-bit systems.

[BZ #13304]
* sysdeps/m68k/coldfire/nofpu/s_fma.c: New file.
* sysdeps/m68k/coldfire/nofpu/s_fmaf.c: Likewise.
* sysdeps/m68k/coldfire/nofpu/sfp-machine.h: Likewise.

8 years agoUse soft-fp fma for MicroBlaze (bug 13304).
Joseph Myers [Fri, 25 Sep 2015 17:29:19 +0000 (17:29 +0000)]
Use soft-fp fma for MicroBlaze (bug 13304).

Systems without floating-point exceptions and rounding modes should
use the soft-fp versions of fmaf and fma, not the sysdeps/ieee754
versions that rely on setting rounding to zero and testing for the
"inexact" exception; this has been noted on
<https://sourceware.org/glibc/wiki/PortStatus> for some time.  This
patch makes MicroBlaze use the soft-fp files; sfp-machine.h is made to
include the nios2 version of sfp-machine.h which seems sufficiently
generic for 32-bit systems.

[BZ #13304]
* sysdeps/microblaze/s_fma.c: New file.
* sysdeps/microblaze/s_fmaf.c: Likewise.
* sysdeps/microblaze/sfp-machine.h: Likewise.

8 years ago[BZ #17250] Fix static dlopen default library search path
Maciej W. Rozycki [Fri, 25 Sep 2015 08:37:12 +0000 (09:37 +0100)]
[BZ #17250] Fix static dlopen default library search path

Fix a regression introduced with commit 0d23a5c1 [Static dlopen
correction fallout fixes] that caused the default library search path to
be ignored for modules loaded with dlopen from static executables.

[BZ #17250]
* elf/dl-support.c (_dl_main_map): Don't initialize l_flags_1
member.

8 years agoFix hypot missing underflows (bug 18803).
Joseph Myers [Thu, 24 Sep 2015 23:43:57 +0000 (23:43 +0000)]
Fix hypot missing underflows (bug 18803).

Similar to various other bugs in this area, hypot functions can fail
to raise the underflow exception when the result is tiny and inexact
but one or more low bits of the intermediate result that is scaled
down (or, in the i386 case, converted from a wider evaluation format)
are zero.  This patch forces the exception in a similar way to
previous fixes.

Note that this issue cannot arise for implementations of hypotf using
double (or wider) for intermediate evaluation (if hypotf should
underflow, that means the double square root is being computed of some
number of the form N*2^-298, for 0 < N < 2^46, which is exactly
represented as a double, and whatever the rounding mode such a square
root cannot have a mantissa with all zeroes after the initial 23
bits).  Thus no changes are made to hypotf implementations in this
patch, only to hypot and hypotl.

Tested for x86_64, x86, mips64 and powerpc.

[BZ #18803]
* sysdeps/i386/fpu/e_hypot.S: Use DEFINE_DBL_MIN.
(MO): New macro.
(__ieee754_hypot) [PIC]: Load PIC register.
(__ieee754_hypot): Use DBL_NARROW_EVAL_UFLOW_NONNEG instead of
DBL_NARROW_EVAL.
* sysdeps/ieee754/dbl-64/e_hypot.c (__ieee754_hypot): Use
math_check_force_underflow_nonneg in case where result might be
tiny.
* sysdeps/ieee754/ldbl-128/e_hypotl.c (__ieee754_hypotl):
Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_hypotl.c (__ieee754_hypotl):
Likewise.
* sysdeps/ieee754/ldbl-96/e_hypotl.c (__ieee754_hypotl): Likewise.
* sysdeps/powerpc/fpu/e_hypot.c (__ieee754_hypot): Likewise.
* math/auto-libm-test-in: Add more tests of hypot.
* math/auto-libm-test-out: Regenerated.

8 years ago Add missing ChangeLog entry.
Steve Ellcey [Thu, 24 Sep 2015 23:38:43 +0000 (16:38 -0700)]
Add missing ChangeLog entry.

    I forgot the ChangeLog entry with my patch to sysdeps/mips/math_private.h.

8 years ago Add unused attribute to declaration for mips16 builds.
Steve Ellcey [Thu, 24 Sep 2015 23:12:49 +0000 (16:12 -0700)]
Add unused attribute to declaration for mips16 builds.

    2015-09-24  Steve Ellcey  <sellcey@imgtec.com>

  * sysdeps/mips/math_private.h (libc_fesetenv_mips): Mark cw as unused.

8 years agoRefactor x86_64 libm code forcing underflow exceptions.
Joseph Myers [Thu, 24 Sep 2015 22:25:30 +0000 (22:25 +0000)]
Refactor x86_64 libm code forcing underflow exceptions.

This patch refactors code in sysdeps/x86_64/fpu that forces underflow
exceptions and closely follows corresponding i386 code to use common
macros in x86_64-math-asm.h for that purpose.  This is mainly about
keeping the code similar to the i386 code as far as possible, since
each macro apart from DEFINE_LDBL_MIN ends up used only once.  It
would be possible to do a further refactoring to share these macros
between i386 and x86_64 (with i386 using the fcomip / fucomip versions
when building for i686 and above), but I have no immediate plans to do
so.

Tested for x86_64.

* sysdeps/x86_64/fpu/x86_64-math-asm.h: New file.
* sysdeps/x86_64/fpu/e_exp2l.S: Include <x86_64-math-asm.h>.
(ldbl_min): Replace with use of DEFINE_LDBL_MIN.
(__ieee754_exp2l): Use LDBL_CHECK_FORCE_UFLOW_NONNEG_NAN.
* sysdeps/x86_64/fpu/e_expl.S: Include <x86_64-math-asm.h>.
[!USE_AS_EXPM1L] (cmin): Replace with use of DEFINE_LDBL_MIN.
(IEEE754_EXPL): Use LDBL_CHECK_FORCE_UFLOW_NONNEG.

8 years agoUse LOAD_PIC_REG in i386 atanh.
Joseph Myers [Thu, 24 Sep 2015 21:48:22 +0000 (21:48 +0000)]
Use LOAD_PIC_REG in i386 atanh.

sysdeps/i386/fpu/e_atanh.S, unlike all other functions in that
directory, loads the PIC register with its own code using
_GLOBAL_OFFSET_TABLE_, rather than with the LOAD_PIC_REG macro.  I see
no good reason for the difference; this patch makes it use the common
macro.

Tested for x86.

* sysdeps/i386/fpu/e_atanh.S (__ieee754_atanh) [PIC]: Use
LOAD_PIC_REG.

8 years agoRefactor i386 libm code forcing underflow exceptions.
Joseph Myers [Thu, 24 Sep 2015 21:41:00 +0000 (21:41 +0000)]
Refactor i386 libm code forcing underflow exceptions.

This patch refactors code in sysdeps/i386/fpu that forces underflow
exceptions to use common macros for that purpose as far as possible.
(Although some of the macros end up used in only one place, I think
it's cleanest to define all these macros together so that all the code
forcing underflow uses such macros.  Some more uses of such macros
will also be introduced when fixing remaining bugs about missing
underflow exceptions, and it would be possible to do further
refactoring of the macros in i386-math-asm.h to share more code by
using other macros internally.  Places that test for underflow by
examining the representation of the argument with integer operations,
rather that using floating-point comparisons on the argument or
result, are unchanged by this patch.)

Most of this code uses a macro MO to abstract away the differences
between PIC and non-PIC memory references to constants.  log1p
functions, however, hardcoded PIC conditionals for this.  Because the
common macros rely on the use of MO, I changed the log1p functions to
use the normal style here, and, for consistency, also made that change
to log1pl which is otherwise unaffected by this patch.

Tested for x86.

* sysdeps/i386/fpu/i386-math-asm.h (DEFINE_LDBL_MIN): New macro.
(FLT_CHECK_FORCE_UFLOW): Likewise.
(DBL_CHECK_FORCE_UFLOW): Likewise.
(FLT_CHECK_FORCE_UFLOW_NARROW): Likewise.
(DBL_CHECK_FORCE_UFLOW_NARROW): Likewise.
(LDBL_CHECK_FORCE_UFLOW_NONNEG_NAN): Likewise.
(FLT_CHECK_FORCE_UFLOW_NONNAN): Likewise.
(DBL_CHECK_FORCE_UFLOW_NONNAN): Likewise.
(FLT_CHECK_FORCE_UFLOW_NONNEG): Likewise.
(DBL_CHECK_FORCE_UFLOW_NONNEG): Likewise.
(LDBL_CHECK_FORCE_UFLOW_NONNEG): Likewise.
* sysdeps/i386/fpu/e_asin.S: Include <i386-math-asm.h>.
(dbl_min): Replace with use of DEFINE_DBL_MIN.
(__ieee754_asin): Use DBL_CHECK_FORCE_UFLOW.
* sysdeps/i386/fpu/e_asinf.S: Include <i386-math-asm.h>.
(flt_min): Replace with use of DEFINE_FLT_MIN.
(__ieee754_asinf): Use FLT_CHECK_FORCE_UFLOW.
* sysdeps/i386/fpu/e_atan2.S: Include <i386-math-asm.h>.
(dbl_min): Replace with use of DEFINE_DBL_MIN.
(__ieee754_atan2): Use DBL_CHECK_FORCE_UFLOW_NARROW.
* sysdeps/i386/fpu/e_atan2f.S: Include <i386-math-asm.h>.
(flt_min): Replace with use of DEFINE_FLT_MIN.
(__ieee754_atan2f): Use FLT_CHECK_FORCE_UFLOW_NARROW.
* sysdeps/i386/fpu/e_atanh.S: Include <i386-math-asm.h>.
(dbl_min): Replace with use of DEFINE_DBL_MIN.
(__ieee754_atanh): Use DBL_CHECK_FORCE_UFLOW_NONNEG.
* sysdeps/i386/fpu/e_atanhf.S: Include <i386-math-asm.h>.
(flt_min): Replace with use of DEFINE_FLT_MIN.
(__ieee754_atanhf): Use FLT_CHECK_FORCE_UFLOW_NONNEG.
* sysdeps/i386/fpu/e_exp2l.S: Include <i386-math-asm.h>.
(ldbl_min): Replace with use of DEFINE_LDBL_MIN.
(__ieee754_exp2l): Use LDBL_CHECK_FORCE_UFLOW_NONNEG_NAN.
* sysdeps/i386/fpu/e_expl.S: Include <i386-math-asm.h>.
[!USE_AS_EXPM1L] (cmin): Replace with use of DEFINE_LDBL_MIN.
(IEEE754_EXPL): Use LDBL_CHECK_FORCE_UFLOW_NONNEG.
* sysdeps/i386/fpu/s_atan.S: Include <i386-math-asm.h>.
(dbl_min): Replace with use of DEFINE_DBL_MIN.
(__atan): Use DBL_CHECK_FORCE_UFLOW.
* sysdeps/i386/fpu/s_atanf.S: Include <i386-math-asm.h>.
(flt_min): Replace with use of DEFINE_FLT_MIN.
(__atanf): Use FLT_CHECK_FORCE_UFLOW.
* sysdeps/i386/fpu/s_expm1.S: Include <i386-math-asm.h>.
(dbl_min): Replace with use of DEFINE_DBL_MIN.
(__expm1): Use DBL_CHECK_FORCE_UFLOW.  Move underflow check after
main computation.
* sysdeps/i386/fpu/s_expm1f.S: Include <i386-math-asm.h>.
(flt_min): Replace with use of DEFINE_FLT_MIN.
(__expm1f): Use FLT_CHECK_FORCE_UFLOW.  Move underflow check after
main computation.
* sysdeps/i386/fpu/s_log1p.S: Include <i386-math-asm.h>.
(dbl_min): Replace with use of DEFINE_DBL_MIN.
(MO): New macro.
(__log1p): Use MO.  Use DBL_CHECK_FORCE_UFLOW_NONNAN.
* sysdeps/i386/fpu/s_log1pf.S: Include <i386-math-asm.h>.
(flt_min): Replace with use of DEFINE_FLT_MIN.
(MO): New macro.
(__log1pf): Use MO.  Use FLT_CHECK_FORCE_UFLOW_NONNAN.
* sysdeps/i386/fpu/s_log1pl.S (MO): New macro.
(__log1pl): Use MO.

8 years agoFix x86_64 fma4 pow inappropriate contraction (bug 19003).
Joseph Myers [Thu, 24 Sep 2015 16:48:32 +0000 (16:48 +0000)]
Fix x86_64 fma4 pow inappropriate contraction (bug 19003).

The x86_64 fma4 version of pow fails to disable contraction of
operations other than those explicitly intended to use fma
instructions, so resulting in large ulps errors on processors with
fma4 instructions, as in bug 18104 (165ulp for the test added for that
bug; error originally reported by "blaaa" on #glibc).  This patch adds
$(config-cflags-nofma) for e_pow-fma4.c, corresponding to the use for
e_pow.c in sysdeps/ieee754/dbl-64/Makefile.

Tested for x86_64 on a processor with fma4.

[BZ #19003]
* sysdeps/x86_64/fpu/multiarch/Makefile (CFLAGS-e_pow-fma4.c): Add
$(config-cflags-nofma).

8 years agoRegenerate aarch64 libm-test-ulps
Szabolcs Nagy [Thu, 24 Sep 2015 13:22:31 +0000 (14:22 +0100)]
Regenerate aarch64 libm-test-ulps

* sysdeps/aarch64/libm-test-ulps: Regenerated.

8 years agoDon't use volatile in exp2f.
Joseph Myers [Wed, 23 Sep 2015 22:52:13 +0000 (22:52 +0000)]
Don't use volatile in exp2f.

sysdeps/ieee754/flt-32/e_exp2f.c declares two variable as "static
const volatile float".  Maybe this use of "volatile" was originally
intended to inhibit optimization of underflowing / overflowing
operations such as TWOM100 * TWOM100; in any case, it's not currently
needed, as given -frounding-math constant folding of such expressions
is properly disabled when it would be unsafe.  This patch removes the
unnecessary use of "volatile".

Tested for x86_64.

* sysdeps/ieee754/flt-32/e_exp2f.c (TWOM100): Remove volatile.
(TWO127): Likewise.

8 years agoRefactor code forcing underflow exceptions.
Joseph Myers [Wed, 23 Sep 2015 22:42:30 +0000 (22:42 +0000)]
Refactor code forcing underflow exceptions.

Various floating-point functions have code to force underflow
exceptions if a tiny result was computed in a way that might not have
resulted in such exceptions even though the result is inexact.  This
typically uses math_force_eval to ensure that the underflowing
expression is evaluated, but sometimes uses volatile.

This patch refactors such code to use three new macros
math_check_force_underflow, math_check_force_underflow_nonneg and
math_check_force_underflow_complex (which in turn use
math_force_eval).  In the limited number of cases not suited to a
simple conversion to these macros, existing uses of volatile are
changed to use math_force_eval instead.  The converted code does not
always execute exactly the same sequence of operations as the original
code, but the overall effects should be the same.

Tested for x86_64, x86, mips64 and powerpc.

* sysdeps/generic/math_private.h (fabs_tg): New macro.
(min_of_type): Likewise.
(math_check_force_underflow): Likewise.
(math_check_force_underflow_nonneg): Likewise.
(math_check_force_underflow_complex): Likewise.
* math/e_exp2l.c (__ieee754_exp2l): Use
math_check_force_underflow_nonneg.
* math/k_casinh.c (__kernel_casinh): Likewise.
* math/k_casinhf.c (__kernel_casinhf): Likewise.
* math/k_casinhl.c (__kernel_casinhl): Likewise.
* math/s_catan.c (__catan): Use
math_check_force_underflow_complex.
* math/s_catanf.c (__catanf): Likewise.
* math/s_catanh.c (__catanh): Likewise.
* math/s_catanhf.c (__catanhf): Likewise.
* math/s_catanhl.c (__catanhl): Likewise.
* math/s_catanl.c (__catanl): Likewise.
* math/s_ccosh.c (__ccosh): Likewise.
* math/s_ccoshf.c (__ccoshf): Likewise.
* math/s_ccoshl.c (__ccoshl): Likewise.
* math/s_cexp.c (__cexp): Likewise.
* math/s_cexpf.c (__cexpf): Likewise.
* math/s_cexpl.c (__cexpl): Likewise.
* math/s_clog.c (__clog): Use math_check_force_underflow_nonneg.
* math/s_clog10.c (__clog10): Likewise.
* math/s_clog10f.c (__clog10f): Likewise.
* math/s_clog10l.c (__clog10l): Likewise.
* math/s_clogf.c (__clogf): Likewise.
* math/s_clogl.c (__clogl): Likewise.
* math/s_csin.c (__csin): Use math_check_force_underflow_complex.
* math/s_csinf.c (__csinf): Likewise.
* math/s_csinh.c (__csinh): Likewise.
* math/s_csinhf.c (__csinhf): Likewise.
* math/s_csinhl.c (__csinhl): Likewise.
* math/s_csinl.c (__csinl): Likewise.
* math/s_csqrt.c (__csqrt): Use math_check_force_underflow.
* math/s_csqrtf.c (__csqrtf): Likewise.
* math/s_csqrtl.c (__csqrtl): Likewise.
* math/s_ctan.c (__ctan): Use math_check_force_underflow_complex.
* math/s_ctanf.c (__ctanf): Likewise.
* math/s_ctanh.c (__ctanh): Likewise.
* math/s_ctanhf.c (__ctanhf): Likewise.
* math/s_ctanhl.c (__ctanhl): Likewise.
* math/s_ctanl.c (__ctanl): Likewise.
* stdlib/strtod_l.c (round_and_return): Use math_force_eval
instead of volatile.
* sysdeps/ieee754/dbl-64/e_asin.c (__ieee754_asin): Use
math_check_force_underflow.
* sysdeps/ieee754/dbl-64/e_atanh.c (__ieee754_atanh): Likewise.
* sysdeps/ieee754/dbl-64/e_exp.c (__ieee754_exp): Do not use
volatile when forcing underflow.
* sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/dbl-64/e_gamma_r.c (__ieee754_gamma_r):
Likewise.
* sysdeps/ieee754/dbl-64/e_j1.c (__ieee754_j1): Use
math_check_force_underflow.
* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn): Likewise.
* sysdeps/ieee754/dbl-64/e_sinh.c (__ieee754_sinh): Likewise.
* sysdeps/ieee754/dbl-64/s_asinh.c (__asinh): Likewise.
* sysdeps/ieee754/dbl-64/s_atan.c (atan): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/dbl-64/s_erf.c (__erf): Use
math_check_force_underflow.
* sysdeps/ieee754/dbl-64/s_expm1.c (__expm1): Likewise.
* sysdeps/ieee754/dbl-64/s_fma.c (__fma): Use math_force_eval
instead of volatile.
* sysdeps/ieee754/dbl-64/s_log1p.c (__log1p): Use
math_check_force_underflow.
* sysdeps/ieee754/dbl-64/s_sin.c (__sin): Likewise.
* sysdeps/ieee754/dbl-64/s_tan.c (tan): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/dbl-64/s_tanh.c (__tanh): Use
math_check_force_underflow.
* sysdeps/ieee754/flt-32/e_asinf.c (__ieee754_asinf): Likewise.
* sysdeps/ieee754/flt-32/e_atanhf.c (__ieee754_atanhf): Likewise.
* sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/flt-32/e_gammaf_r.c (__ieee754_gammaf_r):
Likewise.
* sysdeps/ieee754/flt-32/e_j1f.c (__ieee754_j1f): Use
math_check_force_underflow.
* sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_jnf): Likewise.
* sysdeps/ieee754/flt-32/e_sinhf.c (__ieee754_sinhf): Likewise.
* sysdeps/ieee754/flt-32/k_sinf.c (__kernel_sinf): Likewise.
* sysdeps/ieee754/flt-32/k_tanf.c (__kernel_tanf): Likewise.
* sysdeps/ieee754/flt-32/s_asinhf.c (__asinhf): Likewise.
* sysdeps/ieee754/flt-32/s_atanf.c (__atanf): Likewise.
* sysdeps/ieee754/flt-32/s_erff.c (__erff): Likewise.
* sysdeps/ieee754/flt-32/s_expm1f.c (__expm1f): Likewise.
* sysdeps/ieee754/flt-32/s_log1pf.c (__log1pf): Likewise.
* sysdeps/ieee754/flt-32/s_tanhf.c (__tanhf): Likewise.
* sysdeps/ieee754/ldbl-128/e_asinl.c (__ieee754_asinl): Likewise.
* sysdeps/ieee754/ldbl-128/e_atanhl.c (__ieee754_atanhl):
Likewise.
* sysdeps/ieee754/ldbl-128/e_expl.c (__ieee754_expl): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/ldbl-128/e_gammal_r.c (__ieee754_gammal_r):
Likewise.
* sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_j1l): Use
math_check_force_underflow.
* sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-128/e_sinhl.c (__ieee754_sinhl): Likewise.
* sysdeps/ieee754/ldbl-128/k_sincosl.c (__kernel_sincosl):
Likewise.
* sysdeps/ieee754/ldbl-128/k_sinl.c (__kernel_sinl): Likewise.
* sysdeps/ieee754/ldbl-128/k_tanl.c (__kernel_tanl): Likewise.
* sysdeps/ieee754/ldbl-128/s_asinhl.c (__asinhl): Likewise.
* sysdeps/ieee754/ldbl-128/s_atanl.c (__atanl): Likewise.
* sysdeps/ieee754/ldbl-128/s_erfl.c (__erfl): Likewise.
* sysdeps/ieee754/ldbl-128/s_expm1l.c (__expm1l): Likewise.
* sysdeps/ieee754/ldbl-128/s_fmal.c (__fmal): Use math_force_eval
instead of volatile.
* sysdeps/ieee754/ldbl-128/s_log1pl.c (__log1pl): Use
math_check_force_underflow.
* sysdeps/ieee754/ldbl-128/s_tanhl.c (__tanhl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_asinl.c (__ieee754_asinl): Use
math_check_force_underflow.
* sysdeps/ieee754/ldbl-128ibm/e_atanhl.c (__ieee754_atanhl):
Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (__ieee754_gammal_r):
Use math_check_force_underflow_nonneg.
* sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Use
math_check_force_underflow.
* sysdeps/ieee754/ldbl-128ibm/e_sinhl.c (__ieee754_sinhl):
Likewise.
* sysdeps/ieee754/ldbl-128ibm/k_sincosl.c (__kernel_sincosl):
Likewise.
* sysdeps/ieee754/ldbl-128ibm/k_sinl.c (__kernel_sinl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/k_tanl.c (__kernel_tanl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_asinhl.c (__asinhl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_atanl.c (__atanl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_erfl.c (__erfl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_tanhl.c (__tanhl): Likewise.
* sysdeps/ieee754/ldbl-96/e_asinl.c (__ieee754_asinl): Likewise.
* sysdeps/ieee754/ldbl-96/e_atanhl.c (__ieee754_atanhl): Likewise.
* sysdeps/ieee754/ldbl-96/e_gammal_r.c (__ieee754_gammal_r): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/ldbl-96/e_j1l.c (__ieee754_j1l): Use
math_check_force_underflow.
* sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-96/e_sinhl.c (__ieee754_sinhl): Likewise.
* sysdeps/ieee754/ldbl-96/k_sinl.c (__kernel_sinl): Likewise.
* sysdeps/ieee754/ldbl-96/k_tanl.c (__kernel_tanl): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/ldbl-96/s_asinhl.c (__asinhl): Use
math_check_force_underflow.
* sysdeps/ieee754/ldbl-96/s_erfl.c (__erfl): Likewise.
* sysdeps/ieee754/ldbl-96/s_fmal.c (__fmal): Use math_force_eval
instead of volatile.
* sysdeps/ieee754/ldbl-96/s_tanhl.c (__tanhl): Use
math_check_force_underflow.

8 years agoUse math_narrow_eval more consistently.
Joseph Myers [Wed, 23 Sep 2015 18:14:57 +0000 (18:14 +0000)]
Use math_narrow_eval more consistently.

Where glibc code needs to avoid excess range and precision in
floating-point arithmetic, code variously uses either asms or volatile
to force the results of that arithmetic to memory; mostly this is
conditional on FLT_EVAL_METHOD, but in the case of lrint / llrint
functions some use of volatile is unconditional (and is present
unnecessarily in versions for long double).  This patch make such code
use the recently-added math_narrow_eval macro consistently, removing
the unnecessary uses of volatile in long double lrint / llrint
implementations completely.

Tested for x86_64, x86, mips64 and powerpc.

* math/s_nexttowardf.c (__nexttowardf): Use math_narrow_eval.
* stdlib/strtod_l.c: Include <math_private.h>.
(overflow_value): Use math_narrow_eval.
(underflow_value): Likewise.
* sysdeps/i386/fpu/s_nexttoward.c (__nexttoward): Likewise.
* sysdeps/i386/fpu/s_nexttowardf.c (__nexttowardf): Likewise.
* sysdeps/ieee754/dbl-64/e_gamma_r.c (gamma_positive): Likewise.
(__ieee754_gamma_r): Likewise.
* sysdeps/ieee754/dbl-64/gamma_productf.c (__gamma_productf):
Likewise.
* sysdeps/ieee754/dbl-64/k_rem_pio2.c (__kernel_rem_pio2):
Likewise.
* sysdeps/ieee754/dbl-64/lgamma_neg.c (__lgamma_neg): Likewise.
* sysdeps/ieee754/dbl-64/s_erf.c (__erfc): Likewise.
* sysdeps/ieee754/dbl-64/s_llrint.c (__llrint): Likewise.
* sysdeps/ieee754/dbl-64/s_lrint.c (__lrint): Likewise.
* sysdeps/ieee754/flt-32/e_gammaf_r.c (gammaf_positive): Likewise.
(__ieee754_gammaf_r): Likewise.
* sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
Likewise.
* sysdeps/ieee754/flt-32/lgamma_negf.c (__lgamma_negf): Likewise.
* sysdeps/ieee754/flt-32/s_erff.c (__erfcf): Likewise.
* sysdeps/ieee754/flt-32/s_llrintf.c (__llrintf): Likewise.
* sysdeps/ieee754/flt-32/s_lrintf.c (__lrintf): Likewise.
* sysdeps/ieee754/ldbl-128/s_llrintl.c (__llrintl): Do not use
volatile.
* sysdeps/ieee754/ldbl-128/s_lrintl.c (__lrintl): Likewise.
* sysdeps/ieee754/ldbl-128/s_nexttoward.c (__nexttoward): Use
math_narrow_eval.
* sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c (__nexttoward):
Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c (__nexttowardf):
Likewise.
* sysdeps/ieee754/ldbl-96/gamma_product.c (__gamma_product):
Likewise.
* sysdeps/ieee754/ldbl-96/s_llrintl.c (__llrintl): Do not use
volatile.
* sysdeps/ieee754/ldbl-96/s_lrintl.c (__lrintl): Likewise.
* sysdeps/ieee754/ldbl-96/s_nexttoward.c (__nexttoward): Use
math_narrow_eval.
* sysdeps/ieee754/ldbl-96/s_nexttowardf.c (__nexttowardf):
Likewise.
* sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c (__nldbl_nexttowardf):
Likewise.

8 years agoRemove ignored symbols from nptl/Versions
H.J. Lu [Tue, 22 Sep 2015 16:32:22 +0000 (09:32 -0700)]
Remove ignored symbols from nptl/Versions

Those ignored symbols are listed a few lines below.

* nptl/Versions: Remove ignored symbols.

8 years agoTest in commit e07aabba73ea62e7dfa0512507c92efb851fbdbe is for bug 17079
Florian Weimer [Tue, 22 Sep 2015 11:40:17 +0000 (13:40 +0200)]
Test in commit e07aabba73ea62e7dfa0512507c92efb851fbdbe is for bug 17079

8 years agoAdd test case for bug 18287
Florian Weimer [Tue, 22 Sep 2015 11:20:18 +0000 (13:20 +0200)]
Add test case for bug 18287

8 years agoAdd missing __mach_host_self_ symbol in Versions
Samuel Thibault [Tue, 22 Sep 2015 00:02:20 +0000 (02:02 +0200)]
Add missing __mach_host_self_ symbol in Versions

* mach/Versions (__mach_host_self_): Add symbol.

8 years agoFix vm_page_size visibility
Samuel Thibault [Sun, 20 Sep 2015 22:08:51 +0000 (00:08 +0200)]
Fix vm_page_size visibility

* sysdeps/mach/hurd/mmap.c (__mmap): Use __vm_page_size instead of
vm_page_size.

8 years agoReally fix sysdeps/i386/fpu/s_scalbn.S build
Samuel Thibault [Sat, 19 Sep 2015 12:23:16 +0000 (14:23 +0200)]
Really fix sysdeps/i386/fpu/s_scalbn.S build

* math/Versions (libc: GLIBC_2_20): New (empty) version set.
(libc: GLIBC_2_22): Remove unused version set.

8 years agotimezone: add a configure flag to disable program install
Mike Frysinger [Fri, 18 Sep 2015 18:00:05 +0000 (14:00 -0400)]
timezone: add a configure flag to disable program install

Some distros build+install the timezone tools (zic/zdump/tzselect) outside
of glibc and use the upstream package directly.  Add a configure flag to
glibc so they can disable install of those tools.

This allows tests to run & pass regardless of the configure flag.  Only
the install of them is impacted.

8 years agoRevert timezone/Makefile change.
Joseph Myers [Fri, 18 Sep 2015 22:02:32 +0000 (22:02 +0000)]
Revert timezone/Makefile change.

This change breaks the build with all released versions of GCC.

* timezone/Makefile: Revert previous change.

8 years agoAvoid excess range in results from i386 exp, hypot, pow functions (bug 18980).
Joseph Myers [Fri, 18 Sep 2015 21:53:22 +0000 (21:53 +0000)]
Avoid excess range in results from i386 exp, hypot, pow functions (bug 18980).

i386 exp, hypot and pow functions can return overflowing and
underflowing values with excess range and precision; ; Wilco
Dijkstra's patches to make isfinite etc. expand inline cause this
pre-existing issue to result in test failures.

This patch fixes those functions to avoid excess range and precision
in their return values.  Appropriate macros are added for the repeated
code sequences; in future I'll add more such macros and refactor
existing code forcing underflow (with or without also eliminating
excess range and precision from the return value) to use such macros.

Tested for x86.  If, after this patch, you still see x86 libm test
failures with excess range or precision, please file bugs in Bugzilla.

[BZ #18980]
* sysdeps/i386/fpu/i386-math-asm.h (DEFINE_FLT_MIN): New macro.
(DEFINE_DBL_MIN): Likewise.
(FLT_NARROW_EVAL_UFLOW_NONNEG_NAN): Likewise.
(DBL_NARROW_EVAL_UFLOW_NONNEG_NAN): Likewise.
(FLT_NARROW_EVAL_UFLOW_NONNEG): Likewise.
(DBL_NARROW_EVAL_UFLOW_NONNEG): Likewise.
* sysdeps/i386/fpu/e_exp.S: Include <i386-math-asm.h>.
(dbl_min): Replace with use of DEFINE_DBL_MIN.
(__ieee754_exp): Use DBL_NARROW_EVAL_UFLOW_NONNEG_NAN.
(__exp_finite): Use DBL_NARROW_EVAL_UFLOW_NONNEG.
* sysdeps/i386/fpu/e_exp10.S: Include <i386-math-asm.h>.
(dbl_min): Replace with use of DEFINE_DBL_MIN.
(__ieee754_exp10): Use DBL_NARROW_EVAL_UFLOW_NONNEG_NAN.
* sysdeps/i386/fpu/e_exp10f.S: Include <i386-math-asm.h>.
(flt_min): Replace with use of DEFINE_FLT_MIN.
(__ieee754_exp10f): Use FLT_NARROW_EVAL_UFLOW_NONNEG_NAN.
* sysdeps/i386/fpu/e_exp2.S: Include <i386-math-asm.h>.
(dbl_min): Replace with use of DEFINE_DBL_MIN.
(__ieee754_exp2): Use DBL_NARROW_EVAL_UFLOW_NONNEG_NAN.
* sysdeps/i386/fpu/e_exp2f.S: Include <i386-math-asm.h>.
(flt_min): Replace with use of DEFINE_FLT_MIN.
(__ieee754_exp2f): Use FLT_NARROW_EVAL_UFLOW_NONNEG_NAN.
* sysdeps/i386/fpu/e_expf.S: Include <i386-math-asm.h>.
(flt_min): Replace with use of DEFINE_FLT_MIN.
(__ieee754_expf): Use FLT_NARROW_EVAL_UFLOW_NONNEG_NAN.
(__expf_finite): Use FLT_NARROW_EVAL_UFLOW_NONNEG.
* sysdeps/i386/fpu/e_hypot.S: Include <i386-math-asm.h>.
(__ieee754_hypot): Use DBL_NARROW_EVAL.
* sysdeps/i386/fpu/e_hypotf.S: Include <i386-math-asm.h>.
(__ieee754_hypotf): Use FLT_NARROW_EVAL.
* sysdeps/i386/fpu/e_pow.S: Include <i386-math-asm.h>.
(__ieee754_pow): Use DBL_NARROW_EVAL.
* sysdeps/i386/fpu/e_powf.S: Include <i386-math-asm.h>.
(__ieee754_powf): Use FLT_NARROW_EVAL.
* sysdeps/i386/i686/fpu/multiarch/e_expf-sse2.S
(__ieee754_expf_sse2): Convert double-precision result to single
precision.
* sysdeps/i386/fpu/libm-test-ulps: Update.

8 years agoUndo build error fixes to timezone/private.h, change makefile instead to
Wilco Dijkstra [Fri, 18 Sep 2015 20:40:12 +0000 (21:40 +0100)]
Undo build error fixes to timezone/private.h, change makefile instead to
ignore the errors.

2015-09-18  Wilco Dijkstra  <wdijkstr@arm.com>

        * timezone/Makefile: Ignore unused variable errors due to private.h
        (time_t_min) and (time_t_max).
        * timezone/private.h (time_t_min): Revert removal.  (time_t_max):
        Likewise.

8 years agoAvoid excess range in results from i386 scalb functions (bug 18981).
Joseph Myers [Fri, 18 Sep 2015 20:34:59 +0000 (20:34 +0000)]
Avoid excess range in results from i386 scalb functions (bug 18981).

i386 scalb / scalbn / scalbln (and thus ldexp) functions for float and
double can return results with excess range (and consequently excess
precision for subnormal results).  As the results of these functions
are fully determined by reference to IEEE 754 operations, this is
unambiguously a bug, apart from the testsuite failures it causes.

This patch makes those functions store their results on the stack and
load them back to eliminate the excess range.  Double rounding is not
a problem, as the only cases where it could occur are when the result
overflows or underflows for extended precision, and then the
double-rounded results are the same as the single-rounded results.

The new macros will be used for more functions, more such macros
added, and existing code refactored to use such macros, in subsequent
patches.

Tested for x86.  Committed.

[BZ #18981]
* sysdeps/i386/fpu/i386-math-asm.h: New file.
* sysdeps/i386/fpu/e_scalb.S: Include <i386-math-asm.h>.
(__ieee754_scalb): Use DBL_NARROW_EVAL.
* sysdeps/i386/fpu/e_scalbf.S: Include <i386-math-asm.h>.
(__ieee754_scalbf): Use FLT_NARROW_EVAL.
* sysdeps/i386/fpu/s_scalbn.S: Include <i386-math-asm.h>.
(__scalbn): Use DBL_NARROW_EVAL.
* sysdeps/i386/fpu/s_scalbnf.S: Include <i386-math-asm.h>.
(__scalbnf): Use FLT_NARROW_EVAL.

8 years agoCleanup a few cases where isinf is used to get the signbit to improve the readability...
Wilco Dijkstra [Fri, 18 Sep 2015 20:19:48 +0000 (21:19 +0100)]
Cleanup a few cases where isinf is used to get the signbit to improve the readability and maintainability and allow inlining.

2015-09-18  Wilco Dijkstra  <wdijkstr@arm.com>

        * math/w_tgamma.c (__ieee754_gamma_r): Use explicit sign check.
        * math/w_tgammaf.c (__ieee754_gammaf_r): Likewise.
        * math/w_tgammal.c (__ieee754_gammal_r): Likewise.
        * stdio-common/printf_fp.c (___printf_fp):
        Use signbit to get the sign. Use isinf macro to allow inlining.
        * stdio-common/printf_fphex.c (__printf_fphex): Likewise.
        * stdio-common/printf_size.c (__printf_size): Likewise.

8 years agotimezone: fix parallel check failures
Mike Frysinger [Fri, 18 Sep 2015 17:49:08 +0000 (13:49 -0400)]
timezone: fix parallel check failures

The XT testdata install rules expect the testdata dir to already exist in
the build tree, but it doesn't actually create it.  Instead, it relies on
the build-testdata define happening to be executed before it (which runs
zic which creates the dir).  When we run in parallel though, it's easy to
hit a failure:
$ cd timezone
$ rm -rf $objdir/timezone/testdata
$ make check -j
...
cp testdata/XT1 .../timezone/testdata/XT1
cp: cannot create regular file '.../timezone/testdata/XT1': No such file or directory
Makefile:116: recipe for target '.../timezone/testdata/XT1' failed
make: *** [.../timezone/testdata/XT1] Error 1
make: *** Waiting for unfinished jobs....

8 years agoAvoid excess range overflowing results from cosh, sinh, lgamma (bug 18980).
Joseph Myers [Fri, 18 Sep 2015 20:00:48 +0000 (20:00 +0000)]
Avoid excess range overflowing results from cosh, sinh, lgamma (bug 18980).

Various i386 libm functions return values with excess range and
precision; Wilco Dijkstra's patches to make isfinite etc. expand
inline cause this pre-existing issue to result in test failures (when
e.g. a result that overflows float but not long double gets counted as
overflowing for some purposes but not others).

This patch addresses those cases arising from functions defined in C,
adding a math_narrow_eval macro that forces values to memory to
eliminate excess precision if FLT_EVAL_METHOD indicates this is
needed, and is a no-op otherwise.  I'll convert existing uses of
volatile and asm for this purpose to use the new macro later, once
i386 has clean test results again (which requires fixes for .S files
as well).

Tested for x86_64 and x86.  Committed.

[BZ #18980]
* sysdeps/generic/math_private.h: Include <float.h>.
(math_narrow_eval): New macro.
[FLT_EVAL_METHOD != 0] (excess_precision): Likewise.
* sysdeps/ieee754/dbl-64/e_cosh.c (__ieee754_cosh): Use
math_narrow_eval on overflowing return value.
* sysdeps/ieee754/dbl-64/e_lgamma_r.c (__ieee754_lgamma_r):
Likewise.
* sysdeps/ieee754/dbl-64/e_sinh.c (__ieee754_sinh): Likewise.
* sysdeps/ieee754/flt-32/e_coshf.c (__ieee754_coshf): Likewise.
* sysdeps/ieee754/flt-32/e_lgammaf_r.c (__ieee754_lgammaf_r):
Likewise.
* sysdeps/ieee754/flt-32/e_sinhf.c (__ieee754_sinhf): Likewise.

8 years agoSince we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns...
Wilco Dijkstra [Fri, 18 Sep 2015 19:51:52 +0000 (20:51 +0100)]
Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f)
with isinf, and remove the unused inlines __isinf_ns(l/f), __isnan(f) and __finite(f).

2015-09-18  Wilco Dijkstra  <wdijkstr@arm.com>

        * include/math.h: Remove __isinf_ns, __isinf_nsf, __isinf_nsl.
        * math/Makefile: Remove isinf_ns.c.
        * math/divtc3.c (__divtc3): Replace __isinf_nsl with isinf.
        * math/multc3.c (__multc3): Likewise.
        * math/s_casin.c (__casin): Likewise.
        * math/s_casinf.c (__casinf): Likewise.
        * math/s_casinl.c (__casinl): Likewise.
        * math/s_cproj.c (__cproj): Likewise.
        * math/s_cprojf.c (__cprojf): Likewise.
        * math/s_cprojl.c (__cprofl): Likewise.
        * math/s_ctan.c (__ctan): Likewise.
        * math/s_ctanf.c (__ctanf): Likewise.
        * math/s_ctanh.c (__ctanh): Likewise.
        * math/s_ctanhf.c (__ctanhf): Likewise.
        * math/s_ctanhl.c (__ctanhl): Likewise.
        * math/s_ctanl.c (__ctanl): Likewise.
        * math/w_fmod.c (__fmod): Likewise.
        * math/w_fmodf.c (__fmodf): Likewise.
        * math/w_fmodl.c (_fmodl): Likewise.
        * math/w_remainder.c (__remainder): Likewise.
        * math/w_remainderf.c (__remainderf): Likewise.
        * math/w_remainderl.c (__remainderl): Likewise.
        * math/w_scalb.c (__scalb): Likewise.
        * math/w_scalbf.c (__scalbf): Likewise.
        * math/w_scalbl.c (__scalbl): Likewise.
        * sysdeps/ieee754/dbl-64/s_isinf_ns.c: Deleted file.
        * sysdeps/ieee754/dbl-64/s_sincos.c (__sincos): Replace __isinf_ns
        with isinf.
        * sysdeps/ieee754/dbl-64/wordsize-64/math_private.h: Deleted file.
        * sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c: Deleted file.
        * sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Replace
        __isinf_nsf with isinf.
        * sysdeps/ieee754/flt-32/math_private.h: Deleted file.
        * sysdeps/ieee754/flt-32/s_isinf_nsf.c: Deleted file.
        * sysdeps/ieee754/ldbl-128/s_isinf_nsl.c: Deleted file.
        * sysdeps/ieee754/ldbl-128/s_sincosl.c (__sincosl): Replace __isinf_nsl
        with isinf.
        * sysdeps/ieee754/ldbl-128ibm/s_cprojl.c(__cprojll): Replace
        __isinf_nsl with isinf.
        * sysdeps/ieee754/ldbl-128ibm/s_ctanl.c(__ctanl): Replace __isinf_nsl
        with isinf.
        * sysdeps/ieee754/ldbl-128ibm/s_isinf_nsl.c: Deleted file.
        * sysdeps/ieee754/ldbl-128ibm/s_sincosl.c (__sincosl): Replace
        __isinf_nsl with isinf.
        * sysdeps/ieee754/ldbl-96/s_isinf_nsl.c: Deleted file.
        * sysdeps/ieee754/ldbl-96/s_sincosl.c (__sincosl): Replace __isinf_nsl
        with isinf.

8 years agoFix several build failures with GCC6 due to unused static variables.
Wilco Dijkstra [Fri, 18 Sep 2015 19:27:20 +0000 (20:27 +0100)]
Fix several build failures with GCC6 due to unused static variables.

2015-09-18  Wilco Dijkstra  <wdijkstr@arm.com>

        * resolv/base64.c (rcsid): Remove unused static.
        * sysdeps/ieee754/dbl-64/atnat2.h (qpi1): Remove unused
        static.  (tqpi1): Likewise.
        * sysdeps/ieee754/dbl-64/uexp.h (one): Likewise.
        * sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Likewise.
        * sysdeps/ieee754/flt-32/e_log10f.c (one): Likewise.
        * sysdeps/ieee754/flt-32/s_cosf.c (one): Likewise.
        * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Likewise.
        * sysdeps/ieee754/ldbl-128/s_erfl.c (half): Likewise.
        * sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Likewise.
        * timezone/private.h (time_t_min): Likewise.  (time_t_max):
        Likewise.

8 years agoUse __libc_ptf_call in _longjmp_unwind
H.J. Lu [Fri, 18 Sep 2015 19:22:36 +0000 (12:22 -0700)]
Use __libc_ptf_call in _longjmp_unwind

Use __libc_ptf_call in _longjmp_unwind to avoid duplicated logic.  On
x86-64, I got

jmp-unwind.os:
_longjmp_unwind:
movl __libc_pthread_functions_init(%rip), %eax
testl %eax, %eax
jne .L4
rep ret
.L4:
movq 304+__libc_pthread_functions(%rip), %rax
movq %rsp, %rsi
ror $2*8+1, %rax
xor %fs:48, %rax
jmp *%rax

jmp-unwind.o:

_longjmp_unwind:
movl $__pthread_cleanup_upto, %eax
testq %rax, %rax
je .L1
movq %rsp, %rsi
jmp __pthread_cleanup_upto
.L1:
rep ret

* sysdeps/nptl/jmp-unwind.c: Include <libc-lock.h> instead of
<nptl/pthreadP.h>.
(_longjmp_unwind): Use __libc_ptf_call.
* sysdeps/unix/sysv/linux/s390/jmp-unwind.c: Likewise.

8 years agoarm: setjmp/longjmp: fix PIC vs SHARED thinkos
David Lamparter [Sun, 12 Sep 2010 13:38:44 +0000 (09:38 -0400)]
arm: setjmp/longjmp: fix PIC vs SHARED thinkos

The logic in setjmp/__longjmp incorrectly uses "PIC" to figure out
whether the code is going into a shared library when it should be
using "SHARED".  If you build glibc with a gcc version that has PIE
enabled by default, then the code will try to use symbols that are
only in the shared library.

URL: https://bugs.gentoo.org/336914

8 years agoUse the GCC builtin functions for the non-inlined signbit implementations.
Wilco Dijkstra [Fri, 18 Sep 2015 15:39:08 +0000 (16:39 +0100)]
Use the GCC builtin functions for the non-inlined signbit implementations.

2015-09-18  Wilco Dijkstra  <wdijkstr@arm.com>

        * sysdeps/ieee754/dbl-64/s_signbit.c (__signbit):
        Use __builtin_signbit.
        * sysdeps/ieee754/flt-32/s_signbitf.c (__signbitf):
        Use __builtin_signbitf.
        * sysdeps/ieee754/ldbl-128/s_signbitl.c (__signbitl):
        Use __builtin_signbitl.
        * sysdeps/ieee754/ldbl-128ibm/s_signbitl.c (___signbitl): Likewise.
        * sysdeps/ieee754/ldbl-96/s_signbitl.c (__signbitl): Likewise.

8 years agoAdd inlining of the C99 math functions isinf/isnan/signbit/isfinite/isnormal/fpclassi...
Wilco Dijkstra [Fri, 18 Sep 2015 15:30:43 +0000 (16:30 +0100)]
Add inlining of the C99 math functions isinf/isnan/signbit/isfinite/isnormal/fpclassify using GCC
built-ins when available. Since going through the PLT is expensive for these small functions,
inlining results in major speedups (about 7x on Cortex-A57 for isinf). The GCC built-ins are not
correct if signalling NaN support is required, and thus are turned off in that case (see GCC bug
66462). The test-snan.c tests sNaNs and so must be explicitly built with -fsignaling-nans.

2015-09-18  Wilco Dijkstra  <wdijkstr@arm.com>

        [BZ #15367]
        [BZ #17441]

        * math/Makefile: Build test-snan.c with -fsignaling-nans.
        * math/math.h (fpclassify): Use __builtin_fpclassify when
        available.  (signbit): Use __builtin_signbit(f/l).
        (isfinite): Use__builtin_isfinite.  (isnormal): Use
        __builtin_isnormal.  (isnan): Use __builtin_isnan.
        (isinf): Use __builtin_isinf_sign.

8 years agoAdd a new benchmark for isinf/isnan/isnormal/isfinite/fpclassify. The test uses 2...
Wilco Dijkstra [Fri, 18 Sep 2015 15:02:38 +0000 (16:02 +0100)]
Add a new benchmark for isinf/isnan/isnormal/isfinite/fpclassify. The test uses 2 arrays with 1024 doubles, one with 99% finite FP numbers (10% zeroes, 10% negative) and 1% inf/NaN, the other with 50% inf, and 50% Nan.

ChangeLog:
2015-09-18  Wilco Dijkstra  <wdijkstr@arm.com>

* benchtests/Makefile: Add bench-math-inlines, link with libm.
* benchtests/bench-math-inlines.c: New benchmark.
* benchtests/bench-util.h: New file.
* benchtests/bench-util.c: New file.
* benchtests/bench-skeleton.c: Add include of bench-util.c/h.

8 years agoFix error messages in elf/tst-dlmopen1.c.
Carlos O'Donell [Fri, 18 Sep 2015 14:27:55 +0000 (10:27 -0400)]
Fix error messages in elf/tst-dlmopen1.c.

The test error messages incorrectly reference LIBC_SO
when they should reference the dlmopen'd library
tst-dlmopen1mod.so. Define TEST_SO and use it in
all the error messages.

8 years agoUse ALIGN_* macros in _dl_map_object_from_fd.
Carlos O'Donell [Fri, 18 Sep 2015 13:27:45 +0000 (09:27 -0400)]
Use ALIGN_* macros in _dl_map_object_from_fd.

Cleanup _dl_map_object_from_fd to make it clear exactly
what we're doing with the mappings i.e. extending the the
start of the map down to a page boundary, extending the
end of the map up to a page boundary, and offset itself
also to page boundary. The result is much easier to read
as expected from the ALIGN_* cleanups.

8 years agotime: in strptime(), make %z accept [+-]HH:MM tz [BZ #17887]
Vincent Bernat [Thu, 17 Sep 2015 07:56:13 +0000 (09:56 +0200)]
time: in strptime(), make %z accept [+-]HH:MM tz [BZ #17887]

In ISO 8601, +03:30 is a valid time zone. Currently, strptime() only
parses it as a 2-digit time zone an believes this is +03:00. This change
makes it accept a single colon.

8 years agotime: in strptime(), make %z accept Z as a time zone [BZ #17886]
Vincent Bernat [Thu, 17 Sep 2015 07:55:04 +0000 (09:55 +0200)]
time: in strptime(), make %z accept Z as a time zone [BZ #17886]

In ISO 8601, the timezone can be 'Z' instead of using
digits. 2014-08-17T12:33:12+0000 is often expressed as
2014-08-17T12:33:12Z.

8 years agoalpha: drop __ASSUME_FDATASYNC
Mike Frysinger [Tue, 18 Aug 2015 13:23:44 +0000 (09:23 -0400)]
alpha: drop __ASSUME_FDATASYNC

Since we require a new enough kernel all the time, the __ASSUME_FDATASYNC
define has been hardcoded to 1.  That means we can delete the alpha file
for fdatasync now and rely on the syscalls list like other ports.

8 years agoTest for weak undefined symbols in linknamespace.pl.
Joseph Myers [Fri, 18 Sep 2015 00:52:07 +0000 (00:52 +0000)]
Test for weak undefined symbols in linknamespace.pl.

This patch makes linknamespace.pl require weak undefined symbols to be
within the standard namespace.  (It remains the case that
linknamespace.pl does not look for definitions of such symbols or
require symbols used in those definitions to be within the standard
namespace.)

Tested for x86_64 and x86.

* conform/linknamespace.pl: Require weak undefined symbols to be
in the standard namespace.
(%strong_syms): Rename to %seen_syms.
(%strong_seen): Rename to %seen_where.

8 years agoUse __pthread_setcancelstate in libc.a
H.J. Lu [Thu, 17 Sep 2015 23:38:54 +0000 (16:38 -0700)]
Use __pthread_setcancelstate in libc.a

This patch references __pthread_setcancelstate instead of
pthread_setcancelstate in libc.a.

[BZ #18970]
* misc/error.c (error): Replace pthread_setcancelstate with
__pthread_setcancelstate.
(error_at_line): Likewise.
* posix/wordexp.c (parse_comm): Likewise.
* stdlib/fmtmsg.c (fmtmsg): Likewise.
* nptl/forward.c (pthread_setcancelstate): Renamed to ...
(__pthread_setcancelstate): This.
(pthread_setcancelstate): Add an alias.
* nptl/nptl-init.c (pthread_functions): Replace
ptr_pthread_setcancelstate with ptr___pthread_setcancelstate.
* sysdeps/nptl/pthread-functions.h (pthread_functions): Likewise.
* nptl/pthreadP.h (__pthread_setcancelstate): Mark it with
hidden_proto.
* nptl/pthread_setcancelstate.c (__pthread_setcancelstate): Mark
it with hidden_def.
* sysdeps/nptl/libc-lockP.h (__pthread_setcancelstate): New.
(pthread_setcancelstate): Renamed to ...
(__pthread_setcancelstate): This.
* sysdeps/unix/sysv/linux/fatal-prepare.h (FATAL_PREPARE): Use
__libc_ptf_call with __pthread_setcancelstate.

8 years agoFix sign of zero part from ctan / ctanh when argument infinite (bug 17118).
Joseph Myers [Thu, 17 Sep 2015 21:21:39 +0000 (21:21 +0000)]
Fix sign of zero part from ctan / ctanh when argument infinite (bug 17118).

C99/C11 Annex G specifies the sign of the zero part of the result of
ctan (x +/- i * Inf) and ctanh (+/-Inf + i * y).  This patch fixes glibc
to follow that specification, along the lines I described in my review
of Andreas's previous patch for this issue
<https://sourceware.org/ml/libc-alpha/2014-08/msg00142.html>.

Tested for x86_64.

2015-09-17  Joseph Myers  <joseph@codesourcery.com>
    Andreas Schwab  <schwab@suse.de>

[BZ #17118]
* math/s_ctan.c (__ctan): Determine sign of zero real part of
result when imaginary part of argument is infinite using sine and
cosine.
* math/s_ctanf.c (__ctanf): Likewise.
* math/s_ctanl.c (__ctanl): Likewise.
* math/s_ctanh.c (__ctanh): Determine sign of zero imaginary part
of result when real part of argument is infinite using sine and
cosine.
* math/s_ctanhf.c (__ctanhf): Likewise.
* math/s_ctanhl.c (__ctanhl): Likewise.
* math/libm-test.inc (ctan_test_data): Add more tests of ctan.
(ctanh_test_data): Add more tests of ctanh.

8 years agoReduce number of constants in __finite* (bug 15384).
Joseph Myers [Thu, 17 Sep 2015 16:47:14 +0000 (16:47 +0000)]
Reduce number of constants in __finite* (bug 15384).

Bug 15384 notes that in __finite, two different constants are used
that could be the same constant (the result only depends on the
exponent of the floating-point representation), and that using the
same constant is better for architectures where constants need loading
from a constant pool.  This patch implements that change.

Tested for x86_64, mips64 and powerpc.

[BZ #15384]
* sysdeps/ieee754/dbl-64/s_finite.c (FINITE): Use same constant as
bit-mask as in subtraction.
* sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c (__finite):
Likewise.
* sysdeps/ieee754/flt-32/s_finitef.c (FINITEF): Likewise.
* sysdeps/ieee754/ldbl-128/s_finitel.c (__finitel): Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_finitel.c (__finitel): Likewise.

8 years agoFix tgamma missing underflows (bug 18951).
Joseph Myers [Thu, 17 Sep 2015 15:51:54 +0000 (15:51 +0000)]
Fix tgamma missing underflows (bug 18951).

Similar to various other bugs in this area, tgamma functions can fail
to raise the underflow exception when the result is tiny and inexact
but one or more low bits of the intermediate result that is scaled
down are zero.  This patch forces the exception in a similar way to
previous fixes.

Tested for x86_64, x86, mips64 and powerpc.

[BZ #18951]
* sysdeps/ieee754/dbl-64/e_gamma_r.c (__ieee754_gamma_r): Force
underflow exception for small results.
* sysdeps/ieee754/flt-32/e_gammaf_r.c (__ieee754_gammaf_r):
Likewise.
* sysdeps/ieee754/ldbl-128/e_gammal_r.c (__ieee754_gammal_r):
Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (__ieee754_gammal_r):
Likewise.
* sysdeps/ieee754/ldbl-96/e_gammal_r.c (__ieee754_gammal_r):
Likewise.
* math/auto-libm-test-in: Add more tests of tgamma.
* math/auto-libm-test-out: Regenerated.

8 years agoRestore sparc64 implementation of semctl
Andreas Schwab [Thu, 17 Sep 2015 13:58:01 +0000 (15:58 +0200)]
Restore sparc64 implementation of semctl

The sparc64 variant of the ipc syscall does not dereference the pointer
argument for the SEMCTL operation.

8 years agoDon't declare float / long double Bessel functions for XSI POSIX (bug 18977).
Joseph Myers [Wed, 16 Sep 2015 22:04:40 +0000 (22:04 +0000)]
Don't declare float / long double Bessel functions for XSI POSIX (bug 18977).

The float and long double versions of Bessel function (j0f, y1l, etc.)
are not in POSIX; only the double versions are.  This patch
accordingly limits the declarations of those functions to __USE_MISC,
and fixes the conform/ test expectations which matched the previous
incorrect declarations.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by this patch).

[BZ #18977]
* math/bits/mathcalls.h
[!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (j0): Do
not declare.
[!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (j1):
Likewise.
[!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (jn):
Likewise.
[!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (y0):
Likewise.
[!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (y1):
Likewise.
[!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (yn):
Likewise.
* conform/data/math.h-data
[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (j0f): Do not expect
function.
[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (j1f): Likewise.
[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (jnf): Likewise.
[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (y0f): Likewise.
[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (y1f): Likewise.
[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (ynf): Likewise.
[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (j0l): Likewise.
[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (j1l): Likewise.
[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (jnl): Likewise.
[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (y0l): Likewise.
[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (y1l): Likewise.
[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (ynl): Likewise.

8 years agoMake scalbn set errno (bug 6803).
Joseph Myers [Wed, 16 Sep 2015 21:11:00 +0000 (21:11 +0000)]
Make scalbn set errno (bug 6803).

As noted in bug 6803, scalbn fails to set errno on overflow and
underflow.  This patch fixes this by making scalbn an alias of ldexp,
which has exactly the same semantics (for floating-point types with
radix 2) and already has wrappers that deal with setting errno,
instead of an alias of the internal __scalbn (which ldexp calls).

Notes:

* Where compat symbols were defined for scalbn functions, I didn't
  change what they point to (to keep the patch minimal), so such
  compat symbols continue to go directly to the non-errno-setting
  functions.

* Mike, I didn't do anything with the IA64 versions of these
  functions, where I think both the ldexp and scalbn functions already
  deal with setting errno.  As a cleanup (not needed to fix this bug)
  however you might want to make those functions into aliases for
  IA64; there is no need for them to be separate function
  implementations at all.

* This concludes the fix for bug 6803 since the scalb and scalbln
  cases of that bug were fixed some time ago.

Tested for x86_64, x86, mips64 and powerpc.

[BZ #6803]
* math/s_ldexp.c (scalbn): Define as weak alias of __ldexp.
[NO_LONG_DOUBLE] (scalbnl): Define as weak alias of __ldexp.
* math/s_ldexpf.c (scalbnf): Define as weak alias of __ldexpf.
* math/s_ldexpl.c (scalbnl): Define as weak alias of __ldexpl.
* sysdeps/i386/fpu/s_scalbn.S (scalbn): Remove alias.
* sysdeps/i386/fpu/s_scalbnf.S (scalbnf): Likewise.
* sysdeps/i386/fpu/s_scalbnl.S (scalbnl): Likewise.
* sysdeps/ieee754/dbl-64/s_scalbn.c (scalbn): Likewise.
[NO_LONG_DOUBLE] (scalbnl): Likewise.
* sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c (scalbn):
Likewise.
[NO_LONG_DOUBLE] (scalbnl): Likewise.
* sysdeps/ieee754/flt-32/s_scalbnf.c (scalbnf): Likewise.
* sysdeps/ieee754/ldbl-128/s_scalbnl.c (scalbnl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c (scalbnl): Remove
long_double_symbol calls.
* sysdeps/ieee754/ldbl-64-128/s_scalbnl.c (scalbnl): Likewise.
* sysdeps/ieee754/ldbl-opt/s_ldexpl.c (__ldexpl_2): Define as
strong alias of __ldexpl.
(scalbnl): Define using long_double_symbol.
* sysdeps/m68k/m680x0/fpu/s_scalbn.c (__CONCATX(scalbn,suffix)):
Remove alias.
* sysdeps/sparc/sparc64/soft-fp/s_scalbnl.c (scalbnl): Likewise.
* sysdeps/x86_64/fpu/s_scalbnl.S (scalbnl): Likewise.
* math/libm-test.inc (scalbn_test_data): Add errno expectations.
(scalbln_test_data): Add more errno expectations.

8 years agoCache the host port like we cache the task port
Justus Winter [Wed, 16 Sep 2015 17:41:14 +0000 (19:41 +0200)]
Cache the host port like we cache the task port

This way we do not
need to call the kernel just to get the port.  Furthermore, we no
longer increase the reference count on every invocation of
`mach_host_self'.

* mach/mach/mach_traps.h (__mach_host_self, mach_host_self):
Protect declarations against the macro expansion.
* mach/mach_init.c (__mach_host_self_): New variable.
(mach_init): Initialize `__mach_host_self_'.
* mach/mach_init.h (__mach_host_self_): New declaration.
(__mach_host_self, mach_host_self): New macros.
* sysdeps/mach/hurd/dl-sysdep.c (_dl_sysdep_start_cleanup):
Release reference.

8 years agoUpdate de.po from Translation Project (bug 4404).
Joseph Myers [Wed, 16 Sep 2015 16:51:28 +0000 (16:51 +0000)]
Update de.po from Translation Project (bug 4404).

[BZ #4404]
* po/de.po: Update from Translation Project.

8 years agoClean up ldbl-128 / ldbl-128ibm expm1l dead code (bug 16415).
Joseph Myers [Wed, 16 Sep 2015 16:42:46 +0000 (16:42 +0000)]
Clean up ldbl-128 / ldbl-128ibm expm1l dead code (bug 16415).

The ldbl-128 and ldbl-128ibm expm1l implementations have code to
handle +Inf and finite arguments above an overflow threshold.  Since
they now use __expl for large positive arguments to fix other
problems, this code is unreachable; this patch removes it.

Tested for mips64 and powerpc.

[BZ #16415]
* sysdeps/ieee754/ldbl-128/s_expm1l.c (maxlog): Remove variable.
(__expm1l): Remove code to handle positive infinity and overflow.
* sysdeps/ieee754/ldbl-128ibm/s_expm1l.c (maxlog): Remove
variable.
(__expm1l): Remove code to handle positive infinity and overflow.

8 years agoFix BZ #18872 -- memory leak in printf_positional.
Paul Pluzhnikov [Wed, 16 Sep 2015 16:16:11 +0000 (09:16 -0700)]
Fix BZ #18872 -- memory leak in printf_positional.

8 years agoRemove extra va_start/va_end calls (bug 17244)
Andreas Schwab [Tue, 7 Jul 2015 10:51:17 +0000 (12:51 +0200)]
Remove extra va_start/va_end calls (bug 17244)

8 years agoAdd missing va_end calls (bug 17243)
Andreas Schwab [Tue, 7 Jul 2015 10:52:51 +0000 (12:52 +0200)]
Add missing va_end calls (bug 17243)

8 years agoUse HOST_NAME_MAX for MAXHOSTNAMELEN in <sys/param.h>.
Roland McGrath [Tue, 15 Sep 2015 22:27:58 +0000 (15:27 -0700)]
Use HOST_NAME_MAX for MAXHOSTNAMELEN in <sys/param.h>.

8 years agoFix math.h, tgmath.h XSI POSIX namespace (gamma, isnan, scalb) (bug 18967).
Joseph Myers [Tue, 15 Sep 2015 22:12:40 +0000 (22:12 +0000)]
Fix math.h, tgmath.h XSI POSIX namespace (gamma, isnan, scalb) (bug 18967).

math.h incorrectly declares various functions for XSI POSIX 2001 and
2008 editions.  gamma was removed in the 2001 edition but is still
declared, along with gammaf and gammal which were never standard
functions.  isnan is still declared as a function, along with isnanf
and isnanl which were never standard functions, although in 2001 the
function was replaced by the type-generic macro.  scalbf and scalbl
are declared although never standard, and scalb was removed in the
2008 edition but is still declared.  The scalb type-generic macro in
tgmath.h shouldn't be present for any POSIX version, since POSIX never
had such a type-generic macro.

This patch disables all those declarations in the relevant cases (as a
minimal fix, it leaves them enabled for __USE_MISC).  For the matter
of declaring scalb but not scalbf or scalbl for the 2001 edition, a
new macro __MATH_DECLARING_DOUBLE is added, defined by math.h around
includes of bits/mathcalls.h, for bits/mathcalls.h to use to test
which type's functions are being declared.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

[BZ #18967]
* math/math.h (__MATH_DECLARING_DOUBLE): New macro.  Define and
undefine around includes of <bits/mathcalls.h>.
* math/bits/mathcalls.h [!__USE_MISC && __USE_XOPEN2K] (isnan): Do
not declare function.
[!__USE_MISC && __USE_XOPEN2K] (gamma): Likewise.
[!__USE_MISC && (!__MATH_DECLARING_DOUBLE || __USE_XOPEN2K8)]
(scalb): Likewise.
* math/tgmath.h [!__USE_MISC && __USE_XOPEN_EXTENDED] (scalb): Do
not define macro.
* conform/Makefile (test-xfail-XOPEN2K/math.h/conform): Remove
variable.
(test-xfail-XOPEN2K/tgmath.h/conform): Likewise.
(test-xfail-XOPEN2K8/math.h/conform): Likewise.
(test-xfail-XOPEN2K8/tgmath.h/conform): Likewise.

8 years agoFix ldbl-128ibm nearbyintl use of signaling comparisons on NaNs (bug 18857).
Joseph Myers [Tue, 15 Sep 2015 20:48:05 +0000 (20:48 +0000)]
Fix ldbl-128ibm nearbyintl use of signaling comparisons on NaNs (bug 18857).

The ldbl-128ibm implementation of nearbyintl wrongly uses signaling
comparisons such as "if (fabs (u.d[0].d) < TWO52)" on arguments that
might be NaNs, when "invalid" exceptions should not be raised.  (For
hard float, this issue may be hidden by
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58684>, powerpc GCC
wrongly only using unordered comparison instructions.)  This patch
fixes this by just returning the argument if it is not finite (because
of the arbitrary value of the low part of a NaN in IBM long double,
there are quite a lot of comparisons that could end up involving a NaN
when the argument to nearbyintl is a NaN, so excluding NaN arguments
at the start is the simplest and safest fix).

Tested for powerpc-nofpu, where it removes failures for spurious
"invalid" exceptions from nearbyintl.

[BZ #18857]
* sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c (__nearbyintl): Just
return non-finite argument without doing ordered comparisons on
it.

8 years agoMark fegetround pure (bug 16296).
Joseph Myers [Tue, 15 Sep 2015 20:36:50 +0000 (20:36 +0000)]
Mark fegetround pure (bug 16296).

Bug 16296 notes that fegetround is a pure function and should be
marked as such in fenv.h.  This patch implements that.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by this patch).

[BZ #16296]
* math/fenv.h (fegetround): Use __attribute_pure__.
* include/fenv.h (__fegetround): Likewise.

8 years agoFix ctan, ctanh missing underflows (bug 18595).
Joseph Myers [Tue, 15 Sep 2015 17:46:08 +0000 (17:46 +0000)]
Fix ctan, ctanh missing underflows (bug 18595).

Similar to various other bugs in this area, ctan and ctanh can fail to
raise the underflow exception for some cases of results that are tiny
and inexact.  This patch forces the exception in a similar way to
previous fixes.

Tested for x86_64 and x86.

[BZ #18595]
* math/s_ctan.c (__ctan): Force underflow exception for results
whose real or imaginary part has small absolute value.
* math/s_ctanf.c (__ctanf): Likewise.
* math/s_ctanh.c (__ctanh): Likewise.
* math/s_ctanhf.c (__ctanhf): Likewise.
* math/s_ctanhl.c (__ctanhl): Likewise.
* math/s_ctanl.c (__ctanl): Likewise.
* math/auto-libm-test-in: Do not allow missing underflow for ctan
and ctanh.  Add more tests of ctan and ctanh.

8 years agoSimplify hypotf infinity handling (bug 15918).
Joseph Myers [Tue, 15 Sep 2015 17:24:23 +0000 (17:24 +0000)]
Simplify hypotf infinity handling (bug 15918).

Bug 15918 points out that the handling of infinities in hypotf can be
simplified: it's enough to return the absolute value of the infinite
argument without first comparing it to the other argument and possibly
returning that other argument's absolute value.  This patch makes that
cleanup (which should not change how hypotf behaves on any input).

Tested for x86_64.

[BZ #15918]
* sysdeps/ieee754/flt-32/e_hypotf.c (__ieee754_hypotf): Simplify
handling of cases where one argument is an infinity.

8 years agoFix i386 exp10 missing underflows (bug 18966).
Joseph Myers [Tue, 15 Sep 2015 16:50:02 +0000 (16:50 +0000)]
Fix i386 exp10 missing underflows (bug 18966).

On i386, the double version of exp10 can miss underflow exceptions if
the result is in the subnormal range for double but the last 11 bits
of the 64-bit extended-precision mantissa happen to be zero.  This
patch forces the exception in a similar way to previous fixes.

As with the exp2 and exp fixes, the exp10f changes may in fact not be
needed to ensure underflow exceptions, but are included for
consistency and to fix the exp10 part of bug 18875 by ensuring that
excess range and precision is removed from underflowing return values.

Tested for x86_64 and x86.

[BZ #18875]
[BZ #18966]
* sysdeps/i386/fpu/e_exp10.S (dbl_min): New object.
(MO): New macro.
(__ieee754_exp10): For small results, force underflow exception
and remove excess range and precision from return value.
* sysdeps/i386/fpu/e_exp10f.S (flt_min): New object.
(MO): New macro.
(__ieee754_exp10f): For small results, force underflow exception
and remove excess range and precision from return value.
* math/auto-libm-test-in: Add more tests of exp10.
* math/auto-libm-test-out: Regenerated.

8 years agoFix typo
Samuel Thibault [Tue, 15 Sep 2015 08:19:31 +0000 (10:19 +0200)]
Fix typo

* sysdeps/mach/hurd/Makefile ($(patsubst %,$(hurd-objpfx)hurd/%.%,auth io fs
process)): Fix bogus %.% pattern into %.h.

8 years agoFix i386 exp missing underflows (bug 18961).
Joseph Myers [Mon, 14 Sep 2015 22:40:05 +0000 (22:40 +0000)]
Fix i386 exp missing underflows (bug 18961).

On i386, the double version of exp can miss underflow exceptions if
the result is in the subnormal range for double but the last 11 bits
of the 64-bit extended-precision mantissa happen to be zero.  This
patch forces the exception in a similar way to previous fixes.

As with the exp2 fixes, the expf changes may in fact not be needed to
ensure underflow exceptions, but are included for consistency and to
fix the exp part of bug 18875 by ensuring that excess range and
precision is removed from underflowing return values.

Tested for x86_64 and x86.

[BZ #18875]
[BZ #18961]
* sysdeps/i386/fpu/e_exp.S (dbl_min): New object.
(MO): New macro.
(__ieee754_exp): For small results, force underflow exception and
remove excess range and precision from return value.
(__exp_finite): Likewise.
* sysdeps/i386/fpu/e_expf.S (flt_min): New object.
(MO): New macro.
(__ieee754_expf): For small results, force underflow exception and
remove excess range and precision from return value.
(__expf_finite): Likewise.
* math/auto-libm-test-in: Add more tests of exp.
* math/auto-libm-test-out: Regenerated.

8 years agoFix exp2 missing underflows (bug 16521).
Joseph Myers [Mon, 14 Sep 2015 22:00:12 +0000 (22:00 +0000)]
Fix exp2 missing underflows (bug 16521).

Various exp2 implementations in glibc can miss underflow exceptions
when the scaling down part of the calculation is exact (or, in the x86
case, when the conversion from extended precision to the target
precision is exact).  This patch forces the exception in a similar way
to previous fixes.

The x86 exp2f changes may in fact not be needed for this purpose -
it's likely to be the case that no argument of type float has an exp2
result so close to an exact subnormal float value that it equals that
value when rounded to 64 bits (even taking account of variation
between different x86 implementations).  However, they are included
for consistency with the changes to exp2 and so as to fix the exp2f
part of bug 18875 by ensuring that excess range and precision is
removed from underflowing return values.

Tested for x86_64, x86 and mips64.

[BZ #16521]
[BZ #18875]
* math/e_exp2l.c (__ieee754_exp2l): Force underflow exception for
small results.
* sysdeps/i386/fpu/e_exp2.S (dbl_min): New object.
(MO): New macro.
(__ieee754_exp2): For small results, force underflow exception and
remove excess range and precision from return value.
* sysdeps/i386/fpu/e_exp2f.S (flt_min): New object.
(MO): New macro.
(__ieee754_exp2f): For small results, force underflow exception
and remove excess range and precision from return value.
* sysdeps/i386/fpu/e_exp2l.S (ldbl_min): New object.
(MO): New macro.
(__ieee754_exp2l): Force underflow exception for small results.
* sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Likewise.
* sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Likewise.
* sysdeps/x86_64/fpu/e_exp2l.S (ldbl_min): New object.
(MO): New macro.
(__ieee754_exp2l): Force underflow exception for small results.
* math/auto-libm-test-in: Add more tests or exp2.
* math/auto-libm-test-out: Regenerated.

8 years agoUse ALIGN_DOWN in systrim.
Carlos O'Donell [Mon, 14 Sep 2015 19:32:47 +0000 (15:32 -0400)]
Use ALIGN_DOWN in systrim.

While doing code review I converted another bespoke round down, and
corrected a comment.

The comment spoke about keeping at least one page allocated even
during systrim, which is not correct. The code does nothing to keep
a page allocated. The code does attempt to keep PAD padding as
documented in comments and MINSIZE as required by design.

Historically in 2002 when Ulrich wrote the code (fa8d436c) the math
was inlined into one statement which did reserve an extra page:
extra = ((top_size - pad - MINSIZE + (pagesz-1)) / pagesz - 1) * pagesz;
There is no reason given for this extra page.

In 2010 Anton Branchard's change (b9b42ee0) from division
to shifts removed the extra page by dropping the "+ (pagesiz-1), which
mean we might have attempted to return -0 via MORECORE. The fix by Will
Newton in 2014 added a check for extra being zero (51a7380b).

From first principles I see no reason why we should keep an extra
page of memory from being trimmed back to the OS. The only sensible
interface is to honour PAD padding as the function is documented,
with the caveat the MINSIZE is maintained for the top chunk.

Given that we've been using this code for 5+ years with no extra
page allocated is sufficient evidence that the comment should be changed
to match the code that I'm touching.

Tested on x86_64 and i686, no regressions.

8 years agoPrevent check-local-headers.sh hang.
Carlos O'Donell [Mon, 14 Sep 2015 13:57:58 +0000 (09:57 -0400)]
Prevent check-local-headers.sh hang.

Consensus in [1] was that the right way to fix this was simply to
redirect from /dev/null to terminate the test if no inputs was found
by the tests own globbing e.g. "*/*.{o,os,oS}.d" This can happen when
the build is incomplete and the tests are started. This failure causes
check-local-headers.sh to hang forever waiting for input from stdin.
This change makes the test terminate immediately if the glob doesn't
return any files.

[1] https://sourceware.org/ml/libc-alpha/2014-12/msg00337.html

8 years agoFix typo
Samuel Thibault [Sun, 13 Sep 2015 17:50:22 +0000 (19:50 +0200)]
Fix typo

* sysdeps/mach/hurd/Makefile ($(patsubst %,$(hurd-objpfx)hurd/%.%,auth
io fs process)): Drop spurious backslash.

8 years agolinux/getsysstats.c: use sysinfo() instead of parsing /proc/meminfo
Rasmus Villemoes [Tue, 18 Aug 2015 09:55:34 +0000 (11:55 +0200)]
linux/getsysstats.c: use sysinfo() instead of parsing /proc/meminfo

Profiling git's test suite, Linus noted [1] that a disproportionately
large amount of time was spent reading /proc/meminfo. This is done by
the glibc functions get_phys_pages and get_avphys_pages, but they only
need the MemTotal and MemFree fields, respectively. That same
information can be obtained with a single syscall, sysinfo, instead of
six: open, fstat, mmap, read, close, munmap. While sysinfo also
provides more than necessary, it does a lot less work than what the
kernel needs to do to provide the entire /proc/meminfo. Both strace -T
and in-app microbenchmarks shows that the sysinfo() approach is
roughly an order of magnitude faster.

sysinfo() is much older than what glibc currently requires, so I don't
think there's any reason to keep the old parsing code. Moreover, this
makes get_[av]phys_pages work even in the absence of /proc.

Linus noted that something as simple as 'bash -c "echo"' would trigger
the reading of /proc/meminfo, but gdb says that many more applications
than just bash are affected:

Starting program: /bin/bash "-c" "echo"

Breakpoint 1, __get_phys_pages () at ../sysdeps/unix/sysv/linux/getsysstats.c:283
283     ../sysdeps/unix/sysv/linux/getsysstats.c: No such file or directory.
(gdb) bt

So it seems that any application that uses qsort on a moderately sized
array will incur this cost (once), which is obviously proportionately
more expensive for lots of short-lived processes (such as the git test
suite).

[1] http://thread.gmane.org/gmane.linux.kernel/2019285

Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
* sysdeps/unix/sysv/linux/getsysstats.c (__get_phys_pages):
Use sysinfo system call instead of parsing /proc/meminfo.
* sysdeps/unix/sysv/linux/getsysstats.c (__get_avphys_pages):
Likewise.

8 years agolocaledef: improve error message [BZ #16985]
Mike Frysinger [Sat, 29 Aug 2015 20:37:29 +0000 (16:37 -0400)]
localedef: improve error message [BZ #16985]

If you pass in a path that fails to be opened, then output_path is set to
NULL, and an error is flagged.  Then at the end, we use both of those:
cannot write output files to `(null)': No such file or directory

Tweak the message to use the user's input when output_path is NULL.

8 years agoAdd more random libm test inputs (mainly for ldbl-128).
Joseph Myers [Sat, 12 Sep 2015 00:01:38 +0000 (00:01 +0000)]
Add more random libm test inputs (mainly for ldbl-128).

This patch adds more libm test inputs found through random test
generation to increase previously known ulps.  This particular test
generation was run for mips64, so most of the increased ulps are for
ldbl-128 (float and double having been fairly well covered by such
testing for x86_64), but there's the odd ulps increase for other
formats.

Tested for x86_64, x86 and mips64.

* math/auto-libm-test-in: Add more tests of acos, acosh, asin,
asinh, atan, atan2, atanh, cabs, carg, cos, csqrt, erfc, exp,
exp10, exp2, log, log1p, log2, pow, sin, sincos, sinh, tan and
tanh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/mips/mips32/libm-test-ulps: Likewise.
* sysdeps/mips/mips64/libm-test-ulps: Likewise.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

8 years agoNaCl: Do not install <sys/mtio.h>.
Roland McGrath [Fri, 11 Sep 2015 21:16:18 +0000 (14:16 -0700)]
NaCl: Do not install <sys/mtio.h>.

8 years agoMove bits/atomic.h to atomic-machine.h (bug 14912).
Joseph Myers [Fri, 11 Sep 2015 20:00:19 +0000 (20:00 +0000)]
Move bits/atomic.h to atomic-machine.h (bug 14912).

It was noted in
<https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the
bits/*.h naming scheme should only be used for installed headers.
This patch renames bits/atomic.h to atomic-machine.h to follow that
convention.

This is the only change in this series that needs to change the
filename rather than simply removing a directory level (because both
atomic.h and bits/atomic.h exist at present).

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).

[BZ #14912]
* sysdeps/aarch64/bits/atomic.h: Move to ...
* sysdeps/aarch64/atomic-machine.h: ...here.
(_AARCH64_BITS_ATOMIC_H): Rename macro to
_AARCH64_ATOMIC_MACHINE_H.
* sysdeps/alpha/bits/atomic.h: Move to ...
* sysdeps/alpha/atomic-machine.h: ...here.
* sysdeps/arm/bits/atomic.h: Move to ...
* sysdeps/arm/atomic-machine.h: ...here.  Update comments.
* bits/atomic.h: Move to ...
* sysdeps/generic/atomic-machine.h: ...here.
(_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H.
* sysdeps/i386/bits/atomic.h: Move to ...
* sysdeps/i386/atomic-machine.h: ...here.
* sysdeps/ia64/bits/atomic.h: Move to ...
* sysdeps/ia64/atomic-machine.h: ...here.
* sysdeps/m68k/coldfire/bits/atomic.h: Move to ...
* sysdeps/m68k/coldfire/atomic-machine.h: ...here.
(_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H.
* sysdeps/m68k/m680x0/m68020/bits/atomic.h: Move to ...
* sysdeps/m68k/m680x0/m68020/atomic-machine.h: ...here.
* sysdeps/microblaze/bits/atomic.h: Move to ...
* sysdeps/microblaze/atomic-machine.h: ...here.
* sysdeps/mips/bits/atomic.h: Move to ...
* sysdeps/mips/atomic-machine.h: ...here.
(_MIPS_BITS_ATOMIC_H): Rename macro to _MIPS_ATOMIC_MACHINE_H.
* sysdeps/powerpc/bits/atomic.h: Move to ...
* sysdeps/powerpc/atomic-machine.h: ...here.  Update comments.
* sysdeps/powerpc/powerpc32/bits/atomic.h: Move to ...
* sysdeps/powerpc/powerpc32/atomic-machine.h: ...here.  Update
comments.  Include <atomic-machine.h> instead of <bits/atomic.h>.
* sysdeps/powerpc/powerpc64/bits/atomic.h: Move to ...
* sysdeps/powerpc/powerpc64/atomic-machine.h: ...here.  Include
<atomic-machine.h> instead of <bits/atomic.h>.
* sysdeps/s390/bits/atomic.h: Move to ...
* sysdeps/s390/atomic-machine.h: ...here.
* sysdeps/sparc/sparc32/bits/atomic.h: Move to ...
* sysdeps/sparc/sparc32/atomic-machine.h: ...here.
(_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H.
* sysdeps/sparc/sparc32/sparcv9/bits/atomic.h: Move to ...
* sysdeps/sparc/sparc32/sparcv9/atomic-machine.h: ...here.
* sysdeps/sparc/sparc64/bits/atomic.h: Move to ...
* sysdeps/sparc/sparc64/atomic-machine.h: ...here.
* sysdeps/tile/bits/atomic.h: Move to ...
* sysdeps/tile/atomic-machine.h: ...here.
* sysdeps/tile/tilegx/bits/atomic.h: Move to ...
* sysdeps/tile/tilegx/atomic-machine.h: ...here.  Include
<sysdeps/tile/atomic-machine.h> instead of
<sysdeps/tile/bits/atomic.h>.
(_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H.
* sysdeps/tile/tilepro/bits/atomic.h: Move to ...
* sysdeps/tile/tilepro/atomic-machine.h: ...here.  Include
<sysdeps/tile/atomic-machine.h> instead of
<sysdeps/tile/bits/atomic.h>.
(_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H.
* sysdeps/unix/sysv/linux/arm/bits/atomic.h: Move to ...
* sysdeps/unix/sysv/linux/arm/atomic-machine.h: ...here.  Include
<sysdeps/arm/atomic-machine.h> instead of
<sysdeps/arm/bits/atomic.h>.
* sysdeps/unix/sysv/linux/hppa/bits/atomic.h: Move to ...
* sysdeps/unix/sysv/linux/hppa/atomic-machine.h: ...here.
(_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H.
* sysdeps/unix/sysv/linux/m68k/coldfire/bits/atomic.h: Move to ...
* sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h: ...here.
(_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H.
* sysdeps/unix/sysv/linux/nios2/bits/atomic.h: Move to ...
* sysdeps/unix/sysv/linux/nios2/atomic-machine.h: ...here.
(_NIOS2_BITS_ATOMIC_H): Rename macro to _NIOS2_ATOMIC_MACHINE_H.
* sysdeps/unix/sysv/linux/sh/bits/atomic.h: Move to ...
* sysdeps/unix/sysv/linux/sh/atomic-machine.h: ...here.
* sysdeps/x86_64/bits/atomic.h: Move to ...
* sysdeps/x86_64/atomic-machine.h: ...here.
* include/atomic.h: Include <atomic-machine.h> instead of
<bits/atomic.h>.

8 years agoUpdate libm-test-ulps for MIPS.
Joseph Myers [Fri, 11 Sep 2015 15:39:42 +0000 (15:39 +0000)]
Update libm-test-ulps for MIPS.

* sysdeps/mips/mips32/libm-test-ulps: Update.
* sysdeps/mips/mips64/libm-test-ulps: Likewise.

8 years agoFix ldbl-128/ldbl-128ibm lgamma spurious "invalid", incorrect signgam (bug 18952).
Joseph Myers [Fri, 11 Sep 2015 15:34:25 +0000 (15:34 +0000)]
Fix ldbl-128/ldbl-128ibm lgamma spurious "invalid", incorrect signgam (bug 18952).

The ldbl-128 / ldbl-128ibm implementation of lgammal converts (the
floor of minus) non-integer negative arguments to int to determine the
value of signgam.  When those values are outside the range of int,
this produces spurious "invalid" exceptions and incorrect values of
signgam.  This patch fixes this by instead determining signgam through
comparing half the integer in question to floor of half the integer.

Tested for mips64, x86_64 and x86.

[BZ #18952]
* sysdeps/ieee754/ldbl-128/e_lgammal_r.c (__ieee754_lgammal_r): Do
not convert non-integer negative arguments to int to determine the
value of signgam.
* math/auto-libm-test-in: Add more tests of lgamma.
* math/auto-libm-test-out: Regenerated.

8 years agoAdd more randomly-generated libm tests.
Joseph Myers [Fri, 11 Sep 2015 15:03:10 +0000 (15:03 +0000)]
Add more randomly-generated libm tests.

This patch adds more libm test inputs found through random test
generation to increase observed ulps on x86_64.

Tested for x86_64 and x86.

* math/auto-libm-test-in: Add more tests of acosh, atanh, cbrt,
cosh, csqrt, erfc, expm1 and lgamma.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

8 years agoFix lgamma (negative) inaccuracy (bug 2542, bug 2543, bug 2558).
Joseph Myers [Thu, 10 Sep 2015 22:27:58 +0000 (22:27 +0000)]
Fix lgamma (negative) inaccuracy (bug 2542, bug 2543, bug 2558).

The existing implementations of lgamma functions (except for the ia64
versions) use the reflection formula for negative arguments.  This
suffers large inaccuracy from cancellation near zeros of lgamma (near
where the gamma function is +/- 1).

This patch fixes this inaccuracy.  For arguments above -2, there are
no zeros and no large cancellation, while for sufficiently large
negative arguments the zeros are so close to integers that even for
integers +/- 1ulp the log(gamma(1-x)) term dominates and cancellation
is not significant.  Thus, it is only necessary to take special care
about cancellation for arguments around a limited number of zeros.

Accordingly, this patch uses precomputed tables of relevant zeros,
expressed as the sum of two floating-point values.  The log of the
ratio of two sines can be computed accurately using log1p in cases
where log would lose accuracy.  The log of the ratio of two gamma(1-x)
values can be computed using Stirling's approximation (the difference
between two values of that approximation to lgamma being computable
without computing the two values and then subtracting), with
appropriate adjustments (which don't reduce accuracy too much) in
cases where 1-x is too small to use Stirling's approximation directly.

In the interval from -3 to -2, using the ratios of sines and of
gamma(1-x) can still produce too much cancellation between those two
parts of the computation (and that interval is also the worst interval
for computing the ratio between gamma(1-x) values, which computation
becomes more accurate, while being less critical for the final result,
for larger 1-x).  Because this can result in errors slightly above
those accepted in glibc, this interval is instead dealt with by
polynomial approximations.  Separate polynomial approximations to
(|gamma(x)|-1)(x-n)/(x-x0) are used for each interval of length 1/8
from -3 to -2, where n (-3 or -2) is the nearest integer to the
1/8-interval and x0 is the zero of lgamma in the relevant half-integer
interval (-3 to -2.5 or -2.5 to -2).

Together, the two approaches are intended to give sufficient accuracy
for all negative arguments in the problem range.  Outside that range,
the previous implementation continues to be used.

Tested for x86_64, x86, mips64 and powerpc.  The mips64 and powerpc
testing shows up pre-existing problems for ldbl-128 and ldbl-128ibm
with large negative arguments giving spurious "invalid" exceptions
(exposed by newly added tests for cases this patch doesn't affect the
logic for); I'll address those problems separately.

[BZ #2542]
[BZ #2543]
[BZ #2558]
* sysdeps/ieee754/dbl-64/e_lgamma_r.c (__ieee754_lgamma_r): Call
__lgamma_neg for arguments from -28.0 to -2.0.
* sysdeps/ieee754/flt-32/e_lgammaf_r.c (__ieee754_lgammaf_r): Call
__lgamma_negf for arguments from -15.0 to -2.0.
* sysdeps/ieee754/ldbl-128/e_lgammal_r.c (__ieee754_lgammal_r):
Call __lgamma_negl for arguments from -48.0 or -50.0 to -2.0.
* sysdeps/ieee754/ldbl-96/e_lgammal_r.c (__ieee754_lgammal_r):
Call __lgamma_negl for arguments from -33.0 to -2.0.
* sysdeps/ieee754/dbl-64/lgamma_neg.c: New file.
* sysdeps/ieee754/dbl-64/lgamma_product.c: Likewise.
* sysdeps/ieee754/flt-32/lgamma_negf.c: Likewise.
* sysdeps/ieee754/flt-32/lgamma_productf.c: Likewise.
* sysdeps/ieee754/ldbl-128/lgamma_negl.c: Likewise.
* sysdeps/ieee754/ldbl-128/lgamma_productl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/lgamma_negl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/lgamma_productl.c: Likewise.
* sysdeps/ieee754/ldbl-96/lgamma_negl.c: Likewise.
* sysdeps/ieee754/ldbl-96/lgamma_product.c: Likewise.
* sysdeps/ieee754/ldbl-96/lgamma_productl.c: Likewise.
* sysdeps/generic/math_private.h (__lgamma_negf): New prototype.
(__lgamma_neg): Likewise.
(__lgamma_negl): Likewise.
(__lgamma_product): Likewise.
(__lgamma_productl): Likewise.
* math/Makefile (libm-calls): Add lgamma_neg and lgamma_product.
* math/auto-libm-test-in: Add more tests of lgamma.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

8 years agoTo fix BZ #18675, use __fstatvfs64 in __fpathconf.
Paul Pluzhnikov [Thu, 10 Sep 2015 01:41:25 +0000 (18:41 -0700)]
To fix BZ #18675, use __fstatvfs64 in __fpathconf.

8 years agoMove bits/libc-lock.h and bits/libc-lockP.h out of bits/ (bug 14912).
Joseph Myers [Tue, 8 Sep 2015 21:11:03 +0000 (21:11 +0000)]
Move bits/libc-lock.h and bits/libc-lockP.h out of bits/ (bug 14912).

It was noted in
<https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the
bits/*.h naming scheme should only be used for installed headers.
This patch renames bits/libc-lock.h to plain libc-lock.h and
bits/libc-lockP.h to plain libc-lockP.h to follow that convention.

Note that I don't know where libc-lockP.h comes from for Hurd (the
Hurd libc-lock.h includes libc-lockP.h, but the only libc-lockP.h in
the glibc source tree is for NPTL) - some unmerged patch? - but I
updated the #include in the Hurd libc-lock.h anyway.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).

[BZ #14912]
* bits/libc-lock.h: Move to ...
* sysdeps/generic/libc-lock.h: ...here.
(_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H.
* sysdeps/mach/hurd/bits/libc-lock.h: Move to ...
* sysdeps/mach/hurd/libc-lock.h: ...here.
(_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H.
[_LIBC]: Include <libc-lockP.h> instead of <bits/libc-lockP.h>.
* sysdeps/mach/bits/libc-lock.h: Move to ...
* sysdeps/mach/libc-lock.h: ...here.
(_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H.
* sysdeps/nptl/bits/libc-lock.h: Move to ...
* sysdeps/nptl/libc-lock.h: ...here.
(_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H.
* sysdeps/nptl/bits/libc-lockP.h: Move to ...
* sysdeps/nptl/libc-lockP.h: ...here.
(_BITS_LIBC_LOCKP_H): Rename macro to _LIBC_LOCKP_H.
* crypt/crypt_util.c: Include <libc-lock.h> instead of
<bits/libc-lock.h>.
* dirent/scandir-tail.c: Likewise.
* dlfcn/dlerror.c: Likewise.
* elf/dl-close.c: Likewise.
* elf/dl-iteratephdr.c: Likewise.
* elf/dl-lookup.c: Likewise.
* elf/dl-open.c: Likewise.
* elf/dl-support.c: Likewise.
* elf/dl-writev.h: Likewise.
* elf/rtld.c: Likewise.
* grp/fgetgrent.c: Likewise.
* gshadow/fgetsgent.c: Likewise.
* gshadow/sgetsgent.c: Likewise.
* iconv/gconv_conf.c: Likewise.
* iconv/gconv_db.c: Likewise.
* iconv/gconv_dl.c: Likewise.
* iconv/gconv_int.h: Likewise.
* iconv/gconv_trans.c: Likewise.
* include/link.h: Likewise.
* inet/getnameinfo.c: Likewise.
* inet/getnetgrent.c: Likewise.
* inet/getnetgrent_r.c: Likewise.
* intl/bindtextdom.c: Likewise.
* intl/dcigettext.c: Likewise.
* intl/finddomain.c: Likewise.
* intl/gettextP.h: Likewise.
* intl/loadmsgcat.c: Likewise.
* intl/localealias.c: Likewise.
* intl/textdomain.c: Likewise.
* libidn/idn-stub.c: Likewise.
* libio/libioP.h: Likewise.
* locale/duplocale.c: Likewise.
* locale/freelocale.c: Likewise.
* locale/newlocale.c: Likewise.
* locale/setlocale.c: Likewise.
* login/getutent_r.c: Likewise.
* login/getutid_r.c: Likewise.
* login/getutline_r.c: Likewise.
* login/utmp-private.h: Likewise.
* login/utmpname.c: Likewise.
* malloc/mtrace.c: Likewise.
* misc/efgcvt.c: Likewise.
* misc/error.c: Likewise.
* misc/fstab.c: Likewise.
* misc/getpass.c: Likewise.
* misc/mntent.c: Likewise.
* misc/syslog.c: Likewise.
* nis/nis_call.c: Likewise.
* nis/nis_callback.c: Likewise.
* nis/nss-default.c: Likewise.
* nis/nss_compat/compat-grp.c: Likewise.
* nis/nss_compat/compat-initgroups.c: Likewise.
* nis/nss_compat/compat-pwd.c: Likewise.
* nis/nss_compat/compat-spwd.c: Likewise.
* nis/nss_nis/nis-alias.c: Likewise.
* nis/nss_nis/nis-ethers.c: Likewise.
* nis/nss_nis/nis-grp.c: Likewise.
* nis/nss_nis/nis-hosts.c: Likewise.
* nis/nss_nis/nis-network.c: Likewise.
* nis/nss_nis/nis-proto.c: Likewise.
* nis/nss_nis/nis-pwd.c: Likewise.
* nis/nss_nis/nis-rpc.c: Likewise.
* nis/nss_nis/nis-service.c: Likewise.
* nis/nss_nis/nis-spwd.c: Likewise.
* nis/nss_nisplus/nisplus-alias.c: Likewise.
* nis/nss_nisplus/nisplus-ethers.c: Likewise.
* nis/nss_nisplus/nisplus-grp.c: Likewise.
* nis/nss_nisplus/nisplus-hosts.c: Likewise.
* nis/nss_nisplus/nisplus-initgroups.c: Likewise.
* nis/nss_nisplus/nisplus-network.c: Likewise.
* nis/nss_nisplus/nisplus-proto.c: Likewise.
* nis/nss_nisplus/nisplus-pwd.c: Likewise.
* nis/nss_nisplus/nisplus-rpc.c: Likewise.
* nis/nss_nisplus/nisplus-service.c: Likewise.
* nis/nss_nisplus/nisplus-spwd.c: Likewise.
* nis/ypclnt.c: Likewise.
* nptl/libc_pthread_init.c: Likewise.
* nss/getXXbyYY.c: Likewise.
* nss/getXXent.c: Likewise.
* nss/getXXent_r.c: Likewise.
* nss/nss_db/db-XXX.c: Likewise.
* nss/nss_db/db-netgrp.c: Likewise.
* nss/nss_db/nss_db.h: Likewise.
* nss/nss_files/files-XXX.c: Likewise.
* nss/nss_files/files-alias.c: Likewise.
* nss/nsswitch.c: Likewise.
* posix/regex_internal.h: Likewise.
* posix/wordexp.c: Likewise.
* pwd/fgetpwent.c: Likewise.
* resolv/res_hconf.c: Likewise.
* resolv/res_libc.c: Likewise.
* shadow/fgetspent.c: Likewise.
* shadow/lckpwdf.c: Likewise.
* shadow/sgetspent.c: Likewise.
* socket/opensock.c: Likewise.
* stdio-common/reg-modifier.c: Likewise.
* stdio-common/reg-printf.c: Likewise.
* stdio-common/reg-type.c: Likewise.
* stdio-common/vfprintf.c: Likewise.
* stdio-common/vfscanf.c: Likewise.
* stdlib/abort.c: Likewise.
* stdlib/cxa_atexit.c: Likewise.
* stdlib/fmtmsg.c: Likewise.
* stdlib/random.c: Likewise.
* stdlib/setenv.c: Likewise.
* string/strsignal.c: Likewise.
* sunrpc/auth_none.c: Likewise.
* sunrpc/bindrsvprt.c: Likewise.
* sunrpc/create_xid.c: Likewise.
* sunrpc/key_call.c: Likewise.
* sunrpc/rpc_thread.c: Likewise.
* sysdeps/arm/backtrace.c: Likewise.
* sysdeps/generic/ldsodefs.h: Likewise.
* sysdeps/generic/stdio-lock.h: Likewise.
* sysdeps/generic/unwind-dw2-fde.c: Likewise.
* sysdeps/i386/backtrace.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c: Likewise.
* sysdeps/m68k/backtrace.c: Likewise.
* sysdeps/mach/hurd/cthreads.c: Likewise.
* sysdeps/mach/hurd/dirstream.h: Likewise.
* sysdeps/mach/hurd/malloc-machine.h: Likewise.
* sysdeps/nptl/malloc-machine.h: Likewise.
* sysdeps/nptl/stdio-lock.h: Likewise.
* sysdeps/posix/dirstream.h: Likewise.
* sysdeps/posix/getaddrinfo.c: Likewise.
* sysdeps/posix/system.c: Likewise.
* sysdeps/pthread/aio_suspend.c: Likewise.
* sysdeps/s390/s390-32/backtrace.c: Likewise.
* sysdeps/s390/s390-64/backtrace.c: Likewise.
* sysdeps/unix/sysv/linux/check_pf.c: Likewise.
* sysdeps/unix/sysv/linux/if_index.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c: Likewise.
* sysdeps/unix/sysv/linux/shm-directory.c: Likewise.
* sysdeps/unix/sysv/linux/system.c: Likewise.
* sysdeps/x86_64/backtrace.c: Likewise.
* time/alt_digit.c: Likewise.
* time/era.c: Likewise.
* time/tzset.c: Likewise.
* wcsmbs/wcsmbsload.c: Likewise.
* nptl/tst-initializers1.c (do_test): Refer to <libc-lock.h>
instead of <bits/libc-lock.h> in comment.

8 years agoBZ#18921: Mark fixed in NEWS.
Roland McGrath [Tue, 8 Sep 2015 21:03:07 +0000 (14:03 -0700)]
BZ#18921: Mark fixed in NEWS.

8 years agoMIPS: Only use .set mips* assembler directives when necessary
Andrew Bennett [Mon, 24 Aug 2015 21:06:29 +0000 (22:06 +0100)]
MIPS: Only use .set mips* assembler directives when necessary

There are a few .set mips* assembler directives used in the MIPS specific
sysdep code that force an instruction to be assembled for a specific ISA.
The reason for these is to allow an instruction to be encoded when it might
not be supported in the current ISA (when the code is run the Linux kernel
will trap and emulate any unsupported instructions).  Unfortunately forcing
a specific ISA means that when assembling for a newer ISA, where the
instruction has a different encoding, the wrong encoding will be used.

        * sysdeps/mips/bits/atomic.h [_MIPS_SIM == _ABIO32] (MIPS_PUSH_MIPS2):
        Only use .set mips2 if the current ISA is below mips2.
        * sysdeps/mips/sys/tas.h [_MIPS_SIM == _ABIO32] (_test_and_set):
        Likewise.
        * sysdeps/mips/nptl/tls.h (READ_THREAD_POINTER): Only use .set
        mips32r2 if the current ISA is below mips32r2.
        * sysdeps/mips/tls-macros.h (TLS_RDHWR): New define.
        (TLS_IE): Updated to use the TLD_RDHWR macro.
        (TLS_LE): Likewise.
        * sysdeps/unix/mips/sysdep.h (__mips_isa_rev): Moved out of #ifdef
        __ASSEMBLER__ condition.

8 years agoFix parallel build of before-compile targets.
Samuel Thibault [Mon, 7 Sep 2015 23:26:01 +0000 (01:26 +0200)]
Fix parallel build of before-compile targets.

* sysdeps/mach/Makefile ($(patsubst
mach%,m\%h%,$(mach-before-compile))): Move rule to dedicated
mach-before-compile target.
* sysdeps/mach/hurd/Makefile ($(patsubst %,$(hurd-objpfx)hurd/%.%,auth
io fs process)): Move rule to dedicated hurd-before-compile target.

8 years agoFix rules generating headers in hurd/ and mach/
Samuel Thibault [Sun, 6 Sep 2015 19:07:00 +0000 (21:07 +0200)]
Fix rules generating headers in hurd/ and mach/

when initial make call has subdir= explicitly set.

* sysdeps/mach/Makefile ($(patsubst
mach%,m\%h%,$(mach-before-compile))): Force subdir to mach when
calling $(MAKE).
* sysdeps/mach/hurd/Makefile ($(patsubst %,$(hurd-objpfx)hurd/%.%,auth
io fs process)): Force subdir to hurd when calling $(MAKE).
($(common-objpfx)hurd/../mach/RPC_task_get_sampled_pcs.c): Force
subdir to mach when calling $(MAKE).

8 years agoCheck sysheaders when looking for Mach and Hurd headers
Manolis Ragkousis [Wed, 26 Aug 2015 21:48:33 +0000 (23:48 +0200)]
Check sysheaders when looking for Mach and Hurd headers

* sysdeps/mach/configure.ac: Add sysheaders check.
* sysdeps/mach/configure: Regenerate.
* sysdeps/mach/hurd/configure.ac: Add sysheaders check.
* sysdeps/mach/hurd/configure: Regenerate.

8 years agoBZ#18921: Fix opendir inverted o_directory_works test.
Roland McGrath [Fri, 4 Sep 2015 21:37:56 +0000 (14:37 -0700)]
BZ#18921: Fix opendir inverted o_directory_works test.

8 years agoRename bits/linkmap.h to linkmap.h (bug 14912).
Joseph Myers [Fri, 4 Sep 2015 19:44:27 +0000 (19:44 +0000)]
Rename bits/linkmap.h to linkmap.h (bug 14912).

It was noted in
<https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the
bits/*.h naming scheme should only be used for installed headers.
This patch renames bits/linkmap.h to plain linkmap.h to follow that
convention.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).

[BZ #14912]
* bits/linkmap.h: Move to ...
* sysdeps/generic/linkmap.h: ...here.
* sysdeps/aarch64/bits/linkmap.h: Move to ...
* sysdeps/aarch64/linkmap.h: ...here.
* sysdeps/arm/bits/linkmap.h: Move to ...
* sysdeps/arm/linkmap.h: ...here.
* sysdeps/hppa/bits/linkmap.h: Move to ...
* sysdeps/hppa/linkmap.h: ...here.
* sysdeps/ia64/bits/linkmap.h: Move to ...
* sysdeps/ia64/linkmap.h: ...here.
* sysdeps/mips/bits/linkmap.h: Move to ...
* sysdeps/mips/linkmap.h: ...here.
* sysdeps/s390/bits/linkmap.h: Move to ...
* sysdeps/s390/linkmap.h: ...here.
* sysdeps/sh/bits/linkmap.h: Move to ...
* sysdeps/sh/linkmap.h: ...here.
* sysdeps/x86/bits/linkmap.h: Move to ...
* sysdeps/x86/linkmap.h: ...here.
* include/link.h: Include <linkmap.h> instead of <bits/linkmap.h>.

8 years agoTerminate FDE before return trampoline in makecontext for powerpc (bug 18635)
Andreas Schwab [Thu, 20 Aug 2015 13:25:18 +0000 (15:25 +0200)]
Terminate FDE before return trampoline in makecontext for powerpc (bug 18635)

This fixes tst-makecontext for PowerPC.

[BZ #18635]
* sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
(__makecontext): Terminate FDE before return label.
(__novec_makecontext): Likewise.

8 years agopowerpc: Fix compiler warning in some syscalls.
Carlos Eduardo Seo [Thu, 3 Sep 2015 01:04:23 +0000 (22:04 -0300)]
powerpc: Fix compiler warning in some syscalls.

Commit f4491417cc80b4a01e72e9d218af137765ee5918 introduced some warnings
when building GLIBC with GCC 5.x. similar to those fixed by commit
dd6e8af6ba1b8a95a7f1dc7422e5ea4ccc7fbd93.  This patch fixes those warnings.

* sysdeps/unix/sysv/linux/socketpair.c: Use the address of the
first member of struct sv in syscall macro.

8 years agoRename bits/stdio-lock.h to stdio-lock.h (bug 14912).
Joseph Myers [Fri, 4 Sep 2015 16:21:14 +0000 (16:21 +0000)]
Rename bits/stdio-lock.h to stdio-lock.h (bug 14912).

It was noted in
<https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the
bits/*.h naming scheme should only be used for installed headers.
This patch renames bits/stdio-lock.h to plain stdio-lock.h to follow
that convention.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).

[BZ #14912]
* bits/stdio-lock.h: Move to ...
* sysdeps/generic/stdio-lock.h: ...here.
(_BITS_STDIO_LOCK_H): Rename macro to _STDIO_LOCK_H.
* sysdeps/nptl/bits/stdio-lock.h: Move to ...
* sysdeps/nptl/stdio-lock.h: ...here.
(_BITS_STDIO_LOCK_H): Rename macro to _STDIO_LOCK_H.
* include/libio.h: Include <stdio-lock.h> instead of
<bits/stdio-lock.h>.
* sysdeps/nptl/fork.c: Likewise.
* sysdeps/pthread/flockfile.c: Likewise.
* sysdeps/pthread/ftrylockfile.c: Likewise.
* sysdeps/pthread/funlockfile.c: Likewise.

8 years agoRename bits/m68k-vdso.h to m68k-vdso.h (bug 14912).
Joseph Myers [Fri, 4 Sep 2015 14:46:21 +0000 (14:46 +0000)]
Rename bits/m68k-vdso.h to m68k-vdso.h (bug 14912).

It was noted in
<https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the
bits/*.h naming scheme should only be used for installed headers.
This patch renames bits/m68k-vdso.h to plain m68k-vdso.h to follow
that convention.

[BZ #14912]
* sysdeps/unix/sysv/linux/m68k/bits/m68k-vdso.h: Move to ...
* sysdeps/unix/sysv/linux/m68k/m68k-vdso.h: ...here.
* sysdeps/unix/sysv/linux/m68k/coldfire/bits/atomic.h: Include
<m68k-vdso.h> instead of <bits/m68k-vdso.h>.
* sysdeps/unix/sysv/linux/m68k/init-first.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/m68k-helpers.S: Likewise.
* sysdeps/unix/sysv/linux/m68k/m68k-vdso.c: Likewise.

8 years agoAmend ChangeLog to reflect deletion of elf/tst-znodelete-zlib.cc
Florian Weimer [Fri, 4 Sep 2015 09:35:02 +0000 (11:35 +0200)]
Amend ChangeLog to reflect deletion of elf/tst-znodelete-zlib.cc

Commit f25238ffe0455013174438376b3ee88df496f9d1 deleted this file
because it was noted during review that it was unused.