about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* Use libm_alias_float for s390.Joseph Myers2017-11-281-1/+2
| | | | | | | | | | | | | Continuing the preparation for additional _FloatN / _FloatNx function aliases, this patch makes an s390 libm function implementation use libm_alias_float to define function aliases. Tested with build-many-glibcs.py for s390-linux-gnu and s390x-linux-gnu that installed stripped shared libraries are unchanged by the patch. * sysdeps/s390/fpu/s_fmaf.c: Include <libm-alias-float.h>. [!__fmaf] (fmaf): Define using libm_alias_float.
* Use libm_alias_double for s390.Joseph Myers2017-11-282-11/+2
| | | | | | | | | | | | | | | | | Continuing the preparation for additional _FloatN / _FloatNx function aliases, this patch makes s390 libm function implementations use libm_alias_double to define function aliases. This allows sysdeps/unix/sysv/linux/s390/fpu/s_fma.c to be removed, as libm_alias_double handles symbol versioning for long double compat symbols. Tested with build-many-glibcs.py for s390-linux-gnu and s390x-linux-gnu that installed stripped shared libraries are unchanged by the patch. * sysdeps/s390/fpu/s_fma.c: Include <libm-alias-double.h>. [!__fma] (fma): Define using libm_alias_double. * sysdeps/unix/sysv/linux/s390/fpu/s_fma.c: Remove.
* sparc: Implement memset/bzero ifunc selection in CAdhemerval Zanella2017-11-2811-130/+164
| | | | | | | | | | | | | | | | | | | | | | | | This patch refactor the SPARC64 ifunc selector to a C implementation. No functional change is expected, including ifunc resolution rules. Checked on sparc64-linux-gnu, sparcv9-linux-gnu and x86_64-linux-gnu. * sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile [$(subdir) = string] (sysdep_routines): Add memset-ultra1. * sysdeps/sparc/sparc64/multiarch/Makefile [$(subdir) = string] (sysdep_routines): Add memset-ultra1. * sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/memset.c: Likewise. * sysdeps/sparc/sparc32/sparcv9/multiarch/bzero.c: Likewise. * sysdeps/sparc/sparc64/multiarch/ifunc-memset.h: Likewise. * sysdeps/sparc/sparc64/multiarch/memset-ultra1.S: Likewise. * sysdeps/sparc/sparc64/multiarch/memset.c: Likewise. * sysdeps/sparc/sparc64/multiarch/bzero.c: Likewise. * sysdeps/sparc/sparc32/sparcv9/multiarch/memset.S: Remove file. * sysdeps/sparc/sparc64/multiarch/memset.S: Likewise. Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sparc: Implement memcpy/mempcpy ifunc selection in CAdhemerval Zanella2017-11-2812-173/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch refactor the SPARC64 ifunc selector to a C implementation. The x86_64 implementation is used as default, which resulted in common definitions (ifunc-init.h) used on both architectures. No functional change is expected, including ifunc resolution rules. Checked on sparc64-linux-gnu, sparcv9-linux-gnu and x86_64-linux-gnu. * sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-ultra1.S: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.c: Likewise. * sysdeps/sparc/sparc32/sparcv9/multiarch/mempcpy.c: Likewise. * sysdeps/sparc/sparc64/multiarch/ifunc-memcpy.h: Likewise. * sysdeps/sparc/sparc64/multiarch/memcpy-ultra1.S: Likewise. * sysdeps/sparc/sparc64/multiarch/memcpy.c: Likewise. * sysdeps/sparc/sparc64/multiarch/mempcpy.c: Likewise. * sysdeps/sparc/sparc-ifunc.h (sparc_libc_ifunc_redirected): New macro. * sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile [$(subdir) = string] (sysdep_routines): Add memcpy-ultra1. * sysdeps/sparc/sparc64/multiarch/Makefile [$(subdir) = string] (sysdep_routines): Add memcpy-ultra1. * sysdeps/sparc/sparc64/multiarch/memcpy.S: Remove file. * sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.S: Likewise. Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Use libm_alias_float for alpha.Joseph Myers2017-11-2834-38/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the preparation for additional _FloatN / _FloatNx function aliases, this patch makes alpha libm function implementations use libm_alias_float macros to define function aliases. In the case of the ABI compatibility for complex functions, libm_alias_float_other is used, with the cfloat_versions macro adjusted to take a function name argument without the trailing 'f' to facilitate this, and cfloat_versions dealing with calling libm_alias_float_other (except for clog10f, which doesn't use that macro because of the complexity associated with __clog10f also being exported). Tested with build-many-glibcs.py for alpha-linux-gnu that installed stripped shared libraries are unchanged by the patch. * sysdeps/alpha/fpu/cfloat-compat.h: Include <libm-alias-float.h>. (cfloat_versions): Take function argument without trailing 'f'. Call libm_alias_float_other. * sysdeps/alpha/fpu/cabsf.c: Update call to cfloat_versions. * sysdeps/alpha/fpu/cargf.c: Likewise. * sysdeps/alpha/fpu/cimagf.c: Likewise. * sysdeps/alpha/fpu/conjf.c: Likewise. * sysdeps/alpha/fpu/crealf.c: Likewise. * sysdeps/alpha/fpu/s_cacosf.c: Likewise. * sysdeps/alpha/fpu/s_cacoshf.c: Likewise. * sysdeps/alpha/fpu/s_casinf.c: Likewise. * sysdeps/alpha/fpu/s_casinhf.c: Likewise. * sysdeps/alpha/fpu/s_catanf.c: Likewise. * sysdeps/alpha/fpu/s_catanhf.c: Likewise. * sysdeps/alpha/fpu/s_ccosf.c: Likewise. * sysdeps/alpha/fpu/s_ccoshf.c: Likewise. * sysdeps/alpha/fpu/s_cexpf.c: Likewise. * sysdeps/alpha/fpu/s_clogf.c: Likewise. * sysdeps/alpha/fpu/s_cpowf.c: Likewise. * sysdeps/alpha/fpu/s_cprojf.c: Likewise. * sysdeps/alpha/fpu/s_csinf.c: Likewise. * sysdeps/alpha/fpu/s_csinhf.c: Likewise. * sysdeps/alpha/fpu/s_csqrtf.c: Likewise. * sysdeps/alpha/fpu/s_ctanf.c: Likewise. * sysdeps/alpha/fpu/s_ctanhf.c: Likewise. * sysdeps/alpha/fpu/s_clog10f.c: Include <libm-alias-float.h>. (clog10f): Use libm_alias_float_other. * sysdeps/alpha/fpu/s_ceilf.c: Include <libm-alias-float.h>. (ceilf): Define using libm_alias_float. * sysdeps/alpha/fpu/s_copysignf.c: Include <libm-alias-float.h>. (copysignf): Define using libm_alias_float. * sysdeps/alpha/fpu/s_fabsf.c: Include <libm-alias-float.h>. (fabsf): Define using libm_alias_float. * sysdeps/alpha/fpu/s_floorf.c: Include <libm-alias-float.h>. (floorf): Define using libm_alias_float. * sysdeps/alpha/fpu/s_fmax.S: Include <libm-alias-float.h>. (fmaxf): Define using libm_alias_float. * sysdeps/alpha/fpu/s_fmin.S: Include <libm-alias-float.h>. (fminf): Define using libm_alias_float. * sysdeps/alpha/fpu/s_lrintf.c: Include <libm-alias-float.h>. (lrintf): Define using libm_alias_float. (llrintf): Likewise. * sysdeps/alpha/fpu/s_lroundf.c: Include <libm-alias-float.h>. (lroundf): Define using libm_alias_float. (llroundf): Likewise. * sysdeps/alpha/fpu/s_rintf.c: Include <libm-alias-float.h>. (rintf): Define using libm_alias_float. * sysdeps/alpha/fpu/s_truncf.c: Include <libm-alias-float.h>. (truncf): Define using libm_alias_float.
* Use libm_alias_float for aarch64.Joseph Myers2017-11-2813-13/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the preparation for additional _FloatN / _FloatNx function aliases, this patch makes aarch64 libm function implementations use libm_alias_float to define function aliases. Tested with build-many-glibcs.py for aarch64-linux-gnu that installed stripped shared libraries are unchanged by the patch. * sysdeps/aarch64/fpu/s_ceilf.c: Include <libm-alias-float.h>. (ceilf): Define using libm_alias_float. * sysdeps/aarch64/fpu/s_floorf.c: Include <libm-alias-float.h>. (floorf): Define using libm_alias_float. * sysdeps/aarch64/fpu/s_fmaf.c: Include <libm-alias-float.h>. (fmaf): Define using libm_alias_float. * sysdeps/aarch64/fpu/s_fmaxf.c: Include <libm-alias-float.h>. (fmaxf): Define using libm_alias_float. * sysdeps/aarch64/fpu/s_fminf.c: Include <libm-alias-float.h>. (fminf): Define using libm_alias_float. * sysdeps/aarch64/fpu/s_llrintf.c: Include <libm-alias-float.h>. (llrintf): Define using libm_alias_float. * sysdeps/aarch64/fpu/s_llroundf.c: Include <libm-alias-float.h>. (llroundf): Define using libm_alias_float. * sysdeps/aarch64/fpu/s_lrintf.c: Include <libm-alias-float.h>. (lrintf): Define using libm_alias_float. * sysdeps/aarch64/fpu/s_lroundf.c: Include <libm-alias-float.h>. (lroundf): Define using libm_alias_float. * sysdeps/aarch64/fpu/s_nearbyintf.c: Include <libm-alias-float.h>. (nearbyintf): Define using libm_alias_float. * sysdeps/aarch64/fpu/s_rintf.c: Include <libm-alias-float.h>. (rintf): Define using libm_alias_float. * sysdeps/aarch64/fpu/s_roundf.c: Include <libm-alias-float.h>. (roundf): Define using libm_alias_float. * sysdeps/aarch64/fpu/s_truncf.c: Include <libm-alias-float.h>. (truncf): Define using libm_alias_float.
* Use libm_alias_double for alpha.Joseph Myers2017-11-2810-90/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the preparation for additional _FloatN / _FloatNx function aliases, this patch makes alpha libm function implementations use libm_alias_double to define function aliases. This also simplifies the code because the compatibility for long double = double is handled by libm_alias_double instead of locally in each source file. Tested with build-many-glibcs.py for alpha-linux-gnu that installed stripped shared libraries are unchanged by the patch. * sysdeps/alpha/fpu/s_ceil.c: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/alpha/fpu/s_copysign.c: Include <libm-alias-double.h>. (copysign): Define using libm_alias_double. * sysdeps/alpha/fpu/s_fabs.c: Include <libm-alias-double.h>. (fabs): Define using libm_alias_double. * sysdeps/alpha/fpu/s_floor.c: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/alpha/fpu/s_fmax.S: Include <libm-alias-double.h>. (fmax): Define using libm_alias_double. * sysdeps/alpha/fpu/s_fmin.S: Include <libm-alias-double.h>. (fmin): Define using libm_alias_double. * sysdeps/alpha/fpu/s_lrint.c: Include <libm-alias-double.h>. (lrint): Define using libm_alias_double. (llrint): Likewise. * sysdeps/alpha/fpu/s_lround.c: Include <libm-alias-double.h>. (lround): Define using libm_alias_double. (llround): Likewise. * sysdeps/alpha/fpu/s_rint.c: Include <libm-alias-double.h>. (rint): Define using libm_alias_double. * sysdeps/alpha/fpu/s_trunc.c: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double.
* Support ldbl-opt libm_alias_double use from .S files.Joseph Myers2017-11-281-1/+1
| | | | | | | | | | | | | This patch makes the ldbl-opt libm_alias_double implementation support use from .S sources, by adding a semicolon after its use of weak_alias. Tested (compilation only) with build-many-glibcs.py for alpha-linux-gnu, in conjunction with a patch introducing uses of libm_alias_double in alpha .S files. * sysdeps/ieee754/ldbl-opt/libm-alias-double.h (libm_alias_double_r): Add semicolon after weak_alias call.
* Use libm_alias_double for aarch64.Joseph Myers2017-11-2713-13/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the preparation for additional _FloatN / _FloatNx function aliases, this patch makes aarch64 libm function implementations use libm_alias_double to define function aliases. Tested with build-many-glibcs.py for aarch64-linux-gnu that installed stripped shared libraries are unchanged by the patch. * sysdeps/aarch64/fpu/s_ceil.c: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/aarch64/fpu/s_floor.c: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/aarch64/fpu/s_fma.c: Include <libm-alias-double.h>. (fma): Define using libm_alias_double. * sysdeps/aarch64/fpu/s_fmax.c: Include <libm-alias-double.h>. (fmax): Define using libm_alias_double. * sysdeps/aarch64/fpu/s_fmin.c: Include <libm-alias-double.h>. (fmin): Define using libm_alias_double. * sysdeps/aarch64/fpu/s_llrint.c: Include <libm-alias-double.h>. (llrint): Define using libm_alias_double. * sysdeps/aarch64/fpu/s_llround.c: Include <libm-alias-double.h>. (llround): Define using libm_alias_double. * sysdeps/aarch64/fpu/s_lrint.c: Include <libm-alias-double.h>. (lrint): Define using libm_alias_double. * sysdeps/aarch64/fpu/s_lround.c: Include <libm-alias-double.h>. (lround): Define using libm_alias_double. * sysdeps/aarch64/fpu/s_nearbyint.c: Include <libm-alias-double.h>. (nearbyint): Define using libm_alias_double. * sysdeps/aarch64/fpu/s_rint.c: Include <libm-alias-double.h>. (rint): Define using libm_alias_double. * sysdeps/aarch64/fpu/s_round.c: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/aarch64/fpu/s_trunc.c: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double.
* Implement the mlock2 functionFlorian Weimer2017-11-2734-2/+150
| | | | | | Fallback using mlock is provided if the flags argument is zero. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add _Float64x function aliases.Joseph Myers2017-11-2736-8/+1381
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Consolidate link map sortingAndreas Schwab2017-11-271-2/+2
| | | | | | 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.
* Use libm_alias_float128 more in sysdeps/ieee754/float128.Joseph Myers2017-11-246-6/+6
| | | | | | | | | | | | | | | | | | | | | | 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.
* Use -mfloat128 for _Float64x tests for powerpc64le.Joseph Myers2017-11-241-1/+5
| | | | | | | | | | | | | | | | | | | 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.
* Support _Float64x in libm_alias macros.Joseph Myers2017-11-243-15/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Support strfromf64x alias.Joseph Myers2017-11-241-1/+12
| | | | | | | | | | | | | | | | | | | | | 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.
* Support strtof64x, wcstof64x aliases.Joseph Myers2017-11-245-0/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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].
* Make min_of_type_ macros function-like.Joseph Myers2017-11-241-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Linux: Introduce <bits/mman-shared.h>Florian Weimer2017-11-244-16/+43
| | | | | | | | 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>
* posix: Fix generic p{read,write}v buffer allocation (BZ#22457)Adhemerval Zanella2017-11-242-6/+10
| | | | | | | | | | | | | | | | | 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.
* Use libm_alias_ldouble macros in sysdeps/ia64/fpu.Joseph Myers2017-11-2347-4/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* sigwait: Do not fail with EINTR and return error code [BZ #22478]Florian Weimer2017-11-231-2/+9
| | | | | | | | | | | | | | | | | | | 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>
* Linux: Add memfd_create system call wrapperFlorian Weimer2017-11-2333-1/+170
| | | | | | | | | | | | | | 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>
* Remove unused sparc64/soft-fp libm function implementations.Joseph Myers2017-11-223-155/+0
| | | | | | | | | | | | | | 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.
* Avoid use of strlen in getlogin_r (bug 22447).Joseph Myers2017-11-221-2/+3
| | | | | | | | | | | | | | | | | | 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.
* Update hppa bits/mman.h from Linux 4.14.Joseph Myers2017-11-211-3/+2
| | | | | | | | | | | | | | | | 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.
* S390: Add cfi information for start routines in order to stop unwinding.Stefan Liebler2017-11-216-16/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* aarch64: Optimized memset for falkorSiddhesh Poyarekar2017-11-2011-22/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* tst-ttyname: Fix namespace setup for FedoraFlorian Weimer2017-11-181-61/+6
| | | | | | | | | | | | | | | | 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>
* powerpc: Update AT_HWCAP2 bitsTulio Magno Quites Machado Filho2017-11-172-2/+4
| | | | | | | | | | | | | 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>
* Use libm_alias_ldouble in sysdeps/x86_64/fpu.Joseph Myers2017-11-1711-12/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Use libm_alias_ldouble in sysdeps/i386/fpu.Joseph Myers2017-11-1721-21/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Support bits/floatn.h inclusion from .S files.Joseph Myers2017-11-175-126/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add AArch64 HWCAP_DCPOP from Linux 4.14.Joseph Myers2017-11-171-0/+1
| | | | | | | | | | 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.
* aarch64: Fix f{max,min}{f} build for GCC 4.9 and 5Adhemerval Zanella2017-11-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Add Linux 4.14 ARPHRD_RAWIP to net/if_arp.h.Joseph Myers2017-11-161-0/+1
| | | | | | | | | 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.
* Update kernel version in syscall-names.list to 4.14.Joseph Myers2017-11-161-2/+2
| | | | | | | | | | | | 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.
* Prefer https for Sourceware linksSiddhesh Poyarekar2017-11-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* The -Wstringop-truncation option new in GCC 8 detects common misusesMartin Sebor2017-11-152-6/+12
| | | | | | | | | | | | | | | 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.
* linux ttyname{_r}: Add testsLuke Shumaker2017-11-152-1/+627
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* linux ttyname{_r}: Don't bail prematurely [BZ #22145]Luke Shumaker2017-11-152-15/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* linux ttyname{_r}: Make tty checks consistentLuke Shumaker2017-11-153-64/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* linux ttyname: Change return type of is_pty from int to boolLuke Shumaker2017-11-151-1/+2
| | | | | | | 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>
* linux ttyname: Update a reference to kernel docs for kernel 4.10Luke Shumaker2017-11-151-1/+2
| | | | | | | | | | 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>
* Add MSG_ZEROCOPY from Linux 4.14 to bits/socket.h.Joseph Myers2017-11-151-0/+2
| | | | | | | | | | 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.
* Add MADV_WIPEONFORK, MADV_KEEPONFORK from Linux 4.14.Joseph Myers2017-11-152-0/+4
| | | | | | | | | | | | | | | | 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.
* Cleanup sigpause implementationAdhemerval Zanella2017-11-151-20/+6
| | | | | | | | | | | | | | 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>
* Check length of ifname before copying it into to ifreq structure.Steve Ellcey2017-11-151-0/+6
| | | | | | [BZ #22442] * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): Check if ifname is too long.
* linux: Include <sysdep-cancel.h> for epoll_waitLuke Shumaker2017-11-151-0/+2
| | | | | | | | | | | | | 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>
* ld.so: Add architecture specific fieldsH.J. Lu2017-11-133-4/+9
| | | | | | | | | | | | | | | | | | | | | | 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.