]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
6 years agoAdd _Float64x function aliases.
Joseph Myers [Mon, 27 Nov 2017 14:16:47 +0000 (14:16 +0000)] 
Add _Float64x function aliases.

This patch continues filling out TS 18661-3 support by adding *f64x
function aliases on platforms with _Float64x support.  (It so happens
the set of such platforms is exactly the same as the set of platforms
with _Float128 support, although on x86_64, x86 and ia32 the _Float64x
format is Intel extended rather than binary128.)  The API provided
corresponds exactly to that provided for _Float128, mostly coming from
TS 18661-3.  As these functions always alias those for another type
(long double, _Float128 or both), __* function names are not provided,
as in other cases of alias types.

Given the preparation done in previous patches, this one just enables
the feature via Makeconfig and bits/floatn.h, adds symbol versions,
and updates documentation and ABI baselines.  The symbol versions are
present unconditionally as GLIBC_2.27 in the relevant Versions files,
as it's OK for those to specify versions for functions that may not be
present in some configurations; no additional complexity is needed
unless in future some configuration gains support for this type that
didn't have such support in 2.27.  The Makeconfig additions for ia64
and x86 aren't strictly needed, as those configurations also get
float64x-alias-fcts definitions from
sysdeps/ieee754/float128/Makeconfig, but still seem appropriate given
that _Float64x is not _Float128 for those configurations.

A libm-test-ulps update for x86 is included.  This is because
bits/mathinline.h does not have _Float64x support added and for two
functions the use of out-of-line functions results in increased ulps
(ifloat64x shares ulps with ildouble / ifloat128 as appropriate).
Given that we'd like generally to eliminate bits/mathinline.h
optimizations, preferring to have such optimizations in GCC instead,
it seems reasonable not to add such support there for new types.  GCC
support for _FloatN / _FloatNx built-in functions is limited, but has
been improved in GCC 8, and at some point I hope the full set of libm
built-in functions in GCC, and other optimizations with
per-floating-type aspects, will be enabled for all _FloatN / _FloatNx
types.

Tested for x86_64 and x86, and with build-many-glibcs.py, with both
GCC 6 and GCC 7.

* sysdeps/ia64/Makeconfig (float64x-alias-fcts): New variable.
* sysdeps/ieee754/float128/Makeconfig (float64x-alias-fcts):
Likewise.
* sysdeps/ieee754/ldbl-128/Makeconfig (float64x-alias-fcts):
Likewise.
* sysdeps/x86/Makeconfig: New file.
* bits/floatn-common.h (__HAVE_FLOAT64X): Remove macro.
(__HAVE_FLOAT64X_LONG_DOUBLE): Likewise.
* bits/floatn.h (__HAVE_FLOAT64X): New macro.
(__HAVE_FLOAT64X_LONG_DOUBLE): Likewise.
* sysdeps/ia64/bits/floatn.h (__HAVE_FLOAT64X): Likewise.
(__HAVE_FLOAT64X_LONG_DOUBLE): Likewise.
* sysdeps/ieee754/ldbl-128/bits/floatn.h (__HAVE_FLOAT64X):
Likewise.
(__HAVE_FLOAT64X_LONG_DOUBLE): Likewise.
* sysdeps/mips/ieee754/bits/floatn.h (__HAVE_FLOAT64X): Likewise.
(__HAVE_FLOAT64X_LONG_DOUBLE): Likewise.
* sysdeps/powerpc/bits/floatn.h (__HAVE_FLOAT64X): Likewise.
(__HAVE_FLOAT64X_LONG_DOUBLE): Likewise.
* sysdeps/x86/bits/floatn.h (__HAVE_FLOAT64X): Likewise.
(__HAVE_FLOAT64X_LONG_DOUBLE): Likewise.
* manual/math.texi (Mathematics): Document support for _Float64x.
* math/Versions (GLIBC_2.27): Add _Float64x functions.
* stdlib/Versions (GLIBC_2.27): Likewise.
* wcsmbs/Versions (GLIBC_2.27): Likewise.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.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/powerpc/powerpc64/libc-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* sysdeps/i386/fpu/libm-test-ulps: Likewise.
* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.

6 years agoConsolidate link map sorting
Andreas Schwab [Tue, 7 Nov 2017 14:24:19 +0000 (15:24 +0100)] 
Consolidate link map sorting

Combine the four places where link maps are sorted into a single function.
This also moves the logic to skip the first map (representing the main
binary) to the callers.

6 years agoUse libm_alias_float128 more in sysdeps/ieee754/float128.
Joseph Myers [Fri, 24 Nov 2017 23:53:54 +0000 (23:53 +0000)] 
Use libm_alias_float128 more in sysdeps/ieee754/float128.

This patch uses libm_alias_float128 in place of weak_alias more in
sysdeps/ieee754/float128, in preparation for defining _Float64x
aliases when appropriate.

Tested for x86_64, and for powerpc64le (compilation only) with
build-many-glibcs.py in conjunction with _Float64x support patches.

* sysdeps/ieee754/float128/s_fromfpf128.c (fromfpf128): Define
using libm_alias_float128.
* sysdeps/ieee754/float128/s_fromfpxf128.c (fromfpxf128):
Likewise.
* sysdeps/ieee754/float128/s_setpayloadf128.c (setpayloadf128):
Likewise.
* sysdeps/ieee754/float128/s_setpayloadsigf128.c
(setpayloadsigf128): Likewise.
* sysdeps/ieee754/float128/s_ufromfpf128.c (ufromfpf128):
Likewise.
* sysdeps/ieee754/float128/s_ufromfpxf128.c (ufromfpxf128):
Likewise.

6 years agoUse -mfloat128 for _Float64x tests for powerpc64le.
Joseph Myers [Fri, 24 Nov 2017 23:38:51 +0000 (23:38 +0000)] 
Use -mfloat128 for _Float64x tests for powerpc64le.

Supporting _Float64x on powerpc64le means that tests of that type need
to use -mfloat128 just like tests of _Float128.  This patch adds the
necessary uses of that option.

Tested (compilation only) for powerpc64le with build-many-glibcs.py,
in conjunction with _Float64x support patches.

* sysdeps/powerpc/powerpc64le/Makefile ($(foreach
suf,$(all-object-suffixes),$(objpfx)test-float64x%$(suf))): Add
-mfloat128 to CFLAGS.
($(foreach
suf,$(all-object-suffixes),$(objpfx)test-ifloat64x%$(suf))):
Likewise.
(CFLAGS-libm-test-support-float64x.c): New variable.
($(objpfx)test-float64x% $(objpfx)test-ifloat64x%): Add
$(f128-loader-link) to gnulib-tests.

6 years agoSupport _Float64x in libm_alias macros.
Joseph Myers [Fri, 24 Nov 2017 23:33:14 +0000 (23:33 +0000)] 
Support _Float64x in libm_alias macros.

This patch adds support for libm_alias_ldouble and libm_alias_float128
to create *f64x function aliases when appropriate.

Making such aliases work for functions defined in assembly sources
requires adding some semicolons after weak_alias calls in alias macro
definitions.  For C, semicolons are already present in the macros
called when required, but a GNU C extension allows excess semicolons
at file scope in a source file (and glibc already uses this), so it is
OK to have extra semicolons present in the macro definitions.  For
assembly sources, making multiple alias macro calls from a single
macro expansion means there are no newlines between the calls, so an
explicit separator is needed.  If hppa were to have .S sources in
libm, a more complicated approach would be needed that used
ASM_LINE_SEP when building assembly sources but not for C, but right
now there are no such sources so just using a semicolon (as already
present unconditionally in some such macro expansions) suffices.

Tested for x86_64, including in conjunction with _Float64x support
patches.

* sysdeps/generic/libm-alias-float128.h: Include <bits/floatn.h>.
(libm_alias_float128_other_r): If
[__HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE], define f64x
alias.
(libm_alias_float128_r): Add semicolon after weak_alias call.
* sysdeps/generic/libm-alias-ldouble.h
(libm_alias_ldouble_other_r_f128): New macro.
(libm_alias_ldouble_other_r_f64x): Likewise.
(libm_alias_ldouble_other_r): Use libm_alias_ldouble_other_r_f128
and libm_alias_ldouble_other_r_f64x.
(libm_alias_ldouble_r): Add semicolon after weak_alias call.
* sysdeps/ieee754/ldbl-opt/libm-alias-ldouble.h
(libm_alias_ldouble_other_r_f128): New macro.
(libm_alias_ldouble_other_r_f64x): Likewise.
(libm_alias_ldouble_other_r): Use libm_alias_ldouble_other_r_f128
and libm_alias_ldouble_other_r_f64x.

6 years agoSupport strfromf64x alias.
Joseph Myers [Fri, 24 Nov 2017 23:12:30 +0000 (23:12 +0000)] 
Support strfromf64x alias.

This patch adds support for defining strfromf64x as a function alias
(of strfroml or strfromf128, as appropriate) when _Float64x is
supported.

Tested for x86_64, including in conjunction with _Float64x support
patches, and also tested build for other configurations (in
conjunction with _Float64x support patches) with build-many-glibcs.py
to cover the various different files needing updating to define these
aliases.

* stdlib/strfroml.c: Always include <stdlib.h>.
[__HAVE_FLOAT64X_LONG_DOUBLE] (strfromf64x): Define and later
undefine as macro and define as weak alias.
* sysdeps/ieee754/float128/strfromf128.c: Include <bits/floatn.h>.
[__HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE]: Include
<stdlib.h>.
[__HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE] (strfromf64x):
Define and later undefine as macro and define as weak alias.

6 years agoSupport strtof64x, wcstof64x aliases.
Joseph Myers [Fri, 24 Nov 2017 22:51:53 +0000 (22:51 +0000)] 
Support strtof64x, wcstof64x aliases.

This patch adds support for defining strtof64x, strtof64x_l, wcstof64
and wcstof64x_l function aliases when _Float64x is supported.

Tested for x86_64, including in conjunction with _Float64x support
patches, and also tested build for other configurations (in
conjunction with _Float64x support patches) with build-many-glibcs.py
to cover the various different files needing updating to define these
aliases.

* stdlib/strtold.c [__HAVE_FLOAT64X_LONG_DOUBLE] (strtof64x):
Define and later undefine as macro.  Define as weak alias if
[!USE_WIDE_CHAR].
[__HAVE_FLOAT64X_LONG_DOUBLE] (wcstof64x): Define and later
undefine as macro.  Define as weak alias if [USE_WIDE_CHAR].
* sysdeps/ieee754/float128/strtof128.c: Include <bits/floatn.h>.
[__HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE] (strtof64x):
Define and later undefine as macro.  Define as weak alias if
[!USE_WIDE_CHAR].
[__HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE] (wcstof64x):
Define and later undefine as macro.  Define as weak alias if
[USE_WIDE_CHAR].
* sysdeps/ieee754/float128/strtof128_l.c
[__HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE] (strtof64x_l):
Define and later undefine as macro.  Define as weak alias if
[!USE_WIDE_CHAR].
[__HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE] (wcstof64x_l):
Define and later undefine as macro.  Define as weak alias if
[USE_WIDE_CHAR].
* sysdeps/ieee754/ldbl-128/strtold_l.c
[__HAVE_FLOAT64X_LONG_DOUBLE] (strtof64x_l): Define and later
undefine as macro.  Define as weak alias if [!USE_WIDE_CHAR].
[__HAVE_FLOAT64X_LONG_DOUBLE] (wcstof64x_l): Define and later
undefine as macro.  Define as weak alias if [USE_WIDE_CHAR].
* sysdeps/ieee754/ldbl-64-128/strtold_l.c
[__HAVE_FLOAT64X_LONG_DOUBLE] (strtof64x_l): Define and later
undefine as macro.  Define as weak alias if [!USE_WIDE_CHAR].
[__HAVE_FLOAT64X_LONG_DOUBLE] (wcstof64x_l): Define and later
undefine as macro.  Define as weak alias if [USE_WIDE_CHAR].
* sysdeps/ieee754/ldbl-96/strtold_l.c
[__HAVE_FLOAT64X_LONG_DOUBLE] (strtof64x_l): Define and later
undefine as macro.  Define as weak alias if [!USE_WIDE_CHAR].
[__HAVE_FLOAT64X_LONG_DOUBLE] (wcstof64x_l): Define and later
undefine as macro.  Define as weak alias if [USE_WIDE_CHAR].

6 years agoSupport testing _Float64x libm functions.
Joseph Myers [Fri, 24 Nov 2017 22:25:03 +0000 (22:25 +0000)] 
Support testing _Float64x libm functions.

This patch adds support for testing _Float64x libm functions.  A
configuration with such functions sets float64x-alias-fcts = yes in a
sysdeps Makeconfig file; until such settings are added, this test
support is inactive.

Tested for x86_64, including in conjunction with _Float64x support
patches.

* math/test-float64x.h: New file.
* math/Makefile (type-float64x-yes): New variable.
(test-types): Add $(type-float64x-$(float64x-alias-fcts)).

6 years agoMake min_of_type_ macros function-like.
Joseph Myers [Fri, 24 Nov 2017 22:03:35 +0000 (22:03 +0000)] 
Make min_of_type_ macros function-like.

math_private.h uses __MATH_TG in defining the min_of_type macro used
within libm, with min_of_type_<suffix> macros for each type.  This
runs into problems with __MATH_TG expansions used with additional
_FloatN and _FloatNx type support, because those can end up
macro-expanding the FUNC argument to __MATH_TG before it gets
concatenated with a suffix - meaning that min_of_type_ can't
simultaneously be the macro name for double, and a prefix to other
macro names, since the latter case requires such premature macro
expansion not to occur.  (This is not a problem for the uses of
__MATH_TG in installed headers because FUNC there is a function name
in the implementation namespace, and the suffixes themselves don't get
macro-expanded.)

This patch fixes the problem by making min_of_type_<suffix> macros
function-like, so no macro expansion occurs when min_of_type_ is
expanded on its own as a macro argument, only later when followed by
() after expansion.

Tested for x86_64, including in conjunction with _Float64x support
patches.

* sysdeps/generic/math_private.h (min_of_type_f): Make into a
function-like macro.
(min_of_type_): Likewise.
(min_of_type_l): Likewise.
(min_of_type_f128): Likewise.
(min_of_type): Pass () as last argument of __MATH_TG.

6 years agoDefine __STDC_WANT_IEC_60559_TYPES_EXT__ in tst-strtod-round-skeleton.c.
Joseph Myers [Fri, 24 Nov 2017 21:42:55 +0000 (21:42 +0000)] 
Define __STDC_WANT_IEC_60559_TYPES_EXT__ in tst-strtod-round-skeleton.c.

The tst-strtod-round-skeleton.c conditionals relating to handling of
_Float64x require associated <float.h> macros, which requires
__STDC_WANT_IEC_60559_TYPES_EXT__ to be defined before <float.h> is
included if _Float64x is supported.  This patch adds the necessary
definition.

Tested for x86_64, including in conjunction with _Float64x support
patches.

