]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
8 years agoRefactor M_ macros defined in libm-test.inc
Paul E. Murphy [Fri, 27 May 2016 17:02:34 +0000 (12:02 -0500)] 
Refactor M_ macros defined in libm-test.inc

These are local to the test suite.  Rename them as a macro starting
with lit_pi and a series of postfix operations to give us a constant
starting with lit_pi.

The lit prefix is intended to enable easy substitutions via
gen-test-libm.pl if needed.

8 years agoAvoid "invalid" exceptions from powerpc fabsl (sNaN) (bug 20157).
Joseph Myers [Fri, 27 May 2016 15:29:31 +0000 (15:29 +0000)] 
Avoid "invalid" exceptions from powerpc fabsl (sNaN) (bug 20157).

The powerpc implementations of fabsl for ldbl-128ibm (both powerpc32
and powerpc64) wrongly raise the "invalid" exception for sNaN
arguments.  fabs functions should be quiet for all inputs including
signaling NaNs.  The problem is the use of a comparison instruction
fcmpu to determine if the high part of the argument is negative and so
the low part needs to be negated; such instructions raise "invalid"
for sNaNs.

There is a pure integer implementation of fabsl in
sysdeps/ieee754/ldbl-128ibm/s_fabsl.c.  However, it's not necessary to
use it to avoid such exceptions.  The fsel instruction does not raise
exceptions for sNaNs, and can be used in place of the original
comparison.  (Note that if the high part is zero or a NaN, it does not
matter whether the low part is negated; the choice of whether the low
part of a zero is +0 or -0 does not affect the value, and the low part
of a NaN does not affect the value / payload either.)

The condition in GCC for fsel to be available is TARGET_PPC_GFXOPT,
corresponding to the _ARCH_PPCGR predefined macro.  fsel is available
on all 64-bit processors supported by GCC.  A few 32-bit processors
supported by GCC do not have TARGET_PPC_GFXOPT despite having hard
float support.  To support those processors, integer code (similar to
that in copysignl) is included for the !_ARCH_PPCGR case for
powerpc32.

Tested for powerpc32 (configurations with and without _ARCH_PPCGR) and
powerpc64.

