]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
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.

8 years agoMark elf/tst-protected1[ab] as XFAIL.
Roland McGrath [Thu, 3 Sep 2015 23:26:59 +0000 (16:26 -0700)] 
Mark elf/tst-protected1[ab] as XFAIL.

8 years agoRename bits/libc-tsd.h to libc-tsd.h (bug 14912).
Joseph Myers [Thu, 3 Sep 2015 20:33:46 +0000 (20:33 +0000)] 
Rename bits/libc-tsd.h to libc-tsd.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/libc-tsd.h to plain libc-tsd.h to follow that
convention.

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

[BZ #14912]
* bits/libc-tsd.h: Move to ...
* sysdeps/generic/libc-tsd.h: ...here.
(_GENERIC_BITS_LIBC_TSD_H): Rename macro to _GENERIC_LIBC_TSD_H.
* sysdeps/mach/hurd/bits/libc-tsd.h: Move to ...
* sysdeps/mach/hurd/libc-tsd.h: ...here.
(_BITS_LIBC_TSD_H): Rename macro to _LIBC_TSD_H.
* include/ctype.h: Include <libc-tsd.h> instead of
<bits/libc-tsd.h>.
* include/rpc/rpc.h: Likewise.
* locale/localeinfo.h: Likewise.
* sunrpc/rpc_thread.c: Likewise.
* sysdeps/mach/hurd/malloc-machine.h: Likewise.
* sysdeps/nptl/malloc-machine.h: Likewise.

8 years agoDon't install bits/libc-lock.h or bits/stdio-lock.h.
Joseph Myers [Thu, 3 Sep 2015 20:25:55 +0000 (20:25 +0000)] 
Don't install bits/libc-lock.h or bits/stdio-lock.h.

The bits/libc-lock.h and bits/stdio-lock.h headers are installed, but
not used by any other installed header.

Accordingly, this patch stops these headers from being installed.  A
followup is intended to move these headers out of the bits/ namespace.

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

* Makefile (headers): Remove bits/libc-lock.h.
* libio/Makefile (headers): Remove bits/stdio-lock.h.

8 years agoDon't include <bits/stdio-lock.h> from installed <libio.h>.
Joseph Myers [Thu, 3 Sep 2015 20:24:54 +0000 (20:24 +0000)] 
Don't include <bits/stdio-lock.h> from installed <libio.h>.

Every so often someone gets confused by the fact that the installed
<bits/stdio-lock.h> header includes the non-installed <lowlevellock.h>
header.

This inclusion is not in fact a bug, because <bits/stdio-lock.h> only
gets included by any header that users should include directly if
_IO_MTSAFE_IO is defined, and that's an internal define used when
building libio, not a feature test macro it's valid for users to
define.  However, on general principles it's best to have as little as
possible in the installed headers that is inapplicable for valid uses
of the installed glibc.

This patch moves the include of <bits/stdio-lock.h> to the internal
header include/libio.h, so that even if someone defines _IO_MTSAFE_IO
it won't get included.  This is intended as preparation for stopping
<bits/stdio-lock.h> and <bits/libc-lock.h> from being installed at all
(after this patch they aren't used in any installed header; formally
of course they don't need to be installed even before this patch, but
stopping them being installed before removing the #include would just
exacerbate the confusion described above), and then moving those out
of the bits/ namespace in accordance with the principle that that
namespace is only for installed headers.

The tests scanf15.c and scanf17.c avoid the internal headers; after
this patch that means they need to undefine _IO_MTSAFE_IO as well as
_LIBC so as to get a working _IO_lock_t definition for libio.h.  This
brings them closer to using the headers as an installed program would,
which clearly accords with the intent of those tests.

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

* libio/libio.h [_IO_MTSAFE_IO]: Remove include of
<bits/stdio-lock.h> and commented-out include of <comthread.h>.
* include/libio.h [!_ISOMAC && _IO_MTSAFE_IO]: Include
<bits/stdio-lock.h>.
* stdio-common/scanf15.c (_IO_MTSAFE_IO): Undefine.
* stdio-common/scanf17.c (_IO_MTSAFE_IO): Likewise.

8 years agoFix BZ #18757.
Paul Pluzhnikov [Tue, 1 Sep 2015 15:48:15 +0000 (08:48 -0700)] 
Fix BZ #18757.

8 years agoFilter out NULL entries.
Paul Pluzhnikov [Tue, 1 Sep 2015 15:35:38 +0000 (08:35 -0700)] 
Filter out NULL entries.

8 years agoAdd netinet/in.h values from Linux 4.2.
Joseph Myers [Tue, 1 Sep 2015 13:47:25 +0000 (13:47 +0000)] 
Add netinet/in.h values from Linux 4.2.

This patch adds new constants from Linux 4.2 to netinet/in.h:
IPPROTO_MPLS and IP_BIND_ADDRESS_NO_PORT (both in
include/uapi/linux/in.h in Linux; one directly in netinet/in.h, one in
bits/in.h in glibc).

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

* inet/netinet/in.h (IPPROTO_MPLS): New enum value and macro.
* sysdeps/unix/sysv/linux/bits/in.h (IP_BIND_ADDRESS_NO_PORT): New
macro.

8 years agoAdd more TCP_* values to netinet/tcp.h.
Joseph Myers [Tue, 1 Sep 2015 13:45:49 +0000 (13:45 +0000)] 
Add more TCP_* values to netinet/tcp.h.

This patch adds move TCP_* values to sysdeps/gnu/netinet/tcp.h to
bring it up to date with Linux 4.2.  TCP_SAVE_SYN and TCP_SAVED_SYN
are new in 4.2, TCP_NOTSENT_LOWAT and TCP_CC_INFO are older (Szabolcs
previously noted in
<https://sourceware.org/ml/libc-alpha/2015-06/msg00938.html> that this
header was out of date in glibc).

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

* sysdeps/gnu/netinet/tcp.h (TCP_NOTSENT_LOWAT): New macro.
(TCP_CC_INFO): Likewise.
(TCP_SAVE_SYN): Likewise.
(TCP_SAVED_SYN): Likewise.

8 years agoFix non-v9 32-bit sparc build.
Brett Neumeier [Mon, 31 Aug 2015 22:27:21 +0000 (15:27 -0700)] 
Fix non-v9 32-bit sparc build.

[BZ #18870]
* sysdeps/sparc/sparc32/sem_open.c: Add missing #include

8 years agoFix broken overflow check in posix_fallocate [BZ 18873]
Paul Eggert [Wed, 26 Aug 2015 06:42:01 +0000 (23:42 -0700)] 
Fix broken overflow check in posix_fallocate [BZ 18873]

* sysdeps/posix/posix_fallocate.c (posix_fallocate):
* sysdeps/posix/posix_fallocate64.c (__posix_fallocate64_l64):
Fix parenthesization typo.

8 years agoNEWS: add #18887
Mike Frysinger [Sat, 29 Aug 2015 22:10:50 +0000 (18:10 -0400)] 
NEWS: add #18887

8 years agogetmntent: fix memory corruption w/blank lines [BZ #18887]
Mike Frysinger [Fri, 28 Aug 2015 21:08:49 +0000 (17:08 -0400)] 
getmntent: fix memory corruption w/blank lines [BZ #18887]

The fix for BZ #17273 introduced a single byte of memory corruption when
the line is entirely blank.  It would walk back past the start of the
buffer if the heap happened to be 0x20 or 0x09 and then write a NUL byte.
buffer = '\n';
end_ptr = buffer;
while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')
end_ptr--;
*end_ptr = '\0';

Fix that and rework the tests.  Adding the testcase for BZ #17273 to the
existing \040 parser does not really make sense as it's unrelated, and
leads to confusing behavior: it implicitly relies on the new entry being
longer than the previous entry (since it just rewinds the FILE*).  Split
it out into its own dedicated testcase instead.

8 years agode.po: fix SIGALRM typo [BZ #4404]
Mike Frysinger [Sat, 29 Aug 2015 20:43:43 +0000 (16:43 -0400)] 
de.po: fix SIGALRM typo [BZ #4404]

8 years agotime/tst-strptime2.c: test full input range +/- 0-9999
James Perkins [Mon, 17 Aug 2015 20:48:39 +0000 (13:48 -0700)] 
time/tst-strptime2.c: test full input range +/- 0-9999

strptime's %z specifier parses a string consisting of a sign ('+'
or '-'), two hours digits, and optionally two minutes digits, into a
tm.tm_gmtoff field containing the signed number of seconds the time
zone is offset from UTC time.

The time/tst-strptime2.c program passes a short list of strings through
strptime, validating that either the gmtoff value returned matches an
expected value, or that strptime returns an expected NULL for invalid
strings (for example, when the minutes portion of the string is outside
of the range 00 to 59, or the sign is missing before the hours digits).

In review of strptime fixes, Carlos O'Donell expressed a wish that
the test function iterate through the entire range of all possible
numeric strings (-9999 to +9999) which could be passed to strptime %z,
and validate the correct response.

Specifically, the test will look for a NULL response from strptime
when:

  * sign ('+' or '-') is not present before the first digit (invalid
    format).
  * A sign and no digits are found (invalid format).
  * A sign and one digit are found (invalid format).
  * A sign and three digits are found (invalid format).
  * A sign and four digits (-9999 to +9999) are found but the last
    two digits (minutes) are in the range 60 to 99.

The test will look for a success response from strptime with
tm.tm_gmtoff matching the calculated tm_gmtoff value when:

  * A sign and four digits are found (-9999 to +9999), and the last
    two digits (minutes) are in the range 00 to 59.
  * A sign and two digit strings are found (-99 to +99).

The test's iteration over the possible digit values results in 22223
test strings prepared, tested, and passed by strptime.

The test supports a --verbose command line option which will show
the test results of every test input, and a final summary of all
tests. Here is some sample output:

  PASS: input "1113472456  1030", expected: invalid, return value NULL
  PASS: input "1113472456 +", expected: invalid, return value NULL
  PASS: input "1113472456 -", expected: invalid, return value NULL
  PASS: input "1113472456 +0", expected: invalid, return value NULL
  PASS: input "1113472456 -0", expected: invalid, return value NULL
  PASS: input "1113472456 +1", expected: invalid, return value NULL
  ...
  PASS: input "1113472456 +9", expected: invalid, return value NULL
  PASS: input "1113472456 -9", expected: invalid, return value NULL
  PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0
  PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0
  PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600
  PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600
  PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200
  ...
  PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400
  PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400
  PASS: input "1113472456 +000", expected: invalid, return value NULL
  PASS: input "1113472456 -000", expected: invalid, return value NULL
  PASS: input "1113472456 +001", expected: invalid, return value NULL
  ...
  PASS: input "1113472456 +999", expected: invalid, return value NULL
  PASS: input "1113472456 -999", expected: invalid, return value NULL
  PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0
  PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0
  PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60
  PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60
  ...
  PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540
  PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540
  PASS: input "1113472456 +0060", expected: invalid, return value NULL
  PASS: input "1113472456 -0060", expected: invalid, return value NULL
  ...
  PASS: input "1113472456 +0099", expected: invalid, return value NULL
  PASS: input "1113472456 -0099", expected: invalid, return value NULL
  PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600
  PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600
  PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660
  ...
  PASS: input "1113472456 +9999", expected: invalid, return value NULL
  PASS: input "1113472456 -9999", expected: invalid, return value NULL
  PASS: 22223 input strings: 0 fail, 22223 pass

Any failing test will result in printing the failed line to stdout, and
will trigger the printing of the summary line at the of all tests. For
example:

  FAIL: input "1113472456  1030", expected: invalid, return value NULL,
    got: valid, tm.tm_gmtoff 37800
  FAIL: 22223 input strings: 1 fail, 22222 pass

8 years agostrptime %z: fix rounding, extend range to +/-9959 [BZ #16141]
James Perkins [Mon, 17 Aug 2015 20:48:38 +0000 (13:48 -0700)] 
strptime %z: fix rounding, extend range to +/-9959 [BZ #16141]

Topic: strptime supports a %z input field descriptor, which parses a
time zone offset from UTC time into the broken-out time field tm_gmtoff.

Problems:

1) In the current implementation, the minutes portion calculation is
correct only for minutes evenly divisible by 3. This is because the
minutes value is converted to decimal time, but inadequate precision
leads to rounding which calculates results that are too low for
some values.

For example, due to rounding, a +1159 offset string results in an
incorrect tm_gmtoff of 43128 (== 11 * 3600 + 58.8 * 60) seconds,
instead of 43140 (== 11 * 3600 + 59 * 60) seconds. In contrast,
a +1157 offset (minutes divisible by 3) does not cause the bug,
and results in a correct tm_gmtoff of 43020.

2) strptime's %z specifier will not parse time offsets less than
-1200 or greater than +1200, or if only hour digits are present, less
than -12 or greater than +12. It will return NULL for offsets outside
that range. These limits do not meet historical and modern use cases:

  * Present day exceeds the +1200 limit:
    - Pacific/Auckland (New Zealand) summer time is +1300.
    - Pacific/Kiritimati (Christmas Island) is +1400.
    - Pacific/Apia (Samoa) summer time is +1400.
  * Historical offsets exceeded +1500/-1500.
  * POSIX supports -2459 to +2559.
  * Offsets up to +/-9959 may occasionally be useful.
  * Paul Eggert's notes provide additional detail:
    - https://sourceware.org/ml/libc-alpha/2014-12/msg00068.html
    - https://sourceware.org/ml/libc-alpha/2014-12/msg00072.html

3) tst-strptime2, part of the 'make check' test suite, does not test
for the above problems.

Corrective actions:

1) In time/strptime_l.c, calculate the offset from the hour and
minute portions directly, without the rounding errors introduced by
decimal time.

2) Remove the +/-1200 range limit, permitting strptime to parse offsets
from -9959 through +9959.

3) Add zone offset values to time/tst-strptime2.c.

  * Test minutes evenly divisible by three (+1157) and not evenly
    divisible by three (+1158 and +1159).
  * Test offsets near the old and new range limits (-1201, -1330, -2459,
    -2500, -99, -9959, +1201, +1330, +1400, +1401, +2559, +2600, +99,
    and +9959)

The revised strptime passes all old and new tst-strptime2 tests.

8 years agoMention 15786 in NEWS
H.J. Lu [Fri, 28 Aug 2015 19:53:19 +0000 (12:53 -0700)] 
Mention 15786 in NEWS

commit f3dcae82d54e5097e18e1d6ef4ff55c2ea4e621e
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 25 04:33:54 2015 -0700

    Save and restore vector registers in x86-64 ld.so

also fixed

https://sourceware.org/bugzilla/show_bug.cgi?id=15786

8 years agoFix wordsize-32 mmap offset for negative value (BZ#18877)
Adhemerval Zanella [Thu, 27 Aug 2015 19:44:04 +0000 (16:44 -0300)] 
Fix wordsize-32 mmap offset for negative value (BZ#18877)

This patch fixes the default wordsize-32 mmap implementation offset
calculation for negative values.  Current code uses signed shift
operation to calculate the multiple size to use with syscall and
it is implementation defined.  Change it to use a division base
on mmap page size (default being as before, 4096).

Tested on armv7hf.

[BZ #18877]
* posix/Makefile (tests): Add tst-mmap-offset.
* posix/tst-mmap.c: New file.
* sysdeps/unix/sysv/linux/generic/wordsize-32/mmap.c (__mmap): Fix
offset calculation for negative values.

8 years agoNote bug 14941 as having been fixed in 2.18.
Joseph Myers [Thu, 27 Aug 2015 22:37:51 +0000 (22:37 +0000)] 
Note bug 14941 as having been fixed in 2.18.

8 years agoDetect and select i586/i686 implementation at run-time fedora/master
H.J. Lu [Thu, 27 Aug 2015 16:06:26 +0000 (09:06 -0700)] 
Detect and select i586/i686 implementation at run-time

We detect i586 and i686 features at run-time by checking CX8 and CMOV
CPUID features bits.  We can use these information to select the best
implementation in ix86 multiarch.  HAS_I586/HAS_I686 is true if i586/i686
instructions are available on the processor.

Due to the reordering and the other nifty extensions in i686, it is not
really good to use heavily i586 optimized code on an i686.  It's better
to use i486 code if it isn't an i586.  USE_I586/USE_I686 is true if
i586/i686 implementation should be used for the processor.  USE_I586
is true only if i686 instructions aren't available.  If i686 instructions
are available, we always choose i686 or i486 implementation, in that order,
and we never choose i586 implementation for i686-class processors.

* sysdeps/i386/init-arch.h: New file.
* sysdeps/i386/i586/init-arch.h: Likewise.
* sysdeps/i386/i686/init-arch.h: Likewise.
* sysdeps/x86/cpu-features.c (init_cpu_features): Set bit_I586
bit if CX8 is available.  Set bit_I686 bit if CMOV is available.
* sysdeps/x86/cpu-features.h (bit_I586): New.
(bit_I686): Likewise.
(bit_CX8): Likewise.
(bit_CMOV): Likewise.
(index_CX8): Likewise.
(index_CMOV): Likewise.
(index_I586): Likewise.
(index_I686): Likewise.
(reg_CX8): Likewise.
(reg_CMOV): Likewise.
(HAS_I586): Defined as HAS_ARCH_FEATURE (I586) if i586 isn't
available at compile-time.
(HAS_I686): Defined as HAS_ARCH_FEATURE (I686) if i686 isn't
available at compile-time.
* sysdeps/x86/init-arch.h (USE_I586): New macro.
(USE_I686): Likewise.

8 years agoAdd i386 memset and memcpy assembly functions
H.J. Lu [Thu, 27 Aug 2015 16:04:40 +0000 (09:04 -0700)] 
Add i386 memset and memcpy assembly functions

Add i386 memset and memcpy assembly functions with REP MOVSB/STOSB
instructions.

* sysdeps/i386/bcopy.S: New file.
* sysdeps/i386/bzero.S: Likewise.
* sysdeps/i386/memcpy.S: Likewise.
* sysdeps/i386/memmove.S: Likewise.
* sysdeps/i386/mempcpy.S: Likewise.
* sysdeps/i386/memset.S: Likewise.
* sysdeps/i386/bzero.c: Removed.
* sysdeps/i386/memset.c: Likewise.
* sysdeps/i386/i586/memcpy_chk.S: Likewise.
* sysdeps/i386/i586/mempcpy_chk.S: Likewise.
* sysdeps/i386/i586/memset_chk.S: Likewise.
* sysdeps/i386/i686/memcpy_chk.S: Moved to ...
* sysdeps/i386/memcpy_chk.S: Here.
* sysdeps/i386/i686/memmove_chk.S: Moved to ...
* sysdeps/i386/memmove_chk.S: Here.
* sysdeps/i386/i686/mempcpy_chk.S: Moved to ...
* sysdeps/i386/mempcpy_chk.S: Likewise.
* sysdeps/i386/i686/memset_chk.S: Moved to ...
* sysdeps/i386/memset_chk.S: Likewise.

8 years ago Fix undefined warning messages in GCC 6.
Steve Ellcey [Thu, 27 Aug 2015 15:09:49 +0000 (08:09 -0700)] 
Fix undefined warning messages in GCC 6.

    GCC 6 puts out warnings in a different location then GCC 5.  Move the
    DIAG macros so that the warnings are supressed for both compilers.

    ChangeLog:

* soft-fp/fmasf4.c: Add include of sys/cdefs.h.
Move DIAG_PUSH_NEEDS_COMMENT, DIAG_IGNORE_NEEDS_COMMENT to front of
file, move DIAG_POP_NEEDS_COMMENT to end of file.
* soft-fp/fmadf4.c: Ditto.
* soft-fp/fmatf4.c: Ditto.

8 years agoRemove i486 subdirectory
H.J. Lu [Thu, 27 Aug 2015 14:59:06 +0000 (07:59 -0700)] 
Remove i486 subdirectory

Since glibc doesn't support i386 any more, we can remove i486 subdirectory.

* sysdeps/i386/i586/Implies: Removed.
* sysdeps/i386/i686/Implies: Likewise.

8 years agoMove i486/strlen.S to strlen.S
H.J. Lu [Thu, 27 Aug 2015 14:57:36 +0000 (07:57 -0700)] 
Move i486/strlen.S to strlen.S

Since glibc doesn't support i386 any more, we can move i486/strlen.S
to strlen.S.

* sysdeps/i386/i486/strlen.S: Moved to ...
* sysdeps/i386/strlen.S: Here.

8 years agoMove i486/strcat.S to strcat.S
H.J. Lu [Thu, 27 Aug 2015 14:56:19 +0000 (07:56 -0700)] 
Move i486/strcat.S to strcat.S

Since glibc doesn't support i386 any more, we can move i486/strcat.S
to strcat.S.

* sysdeps/i386/i486/strcat.S: Moved to ...
* sysdeps/i386/strcat.S: Here.
* sysdeps/i386/i686/multiarch/strcat.S: Updated.

8 years agoMove i486/pthread_spin_trylock.S to pthread_spin_trylock.S
H.J. Lu [Thu, 27 Aug 2015 14:55:13 +0000 (07:55 -0700)] 
Move i486/pthread_spin_trylock.S to pthread_spin_trylock.S

Since glibc doesn't support i386 any more, we can move
i486/pthread_spin_trylock.S to pthread_spin_trylock.S

* sysdeps/i386/i486/pthread_spin_trylock.S: Moved to ...
* sysdeps/i386/pthread_spin_trylock.S: Here.
* sysdeps/i386/i586/pthread_spin_trylock.S: Removed.
* sysdeps/i386/i686/pthread_spin_trylock.S: Updated.

8 years agoMove i486/string-inlines.c to string-inlines.c
H.J. Lu [Thu, 27 Aug 2015 14:51:35 +0000 (07:51 -0700)] 
Move i486/string-inlines.c to string-inlines.c

Since glibc doesn't support i386 any more, we can move
i486/string-inlines.c to string-inlines.c.

* sysdeps/i386/i486/string-inlines.c: Moved to ...
* sysdeps/i386/string-inlines.c: Here.

8 years agoMove i486/htonl.S to htonl.S
H.J. Lu [Thu, 27 Aug 2015 14:50:23 +0000 (07:50 -0700)] 
Move i486/htonl.S to htonl.S

Since glibc doesn't support i386 any more, we can move i486/htonl.S to
htonl.S.

* sysdeps/i386/i486/htonl.S: Moved ...
* sysdeps/i386/htonl.S: here.

8 years agoMove i486/bits/atomic.h to bits/atomic.h
H.J. Lu [Thu, 27 Aug 2015 14:49:10 +0000 (07:49 -0700)] 
Move i486/bits/atomic.h to bits/atomic.h

Since glibc doesn't support i386 any more, we can move i486/bits/atomic.h
to bits/atomic.h.

* sysdeps/i386/i486/bits/atomic.h: Moved to ...
* sysdeps/i386/bits/atomic.h: Here.

8 years agoRemove sysdeps/i386/i486/Versions
H.J. Lu [Thu, 27 Aug 2015 14:44:51 +0000 (07:44 -0700)] 
Remove sysdeps/i386/i486/Versions

sysdeps/i386/i486/Versions isn't needed since it duplicates contents
in sysdeps/i386/Versions.

* sysdeps/i386/i486/Versions: Removed.

8 years agoMention mkdtemp as another secure alternative to mktemp
Gleb Fotengauer-Malinovskiy [Sun, 9 Aug 2015 09:11:36 +0000 (11:11 +0200)] 
Mention mkdtemp as another secure alternative to mktemp

[BZ #2898]
* misc/mktemp.c: Add mkdtemp to the link_warning message.
Based on patch by Aurelien Jarno.

8 years agoDisable uninitialized warning with GCC 4.8
Stan Shebs [Wed, 26 Aug 2015 23:10:00 +0000 (16:10 -0700)] 
Disable uninitialized warning with GCC 4.8

As with other spots in the code, GCC 4.8 unnecessarily complains about
an uninitialized variable in tanl calcs, so this patch disables.  With
it, the library and sees the usual set of test passes.

* sysdeps/ieee754/ldbl-96/k_tanl.c: Include <libc-internal.h>.
(__kernel_tanl): Ignore uninitialized warnings around use of SIGN.

8 years agoMeaningless ChangeLog cleanup to trigger buildbot.
Roland McGrath [Wed, 26 Aug 2015 21:06:09 +0000 (14:06 -0700)] 
Meaningless ChangeLog cleanup to trigger buildbot.

8 years agopowerpc: Sync hwcap.h with kernel
Carlos Eduardo Seo [Wed, 19 Aug 2015 04:42:55 +0000 (01:42 -0300)] 
powerpc: Sync hwcap.h with kernel

Linux commit b4b56f9ecab40f3b4ef53e130c9f6663be491894 introduced
a new HWCAP2 bit to indicate that the kernel now aborts a memory
transaction when a syscall is made.  This patch adds that bit to
sysdeps/powerpc/bits/hwcap.h.

2015-08-26  Carlos Eduardo Seo  <cseo@linux.vnet.ibm.com>

* sysdeps/powerpc/bits/hwcap.h: Add PPC_FEATURE2_HTM_NOSC.
* sysdeps/powerpc/dl-procinfo.c:
(_dl_powerpc_cap_flags): Added descriptor for this hwcap
feature so it shows when LD_SHOW_AUXV=1.

8 years agopowerpc: Revert to default atomic ops in elision code
Paul E. Murphy [Thu, 13 Aug 2015 21:21:05 +0000 (16:21 -0500)] 
powerpc: Revert to default atomic ops in elision code

Power ISA 2.07B section B.5.5 relaxed the barrier requirement around a
TLE enabled lock.  It is now identical to a traditional lock.

2015-08-26  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>

* sysdeps/unix/sysv/linux/powerpc/elision-lock.c
(__arch_compare_and_exchange_val_32_acq): Remove and use common
definition.  ISA 2.07B no longer requires full sync.

8 years agomips: siginfo.h: add SIGSYS details [BZ #18863]
Mike Frysinger [Wed, 26 Aug 2015 04:26:10 +0000 (00:26 -0400)] 
mips: siginfo.h: add SIGSYS details [BZ #18863]

Linux 3.13 added SIGSYS details to siginfo_t; update glibc's copy to
keep in sync with it.

8 years agoReplace BZERO_P/PIC with USE_AS_BZERO/SHARED
H.J. Lu [Wed, 26 Aug 2015 15:00:47 +0000 (08:00 -0700)] 
Replace BZERO_P/PIC with USE_AS_BZERO/SHARED

Replace BZERO_P with USE_AS_BZERO in i586/i686 memset.S to support i386
multi-arch memset.  Also we should check SHARED not PIC for libc.so
since libc.a may be compiled with PIC.

* sysdeps/i386/i586/bzero.S (USE_AS_BZERO): New.
* sysdeps/i386/i686/bzero.S (USE_AS_BZERO): Likewise.
* sysdeps/i386/i586/memset.S (BZERO_P): Removed.
Check USE_AS_BZERO/SHARED instead of BZERO_P/PIC.
(__memset_zero_constant_len_parameter): New.
* sysdeps/i386/i686/memset.S (BZERO_P): Removed.
Check USE_AS_BZERO/SHARED instead of BZERO_P/PIC.
(__memset_zero_constant_len_parameter): Don't define if
__memset_chk or USE_AS_BZERO are defined.

8 years agoReplace MEMPCPY_P/PIC with USE_AS_MEMPCPY/SHARED
H.J. Lu [Wed, 26 Aug 2015 14:59:15 +0000 (07:59 -0700)] 
Replace MEMPCPY_P/PIC with USE_AS_MEMPCPY/SHARED

Replace MEMPCPY_P with USE_AS_MEMPCPY in i586 memcpy.S to support i386
multi-arch memcpy.  Also we should check SHARED not PIC for libc.so
since libc.a may be compiled with PIC.

* sysdeps/i386/i586/memcpy.S (MEMPCPY_P): Removed.
Check USE_AS_MEMPCPY/SHARED instead of MEMPCPY_P/PIC.
* sysdeps/i386/i586/mempcpy.S (USE_AS_MEMPCPY): New.

8 years agoDon't disable SSE in x86-64 ld.so
H.J. Lu [Wed, 26 Aug 2015 14:55:42 +0000 (07:55 -0700)] 
Don't disable SSE in x86-64 ld.so

Since x86-64 ld.so preserves vector registers now, we can use SSE in
x86-64 ld.so.  We should run tst-ld-sse-use.sh only on i386.

* sysdeps/x86/Makefile [$(subdir) == elf] (CFLAGS-.os,
tests-special, $(objpfx)tst-ld-sse-use.out): Moved to ...
* sysdeps/i386/Makefile [$(subdir) == elf] (CFLAGS-.os,
tests-special, $(objpfx)tst-ld-sse-use.out): Here.  Update
comments.
* sysdeps/x86_64/Makefile [$(subdir) == elf] (CFLAGS-.os): Add
-mno-mmx for $(all-rtld-routines).
* sysdeps/x86/tst-ld-sse-use.sh: Moved to ...
* sysdeps/i386/tst-ld-sse-use.sh: Here.  Replace x86-64 with
i386.

8 years agoAdjust _Unwind_Word in unwind.h to version in libgcc.
Stefan Liebler [Wed, 26 Aug 2015 08:26:26 +0000 (10:26 +0200)] 
Adjust _Unwind_Word in unwind.h to version in libgcc.

Building glibc on s390-32 with gcc option -mzarch produces the error due to
sysdeps/s390/jmpbuf-unwind.h:37:10: (void *) (_Unwind_GetCFA  (_context):
cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

Building on s390-32 in esa-mode or s390-64 is fine.

_Unwind_GetCFA returns an _Unwind_Word which is an unsigned
with a size of 4 bytes on s390-32 (esa-mode) and 8 bytes on s390-64.
On s390-32 (zarch-mode), _Unwind_Word has a size of 8 bytes, too.

_Unwind_Word is defined in sysdeps/generic/unwind.h as
typedef unsigned _Unwind_Word __attribute__((__mode__(__word__)));

In libgcc unwind header (<gcc-src>/libgcc/unwind-generic.h) this typedef has
changed to "typedef unsigned _Unwind_Word __attribute__((__mode__(__unwind_word__)));"
in June 2008.

With this mode, _Unwind_Word has a size of 4 bytes on s390-32 (zarch-mode).
The same change applies to _Unwind_Sword.
Thus this patch updates the unwind header according to these changes.

Afterwards, the int-to-pointer-cast-warning is gone away on s390-32 (zarch-mode)
and the testsuite runs with the same test-failures as s390-32 (esa-mode)
plus FAIL: c++-types-check. Here register_t is expected to has a size of 4 bytes,
but it has a size of 8 bytes due to:
posix/sys/types.h:205:typedef int register_t __attribute__ ((__mode__ (__word__)));

The libgcc-patch for gcc 4.4 can be found here:
"[PATCH, spu, unwind] Remove attribute ((mode (word))) from unwind.h"
https://gcc.gnu.org/ml/gcc-patches/2008-06/msg00969.html

ChangeLog:

* sysdeps/generic/unwind.h
(_Unwind_Word): Use __mode__(__unwind_word__)
instead of __mode__(__word__).
(_Unwind_Sword): Likewise.

8 years agoS390: Fix build error with gcc6 in utf8_utf16-z9.c.
Stefan Liebler [Wed, 26 Aug 2015 08:26:26 +0000 (10:26 +0200)] 
S390: Fix build error with gcc6 in utf8_utf16-z9.c.

This patch fixes the build error with gcc6:
array subscript is above array bounds [-Werror=array-bounds]

While including loop.c to construct the SINGLE(LOOPFCT) method
for converting from UTF-16 to UTF-8, the bytebuf array with length
MAX_NEEDED_INPUT is used as inptr. MAX_NEEDED_INPUT defaults to
MIN_NEEDED_INPUT if not defined before including loop.c.
Thus bytebuf has a length of 2.
This patch defines MAX_NEEDED_INPUT to MAX_NEEDED_TO, which is 4.

ChangeLog:

* sysdeps/s390/s390-64/utf8-utf16-z9.c
(MAX_NEEDED_INPUT): New define.
(MAX_NEEDED_OUTPUT): New define.

8 years agoS390: Optimize string, wcsmbs and memory functions.
Stefan Liebler [Wed, 26 Aug 2015 08:26:26 +0000 (10:26 +0200)] 
S390: Optimize string, wcsmbs and memory functions.

This patch set introduces optimized string, wcsmbs and memory functions for
S390/S390x. The functions are accelerated by the usage of the new z13 vector
instructions.

The Principles of Operations manual for IBM z13 is publically available:
http://publibfi.boulder.ibm.com/epubs/pdf/dz9zr010.pdf

The support for these instructions in assembler was introduced by commits:
-"[Committed] S/390: Add support for IBM z13."
 (https://sourceware.org/ml/binutils/2015-01/msg00197.html)
-"[Committed] S/390: Add more IBM z13 instructions"
 (https://sourceware.org/ml/binutils/2015-03/msg00088.html)

The first patches do preparation for the latter optimization patches.
The floating point exception handling - fetestexcept(), ... - is fixed and
the platform and hwcap strings are extended.
The current ifunc routines memset, memcpy and memcmp are refactored and the
ifunc test-framework is now enabled.
A S390 specific configure-check tests if the used binutils supports the new
vector instructions. The optimized functions are provided via ifunc if the
binutils supports the vector instructions. Otherwise a message is dumped to
configure output and only the currently used common code functions are
available.

The optimized functions are implemented in common for s390-32 and s390-64
and the few differences are handled via #ifdef.

The ifunc-resolvers are defined in files sysdeps/s390/multiarch/<func>.c,
which choose either the current implementation __<func>_c() or the vector
implementation __<func>_vx() depending on the HWCAP_S390_VX flag bit in
AT_HWCAP field. If the bit is set, the hardware and the kernel are supporting
vector registers and instructions. If the used binutils lacks vector-support,
then the default implementation in string or wcsmbs directory is included
here instead.
The file sysdeps/s390/multiarch/<func>-c.c includes the current implementation
and defines the function name __<func>_c.
The assembler files sysdeps/s390/multiarch/<func>-vx.S with the vector
instructions are using the directive '.machine "z13"' to allow building glibc
without option '-march=z13'. Additionally the directive '.machinemode
"zarch_nohighgprs"' is needed for the 31bit glibc. This mode does not set the
highgprs flag in ELF header, which would lead to an unloadable libc on a 31bit
kernel.

The most optimized string functions are structured in the same way:
The first 16 bytes of the string is loaded unaligned via vlbb - vector load
to block boundary (e.g. 4k). This instruction loads 16 bytes if possible.
In case of a page cross, it only loads the last bytes of the current page
without a segmentation fault.
Afterwards these first part of string is processed. If e.g. for strlen the end
of string is reached within this first part, the function returns. Otherwise
the pointer is aligned to 16 byte, so i can load a full vector register with vl
without checking for a page cross. Afterwards the first part of string is
processed. If e.g. for strlen the end of string is reached within this first
part, the function returns. Otherwise the pointer is aligned to 16 byte, so
a full vector register can be loaded with vl - vector load - without checking
for a page cross. The remaining string is processed in a four times unrolled
loop, because benchmark results measured improvements compared to a non
unrolled loop.

The optimized wide string functions can only handle 4byte aligned string
pointers. Although a wchar_t pointer should always be 4byte aligned, the most
current common code wide string functions can handle non aligned strings.
Thus the optimized functions will fall back to the common code functions in
case of a non aligned wide string to behave the same as before this patch.

Some string tests can test the string and the wide string version of a function.
The remaining ones are extended and new wide string tests are added.
This is the same in case of the benchtests.

ChangeLog:

* NEWS: New item for IBM z13 string optimizations.

8 years agoS390: Optimize memrchr.
Stefan Liebler [Wed, 26 Aug 2015 08:26:26 +0000 (10:26 +0200)] 
S390: Optimize memrchr.

This patch provides optimized version of memrchr with the z13 vector
instructions.

ChangeLog:

* sysdeps/s390/multiarch/memrchr-c.c: New File.
* sysdeps/s390/multiarch/memrchr-vx.S: Likewise.
* sysdeps/s390/multiarch/memrchr.c: Likewise.
* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Add memrchr functions.
* sysdeps/s390/multiarch/ifunc-impl-list-common.c
(__libc_ifunc_impl_list_common): Add ifunc test for memrchr.

8 years agoS390: Optimize wmemcmp.
Stefan Liebler [Wed, 26 Aug 2015 08:26:25 +0000 (10:26 +0200)] 
S390: Optimize wmemcmp.

This patch provides optimized version of wmemcmp with the z13 vector
instructions.

ChangeLog:

* sysdeps/s390/multiarch/wmemcmp-c.c: New File.
* sysdeps/s390/multiarch/wmemcmp-vx.S: Likewise.
* sysdeps/s390/multiarch/wmemcmp.c: Likewise.
* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Add wmemcmp functions.
* sysdeps/s390/multiarch/ifunc-impl-list-common.c
(__libc_ifunc_impl_list_common): Add ifunc test for wmemcmp.
* benchtests/bench-wmemcmp.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wmemcmp.

8 years agoS390: Optimize wmemset.
Stefan Liebler [Wed, 26 Aug 2015 08:26:25 +0000 (10:26 +0200)] 
S390: Optimize wmemset.

This patch provides optimized version of wmemset with the z13 vector
instructions.

ChangeLog:

* sysdeps/s390/multiarch/wmemset-c.c: New File.
* sysdeps/s390/multiarch/wmemset-vx.S: Likewise.
* sysdeps/s390/multiarch/wmemset.c: Likewise.
* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Add wmemset functions.
* sysdeps/s390/multiarch/ifunc-impl-list-common.c
(__libc_ifunc_impl_list_common): Add ifunc test for wmemset.
* wcsmbs/wmemset.c: Use WMEMSET if defined.
* string/test-memset.c: Add wmemset support.
* wcsmbs/test-wmemset.c: New File.
* wcsmbs/Makefile (strop-tests): Add wmemset.
* benchtests/bench-memset.c: Add wmemset support.
* benchtests/bench-wmemset.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wmemset.

8 years agoS390: Optimize memccpy.
Stefan Liebler [Wed, 26 Aug 2015 08:26:25 +0000 (10:26 +0200)] 
S390: Optimize memccpy.

This patch provides optimized versions of memccpy with the z13 vector
instructions.

ChangeLog:

* sysdeps/s390/multiarch/memccpy-c.c: New File.
* sysdeps/s390/multiarch/memccpy-vx.S: Likewise.
* sysdeps/s390/multiarch/memccpy.c: Likewise.
* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Add memccpy functions.
* sysdeps/s390/multiarch/ifunc-impl-list-common.c
(__libc_ifunc_impl_list_common): Add ifunc test for memccpy.
* string/memccpy.c: Use MEMCCPY if defined.

8 years agoS390: Optimize memchr, rawmemchr and wmemchr.
Stefan Liebler [Wed, 26 Aug 2015 08:26:24 +0000 (10:26 +0200)] 
S390: Optimize memchr, rawmemchr and wmemchr.

This patch provides optimized versions of memchr, rawmemchr and wmemchr with the
z13 vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/memchr-vx.S: New File.
* sysdeps/s390/multiarch/memchr.c: Likewise.
* sysdeps/s390/multiarch/rawmemchr-c.c: Likewise.
* sysdeps/s390/multiarch/rawmemchr-vx.S: Likewise.
* sysdeps/s390/multiarch/rawmemchr.c: Likewise.
* sysdeps/s390/multiarch/wmemchr-c.c: Likewise.
* sysdeps/s390/multiarch/wmemchr-vx.S: Likewise.
* sysdeps/s390/multiarch/wmemchr.c: Likewise.
* sysdeps/s390/s390-32/multiarch/memchr.c: Likewise.
* sysdeps/s390/s390-64/multiarch/memchr.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add memchr, wmemchr
and rawmemchr functions.
* sysdeps/s390/multiarch/ifunc-impl-list-common.c
(__libc_ifunc_impl_list_common): Add ifunc test for memchr, rawmemchr
and wmemchr.
* wcsmbs/wmemchr.c: Use WMEMCHR if defined.
* string/test-memchr.c: Add wmemchr support.
* wcsmbs/test-wmemchr.c: New File.
* wcsmbs/Makefile (strop-tests): Add wmemchr.
* benchtests/bench-memchr.c: Add wmemchr support.
* benchtests/bench-wmemchr.c: New File.
* benchtests/Makefile (wcsmbs-bench): wmemchr.

8 years agoS390: Optimize strcspn and wcscspn.
Stefan Liebler [Wed, 26 Aug 2015 08:26:24 +0000 (10:26 +0200)] 
S390: Optimize strcspn and wcscspn.

This patch provides optimized versions of strcspn and wcscspn with the z13
vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/strcspn-c.c: New File.
* sysdeps/s390/multiarch/strcspn-vx.S: Likewise.
* sysdeps/s390/multiarch/strcspn.c: Likewise.
* sysdeps/s390/multiarch/wcscspn-c.c: Likewise.
* sysdeps/s390/multiarch/wcscspn-vx.S: Likewise.
* sysdeps/s390/multiarch/wcscspn.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strcspn and
wcscspn functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strcspn, wcscspn.
* wcsmbs/wcscspn.c: Use WCSCSPN if defined.
* string/test-strcspn.c: Add wcscspn support.
* wcsmbs/test-wcscspn.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcscspn.
* benchtests/bench-strcspn.c: Add wcscspn support.
* benchtests/bench-wcscspn.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcscspn.

8 years agoS390: Optimize strpbrk and wcspbrk.
Stefan Liebler [Wed, 26 Aug 2015 08:26:24 +0000 (10:26 +0200)] 
S390: Optimize strpbrk and wcspbrk.

This patch provides optimized versions of strpbrk and wcspbrk with the z13
vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/strpbrk-c.c: New File.
* sysdeps/s390/multiarch/strpbrk-vx.S: Likewise.
* sysdeps/s390/multiarch/strpbrk.c: Likewise.
* sysdeps/s390/multiarch/wcspbrk-c.c: Likewise.
* sysdeps/s390/multiarch/wcspbrk-vx.S: Likewise.
* sysdeps/s390/multiarch/wcspbrk.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strpbrk and
wcspbrk functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strpbrk, wcspbrk.
* wcsmbs/wcspbrk.c: Use WCSPBRK if defined.
* string/test-strpbrk.c: Add wcspbrk support.
* wcsmbs/test-wcspbrk.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcspbrk.
* benchtests/bench-strpbrk.c: Add wcspbrk support.
* benchtests/bench-wcspbrk.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcspbrk.

8 years agoS390: Optimize strspn and wcsspn.
Stefan Liebler [Wed, 26 Aug 2015 08:26:24 +0000 (10:26 +0200)] 
S390: Optimize strspn and wcsspn.

This patch provides optimized versions of strspn and wcsspn with the z13
vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/strspn-c.c: New File.
* sysdeps/s390/multiarch/strspn-vx.S: Likewise.
* sysdeps/s390/multiarch/strspn.c: Likewise.
* sysdeps/s390/multiarch/wcsspn-c.c: Likewise.
* sysdeps/s390/multiarch/wcsspn-vx.S: Likewise.
* sysdeps/s390/multiarch/wcsspn.c: Likewise.
* wcsmbs/wcsspn.c: Use WCSSPN if defined.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strspn and
wcsspn functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strspn, wcsspn.
* string/test-strspn.c: Add wcsspn support.
* wcsmbs/test-wcsspn.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcsspn.
* benchtests/bench-strspn.c: Add wcsspn support.
* benchtests/bench-wcsspn.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcsspn.

8 years agoS390: Optimize strrchr and wcsrchr.
Stefan Liebler [Wed, 26 Aug 2015 08:26:23 +0000 (10:26 +0200)] 
S390: Optimize strrchr and wcsrchr.

This patch provides optimized versions of strrchr and wcsrchr with the z13
vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/strrchr-c.c: New File.
* sysdeps/s390/multiarch/strrchr-vx.S: Likewise.
* sysdeps/s390/multiarch/strrchr.c: Likewise.
* sysdeps/s390/multiarch/wcsrchr-c.c: Likewise.
* sysdeps/s390/multiarch/wcsrchr-vx.S: Likewise.
* sysdeps/s390/multiarch/wcsrchr.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strrchr and
wcsrchr functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strrchr, wcsrchr.
* benchtests/bench-wcsrchr.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcsrchr.

8 years agoS390: Optimize strchrnul and wcschrnul.
Stefan Liebler [Wed, 26 Aug 2015 08:26:23 +0000 (10:26 +0200)] 
S390: Optimize strchrnul and wcschrnul.

This patch provides optimized versions of strchrnul and wcschrnul with the z13
vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/strchrnul-c.c: New File.
* sysdeps/s390/multiarch/strchrnul-vx.S: Likewise.
* sysdeps/s390/multiarch/strchrnul.c: Likewise.
* sysdeps/s390/multiarch/wcschrnul-c.c: Likewise.
* sysdeps/s390/multiarch/wcschrnul-vx.S: Likewise.
* sysdeps/s390/multiarch/wcschrnul.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strchrnul and
wcschrnul functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strchrnul, wcschrnul.
* wcsmbs/wcschrnul.c: Use WCSCHRNUL if defined.
* string/test-strchr.c: Add wcschrnul support.
* wcsmbs/test-wcschrnul.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcschrnul.
* benchtests/bench-strchr.c: Add wcschrnul support.
* benchtests/bench-wcschrnul.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcschrnul.

8 years agoS390: Optimize strchr and wcschr.
Stefan Liebler [Wed, 26 Aug 2015 08:26:23 +0000 (10:26 +0200)] 
S390: Optimize strchr and wcschr.

This patch provides optimized versions of strchr and wcschr with the z13
vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/strchr-c.c: New File.
* sysdeps/s390/multiarch/strchr-vx.S: Likewise.
* sysdeps/s390/multiarch/strchr.c: Likewise.
* sysdeps/s390/multiarch/wcschr-c.c: Likewise.
* sysdeps/s390/multiarch/wcschr-vx.S: Likewise.
* sysdeps/s390/multiarch/wcschr.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strchr and
wcschr functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strchr, wcschr.
* string/strchr.c (STRCHR): Define and use macro.
* benchtests/bench-wcschr.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcschr.

8 years agoS390: Optimize strncmp and wcsncmp.
Stefan Liebler [Wed, 26 Aug 2015 08:26:22 +0000 (10:26 +0200)] 
S390: Optimize strncmp and wcsncmp.

This patch provides optimized versions of strncmp and wcsncmp with the z13
vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/strncmp-c.c: New File.
* sysdeps/s390/multiarch/strncmp-vx.S: Likewise.
* sysdeps/s390/multiarch/strncmp.c: Likewise.
* sysdeps/s390/multiarch/wcsncmp-c.c: Likewise.
* sysdeps/s390/multiarch/wcsncmp-vx.S: Likewise.
* sysdeps/s390/multiarch/wcsncmp.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strncmp and
wcsncmp functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strncmp, wcsncmp.
* wcsmbs/wcsncmp.c (WCSNCMP): Define and use macro.
* benchtests/bench-strncmp.c: Add wcsncmp support.
* benchtests/bench-wcsncmp.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcsncmp.

8 years agoS390: Optimize strcmp and wcscmp.
Stefan Liebler [Wed, 26 Aug 2015 08:26:22 +0000 (10:26 +0200)] 
S390: Optimize strcmp and wcscmp.

This patch provides optimized versions of strcmp and wcscmp with the z13
vector instructions.

The architecture specific string.h had a typo, which leads to ommiting the
inline version in this file if __USE_STRING_INLINES is defined.
Tested this inline version by tweaking test-strcmp.c.

ChangeLog:

* sysdeps/s390/multiarch/strcmp-vx.S: New File.
* sysdeps/s390/multiarch/strcmp.c: Likewise.
* sysdeps/s390/multiarch/wcscmp-c.c: Likewise.
* sysdeps/s390/multiarch/wcscmp-vx.S: Likewise.
* sysdeps/s390/multiarch/wcscmp.c: Likewise.
* sysdeps/s390/s390-32/multiarch/strcmp.c: Likewise.
* sysdeps/s390/s390-64/multiarch/strcmp.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strcmp and
wcscmp functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strcmp, wcscmp.
* string/strcmp.c (STRCMP): Define and use macro.
* benchtests/bench-wcscmp.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcscmp.
* sysdeps/s390/bits/string.h: Fix typo: _HAVE_STRING_ARCH_strcmp
instead of _HAVE_STRING_ARCH_memchr.

8 years agoS390: Optimize strncat wcsncat.
Stefan Liebler [Wed, 26 Aug 2015 08:26:22 +0000 (10:26 +0200)] 
S390: Optimize strncat wcsncat.

This patch provides optimized versions of strncat and wcsncat with the z13
vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/strncat-c.c: New File.
* sysdeps/s390/multiarch/strncat-vx.S: Likewise.
* sysdeps/s390/multiarch/strncat.c: Likewise.
* sysdeps/s390/multiarch/wcsncat-c.c: Likewise.
* sysdeps/s390/multiarch/wcsncat-vx.S: Likewise.
* sysdeps/s390/multiarch/wcsncat.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strncat and
wcsncat functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strncat, wcsncat.
* wcsmbs/wcsncat.c (WCSNCAT): Define and use macro.
* string/test-strncat.c: Add wcsncat support.
* wcsmbs/test-wcsncat.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcsncat.
* benchtests/bench-strncat.c: Add wcsncat support.
* benchtests/bench-wcsncat.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcsncat.

8 years agoS390: Optimize strcat and wcscat.
Stefan Liebler [Wed, 26 Aug 2015 08:26:21 +0000 (10:26 +0200)] 
S390: Optimize strcat and wcscat.

This patch provides optimized versions of strcat and wcscat with the z13
vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/strcat-c.c: New File.
* sysdeps/s390/multiarch/strcat-vx.S: Likewise.
* sysdeps/s390/multiarch/strcat.c: Likewise.
* sysdeps/s390/multiarch/wcscat-c.c: Likewise.
* sysdeps/s390/multiarch/wcscat-vx.S: Likewise.
* sysdeps/s390/multiarch/wcscat.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strcat and
wcscat functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strcat, wcscat.
* string/strcat.c (STRCAT): Define and use macro.
* wcsmbs/wcscat.c: Use WCSCAT if defined.
* string/test-strcat.c: Add wcscat support.
* wcsmbs/test-wcscat.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcscat.
* benchtests/bench-strcat.c: Add wcscat support.
* benchtests/bench-wcscat.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcscat.

8 years agoS390: Optimize stpncpy and wcpncpy.
Stefan Liebler [Wed, 26 Aug 2015 08:26:21 +0000 (10:26 +0200)] 
S390: Optimize stpncpy and wcpncpy.

This patch provides optimized versions of stpncpy and wcpncpy with the z13
vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/stpncpy-c.c: New File.
* sysdeps/s390/multiarch/stpncpy-vx.S: Likewise.
* sysdeps/s390/multiarch/stpncpy.c: Likewise.
* sysdeps/s390/multiarch/wcpncpy-c.c: Likewise.
* sysdeps/s390/multiarch/wcpncpy-vx.S: Likewise.
* sysdeps/s390/multiarch/wcpncpy.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add stpncpy and
wcpncpy functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for stpncpy, wcpncpy.
* wcsmbs/wcpncpy.c: Use WCPNCPY if defined.
* string/test-stpncpy.c: Add wcpncpy support.
* wcsmbs/test-wcpncpy.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcpncpy.
* benchtests/bench-stpncpy.c: Add wcpncpy support.
* benchtests/bench-wcpncpy.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcpncpy.

8 years agoS390: Optimize strncpy and wcsncpy.
Stefan Liebler [Wed, 26 Aug 2015 08:26:21 +0000 (10:26 +0200)] 
S390: Optimize strncpy and wcsncpy.

This patch provides optimized versions of strncpy and wcsncpy with the z13
vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/strncpy-vx.S: New File.
* sysdeps/s390/multiarch/strncpy.c: Likewise.
* sysdeps/s390/multiarch/wcsncpy-c.c: Likewise.
* sysdeps/s390/multiarch/wcsncpy-vx.S: Likewise.
* sysdeps/s390/multiarch/wcsncpy.c: Likewise.
* sysdeps/s390/s390-32/multiarch/strncpy.c: Likewise.
* sysdeps/s390/s390-64/multiarch/strncpy.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strncpy and
wcsncpy functions.
* wcsmbs/wcsncpy.c: Use WCSNCPY if defined.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strncpy, wcsncpy.
* string/test-strncpy.c: Add wcsncpy support.
* wcsmbs/test-wcsncpy.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcsncpy.
* benchtests/bench-strncpy.c: Add wcsncpy support.
* benchtests/bench-wcsncpy.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcsncpy

8 years agoS390: Optimize stpcpy and wcpcpy.
Stefan Liebler [Wed, 26 Aug 2015 08:26:21 +0000 (10:26 +0200)] 
S390: Optimize stpcpy and wcpcpy.

This patch provides optimized versions of stpcpy and wcpcpy with the z13
vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/stpcpy-c.c: New File.
* sysdeps/s390/multiarch/stpcpy-vx.S: Likewise.
* sysdeps/s390/multiarch/stpcpy.c: Likewise.
* sysdeps/s390/multiarch/wcpcpy-c.c: Likewise.
* sysdeps/s390/multiarch/wcpcpy-vx.S: Likewise.
* sysdeps/s390/multiarch/wcpcpy.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add stpcpy and
wcpcpy functions.
* string/stpcpy.c: Use STPCPY if defined.
* wcsmbs/wcpcpy.c: Use WCPCPY if defined.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for stpcpy, wcpcpy.
* string/test-stpcpy.c: Add wcpcpy support.
* wcsmbs/test-wcpcpy.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcpcpy.
* benchtests/bench-stpcpy.c: Add wcpcpy support.
* benchtests/bench-wcpcpy.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcpcpy.

8 years agoS390: Optimize strcpy and wcscpy.
Stefan Liebler [Wed, 26 Aug 2015 08:26:20 +0000 (10:26 +0200)] 
S390: Optimize strcpy and wcscpy.

This patch provides optimized versions of strcpy and wcscpy with the z13
vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/strcpy-vx.S: New File.
* sysdeps/s390/multiarch/strcpy.c: Likewise.
* sysdeps/s390/multiarch/wcscpy-c.c: Likewise.
* sysdeps/s390/multiarch/wcscpy-vx.S: Likewise.
* sysdeps/s390/multiarch/wcscpy.c: Likewise.
* sysdeps/s390/s390-32/multiarch/strcpy.c: Likewise.
* sysdeps/s390/s390-64/multiarch/strcpy.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strcpy and
wcscpy functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strcpy, wcscpy.
* benchtests/bench-wcscpy.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcscpy.

8 years agoS390: Optimize strnlen and wcsnlen.
Stefan Liebler [Wed, 26 Aug 2015 08:26:20 +0000 (10:26 +0200)] 
S390: Optimize strnlen and wcsnlen.

This patch provides optimized versions of strnlen and wcsnlen with the z13
vector instructions.

ChangeLog:

* sysdeps/s390/multiarch/strnlen-c.c: New File.
* sysdeps/s390/multiarch/strnlen-vx.S: Likewise.
* sysdeps/s390/multiarch/strnlen.c: Likewise.
* sysdeps/s390/multiarch/wcsnlen-c.c: Likewise.
* sysdeps/s390/multiarch/wcsnlen-vx.S: Likewise.
* sysdeps/s390/multiarch/wcsnlen.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strnlen and
wcsnlen functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strnlen, wcsnlen.
* wcsmbs/wcsnlen.c: Use WCSNLEN if defined.
* string/test-strnlen.c: Add wcsnlen support.
* wcsmbs/test-wcsnlen.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcsnlen.
* benchtests/bench-strnlen.c: Add wcsnlen support.
* benchtests/bench-wcsnlen.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcsnlen.

8 years agoS390: Optimize strlen and wcslen.
Stefan Liebler [Wed, 26 Aug 2015 08:26:20 +0000 (10:26 +0200)] 
S390: Optimize strlen and wcslen.

This patch provides optimized versions of strlen and wcslen with the z13 vector
instructions.
The helper macro IFUNC_VX_IMPL is introduced and is used to register all
__<func>_c() and __<func>_vx() functions within __libc_ifunc_impl_list()
to the ifunc test framework.

ChangeLog:

* sysdeps/s390/multiarch/Makefile: New File.
* sysdeps/s390/multiarch/strlen-c.c: Likewise.
* sysdeps/s390/multiarch/strlen-vx.S: Likewise.
* sysdeps/s390/multiarch/strlen.c: Likewise.
* sysdeps/s390/multiarch/wcslen-c.c: Likewise.
* sysdeps/s390/multiarch/wcslen-vx.S: Likewise.
* sysdeps/s390/multiarch/wcslen.c: Likewise.
* string/strlen.c (STRLEN): Define and use macro.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(IFUNC_VX_IMPL): New macro function.
(__libc_ifunc_impl_list): Add ifunc test for strlen, wcslen.
* benchtests/Makefile (wcsmbs-bench): New variable.
(string-bench-all): Added wcsmbs-bench.
* benchtests/bench-wcslen.c: New File.

8 years agoS390: Ifunc resolver macro for vector instructions.
Stefan Liebler [Wed, 26 Aug 2015 08:26:19 +0000 (10:26 +0200)] 
S390: Ifunc resolver macro for vector instructions.

This patch introduces a s390 specific ifunc resolver macro for 32/64bit,
which chooses <func>_vx with vector instructions if HWCAP_S390_VX flag
in hwcaps is set or <func>_c if not.

ChangeLog:

* sysdeps/s390/multiarch/ifunc-resolve.h (s390_vx_libc_ifunc,
s390_vx_libc_ifunc2): New macro function.

8 years agoS390: configure check for vector instruction support in assembler.
Stefan Liebler [Wed, 26 Aug 2015 08:26:19 +0000 (10:26 +0200)] 
S390: configure check for vector instruction support in assembler.

The S390 specific test checks if the assembler has support for the new z13
vector instructions by compiling a vector instruction. The .machine and
.machinemode directives are needed to compile the vector instruction without
-march=z13 option on 31/64 bit.
On success the macro HAVE_S390_VX_ASM_SUPPORT is defined. This macro is used
to determine if the optimized functions can be build without compile errors.
If the used assembler lacks vector support, then a warning is dumped while
configuring and only the common code functions are build.

The z13 instruction support was introduced in
"[Committed] S/390: Add support for IBM z13."
(https://sourceware.org/ml/binutils/2015-01/msg00197.html)

ChangeLog:

* config.h.in (HAVE_S390_VX_ASM_SUPPORT): New macro undefine.
* sysdeps/s390/configure.ac: Add test for S390 vector instruction
assembler support.
* sysdeps/s390/configure: Regenerated.

8 years agoS390: Add new s390 platform.
Stefan Liebler [Wed, 26 Aug 2015 08:26:19 +0000 (10:26 +0200)] 
S390: Add new s390 platform.

The new IBM z13 is added to platform string array.
The macro _DL_PLATFORMS_COUNT is incremented to 8,
because it was not incremented by commit
"S/390: Sync AUXV capabilities and archs with kernel".

ChangeLog:

* sysdeps/s390/dl-procinfo.c (_dl_s390_cap_flags): Add z13.
* sysdeps/s390/dl-procinfo.h (_DL_PLATFORMS_COUNT): Increased.

8 years agoS390: Add hwcaps value for vector facility.
Stefan Liebler [Wed, 26 Aug 2015 08:26:19 +0000 (10:26 +0200)] 
S390: Add hwcaps value for vector facility.

The HWCAP_S390_VX flag in hwcap field of auxiliary vector indicates
if the vector facility is available and the kernel is aware of it.
This can be tested with LD_SHOW_AUXV=1 <prog>.
Currently it does not show te, because it was not incremented
by commit "S/390: Add hwcap value for transactional execution.".
Thus _DL_HWCAP_COUNT is incremented by two.

ChangeLog:

* sysdeps/s390/dl-procinfo.c (_dl_s390_platforms): Add vector flag.
* sysdeps/s390/dl-procinfo.h: Add vector capability.
* sysdeps/unix/sysv/linux/s390/bits/hwcap.h (HWCAP_S390_VX): Define.

8 years agoS390: Refactor ifunc implementations and enable ifunc-test-framework.
Stefan Liebler [Wed, 26 Aug 2015 08:26:18 +0000 (10:26 +0200)] 
S390: Refactor ifunc implementations and enable ifunc-test-framework.

On s390 all ifunc resolvers were implemented in multiarch/ifunc-resolve.c.
The resulting single object files has undefined references to all ifunc-functions.
This patch introduces one multiarch/<func>.c file for each of memcpy, memcmp
and memset with the function specific ifunc resolver. The different function
implementations are now implemented in multiarch/<func>-s390x.S
(moved from multiarch/<func>.S).

The new multiarch/ifunc-resolve.h file contains the ifunc-resolver macro
and other helper-macros. They are merged and are now used in common for
32/64bit. Therefore the __<func>_g5/__<func>_z900 functions were renamed to
__<func>_default.

This patch also enables testing the ifunc implementations by implementing
the function __libc_ifunc_impl_list. It uses the helper-macros of ifunc-resolve.h.

ChangeLog:

* sysdeps/s390/s390-32/multiarch/Makefile (sysdep_routines):
Remove ifunc-resolve, add memset-s390, memcpy-s390, memcmp-s390.
* sysdeps/s390/s390-32/multiarch/ifunc-resolve.c: Delete File.
* sysdeps/s390/s390-32/multiarch/memcmp.S: Move to ...
* sysdeps/s390/s390-32/multiarch/memcmp-s390.S: ... here.
(memcmp, bcmp): Use __memcmp_default as alias source.
* sysdeps/s390/s390-32/multiarch/memcmp.c: New File.
* sysdeps/s390/s390-32/memcmp.S (__memcmp_g5):
Rename to __memcmp_default.
* sysdeps/s390/s390-32/multiarch/memcpy.S: Move to ...
* sysdeps/s390/s390-32/multiarch/memcpy-s390.S: ... here.
(memcpy): Use __memcpy_default as alias source.
* sysdeps/s390/s390-32/multiarch/memcpy.c: New File.
* sysdeps/s390/s390-32/memcpy.S (__memcpy_g5):
Rename to __memcpy_default.
* sysdeps/s390/s390-32/multiarch/memset.S: Move to ...
* sysdeps/s390/s390-32/multiarch/memset-s390.S: ... here.
(memset): Use __memset_default as alias source.
* sysdeps/s390/s390-32/multiarch/memset.c: New File.
* sysdeps/s390/s390-32/memset.S (__memset_g5):
Rename to __memset_default.
* sysdeps/s390/s390-64/multiarch/Makefile (sysdep_routines):
Remove ifunc-resolve, add memset-s390x, memcpy-s390x, memcmp-s390x.
* sysdeps/s390/s390-64/multiarch/ifunc-resolve.c: Delete File.
* sysdeps/s390/s390-64/multiarch/memcmp.S: Move to ...
* sysdeps/s390/s390-64/multiarch/memcmp-s390x.S: ... here.
(memcmp, bcmp): Use __memcmp_default as alias source.
* sysdeps/s390/s390-64/multiarch/memcmp.c: New File.
* sysdeps/s390/s390-64/memcmp.S (__memcmp_z900):
Rename to __memcmp_default.
* sysdeps/s390/s390-64/multiarch/memcpy.S: Move to ...
* sysdeps/s390/s390-64/multiarch/memcpy-s390x.S: ... here.
(memcpy): Use __memcpy_default as alias source.
* sysdeps/s390/s390-64/multiarch/memcpy.c: New File.
* sysdeps/s390/s390-64/memcpy.S (__memcpy_z900):
Rename to __memcpy_default.
* sysdeps/s390/s390-64/multiarch/memset.S: Move to ...
* sysdeps/s390/s390-64/multiarch/memset-s390x.S: ... here.
(memset): Use __memset_default as alias source.
* sysdeps/s390/s390-64/multiarch/memset.c: New File.
* sysdeps/s390/s390-64/memset.S (__memset_z900):
Rename to __memset_default.
* sysdeps/s390/multiarch/ifunc-resolve.h: New File.
* sysdeps/s390/multiarch/ifunc-impl-list.c: New File.