* stdlib/tst-strtod-round-skeleton.c
(__STDC_WANT_IEC_60559_TYPES_EXT__): Define before including
headers.

6 years agoFix gen-tgmath-tests.py for _Float64, _Float64x testing.
Joseph Myers [Fri, 24 Nov 2017 21:22:34 +0000 (21:22 +0000)] 
Fix gen-tgmath-tests.py for _Float64, _Float64x testing.

math/gen-tgmath-tests.py was missing a create_type argument when
creating the internal types for combinations of long double with
_Float64 and _Float64x, so resulting in output that did not compile
when glibc support for those types was enabled.  This patch adds the
missing argument so that the tests properly compile in that case.

Tested for x86_64, including in conjunction with _Float64x support
patches.

* math/gen-tgmath-tests.py (Type.init_types): Pass suffix argument
for combinations of long double with _Float64 and _Float64x.

6 years agoHandle more _FloatN, _FloatNx types in bits/libm-simd-decl-stubs.h.
Joseph Myers [Fri, 24 Nov 2017 21:11:37 +0000 (21:11 +0000)] 
Handle more _FloatN, _FloatNx types in bits/libm-simd-decl-stubs.h.

This patch adds the macro definitions to bits/libm-simd-decl-stubs.h
required to handle additional _FloatN and _FloatNx types.

Tested for x86_64, including in conjunction with _Float64x support
patches.

* bits/libm-simd-decl-stubs.h (__DECL_SIMD_cosf16): New macro.
(__DECL_SIMD_cosf32): Likewise.
(__DECL_SIMD_cosf64): Likewise.
(__DECL_SIMD_cosf32x): Likewise.
(__DECL_SIMD_cosf64x): Likewise.
(__DECL_SIMD_cosf128x): Likewise.
(__DECL_SIMD_sinf16): Likewise.
(__DECL_SIMD_sinf32): Likewise.
(__DECL_SIMD_sinf64): Likewise.
(__DECL_SIMD_sinf32x): Likewise.
(__DECL_SIMD_sinf64x): Likewise.
(__DECL_SIMD_sinf128x): Likewise.
(__DECL_SIMD_sincosf16): Likewise.
(__DECL_SIMD_sincosf32): Likewise.
(__DECL_SIMD_sincosf64): Likewise.
(__DECL_SIMD_sincosf32x): Likewise.
(__DECL_SIMD_sincosf64x): Likewise.
(__DECL_SIMD_sincosf128x): Likewise.
(__DECL_SIMD_logf16): Likewise.
(__DECL_SIMD_logf32): Likewise.
(__DECL_SIMD_logf64): Likewise.
(__DECL_SIMD_logf32x): Likewise.
(__DECL_SIMD_logf64x): Likewise.
(__DECL_SIMD_logf128x): Likewise.
(__DECL_SIMD_expf16): Likewise.
(__DECL_SIMD_expf32): Likewise.
(__DECL_SIMD_expf64): Likewise.
(__DECL_SIMD_expf32x): Likewise.
(__DECL_SIMD_expf64x): Likewise.
(__DECL_SIMD_expf128x): Likewise.
(__DECL_SIMD_powf16): Likewise.
(__DECL_SIMD_powf32): Likewise.
(__DECL_SIMD_powf64): Likewise.
(__DECL_SIMD_powf32x): Likewise.
(__DECL_SIMD_powf64x): Likewise.
(__DECL_SIMD_powf128x): Likewise.

6 years agoMove wcstof128 symbol versions to wcsmbs/Versions.
Joseph Myers [Fri, 24 Nov 2017 18:38:45 +0000 (18:38 +0000)] 
Move wcstof128 symbol versions to wcsmbs/Versions.

This patch moves wcstof128 and wcstof128_l Versions file entries from
stdlib/Versions to wcsmbs/Versions, which is a more appropriate place
for them.

Tested for x86_64, and with build-many-glibcs.py that installed
stripped shared libraries are unchanged by the patch.

* stdlib/Versions (libc): Move entries for wcstof128 and
wcstof128_l to ....
* wcsmbs/Versions (libc): ... here.
Include <float128-abi.h>.

6 years agoLinux: Introduce <bits/mman-shared.h>
Florian Weimer [Fri, 24 Nov 2017 16:55:59 +0000 (17:55 +0100)] 
Linux: Introduce <bits/mman-shared.h>