[BZ #20157]
* sysdeps/powerpc/powerpc32/fpu/s_fabsl.S (__fabsl): Use fsel to
determine whether to negate low half if [_ARCH_PPCGR], and integer
comparison otherwise.
* sysdeps/powerpc/powerpc64/fpu/s_fabsl.S (__fabsl): Use fsel to
determine whether to negate low half.

8 years agoRemove unused macros from libm-test.inc.
Joseph Myers [Fri, 27 May 2016 15:26:48 +0000 (15:26 +0000)] 
Remove unused macros from libm-test.inc.

This patch removes various no-longer-used macros from libm-test.inc.
NO_TEST_INLINE_FLOAT, NO_TEST_INLINE_DOUBLE and M_PI_6l would have
been used before relevant tests were moved to auto-libm-test-in.
TEST_COND_x86_64 and TEST_COND_x86 were for tests in auto-libm-test-in
XFAILed for x86, and are no longer relevant now the bugs in question
have been fixed and the XFAILing removed (if future x86-specific
XFAILs become needed, they can always be added back).

Tested for x86_64 and x86.

* math/libm-test.inc (NO_TEST_INLINE_FLOAT): Remove macro.
(NO_TEST_INLINE_DOUBLE): Likewise.
(TEST_COND_x86_64): Likewise.
(TEST_COND_x86): Likewise.
(M_PI_6l): Likewise.

8 years agoRefactor type specific macros using regexes
Paul E. Murphy [Thu, 12 May 2016 16:35:34 +0000 (11:35 -0500)] 
Refactor type specific macros using regexes

Replace most of the type specific macros  with the equivalent
type-generic macro using the following sed replacement command below:

sed -ri -e 's/defined TEST_FLOAT/TEST_COND_binary32/' \
        -e 's/ndef TEST_FLOAT/ !TEST_COND_binary32/'  \
        -e 's/def TEST_FLOAT/ TEST_COND_binary32/'    \
        -e 's/defined TEST_DOUBLE/TEST_COND_binary64/'\
        -e 's/ndef TEST_DOUBLE/ !TEST_COND_binary64/' \
        -e 's/def TEST_DOUBLE/ TEST_COND_binary64/'   \
        -e 's/defined TEST_LDOUBLE && //'             \
        -e 's/ifdef TEST_LDOUBLE/if MANT_DIG >= 64/'  \
        -e 's/defined TEST_LDOUBLE/MANT_DIG >= 64/'   \
        -e '/nexttoward_test_data\[\]/,/  };/!s/LDBL_(MIN_EXP|MAX_EXP|MANT_DIG)/\1/g' \
        libm-test.inc

With a little extra manual cleanup to simplify the following case:

#if MANT_DIG >= 64
# if MANT_DIG >= 64
...
# endif
...

Note, TEST_LDOUBLE checks are replaced by MANT_DIG >= 64 excepting
where another property of the type is being tested. And, the final
regex is intended to avoid replacing LDBL_ macro usage within the
nexttoward tests which explicitly take argument 2 as long double.

8 years agoBegin refactor of libm-test.inc
Paul E. Murphy [Fri, 27 May 2016 14:53:51 +0000 (09:53 -0500)] 
Begin refactor of libm-test.inc

Attempt to creatively redefine the macros
to choose tests based on the format being
tested, not the type.

Note, TS 18661 does not define any printf
modifiers, so we need to be a little more
verbose about constructing strings to
output.

8 years agoFix ldbl-128ibm ceill, rintl etc. for sNaN arguments (bug 20156).
Joseph Myers [Fri, 27 May 2016 13:59:24 +0000 (13:59 +0000)] 
Fix ldbl-128ibm ceill, rintl etc. for sNaN arguments (bug 20156).

The ldbl-128ibm implementations of ceill, floorl, roundl, truncl,
rintl and nearbyintl wrongly return an sNaN when given an sNaN
argument.  This patch fixes them to add such an argument to itself to
turn it into a quiet NaN.  (The code structure means this "else" case
applies to any argument which is zero or not finite; it's OK to do
this in all such cases.)

Tested for powerpc.

[BZ #20156]
* sysdeps/ieee754/ldbl-128ibm/s_ceill.c (__ceill): Add high part
to itself when zero or not finite.
* sysdeps/ieee754/ldbl-128ibm/s_floorl.c (__floorl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_rintl.c (__rintl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_roundl.c (__roundl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_truncl.c (__truncl): Likewise.

8 years agoFix ldbl-128ibm sqrtl (sNaN) (bug 20153).
Joseph Myers [Thu, 26 May 2016 22:58:36 +0000 (22:58 +0000)] 
Fix ldbl-128ibm sqrtl (sNaN) (bug 20153).

The ldbl-128ibm implementation of sqrtl wrongly returns an sNaN for
signaling NaN arguments.  This patch fixes it to quiet its argument,
using the same x * x + x return for infinities and NaNs as the dbl-64
implementation uses to ensure that +Inf maps to +Inf while -Inf and
NaN map to NaN.

Tested for powerpc.

[BZ #20153]
* sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c (__ieee754_sqrtl): Return
x * x + x for infinities and NaNs.

8 years agoFix ldbl-128 j0l, j1l, y0l, y1l for sNaN argument (bug 20151).
Joseph Myers [Thu, 26 May 2016 20:55:03 +0000 (20:55 +0000)] 
Fix ldbl-128 j0l, j1l, y0l, y1l for sNaN argument (bug 20151).

The ldbl-128 implementations of j0l, j1l, y0l, y1l (also used for
ldbl-128ibm) return an sNaN argument unchanged.  This patch fixes them
to add a NaN argument to itself to quiet it before return.

Tested for mips64.

[BZ #20151]
* sysdeps/ieee754/ldbl-128/e_j0l.c (__ieee754_j0l): Add NaN
argument to itself before returning result.
(__ieee754_y0l): Likewise.
* sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_j1l): Likewise.
(__ieee754_y1l).

8 years agoAdd more sNaN tests to libm-test.inc.
Joseph Myers [Thu, 26 May 2016 18:07:04 +0000 (18:07 +0000)] 
Add more sNaN tests to libm-test.inc.

This patch adds more tests of signaling NaN inputs to libm-test.inc.
These tests are for a subset of functions with a single floating-point
input where no failures appeared in x86_64 or x86 testing.  I intend
to investigate any failures of these new tests on some other
architectures before dealing with other functions.

Tested for x86_64 and x86.

* math/libm-test.inc (acosh_test_data): Add sNaN tests.
(atan_test_data): Likewise.
(ceil_test_data): Likewise.
(cos_test_data): Likewise.
(cosh_test_data): Likewise.
(erf_test_data): Likewise.
(exp2_test_data): Likewise.
(fabs_test_data): Likewise.
(floor_test_data): Likewise.
(ilogb_test_data): Likewise.
(j0_test_data): Likewise.
(j1_test_data): Likewise.
(jn_test_data): Likewise.
(lgamma_test_data): Likewise.
(lrint_test_data): Likewise.
(llrint_test_data): Likewise.
(logb_test_data): Likewise.
(lround_test_data): Likewise.
(llround_test_data): Likewise.
(nearbyint_test_data): Likewise.
(rint_test_data): Likewise.
(round_test_data): Likewise.
(sin_test_data): Likewise.
(sincos_test_data): Likewise.
(sinh_test_data): Likewise.
(sqrt_test_data): Likewise.
(tan_test_data): Likewise.
(tanh_test_data): Likewise.
(tgamma_test_data): Likewise.
(trunc_test_data): Likewise.
(y0_test_data): Likewise.
(y1_test_data): Likewise.
(yn_test_data): Likewise.

8 years agoSupport sNaN testing in libm-test.inc.
Joseph Myers [Thu, 26 May 2016 16:38:04 +0000 (16:38 +0000)] 
Support sNaN testing in libm-test.inc.

This patch adds support in libm-test.inc for tests with signaling NaN
arguments.  gen-libm-test.pl is made to set a flag TEST_SNAN for such
tests, so that they can be disabled automatically when sNaN testing
isn't supported for a given type (at present, for float and double on
32-bit x86 because it's unpredictable when a value might be loaded
into a floating-point register and so automatically converted to long
double with sNaNs converted to quiet NaNs).  -fsignaling-nans is used
where needed.

Tests are added for classification macros, as a starting point; this
is deliberately more conservative than Thomas's patch
<https://sourceware.org/ml/libc-ports/2013-04/msg00008.html>, to allow
more tests to be added, and issues exposed fixed, bit by bit.

Tested for x86_64 and x86.

* math/libm-test.inc: Update comment about NaN testing.
(TEST_SNAN): New macro.
(snan_value): Likewise.
(enable_test): Disable tests of sNaNs when SNAN_TESTS fails.
(fpclassify_test_data): Add sNaN tests.
(isfinite_test_data): Likewise.
(isinf_test_data): Likewise.
(isnan_test_data): Likewise.
(isnormal_test_data): Likewise.
(issignaling_test_data): Likewise.
(signbit_test_data): Likewise.
* math/gen-libm-test.pl (%beautify): Add snan_value.
(show_exceptions): Add argument $test_snan.
(parse_args): Handle snan_value as non-finite.  Update call to
show_exceptions.
* math/Makefile (libm-test-no-inline-cflags): Add
-fsignaling-nans.

8 years agonetwork: Fix missing bits from {recv,send}{m}msg standard com,pliance
Adhemerval Zanella [Thu, 26 May 2016 14:11:33 +0000 (11:11 -0300)] 
network: Fix missing bits from {recv,send}{m}msg standard com,pliance

This patch fixes wrong/missing bits from the Fix {recv,send}{m}msg
standard compliance (BZ#16919) patches:

  * nptl/Makefile sets CFLAGS-oldrecvfrom.c, but there's no such file as
    oldrecvfrom.c.  It should be oldsendmsg.c as defined by ChangeLog.

  * sysdeps/unix/sysv/linux/hppa/Versions and
    sysdeps/unix/sysv/linux/i386/Versions list a symbol recvms instead of
    recvmsg at version GLIBC_2.24.

* nptl/Makefile (CFLAGS-oldrecvfrom.c): Remove rule.
(CFLAGS-oldsendmsg.c): Add rule.
* sysdeps/unix/sysv/linux/hppa/Versions [libc] (GLIBC_2.24):
Correct recvmsg symbol name.
* sysdeps/unix/sysv/linux/i386/Versions [libc] (GLIBC_2.24):
Likewise.

8 years agonetwork: recvmmsg and sendmmsg standard compliance (BZ#16919)
Adhemerval Zanella [Thu, 17 Mar 2016 12:52:17 +0000 (09:52 -0300)] 
network: recvmmsg and sendmmsg standard compliance (BZ#16919)

POSIX specifies that both msghdr::msg_iovlen and msghdr::msg_controllen
to be of size int and socklen_t respectively, however Linux implements
it as a size_t.  So for 64-bits architecture where sizeof of size_t is
larger than socklen_t, both sendmmsg and recvmmsg need to adjust the
mmsghdr::msg_hdr internal fields before issuing the syscall itself.

This patch fixes it by operating on the padding if it the case.
For recvmmsg, the most straightfoward case, only zero padding the fields
is suffice.  However, for sendmmsg, where adjusting the buffer is out
of the contract (since it may point to a read-only data), the function
is rewritten to use sendmsg instead (which from previous patch
allocates a temporary msghdr to operate on).

Also for 64-bit ports that requires it, a new recvmmsg and sendmmsg
compat version is created (which uses size_t for both cmsghdr::cmsg_len
and internal

Tested on x86_64, i686, aarch64, armhf, and powerpc64le.

* sysdeps/unix/sysv/linux/Makefile
[$(subdir) = socket] (sysdep_routines): Add oldrecvmmsg and
oldsendmmsg.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add recvmmsg and
sendmmsg.
* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
* sysdeps/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/oldrecvmmsg.c: New file.
* sysdeps/unix/sysv/linux/oldsendmmsg.c: Likewise.
* sysdeps/unix/sysv/linux/recvmmsg.c (__recvmmsg): Adjust msghdr
iovlen and controllen fields to adjust to POSIX specification.
* sysdeps/unix/sysv/linux/sendmmsg.c (__sendmmsg): Likewise.

8 years agonetwork: recvmsg and sendmsg standard compliance (BZ#16919)
Adhemerval Zanella [Fri, 18 Mar 2016 20:34:33 +0000 (17:34 -0300)] 
network: recvmsg and sendmsg standard compliance (BZ#16919)

POSIX specifies that both msghdr::msg_iovlen and msghdr::msg_controllen
to be of size int and socklen_t respectively.  However Linux defines it as
both size_t and for 64-bit it requires some adjustments to make the
functions standard compliance.

This patch fixes it by creating a temporary header and zeroing the pad
fields for 64-bits architecture where size of size_t exceeds the size of
the int.

Also the new recvmsg and sendmsg implementation is only added on libc,
with libpthread only containing a compat symbol.

Tested on x86_64, i686, aarch64, armhf, and powerpc64le.

* conform/data/sys/socket.h-data (msghdr.msg_iovlen): Remove xfail-
and change to correct expected type.
(msghdr.msg_controllen): Likewise.
(cmsghdr.cmsg_len): Likewise.
* sysdeps/unix/sysv/linux/bits/socket.h (msghdr.msg_iovlen): Fix
expected POSIX assumption about the size.
(msghdr.msg_controllen): Likewise.
(msghdr.__glibc_reserved1): Likewise.
(msghdr.__glibc_reserved2): Likewise.
(cmsghdr.cmsg_len): Likewise.
(cmsghdr.__glibc_reserved1): Likewise.
* nptl/Makefile (libpthread-routines): Remove ptw-recvmsg and ptw-sendmsg.
Add ptw-oldrecvmsg and ptw-oldsendmsg.
(CFLAGS-sendmsg.c): Remove rule.
(CFLAGS-recvmsg.c): Likewise.
(CFLAGS-oldsendmsg.c): Add rule.
(CFLAGS-oldrecvmsg.c): Likewise.
* sysdeps/unix/sysv/linux/alpha/Versions [libc] (GLIBC_2.24): Add
recvmsg and sendmsg.
* sysdeps/unix/sysv/linux/aarch64/Version [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/arm/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/hppa/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/i386/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/ia64/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/m68k/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/microblaze/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/nios2/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions [libc]
(GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/sh/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/sparc/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/Versions [libc] (GLIBC_2.24):
Likewise.
( sysdeps/unix/sysv/linux/tile/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/Versions [libc]
(GLIBC_2.24): Likewise.
( sysdeps/unix/sysv/linux/x86_64/64/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/x84_64/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/Makefile
[$(subdir) = socket)] (sysdep_headers): Add oldrecvmsg and oldsendmsg.
(CFLAGS-sendmsg.c): Add rule.
(CFLAGS-recvmsg.c): Likewise.
(CFLAGS-oldsendmsg.c): Likewise.
(CFLAGS-oldrecvmsg.c): Likewise.
* sysdeps/unix/sysv/linux/check_native.c (__check_native): Fix msghdr
initialization.
* sysdeps/unix/sysv/linux/check_pf.c (make_request): Likewise.
* sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Likewise.
* sysdeps/unix/sysv/linux/oldrecvmsg.c: New file.
* sysdeps/unix/sysv/linux/oldsendmsg.c: Likewise.
* sysdeps/unix/sysv/linux/recvmsg.c (__libc_recvmsg): Adjust msghdr
iovlen and controllen fields to adjust to POSIX specification.
* sysdeps/unix/sysv/linux/sendmsg.c (__libc_sendmsg): Likewise.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist: New version and
added recvmsg and sendmsg.
* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
Likewise.
* sysdeps/unix/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
* sysdepe/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
Likewise.
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise.
Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.

8 years agoAdjust kernel-features.h defaults for recvmsg and sendmsg
Adhemerval Zanella [Tue, 15 Mar 2016 20:42:26 +0000 (17:42 -0300)] 
Adjust kernel-features.h defaults for recvmsg and sendmsg

This patch removes the auto-generation for recvmsg and sendmsg syscall
and adjust the kernel-features.h for all architectures supported on
Linux.  This patch follows the idea of 'Adjust kernel-features.h defaults
for socket syscalls.' (35ade9f11b9007ee9683529f2d33698ff35255c8) by define
__ASSUME_SENDMSG_SYSCALL and __ASSUME_RECVMSG_SYSCALL as supported by
default and undefine it for the architecture that do not support it
directly.

The main rationale is to make is easier add code wrapper over the syscall
to fix BZ#16919 (recvmsg standard compliance).

Tested on x86_64, i686, aarch64, armhf, and powerpc64le.

* sysdeps/unix/sysv/linux/alpha/syscalls.list (recvmsg): Remove
from auto-generation.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/arm/syscalls.list (recvmsg): Likewise.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (recvmsg): Likewise.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (recvmsg): Likewise.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (recvmsg): Likewise.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/mips/syscalls.list (recvmsg): Likewise.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list (recvmsg):
Likewise.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (recvmsg): Likewise.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL):
Remove.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_SENDMSG_SYSCALL):
Undefine.
[__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_RECVMSG_SYSCALL):
Likewise.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_SENDMSG_SYSCALL): Define.
(__ASSUME_RECVMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL):
Remove.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_SENDMSG_SYSCALL):
Undefine.
[__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_RECVMSG_SYSCALL):
Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL):
Remove.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_SENDMSG_SYSCALL):
Undefine.
[__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_RECVMSG_SYSCALL):
Likewise.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
(__ASSUME_SENDMSG_SYSCALL): Undefine.
(__ASSUME_RECVMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_SENDMSG_SYSCALL): Likewise.
(__ASSUME_RECVMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_SENDMSG_SYSCALL): Likewise.
(__ASSUME_RECVMSG_SYSCALL): Likewise.

8 years agoRefactor tst-strtod-round.c for type-generic-ness
Paul E. Murphy [Mon, 9 May 2016 22:59:37 +0000 (17:59 -0500)] 
Refactor tst-strtod-round.c for type-generic-ness

Reduce much of the redundancy in this file, and attempt
to coral the type specific stuff to ease adding an new type.

8 years agoDo not raise "inexact" from powerpc64 ceil, floor, trunc (bug 15479).
Joseph Myers [Wed, 25 May 2016 17:42:22 +0000 (17:42 +0000)] 
Do not raise "inexact" from powerpc64 ceil, floor, trunc (bug 15479).

Continuing fixes for ceil, floor and trunc functions not to raise the
"inexact" exception, this patch fixes the versions used on older
powerpc64 processors.  As was done with the round implementations some
time ago, the save of floating-point state is moved after the first
floating-point operation on the input to ensure that any "invalid"
exception from signaling NaN input is included in the saved state, and
then the whole state gets restored rather than just the rounding mode.

This has no effect on configurations using the power5+ code, since
such processors can do these operations with a single instruction (and
those instructions do not set "inexact", so are correct for TS 18661-1
semantics).

Tested for powerpc64.

[BZ #15479]
* sysdeps/powerpc/powerpc64/fpu/s_ceil.S (__ceil): Move save of
floating-point state after first floating-point operation on
input.  Restore full floating-point state instead of just rounding
mode.
* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S (__ceilf): Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_floor.S (__floor): Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_floorf.S (__floorf): Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_trunc.S (__trunc): Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_truncf.S (__truncf): Likewise.

8 years agoDo not raise "inexact" from powerpc32 ceil, floor, trunc (bug 15479).
Joseph Myers [Wed, 25 May 2016 16:53:23 +0000 (16:53 +0000)] 
Do not raise "inexact" from powerpc32 ceil, floor, trunc (bug 15479).

Continuing fixes for ceil, floor and trunc functions not to raise the
"inexact" exception, this patch fixes the versions used on older
powerpc32 processors.  As was done with the round implementations some
time ago, the save of floating-point state is moved after the first
floating-point operation on the input to ensure that any "invalid"
exception from signaling NaN input is included in the saved state, and
then the whole state gets restored rather than just the rounding mode.

This has no effect on configurations using the power5+ code, since
such processors can do these operations with a single instruction (and
those instructions do not set "inexact", so are correct for TS 18661-1
semantics).

Tested for powerpc32.

[BZ #15479]
* sysdeps/powerpc/powerpc32/fpu/s_ceil.S (__ceil): Move save of
floating-point state after first floating-point operation on
input.  Restore full floating-point state instead of just rounding
mode.
* sysdeps/powerpc/powerpc32/fpu/s_ceilf.S (__ceilf): Likewise.
* sysdeps/powerpc/powerpc32/fpu/s_floor.S (__floor): Likewise.
* sysdeps/powerpc/powerpc32/fpu/s_floorf.S (__floorf): Likewise.
* sysdeps/powerpc/powerpc32/fpu/s_trunc.S (__trunc): Likewise.
* sysdeps/powerpc/powerpc32/fpu/s_truncf.S (__truncf): Likewise.

8 years agoFix UTF-16 surrogate handling. [BZ #19727]
Stefan Liebler [Wed, 25 May 2016 15:18:06 +0000 (17:18 +0200)] 
Fix UTF-16 surrogate handling. [BZ #19727]

According to the latest Unicode standard, a conversion from/to UTF-xx has
to report an error if the character value is in range of an utf16 surrogate
(0xd800..0xdfff). See https://sourceware.org/ml/libc-help/2015-12/msg00015.html.
Thus this patch fixes this behaviour for converting from utf32 to internal and
from internal to utf8.

Furthermore the conversion from utf16 to internal does not report an error if the
input-stream consists of two low-surrogate values. If an uint16_t value is in the
range of 0xd800 .. 0xdfff, the next uint16_t value is checked, if it is in the
range of a low surrogate (0xdc00 .. 0xdfff). Afterwards these two uint16_t
values are interpreted as a high- and low-surrogates pair. But there is no test
if the first uint16_t value is really in the range of a high-surrogate
(0xd800 .. 0xdbff). If there would be two uint16_t values in the range of a low
surrogate, then they will be treated as a valid high- and low-surrogates pair.
This patch adds this test.

This patch also adds a new testcase, which checks UTF conversions with input
values in range of UTF16 surrogates. The test converts from UTF-xx to INTERNAL,
INTERNAL to UTF-xx and directly between UTF-xx to UTF-yy. The latter conversion
is needed because s390 has iconv-modules, which converts from/to UTF in one step.
The new testcase was tested on a s390, power and intel machine.

ChangeLog:

[BZ #19727]
* iconvdata/utf-16.c (BODY): Report an error if first word is not a
valid high surrogate.
* iconvdata/utf-32.c (BODY): Report an error if the value is in range
of an utf16 surrogate.
* iconv/gconv_simple.c (BODY): Likewise.
* iconvdata/bug-iconv12.c: New file.
* iconvdata/Makefile (tests): Add bug-iconv12.

rename test

8 years agoFix ucs4le_internal_loop in error case. [BZ #19726]
Stefan Liebler [Wed, 25 May 2016 15:18:06 +0000 (17:18 +0200)] 
Fix ucs4le_internal_loop in error case. [BZ #19726]

When converting from UCS4LE to INTERNAL, the input-value is checked for a too
large value and the iconv() call sets errno to EILSEQ. In this case the inbuf
argument of the iconv() call should point to the invalid character, but it
points to the beginning of the inbuf.
Thus this patch updates the pointers inptrp and outptrp before returning in
this error case.

This patch also adds a new testcase for this issue.
The new test was tested on a s390, power, intel machine.

ChangeLog:

[BZ #19726]
* iconv/gconv_simple.c (ucs4le_internal_loop): Update inptrp and
outptrp in case of an illegal input.
* iconv/tst-iconv6.c: New file.
* iconv/Makefile (tests): Add tst-iconv6.

8 years agoS390: Fix utf32 to utf16 handling of low surrogates (disable cu42).
Stefan Liebler [Wed, 25 May 2016 15:18:06 +0000 (17:18 +0200)] 
S390: Fix utf32 to utf16 handling of low surrogates (disable cu42).

According to the latest Unicode standard, a conversion from/to UTF-xx has
to report an error if the character value is in range of an utf16 surrogate
(0xd800..0xdfff). See https://sourceware.org/ml/libc-help/2015-12/msg00015.html.

Thus the cu42 instruction, which converts from utf32 to utf16,  has to be
disabled because it does not report an error in case of a value in range of
a low surrogate (0xdc00..0xdfff). The etf3eh variant is removed and the c,
vector variant is adjusted to handle the value in range of an utf16 low
surrogate correctly.

ChangeLog:

* sysdeps/s390/utf16-utf32-z9.c: Disable cu42 instruction and report
an error in case of a value in range of an utf16 low surrogate.

8 years agoS390: Fix utf32 to utf8 handling of low surrogates (disable cu41).
Stefan Liebler [Wed, 25 May 2016 15:18:05 +0000 (17:18 +0200)] 
S390: Fix utf32 to utf8 handling of low surrogates (disable cu41).

According to the latest Unicode standard, a conversion from/to UTF-xx has
to report an error if the character value is in range of an utf16 surrogate
(0xd800..0xdfff). See https://sourceware.org/ml/libc-help/2015-12/msg00015.html.

Thus the cu41 instruction, which converts from utf32 to utf8,  has to be
disabled because it does not report an error in case of a value in range of
a low surrogate (0xdc00..0xdfff). The etf3eh variant is removed and the c,
vector variant is adjusted to handle the value in range of an utf16 low
surrogate correctly.

ChangeLog:

* sysdeps/s390/utf8-utf32-z9.c: Disable cu41 instruction and report
an error in case of a value in range of an utf16 low surrogate.

8 years agoS390: Use s390-64 specific ionv-modules on s390-32, too.
Stefan Liebler [Wed, 25 May 2016 15:18:05 +0000 (17:18 +0200)] 
S390: Use s390-64 specific ionv-modules on s390-32, too.

This patch reworks the existing s390 64bit specific iconv modules in order
to use them on s390 31bit, too.

Thus the parts for subdirectory iconvdata in sysdeps/s390/s390-64/Makefile
were moved to sysdeps/s390/Makefile so that they apply on 31bit, too.
All those modules are moved from sysdeps/s390/s390-64 directory to sysdeps/s390.

The iso-8859-1 to/from cp037 module was adjusted, to use brct (branch relative
on count) instruction on 31bit s390 instead of brctg, because the brctg is a
zarch instruction and is not available on a 31bit kernel.

The utf modules are using zarch instructions, thus the directive machinemode
zarch_nohighgprs was added to the inline assemblies to omit the high-gprs flag
in the shared libraries. Otherwise they can't be loaded on a 31bit kernel.
The ifunc resolvers were adjusted in order to call the etf3eh or vector variants
only if zarch instructions are available (64bit kernel in 31bit compat-mode).
Furthermore some variable types were changed. E.g. unsigned long long would be
a register pair on s390 31bit, but we want only one single register.
For variables of type size_t the register contents have to be enlarged from a
32bit to a 64bit value on 31bit, because the inline assemblies uses 64bit values
in such cases.

ChangeLog:

* sysdeps/s390/s390-64/Makefile (iconvdata-subdirectory):
Move to ...
* sysdeps/s390/Makefile: ... here.
* sysdeps/s390/s390-64/iso-8859-1_cp037_z900.c: Move to ...
* sysdeps/s390/iso-8859-1_cp037_z900.c: ... here.
(BRANCH_ON_COUNT): New define.
(TR_LOOP): Use BRANCH_ON_COUNT instead of brctg.
* sysdeps/s390/s390-64/utf16-utf32-z9.c: Move to ...
* sysdeps/s390/utf16-utf32-z9.c: ... here and adjust to
run on s390-32, too.
* sysdeps/s390/s390-64/utf8-utf16-z9.c: Move to ...
* sysdeps/s390/utf8-utf16-z9.c: ... here and adjust to
run on s390-32, too.
* sysdeps/s390/s390-64/utf8-utf32-z9.c: Move to ...
* sysdeps/s390/utf8-utf32-z9.c: ... here and adjust to
run on s390-32, too.

8 years agoS390: Optimize utf16-utf32 module.
Stefan Liebler [Wed, 25 May 2016 15:18:05 +0000 (17:18 +0200)] 
S390: Optimize utf16-utf32 module.

This patch reworks the s390 specific module to convert between utf16 and utf32.
Now ifunc is used to choose either the c or etf3eh (with convert utf
instruction) variants at runtime.
Furthermore a new vector variant for z13 is introduced which will be build
and chosen if vector support is available at build / runtime.

In case of converting utf 32 to utf16, the vector variant optimizes input of
2byte utf16 characters. The convert utf instruction is used if an utf16
surrogate is found.

For the other direction utf16 to utf32, the cu24 instruction can't be re-
enabled, because it does not report an error, if the input-stream consists of
a single low surrogate utf16 char (e.g. 0xdc00). This applies to the newest z13,
too. Thus there is only the c or the new vector variant, which can handle utf16
surrogate characters.

This patch also fixes some whitespace errors. Furthermore, the etf3eh variant is
handling the "UTF-xx//IGNORE" case now. Before they ignored the ignore-case and
always stopped at an error.

ChangeLog:

* sysdeps/s390/s390-64/utf16-utf32-z9.c: Use ifunc to select c,
etf3eh or new vector loop-variant.

8 years agoS390: Optimize utf8-utf16 module.
Stefan Liebler [Wed, 25 May 2016 15:18:05 +0000 (17:18 +0200)] 
S390: Optimize utf8-utf16 module.

This patch reworks the s390 specific module to convert between utf8 and utf16.
Now ifunc is used to choose either the c or etf3eh (with convert utf instruction)
variants at runtime. Furthermore a new vector variant for z13 is introduced
which will be build and chosen if vector support is available at build / runtime.

In case of converting utf 8 to utf16, the vector variant optimizes input of
1byte utf8 characters. The convert utf instruction is used if a multibyte utf8
character is found.

For the other direction utf16 to utf8, the cu21 instruction can't be re-enabled,
because it does not report an error, if the input-stream consists of a single
low surrogate utf16 char (e.g. 0xdc00). This applies to the newest z13, too.
Thus there is only the c or the new vector variant, which can handle 1..4 byte
utf8 characters.

The c variant from utf16 to utf8 has beed fixed. If a high surrogate was at the
end of the input-buffer, then errno was set to EINVAL and the input-pointer
pointed just after the high surrogate. Now it points to the beginning of the
high surrogate.

This patch also fixes some whitespace errors. The c variant from utf8 to utf16
is now checking that tail-bytes starts with 0b10... and the value is not in
range of an utf16 surrogate.

Furthermore, the etf3eh variants are handling the "UTF-xx//IGNORE" case now.
Before they ignored the ignore-case and always stopped at an error.

ChangeLog:

* sysdeps/s390/s390-64/utf8-utf16-z9.c: Use ifunc to select c,
etf3eh or new vector loop-variant.

8 years agoS390: Optimize utf8-utf32 module.
Stefan Liebler [Wed, 25 May 2016 15:18:05 +0000 (17:18 +0200)] 
S390: Optimize utf8-utf32 module.

This patch reworks the s390 specific module to convert between utf8 and utf32.
Now ifunc is used to choose either the c or etf3eh (with convert utf
instruction) variants at runtime.
Furthermore a new vector variant for z13 is introduced which will be build
and chosen if vector support is available at build / runtime.
The vector variants optimize input of 1byte utf8 characters. The convert utf
instruction is used if a multibyte utf8 character is found.

This patch also fixes some whitespace errors. The c variants are rejecting
UTF-16 surrogates and values above 0x10ffff now.
Furthermore, the etf3eh variants are handling the "UTF-xx//IGNORE" case now.
Before they ignored the ignore-case and always stopped at an error.

ChangeLog:

* sysdeps/s390/s390-64/utf8-utf32-z9.c: Use ifunc to select c, etf3eh
or new vector loop-variant.

8 years agoS390: Optimize iso-8859-1 to ibm037 iconv-module.
Stefan Liebler [Wed, 25 May 2016 15:18:05 +0000 (17:18 +0200)] 
S390: Optimize iso-8859-1 to ibm037 iconv-module.

This patch reworks the s390 specific module which used the z900
translate one to one instruction. Now the g5 translate instruction is used,
because it outperforms the troo instruction.

ChangeLog:

* sysdeps/s390/s390-64/iso-8859-1_cp037_z900.c (TROO_LOOP):
Rename to TR_LOOP and usage of tr instead of troo instruction.

8 years agoS390: Optimize builtin iconv-modules.
Stefan Liebler [Wed, 25 May 2016 15:18:04 +0000 (17:18 +0200)] 
S390: Optimize builtin iconv-modules.

This patch introduces a s390 specific gconv_simple.c file which provides
optimized versions for z13 with vector instructions, which will be chosen at
runtime via ifunc.
The optimized conversions can convert between internal and ascii, ucs4, ucs4le,
ucs2, ucs2le.
If the build-environment lacks vector support, then iconv/gconv_simple.c
is used wihtout any change. Otherwise iconvdata/gconv_simple.c is used to create
conversion loop routines without vector instructions as fallback, if vector
instructions aren't available at runtime.

ChangeLog:

* sysdeps/s390/multiarch/gconv_simple.c: New File.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add gconv_simple.

8 years agoS390: Optimize 8bit-generic iconv modules.
Stefan Liebler [Wed, 25 May 2016 15:18:04 +0000 (17:18 +0200)] 
S390: Optimize 8bit-generic iconv modules.

This patch introduces a s390 specific 8bit-generic.c file which provides an
optimized version for z13 with translate-/vector-instructions, which will be
chosen at runtime via ifunc.
If the build-environment lacks vector support, then iconvdata/8bit-generic.c
is used wihtout any change. Otherwise iconvdata/8bit-generic.c is used to create
conversion loop routines without vector instructions as fallback, if vector
instructions aren't available at runtime.

The vector routines can only be used with charsets where the maximum UCS4 value
fits in 1 byte size. Then the hardware translate-instruction is used
to translate between up to 256 generic characters and "1 byte UCS4"
characters at once. The vector instructions are used to convert between
the "1 byte UCS4" and UCS4.

The gen-8bit.sh script in sysdeps/s390/multiarch generates the conversion
table to_ucs1. Therefore in sysdeps/s390/multiarch/Makefile is added an
override define generate-8bit-table, which is originally defined in
iconvdata/Makefile. This version calls the gen-8bit.sh in iconvdata folder
and the s390 one.

ChangeLog:

* sysdeps/s390/multiarch/8bit-generic.c: New File.
* sysdeps/s390/multiarch/gen-8bit.sh: New File.
* sysdeps/s390/multiarch/Makefile (generate-8bit-table):
New override define.
* sysdeps/s390/multiarch/iconv/skeleton.c: Likewise.

8 years agoS390: Configure check for vector support in gcc.
Stefan Liebler [Wed, 25 May 2016 15:18:04 +0000 (17:18 +0200)] 
S390: Configure check for vector support in gcc.

The S390 specific test checks if the gcc has support for vector registers
by compiling an inline assembly which clobbers vector registers.
On success the macro HAVE_S390_VX_GCC_SUPPORT is defined.
This macro can be used to determine if e.g. clobbering vector registers
is allowed or not.

ChangeLog:

* config.h.in (HAVE_S390_VX_GCC_SUPPORT): New macro undefine.
* sysdeps/s390/configure.ac: Add test for S390 vector register
support in gcc.
* sysdeps/s390/configure: Regenerated.

8 years agoS390: Get rid of make warning: overriding recipe for target gconv-modules.
Stefan Liebler [Wed, 25 May 2016 15:18:04 +0000 (17:18 +0200)] 
S390: Get rid of make warning: overriding recipe for target gconv-modules.

This patch introduces a way to provide an architecture dependent gconv-modules
file. Before this patch, the gconv-modules file was normally installed from
src-dir/iconvdata/gconv-modules. The S390 Makefile had overridden the
installation recipe (with a make warning) in order to install the
gconv-module-s390 file from build-dir.
The iconvdata/Makefile provides another recipe, which copies the gconv-modules
file from src to build dir, which are used by the testcases.
Thus the testcases does not use the currently build s390-modules.

This patch uses build-dir/iconvdata/gconv-modules for installation, which
is generated by concatenating src-dir/iconvdata/gconv-modules and the
architecture specific one. The latter one can be specified by setting the variable
sysdeps-gconv-modules in sysdeps/.../Makefile.

The architecture specific gconv-modules file is emitted before the common one
because these modules aren't used in all possible conversions. E.g. the converting
from INTERNAL to UTF-16 used the common UTF-16.so module instead of UTF16_UTF32_Z9.so.

This way, the s390-Makefile does not need to override the recipe for gconv-modules
and no warning is emitted anymore.
Since we no longer support empty objpfx the conditional test in iconvdata/Makefile
is removed.

ChangeLog:

* iconvdata/Makefile ($(inst_gconvdir)/gconv-modules):
Install file from $(objpfx)gconv-modules.
($(objpfx)gconv-modules): Concatenate architecture specific file
in variable sysdeps-gconv-modules and gconv-modules in src dir.
* sysdeps/s390/gconv-modules: New file.
* sysdeps/s390/s390-64/Makefile: ($(inst_gconvdir)/gconv-modules):
Deleted.
($(objpfx)gconv-modules-s390): Deleted.
(sysdeps-gconv-modules): New variable.

8 years agoDo not raise "inexact" from x86_64 SSE4.1 ceil, floor (bug 15479).
Joseph Myers [Tue, 24 May 2016 21:11:18 +0000 (21:11 +0000)] 
Do not raise "inexact" from x86_64 SSE4.1 ceil, floor (bug 15479).

Continuing fixes for ceil and floor functions not to raise the
"inexact" exception, this patch fixes the x86_64 SSE4.1 versions.  The
roundss / roundsd instructions take an immediate operand that
determines the rounding mode and whether to raise "inexact"; this just
needs bit 3 set to disable "inexact", which this patch does.

Remark: we don't have an SSE4.1 version of trunc / truncf (using this
instruction with operand 11); I'd expect one to make sense, but of
course it should be benchmarked against the existing C code.  I'll
file a bug in Bugzilla for the lack of such a version.

Tested for x86_64.

[BZ #15479]
* sysdeps/x86_64/fpu/multiarch/s_ceil.S (__ceil_sse41): Set bit 3
of immediate operand to rounding instruction.
* sysdeps/x86_64/fpu/multiarch/s_ceilf.S (__ceilf_sse41):
Likewise.
* sysdeps/x86_64/fpu/multiarch/s_floor.S (__floor_sse41):
Likewise.
* sysdeps/x86_64/fpu/multiarch/s_floorf.S (__floorf_sse41):
Likewise.

8 years agoFixup usage of MIN_EXP in libm-test.inc
Paul E. Murphy [Thu, 19 May 2016 22:09:02 +0000 (17:09 -0500)] 
Fixup usage of MIN_EXP in libm-test.inc

Make MANT_DIG shadow the types *_MIN_EXP macro. Replace
calls sites with (MIN_EXP - 1), and simplify.

8 years agoFixup usage of MANT_DIG in libm-test.inc
Paul E. Murphy [Thu, 19 May 2016 22:01:16 +0000 (17:01 -0500)] 
Fixup usage of MANT_DIG in libm-test.inc

Make MANT_DIG shadow the types *_MANT_DIG macro. Replace
calls sites with (MANT_DIG - 1), and simplify.

8 years agoRefactor tst-strtod-round.c
Paul E. Murphy [Mon, 9 May 2016 16:49:11 +0000 (11:49 -0500)] 
Refactor tst-strtod-round.c

This file is partially generated.  To make updates a little
simpler, I have moved the generated code into a partially
contained header to simplify regeneration.

gen-tst-strtod-round.c now takes two, mandatory arguments.
These arguments specify the input test data and the output
destination, respectively.

8 years agoDo not raise "inexact" from generic round (bug 15479).
Joseph Myers [Tue, 24 May 2016 17:46:55 +0000 (17:46 +0000)] 
Do not raise "inexact" from generic round (bug 15479).

C99 and C11 allow but do not require ceil, floor, round and trunc to
raise the "inexact" exception for noninteger arguments.  TS 18661-1
requires that this exception not be raised by these functions.  This
aligns them with general IEEE semantics, where "inexact" is only
raised if the final step of rounding the infinite-precision result to
the result type is inexact; for these functions, the
infinite-precision integer result is always representable in the
result type, so "inexact" should never be raised.

The generic implementations of ceil, floor and round functions contain
code to force "inexact" to be raised.  This patch removes it for round
functions to align them with TS 18661-1 in this regard.  The tests
*are* updated by this patch; there are fewer architecture-specific
versions than for ceil and floor, and I fixed the powerpc ones some
time ago.  If any others still have the issue, as shown by tests for
round failing with spurious exceptions, they can be fixed separately
by architecture maintainers or others.

Tested for x86_64, x86 and mips64.

[BZ #15479]
* sysdeps/ieee754/dbl-64/s_round.c (huge): Remove variable.
(__round): Do not force "inexact" exception.
* sysdeps/ieee754/dbl-64/wordsize-64/s_round.c (huge): Remove
variable.
(__round): Do not force "inexact" exception.
* sysdeps/ieee754/flt-32/s_roundf.c (huge): Remove variable.
(__roundf): Do not force "inexact" exception.
* sysdeps/ieee754/ldbl-128/s_roundl.c (huge): Remove variable.
(__roundl): Do not force "inexact" exception.
* sysdeps/ieee754/ldbl-96/s_roundl.c (huge): Remove variable.
(__roundl): Do not force "inexact" exception.
* math/libm-test.inc (round_test_data): Do not allow spurious
"inexact" exceptions.

8 years agoDo not raise "inexact" from generic floor (bug 15479).
Joseph Myers [Tue, 24 May 2016 17:44:46 +0000 (17:44 +0000)] 
Do not raise "inexact" from generic floor (bug 15479).

C99 and C11 allow but do not require ceil, floor, round and trunc to
raise the "inexact" exception for noninteger arguments.  TS 18661-1
requires that this exception not be raised by these functions.  This
aligns them with general IEEE semantics, where "inexact" is only
raised if the final step of rounding the infinite-precision result to
the result type is inexact; for these functions, the
infinite-precision integer result is always representable in the
result type, so "inexact" should never be raised.

The generic implementations of ceil, floor and round functions contain
code to force "inexact" to be raised.  This patch removes it for floor
functions to align them with TS 18661-1 in this regard.  Note that
some architecture-specific versions may still raise "inexact", so the
tests are not updated and the bug is not yet fixed.

Tested for x86_64, x86 and mips64.

[BZ #15479]
* sysdeps/ieee754/dbl-64/s_floor.c: Do not mention "inexact"
exception in comment.
(huge): Remove variable.
(__floor): Do not force "inexact" exception.
* sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c: Do not mention
"inexact" exception in comment.
(huge): Remove variable.
(__floor): Do not force "inexact" exception.
* sysdeps/ieee754/flt-32/s_floorf.c: Do not mention "inexact"
exception in comment.
(huge): Remove variable.
(__floorf): Do not force "inexact" exception.
* sysdeps/ieee754/ldbl-128/s_floorl.c: Do not mention "inexact"
exception in comment.
(huge): Remove variable.
(__floorl): Do not force "inexact" exception.

8 years agoDo not raise "inexact" from generic ceil (bug 15479).
Joseph Myers [Tue, 24 May 2016 17:42:10 +0000 (17:42 +0000)] 
Do not raise "inexact" from generic ceil (bug 15479).

C99 and C11 allow but do not require ceil, floor, round and trunc to
raise the "inexact" exception for noninteger arguments.  TS 18661-1
requires that this exception not be raised by these functions.  This
aligns them with general IEEE semantics, where "inexact" is only
raised if the final step of rounding the infinite-precision result to
the result type is inexact; for these functions, the
infinite-precision integer result is always representable in the
result type, so "inexact" should never be raised.

The generic implementations of ceil, floor and round functions contain
code to force "inexact" to be raised.  This patch removes it for ceil
functions to align them with TS 18661-1 in this regard.  Note that
some architecture-specific versions may still raise "inexact", so the
tests are not updated and the bug is not yet fixed.

Tested for x86_64, x86 and mips64.

[BZ #15479]
* sysdeps/ieee754/dbl-64/s_ceil.c: Do not mention "inexact"
exception in comment.
(huge): Remove variable.
(__ceil): Do not force "inexact" exception.
* sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c: Do not mention
"inexact" exception in comment.
(huge): Remove variable.
(__ceil): Do not force "inexact" exception.
* sysdeps/ieee754/flt-32/s_ceilf.c (huge): Remove variable.
(__ceilf): Do not force "inexact" exception.
* sysdeps/ieee754/ldbl-128/s_ceill.c: Do not mention "inexact"
exception in comment.
(huge): Remove variable.
(__ceill): Do not force "inexact" exception.

8 years agoAvoid an extra branch to PLT for -z now
H.J. Lu [Tue, 24 May 2016 15:44:10 +0000 (08:44 -0700)] 
Avoid an extra branch to PLT for -z now

When --enable-bind-now is used to configure glibc build, we can avoid
an extra branch to the PLT entry by using indirect branch via the GOT
slot instead, which is similar to the first instructuon in the PLT
entry.  Changes in the shared library sizes in text sections:

Shared library    Before (bytes)   After (bytes)
libm.so             1060813          1060797
libmvec.so           160881           160805
libpthread.so         94992            94984
librt.so              25064            25048

* config.h.in (BIND_NOW): New.
* configure.ac (BIND_NOW): New.  Defined for --enable-bind-now.
* configure: Regenerated.
* sysdeps/x86_64/sysdep.h (JUMPTARGET)[BIND_NOW]: Defined to
indirect branch via the GOT slot.

8 years agoS390: Implement mempcpy with help of memcpy. [BZ #19765]
Stefan Liebler [Tue, 24 May 2016 08:39:13 +0000 (10:39 +0200)] 
S390: Implement mempcpy with help of memcpy. [BZ #19765]

There exist optimized memcpy functions on s390, but no optimized mempcpy.
This patch adds mempcpy entry points in memcpy.S files, which
use the memcpy implementation. Now mempcpy itself is also an IFUNC function
as memcpy is and the variants are listed in ifunc-impl-list.c.

The s390 string.h does not define _HAVE_STRING_ARCH_mempcpy.
Instead mempcpy string/string.h inlines memcpy() + n.
If n is constant and small enough, GCC emits instructions like mvi or mvc
and avoids the function call to memcpy.
If n is not constant, then memcpy is called and n is added afterwards.
If _HAVE_STRING_ARCH_mempcpy would be defined, mempcpy would be called in
every case.

According to PR70140 "Inefficient expansion of __builtin_mempcpy"
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70140) GCC should handle a
call to mempcpy in the same way as memcpy. Then either the mempcpy macro
in string/string.h has to be removed or _HAVE_STRING_ARCH_mempcpy has to
be defined for S390.

ChangeLog:

[BZ #19765]
* sysdeps/s390/mempcpy.S: New File.
* sysdeps/s390/multiarch/mempcpy.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add mempcpy.
* sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list):
Add mempcpy variants.
* sysdeps/s390/s390-32/memcpy.S: Add mempcpy entry point.
(memcpy): Adjust to be usable from mempcpy entry point.
(__memcpy_mvcle): Likewise.
* sysdeps/s390/s390-64/memcpy.S: Likewise.
* sysdeps/s390/s390-32/multiarch/memcpy-s390.S: Add entry points
____mempcpy_z196, ____mempcpy_z10 and add __GI_ symbols for mempcpy.
(__memcpy_z196): Adjust to be usable from mempcpy entry point.
(__memcpy_z10): Likewise.
* sysdeps/s390/s390-64/multiarch/memcpy-s390x.S: Likewise.

8 years agoS390: Do not call memcpy, memcmp, memset within libc.so via ifunc-plt.
Stefan Liebler [Tue, 24 May 2016 08:39:13 +0000 (10:39 +0200)] 
S390: Do not call memcpy, memcmp, memset within libc.so via ifunc-plt.

On s390, the memcpy, memcmp, memset functions are IFUNC symbols,
which are created with s390_libc_ifunc-macro.
This macro creates a __GI_ symbol which is set to the
ifunced symbol. Thus calls within libc.so to e.g. memcpy
result in a call to *ABS*+0x954c0@plt stub and afterwards
to the resolved memcpy-ifunc-variant.

This patch sets the __GI_ symbol to the default-ifunc-variant
to avoid the plt call. The __GI_ symbols are now created at the
default variant of ifunced function.

ChangeLog:

* sysdeps/s390/multiarch/ifunc-resolve.h (s390_libc_ifunc):
Remove __GI_ symbol.
* sysdeps/s390/s390-32/multiarch/memcmp-s390.S: Add __GI_memcmp symbol.
* sysdeps/s390/s390-64/multiarch/memcmp-s390x.S: Likewise.
* sysdeps/s390/s390-32/multiarch/memcpy-s390.S: Add __GI_memcpy symbol.
* sysdeps/s390/s390-64/multiarch/memcpy-s390x.S: Likewise.
* sysdeps/s390/s390-32/multiarch/memset-s390.S: Add __GI_memset symbol.
* sysdeps/s390/s390-64/multiarch/memset-s390x.S: Likewise.

8 years agoS390: Use 64bit instruction to check for copies of > 1MB with mvcle.
Stefan Liebler [Tue, 24 May 2016 08:39:13 +0000 (10:39 +0200)] 
S390: Use 64bit instruction to check for copies of > 1MB with mvcle.

The __memcpy_default variant on s390 64bit calculates the number of
256byte blocks in a 64bit register and checks, if they exceed 1MB
to jump to mvcle. Otherwise a mvc-loop is used. The compare-instruction
only checks a 32bit value.
This patch uses a 64bit compare.

ChangeLog:

* sysdeps/s390/s390-64/memcpy.S (memcpy):
Use cghi instead of chi to compare 64bit value.

8 years agoS390: Use mvcle for copies > 1MB on 32bit with default memcpy variant.
Stefan Liebler [Tue, 24 May 2016 08:39:13 +0000 (10:39 +0200)] 
S390: Use mvcle for copies > 1MB on 32bit with default memcpy variant.

If more than 255 bytes should be copied, the algorithm jumps away.
Before this patch, it jumps to the mvc-loop (.L_G5_12).
Now it jumps first to the "> 1MB" check, which jumps away to
__memcpy_mvcle. Otherwise, the mvc-loop (.L_G5_12) copies the bytes.

ChangeLog:

* sysdeps/s390/s390-32/memcpy.S (memcpy):
Jump to 1MB check before executing mvc-loop.

8 years agomalloc: Correct malloc alignment on 32-bit architectures [BZ #6527]
Florian Weimer [Tue, 24 May 2016 06:05:15 +0000 (08:05 +0200)] 
malloc: Correct malloc alignment on 32-bit architectures [BZ #6527]

After the heap rewriting added in commit
4cf6c72fd2a482e7499c29162349810029632c3f (malloc: Rewrite dumped heap
for compatibility in __malloc_set_state), we can change malloc alignment
for new allocations because the alignment of old allocations no longer
matters.

We need to increase the malloc state version number, so that binaries
containing dumped heaps of the new layout will not try to run on
previous versions of glibc, resulting in obscure crashes.

This commit addresses a failure of tst-malloc-thread-fail on the
affected architectures (32-bit ppc and mips) because the test checks
pointer alignment.

8 years agoRefactor tst-strtod6.c
Paul E. Murphy [Mon, 9 May 2016 19:20:17 +0000 (14:20 -0500)] 
Refactor tst-strtod6.c

Use the type-generic macros in tst-strtod.h to simplify this
test case and enable extension to future variants of this
functions.

8 years agoRefactor bug-strtod2.c to be type generic
Paul E. Murphy [Fri, 6 May 2016 21:13:29 +0000 (16:13 -0500)] 
Refactor bug-strtod2.c to be type generic

This only tested for strtod. This expands the testing to
all variants of strto*.

8 years agoRefactor bug-strtod.c to better test new types.
Paul E. Murphy [Fri, 6 May 2016 21:00:39 +0000 (16:00 -0500)] 
Refactor bug-strtod.c to better test new types.

This introduces tst-strtod.h to contain some macros
to assist with updating strto{f,d,ld} test code to
support additional variants of this function.

8 years agoCVE-2016-4429: sunrpc: Do not use alloca in clntudp_call [BZ #20112]
Florian Weimer [Mon, 23 May 2016 18:18:34 +0000 (20:18 +0200)] 
CVE-2016-4429: sunrpc: Do not use alloca in clntudp_call [BZ #20112]

The call is technically in a loop, and under certain circumstances
(which are quite difficult to reproduce in a test case), alloca
can be invoked repeatedly during a single call to clntudp_call.
As a result, the available stack space can be exhausted (even
though individual alloca sizes are bounded implicitly by what
can fit into a UDP packet, as a side effect of the earlier
successful send operation).

8 years agoMake padding in struct sockaddr_storage explicit [BZ #20111]
Florian Weimer [Mon, 23 May 2016 17:43:09 +0000 (19:43 +0200)] 
Make padding in struct sockaddr_storage explicit [BZ #20111]

This avoids aliasing issues with GCC 6 in -fno-strict-aliasing
mode.  (With implicit padding, not all data is copied.)

This change makes it explicit that struct sockaddr_storage is
only 126 bytes large on m68k (unlike elsewhere, where we end up
with the requested 128 bytes).  The new test case makes sure that
this does not happen on other architectures.

8 years agoconformtest: Correct some limits.h expectations for XPG3, XPG4.
Joseph Myers [Mon, 23 May 2016 15:25:34 +0000 (15:25 +0000)] 
conformtest: Correct some limits.h expectations for XPG3, XPG4.

The conform/ test of limits.h namespace for XPG3 was failing because
of NL_* and NZERO defines.  Those symbols are EX-shaded, not
UX-shaded, so it's correct for them to be defined for XPG3; this patch
corrects the expectations accordingly.  (Actually it looks like they
should not be listed as optional for these standards, but that's
another matter.)

Tested for x86_64 and x86.

* conform/data/limits.h-data (CHARCLASS_NAME_MAX): Also expect for
[XPG3 || XPG4].
(NL_ARGMAX): Also expect for [XPG3].
(NL_LANGMAX): Likewise.
(NL_MSGMAX): Likewise.
(NL_NMAX): Likewise.
(NL_SETMAX): Likewise.
(NL_TEXTMAX): Likewise.
(NZERO): Likewise.
(TMP_MAX): Likewise.
* conform/Makefile (test-xfail-XPG3/limits.h/conform): Remove
variable.

8 years agoUpdate sysdeps/unix/sysv/linux/bits/socket.h for Linux 4.6.
Joseph Myers [Mon, 23 May 2016 13:27:37 +0000 (13:27 +0000)] 
Update sysdeps/unix/sysv/linux/bits/socket.h for Linux 4.6.

This patch updates sysdeps/unix/sysv/linux/bits/socket.h for new
constants added in Linux 4.6.  AF_KCM / PF_KCM are added.  SOL_KCM is
new, and I added a lot of SOL_* values postdating the last one present
in the header, since I saw no apparent reason for the set in glibc to
stop at SOL_IRDA.  MSG_BATCH is added; Linux also has
MSG_SENDPAGE_NOTLAST which is not in glibc, but given the comment
starts "sendpage() internal" I presume it's correct for it not to be
in glibc.

(Note that this is a case where the Linux kernel header with userspace
relevant values is *not* a uapi header but include/linux/socket.h - I
don't know why, but at least this header, as well as uapi headers,
needs reviewing for glibc-relevant changes each release.)

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

* sysdeps/unix/sysv/linux/bits/socket.h (PF_KCM): New macro.
(PF_MAX): Update value.
(AF_KCM): New macro.
(SOL_NETBEUI): Likewise.
(SOL_LLC): Likewise.
(SOL_DCCP): Likewise.
(SOL_NETLINK): Likewise.
(SOL_TIPC): Likewise.
(SOL_RXRPC): Likewise.
(SOL_PPPOL2TP): Likewise.
(SOL_BLUETOOTH): Likewise.
(SOL_PNPIPE): Likewise.
(SOL_RDS): Likewise.
(SOL_IUCV): Likewise.
(SOL_CAIF): Likewise.
(SOL_ALG): Likewise.
(SOL_NFC): Likewise.
(SOL_KCM): Likewise.
(MSG_BATCH): New enum value and macro.

8 years agoRemove special L2 cache case for Knights Landing
H.J. Lu [Fri, 20 May 2016 21:41:14 +0000 (14:41 -0700)] 
Remove special L2 cache case for Knights Landing

L2 cache is shared by 2 cores on Knights Landing, which has 4 threads
per core:

https://en.wikipedia.org/wiki/Xeon_Phi#Knights_Landing

So L2 cache is shared by 8 threads on Knights Landing as reported by
CPUID.  We should remove special L2 cache case for Knights Landing.

[BZ #18185]
* sysdeps/x86/cacheinfo.c (init_cacheinfo): Don't limit threads
sharing L2 cache to 2 for Knights Landing.

8 years agoconformtest: Correct ftw.h expectations for XPG3, XPG4.
Joseph Myers [Fri, 20 May 2016 19:45:06 +0000 (19:45 +0000)] 
conformtest: Correct ftw.h expectations for XPG3, XPG4.

This patch corrects various conformtest expectations in ftw.h for XPG3
and XPG4.

Tested for x86_64 and x86.

* conform/data/ftw.h-data (struct FTW): Do not expect for [XPG3].
(FTW_DP): Do not expect for [XPG3 || XPG4].
(FTW_SL): Do not expect for [XPG3].
(FTW_SLN): Likewise.
(FTW_PHYS): Likewise.
(FTW_MOUNT): Likewise.
(FTW_DEPTH): Likewise.
(FTW_CHDIR): Likewise.
(nftw): Likewise.
* conform/Makefile (test-xfail-XPG3/ftw.h/conform): Remove
variable.

8 years agomanual: fix typos in error reporting
ricaljasan@pacific.net [Fri, 6 May 2016 07:54:30 +0000 (00:54 -0700)] 
manual: fix typos in error reporting

8 years agomanual: fix typo in the introduction
ricaljasan@pacific.net [Fri, 6 May 2016 07:54:29 +0000 (00:54 -0700)] 
manual: fix typo in the introduction

8 years agoImplement proper fmal for ldbl-128ibm (bug 13304).
Joseph Myers [Thu, 19 May 2016 20:10:56 +0000 (20:10 +0000)] 
Implement proper fmal for ldbl-128ibm (bug 13304).

ldbl-128ibm had an implementation of fmal that just did (x * y) + z in
most cases, with no attempt at actually being a fused operation.

This patch replaces it with a genuine fused operation.  It is not
necessarily correctly rounding, but should produce a result at least
as accurate as the long double arithmetic operations in libgcc, which
I think is all that can reasonably be expected for such a non-IEEE
format where arithmetic is approximate rather than rounded according
to any particular rule for determining the exact result.  Like the
libgcc arithmetic, it may produce spurious overflow and underflow
results, and it falls back to the libgcc multiplication in the case of
(finite, finite, zero).

This concludes the fixes for bug 13304; any subsequently found fma
issues should go in separate Bugzilla bugs.  Various other pieces of
bug 13304 were fixed in past releases over the past several years.

Tested for powerpc.

[BZ #13304]
* sysdeps/ieee754/ldbl-128ibm/s_fmal.c: Include <fenv.h>,
<float.h>, <math_private.h> and <stdlib.h>.
(add_split): New function.
(mul_split): Likewise.
(ext_val): New typedef.
(store_ext_val): New function.
(mul_ext_val): New function.
(compare): New function.
(add_split_ext): New function.
(__fmal): After checking for Inf, NaN and zero, compute result as
an exact sum of scaled double values in round-to-nearest before
adding those up and adjusting for other rounding modes.
* math/auto-libm-test-in: Remove xfail-rounding:ldbl-128ibm from
tests of fma.
* math/auto-libm-test-out: Regenerated.

8 years agoCorrect Intel processor level type mask from CPUID
H.J. Lu [Thu, 19 May 2016 17:02:36 +0000 (10:02 -0700)] 
Correct Intel processor level type mask from CPUID

Intel CPUID with EAX == 11 returns:

ECX Bits 07 - 00: Level number. Same value in ECX input.
    Bits 15 - 08: Level type.
    ^^^^^^^^^^^^^^^^^^^^^^^^ This is level type.
    Bits 31 - 16: Reserved.

Intel processor level type mask should be 0xff00, not 0xff0.

[BZ #20119]
* sysdeps/x86/cacheinfo.c (init_cacheinfo): Correct Intel
processor level type mask for CPUID with EAX == 11.

8 years agoCheck the HTT bit before counting logical threads
H.J. Lu [Thu, 19 May 2016 16:09:00 +0000 (09:09 -0700)] 
Check the HTT bit before counting logical threads

Skip counting logical threads for Intel processors if the HTT bit is 0
which indicates there is only a single logical processor.

* sysdeps/x86/cacheinfo.c (init_cacheinfo): Skip counting
logical threads if the HTT bit is 0.
* sysdeps/x86/cpu-features.h (bit_cpu_HTT): New.
(index_cpu_HTT): Likewise.
(reg_HTT): Likewise.

8 years agoRemove alignments on jump targets in memset
H.J. Lu [Thu, 19 May 2016 15:49:45 +0000 (08:49 -0700)] 
Remove alignments on jump targets in memset

X86-64 memset-vec-unaligned-erms.S aligns many jump targets, which
increases code sizes, but not necessarily improve performance.  As
memset benchtest data of align vs no align on various Intel and AMD
processors

https://sourceware.org/bugzilla/attachment.cgi?id=9277

shows that aligning jump targets isn't necessary.

[BZ #20115]
* sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S (__memset):
Remove alignments on jump targets.

8 years agoconformtest: Correct pwd.h expectations for XPG3.
Joseph Myers [Thu, 19 May 2016 14:48:30 +0000 (14:48 +0000)] 
conformtest: Correct pwd.h expectations for XPG3.

This patch corrects some conformtest expectations for pwd.h for XPG4.

Tested for x86_64 and x86.

* conform/data/pwd.h-data (endpwent): Do not expect for [XPG3].
(getpwent): Likewise.
(setpwent): Likewise.
* conform/Makefile (test-xfail-XPG3/pwd.h/conform): Remove
variable.

8 years agoconformtest: Correct search.h expectations for XPG3.
Joseph Myers [Thu, 19 May 2016 14:35:41 +0000 (14:35 +0000)] 
conformtest: Correct search.h expectations for XPG3.

This patch corrects some conformtest expectations for search.h for
XPG3.

Tested for x86_64 and x86.

* conform/data/search.h-data (insque): Do not expect for [XPG3].
(remque): Likewise.
* conform/Makefile (test-xfail-XPG3/search.h/conform): Remove
variable.

8 years agoUpdate libm-test.inc comment about NaN signs.
Joseph Myers [Wed, 18 May 2016 21:57:25 +0000 (21:57 +0000)] 
Update libm-test.inc comment about NaN signs.

libm-test.inc has a comment about signs of NaNs not being tested.
This is out of date since:

commit ce66581742e7ae1d6ce59e5d2d4859b2ae41218c
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Sat Nov 16 12:48:35 2013 +0000

    Test signs of NaNs in libm-test.inc where appropriate.

This patch removes the inaccurate statement.

* math/libm-test.inc: Update comment not to refer to signs of NaNs
not being tested.

8 years agoDon't call internal _Unwind_Resume via PLT
H.J. Lu [Wed, 18 May 2016 20:43:09 +0000 (13:43 -0700)] 
Don't call internal _Unwind_Resume via PLT

There is no need to call the internal funtion, _Unwind_Resume, which
is defined in unwind-forcedunwind.c, via PLT.

* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
(__condvar_cleanup2): Remove JUMPTARGET from  _Unwind_Resume
call.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
(__condvar_cleanup1): Likewise.

8 years agoDon't call internal __pthread_unwind via PLT
H.J. Lu [Wed, 18 May 2016 20:41:43 +0000 (13:41 -0700)] 
Don't call internal __pthread_unwind via PLT

Add PTHREAD_UNWIND to replace JUMPTARGET(__pthread_unwind) and define
it to __GI___pthread_unwind within libpthread.

* sysdeps/unix/sysv/linux/x86_64/cancellation.S (PTHREAD_UNWIND):
New
(__pthread_unwind): Renamed to ...
(PTHREAD_UNWIND): This.
(__pthread_enable_asynccancel): Replace
JUMPTARGET(__pthread_unwind) with PTHREAD_UNWIND.

8 years agoAdd CLONE_NEWCGROUP from Linux 4.6 to bits/sched.h.
Joseph Myers [Wed, 18 May 2016 17:46:52 +0000 (17:46 +0000)] 
Add CLONE_NEWCGROUP from Linux 4.6 to bits/sched.h.

This patch adds CLONE_NEWCGROUP, new in Linux 4.6, to
sysdeps/unix/sysv/linux/bits/sched.h.

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

* sysdeps/unix/sysv/linux/bits/sched.h [__USE_GNU]
(CLONE_NEWCGROUP): New macro.

8 years agoAdd Q_GETNEXTQUOTA from Linux 4.6 to sys/quota.h.
Joseph Myers [Wed, 18 May 2016 13:15:11 +0000 (13:15 +0000)] 
Add Q_GETNEXTQUOTA from Linux 4.6 to sys/quota.h.

This patch adds Q_GETNEXTQUOTA, new in Linux 4.6, to
sysdeps/unix/sysv/linux/sys/quota.h.

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

* sysdeps/unix/sysv/linux/sys/quota.h [_LINUX_QUOTA_VERSION >= 2]
(Q_GETNEXTQUOTA): New macro.

8 years agoClear destination buffer updated by the previous run
H.J. Lu [Wed, 18 May 2016 12:48:56 +0000 (05:48 -0700)] 
Clear destination buffer updated by the previous run

Clear the destination buffer updated by the previous run in bench-memcpy.c
and test-memcpy.c to catch the error when the following implementations do
not copy anything.

[BZ #19907]
* benchtests/bench-memcpy.c (do_one_test): Clear the destination
buffer updated by the previous run.
* string/test-memcpy.c (do_one_test): Likewise.
* benchtests/bench-memmove.c (do_one_test): Add a comment.
* string/test-memmove.c (do_one_test): Likewise.

8 years agoDo not declare grantpt, ptsname, unlockpt in stdlib.h for XPG3 (bug 20094).
Joseph Myers [Tue, 17 May 2016 15:51:55 +0000 (15:51 +0000)] 
Do not declare grantpt, ptsname, unlockpt in stdlib.h for XPG3 (bug 20094).

stdlib.h declares grantpt, ptsname, unlockpt for __USE_XOPEN.  This
patch corrects the condition to __USE_XOPEN_EXTENDED (these functions
are new in XPG4).

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

[BZ #20094]
* stdlib/stdlib.h (grantpt): Declare if [__USE_XOPEN_EXTENDED],
not [__USE_XOPEN].
(unlockpt): Likewise.
(ptsname): Likewise.
* conform/Makefile (test-xfail-XPG3/stdlib.h/conform): Remove
variable.

8 years agoMake sys/stat.h define S_IFSOCK, S_ISSOCK for XPG4 (bug 20076).
Joseph Myers [Tue, 17 May 2016 15:50:00 +0000 (15:50 +0000)] 
Make sys/stat.h define S_IFSOCK, S_ISSOCK for XPG4 (bug 20076).

sys/stat.h should define S_IFSOCK and S_ISSOCK for XPG4 (XNS), but
does not.  This patch corrects the relevant header conditionals.

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

[BZ #20076]
* io/sys/stat.h (S_IFSOCK): Define for [__USE_XOPEN_EXTENDED]
instead of [__USE_UNIX98].
(S_ISSOCK): Likewise.
* conform/Makefile (test-xfail-XPG4/sys/stat.h/conform): Remove
variable.

8 years agoFix stdlib.h rand_r namespace (bug 20074).
Joseph Myers [Tue, 17 May 2016 15:48:29 +0000 (15:48 +0000)] 
Fix stdlib.h rand_r namespace (bug 20074).

stdlib.h declares rand_r if __USE_POSIX; i.e., POSIX.1:1990.  But
rand_r was added along with threads, so the condition should be
__USE_POSIX199506.  This patch corrects the condition.

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

[BZ #20074]
* stdlib/stdlib.h (rand_r): Declare if [__USE_POSIX199506], not if
[__USE_POSIX].
* conform/Makefile (test-xfail-XPG4/stdlib.h/conform): Remove
variable.

8 years agoCorrect ttyslot header declaration conditions (bug 20051).
Joseph Myers [Tue, 17 May 2016 15:47:20 +0000 (15:47 +0000)] 
Correct ttyslot header declaration conditions (bug 20051).

UNIX98 and XPG4 have ttyslot in <stdlib.h>.  glibc, however, has it in
<unistd.h>, for __USE_MISC || (__USE_XOPEN_EXTENDED && !__USE_UNIX98),
but no supported standard has it in <unistd.h>.

This patch adds a properly conditioned declaration to <stdlib.h> (only
enabled for the relevant standards, not for __USE_MISC or __USE_GNU).
The <unistd.h> declaration is restricted to __USE_MISC.  Some relevant
XFAILs are removed.

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

[BZ #20051]
* posix/unistd.h [__USE_XOPEN_EXTENDED && !__USE_UNIX98]
(ttyslot): Do not declare.
* stdlib/stdlib.h [__USE_XOPEN_EXTENDED && !__USE_XOPEN2K]
(ttyslot): New prototype.
* conform/Makefile (test-xfail-XPG4/unistd.h/conform): Remove
variable.
(test-xfail-UNIX98/stdlib.h/conform): Likewise.

8 years agoFix tst-cancel17/tst-cancelx17, which sometimes segfaults while exiting.
Stefan Liebler [Tue, 17 May 2016 08:45:48 +0000 (10:45 +0200)] 
Fix tst-cancel17/tst-cancelx17, which sometimes segfaults while exiting.

The testcase tst-cancel[x]17 ends sometimes with a segmentation fault.
This happens in one of 10000 cases. Then the real testcase has already
exited with success and returned from do_test(). The segmentation fault
occurs after returning from main in _dl_fini().

In those cases, the aio_read(&a) was not canceled because the read
request was already in progress. In the meanwhile aio_write(ap) wrote
something to the pipe and the read request is able to read the
requested byte.
The read request hasn't finished before returning from do_test().
After it finishes, it writes the return value and error code from the
read syscall to the struct aiocb a, which lies on the stack of do_test.
The stack of the subsequent function call of _dl_fini or _dl_sort_fini,
which is inlined in _dl_fini is corrupted.

In case of S390, it reads a zero and decrements it by 1:
unsigned int k = nmaps - 1;
struct link_map **runp = maps[k]->l_initfini;
The load from unmapped memory leads to the segmentation fault.
The stack corruption also happens on other architectures.
I saw them e.g. on x86 and ppc, too.

This patch adds an aio_suspend call to ensure, that the read request
is finished before returning from do_test().

ChangeLog:

* nptl/tst-cancel17.c (do_test): Wait for finishing aio_read(&a).

8 years agotst-mallocfork2: Fix race condition, use fewer resources
Florian Weimer [Fri, 13 May 2016 14:55:01 +0000 (16:55 +0200)] 
tst-mallocfork2: Fix race condition, use fewer resources

The first SIGUSR1 signal could arrive when sigusr1_sender_pid
was still 0.  As a result, kill would send SIGSTOP to the
entire process group.  This would cause the test to hang before
printing any output.

This commit also adds a sched_yield to the signal source, so that
it does not flood the parent process with signals it has never a
chance to handle.

Even with these changes, tst-mallocfork2 still fails reliably
after the fix in commit commit 56290d6e762c1194547e73ff0b948cd79d3a1e03
(Increase fork signal safety for single-threaded processes) is
backed out.

8 years agoconformtest: Correct some stdlib.h expectations for XPG3.
Joseph Myers [Fri, 13 May 2016 17:26:04 +0000 (17:26 +0000)] 
conformtest: Correct some stdlib.h expectations for XPG3.

This patch corrects some spurious conformtest stdlib.h expectations
for XPG3 (not based on a full review of the expectations for that
standard, so other issues may remain).

Tested for x86_64 and x86.

* conform/data/stdlib.h-data (a64l): Do not expect for [XPG3].
(ecvt): Likewise.
(fcvt): Likewise.
(gcvt): Likewise.
(getsubopt): Likewise.
(grantpt): Likewise.
(initstate): Likewise.
(l64a): Likewise.
(mktemp): Likewise.
(mkstemp): Likewise.
(ptsname): Likewise.
(random): Likewise.
(realpath): Likewise.
(setstate): Likewise.
(srandom): Likewise.
(ttyslot): Likewise.
(unlockpt): Likewise.
(valloc): Likewise.

8 years agoconformtest: Do not expect strdup in string.h for XPG3.
Joseph Myers [Fri, 13 May 2016 16:57:09 +0000 (16:57 +0000)] 
conformtest: Do not expect strdup in string.h for XPG3.

This patch corrects a spurious conformtest expectation of strdup in
string.h for XPG3.

Tested for x86_64 and x86.

* conform/data/string.h-data (strdup): Do not expect for [XPG3].
* conform/Makefile (test-xfail-XPG3/string.h/conform): Remove
variable.

8 years agoCall init_cpu_features only if SHARED is defined
H.J. Lu [Fri, 13 May 2016 15:29:22 +0000 (08:29 -0700)] 
Call init_cpu_features only if SHARED is defined

In static executable, since init_cpu_features is called early from
__libc_start_main, there is no need to call it again in dl_platform_init.

[BZ #20072]
* sysdeps/i386/dl-machine.h (dl_platform_init): Call
init_cpu_features only if SHARED is defined.
* sysdeps/x86_64/dl-machine.h (dl_platform_init): Likewise.

8 years agoSupport non-inclusive caches on Intel processors
H.J. Lu [Fri, 13 May 2016 14:18:25 +0000 (07:18 -0700)] 
Support non-inclusive caches on Intel processors

* sysdeps/x86/cacheinfo.c (init_cacheinfo): Check and support
non-inclusive caches on Intel processors.

8 years agomalloc: Rewrite dumped heap for compatibility in __malloc_set_state
Florian Weimer [Fri, 13 May 2016 12:16:39 +0000 (14:16 +0200)] 
malloc: Rewrite dumped heap for compatibility in __malloc_set_state

This will allow us to change many aspects of the malloc implementation
while preserving compatibility with existing Emacs binaries.

As a result, existing Emacs binaries will have a larger RSS, and Emacs
needs a few more milliseconds to start.  This overhead is specific
to Emacs (and will go away once Emacs switches to its internal malloc).

The new checks to make free and realloc compatible with the dumped heap
are confined to the mmap paths, which are already quite slow due to the
munmap overhead.

This commit weakens some security checks, but only for heap pointers
in the dumped main arena.  By default, this area is empty, so those
checks are as effective as before.

8 years agoconformtest: Correct time.h XPG3 expectations.
Joseph Myers [Thu, 12 May 2016 20:47:15 +0000 (20:47 +0000)] 
conformtest: Correct time.h XPG3 expectations.

This patch corrects spurious conformtest expectations of getdate and
getdate_err for XPG3.  (This is not based on a full review of the
expectations, so there may be other issues where the header and tests
agree but are both incorrect.)

Tested for x86_64 and x86.

* conform/data/time.h-data (getdate_err): Do not expect for
[XPG3].
(getdate): Likewise.
* conform/Makefile (test-xfail-XPG3/time.h/conform): Remove
variable.

8 years agoconformtest: Correct some unistd.h expectations for XPG3, XPG4.
Joseph Myers [Thu, 12 May 2016 17:39:04 +0000 (17:39 +0000)] 
conformtest: Correct some unistd.h expectations for XPG3, XPG4.

The conformtest tests of unistd.h fail for XPG3 because of various
expectations that are incorrect for XPG3.  This patch corrects those
bogus expectations, and one bogus expectation for XPG4.  (This is not
based on a full review of the standards so there may well still be
other bugs in the expectations for this header.)

Tested for x86_64 and x86.

* conform/data/unistd.h-data (F_LOCK): Do not expect for [XPG3].
(F_ULOCK): Likewise.
(F_TEST): Likewise.
(F_TLOCK): Likewise.
(useconds_t): Likewise.
(intptr_t): Do not expect for [XPG3] or [XPG4].
(brk): Do not expect for [XPG3]
(fchown): Likewise.
(fchdir): Likewise.
(ftruncate): Likewise.
(getdtablesize): Likewise.
(gethostid): Likewise.
(getpagesize): Likewise.
(getpgid): Likewise.
(getsid): Likewise.
(getwd): Likewise.
(lchown): Likewise.
(lockf): Likewise.
(readlink): Likewise.
(sbrk): Likewise.
(setpgrp): Likewise.
(setregid): Likewise.
(setreuid): Likewise.
(symlink): Likewise.
(sync): Likewise.
(truncate): Likewise.
(ualarm): Likewise.
(usleep): Likewise.
(vfork): Likewise.
* conform/Makefile (test-xfail-XPG3/unistd.h/conform): Remove
variable.

8 years agoDeclare gethostname for XPG4 (bug 20054).
Joseph Myers [Thu, 12 May 2016 16:50:43 +0000 (16:50 +0000)] 
Declare gethostname for XPG4 (bug 20054).

unistd.h declares gethostname for __USE_UNIX98 || __USE_XOPEN2K.  But
it's also in XPG4 (XNS volume - C438 - not the main definitions of
system interfaces and headers in C435).  This patch corrects the
condition.

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

[BZ #20054]
* posix/unistd.h (gethostname): Declare if [__USE_XOPEN_EXTENDED],
not [__USE_UNIX98].
* conform/data/unistd.h-data (gethostname): Do not expect for
[XPG3].

8 years agoconformtest: Do not expect S_IF* in fcntl.h.
Joseph Myers [Thu, 12 May 2016 16:46:55 +0000 (16:46 +0000)] 
conformtest: Do not expect S_IF* in fcntl.h.

The conform/ tests for fcntl.h are failing for XPG3 and XPG4 because
of missing S_IFSOCK.

This is a case of a bogus test.  The relevant wording requiring such
constants is, in current POSIX (and this requirement dates back as far
as XPG4), "The <fcntl.h> header shall define the symbolic constants
for file modes for use as values of mode_t as described in
<sys/stat.h>.".  Note that this is *file modes* not *file types*.
That makes sense, since the point is presumably for use with functions
such as open that are declared in fcntl.h, where file modes are
relevant but file types aren't.  So this patch removes all those
spurious S_IF* expectations for fcntl.h (the macros are generally
still *allowed* through the permission to make everything from
sys/stat.h visible).

Tested for x86_64 and x86.

* conform/data/fcntl.h-data [!POSIX] (S_IFMT): Do not expect.
[!POSIX] (S_IFBLK): Likewise.
[!POSIX] (S_IFCHR): Likewise.
[!POSIX] (S_IFIFO): Likewise.
[!POSIX] (S_IFREG): Likewise.
[!POSIX] (S_IFDIR): Likewise.
[!POSIX] (S_IFLNK): Likewise.
[!POSIX] (S_IFSOCK): Likewise.
* conform/Makefile (test-xfail-XPG3/fcntl.h/conform): Remove
variable.
(test-xfail-XPG4/fcntl.h/conform): Likewise.

8 years agoThis is an optimized memset for AArch64. Memset is split into 4 main cases:
Wilco Dijkstra [Thu, 12 May 2016 15:41:00 +0000 (16:41 +0100)] 
This is an optimized memset for AArch64.  Memset is split into 4 main cases:
small sets of up to 16 bytes, medium of 16..96 bytes which are fully unrolled.
Large memsets of more than 96 bytes align the destination and use an unrolled
loop processing 64 bytes per iteration.  Memsets of zero of more than 256 use
the dc zva instruction, and there are faster versions for the common ZVA sizes
64 or 128.  STP of Q registers is used to reduce codesize without loss of
performance.

The speedup on test-memset is 1% on Cortex-A57 and 8% on Cortex-A53.

* sysdeps/aarch64/memset.S (__memset):
Rewrite of optimized memset.

8 years agoIncrease fork signal safety for single-threaded processes [BZ #19703]
Florian Weimer [Thu, 12 May 2016 06:54:17 +0000 (08:54 +0200)] 
Increase fork signal safety for single-threaded processes [BZ #19703]

This provides a band-aid and addresses the scenario where fork is
called from a signal handler while the process is in the malloc
subsystem (or has acquired the libio list lock).  It does not
address the general issue of async-signal-safety of fork;
multi-threaded processes are not covered, and some glibc
subsystems have fork handlers which are not async-signal-safe.

8 years agogetaddrinfo: Convert from extend_alloca to struct scratch_buffer
Florian Weimer [Thu, 12 May 2016 08:39:29 +0000 (10:39 +0200)] 
getaddrinfo: Convert from extend_alloca to struct scratch_buffer

8 years agoDeclare tcgetsid for XPG4 (bug 20055).
Joseph Myers [Wed, 11 May 2016 18:05:37 +0000 (18:05 +0000)] 
Declare tcgetsid for XPG4 (bug 20055).

termios.h should declare tcgetsid for XPG4, but only does so for
__USE_UNIX98 || __USE_XOPEN2K8 at present.  This patch fixes the
declaration conditions.  A spurious conformtest expectation of this
declaration for XPG3 is removed, and two XFAILs that are fixed by
these changes are also removed.

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

[BZ #20055]
* termios/termios.h (pid_t): Define for [__USE_XOPEN_EXTENDED]
instead of [__USE_UNIX98].
(tcgetsid): Declare for [__USE_XOPEN_EXTENDED] instead of
[__USE_UNIX98].
* conform/data/termios.h-data (tcgetsid): Do not expect for
[XPG3].
* conform/Makefile (test-xfail-XPG3/termios.h/conform): Remove
variable.
(test-xfail-XPG4/termios.h/conform): Likewise.

8 years agolocaledef: Do not compile with mcheck
Florian Weimer [Wed, 11 May 2016 14:56:59 +0000 (16:56 +0200)] 
localedef: Do not compile with mcheck

__malloc_initialize_hook is deprecated.

8 years agoS390: Use fPIC to avoid R_390_GOT12 relocation in gcrt1.o.
Stefan Liebler [Wed, 11 May 2016 13:51:25 +0000 (15:51 +0200)] 
S390: Use fPIC to avoid R_390_GOT12 relocation in gcrt1.o.

if glibc is build with -march=z900 | -march=z990,
the startup file gcrt1.o (used if you link with gcc -pg)
contains R_390_GOT12 | R_390_GOT20 relocations.
Thus, an entry in the GOT can be addressed relative to the GOT pointer
with a 12 | 20 bit displacement value.
The startup files should not contain R_390_GOT12,
R_390_GOT20 relocations, but R_390_GOTENT ones.

This patch removes the overrides of pic-ccflag and
the default pic-ccflag = -fPIC in Makeconfig
is used instead to get the R_390_GOTENT relocations in gcrt1.o.

ChangeLog:

* sysdeps/s390/s390-32/Makefile (pic-ccflag): Remove.
* sysdeps/s390/s390-64/Makefile: Likewise.

8 years agoRemove x86 ifunc-defines.sym and rtld-global-offsets.sym
H.J. Lu [Wed, 11 May 2016 12:49:09 +0000 (05:49 -0700)] 
Remove x86 ifunc-defines.sym and rtld-global-offsets.sym

Merge x86 ifunc-defines.sym with x86 cpu-features-offsets.sym.  Remove
x86 ifunc-defines.sym and rtld-global-offsets.sym.  No code changes on
i686 and x86-64.

* sysdeps/i386/i686/multiarch/Makefile (gen-as-const-headers):
Remove ifunc-defines.sym.
* sysdeps/x86_64/multiarch/Makefile (gen-as-const-headers):
Likewise.
* sysdeps/i386/i686/multiarch/ifunc-defines.sym: Removed.
* sysdeps/x86/rtld-global-offsets.sym: Likewise.
* sysdeps/x86_64/multiarch/ifunc-defines.sym: Likewise.
* sysdeps/x86/Makefile (gen-as-const-headers): Remove
rtld-global-offsets.sym.
* sysdeps/x86_64/multiarch/ifunc-defines.sym: Merged with ...
* sysdeps/x86/cpu-features-offsets.sym: This.
* sysdeps/x86/cpu-features.h: Include <cpu-features-offsets.h>
instead of <ifunc-defines.h> and <rtld-global-offsets.h>.

8 years agoFix sys/stat.h fchmod namespace (bug 20073).
Joseph Myers [Tue, 10 May 2016 21:52:08 +0000 (21:52 +0000)] 
Fix sys/stat.h fchmod namespace (bug 20073).

sys/stat.h declares fchmod if __USE_POSIX (i.e. POSIX.1:1990).  But it
was actually added in 1993 and also in XPG4.  This patch changes the
conditions to the correct __USE_POSIX199309 || __USE_XOPEN_EXTENDED.

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

[BZ #20073]
* io/sys/stat.h (fchmod): Declare for
[__USE_POSIX199309 || __USE_XOPEN_EXTENDED], not [__USE_POSIX].
* conform/Makefile (test-xfail-XPG3/sys/stat.h/conform): Remove
variable.

8 years agoconformtest: Correct some sys/stat.h expectations for XPG3.
Joseph Myers [Tue, 10 May 2016 17:48:23 +0000 (17:48 +0000)] 
conformtest: Correct some sys/stat.h expectations for XPG3.

This patch fixes various conformtest sys/stat.h expectations that were
incorrect for XPG3 (not based on a full review, so not necessarily an
exhaustive set of such corrections).  Most of these corrections fix
spurious failures shown in testing (but that for fchmod introduces a
correct failure, as that function is wrongly declared for XPG3, so
this doesn't eliminate any XFAILs).

Tested for x86_64 and x86.

* conform/data/sys/stat.h-data [XPG3] (S_IFLNK): Do not expect.
[XPG3] (S_IFSOCK): Likewise.
[XPG3] (S_ISVTX): Likewise.
[XPG3] (S_ISLNK): Likewise.
[XPG3] (S_ISSOCK): Likewise.
[XPG3] (fchmod): Likewise.
[XPG3] (lstat): Likewise.
[XPG3] (mknod): Likewise.

8 years agoconformtest: Fix st_blksize, st_blocks expectations for XPG3, XPG4.
Joseph Myers [Tue, 10 May 2016 15:20:09 +0000 (15:20 +0000)] 
conformtest: Fix st_blksize, st_blocks expectations for XPG3, XPG4.

The conformtest expectations expect the struct stat fields st_blksize
and st_blocks to be of types blksize_t and blkcnt_t.  But XPG4 does
not have those types, using long instead, and XPG3 does not have these
fields at all.  This patch adjusts the expectations for those
standards, XFAILing them for XPG4 to allow for systems where the
typedefs don't correspond to long.

Tested for x86_64 and x86.

* conform/data/sys/stat.h-data (st_blksize): Do not expect for
[XPG3].  Expect type long and XFAIL for [XPG4].
(st_blocks): Likewise.

8 years agoDeclare pthread_atfork in unistd.h for UNIX98 (bug 20044).
Joseph Myers [Tue, 10 May 2016 14:57:58 +0000 (14:57 +0000)] 
Declare pthread_atfork in unistd.h for UNIX98 (bug 20044).

For UNIX98 (only), unistd.h should declare pthread_atfork, but that
declaration is missing.  This patch adds it.

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

[BZ #20044]
* posix/unistd.h [__USE_UNIX98 && !__USE_XOPEN2K]
(pthread_atfork): New prototype.
* conform/Makefile (test-xfail-UNIX98/unistd.h/conform): Remove
variable.

8 years agoDeclare cuserid in unistd.h for UNIX98 and before (bug 20043).
Joseph Myers [Tue, 10 May 2016 14:56:49 +0000 (14:56 +0000)] 
Declare cuserid in unistd.h for UNIX98 and before (bug 20043).

For UNIX98 and older X/Open standards, unistd.h should have a
declaration of the legacy cuserid function, but such a declaration is
missing.  This patch adds that missing declaration.

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

[BZ #20043]
* posix/unistd.h [__USE_XOPEN && !__USE_XOPEN2K] (cuserid): New
prototype.

8 years agoresolv: Call gmtime_r instead of gmtime in p_secstodate [BZ #20017]
Florian Weimer [Tue, 10 May 2016 08:50:24 +0000 (10:50 +0200)] 
resolv: Call gmtime_r instead of gmtime in p_secstodate [BZ #20017]

8 years agogetaddrinfo: Restore RES_USE_INET6 flag on error path [BZ #19994]
Florian Weimer [Tue, 10 May 2016 08:09:24 +0000 (10:09 +0200)] 
getaddrinfo: Restore RES_USE_INET6 flag on error path [BZ #19994]

8 years agoconformtest: Remove some bogus sys/types.h expectations for XPG3 and XPG4.
Joseph Myers [Mon, 9 May 2016 21:10:10 +0000 (21:10 +0000)] 
conformtest: Remove some bogus sys/types.h expectations for XPG3 and XPG4.

The conformtest tests for sys/types.h for XPG3 and XPG4 fail because
of missing blksize_t.  This is a bug in the expectations; that type is
not part of those standards.  This patch stops the tests from
expecting it, and some other types that also are not part of XPG3 and
XPG4.

Tested for x86_64 and x86.

* conform/data/sys/types.h-data (blkcnt_t): Do not expect for
[XPG3 || XPG4].
(blksize_t): Likewise.
(clockid_t): Likewise.
* conform/Makefile (test-xfail-XPG3/sys/types.h/conform): Remove
variable.
(test-xfail-XPG4/sys/types.h/conform): Likewise.

8 years agoS390: Add support for vdso getcpu symbol.
Stefan Liebler [Mon, 9 May 2016 09:05:45 +0000 (11:05 +0200)] 
S390: Add support for vdso getcpu symbol.

This patch adds support for symbol __kernel_getcpu in vDSO,
which is available with kernel 4.5.
Now sched_getcpu is using this symbol if available in mapped vDSO
by defining macro HAVE_GETCPU_VSYSCALL. If not available at runtime,
the former syscall is used.

8 years agoMove sysdeps/x86_64/cacheinfo.c to sysdeps/x86
H.J. Lu [Sun, 8 May 2016 15:49:02 +0000 (08:49 -0700)] 
Move sysdeps/x86_64/cacheinfo.c to sysdeps/x86

Move sysdeps/x86_64/cacheinfo.c to sysdeps/x86.  No code changes on x86
and x86_64.

* sysdeps/i386/cacheinfo.c: Include <sysdeps/x86/cacheinfo.c>
instead of <sysdeps/x86_64/cacheinfo.c>.
* sysdeps/x86_64/cacheinfo.c: Moved to ...
* sysdeps/x86/cacheinfo.c: Here.

8 years agolocaledata: chr_US: new Cherokee locale [BZ #12143]
Neskie Manuel [Sun, 17 Apr 2016 23:20:18 +0000 (19:20 -0400)] 
localedata: chr_US: new Cherokee locale [BZ #12143]

8 years agocharmaps: IBM875: fix mapping of iota/upsilon variants [BZ #18453]
Dimitris Pappas [Fri, 22 Apr 2016 03:21:09 +0000 (23:21 -0400)] 
charmaps: IBM875: fix mapping of iota/upsilon variants [BZ #18453]

The letters ΐ/ϊ and ΰ/ϋ are swapped in the EBCDIC 875 map.
Verified against the original IBM spec.