about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* Use libm_alias_double in math/.Joseph Myers2017-09-1522-103/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch converts libm function implementations in math/ from using weak_alias to using libm_alias_double to define public function names, in cases where it would be appropriate to define _Float64 / _Float32x aliases for those functions as well. This eliminates many NO_LONG_DOUBLE conditionals and ldbl-opt wrappers round these function implementations. Tested for x86_64. Also tested with build-many-glibcs.py. Binary differences seen are that the different order in which remainder and drem symbols get defined as a result of this patch (the same source file defines the same aliases, but in a different order of definition) changes the order of symbols in the final libm.so when long double = double, and for ldbl-opt configurations, the compat symbols for Bessel functions were previously defined by e.g. "compat_symbol (libm, j0, j0l, GLIBC_2_0)", which declares j0l as a compat symbol based on j0 and so makes j0l weak because j0 is weak, and are now defined (indirectly via the relevant macros) based on e.g. __j0, so are no longer weak because __j0 isn't weak. * math/s_fma.c: Include <libm-alias-double.h>. (fma): Define using libm_alias_double. * math/s_nextafter.c: Include <libm-alias-double.h>. (nextafter): Define using libm_alias_double. * math/w_acos_compat.c: Include <libm-alias-double.h>. (acos): Define using libm_alias_double. * math/w_acosh_compat.c: Include <libm-alias-double.h>. (aocsh): Define using libm_alias_double. * math/w_asin_compat.c: Include <libm-alias-double.h>. (asin): Define using libm_alias_double. * math/w_atan2_compat.c: Include <libm-alias-double.h>. (atan2): Define using libm_alias_double. * math/w_atanh_compat.c: Include <libm-alias-double.h>. (atanh): Define using libm_alias_double. * math/w_cosh_compat.c: Include <libm-alias-double.h>. (cosh): Define using libm_alias_double. * math/w_exp10_compat.c: Include <libm-alias-double.h>. (exp10): Define using libm_alias_double. * math/w_exp2_compat.c: Include <libm-alias-double.h>. (exp2): Define using libm_alias_double. * math/w_exp_compat.c: Include <libm-alias-double.h>. (exp): Define using libm_alias_double. * math/w_fmod_compat.c: Include <libm-alias-double.h>. (fmod): Define using libm_alias_double. * math/w_hypot_compat.c: Include <libm-alias-double.h>. (hypot): Define using libm_alias_double. * math/w_j0_compat.c: Include <libm-alias-double.h>. (j0): Define using libm_alias_double. (y0): Likewise. * math/w_j1_compat.c: Include <libm-alias-double.h>. (j1): Define using libm_alias_double. (y1): Likewise. * math/w_jn_compat.c: Include <libm-alias-double.h>. (jn): Define using libm_alias_double. (yn): Likewise. * math/w_log10_compat.c: Include <libm-alias-double.h>. (log10): Define using libm_alias_double. * math/w_log2_compat.c: Include <libm-alias-double.h>. (log2): Define using libm_alias_double. * math/w_log_compat.c: Include <libm-alias-double.h>. (log): Define using libm_alias_double. * math/w_pow_compat.c: Include <libm-alias-double.h>. (pow): Define using libm_alias_double. * math/w_remainder_compat.c: Include <libm-alias-double.h>. (remainder): Define using libm_alias_double. * math/w_sinh_compat.c: Include <libm-alias-double.h>. (sinh): Define using libm_alias_double. * math/w_sqrt_compat.c: Include <libm-alias-double.h>. (sqrt): Define using libm_alias_double. * math/w_tgamma_compat.c: Include <libm-alias-double.h>. (tgamma): Define using libm_alias_double. * sysdeps/ieee754/ldbl-opt/s_nextafter.c [LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (nextafterl): Do not define compat symbol here. * sysdeps/ieee754/ldbl-opt/w_exp10_compat.c [LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)] (exp10l): Likewise. * sysdeps/ieee754/ldbl-opt/w_remainder_compat.c [LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (remainderl): Likewise. * sysdeps/ieee754/ldbl-opt/w_acos_compat.c: Remove. * sysdeps/ieee754/ldbl-opt/w_acosh_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_asin_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_atan2_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_atanh_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_cosh_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_exp_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_fmod_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_hypot_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_j0_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_j1_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_jn_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log10_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log2_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_pow_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_sinh_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_sqrt_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_tgamma_compat.c: Likewise.
* [BZ #21745] powerpc: build some IFUNC math functions for libc and libmTulio Magno Quites Machado Filho2017-09-152-17/+22
| | | | | | | | | | | | | | | | | | | | | | | Some math functions have to be distributed in libc because they're required by printf. libc and libm require their own builds of these functions, e.g. libc functions have to call __stack_chk_fail_local in order to bypass the PLT, while libm functions have to call __stack_chk_fail. While math/Makefile treat the generic cases, i.e. s_isinff, the multiarch Makefile has to treat its own files, i.e. s_isinff-ppc64. [BZ #21745] * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile: [$(subdir) = math] (sysdep_calls): New variable. Has the previous contents of sysdep_routines, but re-sorted.. [$(subdir) = math] (sysdep_routines): Re-use the contents from sysdep_calls. [$(subdir) = math] (libm-sysdep_routines): Remove the functions defined in sysdep_calls and replace by the respective m_* names. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S: (compat_symbol): Undefine to avoid duplicated compat symbols in libc.
* Make more libm functions into weak aliases.Joseph Myers2017-09-1461-78/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many libm functions define the function as __<func> and then define <func> as a weak alias. This is not at all limited to cases where there is an internal call that has namespace reasons to need to call __<func> instead of <func>. The common macros for creating libm function aliases work on the basis of public function names all being aliases; that is, they define aliases for functions using the above pattern. Thus, where a function just defines the public name <func> directly, changing that to be a weak alias enables a subsequent conversion to the common macros to retain the exact existing symbols (and so be testable by comparison of stripped binaries). This patch converts many existing functions to use the weak alias pattern, as preparation for subsequent conversions to common macros. I do expect that _FloatN/_FloatNx function aliases will end up needing new variants of the common macros that do *not* create the original float / double / long double name of a function - for cases where that name is created specially to give it a particular symbol version, for example - but for functions that can use the most common macros to create all the public names as aliases, it makes sense for them to do so. Regarding the Bessel function wrappers in this patch: only float and double wrappers are changed because the long double wrappers already used the weak alias pattern. Tested for x86_64, and with build-many-glibcs.py. * include/math.h (roundeven): Change hidden_proto call to __roundeven. * math/w_j0_compat.c (j0): Rename to __j0 and define as weak alias. [NO_LONG_DOUBLE] (__j0l): New strong alias. (y0): Rename to __y0 and define as weak alias. [NO_LONG_DOUBLE] (__y0l): New strong alias. * math/w_j0f_compat.c (j0f): Rename to __j0f and define as weak alias. (y0f): Rename to __y0f and define as weak alias. * math/w_j1_compat.c (j1): Rename to __j1 and define as weak alias. [NO_LONG_DOUBLE] (__j1l): New strong alias. (y1): Rename to __y1 and define as weak alias. [NO_LONG_DOUBLE] (__y1l): New strong alias. * math/w_j1f_compat.c (j1f): Rename to __j1f and define as weak alias. (y1f): Rename to __y1f and define as weak alias. * math/w_jn_compat.c (jn): Rename to __jn and define as weak alias. [NO_LONG_DOUBLE] (__jnl): New strong alias. (yn): Rename to __yn and define as weak alias. [NO_LONG_DOUBLE] (__ynl): New strong alias. * math/w_jnf_compat.c (jnf): Rename to __jnf and define as weak alias. (ynf): Rename to __ynf and define as weak alias. * sysdeps/ieee754/dbl-64/s_fromfp.c (FUNC): Define to __fromfp. (fromfp): Define as weak alias. [NO_LONG_DOUBLE] (__fromfpl): New strong alias. * sysdeps/ieee754/dbl-64/s_fromfpx.c (FUNC): Define to __fromfpx. (fromfpx): Define as weak alias. [NO_LONG_DOUBLE] (__fromfpxl): New strong alias. * sysdeps/ieee754/dbl-64/s_getpayload.c (getpayload): Rename to __getpayload and define as weak alias. [NO_LONG_DOUBLE] (__getpayloadl): New strong alias. * sysdeps/ieee754/dbl-64/s_roundeven.c (roundeven): Rename to __roundeven and define as weak alias. [NO_LONG_DOUBLE] (__roundevenl): New strong alias. * sysdeps/ieee754/dbl-64/s_setpayload.c (FUNC): Define to __setpayload. (setpayload): Define as weak alias. [NO_LONG_DOUBLE] (__setpayloadl): New strong alias. * sysdeps/ieee754/dbl-64/s_setpayloadsig.c (FUNC): Define to __setpayloadsig. (setpayloadsig): Define as weak alias. [NO_LONG_DOUBLE] (__setpayloadsigl): New strong alias. * sysdeps/ieee754/dbl-64/s_totalorder.c (totalorder): Rename to __totalorder and define as weak alias. [NO_LONG_DOUBLE] (__totalorderl): New strong alias. * sysdeps/ieee754/dbl-64/s_totalordermag.c (totalordermag): Rename to __totalordermag and define as weak alias. [NO_LONG_DOUBLE] (__totalordermagl): New strong alias. * sysdeps/ieee754/dbl-64/s_ufromfp.c (FUNC): Define to __ufromfp. (ufromfp): Define as weak alias. [NO_LONG_DOUBLE] (__ufromfpl): New strong alias. * sysdeps/ieee754/dbl-64/s_ufromfpx.c (FUNC): Define to __ufromfpx. (ufromfpx): Define as weak alias. [NO_LONG_DOUBLE] (__ufromfpxl): New strong alias. * sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c (getpayload): Rename to __getpayload and define as weak alias. [NO_LONG_DOUBLE] (__getpayloadl): New strong alias. * sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c (roundeven): Rename to __roundeven and define as weak alias. [NO_LONG_DOUBLE] (__roundevenl): New strong alias. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c (totalorder): Rename to __totalorder and define as weak alias. [NO_LONG_DOUBLE] (__totalorderl): New strong alias. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c (totalordermag): Rename to __totalordermag and define as weak alias. [NO_LONG_DOUBLE] (__totalordermagl): New strong alias. * sysdeps/ieee754/float128/float128_private.h (__getpayloadl): New macro. (__roundevenl): Likewise. (__totalorderl): Likewise. (__totalordermagl): Likewise * sysdeps/ieee754/float128/s_fromfpf128.c (FUNC): Define to __fromfpf128. (fromfpf128): Define as weak alias. * sysdeps/ieee754/float128/s_fromfpxf128.c (FUNC): Define to __fromfpxf128. (fromfpxf128): Define as weak alias. * sysdeps/ieee754/float128/s_setpayloadf128.c (FUNC): Define to __setpayloadf128. (setpayloadf128): Define as weak alias. * sysdeps/ieee754/float128/s_setpayloadsigf128.c (FUNC): Define to __setpayloadsigf128. (setpayloadsigf128): Define as weak alias. * sysdeps/ieee754/float128/s_ufromfpf128.c (FUNC): Define to __ufromfpf128. (ufromfpf128): Define as weak alias. * sysdeps/ieee754/float128/s_ufromfpxf128.c (FUNC): Define to __ufromfpxf128. (ufromfpxf128): Define as weak alias. * sysdeps/ieee754/flt-32/s_fromfpf.c (FUNC): Define to __fromfpf. (fromfpf): Define as weak alias. * sysdeps/ieee754/flt-32/s_fromfpxf.c (FUNC): Define to __fromfpxf. (fromfpxf): Define as weak alias. * sysdeps/ieee754/flt-32/s_getpayloadf.c (getpayloadf): Rename to __getpayloadf and define as weak alias. * sysdeps/ieee754/flt-32/s_roundevenf.c (roundevenf): Rename to __roundevenf and define as weak alias. * sysdeps/ieee754/flt-32/s_setpayloadf.c (FUNC): Define to __setpayloadf. (setpayloadf): Define as weak alias. * sysdeps/ieee754/flt-32/s_setpayloadsigf.c (FUNC): Define to __setpayloadsigf. (setpayloadsigf): Define as weak alias. * sysdeps/ieee754/flt-32/s_totalorderf.c (totalorderf): Rename to __totalorderf and define as weak alias. * sysdeps/ieee754/flt-32/s_totalordermagf.c (totalordermagf): Rename to __totalordermagf and define as weak alias. * sysdeps/ieee754/flt-32/s_ufromfpf.c (FUNC): Define to __ufromfpf. (ufromfpf): Define as weak alias. * sysdeps/ieee754/flt-32/s_ufromfpxf.c (FUNC): Define to __ufromfpxf. (ufromfpxf): Define as weak alias. * sysdeps/ieee754/ldbl-128/s_fromfpl.c (FUNC): Define to __fromfpl. (fromfpl): Define as weak alias. * sysdeps/ieee754/ldbl-128/s_fromfpxl.c (FUNC): Define to __fromfpxl. (fromfpxl): Define as weak alias. * sysdeps/ieee754/ldbl-128/s_getpayloadl.c (getpayloadl): Rename to __getpayloadl and define as weak alias. * sysdeps/ieee754/ldbl-128/s_roundevenl.c (roundevenl): Rename to __roundevenl and define as weak alias. * sysdeps/ieee754/ldbl-128/s_setpayloadl.c (FUNC): Define to __setpayloadl. (setpayloadl): Define as weak alias. * sysdeps/ieee754/ldbl-128/s_setpayloadsigl.c (FUNC): Define to __setpayloadsigl. (setpayloadsigl): Define as weak alias. * sysdeps/ieee754/ldbl-128/s_totalorderl.c (totalorderl): Rename to __totalorderl and define as weak alias. * sysdeps/ieee754/ldbl-128/s_totalordermagl.c (totalordermagl): Rename to __totalordermagl and define as weak alias. * sysdeps/ieee754/ldbl-128/s_ufromfpl.c (FUNC): Define to __ufromfpl. (ufromfpl): Define as weak alias. * sysdeps/ieee754/ldbl-128/s_ufromfpxl.c (FUNC): Define to __ufromfpxl. (ufromfpxl): Define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_fromfpl.c (FUNC): Define to __fromfpl. (fromfpl): Define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_fromfpxl.c (FUNC): Define to __fromfpxl. (fromfpxl): Define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_getpayloadl.c (getpayloadl): Rename to __getpayloadl and define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c (roundevenl): Rename to __roundevenl and define as weak alias. Call __roundeven instead of roundeven. * sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c (FUNC): Define to __setpayloadl. (setpayloadl): Define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_setpayloadsigl.c (FUNC): Define to __setpayloadsigl. (setpayloadsigl): Define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c (totalorderl): Rename to __totalorderl and define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c (totalordermagl): Rename to __totalordermagl and define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_ufromfpl.c (FUNC): Define to __ufromfpl. (ufromfpl): Define as weak alias. * sysdeps/ieee754/ldbl-128ibm/s_ufromfpxl.c (FUNC): Define to __ufromfpxl. (ufromfpxl): Define as weak alias. * sysdeps/ieee754/ldbl-96/s_fromfpl.c (FUNC): Define to __fromfpl. (fromfpl): Define as weak alias. * sysdeps/ieee754/ldbl-96/s_fromfpxl.c (FUNC): Define to __fromfpxl. (fromfpxl): Define as weak alias. * sysdeps/ieee754/ldbl-96/s_getpayloadl.c (getpayloadl): Rename to __getpayloadl and define as weak alias. * sysdeps/ieee754/ldbl-96/s_roundevenl.c (roundevenl): Rename to __roundevenl and define as weak alias. * sysdeps/ieee754/ldbl-96/s_setpayloadl.c (FUNC): Define to __setpayloadl. (setpayloadl): Define as weak alias. * sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c (FUNC): Define to __setpayloadsigl. (setpayloadsigl): Define as weak alias. * sysdeps/ieee754/ldbl-96/s_totalorderl.c (totalorderl): Rename to __totalorderl and define as weak alias. * sysdeps/ieee754/ldbl-96/s_totalordermagl.c (totalordermagl): Rename to __totalordermagl and define as weak alias. * sysdeps/ieee754/ldbl-96/s_ufromfpl.c (FUNC): Define to __ufromfpl. (ufromfpl): Define as weak alias. * sysdeps/ieee754/ldbl-96/s_ufromfpxl.c (FUNC): Define to __ufromfpxl. (ufromfpxl): Define as weak alias.
* Define and use libm_alias_float128.Joseph Myers2017-09-142-0/+41
| | | | | | | | | | | | | | | | | | | | Continuing the process of setting up common macros for libm function aliases, with a view to using them to define _FloatN / _FloatNx aliases in future, this patch adds a libm_alias_float128 macro and uses it in the type-generic templates. (_Float128 functions will end up with _Float64x aliases on powerpc64le, but not on x86_64/x86/ia64 because _Float64x has long double format there, and the macro will provide a single place for the conditionals for that choice, as well as for once ldbl-128 functions always build *f128 and need conditionals for whether to have *l aliases.) Tested for x86_64. Also tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/generic/libm-alias-float128.h: New file. * sysdeps/generic/math-type-macros-float128.h: Include <libm-alias-float128.h>. [!declare_mgen_alias] (declare_mgen_alias): Define macro.
* Define and use libm_alias_ldouble.Joseph Myers2017-09-134-38/+83
| | | | | | | | | | | | | | | | | | | | | | | | | Continuing the process of setting up common macros for libm function aliases, with a view to using them to define _FloatN / _FloatNx aliases in future, this patch adds a libm_alias_ldouble macro and uses it in the type-generic templates. Since math-type-macros-ldouble.h already did the appropriate thing for each symbol (weak_alias or long_double_symbol), this is just a straightforward rearrangement of code, to make the required logic available in a place that can also be used outside of the type-generic templates in future (in particular, to eliminate various wrappers for functions in ldbl-opt and ldbl-64-128). Tested for x86_64. Also tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/generic/libm-alias-ldouble.h: New file. * sysdeps/ieee754/ldbl-opt/libm-alias-ldouble.h: Likewise. * sysdeps/ieee754/ldbl-opt/math-type-macros-ldouble.h: Remove. * sysdeps/generic/math-type-macros-ldouble.h: Include <libm-alias-ldouble.h>. [!declare_mgen_alias] (declare_mgen_alias): Define to use libm_alias_ldouble.
* Move exp compat wrappers under math/Szabolcs Nagy2017-09-137-186/+2
| | | | | | | | | | | | | | | | Move exp compat wrappers to math/w_exp{,f,l}_compat.c to be consistent with other wrappers. * sysdeps/ieee754/dbl-64/w_exp_compat.c: Move to... * math/w_exp_compat.c: ... here. * sysdeps/ieee754/flt-32/w_expf_compat.c: Move to... * math/w_expf_compat.c: ... here. * sysdeps/ieee754/ldbl-128/w_expl_compat.c: Move to... * math/w_expl_compat.c: ... here. * sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Remove. * sysdeps/ieee754/ldbl-96/w_expl_compat.c: Remove. * sysdeps/ieee754/ldbl-opt/w_exp_compat.c: Use the new path. * sysdeps/ieee754/ldbl-opt/w_expl_compat.c: Likewise.
* Clear up log1p, ldexp, scalbn, scalbln compat handling.Joseph Myers2017-09-137-40/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch cleans up how compat symbols / long double versioning are handled for log1p, ldexp, scalbn and scalbln functions. The general principle is to do as much as possible through the type-generic templates. Previously, when errno-setting wrappers were added the compat long double symbols were left pointing directly to the underlying implementations; they are moved to point to the errno-setting wrappers. For the functions also present in libc, compat symbol handling for the libc copies needs to go in ldbl-opt wrappers, but the type-generic templates can handle it for the libm copies. There is no need for w_scalbln_template.c to disable the creation of an unused internal alias (such code made sense in the context of patches trying to avoid any changes to generated code for ease of comparison, but can be removed in a change that specifically does intend to change details of where symbols point). Tested for x86_64, and with build-many-glibcs.py. * math/w_scalbln_template.c (strong_alias): Do not undefine and redefine. * sysdeps/ieee754/ldbl-opt/s_ldexp.c (declare_mgen_alias): Remove macro. (ldexpl): Only define as compat symbol for libc, not libm. (scalbnl): Define as compat symbol for libc here. * sysdeps/ieee754/ldbl-opt/s_ldexpl.c (declare_mgen_alias): Only define for [IS_IN (libc)]. (__ldexpl_2): Remove alias. (ldexpl): Only define with long_double_symbol if [IS_IN (libc)]. (scalbnl): Likewise. Use __wrap_scalbnl not __ldexpl_2 as base name in long_double_symbol call. * sysdeps/ieee754/ldbl-opt/s_log1p.c: Remove file. * sysdeps/ieee754/ldbl-opt/s_scalbln.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_scalbn.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log1p.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_scalbln.c (declare_mgen_alias): Remove macro. [IS_IN (libc) && LONG_DOUBLE_COMPAT (libc, GLIBC_2_1)] (scalblnl): Define as compat symbol.
* posix: Fix compat glob code on s390 and alphaAdhemerval Zanella2017-09-132-4/+2
| | | | | | | | | | | | | | | | | This patch fixes the compat glob implementation consolidation from commit 116f1c64d with the following changes: - Add a compat implementation on s390 to avoid the architecture to build the symbols on default linux oldglob.c by setting GLOB_NO_OLD_VERSION. - Remove the duplicate rule to build oldglob on alpha. Checked on s390-linux-gnu and alpha-linux-gnu using build-many-glibc.py. * sysdeps/unix/sysv/linux/s390/s390-32/oldglob.c: New file. * sysdeps/unix/sysv/linux/alpha/Makefile [$(subdir) = csu] (sysdep_routines): Remove rule.
* Define and use libm_alias_double.Joseph Myers2017-09-1310-43/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the process of setting up common macros for libm function aliases, with a view to using them to define _FloatN / _FloatNx aliases in future, this patch adds a libm_alias_double macro and uses it in the type-generic templates. This macro handles defining aliases for double, and for long double in the NO_LONG_DOUBLE case. It also handles defining compat symbols for long double = double for architectures that changed their long double format. By so doing, it eliminates the need for the M_LIBM_NEED_COMPAT and declare_mgen_libm_compat macros; the single declare_mgen_alias call in each template now suffices to define all required compat symbols. When used for more double functions (not based on type-generic templates), I expect it will eliminate the need for most ldbl-opt wrappers for such functions. A few special cases are needed. __clog10l is a public symbol (for historical reasons) so needs to be given appropriate compat versions for architectures that changed their long double format, but is not defined as an alias using the normal macros since __clog10* are *not* public symbols for _FloatN / _FloatNx types. For scalbn, scalbln and log1p, the changes adding errno setting support for those functions left compat symbols pointing directly to the non-errno-setting implementations. There is no requirement for the compat symbols not to set errno; that just made for the simplest patches at that time. Now, with these common macros, it's natural to redirect the compat symbols to the errno-setting wrappers, which I intend to do in a separate patch. Tested for x86_64, and with build-many-glibcs.py. For ldbl-opt platforms the stripped libm.so binaries are changed (disassembly unchanged) because the details of how the clog10l compat symbol is created mean it ceases to be weak as it was before; for other platforms, stripped libm.so binaries are unchanged. 2017-09-13 Joseph Myers <joseph@codesourcery.com> * sysdeps/generic/libm-alias-double.h: New file. * sysdeps/ieee754/ldbl-opt/libm-alias-double.h: Likewise. * sysdeps/generic/math-type-macros-double.h: Include <libm-alias-double.h>. [declare_mgen_alias] (declare_mgen_alias): Define to use libm_alias_double. * sysdeps/generic/math-type-macros.h [!M_LIBM_NEED_COMPAT] (M_LIBM_NEED_COMPAT): Remove macro. [!M_LIBM_NEED_COMPAT] (declare_mgen_libm_compat): Likewise. * sysdeps/ieee754/ldbl-opt/math-type-macros-double.h: Remove. * math/cabs_template.c [M_LIBM_NEED_COMPAT]: Remove conditional code. * math/carg_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/cimag_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/conj_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/creal_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cacos_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cacosh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_casin_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_casinh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_catan_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_catanh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_ccos_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_ccosh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cexp_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_clog10_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_clog_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cpow_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cproj_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_csin_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_csinh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_csqrt_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_ctan_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_ctanh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_fdim_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_fmax_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_fmin_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_nan_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/w_ilogb_template.c [M_LIBM_NEED_COMPAT]: Likewise. * sysdeps/ieee754/ldbl-opt/s_clog10.c: New file. * sysdeps/ieee754/ldbl-opt/s_ldexp.c (M_LIBM_NEED_COMPAT): Remove macro. (declare_mgen_alias): New macro. * sysdeps/ieee754/ldbl-opt/w_log1p.c: New file. * sysdeps/ieee754/ldbl-opt/w_scalbln.c: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.c (M_LIBM_NEED_COMPAT): Remove macro. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c [HAVE_AS_VIS3_SUPPORT]: Include <math_ldbl_opt.h> and <first-versions.h>. [HAVE_AS_VIS3_SUPPORT && LONG_DOUBLE_COMPAT (libm, FIRST_VERSION_libm_fdiml)]: Define fdiml as compat symbol.
* Remove declare_mgen_alias_2.Joseph Myers2017-09-122-19/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The libm template machinery includes a macro declare_mgen_alias_2, to define two function aliases rather than one. This macro is only used in one place, to define ldexp and scalbn, and only has one nondefault definition, for double in the case where long double has the same format. That definition is because declare_mgen_alias for double, in that case, defines <internal-func>l as an alias of <internal-func>, so cannot be called twice for aliases of the same function. Now, I suspect the <internal-func>l aliases are generally not needed (with maybe a few exceptions such as __clog10l, which is an exported function). But even in the presence of them, there is no need for a special declare_mgen_alias_2 macro for this case. This patch eliminates the need for such a macro by defining __wrap_scalbn<suffix> as an alias of __ldexp<suffix>, and then using that when defining the scalbn public aliases. This is similar to how such internal aliases are created for functions with multiple symbol versions, for example. Tested for x86_64, and with build-many-glibcs.py. (There *are* some cases where installed stripped shared libraries change - not in the generated code but because such changes to static symbols on input to ld, even nonexported symbols that don't affect the code or dynamic symbols, can affect the particular representation in the output of string tables, hash tables etc.) * sysdeps/generic/math-type-macros.h [!declare_mgen_alias_2] (declare_mgen_alias_2): Remove. * sysdeps/generic/math-type-macros-double.h [NO_LONG_DOUBLE && !declare_mgen_alias_2] (declare_mgen_alias_2): Likewise. * math/s_ldexp_template.c (M_SUF (__wrap_scalbn)): Define strong alias. (ldexp): Define with declare_mgen_alias. (scalbn): Likewise.
* x86: Add MathVec_Prefer_No_AVX512 to cpu-features [BZ #21967]H.J. Lu2017-09-123-5/+17
| | | | | | | | | | | | | | | | | | | | | AVX512 functions in mathvec are used on machines with AVX512. An AVX2 wrapper is also provided and it can be used when the AVX512 version isn't profitable. MathVec_Prefer_No_AVX512 is addded to cpu-features. If glibc.tune.hwcaps=MathVec_Prefer_No_AVX512 is set in GLIBC_TUNABLES environment variable, the AVX2 wrapper will be used. Tested on x86-64 machines with and without AVX512. Also verified glibc.tune.hwcaps=MathVec_Prefer_No_AVX512 on AVX512 machine. [BZ #21967] * sysdeps/x86/cpu-features.h (bit_arch_MathVec_Prefer_No_AVX512): New. (index_arch_MathVec_Prefer_No_AVX512): Likewise. * sysdeps/x86/cpu-tunables.c (TUNABLE_CALLBACK (set_hwcaps)): Handle MathVec_Prefer_No_AVX512. * sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx512.h (IFUNC_SELECTOR): Return AVX2 version if MathVec_Prefer_No_AVX512 is set.
* hurd: Fix build without NO_HIDDENSamuel Thibault2017-09-125-0/+17
| | | | | | | | | | | | | | * posix/sched_primax.c (__sched_get_priority_max): Add libc_hidden_def. * posix/sched_primin.c (__sched_get_priority_min): Likewise. * sysdeps/mach/hurd/mmap.c (__mmap): Likewise. * sysdeps/mach/hurd/mmap64.c (__mmap64): Likewise. * sysdeps/mach/hurd/mprotect.c (__mprotect): Likewise. * sysdeps/mach/hurd/munmap.c (__munmap): Likewise. * sysdeps/mach/hurd/dl-sysdep.c (__GI___getpid, __GI___strtoul_internal, __GI_____strtoul_internal, __GI___chk_fail, __GI___fortify_fail, __GI___assert_fail, __GI___assert_perror_fail): Add aliases.
* Define and use a libm_alias_float macro.Joseph Myers2017-09-112-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fully supporting TS 18661-3 _FloatN / _FloatNx types in the cases where they have the same format as other supported types (in line with the principles described at <https://sourceware.org/ml/libc-alpha/2017-01/msg00333.html>) means adding a lot of function aliases to libm (and a few to libc). float functions will have *f32 aliases, double functions will have *f32x and *f64 aliases, long double functions may have *f64x, *f128 or both aliases depending on the configuration, float128 functions have have *f64x aliases depending on the configuration. At present, most individual libm functions have their own weak_alias calls to define the public names for those functions. For TS 18661-3 support, it is desirable that functions not all need to duplicate the logic for which alias names to define. Thus, common macros for defining the public aliases to a libm function make sense. In the double and long double cases, such macros will also help simplify existing code (with LONG_DOUBLE_COMPAT etc. conditionals), by eliminating existing conditionals and ldbl-opt / ldbl-64-128 wrappers (using the generated ldbl-compat-choose.h to allow a single macro definition to expand appropriately for each symbol depending on LONG_DOUBLE_COMPAT for that symbol). This patch starts the process of adding such macros with a straightforward case: a libm_alias_float macro, initially only used in the case of type-generic templates, to define aliases for float functions (currently just the *f public names, in future also *f32). Future patches are intended to add such macros for other types and to extend the cases in which they are used, with a view to as many places as possible using them before support for _FloatN / _FloatNx aliases is enabled. (I think it's inevitable that some places doing architecture-specific things with aliases and symbol versioning may end up needing to replicate logic for the new aliases, but hopefully the number of such places can be kept to a minimum.) The libm_alias_float macro takes unsuffixed names for both the internal and public function names. The need for unsuffixed public names is obvious, since such macros will end up defining multiple public names with different suffixes. Unsuffixed internal names are because I expect the ldbl-128 functions to end up in a form that always defines *f128 names and sometimes also defines *l names - with the main internal names being e.g. __ieee754_<func>f128 (so many macros in float128_private.h can go away). But __ieee754_<func>l aliases will still be needed for e.g. use from math/ complex functions, meaning the alias macro needs to see just __ieee754_<func> as internal name so it can create an alias based on that name. Since libm_alias_float128 will thus need the unsuffixed internal name, it seems to make sense for all such macros to receive the unsuffixed name. Tested for x86_64. Also tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/generic/libm-alias-float.h: New file. * sysdeps/generic/math-type-macros-float.h: Include <libm-alias-float.h>. [!declare_mgen_alias] (declare_mgen_alias): Define macro.
* x86: Add x86_64 to x86-64 HWCAP [BZ #22093]H.J. Lu2017-09-116-8/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before glibc 2.26, ld.so set dl_platform to "x86_64" and searched the "x86_64" subdirectory when loading a shared library. ld.so in glibc 2.26 was changed to set dl_platform to "haswell" or "xeon_phi", based on supported ISAs. This led to shared library loading failure for shared libraries placed under the "x86_64" subdirectory. This patch adds "x86_64" to x86-64 dl_hwcap so that ld.so will always search the "x86_64" subdirectory when loading a shared library. NB: We can't set x86-64 dl_platform to "x86-64" since ld.so will skip the "haswell" and "xeon_phi" subdirectories on "haswell" and "xeon_phi" machines. Tested on i686 and x86-64. [BZ #22093] * sysdeps/x86/cpu-features.c (init_cpu_features): Initialize GLRO(dl_hwcap) to HWCAP_X86_64 for x86-64. * sysdeps/x86/dl-hwcap.h (HWCAP_COUNT): Updated. (HWCAP_IMPORTANT): Likewise. (HWCAP_X86_64): New enum. (HWCAP_X86_AVX512_1): Updated. * sysdeps/x86/dl-procinfo.c (_dl_x86_hwcap_flags): Add "x86_64". * sysdeps/x86_64/Makefile (tests): Add tst-x86_64-1. (modules-names): Add x86_64/tst-x86_64mod-1. (LDFLAGS-tst-x86_64mod-1.so): New. ($(objpfx)tst-x86_64-1): Likewise. ($(objpfx)x86_64/tst-x86_64mod-1.os): Likewise. (tst-x86_64-1-clean): Likewise. * sysdeps/x86_64/tst-x86_64-1.c: New file. * sysdeps/x86_64/tst-x86_64mod-1.c: Likewise.
* Update x86_64 ulps for AMD Ryzen.Markus Trippelsdorf2017-09-081-2/+2
| | | | * sysdeps/x86_64/fpu/libm-test-ulps: Update for AMD Ryzen.
* Add thunderx2t99 and thunderx2t99p1 CPU names to tunables listSteve Ellcey2017-09-081-3/+5
| | | | | | | * manual/tunables.texi (glibc.tune.cpu): Add thunderx2t99 and thunderx2t99p1 to list of cpu names. * sysdeps/unix/sysv/linux/aarch64/cpu-features.c (cpu_list): Add thunderx2t99 and thunderx2t99p1 entries to cpu_list.
* Fix glibc.tune.cpu tunable handlingSteve Ellcey2017-09-081-1/+1
| | | | | * sysdeps/unix/sysv/linux/aarch64/cpu-features.c (get_midr_from_mcpu): Use strcmp instead of tunable_is_name.
* Add Linux 4.13 constants to bits/fcntl-linux.h.Joseph Myers2017-09-081-0/+15
| | | | | | | | | | | | | | | | | | | | This patch adds new interfaces (F_GET_RW_HINT etc., and associated RW[FH]_WRITE_LIFE_*) from Linux 4.13 to bits/fcntl-linux.h (conditional on __USE_GNU). Tested for x86_64. * sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_GNU] (F_GET_RW_HINT): New macro. [__USE_GNU] (F_SET_RW_HINT): Likewise. [__USE_GNU] (F_GET_FILE_RW_HINT): Likewise. [__USE_GNU] (F_SET_FILE_RW_HINT): Likewise. [__USE_GNU] (RWF_WRITE_LIFE_NOT_SET): Likewise. [__USE_GNU] (RWH_WRITE_LIFE_NONE): Likewise. [__USE_GNU] (RWH_WRITE_LIFE_SHORT): Likewise. [__USE_GNU] (RWH_WRITE_LIFE_MEDIUM): Likewise. [__USE_GNU] (RWH_WRITE_LIFE_LONG): Likewise. [__USE_GNU] (RWH_WRITE_LIFE_EXTREME): Likewise.
* Add fcntl sealing interfaces from Linux 3.17 to bits/fcntl-linux.h.Joseph Myers2017-09-081-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While reviewing Linux 4.13 for glibc header changes needed, I noticed that bits/fcntl-linux.h was missing F_ADD_SEALS etc. from Linux 3.17. I didn't find any discussion indicating this omission is deliberate. Now, these interfaces can only be used with file descriptors created with memfd_create, and we don't have a memfd_create wrapper in glibc (a patch was submitted in October 2014, albeit without documentation / tests, and discussions continued over the next few months, but without consensus on whether to add the interface - and we still lack any general consensus on syscall wrappers), but I don't think that's a reason to exclude the constants from bits/fcntl-linux.h (especially as the header does not look compatible with simultaneously including linux/fcntl.h). (Some of those 2014/2015 discussions raised concerns about difficulty using the memfd_create / sealing interface, but those seem to me more like a question of whether it should be part of the OS-independent GNU API - in my view, even fairly specialized syscalls ought to have wrappers added to glibc if not obsolescent, but there may be cases where we only want to include them in the Linux-specific API and anything in the OS-independent GNU API should be different - rather than being relevant to whether constants for use with fcntl should appear in headers.) * sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_GNU] (F_ADD_SEALS): New macro. [__USE_GNU] (F_GET_SEALS): Likewise. [__USE_GNU] (F_SEAL_SEAL): Likewise. [__USE_GNU] (F_SEAL_SHRINK): Likewise. [__USE_GNU] (F_SEAL_GROW): Likewise. [__USE_GNU] (F_SEAL_WRITE): Likewise.
* posix: Consolidate Linux glob implementationAdhemerval Zanella2017-09-0826-48/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the glob implementation. The main changes are: * On Linux all implementation now uses the default one at sysdeps/unix/sysv/linux/glob{free}{64}.c with the exception of alpha (which requires specific versioning) and s390-32 (which different than other 32 bits ports it does not add a compat one symbol for 2.1 version). * The default implementation uses XSTAT_IS_XSTAT64 to define whether both glob{free} and glob{free}64 should be different implementations. For archictures that define XSTAT_IS_XSTAT64, glob{free} is an alias to glob{free}64. * Move i386 olddirent.h header to Linux default directory, since it is the only header with this name and it is shared among different architectures (and used on compat glob symbol as well). Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py for all major architectures. * sysdeps/unix/sysv/linux/arm/glob64.c: Remove file. * sysdeps/unix/sysv/linux/i386/glob64.c: Likewise. * sysdeps/unix/sysv/linux/m68k/glob64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/globfree64.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/glob64.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/glob64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/glob64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/globfree64.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/glob.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/globfree.c: Likewise. * sysdeps/wordsize-64/glob.c: Likewise. * sysdeps/wordsize-64/glob64.c: Likewise. * sysdeps/wordsize-64/globfree64.c: Likewise. * sysdeps/unix/sysv/linux/glob.c: New file. * sysdeps/unix/sysv/linux/glob64.c: Likewise. * sysdeps/unix/sysv/linux/globfree.c: Likewise. * sysdeps/unix/sysv/linux/globfree64.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/glob64.c: Likewise. * sysdeps/unix/sysv/linux/oldglob.c [SHLIB_COMPAT]: Also adds !GLOB_NO_OLD_VERSION as an extra condition. * sysdeps/unix/sysv/linux/i386/alphasort64.c: Include olddirent.h using relative path instead of absolute one. * sysdeps/unix/sysv/linux/i386/getdents64.c: Likewise. * sysdeps/unix/sysv/linux/i386/readdir64.c: Likewise. * sysdeps/unix/sysv/linux/i386/readdir64_r.c: Likewise. * sysdeps/unix/sysv/linux/i386/versionsort64.c: Likewise. * sysdeps/unix/sysv/linux/i386/olddirent.h: Move to ... * sysdeps/unix/sysv/linux//olddirent.h: ... here.
* posix: Sync glob with gnulib [BZ #1062]Adhemerval Zanella2017-09-0813-48/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch syncs posix/glob.c implementation with gnulib version b5ec983 (glob: simplify symlink detection). The only difference to gnulib code is * DT_UNKNOWN, DT_DIR, and DT_LNK definition in the case there were not already defined. Gnulib code which uses HAVE_STRUCT_DIRENT_D_TYPE will redefine them wrongly because GLIBC does not define HAVE_STRUCT_DIRENT_D_TYPE. Instead the patch check for each definition instead. Also, the patch requires additional globfree and globfree64 files for compatibility version on some architectures. Also the code simplification leads to not macro simplification (not need for NO_GLOB_PATTERN_P anymore). Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py for all major architectures. [BZ #1062] * posix/Makefile (routines): Add globfree, globfree64, and glob_pattern_p. * posix/flexmember.h: New file. * posix/glob_internal.h: Likewise. * posix/glob_pattern_p.c: Likewise. * posix/globfree.c: Likewise. * posix/globfree64.c: Likewise. * sysdeps/gnu/globfree64.c: Likewise. * sysdeps/unix/sysv/linux/alpha/globfree.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/globfree64.c: Likewise. * sysdeps/unix/sysv/linux/oldglob.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/globfree64.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/globfree.c: Likewise. * sysdeps/wordsize-64/globfree.c: Likewise. * sysdeps/wordsize-64/globfree64.c: Likewise. * posix/glob.c (HAVE_CONFIG_H): Use !_LIBC instead. [NDEBUG): Remove comments. (GLOB_ONLY_P, _AMIGA, VMS): Remove define. (dirent_type): New type. Use uint_fast8_t not uint8_t, as C99 does not require uint8_t. (DT_UNKNOWN, DT_DIR, DT_LNK): New macros. (struct readdir_result): Use dirent_type. Do not define skip_entry unless it is needed; this saves a byte on platforms lacking d_ino. (readdir_result_type, readdir_result_skip_entry): New functions, replacing ... (readdir_result_might_be_symlink, readdir_result_might_be_dir): these functions, which were removed. This makes the callers easier to read. All callers changed. (D_INO_TO_RESULT): Now empty if there is no d_ino. (size_add_wrapv, glob_use_alloca): New static functions. (glob, glob_in_dir): Check for size_t overflow in several places, and fix some size_t checks that were not quite right. Remove old code using SHELL since Bash no longer uses this. (glob, prefix_array): Separate MS code better. (glob_in_dir): Remove old Amiga and VMS code. (globfree, __glob_pattern_type, __glob_pattern_p): Move to separate files. (glob_in_dir): Do not rely on undefined behavior in accessing struct members beyond their bounds. Use a flexible array member instead (link_stat): Rename from link_exists2_p and return -1/0 instead of 0/1. Caller changed. (glob): Fix memory leaks. * posix/glob64 (globfree64): Move to separate file. * sysdeps/gnu/glob64.c (NO_GLOB_PATTERN_P): Remove define. (globfree64): Remove hidden alias. * sysdeps/unix/sysv/linux/Makefile (sysdeps_routines): Add oldglob. * sysdeps/unix/sysv/linux/alpha/glob.c (__new_globfree): Move to separate file. * sysdeps/unix/sysv/linux/i386/glob64.c (NO_GLOB_PATTERN_P): Remove define. Move compat code to separate file. * sysdeps/wordsize-64/glob.c (globfree): Move definitions to separate file.
* Update netinet/tcp.h from Linux 4.13.Joseph Myers2017-09-071-2/+8
| | | | | | | | | | | | | This patch updates sysdeps/gnu/netinet/tcp.h to include new definitions from include/uapi/linux/tcp.h in Linux 4.13. Tested for x86_64. * sysdeps/gnu/netinet/tcp.h (TCP_ULP): New macro. (TCP_MD5SIG_EXT): Likewise. (TCP_MD5SIG_FLAG_PREFIX): Likewise. (struct tcp_md5sig): Replace __tcpm_pad1 by tcpm_flags and tcpm_prefixlen. Rename __tcpm_pad2 to __tcpm_pad.
* Add SOL_TLS definition from Linux 4.13.Joseph Myers2017-09-071-0/+1
| | | | | | | | | This patch adds the new SOL_TLS constant from Linux 4.13 to the Linux bits/socket.h. Tested for x86_64. * sysdeps/unix/sysv/linux/bits/socket.h (SOL_TLS): New macro.
* Remove remaining _HAVE_STRING_ARCH_* definitions (BZ #18858)Adhemerval Zanella2017-09-067-7/+0
| | | | | | | | | | | | | | | | | | | | | | | Since the removal of bits/string.h, _HAVE_STRING_ARCH_* are no longer used. This patch removes the unused macros from i686 and x86_64 sysdeps folder. Checked on x86_64-linux-gnu and i686-linux-gnu. * sysdeps/i386/i686/multiarch/strncpy.c (_HAVE_STRING_ARCH_strncpy): Remove define. * sysdeps/x86_64/multiarch/stpcpy.c (_HAVE_STRING_ARCH_stpcpy): Likewise. * sysdeps/x86_64/multiarch/strcspn.c (_HAVE_STRING_ARCH_strcspn): Likewise. * sysdeps/x86_64/multiarch/strncat.c (_HAVE_STRING_ARCH_strncat): Likewise. * sysdeps/x86_64/multiarch/strncpy.c (_HAVE_STRING_ARCH_strncpy): Likewise. * sysdeps/x86_64/multiarch/strpbrk.c (_HAVE_STRING_ARCH_strpbrk): Likewise. * sysdeps/x86_64/multiarch/strspn.c (_HAVE_STRING_ARCH_strspn): Likewise.
* Prefer new libm function wrappers for !LIBM_SVID_COMPAT.Joseph Myers2017-09-0594-30/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The initial obsoletion of SVID libm error handling left the old wrappers and __kernel_standard still being used for new ports and static linking, just with macro definitions of _LIB_VERSION and matherr that meant symbols with those names were never actually used and the code for different error handling variants could be optimized out. This patch cleans things up further by eliminating the __kernel_standard use for new ports and static linking. Now, the old wrappers no longer generate any code in the !LIBM_SVID_COMPAT case, while the new errno-only wrappers that were added for float128 support are now also used for float, double and long double in that case. The changes are generally straightforward. The w_scalb*_compat wrappers continue to be used (scalb is obsolescent in the sense of not being supported for float128, but is present in supported standards - the 2001 edition of POSIX and earlier XSI versions - so remains supported for static linking and new ports, as do the float and long double variants that are existing GNU extensions). Those wrappers would only call __kernel_standard in the _LIB_VERSION == _SVID_ case. Since we would like to be able to compile most of glibc without optimization, relying on a static function whose only use is under an if (0) condition being optimized away to avoid an undefined __kernel_standard reference may not be a good idea. Thus, the relevant code in the scalb wrappers has LIBM_SVID_COMPAT conditionals added to guarantee it's not built at all in the case where __kernel_standard does not exist. Just as i386 has its own w_sqrt_compat.c, so w_sqrt.c is also added. ia64 gets dummy w_*.c to prevent those files being built where they would conflict with the ia64 libm, as with its existing w_*_compat.c. Conditions disabling code for !LIBM_SVID_COMPAT are needed in both the math/ wrappers and in the long double wrappers in ldbl-opt (to avoid them setting up aliases and symbol versions for undefined symbols). I hope that future cleanups to how libm function aliases and symbol versioning are done will eliminate the need for most of the ldbl-opt wrappers. Tested for x86_64 and x86, and with build-many-glibcs.py. * sysdeps/generic/math-type-macros-double.h: Include <math-svid-compat.h>. (__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT. * sysdeps/generic/math-type-macros-float.h: Include <math-svid-compat.h>. (__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT. * sysdeps/generic/math-type-macros-ldouble.h: Include <math-svid-compat.h>. (__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT. * math/lgamma-compat.h (BUILD_LGAMMA): Include LIBM_SVID_COMPAT condition. * math/w_acos_compat.c: Condition contents on [LIBM_SVID_COMPAT]. * math/w_acosf_compat.c: Likewise. * math/w_acosh_compat.c: Likewise. * math/w_acoshf_compat.c: Likewise. * math/w_acoshl_compat.c: Likewise. * math/w_acosl_compat.c: Likewise. * math/w_asin_compat.c: Likewise. * math/w_asinf_compat.c: Likewise. * math/w_asinl_compat.c: Likewise. * math/w_atan2_compat.c: Likewise. * math/w_atan2f_compat.c: Likewise. * math/w_atan2l_compat.c: Likewise. * math/w_atanh_compat.c: Likewise. * math/w_atanhf_compat.c: Likewise. * math/w_atanhl_compat.c: Likewise. * math/w_cosh_compat.c: Likewise. * math/w_coshf_compat.c: Likewise. * math/w_coshl_compat.c: Likewise. * math/w_exp10_compat.c: Likewise. * math/w_exp10f_compat.c: Likewise. * math/w_exp10l_compat.c: Likewise. * math/w_exp2_compat.c: Likewise. * math/w_exp2f_compat.c: Likewise. * math/w_exp2l_compat.c: Likewise. * math/w_fmod_compat.c: Likewise. * math/w_fmodf_compat.c: Likewise. * math/w_fmodl_compat.c: Likewise. * math/w_hypot_compat.c: Likewise. * math/w_hypotf_compat.c: Likewise. * math/w_hypotl_compat.c: Likewise. * math/w_j0_compat.c: Likewise. * math/w_j0f_compat.c: Likewise. * math/w_j0l_compat.c: Likewise. * math/w_j1_compat.c: Likewise. * math/w_j1f_compat.c: Likewise. * math/w_j1l_compat.c: Likewise. * math/w_jn_compat.c: Likewise. * math/w_jnf_compat.c: Likewise. * math/w_jnl_compat.c: Likewise. * math/w_lgamma_r_compat.c: Likewise. * math/w_lgammaf_r_compat.c: Likewise. * math/w_lgammal_r_compat.c: Likewise. * math/w_log10_compat.c: Likewise. * math/w_log10f_compat.c: Likewise. * math/w_log10l_compat.c: Likewise. * math/w_log2_compat.c: Likewise. * math/w_log2f_compat.c: Likewise. * math/w_log2l_compat.c: Likewise. * math/w_log_compat.c: Likewise. * math/w_logf_compat.c: Likewise. * math/w_logl_compat.c: Likewise. * math/w_pow_compat.c: Likewise. * math/w_powf_compat.c: Likewise. * math/w_powl_compat.c: Likewise. * math/w_remainder_compat.c: Likewise. * math/w_remainderf_compat.c: Likewise. * math/w_remainderl_compat.c: Likewise. * math/w_sinh_compat.c: Likewise. * math/w_sinhf_compat.c: Likewise. * math/w_sinhl_compat.c: Likewise. * math/w_sqrt_compat.c: Likewise. * math/w_sqrtf_compat.c: Likewise. * math/w_sqrtl_compat.c: Likewise. * math/w_tgamma_compat.c: Likewise. * math/w_tgammaf_compat.c: Likewise. * math/w_tgammal_compat.c: Likewise. * math/w_scalb_compat.c (sysv_scalb): Condition definition on [LIBM_SVID_COMPAT]. (__scalb): Condition call to sysv_scalb on [LIBM_SVID_COMPAT]. * math/w_scalbf_compat.c (sysv_scalbf): Condition definition on [LIBM_SVID_COMPAT]. (__scalbf): Condition call to sysv_scalbf on [LIBM_SVID_COMPAT]. * math/w_scalbl_compat.c (sysv_scalbl): Condition definition on [LIBM_SVID_COMPAT]. (__scalbl): Condition call to sysv_scalbl on [LIBM_SVID_COMPAT]. * sysdeps/i386/fpu/w_sqrt.c: New file. * sysdeps/ia64/fpu/w_acos.c: Likewise. * sysdeps/ia64/fpu/w_acosf.c: Likewise. * sysdeps/ia64/fpu/w_acosh.c: Likewise. * sysdeps/ia64/fpu/w_acoshf.c: Likewise. * sysdeps/ia64/fpu/w_acoshl.c: Likewise. * sysdeps/ia64/fpu/w_acosl.c: Likewise. * sysdeps/ia64/fpu/w_asin.c: Likewise. * sysdeps/ia64/fpu/w_asinf.c: Likewise. * sysdeps/ia64/fpu/w_asinl.c: Likewise. * sysdeps/ia64/fpu/w_atan2.c: Likewise. * sysdeps/ia64/fpu/w_atan2f.c: Likewise. * sysdeps/ia64/fpu/w_atan2l.c: Likewise. * sysdeps/ia64/fpu/w_atanh.c: Likewise. * sysdeps/ia64/fpu/w_atanhf.c: Likewise. * sysdeps/ia64/fpu/w_atanhl.c: Likewise. * sysdeps/ia64/fpu/w_cosh.c: Likewise. * sysdeps/ia64/fpu/w_coshf.c: Likewise. * sysdeps/ia64/fpu/w_coshl.c: Likewise. * sysdeps/ia64/fpu/w_exp.c: Likewise. * sysdeps/ia64/fpu/w_exp10.c: Likewise. * sysdeps/ia64/fpu/w_exp10f.c: Likewise. * sysdeps/ia64/fpu/w_exp10l.c: Likewise. * sysdeps/ia64/fpu/w_exp2.c: Likewise. * sysdeps/ia64/fpu/w_exp2f.c: Likewise. * sysdeps/ia64/fpu/w_exp2l.c: Likewise. * sysdeps/ia64/fpu/w_expf.c: Likewise. * sysdeps/ia64/fpu/w_expl.c: Likewise. * sysdeps/ia64/fpu/w_fmod.c: Likewise. * sysdeps/ia64/fpu/w_fmodf.c: Likewise. * sysdeps/ia64/fpu/w_fmodl.c: Likewise. * sysdeps/ia64/fpu/w_hypot.c: Likewise. * sysdeps/ia64/fpu/w_hypotf.c: Likewise. * sysdeps/ia64/fpu/w_hypotl.c: Likewise. * sysdeps/ia64/fpu/w_lgamma_r.c: Likewise. * sysdeps/ia64/fpu/w_lgammaf_r.c: Likewise. * sysdeps/ia64/fpu/w_lgammal_r.c: Likewise. * sysdeps/ia64/fpu/w_log.c: Likewise. * sysdeps/ia64/fpu/w_log10.c: Likewise. * sysdeps/ia64/fpu/w_log10f.c: Likewise. * sysdeps/ia64/fpu/w_log10l.c: Likewise. * sysdeps/ia64/fpu/w_log2.c: Likewise. * sysdeps/ia64/fpu/w_log2f.c: Likewise. * sysdeps/ia64/fpu/w_log2l.c: Likewise. * sysdeps/ia64/fpu/w_logf.c: Likewise. * sysdeps/ia64/fpu/w_logl.c: Likewise. * sysdeps/ia64/fpu/w_pow.c: Likewise. * sysdeps/ia64/fpu/w_powf.c: Likewise. * sysdeps/ia64/fpu/w_powl.c: Likewise. * sysdeps/ia64/fpu/w_remainder.c: Likewise. * sysdeps/ia64/fpu/w_remainderf.c: Likewise. * sysdeps/ia64/fpu/w_remainderl.c: Likewise. * sysdeps/ia64/fpu/w_sinh.c: Likewise. * sysdeps/ia64/fpu/w_sinhf.c: Likewise. * sysdeps/ia64/fpu/w_sinhl.c: Likewise. * sysdeps/ia64/fpu/w_sqrt.c: Likewise. * sysdeps/ia64/fpu/w_sqrtf.c: Likewise. * sysdeps/ia64/fpu/w_sqrtl.c: Likewise. * sysdeps/ia64/fpu/w_tgamma.c: Likewise. * sysdeps/ia64/fpu/w_tgammaf.c: Likewise. * sysdeps/ia64/fpu/w_tgammal.c: Likewise. * sysdeps/ieee754/dbl-64/w_exp_compat.c: Condition contents on [LIBM_SVID_COMPAT]. * sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise. * sysdeps/ieee754/k_standard.c: Likewise. * sysdeps/ieee754/k_standardf.c: Likewise. * sysdeps/ieee754/k_standardl.c: Likewise. * sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-64-128/w_expl_compat.c: Condition long_double_symbol call on [LIBM_SVID_COMPAT]. * sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_acosl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_asinl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_coshl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_j0l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_j1l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_jnl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log10l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log2l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_logl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_powl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c: Condition long_double_symbol and compat_symbol calls on [LIBM_SVID_COMPAT].
* Hide __chmod and __mkdir [BZ #18822]H.J. Lu2017-09-044-0/+6
| | | | | | | | | | | | | | | Hide internal __chmod and __mkdir functions to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/sys/stat.h (__chmod): Add libc_hidden_proto. (__mkdir): Likewise. * io/chmod.c (__chmod): Add libc_hidden_def. * io/mkdir.c (__mkdir): Likewise. * sysdeps/mach/hurd/chmod.c (__chmod): Likewise. * sysdeps/mach/hurd/mkdir.c (__mkdir): Likewise. * sysdeps/unix/sysv/linux/generic/chmod.c (__chmod): Likewise. * sysdeps/unix/sysv/linux/generic/mkdir.c (__mkdir): Likewise.
* Update kernel version in syscall-names.list to 4.13.Joseph Myers2017-09-041-2/+2
| | | | | | | | | As far as I can tell Linux 4.13 does not add any new syscalls not included in syscall-names.list. This patch updates the version number in that file accordingly. * sysdeps/unix/sysv/linux/syscall-names.list: Update kernel version to 4.13.
* hurd: Fix rtld's strtoul_internal use through hurdlookupSamuel Thibault2017-09-031-0/+9
| | | | | * sysdeps/mach/hurd/dl-sysdep.c (__strtoul_internal): New function.
* hurd: fix overriding rtld's __sbrk with the real implementationSamuel Thibault2017-09-031-0/+1
| | | | | * sysdeps/mach/hurd/dl-sysdep.c (__sbrk): Add weak_function qualifier.
* hurd: mach/hurd/x86 also needs x86 tunablesSamuel Thibault2017-09-031-0/+21
| | | | * sysdeps/mach/hurd/x86/dl-sysdep.c: New file.
* hurd: mach/hurd/i386 also needs mach/hurd/x86Samuel Thibault2017-09-031-0/+1
| | | | * sysdeps/mach/hurd/i386/Implies: Add mach/hurd/x86.
* hurd: fix libm linkSamuel Thibault2017-09-031-1/+1
| | | | | | * sysdeps/x86/fpu/include/bits/fenv.h [NO_HIDDEN]: Redirect __feraiseexcept_renamed to feraiseexcept instead of __GI_feraiseexcept.
* hurd: Fix libc linkSamuel Thibault2017-09-031-0/+8
| | | | | | | | | | This follows db3d848 ('Build divdi3 only for architecture that required it'). * sysdeps/mach/hurd/i386/Makefile [$(subdir) = csu] (sysdep_routines): New rule: divdi3 object. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise.
* hurd: Fix libc linkSamuel Thibault2017-09-032-0/+2
| | | | | * sysdeps/posix/pause.c: Include <sigsetops.h>. * sysdeps/posix/system.c: Include <sigsetops.h>.
* hurd: Fix rtld linkSamuel Thibault2017-09-031-0/+10
| | | | * sysdeps/mach/hurd/dl-sysdep.c (__sbrk): New function.
* hurd: Fix rtld linkSamuel Thibault2017-09-031-0/+6
| | | | | | dl-tunables.c now uses __access_noerrno in addition to __access. * sysdeps/mach/hurd/dl-sysdep.c (__access_noerrno): New function.
* hurd: Fix p{read,write}{,v64}v2.c buildSamuel Thibault2017-09-034-1/+5
| | | | | | | | | | | | * misc/preadv2.c: Include <errno.h>. * misc/preadv64v2.c: Include <errno.h>. * misc/pwritev2.c: Include <errno.h>. * misc/pwritev64v2.c: Include <errno.h>. * sysdeps/posix/preadv2.c: Include <errno.h>. * sysdeps/posix/preadv64v2.c: Include <errno.h>. Fix <unistd.h> inclusion. * sysdeps/posix/pwritev2.c: Include <errno.h>. * sysdeps/posix/pwritev64v2.c: Include <errno.h>.
* hurd: Fix p{read,write}v64v2.c buildSamuel Thibault2017-09-032-2/+2
| | | | | * sysdeps/posix/preadv64v2.c: Use off64_t instead of off_t. * sysdeps/posix/pwritev64v2.c: Use off64_t instead of off_t.
* hurd: Fix p{read,write}{,v64}v2.c buildSamuel Thibault2017-09-034-4/+4
| | | | | | | * sysdeps/posix/preadv2.c: Use off_t instead of OFF_T. * sysdeps/posix/preadv64v2.c: Use off_t instead of OFF_T. * sysdeps/posix/pwritev2.c: Use off_t instead of OFF_T. * sysdeps/posix/pwritev64v2.c: Use off_t instead of OFF_T.
* hurd: Fix getting ssize_t for <sys/socket.h>Samuel Thibault2017-09-031-1/+1
| | | | | * sysdeps/mach/hurd/bits/socket.h: Include <sys/types.h> instead of just <bits/types.h>.
* hurd: Fix sigsetops.h macrosSamuel Thibault2017-09-031-3/+3
| | | | | | * sysdeps/generic/sigsetops.h: Remove spurious #endif. (__sigismember, __sigaddset, __sigdelset): Fix referencing set parameter.
* sysdeps/generic/sigsetops.h: Remove spurious #endifSamuel Thibault2017-09-031-1/+0
|
* Obsolete pow10 functions.Joseph Myers2017-09-0124-397/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch obsoletes the pow10, pow10f and pow10l functions (makes them into compat symbols, not available for new ports or static linking). The exp10 names for these functions are standardized (in TS 18661-4) and were added in the same glibc version (2.1) as pow10 so source code can change to use them without any loss of portability. Since pow10 is deliberately not provided for _Float128, only exp10, this slightly simplifies moving to the new wrapper templates in the !LIBM_SVID_COMPAT case, by avoiding needing to arrange for pow10, pow10f and pow10l to be defined by those templates. Tested for x86_64, and with build-many-glibcs.py. * manual/math.texi (pow10): Do not document. (pow10f): Likewise. (pow10l): Likewise. * math/bits/mathcalls.h [__USE_GNU] (pow10): Do not declare. * math/bits/math-finite.h [__USE_GNU] (pow10): Likewise. * math/libm-test-exp10.inc (pow10_test): Remove. (do_test): Do not call pow10. * math/w_exp10_compat.c (pow10): Make into compat symbol. [NO_LONG_DOUBLE] (pow10l): Likewise. * math/w_exp10f_compat.c (pow10f): Likewise. * math/w_exp10l_compat.c (pow10l): Likewise. * sysdeps/ia64/fpu/e_exp10.S: Include <shlib-compat.h>. (pow10): Make into compat symbol. * sysdeps/ia64/fpu/e_exp10f.S: Include <shlib-compat.h>. (pow10f): Make into compat symbol. * sysdeps/ia64/fpu/e_exp10l.S: Include <shlib-compat.h>. (pow10l): Make into compat symbol. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Remove pow10. (CFLAGS-nldbl-pow10.c): Remove variable.. * sysdeps/ieee754/ldbl-opt/nldbl-pow10.c: Remove file. * sysdeps/ieee754/ldbl-opt/w_exp10_compat.c (pow10l): Condition on [SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_27)]. * sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c (compat_symbol): Undefine and redefine. (pow10l): Make into compat symbol. * sysdeps/aarch64/libm-test-ulps: Remove pow10 ulps. * sysdeps/alpha/fpu/libm-test-ulps: Likewise. * sysdeps/arm/libm-test-ulps: Likewise. * sysdeps/hppa/fpu/libm-test-ulps: Likewise. * sysdeps/i386/fpu/libm-test-ulps: Likewise. * sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise. * sysdeps/microblaze/libm-test-ulps: Likewise. * sysdeps/mips/mips32/libm-test-ulps: Likewise. * sysdeps/mips/mips64/libm-test-ulps: Likewise. * sysdeps/nios2/libm-test-ulps: Likewise. * sysdeps/powerpc/fpu/libm-test-ulps: Likewise. * sysdeps/powerpc/nofpu/libm-test-ulps: Likewise. * sysdeps/s390/fpu/libm-test-ulps: Likewise. * sysdeps/sh/libm-test-ulps: Likewise. * sysdeps/sparc/fpu/libm-test-ulps: Likewise. * sysdeps/tile/libm-test-ulps: Likewise. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Include <string.h> for strcmp call from sysdeps/unix/sysv/linux/gentempfd.c.Joseph Myers2017-09-011-0/+1
| | | | * sysdeps/unix/sysv/linux/gentempfd.c: Include <string.h>.
* linux: Implement tmpfile with O_TMPFILE (BZ#21530)Adhemerval Zanella2017-09-011-0/+34
| | | | | | | | | | | | | | | | | | | | | | This patch adds O_TMPFILE support to tmpfile on Linux. This is similar to the previous suggestion by Andreas Schwab [1] with the difference the file descriptor creation is parameterized to compartmentalize Linux only open flags (O_TMPFILE) on sysdeps. Checked on x86_64-linux-gnu. Adhemerval Zanella <adhemerval.zanella@linaro.org> Andreas Schwab <schwab@suse.de> [BZ #21530] * include/stdio.h (__gen_tempfd): New function. * stdio-common/Makefile (routines): Add gentempfd. * stdio-common/gentempfd.c: New file. * sysdeps/unix/sysv/linux/gentempfd.c: Likewise. * stdio-common/tmpfile.c (tmpfile): First try to use a system specific unnamed file first. [1] https://sourceware.org/ml/libc-alpha/2017-06/msg01293.html
* getaddrinfo: Fix error handling in gethosts [BZ #21915] [BZ #21922]Florian Weimer2017-09-011-22/+20
| | | | | | The old code uses errno as the primary indicator for success or failure. This is wrong because errno is only set for specific combinations of the status return value and the h_errno variable.
* getaddrinfo: Return EAI_NODATA if gethostbyname2_r reports NO_DATA [BZ #21922]Florian Weimer2017-09-011-0/+8
|
* getaddrinfo: In gaih_inet, use h_errno for certain status values onlyFlorian Weimer2017-09-011-1/+4
| | | | | h_errno is not set for NSS_STATUS_SUCCESS, so its value might not be accurate at this point.
* getaddrinfo: Properly set errno for NSS function lookup failureFlorian Weimer2017-09-011-6/+10
|
* getaddrinfo: Use &h_errno has the h_errno pointerFlorian Weimer2017-09-011-28/+18
| | | | | | This simplifies the code because it is not necessary to propagate the temporary h_errno value to the thread-local variable. It also increases compatibility with NSS modules which update only one of the two places.