This header file enables sharing of portable declarations and
definitions across all Linux architectures, including hppa (which does
not use <bits/mman-linux.h>).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agoposix: Fix generic p{read,write}v buffer allocation (BZ#22457)
Adhemerval Zanella [Wed, 22 Nov 2017 20:02:20 +0000 (18:02 -0200)] 
posix: Fix generic p{read,write}v buffer allocation (BZ#22457)

As described in BZ#22457 an interpose malloc can free an invalid
pointer for fallback preadv implementation.  Fortunately this is
just and issue on microblaze-linux-gnu running kernels older than
3.15.  This patch fixes it by calling mmap/unmap instead of
posix_memalign/ free.

Checked on microblaze-linux-gnu check with run-built-tests=no and
by using the sysdeps/posix implementation on x86_64-linux-gnu (just
for sanity test where it shown no regression).

[BZ #22457]
* sysdeps/posix/preadv_common.c (PREADV): Use mmap/munmap instead of
posix_memalign/free.
* sysdeps/posix/pwritev_common.c (PWRITEV): Likewise.

6 years agopl_PL locale: Base collation on iso14651_t1
Mike FABIAN [Mon, 20 Nov 2017 12:25:33 +0000 (17:55 +0530)] 
pl_PL locale: Base collation on iso14651_t1

[BZ #22469]
* localedata/locales/pl_PL (LC_COLLATE): Use “copy "iso14651_t1"”
and implement the collation rules for pl from CLDR on top of that.
* Makefile: Add pl_PL.UTF-8 to test-input and to the list
of locales to be built for testing.
* pl_PL.UTF-8.in: New file with test data to test the Polish sorting.

6 years agoUse libm_alias_ldouble macros in sysdeps/ia64/fpu.
Joseph Myers [Thu, 23 Nov 2017 23:34:54 +0000 (23:34 +0000)] 
Use libm_alias_ldouble macros in sysdeps/ia64/fpu.

Continuing the preparation for additional _FloatN / _FloatNx aliases,
this patch makes long double functions in sysdeps/ia64/fpu use
libm_alias_ldouble macros, so that they can have _Float64x aliases
added in future.

Most ia64 libm functions are defined using ia64-specific macros in
libm-symbols.h.  These are left unchanged, with libm-alias-ldouble.h
included from libm-symbols.h (and the expectation that other
libm-alias-*.h headers will be included from there as well in future),
and libm_alias_ldouble_other then being used in most cases to define
aliases for any additional types (currently the empty set).  Functions
that used weak_alias are converted to use libm_alias_ldouble.

Tested (compilation only) with build-many-glibcs.py for ia64,
including that installed stripped shared libraries are unchanged by
the patch.

* sysdeps/ia64/fpu/libm-symbols.h: Include <libm-alias-ldouble.h>.
* sysdeps/ia64/fpu/e_acoshl.S (acoshl): Use
libm_alias_ldouble_other.
* sysdeps/ia64/fpu/e_acosl.S (acosl): Likewise.
* sysdeps/ia64/fpu/e_asinl.S (asinl): Likewise.
* sysdeps/ia64/fpu/e_atanhl.S (atanhl): Likewise.
* sysdeps/ia64/fpu/e_coshl.S (coshl): Likewise.
* sysdeps/ia64/fpu/e_exp10l.S (exp10l): Likewise.
* sysdeps/ia64/fpu/e_exp2l.S (exp2l): Likewise.
* sysdeps/ia64/fpu/e_fmodl.S (fmodl): Likewise.
* sysdeps/ia64/fpu/e_hypotl.S (hypotl): Likewise.
* sysdeps/ia64/fpu/e_lgammal_r.c (lgammal_r): Define using
libm_alias_ldouble_r.
* sysdeps/ia64/fpu/e_log2l.S (log2l): Use
libm_alias_ldouble_other.
* sysdeps/ia64/fpu/e_logl.S (logl): Likewise.
(log10l): Likewise.
* sysdeps/ia64/fpu/e_powl.S (powl): Likewise.
* sysdeps/ia64/fpu/e_remainderl.S (remainderl): Likewise.
* sysdeps/ia64/fpu/e_sinhl.S (sinhl): Likewise.
* sysdeps/ia64/fpu/e_sqrtl.S (sqrtl): Likewise.
* sysdeps/ia64/fpu/libm_sincosl.S (sincosl): Likewise.
* sysdeps/ia64/fpu/s_asinhl.S (asinhl): Likewise.
* sysdeps/ia64/fpu/s_atanl.S (atanl): Likewise.
(atan2l): Likewise.
* sysdeps/ia64/fpu/s_cbrtl.S (cbrtl): Likewise.
* sysdeps/ia64/fpu/s_ceill.S (ceill): Likewise.
* sysdeps/ia64/fpu/s_copysign.S (copysignl): Define using
libm_alias_ldouble.
* sysdeps/ia64/fpu/s_cosl.S (sinl): Use libm_alias_ldouble_other.
(cosl): Likewise.
* sysdeps/ia64/fpu/s_erfcl.S (erfcl): Likewise.
* sysdeps/ia64/fpu/s_erfl.S (erfl): Likewise.
* sysdeps/ia64/fpu/s_expm1l.S (expm1l): Likewise.
(expl): Likewise.
* sysdeps/ia64/fpu/s_fabsl.S (fabsl): Likewise.
* sysdeps/ia64/fpu/s_fdiml.S (fdiml): Likewise.
* sysdeps/ia64/fpu/s_floorl.S (floorl): Likewise.
* sysdeps/ia64/fpu/s_fmal.S (fmal): Likewise.
* sysdeps/ia64/fpu/s_fmaxl.S (fmaxl): Likewise.
* sysdeps/ia64/fpu/s_frexpl.c (frexpl): Likewise.
* sysdeps/ia64/fpu/s_ldexpl.c (ldexpl): Likewise.
* sysdeps/ia64/fpu/s_log1pl.S (log1pl): Likewise.
* sysdeps/ia64/fpu/s_logbl.S (logbl): Likewise.
* sysdeps/ia64/fpu/s_modfl.S (modfl): Likewise.
* sysdeps/ia64/fpu/s_nearbyintl.S (nearbyintl): Define using
libm_alias_ldouble.
* sysdeps/ia64/fpu/s_nextafterl.S (nextafterl): Use
libm_alias_ldouble_other.
* sysdeps/ia64/fpu/s_rintl.S (rintl): Likewise.
* sysdeps/ia64/fpu/s_roundl.S (roundl): Likewise.
* sysdeps/ia64/fpu/s_scalbnl.c (scalbnl): Define using
libm_alias_ldouble.
* sysdeps/ia64/fpu/s_tanhl.S (tanhl): Use
libm_alias_ldouble_other.
* sysdeps/ia64/fpu/s_tanl.S (tanl): Likewise.
* sysdeps/ia64/fpu/s_truncl.S (truncl): Likewise.
* sysdeps/ia64/fpu/w_lgammal_main.c
[BUILD_LGAMMA && !USE_AS_COMPAT] (lgammal): Likewise.
* sysdeps/ia64/fpu/w_tgammal_compat.S (tgammal): Likewise.

6 years agomalloc: Call tcache destructor in arena_thread_freeres
Florian Weimer [Thu, 23 Nov 2017 13:47:31 +0000 (14:47 +0100)] 
malloc: Call tcache destructor in arena_thread_freeres

It does not make sense to register separate cleanup functions for arena
and tcache since they're always going to be called together.  Call the
tcache cleanup function from within arena_thread_freeres since it at
least makes the order of those cleanups clear in the code.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
6 years agonss: Export nscd hash function as __nss_hash [BZ #22459]
Florian Weimer [Thu, 23 Nov 2017 13:08:11 +0000 (14:08 +0100)] 
nss: Export nscd hash function as __nss_hash [BZ #22459]

6 years agosigwait: Do not fail with EINTR and return error code [BZ #22478]
Florian Weimer [Thu, 23 Nov 2017 10:20:53 +0000 (11:20 +0100)] 
sigwait: Do not fail with EINTR and return error code [BZ #22478]

Since

commit 8b0e795aaa445e9167aa07b282c5720b35342c07
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Nov 1 11:49:05 2017 -0200

    Simplify Linux sig{timed}wait{info} implementations

sigwait can fail with EINTR.  Applications do not expect that, and the
error code is not documented in POSIX or the manual pages.

This commit restores the previous behavior by retrying the system call
on EINTR.  It also returns the error code, not -1, on the remaing
errors.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agoLinux: Add memfd_create system call wrapper
Florian Weimer [Thu, 23 Nov 2017 09:00:40 +0000 (10:00 +0100)] 
Linux: Add memfd_create system call wrapper

The system call is somewhat obscure because it is closely related
to file descriptor sealing.  However, it is also the recommended
way to create alias mappings, which is why it has more general use.

No emulation is provided.  Except for the name of the
/proc/self/fd links, it would be possible to implement an
approximation using O_TMPFILE and tmpfs, but this does not appear
to be worth the added complexity.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoFix typo in variable name in gen-locale.sh.
Joseph Myers [Wed, 22 Nov 2017 23:42:40 +0000 (23:42 +0000)] 
Fix typo in variable name in gen-locale.sh.

* localedata/gen-locale.sh: Fix typo in variable name.

6 years agoObsolete p_secstodate.
Joseph Myers [Wed, 22 Nov 2017 22:21:10 +0000 (22:21 +0000)] 
Obsolete p_secstodate.

This patch, relative to a tree with
<https://sourceware.org/ml/libc-alpha/2017-11/msg00797.html> (pending
review) applied, obsoletes p_secstodate, making the underlying
function __p_secstodate into a compat symbol not available for new
binaries or ports.  The calls in ns_print.c (part of incomplete
handling of TKEY) are changed to use %lu to print times instead of
trying to pretty-print the times any more.

Tested for x86_64.

* resolv/res_debug.c (p_secstodate): Condition definition on
[SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)].  Define
directly as __p_secstodate, and as a compat symbol.  Do not use
libresolv_hidden_def.
* resolv/resolv.h (p_secstodate): Remove macro and function
declaration.
* resolv/ns_print.c (ns_sprintrrf): Print times with %lu, not
using p_secstodate.
* include/resolv.h (__p_secstodate): Do not use
libresolv_hidden_proto.
* resolv/Makefile (tests): Move tst-p_secstodate to ....
(tests-internal): ... here.
* resolv/tst-p_secstodate.c: Include <shlib-compat.h>.  Condition
all contents on [TEST_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)]
and declare and use __p_secstodate and use compat_symbol_reference
in that case.
[!TEST_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)] (do_test): Add
implementation returning 77.

6 years agoFix p_secstodate overflow handling (bug 22463).
Joseph Myers [Wed, 22 Nov 2017 22:12:07 +0000 (22:12 +0000)] 
Fix p_secstodate overflow handling (bug 22463).

The resolv/res_debug.c function p_secstodate (which is a public
function exported from libresolv, taking an unsigned long argument)
does:

        struct tm timebuf;
        time = __gmtime_r(&clock, &timebuf);
        time->tm_year += 1900;
        time->tm_mon += 1;
        sprintf(output, "%04d%02d%02d%02d%02d%02d",
                time->tm_year, time->tm_mon, time->tm_mday,
                time->tm_hour, time->tm_min, time->tm_sec);

If __gmtime_r returns NULL (because the year overflows the range of
int), this will dereference a null pointer.  Otherwise, if the
computed year does not fit in four characters, this will cause a
buffer overrun of the fixed-size 15-byte buffer.  With current GCC
mainline, there is a compilation failure because of the possible
buffer overrun.

I couldn't find a specification for how this function is meant to
behave, but Paul pointed to RFC 4034 as relevant to the cases where
this function is called from within glibc.  The function's interface
is inherently problematic when dates beyond Y2038 might be involved,
because of the ambiguity in how to interpret 32-bit timestamps as such
dates (the RFC suggests interpreting times as being within 68 years of
the present date, which would mean some kind of interface whose
behavior depends on the present date).

This patch works on the basis of making a minimal fix in preparation
for obsoleting the function.  The function is made to handle times in
the interval [0, 0x7fffffff] only, on all platforms, with <overflow>
used as the output string in other cases (and errno set to EOVERFLOW
in such cases).  This seems to be a reasonable state for the function
to be in when made a compat symbol by a future patch, being compatible
with any existing uses for existing timestamps without trying to work
for later timestamps.  Results independent of the range of time_t also
simplify the testcase.

I couldn't persuade GCC to recognize the ranges of the struct tm
fields by adding explicit range checks with a call to
__builtin_unreachable if outside the range (this looks similar to
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80776>), so having added
a range check on the input, this patch then disables the
-Wformat-overflow= warning for the sprintf call (I prefer that to the
use of strftime, as being more transparently correct without knowing
what each of %m and %M etc. is).

I do not know why this build failure should be new with mainline GCC
(that is, I don't know what GCC change might have introduced it, when
the basic functionality for such warnings was already in GCC 7).

I do not know if this is a security issue (that is, if there are
plausible ways in which a date before -999 or after 9999 from an
untrusted source might end up in this function).  The system clock is
arguably an untrusted source (in that e.g. NTP is insecure), but
probably not to that extent (NTP can't communicate such wild
timestamps), and uses from within glibc are limited to 32-bit inputs.

Tested with build-many-glibcs.py that this restores the build for arm
with yesterday's mainline GCC.  Also tested for x86_64 and x86.

[BZ #22463]
* resolv/res_debug.c: Include <libc-diag.h>.
(p_secstodate): Assert time_t at least as wide as u_long.  On
overflow, use integer seconds since the epoch as output, or use
"<overflow>" as output and set errno to EOVERFLOW if integer
seconds since the epoch would be 14 or more characters.
(p_secstodate) [__GNUC_PREREQ (7, 0)]: Disable -Wformat-overflow=
for sprintf call.
* resolv/tst-p_secstodate.c: New file.
* resolv/Makefile (tests): Add tst-p_secstodate.
($(objpfx)tst-p_secstodate): Depend on $(objpfx)libresolv.so.

6 years agoRemove unused sparc64/soft-fp libm function implementations.
Joseph Myers [Wed, 22 Nov 2017 21:11:00 +0000 (21:11 +0000)] 
Remove unused sparc64/soft-fp libm function implementations.

sysdeps/sparc/sparc64/soft-fp has files s_frexpl.c, s_scalblnl.c and
s_scalbnl.c that are never used because the ldbl-128 versions always
come first in the sysdeps directory ordering.  This patch removes the
unused files.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged by this patch.

* sysdeps/sparc/sparc64/soft-fp/s_frexpl.c: Remove file.
* sysdeps/sparc/sparc64/soft-fp/s_scalblnl.c: Likewise.
* sysdeps/sparc/sparc64/soft-fp/s_scalbnl.c: Likewise.

6 years ago* posix/regcomp.c (init_word_char): Add comments.
Paul Eggert [Wed, 22 Nov 2017 19:21:44 +0000 (11:21 -0800)] 
* posix/regcomp.c (init_word_char): Add comments.

6 years agoAvoid use of strlen in getlogin_r (bug 22447).
Joseph Myers [Wed, 22 Nov 2017 18:44:23 +0000 (18:44 +0000)] 
Avoid use of strlen in getlogin_r (bug 22447).

Building glibc with current mainline GCC fails, among other reasons,
because of an error for use of strlen on the nonstring ut_user field.
This patch changes the problem code in getlogin_r to use __strnlen
instead.  It also needs to set the trailing NUL byte of the result
explicitly, because of the case where ut_user does not have such a
trailing NUL byte (but the result should always have one).

Tested for x86_64.  Also tested that, in conjunction with
<https://sourceware.org/ml/libc-alpha/2017-11/msg00797.html>, it fixes
the build for arm with mainline GCC.

[BZ #22447]
* sysdeps/unix/getlogin_r.c (__getlogin_r): Use __strnlen not
strlen to compute length of ut_user and set trailing NUL byte of
result explicitly.

6 years agolv_LV locale: fix collation [BZ #15537]
Mike FABIAN [Fri, 17 Nov 2017 09:54:52 +0000 (10:54 +0100)] 
lv_LV locale: fix collation [BZ #15537]

[BZ #15537]
* localedata/locales/lv_LV (LC_COLLATE): Fix collation by
using “copy "iso14651_t1"” and then implementing the
collation rules for lv from CLDR on top of that.
* Makefile: Add lv_LV.UTF-8 to test-input and to the list
of locales to be built for testing.
* lv_LV.UTF-8.in: New file with test data to test the Latvian
sorting.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agoUpdate hppa bits/mman.h from Linux 4.14.
Joseph Myers [Tue, 21 Nov 2017 22:21:23 +0000 (22:21 +0000)] 
Update hppa bits/mman.h from Linux 4.14.

This patch updates the hppa bits/mman.h based on Linux 4.14.  Some
MADV_* macros are removed in Linux 4.14 as unused/unimplemented, so
this patch removes them from glibc, while adding two new macros added
in Linux 4.14.

Tested (compilation only) for hppa with build-many-glibcs.py.

* sysdeps/unix/sysv/linux/hppa/bits/mman.h
[__USE_MISC] (MADV_SPACEAVAIL): Remove macro.
[__USE_MISC] (MADV_VPS_PURGE): Likewise.
[__USE_MISC] (MADV_VPS_INHERIT): Likewise.
[__USE_MISC] (MADV_HWPOISON): New macro.
[__USE_MISC] (MADV_SOFT_OFFLINE): Likewise.

6 years agonptl: Add workaround for ASSERT_PTHREAD_INTERNAL_SIZE with GCC 4.9
Adhemerval Zanella [Tue, 21 Nov 2017 11:44:42 +0000 (09:44 -0200)] 
nptl: Add workaround for ASSERT_PTHREAD_INTERNAL_SIZE with GCC 4.9

GCC 4.9 (the minimum current supported) emits an warning for universal
zero initializer ({0}) on ASSERT_PTHREAD_INTERNAL_SIZE:

pthread_attr_init.c: In function ‘__pthread_attr_init_2_1’:
pthread_attr_init.c:37:3: error: missing braces around initializer [-Werror=missing-braces]
   ASSERT_PTHREAD_INTERNAL_SIZE (pthread_attr_t, struct pthread_attr);
   ^
pthread_attr_init.c:37:3: error: (near initialization for ‘(anonymous).__size’) [-Werror=missing-braces]

It is fact GCC BZ#53119 [1] fixed in later version (GCC5+).  Since
current branch is closed and there is no indication it will be backports
(comment #20 in same bug report) this patch fixes by using a double
bracket to zero initialize the struct.

Checked on x86_64-linux-gnu with GCC 7 and GCC 4.9.

* nptl/pthreadP.h (ASSERT_PTHREAD_INTERNAL_SIZE): Add workarond for
-Wmissing-braces on GCC 4.9.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agoS390: Add cfi information for start routines in order to stop unwinding.
Stefan Liebler [Tue, 21 Nov 2017 07:45:28 +0000 (08:45 +0100)] 
S390: Add cfi information for start routines in order to stop unwinding.

GDB failed to detect the outermost frame while showing the backtrace
within a thread:
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Before this patch, the start routines like thread_start had no cfi information.
GDB is then using the prologue unwinder if no cfi information is available.
This unwinder tries to unwind r15 and stops e.g. if r15 was updated or
on some jump-instructions.

On older glibc-versions (before commit "Remove cached PID/TID in clone"
c579f48edba88380635ab98cb612030e3ed8691e), the thread_start function used
such a jump-instruction and GDB did not fail with an error.

This patch adds cfi information for _start, thread_start and __makecontext_ret
and marks r14 as undefined which marks the frame as outermost frame and GDB
stops the backtrace. Also tested different gcc versions in order to test
_Unwind_Backtrace() in libgcc as this is used by backtrace() in glibc.

ChangeLog:

* sysdeps/s390/s390-64/start.S (_start): Add cfi information for r14.
* sysdeps/s390/s390-32/start.S: (_start): Likewise
* sysdeps/unix/sysv/linux/s390/s390-64/clone.S
(thread_start): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/clone.S
(thread_start): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S
(__makecontext_ret): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S
(__makecontext_ret): Likewise.

6 years agoRemove attribute_hidden for wchar ifunc symbols.
Stefan Liebler [Tue, 21 Nov 2017 07:39:53 +0000 (08:39 +0100)] 
Remove attribute_hidden for wchar ifunc symbols.

On s390 (31bit) various debug/tst-*chk* testcases are failing as the tests
are ending with a segmentation fault.

One test is e.g. calling wcsnrtombs in debug/tst-chk1.c:1549.
The function wcsnrtombs itself calls __wcsnlen. This function is called via
PLT! The PLT-stub itself loads the address from GOT (r12 is assumed to be
the GOT-pointer). In this case the loaded address is zero and the following
branch leads to the segmentation fault.

Due to the attribute_hidden in commit 44af8a32c341672b5160fdc2839767e9a837ad26
"Mark internal wchar functions with attribute_hidden [BZ #18822]"
for e.g. the __wcsnlen function, r12 is not loaded with the GOT-pointer
in wcsnrtombs.

On s390x (64bit), this __wcsnlen call is also using the PLT-stub. But it is
not failing as the GOT-pointer is setup with larl-instruction by the PLT-stub
itself.
Note: On s390x/s390, __wcsnlen is an IFUNC symbol.

On x86_64, __wcsnlen is also an IFUNC symbol and is called via PLT, too.

Further IFUNC symbols on s390 which were marked as hidden by the mentioned
commit are: __wcscat, __wcsncpy, __wcpncpy, __wcschrnul.

This patch removes the attribute_hidden in wchar.h.
Then the compiler setups e.g. r12 on s390 in order to call __wcsnlen via PLT.

ChangeLog:

* include/wchar.h (__wcsnlen, __wcscat, __wcsncpy, __wcpncpy,
__wcschrnul): Remove attribute_hidden.

6 years agoregex: don't assume uint64_t or uint32_t
Paul Eggert [Tue, 21 Nov 2017 00:25:49 +0000 (16:25 -0800)] 
regex: don't assume uint64_t or uint32_t

This avoids -Werror=overflow errors for 32-bit systems in
the 64-bit case.  Problem reported by Joseph Myers in:
https://sourceware.org/ml/libc-alpha/2017-11/msg00694.html
Also, when this code is used in Gnulib it ports to platforms
that lack uint64_t and uint32_t.  The C standard doesn't guarantee
them, and on some 32-bit compilers there is no uint64_t.
Problem reported by Gianluigi Tiesi in:
http://lists.gnu.org/archive/html/bug-gnulib/2012-03/msg00154.html
* posix/regcomp.c (init_word_char): Don't assume that the types
uint64_t and uint32_t exist.  Adapted from Gnulib patch
2012-05-27T06:40:00!eggert@cs.ucla.edu.  See:
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=252b52457da7887667c036d18cc5169777615bb0

6 years agoaarch64: Optimized memset for falkor
Siddhesh Poyarekar [Mon, 20 Nov 2017 12:55:04 +0000 (18:25 +0530)] 
aarch64: Optimized memset for falkor

The generic memset reads dczid_el0 on every memset.  This has a
significant impact on falkor for a range of sizes because reading
dczid_el0 is slow.

The DZP bit in the dczid_el0 register does not change dynamically, so
it is safe to read once during program startup.  With this patch
dczid_el0 is read once during startup and zva_size is cached.  This is
used to invoke the falkor-specific memset; the generic memset routine
remains unchanged.

The gains due to this are significant for falkor, with run time
reductions as high as 48%.  Here's a sample from the falkor tests:

Function: memset
Variant: walk
                      simple_memset __memset_falkor __memset_generic
=====================================================================
length=256, char=0:   139.96 (-698.28%)    9.07 ( 48.26%)  17.53
length=257, char=0:   140.50 (-699.03%)    9.53 ( 45.80%)  17.58
length=258, char=0:   140.96 (-703.95%)    9.58 ( 45.36%)  17.53
length=259, char=0:   141.56 (-705.16%)    9.53 ( 45.79%)  17.58
length=260, char=0:   142.15 (-710.76%)    9.57 ( 45.39%)  17.53
length=261, char=0:   142.50 (-710.39%)    9.53 ( 45.78%)  17.58
length=262, char=0:   142.97 (-715.09%)    9.57 ( 45.42%)  17.54
length=263, char=0:   143.51 (-716.18%)    9.53 ( 45.80%)  17.58
length=264, char=0:   143.93 (-720.55%)    9.58 ( 45.39%)  17.54
length=265, char=0:   144.56 (-722.07%)    9.53 ( 45.80%)  17.59
length=266, char=0:   144.98 (-726.42%)    9.58 ( 45.42%)  17.54
length=267, char=0:   145.53 (-727.53%)    9.53 ( 45.80%)  17.59
length=268, char=0:   146.25 (-731.81%)    9.53 ( 45.79%)  17.58
length=269, char=0:   146.52 (-735.39%)    9.53 ( 45.66%)  17.54
length=270, char=0:   146.97 (-735.81%)    9.53 ( 45.80%)  17.58
length=271, char=0:   147.54 (-741.08%)    9.58 ( 45.38%)  17.54
length=512, char=0:   268.26 (-1307.85%)  12.06 ( 36.71%)  19.05
length=513, char=0:   268.73 (-1273.89%)  13.56 ( 30.68%)  19.56
length=514, char=0:   269.31 (-1276.89%)  13.56 ( 30.68%)  19.56
length=515, char=0:   269.73 (-1279.05%)  13.56 ( 30.68%)  19.56
length=516, char=0:   270.34 (-1282.24%)  13.56 ( 30.67%)  19.56
length=517, char=0:   270.83 (-1284.71%)  13.56 ( 30.66%)  19.56
length=518, char=0:   271.20 (-1286.54%)  13.56 ( 30.67%)  19.56
length=519, char=0:   271.67 (-1288.67%)  13.65 ( 30.24%)  19.56
length=520, char=0:   272.14 (-1291.04%)  13.65 ( 30.22%)  19.56
length=521, char=0:   272.66 (-1293.69%)  13.65 ( 30.23%)  19.56
length=522, char=0:   273.14 (-1296.13%)  13.65 ( 30.20%)  19.56
length=523, char=0:   273.64 (-1298.75%)  13.65 ( 30.23%)  19.56
length=524, char=0:   274.34 (-1302.16%)  13.66 ( 30.20%)  19.57
length=525, char=0:   274.64 (-1297.78%)  13.56 ( 30.99%)  19.65
length=526, char=0:   275.20 (-1300.04%)  13.56 ( 31.01%)  19.66
length=527, char=0:   275.66 (-1302.86%)  13.56 ( 30.99%)  19.65
length=1024, char=0:  524.46 (-2169.75%)  20.12 ( 12.92%)  23.11
length=1025, char=0:  525.14 (-2124.63%)  21.62 (  8.40%)  23.61
length=1026, char=0:  525.59 (-2125.36%)  21.88 (  7.37%)  23.62
length=1027, char=0:  525.98 (-2127.14%)  21.62 (  8.46%)  23.62
length=1028, char=0:  526.68 (-2131.10%)  21.62 (  8.42%)  23.61
length=1029, char=0:  527.10 (-2131.70%)  21.79 (  7.73%)  23.62
length=1030, char=0:  527.54 (-2118.51%)  21.62 (  9.10%)  23.78
length=1031, char=0:  527.98 (-2136.37%)  21.62 (  8.43%)  23.61
length=1032, char=0:  528.70 (-2139.38%)  21.62 (  8.43%)  23.61
length=1033, char=0:  529.25 (-2124.37%)  21.62 (  9.11%)  23.79
length=1034, char=0:  529.48 (-2142.95%)  21.62 (  8.43%)  23.61
length=1035, char=0:  530.11 (-2145.13%)  21.62 (  8.44%)  23.61
length=1036, char=0:  530.76 (-2147.10%)  21.79 (  7.73%)  23.62
length=1037, char=0:  531.03 (-2149.45%)  21.62 (  8.42%)  23.61
length=1038, char=0:  531.64 (-2151.87%)  21.62 (  8.42%)  23.61
length=1039, char=0:  531.99 (-2151.63%)  21.80 (  7.75%)  23.63

* sysdeps/aarch64/memset-reg.h: New file.
* sysdeps/aarch64/memset.S: Use it.
(__memset): Rename to MEMSET macro.
[ZVA_MACRO]: Use zva_macro.
* sysdeps/aarch64/multiarch/Makefile (sysdep_routines):
Add memset_generic and memset_falkor.
* sysdeps/aarch64/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add memset ifuncs.
* sysdeps/aarch64/multiarch/init-arch.h (INIT_ARCH): New
local variable zva_size.
* sysdeps/aarch64/multiarch/memset.c: New file.
* sysdeps/aarch64/multiarch/memset_generic.S: New file.
* sysdeps/aarch64/multiarch/memset_falkor.S: New file.
* sysdeps/aarch64/multiarch/rtld-memset.S: New file.
* sysdeps/unix/sysv/linux/aarch64/cpu-features.c
(DCZID_DZP_MASK): New macro.
(DCZID_BS_MASK): Likewise.
(init_cpu_features): Read and set zva_size.
* sysdeps/unix/sysv/linux/aarch64/cpu-features.h
(struct cpu_features): New member zva_size.

6 years agobenchtests: Bump start size since smaller sizes are noisy
Siddhesh Poyarekar [Mon, 20 Nov 2017 12:26:35 +0000 (17:56 +0530)] 
benchtests: Bump start size since smaller sizes are noisy

Numbers for very small sizes (< 128B) are much noisier for non-cached
benchmarks like the walk benchmarks, so don't include them.

* benchtests/bench-memcpy-walk.c (START_SIZE): Set to 128.
* benchtests/bench-memmove-walk.c (START_SIZE): Likewise.
* benchtests/bench-memset-walk.c (START_SIZE): Likewise.

6 years agobenchtests: Fix walking sizes and directions for *-walk benchmarks
Siddhesh Poyarekar [Mon, 20 Nov 2017 12:25:59 +0000 (17:55 +0530)] 
benchtests: Fix walking sizes and directions for *-walk benchmarks

Make the walking benchmarks walk only backwards since copying both
ways is biased in favour of implementations that use non-temporal
stores for larger sizes; falkor is one of them.  This also fixes up
bugs in computation of the result which ended up multiplying the
length with the timing result unnecessarily.

* benchtests/bench-memcpy-walk.c (do_one_test): Copy only
backwards.  Fix timing computation.
* benchtests/bench-memmove-walk.c (do_one_test): Likewise.
* benchtests/bench-memset-walk.c (do_one_test): Walk backwards
on memset by N at a time.  Fix timing computation.

6 years agomanual: Document the MAP_HUGETLB, MADV_HUGEPAGE, MADV_NOHUGEPAGE flags
Florian Weimer [Mon, 20 Nov 2017 12:23:17 +0000 (13:23 +0100)] 
manual: Document the MAP_HUGETLB, MADV_HUGEPAGE, MADV_NOHUGEPAGE flags

6 years agomanual: Document mprotect and introduce section on memory protection
Florian Weimer [Sun, 19 Nov 2017 10:27:59 +0000 (11:27 +0100)] 
manual: Document mprotect and introduce section on memory protection

6 years agomanual: Move preadv/writev variants to Scatter-Gather section
Florian Weimer [Sun, 19 Nov 2017 07:58:31 +0000 (08:58 +0100)] 
manual: Move preadv/writev variants to Scatter-Gather section

Also remove a comment about performance.  fwrite vs writev performance
is a very complex topic and cannot be reduced to a simple advice based
on transfer size.

6 years agosupport_become_root: Fix comment style
Christian Brauner [Sat, 18 Nov 2017 16:54:24 +0000 (17:54 +0100)] 
support_become_root: Fix comment style

6 years agosupport_become_root: Don't fail when /proc/<pid/setgroups is missing
Christian Brauner [Sat, 18 Nov 2017 15:22:01 +0000 (16:22 +0100)] 
support_become_root: Don't fail when /proc/<pid/setgroups is missing

The requirement to write "deny" to /proc/<pid>/setgroups for a given user
namespace before being able to write a gid mapping was introduced in Linux
3.19.  Before that this requirement including the file did not exist.
So don't fail when errno == ENOENT.

6 years agotst-ttyname: Fix namespace setup for Fedora
Florian Weimer [Sat, 18 Nov 2017 13:34:46 +0000 (14:34 +0100)] 
tst-ttyname: Fix namespace setup for Fedora

On Fedora, the previous initialization sequence did not work and
resulted in failures like:

info:  entering chroot 1
info:    testcase: basic smoketest
info:      ttyname: PASS {name="/dev/pts/5", errno=0}
info:      ttyname_r: PASS {name="/dev/pts/5", ret=0, errno=0}
error: ../sysdeps/unix/sysv/linux/tst-ttyname.c:122: write (setroups, "deny"): Operation not permitted
info:  entering chroot 2
error: ../sysdeps/unix/sysv/linux/tst-ttyname.c:122: write (setroups, "deny"): Operation not permitted
error: 2 test failures

Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agosupport_enter_mount_namespace: Unshare with mount --make-rprivate
Florian Weimer [Sat, 18 Nov 2017 13:30:20 +0000 (14:30 +0100)] 
support_enter_mount_namespace: Unshare with mount --make-rprivate

System defaults vary, and a mere unshare (CLONE_NEWNS) (which is part of
support_become_root) is no longer sufficient.

Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agosupport_create_temp_directory: Align behavior with create_temp_file
Florian Weimer [Sat, 18 Nov 2017 13:11:09 +0000 (14:11 +0100)] 
support_create_temp_directory: Align behavior with create_temp_file

create_temp_file automatically supplies the test directory and the
XXXXXX suffix.  support_create_temp_directory required the caller to
specify them, which was confusing.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
6 years agopowerpc: Update AT_HWCAP2 bits
Tulio Magno Quites Machado Filho [Fri, 17 Nov 2017 23:15:15 +0000 (21:15 -0200)] 
powerpc: Update AT_HWCAP2 bits

Linux commit ID cba6ac4869e45cc93ac5497024d1d49576e82666 reserved a new
bit for a scenario where transactional memory is available, but the
suspended state is disabled.

* sysdeps/powerpc/bits/hwcap.h (PPC_FEATURE2_HTM_NO_SUSPEND): New
macro.
* sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags): Add
htm-no-suspend.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
6 years agoUse libm_alias_ldouble in sysdeps/x86_64/fpu.
Joseph Myers [Fri, 17 Nov 2017 23:39:11 +0000 (23:39 +0000)] 
Use libm_alias_ldouble in sysdeps/x86_64/fpu.

This patch continues the preparation for additional _FloatN / _FloatNx
function aliases by using libm_alias_ldouble for sysdeps/x86_64/fpu
long double functions, so that they can have _Float64x aliases added
in future.

Tested for x86_64, including build-many-glibcs.py tests that installed
stripped shared libraries are unchanged by the patch.

* sysdeps/x86_64/fpu/e_expl.S: Include <libm-alias-ldouble.h>.
[USE_AS_EXPM1L] (expm1l): Define using libm_alias_ldouble.
* sysdeps/x86_64/fpu/s_ceill.S: Include <libm-alias-ldouble.h>.
(ceill): Define using libm_alias_ldouble.
* sysdeps/x86_64/fpu/s_copysignl.S: Include
<libm-alias-ldouble.h>.
(copysignl): Define using libm_alias_ldouble.
* sysdeps/x86_64/fpu/s_fabsl.S: Include <libm-alias-ldouble.h>.
(fabsl): Define using libm_alias_ldouble.
* sysdeps/x86_64/fpu/s_floorl.S: Include <libm-alias-ldouble.h>.
(floorl): Define using libm_alias_ldouble.
* sysdeps/x86_64/fpu/s_fmaxl.S: Include <libm-alias-ldouble.h>.
(fmaxl): Define using libm_alias_ldouble.
* sysdeps/x86_64/fpu/s_fminl.S: Include <libm-alias-ldouble.h>.
(fminl): Define using libm_alias_ldouble.
* sysdeps/x86_64/fpu/s_llrintl.S: Include <libm-alias-ldouble.h>.
(llrintl): Define using libm_alias_ldouble.
(lrintl): Likewise.
* sysdeps/x86_64/fpu/s_nearbyintl.S: Include
<libm-alias-ldouble.h>.
(nearbyintl): Define using libm_alias_ldouble.
* sysdeps/x86_64/fpu/s_truncl.S: Include <libm-alias-ldouble.h>.
(truncl): Define using libm_alias_ldouble.
* sysdeps/x86_64/x32/fpu/s_lrintl.S: Include
<libm-alias-ldouble.h>.
(lrintl): Define using libm_alias_ldouble.

6 years agoUse libm_alias_ldouble in sysdeps/i386/fpu.
Joseph Myers [Fri, 17 Nov 2017 22:54:39 +0000 (22:54 +0000)] 
Use libm_alias_ldouble in sysdeps/i386/fpu.

This patch continues the preparation for additional _FloatN / _FloatNx
function aliases by using libm_alias_ldouble for sysdeps/i386/fpu long
double functions, so that they can have _Float64x aliases added in
future.

Tested for x86_64 (which includes some of these implementations) and
x86, including build-many-glibcs.py tests that installed stripped
shared libraries are unchanged by the patch.

* sysdeps/i386/fpu/e_expl.S: Include <libm-alias-ldouble.h>.
[USE_AS_EXPM1L] (expm1l): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_asinhl.S: Include <libm-alias-ldouble.h>.
(asinhl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_atanl.c: Include <libm-alias-ldouble.h>.
(atanl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_cbrtl.S: Include <libm-alias-ldouble.h>.
(cbrtl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_ceill.S: Include <libm-alias-ldouble.h>.
(ceill): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_copysignl.S: Include <libm-alias-ldouble.h>.
(copysignl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_fabsl.S: Include <libm-alias-ldouble.h>.
(fabsl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_floorl.S: Include <libm-alias-ldouble.h>.
(floorl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_fmaxl.S: Include <libm-alias-ldouble.h>.
(fmaxl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_fminl.S: Include <libm-alias-ldouble.h>.
(fminl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_frexpl.S: Include <libm-alias-ldouble.h>.
(frexpl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_llrintl.S: Include <libm-alias-ldouble.h>.
(llrintl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_logbl.c: Include <libm-alias-ldouble.h>.
(logbl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_lrintl.S: Include <libm-alias-ldouble.h>.
(lrintl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_nearbyintl.S: Include <libm-alias-ldouble.h>.
(nearbyintl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_nextafterl.c: Include <libm-alias-ldouble.h>.
(nextafterl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_remquol.S: Include <libm-alias-ldouble.h>.
(remquol): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_rintl.c: Include <libm-alias-ldouble.h>.
(rintl): Define using libm_alias_ldouble.
* sysdeps/i386/fpu/s_truncl.S: Include <libm-alias-ldouble.h>.
(truncl): Define using libm_alias_ldouble.
* sysdeps/i386/i686/fpu/s_fmaxl.S: Include <libm-alias-ldouble.h>.
(fmaxl): Define using libm_alias_ldouble.
* sysdeps/i386/i686/fpu/s_fminl.S: Include <libm-alias-ldouble.h>.
(fminl): Define using libm_alias_ldouble.

6 years agoSupport bits/floatn.h inclusion from .S files.
Joseph Myers [Fri, 17 Nov 2017 22:01:43 +0000 (22:01 +0000)] 
Support bits/floatn.h inclusion from .S files.

Further _FloatN / _FloatNx type alias support will involve making
architecture-specific .S files use the common macros for libm function
aliases.  Making them use those macros will also serve to simplify
existing code for aliases / symbol versions in various cases, similar
to such simplifications for ldbl-opt code.

The libm-alias-*.h files sometimes need to include <bits/floatn.h> to
determine which aliases they should define.  At present, this does not
work for inclusion from .S files because <bits/floatn.h> can define
typedefs for old compilers.  This patch changes all the
<bits/floatn.h> and <bits/floatn-common.h> headers to include
__ASSEMBLER__ conditionals.  Those conditionals disable everything
related to C syntax in the __ASSEMBLER__ case, not just the problem
typedefs, as that seemed cleanest.  The __HAVE_* definitions remain in
the __ASSEMBLER__ case, as those provide information that is required
to define the correct set of aliases.

Tested with build-many-glibcs.py for a representative set of
configurations (x86_64-linux-gnu i686-linux-gnu ia64-linux-gnu
powerpc64le-linux-gnu mips64-linux-gnu-n64 sparc64-linux-gnu) with GCC
6.  Also tested with GCC 6 for i686-linux-gnu in conjunction with
changes to use alias macros in .S files.

* bits/floatn-common.h [!__ASSEMBLER]: Disable everything related
to C syntax instead of availability and properties of types.
* bits/floatn.h [!__ASSEMBLER]: Likewise.
* sysdeps/ia64/bits/floatn.h [!__ASSEMBLER]: Likewise.
* sysdeps/ieee754/ldbl-128/bits/floatn.h [!__ASSEMBLER]: Likewise.
* sysdeps/mips/ieee754/bits/floatn.h [!__ASSEMBLER]: Likewise.
* sysdeps/powerpc/bits/floatn.h [!__ASSEMBLER]: Likewise.
* sysdeps/x86/bits/floatn.h [!__ASSEMBLER]: Likewise.

6 years agosupport_become_root: Enable file creation in user namespaces
Florian Weimer [Fri, 17 Nov 2017 21:11:28 +0000 (22:11 +0100)] 
support_become_root: Enable file creation in user namespaces

Without UID/GID maps, file creation will file with EOVERFLOW.

This patch is based on DJ Delorie's work on container testing.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
6 years agoAdd AArch64 HWCAP_DCPOP from Linux 4.14.
Joseph Myers [Fri, 17 Nov 2017 14:03:04 +0000 (14:03 +0000)] 
Add AArch64 HWCAP_DCPOP from Linux 4.14.

This patch adds the HWCAP_DCPOP macro from Linux 4.14 to the AArch64
bits/hwcap.h.

Tested (compilation only) for aarch64 with build-many-glibcs.py.

* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_DCPOP): New
macro.

6 years agoaarch64: Fix f{max,min}{f} build for GCC 4.9 and 5
Adhemerval Zanella [Thu, 16 Nov 2017 21:52:59 +0000 (19:52 -0200)] 
aarch64: Fix f{max,min}{f} build for GCC 4.9 and 5

GCC 4.9 and 5 do not generate a correct f{max,min}nm instruction for
__builtin_{fmax,fmin}{f} without -ffinite-math-only.  It is clear a
compiler issue since the instruction can handle NaN and Inf correctly
and GCC6+ does not show this issue.

We can backport a fix to GCC 5, raise the minimum required GCC version
for aarch64 (since GCC 4.9 branch is now closed [1]) and/or add
configure check to check for this issue.  However I think
-ffinite-math-only should be safe for these specific implementations
and it is a simpler solution.

Checked on aarch64-linux-gnu with GCC 5.3.1.

* sysdeps/aarch64/fpu/Makefile (CFLAGS-s_fmax.c, CFLAGS-s_fmaxf.c,
CFLAGS-s_fmin.c, CFLAGS-s_fminf.c): New rule: add -ffinite-math-only.

[1] https://gcc.gnu.org/ml/gcc/2016-08/msg00010.html

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
6 years agoAdd Linux 4.14 ARPHRD_RAWIP to net/if_arp.h.
Joseph Myers [Thu, 16 Nov 2017 17:52:43 +0000 (17:52 +0000)] 
Add Linux 4.14 ARPHRD_RAWIP to net/if_arp.h.

This patch adds ARPHRD_RAWIP from Linux 4.14 to the Linux
net/if_arp.h.

Tested for x86_64.

* sysdeps/unix/sysv/linux/net/if_arp.h (ARPHRD_RAWIP): New macro.

6 years agoUpdate kernel version in syscall-names.list to 4.14.
Joseph Myers [Thu, 16 Nov 2017 17:51:54 +0000 (17:51 +0000)] 
Update kernel version in syscall-names.list to 4.14.

Linux 4.14 does not add any new syscalls; this patch updates the
version number in syscall-names.list to reflect that it's still
current for 4.14.

Tested for x86_64 (compilation with build-many-glibcs.py, using Linux
4.14).

* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel
version to 4.14.

6 years agoFix botched up regeneration in the last commit
Siddhesh Poyarekar [Thu, 16 Nov 2017 06:38:52 +0000 (12:08 +0530)] 
Fix botched up regeneration in the last commit

6 years agoPrefer https for Sourceware links
Siddhesh Poyarekar [Thu, 16 Nov 2017 06:19:26 +0000 (11:49 +0530)] 
Prefer https for Sourceware links

Update all sourceware links to https.  The website redirects
everything to https anyway so let the web server do a bit less work.
The only reference that remains unchanged is the one in the old
ChangeLog, since it didn't seem worth changing it.

* NEWS: Update sourceware link to https.
* configure.ac: Likewise.
* crypt/md5test-giant.c: Likewise.
* dlfcn/bug-atexit1.c: Likewise.
* dlfcn/bug-atexit2.c: Likewise.
* localedata/README: Likewise.
* malloc/tst-mallocfork.c: Likewise.
* manual/install.texi: Likewise.
* nptl/tst-pthread-getattr.c: Likewise.
* stdio-common/tst-fgets.c: Likewise.
* stdio-common/tst-fwrite.c: Likewise.
* sunrpc/Makefile: Likewise.
* sysdeps/arm/armv7/multiarch/memcpy_impl.S: Likewise.
* wcsmbs/tst-mbrtowc2.c: Likewise.
* configure: Regenerate.
* INSTALL: Regenerate.

6 years agoThe -Wstringop-truncation option new in GCC 8 detects common misuses
Martin Sebor [Thu, 16 Nov 2017 00:39:59 +0000 (17:39 -0700)] 
The -Wstringop-truncation option new in GCC 8 detects common misuses
of the strncat and strncpy function that may result in truncating
the copied string before the terminating NUL.  To avoid false positive
warnings for correct code that intentionally creates sequences of
characters that aren't guaranteed to be NUL-terminated, arrays that
are intended to store such sequences should be decorated with a new
nonstring attribute.  This change add this attribute to Glibc and
uses it to suppress such false positives.

ChangeLog:
* misc/sys/cdefs.h (__attribute_nonstring__): New macro.
* sysdeps/gnu/bits/utmp.h (struct utmp): Use it.
* sysdeps/unix/sysv/linux/s390/bits/utmp.h (struct utmp): Same.

6 years agolinux ttyname{_r}: Add tests
Luke Shumaker [Wed, 15 Nov 2017 19:39:22 +0000 (20:39 +0100)] 
linux ttyname{_r}: Add tests

Add a new tst-ttyname test that includes several named sub-testcases.

This patch is ordered after the patches with the fixes that it tests for (to
avoid breaking `git bisect`), but for reference, here's how each relevant change
so far affected the testcases in this commit, starting with
15e9a4f378c8607c2ae1aa465436af4321db0e23:

  |                                 | before  |         | make checks | don't |
  |                                 | 15e9a4f | 15e9a4f | consistent  | bail  |
  |---------------------------------+---------+---------+-------------+-------|
  | basic smoketest                 | PASS    | PASS    | PASS        | PASS  |
  | no conflict, no match           | PASS[1] | PASS    | PASS        | PASS  |
  | no conflict, console            | PASS    | FAIL!   | FAIL        | PASS! |
  | conflict, no match              | FAIL    | PASS!   | PASS        | PASS  |
  | conflict, console               | FAIL    | FAIL    | FAIL        | PASS! |
  | with readlink target            | PASS    | PASS    | PASS        | PASS  |
  | with readlink trap; fallback    | FAIL    | FAIL    | FAIL        | PASS! |
  | with readlink trap; no fallback | FAIL    | PASS!   | PASS        | PASS  |
  | with search-path trap           | FAIL    | FAIL    | PASS!       | PASS  |
  |---------------------------------+---------+---------+-------------+-------|
  |                                 | 4/9     | 5/9     | 6/9         | 9/9   |

  [1]: 15e9a4f introduced a semantic that, under certain failure
       conditions, ttyname sets errno=ENODEV, where previously it didn't
       set errno; it's not quite fair to hold "before 15e9a4f" ttyname to
       those new semantics.  This testcase actually fails, but would have
       passed if we tested for the old the semantics.

Each of the failing tests before 15e9a4f are all essentially the same bug: that
it returns a PTY slave with the correct minor device number, but from the wrong
devpts filesystem instance.

15e9a4f sought to fix this, but missed several of the cases that can cause this
to happen, and also broke the case where both the erroneous PTY and the correct
PTY exist.

Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolinux ttyname{_r}: Don't bail prematurely [BZ #22145]
Luke Shumaker [Wed, 15 Nov 2017 19:36:44 +0000 (20:36 +0100)] 
linux ttyname{_r}: Don't bail prematurely [BZ #22145]

Commit 15e9a4f378c8607c2ae1aa465436af4321db0e23 introduced logic for ttyname()
sending back ENODEV to signal that we can't get a name for the TTY because we
inherited it from a different mount namespace.

However, just because we inherited it from a different mount namespace and it
isn't available at its original path, doesn't mean that its name is unknowable;
we can still try to find it by allowing the normal fall back on iterating
through devices.

An example scenario where this happens is with "/dev/console" in containers.
It's a common practice among container managers to allocate a PTY master/slave
pair in the host's mount namespace (the slave having a path like "/dev/pty/$X"),
bind mount the slave to "/dev/console" in the container's mount namespace, and
send the slave FD to a process in the container. Inside of the
container, the slave-end isn't available at its original path ("/dev/pts/$X"),
since the container mount namespace has a separate devpts instance from the host
(that path may or may not exist in the container; if it does exist, it's not the
 same PTY slave device). Currently ttyname{_r} sees that the file at the
original "/dev/pts/$X" path doesn't match the FD passed to it, and fails early
and gives up, even though if it kept searching it would find the TTY at
"/dev/console". Fix that; don't have the ENODEV path force an early return
inhibiting the fall-back search.

This change is based on the previous patch that adds use of is_mytty in
getttyname and getttyname_r. Without that change, this effectively reverts
15e9a4f, which made us disregard the false similarity of file pointed to by
"/proc/self/fd/$Y", because if it doesn't bail prematurely then that file
("/dev/pts/$X") will just come up again anyway in the fall-back search.

Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolinux ttyname{_r}: Make tty checks consistent
Luke Shumaker [Wed, 15 Nov 2017 19:34:30 +0000 (20:34 +0100)] 
linux ttyname{_r}: Make tty checks consistent

In the ttyname and ttyname_r routines on Linux, at several points it needs to
check if a given TTY is the TTY we are looking for. It used to be that this
check was (to see if `maybe` is `mytty`):

       __xstat64(_STAT_VER, maybe_filename, &maybe) == 0
    #ifdef _STATBUF_ST_RDEV
       && S_ISCHR(maybe.st_mode) && maybe.st_rdev == mytty.st_rdev
    #else
       && maybe.st_ino == mytty.st_ino && maybe.st_dev == mytty.st_dev
    #endif

This check appears in several places.

Then, one of the changes made in commit 15e9a4f378c8607c2ae1aa465436af4321db0e23
was to change that check to:

       __xstat64(_STAT_VER, maybe_filename, &maybe) == 0
    #ifdef _STATBUF_ST_RDEV
       && S_ISCHR(maybe.st_mode) && maybe.st_rdev == mytty.st_rdev
    #endif
       && maybe.st_ino == mytty.st_ino && maybe.st_dev == mytty.st_dev

That is, it made the st_ino and st_dev parts of the check happen even if we have
the st_rdev member. This is an important change, because the kernel allows
multiple devpts filesystem instances to be created; a device file in one devpts
instance may share the same st_rdev with a file in another devpts instance, but
they aren't the same file.

This check appears twice in each file (ttyname.c and ttyname_r.c), once (in
ttyname and __ttyname_r) to check if a candidate file found by inspecting /proc
is the desired TTY, and once (in getttyname and getttyname_r) to check if a
candidate file found by searching /dev is the desired TTY. However, 15e9a4f
only updated the checks for files found via /proc; but the concern about
collisions between devpts instances is just as valid for files found via /dev.

So, update all 4 occurrences the check to be consistent with the version of the
check introduced in 15e9a4f. Make it easy to keep all 4 occurrences of the
check consistent by pulling it in to a static inline function, is_mytty.

Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolinux ttyname: Change return type of is_pty from int to bool
Luke Shumaker [Wed, 15 Nov 2017 19:33:11 +0000 (20:33 +0100)] 
linux ttyname: Change return type of is_pty from int to bool

is_pty returning a bool is fine since there's no possible outcome other than
true or false, and bool is used throughout the codebase.

Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolinux ttyname: Update a reference to kernel docs for kernel 4.10
Luke Shumaker [Wed, 15 Nov 2017 19:31:32 +0000 (20:31 +0100)] 
linux ttyname: Update a reference to kernel docs for kernel 4.10

Linux 4.10 moved many of the documentation files around.

4.10 came out between the time the patch adding the comment (commit
15e9a4f378c8607c2ae1aa465436af4321db0e23) was submitted and the time
it was applied (in February, January, and March 2017; respectively).

Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agomanual: Update to mention ENODEV for ttyname and ttyname_r
Luke Shumaker [Wed, 15 Nov 2017 19:28:40 +0000 (20:28 +0100)] 
manual: Update to mention ENODEV for ttyname and ttyname_r

Commit 15e9a4f378c8607c2ae1aa465436af4321db0e23 introduced ENODEV as a possible
error condition for ttyname and ttyname_r. Update the manual to mention this GNU
extension.

Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoAdd MSG_ZEROCOPY from Linux 4.14 to bits/socket.h.
Joseph Myers [Wed, 15 Nov 2017 18:41:32 +0000 (18:41 +0000)] 
Add MSG_ZEROCOPY from Linux 4.14 to bits/socket.h.

This patch adds the new MSG_ZEROCOPY constant from Linux 4.14 to the
Linux bits/socket.h.

Tested for x86_64.

* sysdeps/unix/sysv/linux/bits/socket.h (MSG_ZEROCOPY): New enum
constant and macro.

6 years agoAdd MADV_WIPEONFORK, MADV_KEEPONFORK from Linux 4.14.
Joseph Myers [Wed, 15 Nov 2017 18:40:29 +0000 (18:40 +0000)] 
Add MADV_WIPEONFORK, MADV_KEEPONFORK from Linux 4.14.

This patch adds the new MADV_WIPEONFORK and MADV_KEEPONFORK from Linux
4.14 to bits/mman-linux.h (and bits/mman.h in the hppa case).  Note
there are further hppa MADV_* changes in 4.14; I plan a separate glibc
patch for those.

Tested for x86_64.

* sysdeps/unix/sysv/linux/bits/mman-linux.h
[__USE_MISC] (MADV_WIPEONFORK): New macro.
[__USE_MISC] (MADV_KEEPONFORK): Likewise.
* sysdeps/unix/sysv/linux/hppa/bits/mman.h
[__USE_MISC] (MADV_WIPEONFORK): Likewise.
[__USE_MISC] (MADV_KEEPONFORK): Likewise.

6 years agoOptimize sigrelse implementation
Adhemerval Zanella [Mon, 6 Nov 2017 11:31:37 +0000 (09:31 -0200)] 
Optimize sigrelse implementation

This patch simplifies sighold a bit by removing an extra sigprocmask
and using SIG_BLOCK (which union of the current set and the set argument).

Checked on x86_64-linux-gnu.

* signal/sighold.c (sighold): Optimize implementation.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agoCleanup sigpause implementation
Adhemerval Zanella [Fri, 3 Nov 2017 12:55:09 +0000 (10:55 -0200)] 
Cleanup sigpause implementation

This patch simplify sigpause by remobing the single thread optimization
since it will be handled already by the __sigsuspend call.

Checked on x86_64-linux-gnu.

* sysdeps/posix/sigpause.c (do_sigpause): Remove.
(__sigpause): Rely on __sigsuspend to implement single thread
optimization.  Add LIBC_CANCEL_HANDLED for cancellation marking.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Zack Weinberg <zackw@panix.com>
6 years agoUse Linux 4.14 in build-many-glibcs.py.
Joseph Myers [Wed, 15 Nov 2017 17:10:03 +0000 (17:10 +0000)] 
Use Linux 4.14 in build-many-glibcs.py.

* scripts/build-many-glibcs.py (Context.checkout): Default Linux
kernel version to 4.14.

6 years agoCheck length of ifname before copying it into to ifreq structure.
Steve Ellcey [Wed, 15 Nov 2017 16:58:48 +0000 (08:58 -0800)] 
Check length of ifname before copying it into to ifreq structure.

[BZ #22442]
* sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex):
Check if ifname is too long.

6 years agolinux: Include <sysdep-cancel.h> for epoll_wait
Luke Shumaker [Wed, 15 Nov 2017 16:36:25 +0000 (14:36 -0200)] 
linux: Include <sysdep-cancel.h> for epoll_wait

The epoll_wait wrapper uses the raw syscall if __NR_epoll_wait is defined,
and falls back to calling epoll_pwait(..., NULL) if it isn't defined.
However, it didn't include the appropriate headers for __NR_epoll_wait to
be defined, so it was *always* falling back to calling epoll_pwait!

This mistake was introduced in b62c3815912bc679a966134affdedd3f35ae8621,
when epoll_wait changed from being in syscalls.list to always having a C
wrapper.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agoka_GE locale: Add “X” back to yesexpr.
Mike FABIAN [Wed, 15 Nov 2017 12:19:43 +0000 (13:19 +0100)] 
ka_GE locale: Add “X” back to yesexpr.

* localedata/locales/ka_GE (LC_MESSAGES): Add “X” back to yesexpr,
was accidentally lost.

6 years agoaz_IR locale: Add standard copyright header
Mike FABIAN [Wed, 15 Nov 2017 12:16:47 +0000 (13:16 +0100)] 
az_IR locale: Add standard copyright header

* localedata/locales/az_IR: Add standard copyright header.

6 years agomalloc: Account for all heaps in an arena in malloc_info [BZ #22439]
Florian Weimer [Wed, 15 Nov 2017 10:40:41 +0000 (11:40 +0100)] 
malloc: Account for all heaps in an arena in malloc_info [BZ #22439]

This commit adds a "subheaps" field to the malloc_info output that
shows the number of heaps that were allocated to extend a non-main
arena.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
6 years agomalloc: Add missing arena lock in malloc_info [BZ #22408]
Florian Weimer [Wed, 15 Nov 2017 10:39:01 +0000 (11:39 +0100)] 
malloc: Add missing arena lock in malloc_info [BZ #22408]

Obtain the size information while the arena lock is acquired, and only
print it later.

6 years agoUse __builtin_tgmath in tgmath.h with GCC 8 (bug 21660).
Joseph Myers [Wed, 15 Nov 2017 02:08:56 +0000 (02:08 +0000)] 
Use __builtin_tgmath in tgmath.h with GCC 8 (bug 21660).

GCC mainline now supports __builtin_tgmath to allow <tgmath.h> macro
implementations that expand their arguments only once, so avoiding
exponential blowup in the size of macro expansions when calls to those
macros are nested in arguments to those macros.

This patch makes glibc's tgmath.h support using __builtin_tgmath, as a
much simpler and more efficient alternative to the existing
implementation.  (As a side effect, the new feature would make it much
more practical to support decimal floating point in <tgmath.h> with
new compilers; currently, libdfp does not provide a <tgmath.h>
implementation, and making decimal arguments cause integer arguments
to be considered of type _Decimal64 instead of double would have been
very problematic in the old implementation.)

Tested for x86_64 (with GCC mainline).

[BZ #21660]
* math/tgmath.h (__HAVE_BUILTIN_TGMATH): New macro.
[__HAVE_BUILTIN_TGMATH] (__TG_F16_ARG): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TG_F32_ARG): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TG_F64_ARG): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TG_F128_ARG): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TG_F32X_ARG): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TG_F64X_ARG): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TG_F128X_ARG): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_FUNCS): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_RCFUNCS): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_1): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_2): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_2STD): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_3): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_1C): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_2C): Likewise.
(__tgml): Make conditional on [!__HAVE_BUILTIN_TGMATH].
(__floating_type): Likewise.
(__real_integer_type): Likewise.
(__complex_integer_type): Likewise.
(__expr_is_real): Likewise.
(__tgmath_real_type_sub): Likewise.
(__tgmath_real_type): Likewise.
(__tgmath_complex_type_sub): Likewise.
(__tgmath_complex_type): Likewise.
(__TGMATH_F128): Likewise.
(__TGMATH_CF128): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_UNARY_REAL_ONLY): Define using
new macros.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_UNARY_REAL_RET_ONLY): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_BINARY_FIRST_REAL_ONLY):
Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_BINARY_FIRST_REAL_STD_ONLY):
Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_BINARY_REAL_ONLY): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_BINARY_REAL_STD_ONLY): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_BINARY_REAL_RET_ONLY): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY):
Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_TERNARY_REAL_ONLY): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_TERNARY_FIRST_REAL_RET_ONLY):
Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_UNARY_REAL_IMAG): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_UNARY_IMAG): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_UNARY_REAL_IMAG_RET_REAL):
Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_BINARY_REAL_IMAG): Likewise.
(__TGMATH_UNARY_REAL_IMAG_RET_REAL_SAME): New macro.
(carg): Use __TGMATH_UNARY_REAL_IMAG_RET_REAL_SAME.
(cimag): Likewise.
(creal): Likewise.

