aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-11-28Properly compute offsets of note descriptor and next note [BZ #22370]H.J. Lu5-16/+76
A note header has 3 4-bytes fields, followed by note name and note descriptor. According to gABI, in a note entry, the note name field, not note name size, is padded for the note descriptor. And the note descriptor field, not note descriptor size, is padded for the next note entry. Notes are aligned to 4 bytes in 32-bit objects and 8 bytes in 64-bit objects. For all GNU notes, the name is "GNU" which is 4 bytes. They have the same format in the first 16 bytes in both 32-bit and 64-bit objects. They differ by note descriptor size and note type. So far, .note.ABI-tag and .note.gnu.build-id notes are always aligned to 4 bytes. The exsting codes compute the note size by aligning the note name size and note descriptor size to 4 bytes. It happens to produce the same value as the actual note size by luck since the name size is 4 and offset of the note descriptor is 16. But it will produce the wrong size when note alignment is 8 bytes in 64-bit objects. This patch defines ELF_NOTE_DESC_OFFSET and ELF_NOTE_NEXT_OFFSET to properly compute offsets of note descriptor and next note. It uses alignment of PT_NOTE segment to support both 4-byte and 8-byte note alignments in 64-bit objects. To handle PT_NOTE segments with incorrect alignment, which may lead to an infinite loop, if segment alignment is less than 4, we treate alignment as 4 bytes since some note segments have 0 or 1 byte alignment. [BZ #22370] * elf/dl-hwcaps.c (ROUND): Removed. (_dl_important_hwcaps): Replace ROUND with ELF_NOTE_DESC_OFFSET and ELF_NOTE_NEXT_OFFSET. * elf/dl-load.c (ROUND): Removed. (open_verify): Replace ROUND with ELF_NOTE_NEXT_OFFSET. * elf/readelflib.c (ROUND): Removed. (process_elf_file): Replace ROUND with ELF_NOTE_NEXT_OFFSET. * include/elf.h [!_ISOMAC]: Include <libc-pointer-arith.h>. [!_ISOMAC] (ELF_NOTE_DESC_OFFSET): New. [!_ISOMAC] (ELF_NOTE_NEXT_OFFSET): Likewise.
2017-11-28Use libm_alias_float for s390.Joseph Myers2-1/+5
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.
2017-11-28Use libm_alias_double for s390.Joseph Myers3-11/+8
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.
2017-11-28Add the Changelog entry for “cs_CZ locale: Base collation on iso14651_t1 ↵Mike FABIAN1-0/+8
[BZ #22336]”
2017-11-28localedata: Remove duplicate cs_CZ from LOCALESSiddhesh Poyarekar2-1/+5
The LOCALES variable in the localedata had two instances of cs_CZ which generated the following warning: ../gen-locales.mk:11: target '/opt/build/localedata/cs_CZ.UTF-8/LC_CTYPE' given more than once in the same rule Dropped the duplicate entry.
2017-11-28benchtests: Enable BENCHSET to run subset of testsVictor Rodriguez3-20/+76
This patch adds BENCHSET variable to benchtests/Makefile in order to provide the capability to run a list of subsets of benchmark tests, ie; make bench BENCHSET="bench-pthread bench-math malloc-thread" This helps users to benchmark specific glibc area ChangeLog: * benchtests/Makefile:Add BENCHSET to allow subsets of benchmarks to be run. * benchtests/README: Add documentation for: Running subsets of benchmarks. Signed-off-by: Victor Rodriguez <victor.rodriguez.bahena@intel.com> Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com> Reviewed-By: Siddhesh Poyarekar <siddhesh@sourceware.org>
2017-11-28benchtests: Expand range of tests names in schema.jsonVictor Rodriguez2-1/+4
When executing bench-math the benchmark output is invalid with this error msg: Invalid benchmark output: 'workload-spec2006.wrf' does not match any of the regexes: '^[_a-zA-Z0-9]*$¹ or Invalid benchmark output: Additional properties are not allowed ('workload-spec2006.wrf' was unexpected) The error was seen when running the test: workload-spec2006.wrf, 'stack=1024,guard=1' and 'stack=1024,guard=2'. The problem is that the current regex's do not accept the hyphen, dot, equal and comma in the output. This patch changes the regex in benchout.schema.json to accept symbols in benchmark tests names. ChangeLog: * benchtests/scripts/benchout.schema.json: Fix regex to accept a wider range of tests names. Signed-off-by: Victor Rodriguez <victor.rodriguez.bahena@intel.com> Reviewed-By: Siddhesh Poyarekar <siddhesh@sourceware.org>
2017-11-28benchtests: Adjust valid and accepted propertiesVictor Rodriguez2-1/+8
Benchmark workload-spec2006.wrf does not produce max, min or mean results but instead produce throughput. This is represented in benchtests/bench-skeleton.c. This patch adjust benchout.schema.json to consider bench.out from bench-math benchmarks as valid ChangeLog: * benchtests/scripts/benchout.schema.json: Add throughput as accepted result from property and remove "max", min" and "mean" from required properties based on benchtests/bench-skeleton.c. Signed-off-by: Victor Rodriguez <victor.rodriguez.bahena@intel.com> Reviewed-By: Siddhesh Poyarekar <siddhesh@sourceware.org>
2017-11-28posix: Make tst-getaddrinfo[45] xtests due to DNS dependency [BZ #20826]Florian Weimer2-3/+12
These tests need a working Internet connection with DNS. We have additional coverage of getaddrinfo through the resolv tests, so the loss of default test coverage seems acceptable.
2017-11-28sparc: Implement memset/bzero ifunc selection in CAdhemerval Zanella12-130/+179
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>
2017-11-28sparc: Implement memcpy/mempcpy ifunc selection in CAdhemerval Zanella13-173/+216
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>
2017-11-28cs_CZ locale: Base collation on iso14651_t1 [BZ #22336]Mike FABIAN3-2162/+286
[BZ #22336] * localedata/locales/cs_CZ (LC_COLLATE): Use “copy "iso14651_t1"” and implement the collation rules for cs from CLDR on top of that. * Makefile: Add cs_CZ.UTF-8 to test-input and to the list of locales to be built for testing. * cs_CZ.UTF-8.in: New file with test data to test the Czech sorting. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2017-11-28Use libm_alias_float for alpha.Joseph Myers35-38/+102
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.
2017-11-28Use libm_alias_float for aarch64.Joseph Myers14-13/+54
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.
2017-11-28Use libm_alias_double for alpha.Joseph Myers11-90/+46
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.
2017-11-28Support ldbl-opt libm_alias_double use from .S files.Joseph Myers2-1/+6
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.
2017-11-27Use libm_alias_double for aarch64.Joseph Myers14-13/+55
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.
2017-11-27Implement the mlock2 functionFlorian Weimer37-5/+194
Fallback using mlock is provided if the flags argument is zero. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-27Add _Float64x function aliases.Joseph Myers44-18/+1571
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.
2017-11-27Consolidate link map sortingAndreas Schwab8-215/+153
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.
2017-11-24Use libm_alias_float128 more in sysdeps/ieee754/float128.Joseph Myers7-6/+19
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.
2017-11-24Use -mfloat128 for _Float64x tests for powerpc64le.Joseph Myers2-1/+15
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.
2017-11-24Support _Float64x in libm_alias macros.Joseph Myers4-15/+61
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.
2017-11-24Support strfromf64x alias.Joseph Myers3-2/+35
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.
2017-11-24Support strtof64x, wcstof64x aliases.Joseph Myers7-0/+126
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].
2017-11-24Support testing _Float64x libm functions.Joseph Myers3-1/+53
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)).
2017-11-24Make min_of_type_ macros function-like.Joseph Myers2-6/+16
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.
2017-11-24Define __STDC_WANT_IEC_60559_TYPES_EXT__ in tst-strtod-round-skeleton.c.Joseph Myers2-0/+5
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.
2017-11-24Fix gen-tgmath-tests.py for _Float64, _Float64x testing.Joseph Myers2-2/+5
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.
2017-11-24Handle more _FloatN, _FloatNx types in bits/libm-simd-decl-stubs.h.Joseph Myers2-0/+73
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.
2017-11-24Move wcstof128 symbol versions to wcsmbs/Versions.Joseph Myers3-2/+14
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>.
2017-11-24Linux: Introduce <bits/mman-shared.h>Florian Weimer5-16/+56
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>
2017-11-24posix: Fix generic p{read,write}v buffer allocation (BZ#22457)Adhemerval Zanella3-6/+17
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.
2017-11-24pl_PL locale: Base collation on iso14651_t1Mike FABIAN4-2062/+231
[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.
2017-11-23Use libm_alias_ldouble macros in sysdeps/ia64/fpu.Joseph Myers48-4/+115
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.
2017-11-23malloc: Call tcache destructor in arena_thread_freeresFlorian Weimer3-7/+29
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>
2017-11-23nss: Export nscd hash function as __nss_hash [BZ #22459]Florian Weimer12-107/+128
2017-11-23sigwait: Do not fail with EINTR and return error code [BZ #22478]Florian Weimer4-4/+104
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>
2017-11-23Linux: Add memfd_create system call wrapperFlorian Weimer36-1/+249
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>
2017-11-22Fix typo in variable name in gen-locale.sh.Joseph Myers2-1/+3
* localedata/gen-locale.sh: Fix typo in variable name.
2017-11-22Obsolete p_secstodate.Joseph Myers8-15/+55
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.
2017-11-22Fix p_secstodate overflow handling (bug 22463).Joseph Myers4-1/+104
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.
2017-11-22Remove unused sparc64/soft-fp libm function implementations.Joseph Myers4-155/+6
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.
2017-11-22* posix/regcomp.c (init_word_char): Add comments.Paul Eggert2-0/+7
2017-11-22Avoid use of strlen in getlogin_r (bug 22447).Joseph Myers2-2/+10
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.
2017-11-22lv_LV locale: fix collation [BZ #15537]Mike FABIAN4-2061/+166
[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>
2017-11-21Update hppa bits/mman.h from Linux 4.14.Joseph Myers2-3/+11
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.
2017-11-21nptl: Add workaround for ASSERT_PTHREAD_INTERNAL_SIZE with GCC 4.9Adhemerval Zanella2-1/+6
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>
2017-11-21S390: Add cfi information for start routines in order to stop unwinding.Stefan Liebler7-16/+39
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.
2017-11-21Remove attribute_hidden for wchar ifunc symbols.Stefan Liebler2-7/+10
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.