about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* powerpc64le: Enable float128 tuliom/float128Paul E. Murphy2017-05-2511-0/+1123
| | | | | | | | | | | | | | | | | | | | | | | | | | Add ulps for the float128 type, bits/floatn.h, and float128-abi.h. Likewise, sqrt is not implemented in libgcc. The sfp-machine.h header is taken from libgcc, and used to build a P7/P8 soft-fp sqrtf128. * sysdeps/powerpc/fpu/libm-test-ulps: Regenerated. * sysdeps/powerpc/fpu/math_private.h: (__ieee754_sqrtf128): New inline override. * sysdeps/powerpc/powerpc64le/Implies-before: New file. * sysdeps/powerpc/powerpc64le/Makefile: New file. * sysdeps/powerpc/powerpc64le/bits/floatn.h: New file. * sysdeps/powerpc/powerpc64le/fpu/e_sqrtf128.c: New file. * sysdeps/powerpc/powerpc64le/fpu/sfp-machine.h: New file. * sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c: New file. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Regenerated. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64le/float128-abi.h New file.
* powerpc64le: Require gcc >= 6.2 for powerpc64leGabriel F. T. Gomes2017-05-252-0/+88
| | | | | | | | | | | | | | On powerpc64le, support for __float128 will start to be built by default, which requires gcc versions greater than or equal to 6.2. Tested for ppc64 (still works with older compilers) and ppc64le. 2017-04-28 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com> Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> * sysdeps/powerpc/powerpc64le/configure.ac: New file with test for the required minimum gcc version. * sysdeps/powerpc/powerpc64le/configure: New, auto-generated file.
* float128: Add test-{float128,ifloat128,float128-finite}Paul E. Murphy2017-05-2511-4/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds test support for float128, and lays some groundwork for future _FloatN types. * math/Makefile (CFLAGS-test-float128.c): Add appropriate test flags. (CFLAGS-test-float128-finite.c): Likewise (CPPFLAGS-test-ifloat128.c): Likewise * math/test-support.h (CFLOAT): New macro to compensate for older compilers not supporting _Complex __float128. * math/libm-test-support.c (check_complex): Use CFLOAT instead of __complex__ FLOAT. * math/test-float128-finite.c: New file. * math/test-float128.c: New file. * math/test-float128.h: New file. * math/test-ifloat128.c: New file. * math/test-math-floatn.h: New file. * math/gen-libm-test.pl (all_floats): Add float128 variants. (all_floats_pfx): Add float128 mapping. * math/gen-libm-have-vector-test.sh: Add support for float128.
* float128: Add strfromf128, strtof128, and wcstof128 to the manualGabriel F. T. Gomes2017-05-251-6/+33
| | | | | | | 2016-11-14 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com> * manual/arith.texi: Add descriptions for strfromf128, strtof128, and wcstof128.
* float128: Add strtof128, wcstof128, and related functions.Paul E. Murphy2017-05-2521-26/+426
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementations are contained with sysdeps/ieee754/float128 as they are only built when _Float128 is enabled within libc/m. 2017-05-23 Paul E. Murphy <murphyp@linux.vnet.ibm.com> * NEWS: Mention the addition of strtof128 and wcstof128. * include/gmp.h (__mpn_construct_float128): New declaration. * include/stdlib.h: Include bits/floatn.h for _Float128 tests. (__strtof128_l): New declaration. (__strtof128_nan): Likewise. (__wcstof128_nan): Likewise. (__strtof128_internal): Likewise. (____strtof128_l_internal): Likewise. * include/wchar.h: Include bits/floatn.h for _Float128 tests. (__wcstof128_l): New declaration. (__wcstof128_internal): Likewise. * stdlib/Makefile (bug-strtod2): Link libm too. * stdlib/stdlib.h (strtof128): New declaration. (strtof128_l): Likewise. * stdlib/tst-strtod-nan-locale-main.c: Updated to use tst-strtod.h macros to ensure float128 gets tested too. * stdlib/tst-strtod-round-skeleton.c (CHOOSE_f128): New macro. * stdlib/tst-strtod.h: Include bits/floatn.h for _Float128 tests. (_GEN_F128): New macro. (_GEN): Likewise. (_GENx): Likewise. (_DO_F128): Likewise. (_DO): Likewise. (_DOx): Likewise. (GEN_TEST_STRTOD): Update to optionally include _Float128 in the tests. (STRTOD_TEST_FOREACH): Likewise. * sysdeps/ieee754/float128/Makefile: Insert new strtof128 and wcstof128 functions into libc. * sysdeps/ieee754/float128/Versions: Add exports for the above new functions. * sysdeps/ieee754/float128/mpn2float128.c: New file. * sysdeps/ieee754/float128/strtod_nan_float128.h: New file. * sysdeps/ieee754/float128/strtof128.c: New file. * sysdeps/ieee754/float128/strtof128_l.c: New file. * sysdeps/ieee754/float128/strtof128_nan.c: New file. * sysdeps/ieee754/float128/wcstof128.c: New file. * sysdeps/ieee754/float128/wcstof128_l.c: New file. * sysdeps/ieee754/float128/wcstof128_nan.c: New fike. * wcsmbs/Makefile: (CFLAGS-wcstof128.c): Append strtox-CFLAGS. (CFLAGS-wcstof128_l): Likewise. * wcsmbs/wchar.h (wcstof128): New declaration. (wcstof128_l): Likewise.
* float128: Add strfromf128Gabriel F. T. Gomes2017-05-2514-8/+328
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add strfromf128 to stdlib when _Float128 support is enabled. 2016-11-07 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com> * NEWS: Mention the addition of strfromf128. * include/gmp.h: Include bits/floatn.h for _Float128 support. * stdio-common/printf-parsemb.c (__parse_one_specmb): Initialize spec->info.is_binary128 to zero. * stdio-common/printf.h (printf_info): Add new member is_binary128 to indicate that the number being converted to string is compatible with the IEC 60559 binary128 format. * stdio-common/printf_fp.c (__printf_fp_l): Add code to deal with _Float128 numbers. * stdio-common/printf_fphex.c (__printf_fphex): Likewise. * stdio-common/printf_size.c (__printf_size): Likewise. * stdio-common/vfprintf.c (process_arg): Initialize member info.is_binary128 to zero. * stdlib/fpioconst.h (FLT128_MAX_10_EXP_LOG): New macro. * stdlib/stdlib.h: Include bits/floatn.h for _Float128 support. (strfromf128): New declaration. * stdlib/strfrom-skeleton.c (STRFROM): Set member info.is_binary128 to one. * sysdeps/ieee754/float128/Makefile: Add strfromf128. * sysdeps/ieee754/float128/Versions: Likewise. * sysdeps/ieee754/float128/strfromf128.c: New file.
* float128: Add conversion from float128 to mpnGabriel F. T. Gomes2017-05-255-6/+49
| | | | | | | | | | | | | | | Reuse the code for __mpn_extract_long_double to implement __mpn_extract_float128. 2017-05-15 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com> * include/gmp.h (__mpn_extract_float128): Declare when __HAVE_DISTINCT_FLOAT128 is 1. * misc/sys/param.h (MIN, MAX): Only define if not yet defined. * sysdeps/ieee754/float128/Makefile: New file. * sysdeps/ieee754/float128/float1282mpn.c: New file. * sysdeps/ieee754/ldbl-128/ldbl2mpn.c (__mpn_extract_float128): New function, which is built when __FLOAT128_OVERRIDE is defined.
* float128: Extend the power of ten tablesPaul E. Murphy2017-05-252-6/+16
| | | | | | | | | | | | | | | | Update the power of ten tables used by the common implementation when long double is not the most expressive real type. 2016-11-04 Paul E. Murphy <murphyp@linux.vnet.ibm.com> * stdlib/fpioconst.c (HAVE_EXTENDED_RANGE): New macro for testing how big the power of ten table should be. [TENS_P11_IDX]: Include if above is true. [TENS_P12_IDX]: Include if above is true. [TENS_P13_IDX]: Include if above is true. [TENS_P14_IDX]: Include if above is true. * stdlib/fpioconst.h (FPIOCONST_POW10_ARRAY_SIZE): Use larger table if _Float128 is supported.
* float128: Add wrappers to override ldbl-128 as float128.Paul E. Murphy2017-05-2591-0/+765
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change defines float128_private.h which contains macros used to override long double naming conventions when building a ldbl file. * math/math.h [__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (SNANF128): New macro. * math/e_sqrtf128.c: New file. * math/s_fmaxmag_template.c: Include math_private.h in order to make inline expansion of fabs128(). * math/s_fminmag_template.c: Likewise. * sysdeps/ieee754/float128/e_acosf128.c: New file. * sysdeps/ieee754/float128/e_acoshf128.c: New file. * sysdeps/ieee754/float128/e_asinf128.c: New file. * sysdeps/ieee754/float128/e_atan2f128.c: New file. * sysdeps/ieee754/float128/e_atanhf128.c: New file. * sysdeps/ieee754/float128/e_coshf128.c: New file. * sysdeps/ieee754/float128/e_exp10f128.c: New file. * sysdeps/ieee754/float128/e_expf128.c: New file. * sysdeps/ieee754/float128/e_fmodf128.c: New file. * sysdeps/ieee754/float128/e_gammaf128_r.c: New file. * sysdeps/ieee754/float128/e_hypotf128.c: New file. * sysdeps/ieee754/float128/e_ilogbf128.c: New file. * sysdeps/ieee754/float128/e_j0f128.c: New file. * sysdeps/ieee754/float128/e_j1f128.c: New file. * sysdeps/ieee754/float128/e_jnf128.c: New file. * sysdeps/ieee754/float128/e_lgammaf128_r.c: New file. * sysdeps/ieee754/float128/e_log10f128.c: New file. * sysdeps/ieee754/float128/e_log2f128.c: New file. * sysdeps/ieee754/float128/e_logf128.c: New file. * sysdeps/ieee754/float128/e_powf128.c: New file. * sysdeps/ieee754/float128/e_rem_pio2f128.c: New file. * sysdeps/ieee754/float128/e_remainderf128.c: New file. * sysdeps/ieee754/float128/e_scalbf128.c: New file. * sysdeps/ieee754/float128/e_sinhf128.c: New file. * sysdeps/ieee754/float128/float128_private.h: New file. * sysdeps/ieee754/float128/gamma_productf128.c: New file. * sysdeps/ieee754/float128/ieee754_float128.h: New file. * sysdeps/ieee754/float128/k_cosf128.c: New file. * sysdeps/ieee754/float128/k_sincosf128.c: New file. * sysdeps/ieee754/float128/k_sinf128.c: New file. * sysdeps/ieee754/float128/k_tanf128.c: New file. * sysdeps/ieee754/float128/lgamma_negf128.c: New file. * sysdeps/ieee754/float128/lgamma_productf128.c: New file. * sysdeps/ieee754/float128/s_asinhf128.c: New file. * sysdeps/ieee754/float128/s_atanf128.c: New file. * sysdeps/ieee754/float128/s_cbrtf128.c: New file. * sysdeps/ieee754/float128/s_ceilf128.c: New file. * sysdeps/ieee754/float128/s_copysignf128.c: New file. * sysdeps/ieee754/float128/s_cosf128.c: New file. * sysdeps/ieee754/float128/s_erff128.c: New file. * sysdeps/ieee754/float128/s_expm1f128.c: New file. * sysdeps/ieee754/float128/s_fabsf128.c: New file. * sysdeps/ieee754/float128/s_finitef128.c: New file. * sysdeps/ieee754/float128/s_floorf128.c: New file. * sysdeps/ieee754/float128/s_fmaf128.c: New file. * sysdeps/ieee754/float128/s_fpclassifyf128.c: New file. * sysdeps/ieee754/float128/s_frexpf128.c: New file. * sysdeps/ieee754/float128/s_fromfpf128.c: New file. * sysdeps/ieee754/float128/s_fromfpxf128.c: New file. * sysdeps/ieee754/float128/s_getpayloadf128.c: New file. * sysdeps/ieee754/float128/s_isinff128.c: New file. * sysdeps/ieee754/float128/s_isnanf128.c: New file. * sysdeps/ieee754/float128/s_issignalingf128.c: New file. * sysdeps/ieee754/float128/s_llrintf128.c: New file. * sysdeps/ieee754/float128/s_llroundf128.c: New file. * sysdeps/ieee754/float128/s_log1pf128.c: New file. * sysdeps/ieee754/float128/s_logbf128.c: New file. * sysdeps/ieee754/float128/s_lrintf128.c: New file. * sysdeps/ieee754/float128/s_lroundf128.c: New file. * sysdeps/ieee754/float128/s_modff128.c: New file. * sysdeps/ieee754/float128/s_nearbyintf128.c: New file. * sysdeps/ieee754/float128/s_nextafterf128.c: New file. * sysdeps/ieee754/float128/s_nexttowardf128.c: New file. * sysdeps/ieee754/float128/s_nextupf128.c: New file. * sysdeps/ieee754/float128/s_remquof128.c: New file. * sysdeps/ieee754/float128/s_rintf128.c: New file. * sysdeps/ieee754/float128/s_roundevenf128.c: New file. * sysdeps/ieee754/float128/s_roundf128.c: New file. * sysdeps/ieee754/float128/s_scalblnf128.c: New file. * sysdeps/ieee754/float128/s_scalbnf128.c: New file. * sysdeps/ieee754/float128/s_setpayloadf128.c: New file. * sysdeps/ieee754/float128/s_setpayloadsigf128.c: New file. * sysdeps/ieee754/float128/s_signbitf128.c: New file. * sysdeps/ieee754/float128/s_significandf128.c: New file. * sysdeps/ieee754/float128/s_sincosf128.c: New file. * sysdeps/ieee754/float128/s_sinf128.c: New file. * sysdeps/ieee754/float128/s_tanf128.c: New file. * sysdeps/ieee754/float128/s_tanhf128.c: New file. * sysdeps/ieee754/float128/s_totalorderf128.c: New file. * sysdeps/ieee754/float128/s_totalordermagf128.c: New file. * sysdeps/ieee754/float128/s_truncf128.c: New file. * sysdeps/ieee754/float128/s_ufromfpf128.c: New file. * sysdeps/ieee754/float128/s_ufromfpxf128.c: New file. * sysdeps/ieee754/float128/t_sincosf128.c: New file. * sysdeps/ieee754/float128/x2y2m1f128.c: New file. * sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h: (__iscanonicalf128): Define as a macro.
* aarch64: Thunderx specific memcpy and memmoveSteve Ellcey2017-05-249-10/+554
| | | | | | | | | | | | | | * sysdeps/aarch64/memcpy.S (MEMMOVE, MEMCPY): New macros. (memmove): Use MEMMOVE for name. (memcpy): Use MEMCPY for name. Change internal labels to external labels. * sysdeps/aarch64/multiarch/Makefile: New file. * sysdeps/aarch64/multiarch/ifunc-impl-list.c: Likewise. * sysdeps/aarch64/multiarch/init-arch.h: Likewise. * sysdeps/aarch64/multiarch/memcpy.c: Likewise. * sysdeps/aarch64/multiarch/memcpy_generic.S: Likewise. * sysdeps/aarch64/multiarch/memcpy_thunderx.S: Likewise. * sysdeps/aarch64/multiarch/memmove.c: Likewise.
* arm: Fix typo in array countSiddhesh Poyarekar2017-05-243-2/+9
| | | | | | | | | | I just noticed that the array count for the hwcap flags list in ARM is off by 10, i.e. 37 instead of 27. Following patch fixes this. * sysdeps/unix/sysv/linux/arm/dl-procinfo.c (_dl_arm_cap_flags): Fix array subscript. * sysdeps/unix/sysv/linux/arm/dl-procinfo.h (_DL_HWCAP_COUNT): Fix count.
* x86: Don't include cacheinfo.c in ld.soH.J. Lu2017-05-242-0/+8
| | | | | | | Since cacheinfo.c isn't used by ld.so, there is no need to include it in ld.so. * sysdeps/x86/cacheinfo.c: Skip if not in libc.
* x86: Use __get_cpu_features to get cpu_featuresH.J. Lu2017-05-242-10/+17
| | | | | | | | | | | Remove is_intel, is_amd and max_cpuid macros. Use __get_cpu_features to get cpu_features instead. * sysdeps/x86/cacheinfo.c (is_intel): Removed. (is_amd): Likewise. (max_cpuid): Likewise. (__cache_sysconf): Use __get_cpu_features to get cpu_features. (init_cacheinfo): Likewise.
* Fix sigstack namespace (bug 21511).Joseph Myers2017-05-233-8/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | The sigstack function was removed in the 2001 edition of POSIX, and the sigstack structure in the 2008 edition. signal.h wrongly includes those declarations even for newer POSIX versions. This patch fixes the conditions, and conform/ expectations, accordingly. This patch makes the minimum change to when these declarations are present, leaving them visible for __USE_MISC as they would previously have been visible by default. Arguably these legacy declarations should only be visible when an old standard is specifically requested, but implementing that would require arranging for the various sigstack implementations to be able to see the struct sigstack type despite it not being in _GNU_SOURCE in that case. Tested for x86_64. [BZ #21511] * signal/signal.h: Include <bits/types/struct_sigstack.h> only if [(__USE_XOPEN_EXTENDED && !__USE_XOPEN2K8) || __USE_MISC]. (sigstack): Declare only if [(__USE_XOPEN_EXTENDED && !__USE_XOPEN2K) || __USE_MISC]. * conform/data/signal.h-data (struct sigstack): Expect type only if [!XOPEN2K8 && !POSIX2008]. (sigstack): Expect function only if [XPG42 || UNIX98].
* Fix sys/ucontext.h namespace from signal.h etc. inclusion (bug 21457).Joseph Myers2017-05-2321-149/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The various sys/ucontext.h headers include <signal.h> and all the headers split out of <bits/sigstack.h>. (Except that the powerpc version does not include <signal.h>.) None of the standard versions defining ucontext.h require or permit such inclusions; rather, they all say that the stack_t and sigset_t types from signal.h are defined. This patch fixes the headers to include just the bits/ headers for those types (and the existing includes of bits/sigcontext.h). Since bits/types/sigset_t.h is now being included instead of bits/types/__sigset_t.h, __sigset_t uses in the headers are replaced by direct use of the public sigset_t type. sysdeps/unix/sysv/linux/x86/bits/sigcontext.h was relying on the prior inclusion of <signal.h> to define types such as __uint32_t, so gets a bits/types.h include added to provide those types. Although one could keep some or all of the includes under a __USE_MISC conditional, that seems unnecessary to me, especially given the lack of a <signal.h> include in the powerpc version meaning that portable programs already cannot rely on such an include. Tested for x86_64 and x86, and with build-many-glibcs.py. As with other such fixes, more namespace issues remain so this does not permit any XFAILs to be removed or bugs to be closed. [BZ #21457] * sysdeps/arm/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/generic/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/i386/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/m68k/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/mips/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h>. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. * sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/x86/bits/sigcontext.h: Include <bits/types.h>. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t.
* Fix a bug in 'Remove __need macros from signal.h' (a992f506)Zack Weinberg2017-05-228-16/+38
| | | | | | | | | | | | | | | | | | | | | siginfo-arch.h is included in two different places, so the default definitions of the macros that it might or might not define need to be done conditionally afterward, not unconditionally beforehand. * sysdeps/unix/sysv/linux/bits/siginfo-consts.h (__SI_ASYNCIO_AFTER_SIGIO): Define default after including bits/siginfo-arch.h, only if not already defined. * sysdeps/unix/sysv/linux/bits/types/siginfo_t.h (__SI_ALIGNMENT, __SI_BAND_TYPE, __SI_CLOCK_T) (__SI_ERRNO_THEN_CODE, __SI_HAVE_SIGSYS, __SI_SEGFAULT_ADDL): Likewise. * sysdeps/unix/sysv/linux/ia64/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/mips/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/sparc/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/tile/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/x86/bits/siginfo-arch.h: Unconditionally define __SI_* macros.
* libio: Avoid dup already opened file descriptor [BZ#21393]Adhemerval Zanella2017-05-225-59/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As described in BZ#21398 (close as dup of 21393) report current freopen implementation fails when one tries to freopen STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. Although on bug report the discussion leads to argue if a close followed by a freopen on the standard file is a valid operation, the underlying issue is not really the check for dup3 returned value, but rather calling it if the returned file descriptor is equal as the input one. So for a quality of implementation this patch avoid calling dup3 for the aforementioned case. It also adds a dup3 error case check for the two possible failures, with one being Linux only: EINTR and EBUSY. The EBUSY issue is better explained on this stackoverflow thread [1], but in a short it is due the internal Linux implementation which allows a race condition window for dup2 due the logic dissociation of file descriptor allocation and actual VFS 'install' operation. For both outliers failures all allocated memory is freed and a NULL FILE* is returned. With this patch the example on BZ#21398 is now actually possible (I used as the testcase for the bug report). Checked on x86_64-linux-gnu. [BZ #21393] * libio/freopen.c (freopen): Avoid dup already opened file descriptor and add a check for dup3 failure. * libio/freopen64.c (freopen64): Likewise. * libio/tst-freopen.c (do_test): Rename to do_test_basic and use libsupport. (do_test_bz21398): New test. * manual/stdio.texi (freopen): Add documentation of EBUSY failure. [1] http://stackoverflow.com/questions/23440216/race-condition-when-using-dup2
* Remove useless comment from sysdeps/sparc/sparc32/dl-machine.hSiddhesh Poyarekar2017-05-232-2/+5
| | | | | | | | David Miller has not been shot yet AFAIK (yes, I googled for any news that may seem relevant and I poked him on twitter some days ago) so either nobody uses SPARC or the code is correct or nobody read the instructions in the comment to shoot him. In all of those cases the comment is clearly not useful, so getting rid of it.
* Add one more header to be installed, missed from previous patch.Zack Weinberg2017-05-212-2/+6
| | | | * signal/Makefile (headers): Add bits/types/sigval_t.h.
* Remove __need macros from signal.h.Zack Weinberg2017-05-2095-2911/+1192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The types affected are __sig_atomic_t, sig_atomic_t, __sigset_t, sigset_t, sigval_t, sigevent_t, and siginfo_t. __sig_atomic_t is a scalar, so it's now directly available from bits/types.h. The others get bits/types/ headers. Side effects include: There have been small changes to which non-signal headers expose which subset of the signal-related types. A couple of architectures' nested siginfo_t fields had to be renamed to prevent undesired macro expansion. Internal code that wants to manipulate signal masks must now include <sigsetops.h> (which is not installed) and should be aware that __sigaddset, __sigandset, __sigdelset, __sigemptyset, and __sigorset no longer return a value (unlike the public API). Relatedly, the public signal.h no longer declares any of those functions. The obsolete sigmask() macro no longer has a system-specific definition -- in the cases where it matters, it didn't work anyway. New Linux architectures should create bits/siginfo-arch.h and/or bits/siginfo-consts-arch.h to customize their siginfo_t, rather than duplicating everything in bits/siginfo.h (which no longer exists). Add new __SI_* macros if necessary. Ports to other operating systems are strongly encouraged to generalize this scheme further. * bits/sigevent-consts.h * bits/siginfo-consts.h * bits/types/__sigset_t.h * bits/types/sigevent_t.h * bits/types/siginfo_t.h * sysdeps/unix/sysv/linux/bits/sigevent-consts.h * sysdeps/unix/sysv/linux/bits/siginfo-consts.h * sysdeps/unix/sysv/linux/bits/types/__sigset_t.h * sysdeps/unix/sysv/linux/bits/types/sigevent_t.h * sysdeps/unix/sysv/linux/bits/types/siginfo_t.h: New system-dependent bits headers. * sysdeps/unix/sysv/linux/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/bits/siginfo-consts-arch.h * sysdeps/unix/sysv/linux/ia64/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/ia64/bits/siginfo-consts-arch.h * sysdeps/unix/sysv/linux/mips/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/sparc/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/tile/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/tile/bits/siginfo-consts-arch.h * sysdeps/unix/sysv/linux/x86/bits/siginfo-arch.h: New Linux-only system-dependent bits headers. * signal/bits/types/sig_atomic_t.h * signal/bits/types/sigset_t.h * signal/bits/types/sigval_t.h: New non-system-dependent bits headers. * sysdeps/generic/sigsetops.h * sysdeps/unix/sysv/linux/sigsetops.h: New internal headers. * include/bits/types/sig_atomic_t.h * include/bits/types/sigset_t.h * include/bits/types/sigval_t.h: New wrappers. * signal/sigsetops.h * bits/siginfo.h * bits/sigset.h * sysdeps/unix/sysv/linux/bits/siginfo.h * sysdeps/unix/sysv/linux/bits/sigset.h * sysdeps/unix/sysv/linux/ia64/bits/siginfo.h * sysdeps/unix/sysv/linux/mips/bits/siginfo.h * sysdeps/unix/sysv/linux/s390/bits/siginfo.h * sysdeps/unix/sysv/linux/sparc/bits/siginfo.h * sysdeps/unix/sysv/linux/tile/bits/siginfo.h * sysdeps/unix/sysv/linux/x86/bits/siginfo.h: Deleted. * signal/Makefile, sysdeps/unix/sysv/linux/Makefile: Update lists of installed headers. * posix/bits/types.h: Define __sig_atomic_t here. * signal/signal.h: Use the new bits headers; no need to handle __need_sig_atomic_t nor __need_sigset_t. Don't use __sigmask to define sigmask. * include/signal.h: No need to handle __need_sig_atomic_t nor __need_sigset_t. Don't define __sigemptyset. * io/sys/poll.h, setjmp/setjmp.h * sysdeps/arm/sys/ucontext.h, sysdeps/generic/sys/ucontext.h * sysdeps/i386/sys/ucontext.h, sysdeps/m68k/sys/ucontext.h * sysdeps/mach/hurd/i386/bits/sigcontext.h * sysdeps/mips/sys/ucontext.h, sysdeps/powerpc/novmxsetjmp.h * sysdeps/pthread/bits/sigthread.h * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h * sysdeps/unix/sysv/linux/mips/sys/ucontext.h * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h * sysdeps/unix/sysv/linux/s390/sys/ucontext.h * sysdeps/unix/sysv/linux/sh/sys/ucontext.h * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h * sysdeps/unix/sysv/linux/tile/sys/ucontext.h * sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Use bits/types/__sigset_t.h. * misc/sys/select.h, posix/spawn.h * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h * sysdeps/unix/sysv/linux/sys/epoll.h * sysdeps/unix/sysv/linux/sys/signalfd.h: Use bits/types/sigset_t.h. * resolv/netdb.h, rt/mqueue.h: Use bits/types/sigevent_t.h. * rt/aio.h: Use bits/types/sigevent_t.h and bits/sigevent-consts.h. * socket/sys/socket.h: Don't include bits/sigset.h. * login/utmp_file.c, shadow/lckpwdf.c, signal/sigandset.c * signal/sigisempty.c, stdlib/abort.c, sysdeps/posix/profil.c * sysdeps/posix/sigignore.c, sysdeps/posix/sigintr.c * sysdeps/posix/signal.c, sysdeps/posix/sigset.c * sysdeps/posix/sprofil.c, sysdeps/posix/sysv_signal.c * sysdeps/unix/sysv/linux/nptl-signals.h: Include sigsetops.h. * signal/sigaddset.c, signal/sigandset.c, signal/sigdelset.c * signal/sigorset.c, stdlib/abort.c, sysdeps/posix/sigignore.c * sysdeps/posix/signal.c, sysdeps/posix/sigset.c: __sigaddset, __sigandset, __sigdelset, __sigemptyset, __sigorset now return no value. * signal/sigaddset.c, signal/sigdelset.c, signal/sigismem.c Include <errno.h>, <signal.h>, and <sigsetops.h> instead of "sigsetops.h". * signal/sigsetops.c: Explicitly define __sigismember, __sigaddset, and __sigdelset as compatibility symbols. * signal/Versions: Correct commentary on __sigpause, __sigaddset, __sigdelset, __sigismember. * inet/rcmd.c: Include sigsetops.h. Convert old code using __sigblock/__sigsetmask to use __sigprocmask and friends.
* Remove __need_list_t and __need_res_state.Zack Weinberg2017-05-208-110/+135
| | | | | | | | | | | | | | | | | | | | | | | | | These __need macros are only used internally, by nptl/descr.h. However, including all of resolv.h from descr.h causes build failures due to resolv.h's dozens of pseudo-struct-field macros, some of which collide with struct fields in NPTL internal data structures. Similarly, including all of list.h from descr.h produces an include cycle, atomic.h -> atomic-machine.h -> tls.h -> descr.h -> list.h -> atomic.h, and then list.h tries to use atomic.h macros that haven't been defined yet. So we do need mini-headers for these. In the list.h case I called it include/list_t.h since it isn't going to be installed. * resolv/resolv.h: Remove __need_res_state logic. Move definition of res_state and related constants to ... * resolv/bits/types/res_state.h: ...this new file. * resolv/Makefile: Install bits/types/res_state.h. * include/bits/types/res_state.h: New wrapper. * include/list.h: Remove __need_list_t logic. Move definition of list_t to ... * include/list_t.h: ...this new file. * nptl/descr.h: Include list_t.h and bits/types/res_state.h instead of list.h and resolv.h.
* x86_64: Remove L(return_null) from rawmemchr.SH.J. Lu2017-05-202-5/+4
| | | | | | L(return_null) is unused. * sysdeps/x86_64/rawmemchr.S (L(return_null)): Removed.
* Remove sfi_* annotations from ARM assembly files.Zack Weinberg2017-05-2022-882/+460
| | | | | | | | | | | | | | | | | | | | | | This semi-mechanical patch removes all uses and definitions of the sfi_breg, sfi_pld, and sfi_sp macros from various ARM-specific assembly files. These were only used by NaCl. * sysdeps/arm/sysdep.h (ARM_SFI_MACROS, sfi_breg, sfi_pld, sfi_sp): Delete definitions. * sysdeps/arm/__longjmp.S, sysdeps/arm/add_n.S * sysdeps/arm/addmul_1.S, sysdeps/arm/arm-mcount.S * sysdeps/arm/armv6/rawmemchr.S, sysdeps/arm/armv6/strchr.S * sysdeps/arm/armv6/strcpy.S, sysdeps/arm/armv6/strlen.S * sysdeps/arm/armv6/strrchr.S, sysdeps/arm/armv6t2/memchr.S * sysdeps/arm/armv6t2/strlen.S * sysdeps/arm/armv7/multiarch/memcpy_impl.S * sysdeps/arm/armv7/strcmp.S, sysdeps/arm/dl-tlsdesc.S * sysdeps/arm/memcpy.S, sysdeps/arm/memmove.S * sysdeps/arm/memset.S, sysdeps/arm/setjmp.S * sysdeps/arm/strlen.S, sysdeps/arm/submul_1.S: Remove all uses of sfi_breg, sfi_pld, and sfi_sp.
* Remove the bulk of the NaCl port.Zack Weinberg2017-05-20152-8627/+10
| | | | | | | | | | | | | | | | The NaCl port has not been actively maintained since before the 2.25 release. The complementary GCC back-end was never contributed to GCC, and we are given to understand that the current NaCl SDK has switched to Clang and therefore cannot be used to build glibc anymore, so we doubt that the port remains useful. This commit simply removes the sysdeps/arm/nacl and sysdeps/nacl directories and the abi-tags entry. Remove the NaCl port. * abi-tags: Remove .*-.*-nacl.* entry. * sysdeps/arm/nacl: Remove directory and contents. * sysdeps/nacl: Likewise.
* manual: Convert errno @comments to new @errno macro.Rical Jasan2017-05-195-330/+326
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | errno.texi documents error macros, their values, and error strings in Texinfo @comments, some of which are also used for @standards. The purpose of this commit is to separate the standards from the error strings so that both the @standards conversion script picks up clean @standards and the errno documentation framework is improved. The error names, values, and messages are consolidated in a new custom macro, @errno. It is not clear that scripts within the sources rely on the special Texinfo @comment-based format to generate files used throughout the library, so the definition of @errno in macros.texi now provides a comment indicating the dependency. The dependent scripts are updated to use @errno, which also simplifies them a bit. The files those scripts generate were verified to be unchanged. The @errno macro is not visibly rendered in any way at this time, but it does use an @cindex command to add the error string to the Concept Index, to facilitate searching on error messages. * manual/errno.texi: Convert @comment-based errno documentation to @errno. * manual/macros.texi (@errno): New macro. Consolidate errors, their values, and messages, adding the error string to the Concept Index. Provide a warning in the comment about external (to the manual) dependencies. * sysdeps/gnu/errlist.awk: Use @errno instead of @comments. * sysdeps/mach/hurd/errnos.awk: Likewise.
* Split up bits/sigstack.h.Joseph Myers2017-05-1937-219/+306
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bits/sigstack.h contains four things: the legacy struct sigstack type, the preferred stack_t type, the SS_* enum values and macros for signal stack sizes. These vary in different ways between glibc configurations; in particular, the stack sizes vary much more than any of the other pieces. Furthermore, these pieces have different standard namespace rules for when they should be visible (not currently visible in conform/ results both because the relevant tests are XFAILed for sys/ucontext.h namespace issues, and because some of the expectations are incorrect in the same way as the headers, e.g. neither expectations nor headers reflect that current POSIX no longer has either the sigstack function or the sigstack structure). To reduce duplication of identical definitions, and facilitate namespace fixes without requiring the same feature test macro conditions to be repeated in many versions of the same header, this patch splits bits/sigstack.h up into four headers. It keeps the stack size macros, while new bits/types/struct_sigstack.h, bits/types/stack_t.h and bits/ss_flags.h are added for the other pieces. bits/types/struct_sigstack.h is the same everywhere, bits/types/stack_t.h has three variants different in the order of the structure elements (generic = MIPS Linux, and other Linux), and bits/ss_flags.h has generic and Linux variants. This patch includes the new headers everywhere that included <bits/sigstack.h>, so should cause no difference to what any public header defines. Subsequent namespace fixes would then remove or condition some of those includes. There should be no conflicts with Zack's changes to signal.h types, beyond the trivial conflict of both making additions to signal/Makefile's headers list; the two patches affect disjoint sets of types and other definitions. Tested for x86_64 and x86, and with build-many-glibcs.py. * bits/ss_flags.h: New file. * bits/types/stack_t.h: Likewise. * include/bits/types/struct_sigstack.h: Likewise. * signal/bits/types/struct_sigstack.h: Likewise. * sysdeps/unix/sysv/linux/bits/ss_flags.h: Likewise. * sysdeps/unix/sysv/linux/bits/types/stack_t.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h: Likewise. * signal/Makefile (headers): Add bits/types/struct_sigstack.h, bits/types/stack_t.h and bits/ss_flags.h. * signal/signal.h [__USE_XOPEN_EXTENDED || __USE_XOPEN2K8]: Include <bits/types/struct_sigstack.h>, <bits/types/stack_t.h> and <bits/ss_flags.h>. * bits/sigstack.h (struct sigstack): Remove. (stack_t): Likewise. (SS_ONSTACK): Likewise. (SS_DISABLE): Likewise. * sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h (struct sigstack): Likewise. (stack_t): Likewise. (SS_ONSTACK): Likewise. (SS_DISABLE): Likewise. * sysdeps/unix/sysv/linux/alpha/bits/sigstack.h (struct sigstack): Likewise. (stack_t): Likewise. (SS_ONSTACK): Likewise. (SS_DISABLE): Likewise. * sysdeps/unix/sysv/linux/bits/sigstack.h (struct sigstack): Likewise. (stack_t): Likewise. (SS_ONSTACK): Likewise. (SS_DISABLE): Likewise. * sysdeps/unix/sysv/linux/mips/bits/sigstack.h: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/sigstack.h (struct sigstack): Likewise. (stack_t): Likewise. (SS_ONSTACK): Likewise. (SS_DISABLE): Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h (struct sigstack): Likewise. (stack_t): Likewise. (SS_ONSTACK): Likewise. (SS_DISABLE): Likewise. * sysdeps/unix/sysv/linux/sparc/bits/sigstack.h (struct sigstack): Likewise. (stack_t): Likewise. (SS_ONSTACK): Likewise. (SS_DISABLE): Likewise. * sysdeps/arm/sys/ucontext.h: Include <bits/types/struct_sigstack.h>, <bits/types/stack_t.h> and <bits/ss_flags.h>. * sysdeps/generic/sys/ucontext.h: Likewise. * sysdeps/i386/sys/ucontext.h: Likewise. * sysdeps/m68k/sys/ucontext.h: Likewise. * sysdeps/mips/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h: Likewise. * sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Likewise.
* x86: Optimize SSE2 memchr overflow calculationH.J. Lu2017-05-193-16/+18
| | | | | | | | | | | | | | | | | | | | | | | SSE2 memchr computes "edx + ecx - 16" where ecx is less than 16. Use "edx - (16 - ecx)", instead of satured math, to avoid possible addition overflow. This replaces add %ecx, %edx sbb %eax, %eax or %eax, %edx sub $16, %edx with neg %ecx add $16, %ecx sub %ecx, %edx It is the same for x86_64, except for rcx/rdx, instead of ecx/edx. * sysdeps/i386/i686/multiarch/memchr-sse2.S (MEMCHR): Use "edx + ecx - 16" to avoid possible addition overflow. * sysdeps/x86_64/memchr.S (memchr): Likewise.
* Fix makefile rules for vmsplice, splice, and open_by_handle_atAdhemerval Zanella2017-05-193-3/+12
| | | | | | | | | | | | | | | | Commits ecade1c, afbbc18, and a5a34d2 added compiler flags for vmsplice, splice, and open_by_handle_at respectively on default misc/Makefile. However such symbols are build only for Linux and the rules should on linux Makefile only. Checked on x86_64-linux-gnu. * misc/Makefile (CFLAGS-vmsplice.c): Remove rule. (CFLAGS-splice.c): Likewise. (CFLAGS-open_by_handle_at.c): Likewise. * sysdeps/unix/sysv/linux/Makefile (CFLAGS-vmsplice.c): New rule. (CFLAGS-splice.c): Likewise. (CFLAGS-open_by_handle_at.c): Likewise.
* Also create and use ldbl-compat-choose.h.Joseph Myers2017-05-199-29/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes the glibc build generate an additional header ldbl-compat-choose.h that defines LONG_DOUBLE_COMPAT_CHOOSE_* macros for each libc and libm symbol, which select one or the other of their arguments based on whether the symbol was added before a change to long double != double. The effect of this is that it is then possible to define a macro maybe_long_double_symbol that automatically acts as either long_double_symbol or weak_alias depending on when the symbol being defined was added. This can be used when building long double functions from type-generic templates. Thus, with this patch ldbl-opt no longer needs special long double implementations of each new libm function added using such a template, and the existing such implementations are removed. This is a step towards being able more generally to use common macros to create all the aliases needed for a libm function, so reducing the amount of special-case code needed in ldbl-opt and ldbl-64-128, and facilitating subsequently adding *f32 / *f64 / *f128 / *f32x / *f64x aliases to existing functions (where the set of aliases that a function should have may depend on the architecture in various ways). Tested with build-many-glibcs.py. Except for on powerpc64le-linux-gnu, installed stripped shared libraries are unchanged by the patch. powerpc64le-linux-gnu is the unique configuration which used ldbl-opt from the start rather than adding a new long double choice after originally only having had long double = double. The effect of the patch there is that various cases that previously used long_double_symbol unconditionally now use weak_alias instead, so .os files contain e.g. a symbol cabsl instead of cabsl@@GLIBC_2.17. The final dynamic symbols and versions in the resulting shared libraries are unchanged (ABI tests pass), as is the disassembly of the shared libraries, but the differences in the .os files still result in different .gnu_hash contents in libm.so; the differences are of no significance and logically using weak_alias is what's most appropriate in those cases. * scripts/versions.awk: Generate ldbl-compat-choose.h. * sysdeps/ieee754/ldbl-opt/math-type-macros-ldouble.h: Include <ldbl-compat-choose.h>. (maybe_long_double_symbol): New macro. [!declare_mgen_alias] (declare_mgen_alias): Use maybe_long_double_symbol. * sysdeps/ieee754/ldbl-opt/s_canonicalizel.c: Remove. * sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_fminmagl.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_nextdownl.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_llogbl.c: Likewise. * Makerules [$(build-shared) = yes && !avoid-generated] (before-compile): Add $(common-objpfx)ldbl-compat-choose.h. [$(build-shared) = yes && !avoid-generated] ($(common-objpfx)ldbl-compat-choose.h): New target.
* Create and use first-versions.h with macros for function symbol versions.Joseph Myers2017-05-194-35/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch arranges for the glibc build to generate a header first-versions.h that defines macros for the earliest symbol version in which each public symbol (GLIBC_[0-9]* symbol version, name only uses C identifier characters) is available. This is used in sysdeps/ieee754/ldbl-opt/math-type-macros-double.h to replace the manually defined LDOUBLE_*_libm_version macros for various functions defined using type-generic templates, the purpose of which is to use in LONG_DOUBLE_COMPAT tests "was this function originally added before glibc supported long double != double on this platform?". As discussed in <https://sourceware.org/ml/libc-alpha/2016-12/msg00246.html>, I expect this to be useful more generally in reducing the amount of special-case code needed in ldbl-opt and ldbl-64-128. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch. * scripts/versions.awk: Generate first-versions.h. * sysdeps/ieee754/ldbl-opt/math-type-macros-double.h: Include <first-versions.h>. (LDOUBLE_cabsl_libm_version): Remove macro. (LDOUBLE_cargl_libm_version): Likewise. (LDOUBLE_cimagl_libm_version): Likewise. (LDOUBLE_conjl_libm_version): Likewise. (LDOUBLE_creall_libm_version): Likewise. (LDOUBLE_cacosl_libm_version): Likewise. (LDOUBLE_cacoshl_libm_version): Likewise. (LDOUBLE_ccosl_libm_version): Likewise. (LDOUBLE_ccoshl_libm_version): Likewise. (LDOUBLE_casinl_libm_version): Likewise. (LDOUBLE_csinl_libm_version): Likewise. (LDOUBLE_casinhl_libm_version): Likewise. (LDOUBLE_csinhl_libm_version): Likewise. (LDOUBLE_catanl_libm_version): Likewise. (LDOUBLE_catanhl_libm_version): Likewise. (LDOUBLE_ctanl_libm_version): Likewise. (LDOUBLE_ctanhl_libm_version): Likewise. (LDOUBLE_cexpl_libm_version): Likewise. (LDOUBLE_clogl_libm_version): Likewise. (LDOUBLE_cprojl_libm_version): Likewise. (LDOUBLE_csqrtl_libm_version): Likewise. (LDOUBLE_cpowl_libm_version): Likewise. (LDOUBLE_clog10l_libm_version): Likewise. (LDOUBLE___clog10l_libm_version): Likewise. (LDOUBLE_fdiml_libm_version): Likewise. (LDOUBLE_fmaxl_libm_version): Likewise. (LDOUBLE_fminl_libm_version): Likewise. (LDOUBLE_ilogbl_libm_version): Likewise. (LDOUBLE_nanl_libm_version): Likewise. [!M_LIBM_NEED_COMPAT] (M_LIBM_NEED_COMPAT): Use FIRST_VERSION_libm_* macros. [!declare_mgen_libm_compat] (declare_mgen_libm_compat): Likewise. * Makerules [$(build-shared) = yes && !avoid-generated] (before-compile): Add $(common-objpfx)first-versions.h. [$(build-shared) = yes && !avoid-generated] ($(common-objpfx)first-versions.h): New target. ($(common-objpfx)sysd-versions): Depend on and change to rule for building $(common-objpfx)versions.stmp.
* posix: Consolidate Linux mq_timedsend syscallAdhemerval Zanella2017-05-184-1/+39
| | | | | | | | | | | | | | | This patch consolidates the mq_timedsend Linux syscall generation on sysdeps/unix/sysv/linux/mq_timedsend.c. It basically removes it from architecture auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * rt/Makefile (CFLAGS-mq_timedsend.c): New flag. * sysdeps/unix/sysv/linux/mq_timedsend.c: New file. * sysdeps/unix/sysv/linux/syscalls.list (mq_timedsend): Remove from auto-generation list.
* posix: Consolidate Linux mq_timedreceive syscallAdhemerval Zanella2017-05-184-1/+40
| | | | | | | | | | | | | | | This patch consolidates the mq_timedreceive Linux syscall generation on sysdeps/unix/sysv/linux/mq_timedreceive.c. It basically removes it from architecture auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * rt/Makefile (CFLAGS-mq_timedreceive.c): New flag. * sysdeps/unix/sysv/linux/mq_timedreceive.c: New file. * sysdeps/unix/sysv/linux/syscalls.list (mq_timedreceive): Remove from auto-generation list.
* linux: Consolidate Linux open_by_handle_at syscallAdhemerval Zanella2017-05-185-2/+48
| | | | | | | | | | | | | | | | | | This patch consolidates the open_by_handle_at Linux syscall generation on sysdeps/unix/sysv/linux/open_by_handle_at.c. It basically removes it from architectures auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add open_by_handle_at. (CFLAGS-open_by_handle_at.c): New flag. * sysdeps/unix/sysv/linux/open_by_handle_at.c: New file. * sysdeps/unix/sysv/linux/syscalls.list (open_by_handle_at): New file. * misc/Makefile (CFLAGS-open_by_handle_at.c): New rule.
* linux: Consolidate Linux splice syscallAdhemerval Zanella2017-05-185-2/+36
| | | | | | | | | | | | | | | | | This patch consolidates the splice Linux syscall generation on sysdeps/unix/sysv/linux/splice.c. It basically removes it from architectures auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add splice. (CFLAGS-splice.c): New flag. * sysdeps/unix/sysv/linux/splice.c: New file. * sysdeps/unix/sysv/linux/syscalls.list (splice): Remove from auto-generation syscall list. * misc/Makefile (CFLAGS-splice.c): New rule.
* linux: Consolidate Linux vmsplice syscallAdhemerval Zanella2017-05-185-2/+35
| | | | | | | | | | | | | | | | This patch consolidates the vmsplice Linux syscall generation on sysdeps/unix/sysv/linux/vmsplice.c. It basically removes it from architectures auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/Makefile (CFLAGS-vmsplice.c): New flag. * sysdeps/unix/sysv/linux/syscalls.list (vmsplice): Remove from auto-generation syscall list. * sysdeps/unix/sysv/linux/vmsplice.c: New file. * misc/Makefile (CFLAGS-vmsplice.c): New rule.
* posix: Consolidate Linux fsync syscallAdhemerval Zanella2017-05-186-2/+38
| | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the fsync Linux syscall generation on sysdeps/unix/sysv/linux/fsync.c. It basically removes it from architectures auto-generation list. For arm it also removes the __errno_location call since fsync is not called with SYSCALL_CANCEL with call arch-specific INLINE_SYSCALL macro which in turn will call __set_errno macro (and setting errno directly). Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * misc/Makefile (CFLAGS-fsync.c): New flag. * nptl/Makefile (CFLAGS-fsync.c): Likewise. * sysdeps/unix/syscalls.list (fsync): Remove from auto-generation syscall list. * sysdeps/unix/sysv/linux/fsync.c: New file. * sysdeps/unix/sysv/linux/arm/localplt.data [libpthread.so] (__errno_location): Remove.
* posix: Consolidate Linux fdatasync syscallAdhemerval Zanella2017-05-185-1/+37
| | | | | | | | | | | | | | | | This patch consolidates the fdatasync Linux syscall generation on sysdeps/unix/sysv/linux/fdatasync.c. It basically removes it from architectures auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * misc/makefile (CFLAGS-datasync.c): New flag. * nptl/makefile (CFLAGS-datasync.c): Likewise. * sysdeps/unix/sysv/linux/syscalls.list (fdatasync): Remove from auto-generation syscall list. * sysdeps/unix/sysv/linux/fdatasync.c: New file.
* posix: Consolidate Linux msync syscallAdhemerval Zanella2017-05-185-1/+33
| | | | | | | | | | | | | | | This patch consolidates the msync Linux syscall generation on sysdeps/unix/sysv/linux/msync.c. It basically removes it from architectures auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * misc/Makefile (CFLAGS-msync.c): New rule. * nptl/Makefile (CFLAGS-msync.c): Likewise. * sysdeps/unix/syscalls.list: Remove msync from auto-generation list. * sysdeps/unix/sysv/linux/msync.c: New file.
* posix: Consolidate Linux sigsuspend implementationAdhemerval Zanella2017-05-185-40/+7
| | | | | | | | | | | | | | | | | | | | This patch consolidates the sigsuspend Linux syscall generation on sysdeps/unix/sysv/linux/sigsuspend.c. It basically removes the alpha assembly version which call the old sigsusped interface using only the first doubleword from sigset. Current minimum supported kernel on alpha (3.2) enforces rt_sigsuspend on the architecture (__ARCH_WANT_SYS_RT_SIGSUSPEND option on kernel), so it is possible to use the default implementation. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/alpha/sigsuspend.S: Remove file. * sysdeps/unix/sysv/linux/sigsuspend.c: Simplify include list. * nptl/Makefile (CFLAGS-sigsuspend.c): New rule. * sysdeps/unix/sysv/linux/sparc/sparc64/Makefile (CFLAGS-sigsuspend.c): Remove rule.
* linux: Consolidate Linux tee implementationAdhemerval Zanella2017-05-184-2/+34
| | | | | | | | | | | | | | | | This patch consolidates the tee Linux syscall generation on sysdeps/unix/sysv/linux/tee.c. It basically removes it from architectures auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/Makefile (sysdeps_routines): Add tee. (CFLAGS-tee.c): New rule. * sysdeps/unix/sysv/linux/syscalls.list: Remove tee from auto-generated list. * sysdeps/unix/sysv/linux/tee.c: New file.
* posix: Consolidate Linux nanosleep syscallAdhemerval Zanella2017-05-185-1/+38
| | | | | | | | | | | | | | | | This patch consolidates the nanosleep Linux syscall generation on sysdeps/unix/sysv/linux/nanosleep.c. It basically removes it from architectures auto-generation list. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * nptl/Makefile (CFLAGS-nanosleep.c): New rule. * posix/Makefile (CFLAGS-nanosleep.c): Likewise. * sysdeps/unix/sysv/linux/nanosleep.c: New file. * sysdeps/unix/sysv/linux/syscalls.list: Remove nanosleep from auto-generated list.
* posix: Consolidate Linux waitpid syscallAdhemerval Zanella2017-05-187-28/+8
| | | | | | | | | | | | | | | | | | This patch consolidates the waitpid Linux syscall generation on sysdeps/unix/sysv/linux/waitpid.c. It basically removes it from architecture auto-generation list and also remove arch specific implementations. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/sh/syscalls.list: Remove waitpid from auto-generated list. * sysdeps/unix/sysv/linux/m68k/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/syscalls.list: Remove file. * sysdeps/unix/sysv/linux/tile/waitpid.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/syscalls.list: Likewise.
* posix: Consolidate Linux pause syscallAdhemerval Zanella2017-05-187-23/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the pause Linux implementation on sysdeps/unix/sysv/linux/pause.c. If defined the pause syscall (__NR_pause) will be used, other ppoll with 0 arguments will be used instead. It has the small advantage of generic pause implementation with uses rt_sigprocmask plus rt_sigsuspend because it requires only one syscall and the pause is done atomically regarding signal handling (for instance, pause may not be interrupted if the signal arrives between the rt_sigprocmask and rt_sigsuspend syscall). Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/generic/pause.c: Remove file. * sysdeps/unix/sysv/linux/sparc/sparc64/pause.c: Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h [__arch64__] (__NR_pause): Undefine. * sysdeps/unix/sysv/linux/pause.c: New file. * sysdeps/unix/sysv/linux/syscalls.list: Remove pause from auto-generation list.
* Correct comments in x86_64/multiarch/memcmp.SH.J. Lu2017-05-182-3/+8
| | | | | * sysdeps/x86_64/multiarch/memcmp.S (__GI_memcmp): Correct comments.
* Reduce value of LD_HWCAP_MASK for tst-env-setuid test caseSiddhesh Poyarekar2017-05-192-1/+6
| | | | | | | | | | | | | | | It was discovered that the dynamic linker allocates a massive amount of memory that increases with the value of LD_HWCAP_MASK. Due to this, setting its value to 0xffffffff in the environment of tst-env-setuid would cause it to fail in some environments where overcommit was disabled or severely constrained because malloc would fail. Since this test is only concerned with the value of LD_HWCAP_MASK envvar being conserved (or not, for setxid binaries), lower its value to avoid spurious failures. The allocation bug is reported as #21502.
* manual: Convert @tables of annotated @items to @vtables.Rical Jasan2017-05-186-32/+41
| | | | | | | | | | | | | | | | | The conversion script will convert these annotations, but the replacement Summary-generation script won't catch them because @items in @tables are not generally considered annotatable, causing them to be skipped over (or cause errors). Using @vtable ensures their continued presence in the Summary, with the added benefit that Texinfo will also automatically include them in the Variable and Constant Macro index now. * manual/conf.texi: Convert @tables of annotated @items to @vtables. * manual/lang.texi: Likewise. * manual/pattern.texi: Likewise. * manual/resource.texi: Likewise. * manual/socket.texi: Likewise.
* manual: Fix up invalid header and standards syntax.Rical Jasan2017-05-187-13/+23
| | | | | | | | | | | | | | | This commit handles exceptional cases of invalid syntax for the @standards conversion script. * manual/crypt.texi: Move a comment out of an @*x list. * manual/filesys.texi: Refactor some comments, one of which looks like a standard. Fix incorrectly separated standards. * manual/locale.texi: Invert an annotation. * manual/resource.texi: Fix incorrectly separated standards. * manual/time.texi: Refactor a @vtable that obscures an annotation. * manual/users.texi: Refactor multiple headers to occupy a single @comment.
* powerpc: Improve memcmp performance for POWER8Rajalakshmi Srinivasaraghavan2017-05-186-2/+1494
| | | | | Vectorization improves performance over the current implementation. Tested on powerpc64 and powerpc64le.
* float128: Extend __MATH_TG for float128 supportGabriel F. T. Gomes2017-05-173-0/+44
| | | | | | * math/math.h (__MATH_TG): Extend the conditions to add _Float128 support. * misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): New macro.
* powerpc: Add a POWER8-optimized version of cosf()Paul Clarke2017-05-176-1/+603
| | | | | | | | | | | | | This implementation is based on the one already used at sysdeps/powerpc/powerpc64/fpu/multiarch/s_sinf-power8.S. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile [$(subdir) = math] (libm-sysdep_routines): Add s_cosf-power8 and s_cosf-ppc64. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_cosf-power8.S: New file. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_cosf-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_cosf.c: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Likewise.