6 years agoFix string/tester.c build with GCC 8.
Joseph Myers [Tue, 14 Nov 2017 17:52:26 +0000 (17:52 +0000)] 
Fix string/tester.c build with GCC 8.

GCC 8 warns about more cases of string functions truncating their
output or not copying a trailing NUL byte.

This patch fixes testsuite build failures caused by such warnings in
string/tester.c.  In general, the warnings are disabled around the
relevant calls using DIAG_* macros, since the relevant cases are being
deliberately tested.  In one case, the warning is with
-Wstringop-overflow= instead of -Wstringop-truncation; in that case,
the conditional is __GNUC_PREREQ (7, 0) (being the version where
-Wstringop-overflow= was introduced), to allow the conditional to be
removed sooner, since it's harmless to disable the warning for a
GCC version where it doesn't actually occur.  In the case of warnings
for strncpy calls in test_memcmp, the calls in question are changed to
use memcpy, as they don't copy a trailing NUL and the point of that
code is to test memcmp rather than strncpy.

Tested (compilation) with GCC 8 for x86_64-linux-gnu with
build-many-glibcs.py (in conjunction with Martin's patch to allow
glibc to build).

* string/tester.c (test_stpncpy): Disable -Wstringop-truncation
for stpncpy calls for GCC 8.
(test_strncat): Disable -Wstringop-truncation warning for strncat
calls for GCC 8.  Disable -Wstringop-overflow= warning for one
strncat call for GCC 7.
(test_strncpy): Disable -Wstringop-truncation warning for strncpy
calls for GCC 8.
(test_memcmp): Use memcpy instead of strncpy for calls not copying
trailing NUL.

6 years agoFix string/bug-strncat1.c build with GCC 8.
Joseph Myers [Tue, 14 Nov 2017 17:50:36 +0000 (17:50 +0000)] 
Fix string/bug-strncat1.c build with GCC 8.

GCC 8 warns about strncat calls with truncated output.
string/bug-strncat1.c tests such a call; this patch disables the
warning for it.

Tested (compilation) with GCC 8 for x86_64-linux-gnu with
build-many-glibcs.py (in conjunction with Martin's patch to allow
glibc to build).

* string/bug-strncat1.c: Include <libc-diag.h>.
(main): Disable -Wstringop-truncation for strncat call for GCC 8.

6 years agoReplaced unicode sequences in the ASCII printable range
Claude Paroz [Thu, 2 Nov 2017 14:10:42 +0000 (15:10 +0100)] 
Replaced unicode sequences in the ASCII printable range

[BZ #22387]
* localedata/locales/aa_DJ: Improved readibility by replacing
<Uxxxx> sequences in the ASCII printable range by their ASCII
character equivalents.
* localedata/locales/aa_ER: Likewise.
* localedata/locales/aa_ER@saaho: Likewise.
* localedata/locales/aa_ET: Likewise.
* localedata/locales/af_ZA: Likewise.
* localedata/locales/agr_PE: Likewise.
* localedata/locales/ak_GH: Likewise.
* localedata/locales/am_ET: Likewise.
* localedata/locales/anp_IN: Likewise.
* localedata/locales/ar_AE: Likewise.
* localedata/locales/ar_BH: Likewise.
* localedata/locales/ar_DZ: Likewise.
* localedata/locales/ar_EG: Likewise.
* localedata/locales/ar_IN: Likewise.
* localedata/locales/ar_IQ: Likewise.
* localedata/locales/ar_JO: Likewise.
* localedata/locales/ar_KW: Likewise.
* localedata/locales/ar_LB: Likewise.
* localedata/locales/ar_LY: Likewise.
* localedata/locales/ar_MA: Likewise.
* localedata/locales/ar_OM: Likewise.
* localedata/locales/ar_QA: Likewise.
* localedata/locales/ar_SA: Likewise.
* localedata/locales/ar_SD: Likewise.
* localedata/locales/ar_SS: Likewise.
* localedata/locales/ar_SY: Likewise.
* localedata/locales/ar_TN: Likewise.
* localedata/locales/ar_YE: Likewise.
* localedata/locales/as_IN: Likewise.
* localedata/locales/ast_ES: Likewise.
* localedata/locales/ayc_PE: Likewise.
* localedata/locales/az_AZ: Likewise.
* localedata/locales/az_IR: Likewise.
* localedata/locales/be_BY: Likewise.
* localedata/locales/be_BY@latin: Likewise.
* localedata/locales/bem_ZM: Likewise.
* localedata/locales/ber_DZ: Likewise.
* localedata/locales/ber_MA: Likewise.
* localedata/locales/bg_BG: Likewise.
* localedata/locales/bhb_IN: Likewise.
* localedata/locales/bho_IN: Likewise.
* localedata/locales/bi_VU: Likewise.
* localedata/locales/bn_BD: Likewise.
* localedata/locales/bn_IN: Likewise.
* localedata/locales/bo_CN: Likewise.
* localedata/locales/bo_IN: Likewise.
* localedata/locales/br_FR: Likewise.
* localedata/locales/brx_IN: Likewise.
* localedata/locales/bs_BA: Likewise.
* localedata/locales/byn_ER: Likewise.
* localedata/locales/ca_AD: Likewise.
* localedata/locales/ca_ES: Likewise.
* localedata/locales/ca_FR: Likewise.
* localedata/locales/ca_IT: Likewise.
* localedata/locales/ce_RU: Likewise.
* localedata/locales/chr_US: Likewise.
* localedata/locales/cmn_TW: Likewise.
* localedata/locales/crh_UA: Likewise.
* localedata/locales/cs_CZ: Likewise.
* localedata/locales/csb_PL: Likewise.
* localedata/locales/cv_RU: Likewise.
* localedata/locales/cy_GB: Likewise.
* localedata/locales/da_DK: Likewise.
* localedata/locales/de_AT: Likewise.
* localedata/locales/de_BE: Likewise.
* localedata/locales/de_CH: Likewise.
* localedata/locales/de_DE: Likewise.
* localedata/locales/de_IT: Likewise.
* localedata/locales/de_LI: Likewise.
* localedata/locales/de_LU: Likewise.
* localedata/locales/doi_IN: Likewise.
* localedata/locales/dv_MV: Likewise.
* localedata/locales/dz_BT: Likewise.
* localedata/locales/el_CY: Likewise.
* localedata/locales/el_GR: Likewise.
* localedata/locales/en_AG: Likewise.
* localedata/locales/en_AU: Likewise.
* localedata/locales/en_BW: Likewise.
* localedata/locales/en_CA: Likewise.
* localedata/locales/en_DK: Likewise.
* localedata/locales/en_GB: Likewise.
* localedata/locales/en_HK: Likewise.
* localedata/locales/en_IE: Likewise.
* localedata/locales/en_IL: Likewise.
* localedata/locales/en_IN: Likewise.
* localedata/locales/en_NG: Likewise.
* localedata/locales/en_NZ: Likewise.
* localedata/locales/en_PH: Likewise.
* localedata/locales/en_SG: Likewise.
* localedata/locales/en_US: Likewise.
* localedata/locales/en_ZA: Likewise.
* localedata/locales/en_ZM: Likewise.
* localedata/locales/en_ZW: Likewise.
* localedata/locales/eo: Likewise.
* localedata/locales/es_AR: Likewise.
* localedata/locales/es_BO: Likewise.
* localedata/locales/es_CL: Likewise.
* localedata/locales/es_CO: Likewise.
* localedata/locales/es_CR: Likewise.
* localedata/locales/es_CU: Likewise.
* localedata/locales/es_DO: Likewise.
* localedata/locales/es_EC: Likewise.
* localedata/locales/es_ES: Likewise.
* localedata/locales/es_GT: Likewise.
* localedata/locales/es_HN: Likewise.
* localedata/locales/es_MX: Likewise.
* localedata/locales/es_NI: Likewise.
* localedata/locales/es_PA: Likewise.
* localedata/locales/es_PE: Likewise.
* localedata/locales/es_PR: Likewise.
* localedata/locales/es_PY: Likewise.
* localedata/locales/es_SV: Likewise.
* localedata/locales/es_US: Likewise.
* localedata/locales/es_UY: Likewise.
* localedata/locales/es_VE: Likewise.
* localedata/locales/et_EE: Likewise.
* localedata/locales/eu_ES: Likewise.
* localedata/locales/eu_ES@euro: Likewise.
* localedata/locales/fa_IR: Likewise.
* localedata/locales/ff_SN: Likewise.
* localedata/locales/fi_FI: Likewise.
* localedata/locales/fil_PH: Likewise.
* localedata/locales/fo_FO: Likewise.
* localedata/locales/fr_BE: Likewise.
* localedata/locales/fr_CA: Likewise.
* localedata/locales/fr_CH: Likewise.
* localedata/locales/fr_FR: Likewise.
* localedata/locales/fr_LU: Likewise.
* localedata/locales/fur_IT: Likewise.
* localedata/locales/fy_DE: Likewise.
* localedata/locales/fy_NL: Likewise.
* localedata/locales/ga_IE: Likewise.
* localedata/locales/gd_GB: Likewise.
* localedata/locales/gez_ER: Likewise.
* localedata/locales/gez_ET: Likewise.
* localedata/locales/gl_ES: Likewise.
* localedata/locales/gu_IN: Likewise.
* localedata/locales/gv_GB: Likewise.
* localedata/locales/ha_NG: Likewise.
* localedata/locales/hak_TW: Likewise.
* localedata/locales/he_IL: Likewise.
* localedata/locales/hi_IN: Likewise.
* localedata/locales/hif_FJ: Likewise.
* localedata/locales/hne_IN: Likewise.
* localedata/locales/hr_HR: Likewise.
* localedata/locales/hsb_DE: Likewise.
* localedata/locales/ht_HT: Likewise.
* localedata/locales/hu_HU: Likewise.
* localedata/locales/hy_AM: Likewise.
* localedata/locales/i18n: Likewise.
* localedata/locales/ia_FR: Likewise.
* localedata/locales/id_ID: Likewise.
* localedata/locales/ig_NG: Likewise.
* localedata/locales/ik_CA: Likewise.
* localedata/locales/is_IS: Likewise.
* localedata/locales/it_CH: Likewise.
* localedata/locales/it_IT: Likewise.
* localedata/locales/iu_CA: Likewise.
* localedata/locales/ja_JP: Likewise.
* localedata/locales/ka_GE: Likewise.
* localedata/locales/kk_KZ: Likewise.
* localedata/locales/kl_GL: Likewise.
* localedata/locales/kn_IN: Likewise.
* localedata/locales/ko_KR: Likewise.
* localedata/locales/kok_IN: Likewise.
* localedata/locales/ks_IN: Likewise.
* localedata/locales/ks_IN@devanagari: Likewise.
* localedata/locales/ku_TR: Likewise.
* localedata/locales/kw_GB: Likewise.
* localedata/locales/ky_KG: Likewise.
* localedata/locales/lb_LU: Likewise.
* localedata/locales/lg_UG: Likewise.
* localedata/locales/li_BE: Likewise.
* localedata/locales/li_NL: Likewise.
* localedata/locales/lij_IT: Likewise.
* localedata/locales/ln_CD: Likewise.
* localedata/locales/lo_LA: Likewise.
* localedata/locales/lt_LT: Likewise.
* localedata/locales/lv_LV: Likewise.
* localedata/locales/lzh_TW: Likewise.
* localedata/locales/mag_IN: Likewise.
* localedata/locales/mai_IN: Likewise.
* localedata/locales/mg_MG: Likewise.
* localedata/locales/mhr_RU: Likewise.
* localedata/locales/mi_NZ: Likewise.
* localedata/locales/mk_MK: Likewise.
* localedata/locales/ml_IN: Likewise.
* localedata/locales/mn_MN: Likewise.
* localedata/locales/mni_IN: Likewise.
* localedata/locales/mr_IN: Likewise.
* localedata/locales/ms_MY: Likewise.
* localedata/locales/mt_MT: Likewise.
* localedata/locales/my_MM: Likewise.
* localedata/locales/nan_TW: Likewise.
* localedata/locales/nan_TW@latin: Likewise.
* localedata/locales/nb_NO: Likewise.
* localedata/locales/nds_DE: Likewise.
* localedata/locales/nds_NL: Likewise.
* localedata/locales/ne_NP: Likewise.
* localedata/locales/nhn_MX: Likewise.
* localedata/locales/niu_NU: Likewise.
* localedata/locales/niu_NZ: Likewise.
* localedata/locales/nl_AW: Likewise.
* localedata/locales/nl_BE: Likewise.
* localedata/locales/nl_NL: Likewise.
* localedata/locales/nn_NO: Likewise.
* localedata/locales/nr_ZA: Likewise.
* localedata/locales/nso_ZA: Likewise.
* localedata/locales/oc_FR: Likewise.
* localedata/locales/om_ET: Likewise.
* localedata/locales/om_KE: Likewise.
* localedata/locales/or_IN: Likewise.
* localedata/locales/os_RU: Likewise.
* localedata/locales/pa_IN: Likewise.
* localedata/locales/pa_PK: Likewise.
* localedata/locales/pap_AW: Likewise.
* localedata/locales/pap_CW: Likewise.
* localedata/locales/pl_PL: Likewise.
* localedata/locales/ps_AF: Likewise.
* localedata/locales/pt_BR: Likewise.
* localedata/locales/pt_PT: Likewise.
* localedata/locales/quz_PE: Likewise.
* localedata/locales/raj_IN: Likewise.
* localedata/locales/ro_RO: Likewise.
* localedata/locales/ru_RU: Likewise.
* localedata/locales/ru_UA: Likewise.
* localedata/locales/rw_RW: Likewise.
* localedata/locales/sa_IN: Likewise.
* localedata/locales/sat_IN: Likewise.
* localedata/locales/sc_IT: Likewise.
* localedata/locales/sd_IN: Likewise.
* localedata/locales/sd_IN@devanagari: Likewise.
* localedata/locales/se_NO: Likewise.
* localedata/locales/sgs_LT: Likewise.
* localedata/locales/shs_CA: Likewise.
* localedata/locales/si_LK: Likewise.
* localedata/locales/sid_ET: Likewise.
* localedata/locales/sk_SK: Likewise.
* localedata/locales/sl_SI: Likewise.
* localedata/locales/sm_WS: Likewise.
* localedata/locales/so_DJ: Likewise.
* localedata/locales/so_ET: Likewise.
* localedata/locales/so_KE: Likewise.
* localedata/locales/so_SO: Likewise.
* localedata/locales/sq_AL: Likewise.
* localedata/locales/sq_MK: Likewise.
* localedata/locales/sr_ME: Likewise.
* localedata/locales/sr_RS: Likewise.
* localedata/locales/sr_RS@latin: Likewise.
* localedata/locales/ss_ZA: Likewise.
* localedata/locales/st_ZA: Likewise.
* localedata/locales/sv_FI: Likewise.
* localedata/locales/sv_SE: Likewise.
* localedata/locales/sw_KE: Likewise.
* localedata/locales/sw_TZ: Likewise.
* localedata/locales/szl_PL: Likewise.
* localedata/locales/ta_IN: Likewise.
* localedata/locales/ta_LK: Likewise.
* localedata/locales/tcy_IN: Likewise.
* localedata/locales/te_IN: Likewise.
* localedata/locales/tg_TJ: Likewise.
* localedata/locales/th_TH: Likewise.
* localedata/locales/the_NP: Likewise.
* localedata/locales/ti_ER: Likewise.
* localedata/locales/ti_ET: Likewise.
* localedata/locales/tig_ER: Likewise.
* localedata/locales/tk_TM: Likewise.
* localedata/locales/tl_PH: Likewise.
* localedata/locales/tn_ZA: Likewise.
* localedata/locales/to_TO: Likewise.
* localedata/locales/tpi_PG: Likewise.
* localedata/locales/tr_CY: Likewise.
* localedata/locales/tr_TR: Likewise.
* localedata/locales/ts_ZA: Likewise.
* localedata/locales/tt_RU: Likewise.
* localedata/locales/tt_RU@iqtelif: Likewise.
* localedata/locales/ug_CN: Likewise.
* localedata/locales/uk_UA: Likewise.
* localedata/locales/unm_US: Likewise.
* localedata/locales/ur_IN: Likewise.
* localedata/locales/ur_PK: Likewise.
* localedata/locales/uz_UZ: Likewise.
* localedata/locales/uz_UZ@cyrillic: Likewise.
* localedata/locales/ve_ZA: Likewise.
* localedata/locales/vi_VN: Likewise.
* localedata/locales/wa_BE: Likewise.
* localedata/locales/wae_CH: Likewise.
* localedata/locales/wal_ET: Likewise.
* localedata/locales/wo_SN: Likewise.
* localedata/locales/xh_ZA: Likewise.
* localedata/locales/yi_US: Likewise.
* localedata/locales/yo_NG: Likewise.
* localedata/locales/yue_HK: Likewise.
* localedata/locales/yuw_PG: Likewise.
* localedata/locales/zh_CN: Likewise.
* localedata/locales/zh_HK: Likewise.
* localedata/locales/zh_SG: Likewise.
* localedata/locales/zh_TW: Likewise.
* localedata/locales/zu_ZA: Likewise.

6 years agosupport: Add <support/next_to_fault.h>
Florian Weimer [Mon, 13 Nov 2017 16:55:12 +0000 (17:55 +0100)] 
support: Add <support/next_to_fault.h>

Based on the implementation in resolv/tst-inet_pton.c.

6 years agoAdd missing ChangeLog sub-entries
Florian Weimer [Mon, 13 Nov 2017 16:58:10 +0000 (17:58 +0100)] 
Add missing ChangeLog sub-entries

6 years agold.so: Add architecture specific fields
H.J. Lu [Mon, 13 Nov 2017 16:02:39 +0000 (08:02 -0800)] 
ld.so: Add architecture specific fields

To support Intel Control-flow Enforcement Technology (CET) run-time
control:

1. An architecture specific field in the writable ld.so namespace is
needed to indicate if CET features are enabled at run-time.
2. An architecture specific field in struct link_map is needed if
CET features are enabled in an ELF module.

This patch adds dl-procruntime.c to the writable ld.so namespace and
link_map.h to struct link_map.

Tested with build-many-glibcs.py.

* elf/dl-support.c: Include <dl-procruntime.c>.
* include/link.h: Include <link_map.h>.
* sysdeps/generic/dl-procruntime.c: New file.
* sysdeps/generic/link_map.h: Likewise.
* sysdeps/generic/ldsodefs.h: Include <dl-procruntime.c> in
the writable ld.so namespace.

6 years agotimezone: pacify GCC -Wstringop-truncation
Paul Eggert [Mon, 13 Nov 2017 06:00:28 +0000 (22:00 -0800)] 
timezone: pacify GCC -Wstringop-truncation

Problem reported by Martin Sebor in:
https://sourceware.org/ml/libc-alpha/2017-11/msg00336.html
* timezone/zic.c (writezone): Use memcpy, not strncpy.

6 years agosupport: Add xstrndup, xunlink, xreadlink, support_create_temp_directory
Florian Weimer [Sun, 12 Nov 2017 08:53:06 +0000 (09:53 +0100)] 
support: Add xstrndup, xunlink, xreadlink, support_create_temp_directory

6 years agoFix clog10_downward ulps on hppa.
John David Anglin [Sat, 11 Nov 2017 17:12:28 +0000 (12:12 -0500)] 
Fix clog10_downward ulps on hppa.

2017-11-11  John David Anglin  <danglin@gcc.gnu.org>

* sysdeps/hppa/fpu/libm-test-ulps: Update clog10_downward ulps.

6 years agoresolv: More precise checks in res_hnok, res_dnok [BZ #22409] [BZ #22412]
Florian Weimer [Sat, 11 Nov 2017 10:51:08 +0000 (11:51 +0100)] 
resolv: More precise checks in res_hnok, res_dnok [BZ #22409] [BZ #22412]

res_hnok rejected some host names used on the Internet, such as
www-.example.com.  res_hnok and res_dnok failed to perform basic syntax
checking on DNS domain names.

Also fix res_mailok, res_ownok.

6 years agoresolv: ns_name_pton should report trailing \ as error [BZ #22413]
Florian Weimer [Sat, 11 Nov 2017 10:41:45 +0000 (11:41 +0100)] 
resolv: ns_name_pton should report trailing \ as error [BZ #22413]

6 years agoresolv: Add tst-ns_name_pton
Florian Weimer [Sat, 11 Nov 2017 10:33:32 +0000 (11:33 +0100)] 
resolv: Add tst-ns_name_pton

6 years agoresolv: Add tst-res_hnok
Florian Weimer [Sat, 11 Nov 2017 10:23:40 +0000 (11:23 +0100)] 
resolv: Add tst-res_hnok

6 years agoresolv: Use test framework in tst-resolv-network
Florian Weimer [Sat, 11 Nov 2017 09:54:16 +0000 (10:54 +0100)] 
resolv: Use test framework in tst-resolv-network

The main function was left in place by accident when the
test was imported.

6 years agoAdd jmp_buf-macros.h
H.J. Lu [Thu, 9 Nov 2017 13:09:49 +0000 (05:09 -0800)] 
Add jmp_buf-macros.h

Verify that sizes, alignments and field offsets of jmp_buf as well as
sigjmp_buf are unchanged regardless how struct __jmp_buf_tag is defined.
Since jmp_buf is target specific, jmp_buf-macros.h is added for each
Linux target.  A new target must provides its own jmp_buf-macros.h.

TODO: Hurd needs to provide a jmp_buf-macros.h.

Tested with build-many-glibcs.py.

* include/setjmp.h [!_ISOMAC]: Include <stddef.h> and
<jmp_buf-macros.h>.
[!_ISOMAC] (STR_HELPER): New.
[!_ISOMAC] (STR): Likewise.
[!_ISOMAC] (TEST_SIZE): Likewise.
[!_ISOMAC] (TEST_ALIGN): Likewise.
[!_ISOMAC] (TEST_OFFSET): Likewise.
[!_ISOMAC] Add _Static_assert to check sizes, alignments and
field offsets of jmp_buf as well as sigjmp_buf.
* sysdeps/unix/sysv/linux/aarch64/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/alpha/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/arm/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/hppa/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/i386/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/microblaze/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/jmp_buf-macros.h:
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/jmp_buf-macros.h:
Likewise.
* sysdeps/unix/sysv/linux/nios2/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/jmp_buf-macros.h:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/jmp_buf-macros.h:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/sh/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/jmp_buf-macros.h:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/jmp_buf-macros.h:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/jmp_buf-macros.h: Likewise.

6 years agoHandle more _FloatN, _FloatNx types in include/float.h.
Joseph Myers [Tue, 7 Nov 2017 23:47:53 +0000 (23:47 +0000)] 
Handle more _FloatN, _FloatNx types in include/float.h.

Continuing the preparation for additional _FloatN / _FloatNx type
support, this patch adds support in include/float.h.  This header
defines macros for _Float128 properties when using compilers before
GCC 7 that lack those macros in <float.h>.  For testing _Float32 /
_Float64 / _Float32x / _Float64x functions with older compilers, such
macros need to be defined for those types as well; for the older
compilers, those types will always be typedefs for another type, so
the definitions can be in terms of the macros for that other type.

Tested for x86_64.

* include/float.h
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32] (FLT32_MANT_DIG): New macro.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32] (FLT32_DECIMAL_DIG): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32] (FLT32_DIG): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32] (FLT32_MIN_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32] (FLT32_MIN_10_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32] (FLT32_MAX_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32] (FLT32_MAX_10_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32] (FLT32_MAX): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32] (FLT32_EPSILON): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32] (FLT32_MIN): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32] (FLT32_TRUE_MIN): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64] (FLT64_MANT_DIG): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64] (FLT64_DECIMAL_DIG): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64] (FLT64_DIG): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64] (FLT64_MIN_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64] (FLT64_MIN_10_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64] (FLT64_MAX_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64] (FLT64_MAX_10_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64] (FLT64_MAX): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64] (FLT64_EPSILON): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64] (FLT64_MIN): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64] (FLT64_TRUE_MIN): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32X] (FLT32X_MANT_DIG): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32X] (FLT32X_DECIMAL_DIG): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32X] (FLT32X_DIG): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32X] (FLT32X_MIN_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32X] (FLT32X_MIN_10_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32X] (FLT32X_MAX_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32X] (FLT32X_MAX_10_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32X] (FLT32X_MAX): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32X] (FLT32X_EPSILON): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32X] (FLT32X_MIN): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT32X] (FLT32X_TRUE_MIN): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64X] (FLT64X_MANT_DIG): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64X] (FLT64X_DECIMAL_DIG): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64X] (FLT64X_DIG): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64X] (FLT64X_MIN_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64X] (FLT64X_MIN_10_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64X] (FLT64X_MAX_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64X] (FLT64X_MAX_10_EXP): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64X] (FLT64X_MAX): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64X] (FLT64X_EPSILON): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64X] (FLT64X_MIN): Likewise.
[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
&& __HAVE_FLOAT64X] (FLT64X_TRUE_MIN): Likewise.

6 years agoHandle more _FloatN, _FloatNx types in type-generic strtod tests.
Joseph Myers [Tue, 7 Nov 2017 18:08:44 +0000 (18:08 +0000)] 
Handle more _FloatN, _FloatNx types in type-generic strtod tests.

Continuing the preparation for additional _FloatN / _FloatNx type
support, this patch adds support to type-generic strtod tests.
GEN_STRTOD_TEST_FOREACH and STRTOD_TEST_FOREACH are made to handle the
full set of such types.  tst-strtod-round-skeleton.c is updated for
those types it can handle without needing changes to the generator
(i.e. those types that have already-handled formats).

Tested for x86_64.

* stdlib/tst-strtod.h (F16): New macro.
(F32): Likewise.
(F64): Likewise.
(F32X): Likewise.
(F64X): Likewise.
(F128X): Likewise.
(IF_FLOAT16): Likewise.
(IF_FLOAT32): Likewise.
(IF_FLOAT64): Likewise.
(IF_FLOAT32X): Likewise.
(IF_FLOAT64X): Likewise.
(IF_FLOAT128X): Likewise.
(GEN_TEST_STRTOD_FOREACH): Conditionally call macros for _Float16,
_Float32, _Float64, _Float32x, _Float64x and _Float128x.
(STRTOD_TEST_FOREACH): Likewise.
* stdlib/tst-strtod-round-skeleton.c (CHOOSE_f32): New macro.
(CHOOSE_f64): Likewise.
(CHOOSE_f32x): Likewise.
(CHOOSE_f64x): Likewise.

6 years agoRemove traces of tst-typesizes
Andreas Schwab [Tue, 7 Nov 2017 15:04:56 +0000 (16:04 +0100)] 
Remove traces of tst-typesizes

6 years agomfe_MU, miq_NI locales: Escape slashes in d_fmt [BZ #22403]
Mike FABIAN [Tue, 7 Nov 2017 13:24:51 +0000 (14:24 +0100)] 
mfe_MU, miq_NI locales: Escape slashes in d_fmt [BZ #22403]

[BZ #22403]
* localedata/locales/mfe_MU (LC_TIME): Fix wrong d_fmt, / needs
to be escaped.
* localedata/locales/miq_NI (LC_TIME): Fix wrong d_fmt, / needs
to be escaped.

6 years agoan_ES, kab_DZ, om_ET locales: Escape slashes in d_fmt [BZ #22403]
Claude Paroz [Mon, 6 Nov 2017 13:14:28 +0000 (14:14 +0100)] 
an_ES, kab_DZ, om_ET locales: Escape slashes in d_fmt [BZ #22403]

[BZ #22403]
* localedata/locales/an_ES (LC_TIME): Fix wrong d_fmt, / needs
to be escaped.
* localedata/locales/kab_DZ (LC_TIME): Fix wrong d_fmt, / needs
to be escaped.
* localedata/locales/om_ET (LC_TIME): Fix wrong d_fmt, / needs
to be escaped.

6 years agonptl: Define __PTHREAD_MUTEX_{NUSERS_AFTER_KIND,USE_UNION}
Adhemerval Zanella [Thu, 19 Oct 2017 12:11:57 +0000 (10:11 -0200)] 
nptl: Define __PTHREAD_MUTEX_{NUSERS_AFTER_KIND,USE_UNION}

This patch adds two new internal defines to set the internal
pthread_mutex_t layout required by the supported ABIS:

  1. __PTHREAD_MUTEX_NUSERS_AFTER_KIND which control whether to define
     __nusers fields before or after __kind.  The preferred value for
     is 0 for new ports and it sets __nusers before __kind.

  2. __PTHREAD_MUTEX_USE_UNION which control whether internal __spins and
     __list members will be place inside an union for linuxthreads
     compatibility.  The preferred value is 0 for ports and it sets
     to not use an union to define both fields.

It fixes the wrong offsets value for __kind value on x86_64-linux-gnu-x32.
Checked with a make check run-built-tests=no on all afected ABIs.

[BZ #22298]
* nptl/allocatestack.c (allocate_stack): Check if
__PTHREAD_MUTEX_HAVE_PREV is non-zero, instead if
__PTHREAD_MUTEX_HAVE_PREV is defined.
* nptl/descr.h (pthread): Likewise.
* nptl/nptl-init.c (__pthread_initialize_minimal_internal):
Likewise.
* nptl/pthread_create.c (START_THREAD_DEFN): Likewise.
* sysdeps/nptl/fork.c (__libc_fork): Likewise.
* sysdeps/nptl/pthread.h (PTHREAD_MUTEX_INITIALIZER): Likewise.
* sysdeps/nptl/bits/thread-shared-types.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New
defines.
(__pthread_internal_list): Check __PTHREAD_MUTEX_USE_UNION instead
of __WORDSIZE for internal layout.
(__pthread_mutex_s): Check __PTHREAD_MUTEX_NUSERS_AFTER_KIND instead
of __WORDSIZE for internal __nusers layout and __PTHREAD_MUTEX_USE_UNION
instead of __WORDSIZE whether to use an union for __spins and __list
fields.
(__PTHREAD_MUTEX_HAVE_PREV): Define also for __PTHREAD_MUTEX_USE_UNION
case.
* sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New
defines.
* sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION):
Likewise.
* sysdeps/arm/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION):
Likewise.
* sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION):
Likewise.
* sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION):
Likewise.
* sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION):
Likewise.
* sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION):
Likewise.
* sysdeps/mips/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION):
Likewise.
* sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION):
Likewise.
* sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION):
Likewise.
* sysdeps/s390/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION):
Likewise.
* sysdeps/sh/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION):
Likewise.
* sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION):
Likewise.
* sysdeps/tile/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION):
Likewise.
* sysdeps/x86/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION):
Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agonptl: Change tst-typesizes to _Static_assert
Adhemerval Zanella [Mon, 16 Oct 2017 14:25:35 +0000 (12:25 -0200)] 
nptl: Change tst-typesizes to _Static_assert

Instead of rely on runtime check to assure correct pthread types
size a better strategy would use _Static_assert to trigger an error
on build time (and thus allowing to check to potentially ABI breakage
on cross-compiling make check).

This patch moves nptl/tst-typesizes.c to libpthread build time on
each specific initialization routine and also remove some runtime
redundant asserts for the same type sizes.

Checked on x86_64-linux-gnu and with a build check for all affected
ABIs (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf,
hppa-linux-gnu, i686-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu, mips64-linux-gnu, mips64-n32-linux-gnu,
mips-linux-gnu, powerpc64le-linux-gnu, powerpc-linux-gnu,
s390-linux-gnu, s390x-linux-gnu, sh4-linux-gnu, sparc64-linux-gnu,
sparcv9-linux-gnu, tilegx-linux-gnu, tilegx-linux-gnu-x32,
tilepro-linux-gnu, x86_64-linux-gnu, and x86_64-linux-x32).

* nptl/pthreadP.h (ASSERT_TYPE_SIZE, ASSERT_PTHREAD_INTERNAL_SIZE):
New macros.
* nptl/pthread_attr_init.c (__pthread_mutex_init): Add build time
checks for expected input type size.
* nptl/pthread_barrier_init.c (__pthread_barrier_init): Likewise.
* nptl/pthread_barrierattr_init.c (pthread_barrierattr_init):
Likewise.
* nptl/pthread_cond_init.c (__pthread_cond_init): Likewise.
* nptl/pthread_condattr_init.c (__pthread_condattr_init): Likewise.
* nptl/pthread_mutex_init.c (__pthread_mutex_init): Likewise.
* nptl/pthread_mutexattr_init.c (__pthread_mutexattr_init): Likewise.
* nptl/pthread_rwlock_init.c (__pthread_rwlock_init): Likewise.
* nptl/pthread_rwlockattr_init.c (pthread_rwlockattr_init): Likewise.
* nptl/sem_init.c (__new_sem_init, __old_sem_init): Likewise
* nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Remove
superflous runtime assert check.
* nptl/pthread_attr_getaffinity.c (__pthread_attr_getaffinity_new):
Likewise.
* nptl/pthread_attr_getdetachstate.c (__pthread_attr_getdetachstate):
Likewise.
* nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
Likewise.
* nptl/pthread_attr_getinheritsched.c (__pthread_attr_getinheritsched):
Likewise.
* nptl/pthread_attr_getschedparam.c (__pthread_attr_getschedparam):
Likewise.
* nptl/pthread_attr_getschedpolicy.c (__pthread_attr_getschedpolicy):
Likewise.
* nptl/pthread_attr_getscope.c (__pthread_attr_getscope): Likewise.
* nptl/pthread_attr_getstack.c (__pthread_attr_getstack): Likewise.
* nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
Likewise.
* nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
Likewise.
* nptl/pthread_attr_setaffinity.c (__pthread_attr_setaffinity_new):
Likewise.
* nptl/pthread_attr_setdetachstate.c (__pthread_attr_setdetachstate):
Likewise.
* nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
Likewise.
* nptl/pthread_attr_setinheritsched.c
(__pthread_attr_setinheritsched): Likewise.
* nptl/pthread_attr_setschedparam.c (__pthread_attr_setschedparam):
Likewise.
* nptl/pthread_attr_setschedpolicy.c (__pthread_attr_setschedpolicy):
Likewise.
* nptl/pthread_attr_setscope.c (__pthread_attr_setscope): Likewise.
* nptl/pthread_attr_setstack.c (__pthread_attr_setstack,
__old_pthread_attr_setstack): Likewise.
* nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
Likewise.
* nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
Likewise.
* nptl/pthread_getattr_default_np.c (pthread_getattr_default_np):
Likewise.
* nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
* nptl/pthread_setattr_default_np.c (pthread_setattr_default_np):
Likewise.
* nptl/tst-typesizes.c: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agonptl: Add tests for internal pthread_mutex_t offsets
Adhemerval Zanella [Mon, 16 Oct 2017 16:27:29 +0000 (14:27 -0200)] 
nptl: Add tests for internal pthread_mutex_t offsets

This patch adds a new build test to check for internal fields
offsets for user visible internal field.  Although currently
the only field which is statically initialized to a non zero value
is pthread_mutex_t.__data.__kind value, the tests also check the
offset of __kind, __spins, __elision (if supported), and __list
internal member.  A internal header (pthread-offset.h) is added
to each major ABI with the reference value.

Checked on x86_64-linux-gnu and with a build check for all affected
ABIs (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf,
hppa-linux-gnu, i686-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu, mips64-linux-gnu, mips64-n32-linux-gnu,
mips-linux-gnu, powerpc64le-linux-gnu, powerpc-linux-gnu,
s390-linux-gnu, s390x-linux-gnu, sh4-linux-gnu, sparc64-linux-gnu,
sparcv9-linux-gnu, tilegx-linux-gnu, tilegx-linux-gnu-x32,
tilepro-linux-gnu, x86_64-linux-gnu, and x86_64-linux-x32).

* nptl/pthreadP.h (ASSERT_PTHREAD_STRING,
ASSERT_PTHREAD_INTERNAL_OFFSET): New macro.
* nptl/pthread_mutex_init.c (__pthread_mutex_init): Add build time
checks for internal pthread_mutex_t offsets.
* sysdeps/aarch64/nptl/pthread-offsets.h
(__PTHREAD_MUTEX_NUSERS_OFFSET, __PTHREAD_MUTEX_KIND_OFFSET,
__PTHREAD_MUTEX_SPINS_OFFSET, __PTHREAD_MUTEX_ELISION_OFFSET,
__PTHREAD_MUTEX_LIST_OFFSET): New macro.
* sysdeps/alpha/nptl/pthread-offsets.h: Likewise.
* sysdeps/arm/nptl/pthread-offsets.h: Likewise.
* sysdeps/hppa/nptl/pthread-offsets.h: Likewise.
* sysdeps/i386/nptl/pthread-offsets.h: Likewise.
* sysdeps/ia64/nptl/pthread-offsets.h: Likewise.
* sysdeps/m68k/nptl/pthread-offsets.h: Likewise.
* sysdeps/microblaze/nptl/pthread-offsets.h: Likewise.
* sysdeps/mips/nptl/pthread-offsets.h: Likewise.
* sysdeps/nios2/nptl/pthread-offsets.h: Likewise.
* sysdeps/powerpc/nptl/pthread-offsets.h: Likewise.
* sysdeps/s390/nptl/pthread-offsets.h: Likewise.
* sysdeps/sh/nptl/pthread-offsets.h: Likewise.
* sysdeps/sparc/nptl/pthread-offsets.h: Likewise.
* sysdeps/tile/nptl/pthread-offsets.h: Likewise.
* sysdeps/x86_64/nptl/pthread-offsets.h: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agoMove <bits/mman-linux.h> to the Linux sysdeps directory
Florian Weimer [Tue, 7 Nov 2017 11:11:42 +0000 (12:11 +0100)] 
Move <bits/mman-linux.h> to the Linux sysdeps directory

The header file is no longer used on anything but Linux.

6 years agopowerpc: Use latest optimization for internal function calls
Rajalakshmi Srinivasaraghavan [Tue, 7 Nov 2017 04:37:48 +0000 (10:07 +0530)] 
powerpc: Use latest optimization for internal function calls

Update strcasestr-power8 to use power8 version of strnlen for
calculating length.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
6 years agoOptimize sighold implementation
Adhemerval Zanella [Wed, 1 Nov 2017 13:56:53 +0000 (11:56 -0200)] 
Optimize sighold implementation

This patch simplifies sighold a bit by removing an extra sigprocmask
and using SIG_BLOCK (which union of the current set and the set argument).

Checked on x86_64-linux-gnu.

* signal/sighold.c (sighold): Optimize implementation.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Zack Weinberg <zackw@panix.com>