about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* Fix typo in last ChangeLog message.Joseph Myers2016-12-071-1/+2
|
* Fix hypot sNaN handling (bug 20940).Joseph Myers2016-12-079-10/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 generally defines libm functions taking sNaN arguments to return qNaN and raise "invalid", even for the cases where a corresponding qNaN argument would not result in a qNaN return. This includes hypot with one argument being an infinity and the other being an sNaN. This patch duly fixes hypot implementatations in glibc (generic and powerpc) to ensure qNaN, computed by arithmetic on the arguments, is returned in that case. Various implementations do their checks for infinities and NaNs inline by manipulating the representations of the arguments. For simplicity, this patch just uses issignaling to check for sNaN arguments. This could be inlined like the existing code (with due care about reversed quiet NaN conventions, for implementations where that is relevant), but given that all these checks are in cases where it's already known at least one argument is not finite, which should be the uncommon case, that doesn't seem worthwhile unless performance issues are observed in practice. Tested for x86_64, x86, mips64 and powerpc. [BZ #20940] * sysdeps/ieee754/dbl-64/e_hypot.c (__ieee754_hypot): Do not return Inf for arguments Inf and sNaN. * sysdeps/ieee754/flt-32/e_hypotf.c (__ieee754_hypotf): Likewise. * sysdeps/ieee754/ldbl-128/e_hypotl.c (__ieee754_hypotl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_hypotl.c (__ieee754_hypotl): Likewise. * sysdeps/ieee754/ldbl-96/e_hypotl.c (__ieee754_hypotl): Likewise. * sysdeps/powerpc/fpu/e_hypot.c (TEST_INF_NAN): Do not return Inf for arguments Inf and sNaN. When returning a NaN, compute it by arithmetic on the arguments. * sysdeps/powerpc/fpu/e_hypotf.c (TEST_INF_NAN): Likewise. * math/libm-test.inc (pow_test_data): Add tests of sNaN arguments.
* Fix x86_64/x86 powl handling of sNaN arguments (bug 20916).Joseph Myers2016-12-064-10/+109
| | | | | | | | | | | | | | | | | | | | | | | | | The x86_64/x86 powl implementations mishandle sNaN arguments, both by returning sNaN in some cases (instead of doing arithmetic on the arguments to produce the result when NaN arguments result in NaN results) and by treating sNaN the same as qNaN for arguments (1, sNaN) and (sNaN, 0), contrary to TS 18661-1 which requires those cases to return qNaN instead of 1. This patch makes the x86_64/x86 powl implementations follow TS 18661-1 semantics for sNaN arguments; sNaN tests are also added for pow. Given the problems with testing float and double sNaN arguments on 32-bit x86 (sNaN tests disabled because the compiler may convert unnecessarily to a qNaN when passing arguments), no changes are made to the powf and pow implementations there. Tested for x86_64 and x86. [BZ #20916] * sysdeps/i386/fpu/e_powl.S (__ieee754_powl): Do not return 1 for arguments (sNaN, 0) or (1, sNaN). Do arithmetic on NaN arguments to compute result. * sysdeps/x86_64/fpu/e_powl.S (__ieee754_powl): Likewise. * math/libm-test.inc (pow_test_data): Add tests of sNaN arguments.
* Use C11-like atomics instead of plain memory accesses in x86 lock elision.Torvald Riegel2016-12-055-30/+82
| | | | | | | | | | | | | | | | | This uses atomic operations to access lock elision metadata that is accessed concurrently (ie, adapt_count fields). The size of the data is less than a word but accessed only with atomic loads and stores; therefore, we add support for shorter-size atomic load and stores too. * include/atomic.h (__atomic_check_size_ls): New. (atomic_load_relaxed, atomic_load_acquire, atomic_store_relaxed, atomic_store_release): Use it. * sysdeps/x86/elide.h (ACCESS_ONCE): Remove. (elision_adapt, ELIDE_LOCK): Use atomics. * sysdeps/unix/sysv/linux/x86/elision-lock.c (__lll_lock_elision): Use atomics and improve code comments. * sysdeps/unix/sysv/linux/x86/elision-trylock.c (__lll_trylock_elision): Likewise.
* hurd: fix using hurd.h in C++ programsSamuel Thibault2016-12-042-3/+8
| | | | | * hurd/hurd.h: Cast errno constants to error_t to fix usage in C++ programs.
* Fix sysdeps/ieee754 pow handling of sNaN arguments (bug 20916).Joseph Myers2016-12-025-11/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | Various pow function implementations mishandle sNaN arguments in various ways. This includes returning sNaN instead of qNaN for sNaN arguments. For arguments (1, sNaN) and (sNaN, 0), TS 18661-1 semantics are also that the result should be qNaN, whereas with a qNaN argument there the result should be 1, but for the dbl-64 implementation of pow there are issues with sNaN arguments beyond not implementing the TS 18661-1 semantics in those special cases. This patch makes the implementations in sysdeps/ieee754 follow the TS 18661-1 semantics consistently. Because x86 / x86_64 implementations still need fixing, testcases are not included with this patch; they will be included with the fix for the x86 / x86_64 versions. Tested for x86_64, x86, mips64 and powerpc (with such testcases, which pass in the mips64 and powerpc cases). [BZ #20916] * sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Do not return 1 for arguments (sNaN, 0) or (1, sNaN). Do arithmetic on NaN arguments to compute result. * sysdeps/ieee754/flt-32/e_powf.c (__ieee754_powf): Do not return 1 for arguments (sNaN, 0) or (1, sNaN). * sysdeps/ieee754/ldbl-128/e_powl.c (__ieee754_powl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_powl.c (__ieee754_powl): Likewise.
* Fix pow (qNaN, 0) result with -lieee (bug 20919), remove dead parts of wrappers.Joseph Myers2016-12-026-88/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dbl-64 implementation of __ieee754_pow returns a NaN for pow (qNaN, 0) when it should return 1. Normally this is covered up by the wrappers ending up calling __kernel_standard which fixes up the result for this case, but for -lieee the wrappers are bypassed and the bad result gets through as a return value. Now, the wrappers fixing this are dealing with variant error handling that wants a result of NaN for pow (qNaN, 0), and only ever call __kernel_standard for this case if NaN resulted from __ieee754_pow. This leads to a question of whether the dbl-64 code might be deliberately returning NaN in order to use those code paths. However, I can find no sign that this is deliberate. If it were deliberate one would expect other implementations to do the same, and would expect the return of NaN to be very old, but it appears it came in by accident when the present e_pow.c implementation replaced an fdlibm implementation in 2001. So it appears to be unintended that this path through the pow wrapper could be used at all. So this patch fixes the implementation to return 1 in this case as expected. This is consistent with all the other implementations. The relevant path through the wrappers is now unreachable, so is removed (which is the main motivation of this patch: to avoid that path becoming accidentally reachable when implementing TS 18661-1 semantics that pow (sNaN, 0) should return qNaN with "invalid" raised). Another path that would require __ieee754_pow (0, 0) to return 0 is also unreachable (as all implementations return 1, in accordance with C99 semantics), so is removed as well. Note: we don't have anything set up to test -lieee, which in any case is obsolescent (at some point we should remove the ability for new programs to access _LIB_VERSION or define matherr and have it called by glibc). So testing will be implicit through sNaN tests added when making sNaN inputs work correctly for pow functions. Tested for x86_64 and x86. [BZ #20919] * sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Do not return NaN first argument when raised to power 0. * math/w_pow.c (__pow): Do not check for NaN or zero results from raising to power zero. * math/w_powf.c (__powf): Likewise. * math/w_powl.c (__powl): Likewise. * sysdeps/ieee754/k_standard.c (__kernel_standard): Do not handle pow (0, 0) or pow (NaN, 0).
* Bug 20918 - Building with --enable-nss-crypt fails tst-linkall-staticCarlos O'Donell2016-12-026-2/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some configurations may use NSS cryptographic routines but have no static library for those routines. The following changes allow glibc to be built and tested with --enable-nss-crypt, but without having a static NSS library. At a high level the change does two things: (1) Detect at configure time if static NSS crypto libraries are available. Assumes libfreebl3.a (instead of the existing Fedora libfreebl.a which is incomplete) which matches libfreebl3.so. (2) If static NSS crypto libraries are _not_ available then adjust the way in which we build tst-linkall-static. This includes excluding a reference to crypt and not linking against libcrypt.a, all of which will fail otherwise. Testing assumptions: * Static library is named libfreebl3.a (not libfreebl.a as is currently provided in Fedora), matching libfreebl3.so shared link name. Tested on x86_64 on Fedora with: (a) --enable-nss-crypt, with no static NSS library support: PASS (previous FAIL) (b) --enable-nss-crypt, with faked static NSS library support: PASS (unsupported) * Requires changing elf/Makefile to include a stub /lib64/libfreebl3.a for testing purposes. (c) --disable-nss-crypt: PASS (default) No regressions on x86_64. For details see: https://www.sourceware.org/ml/libc-alpha/2016-11/msg00647.html
* elf/tst-tls-manydynamic: New testFlorian Weimer2016-12-025-2/+259
| | | | | This test adds coverage for creating many dynamic TLS variables which exhaust the static TLS allocation.
* aarch64: Use explicit offsets in _dl_tlsdesc_dynamicFlorian Weimer2016-12-023-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 389d1f1b232b3d6b9d73ee2c50e543ace6675621 (“Partial ILP32 support for aarch64”) broke dynamic TLS support because a load offset changed: 0000000000000030 <_dl_tlsdesc_dynamic>: 30: a9bc7bfd stp x29, x30, [sp,#-64]! 34: 910003fd mov x29, sp 38: a9020be1 stp x1, x2, [sp,#32] 3c: a90313e3 stp x3, x4, [sp,#48] 40: d53bd044 mrs x4, tpidr_el0 44: c8dffc1f ldar xzr, [x0] 48: f9400401 ldr x1, [x0,#8] 4c: f9400080 ldr x0, [x4] 50: f9400823 ldr x3, [x1,#16] 54: f9400002 ldr x2, [x0] 58: eb02007f cmp x3, x2 5c: 540001a8 b.hi 90 <_dl_tlsdesc_dynamic+0x60> 60: f9400022 ldr x2, [x1] 64: 8b021000 add x0, x0, x2, lsl #4 68: f9400000 ldr x0, [x0] 6c: b100041f cmn x0, #0x1 70: 54000100 b.eq 90 <_dl_tlsdesc_dynamic+0x60> - 74: f9400421 ldr x1, [x1,#8] + 74: f9400821 ldr x1, [x1,#16] 78: 8b010000 add x0, x0, x1 … This commit introduces explicit struct offsets, generated from the C headers, fixing the regression.
* S390: Regenerate ULPs.Stefan Liebler2016-12-022-6/+10
| | | | | | | | Updated ulps file. ChangeLog: * sysdeps/s390/fpu/libm-test-ulps: Regenerated.
* Fix new testcase elf/tst-latepthread on s390x.Stefan Liebler2016-12-022-0/+8
| | | | | | | | | | | | | | | | | | | | | The first dlopen ("tst-latepthreadmod.so", RTLD_LOCAL | RTLD_LAZY) call in elf/tst-latepthread.c fails on s390x with "error: dlopen failed: .../build-s390x/elf/tst-latepthreadmod.so: undefined symbol: this_function_is_not_defined". In elf/tst-latepthreadmod.c, this_function_is_not_defined is a sibling call which leads to a R_390_GLOB_DAT relocation in .rela.dyn instead of a R_390_JMP_SLOT in .rela.plt. As RTLD_LAZY skips the JMP_SLOT relocations, but not GLOB_DAT ones, the dlopen call fails. If elf/tst-latepthreadmod.c is build with -fno-optimize-sibling-calls, a JMP_SLOT relocation is generated for this_function_is_not_defined and the test passes. ChangeLog: * elf/Makefile (CFLAGS-tst-latepthreadmod.c): Add -fno-optimize-sibling-calls.
* Add llogb, llogbf, llogbl.Joseph Myers2016-12-0244-8/+398
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines llogb functions that are like ilogb except that they return long int instead of int. Corresponding FP_LLOGB* macros are defined, whose values are required to have the obvious correspondence to those of the FP_ILOGB* macros. This patch implements these functions and macros for glibc. llogb uses the type-generic infrastructure, with an implementation similar to the wrapper for ilogb but with additional conversion from FP_ILOGB* to FP_LLOGB*; this approach avoids needing to modify or duplicate any of the architecture-specific ilogb implementations. Tests are also based on those for ilogb. Ideally the llogb functions would alias the ilogb ones when long is 32-bit, but such aliasing requires the associated header declarations of the different-type alias to be hidden, typically by defining macros before including the header (see e.g. how sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c defines lround to __hidden_lround before including <math.h>). The infrastructure for type-generic function implementations does not support defining such macros at present (since C code can't define a macro whose name is determined by other macros). So this patch leaves them as separate functions (similar to e.g. scalbln and scalbn being separate in such a case as well), but with the remapping of FP_ILOGB* to FP_LLOGB* conditioned out in the case where it would be the identity map. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (llogb): New declaration. * math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (llogb): New macro. * math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (__FP_LONG_MAX): New macro. [__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_LLOGB0): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_LLOGBNAN): Likewise. * math/Versions (llogb): New libm symbol at version GLIBC_2.25. (llogbf): Likewise. (llogbl): Likewise. * math/Makefile (gen-libm-calls): Add w_llogbF. (tests): Add test-fp-llogb-constants. * math/w_llogb_template.c: New file. Based on math/w_ilogb_template.c. * math/libm-test.inc (llogb_test_data): New array. (llogb_test): New function. (main): Call llogb_test. * math/test-fp-llogb-constants.c: New file. Based on math/test-fp-ilogb-constants.c. * math/test-tgmath-ret.c (llogb): New CHECK_RET_CONST call. (do_test): Call check_return_llogb. * math/test-tgmath.c (NCALLS): Increase to 126. (F(compile_test)): Call llogb. (F(llogb)): New function. * manual/math.texi (Exponents and Logarithms): Document llogb, llogbf, llogbl, FP_LLOGB0 and FP_LLOGBNAN. * manual/libm-err-tab.pl (@all_functions): Add llogb. * sysdeps/ieee754/ldbl-opt/nldbl-llogb.c: New file. * sysdeps/ieee754/ldbl-opt/w_llogbl.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add llogb. (CFLAGS-nldbl-llogb.c): New variable. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Make ldbl-128 getpayload, setpayload functions use _Float128.Joseph Myers2016-12-013-4/+8
| | | | | | | | | | | | | When I added the getpayload and setpayload functions I failed to make the ldbl-128 functions use the _Float128 type name like most other ldbl-128 functions do in preparation for being used to implement *f128 functions. This patch fixes them to use that name. Tested for mips64. * sysdeps/ieee754/ldbl-128/s_getpayloadl.c (getpayloadl): Use _Float128 instead of long double. * sysdeps/ieee754/ldbl-128/s_setpayloadl_main.c (FUNC): Likewise.
* Add missing hidden_def (__sigsetjmp).Joseph Myers2016-12-0110-0/+22
| | | | | | | | | | | | | | | | | | | This patch adds the missing hidden_def (__sigsetjmp) on various architectures that were failing to build (as noted in <https://sourceware.org/ml/libc-alpha/2016-11/msg01124.html>). Tested (compilation only) with build-many-glibcs.py. * sysdeps/alpha/setjmp.S (__sigsetjmp): Use hidden_def. * sysdeps/hppa/setjmp.S (__sigsetjmp): Likewise. * sysdeps/mips/mips64/setjmp.S (__sigsetjmp): Likewise. * sysdeps/mips/setjmp.S (__sigsetjmp): Likewise. * sysdeps/sh/sh3/setjmp.S (__sigsetjmp): Likewise. * sysdeps/sh/sh4/setjmp.S (__sigsetjmp): Likewise. * sysdeps/sparc/sparc32/setjmp.S (__sigsetjmp): Likewise. * sysdeps/tile/setjmp.S (__sigsetjmp): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S (__sigsetjmp): Likewise.
* powerpc: Remove stpcpy internal clash with IFUNCAdhemerval Zanella2016-12-012-3/+8
| | | | | | | | | | | | | | | | | | | | | Commit c7debbdfacb redirected the internal strrch to default powerpc64 implementation by redefining the weak_alias at sysdeps/powerpc/powerpc64/multiarch/strchr-ppc64.c: #undef weak_alias #define weak_alias(name, aliasname) \ extern __typeof (__strrchr_ppc) aliasname \ __attribute__ ((weak, alias ("__strrchr_ppc"))); This creates a __GI_strchr alias that clashes with the IFUNC symbol in stprchr.os. There is not need to define the default version for internal version, since ifunc should work internally for powerpc64. This patch removes the weak_alias indirection. Checked on powerpc64le. * sysdeps/powerpc/powerpc64/multiarch/strrchr-ppc64.c (weak_alias): Remove redirection to __strrchr_ppc.
* powerpc: strcmp optimization for power9Rajalakshmi Srinivasaraghavan2016-12-016-1/+337
| | | | | | | Vectorized loops are used for strings > 32B when compared to power8 optimization. Tested on power9 ppc64le simulator.
* Refactor FP_ILOGB* out of bits/mathdef.h.Joseph Myers2016-12-0117-105/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the refactoring of bits/mathdef.h, this patch stops it defining FP_ILOGB0 and FP_ILOGBNAN, moving the required information to a new header bits/fp-logb.h. There are only two possible values of each of those macros permitted by ISO C. TS 18661-1 adds corresponding macros for llogb, and their values are required to correspond to those of the ilogb macros in the obvious way. Thus two boolean values - for which the same choices are correct for most architectures - suffice to determine the value of all these macros, and by defining macros for those boolean values in bits/fp-logb.h we can then define the public FP_* macros in math.h and avoid the present duplication of the associated feature test macro logic. This patch duly moves to bits/fp-logb.h defining __FP_LOGB0_IS_MIN and __FP_LOGBNAN_IS_MIN. Default definitions of those to 0 are correct for both architectures, while ia64, m68k and x86 get their own versions of bits/fp-logb.h to reflect their use of values different from the defaults. The patch renders many copies of bits/mathdef.h trivial (needed only to avoid the default __NO_LONG_DOUBLE_MATH). I'll revise <https://sourceware.org/ml/libc-alpha/2016-11/msg00865.html> accordingly so that it removes all bits/mathdef.h headers except the default one and the alpha one, and arranges for the header to be included only by complex.h as the only remaining use at that point will be for the alpha ABI issues there. Tested for x86_64 and x86. Also did compile-only testing with build-many-glibcs.py (using glibc sources from before the commit that introduced many build failures with undefined __GI___sigsetjmp). * bits/fp-logb.h: New file. * sysdeps/ia64/bits/fp-logb.h: Likewise. * sysdeps/m68k/m680x0/bits/fp-logb.h: Likewise. * sysdeps/x86/bits/fp-logb.h: Likewise. * math/Makefile (headers): Add bits/fp-logb.h. * math/math.h: Include <bits/fp-logb.h>. [__USE_ISOC99] (FP_ILOGB0): Define based on __FP_LOGB0_IS_MIN. [__USE_ISOC99] (FP_ILOGBNAN): Define based on __FP_LOGBNAN_IS_MIN. * bits/mathdef.h (FP_ILOGB0): Remove. (FP_ILOGBNAN): Likewise. * sysdeps/aarch64/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/alpha/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/ia64/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/m68k/m680x0/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/mips/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/powerpc/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/s390/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/sparc/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/x86/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise.
* Make build-many-glibcs.py support running as a bot.Joseph Myers2016-12-012-11/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes build-many-glibcs.py support a "bot" action, for repeatedly running a checkout and build cycle. Two new configuration variables are used in bot-config.json. "delay" indicates the time to sleep after each bot-cycle round (regardless of whether that round actually ran any builds); "run" is a boolean, which is false if the bot should just exit (the point of this is that you can edit bot-config.json to set this to false to cause a running bot to exit cleanly between builds) and true if the bot should run. The bot does not exit if the bot-cycle process exits with error status (that can occur when sourceware's load limiting means anonymous version control access fails, for example), just sleeps until it's time to try again. The script is changed to flush stdout before running a subprocess in bot-cycle, so that when output is redirected (as expected for a bot) the status messages from bot-cycle appear in their proper position in its redirected output relative to the output from the subprocesses run, and to copy the logs directory before running builds in bot-cycle so that the logs from at least one complete build are always available for looking at how something failed, even while the next build is running. * scripts/build-many-glibcs.py: Add bot to usage message. Import time module. (Context.__init__): Initialize self.logsdir_old. (Context.run_builds): Handle bot action. (Context.bot_cycle): Copy logs directory before running builds. (Context.bot_run_self): Take argument for whether to check subprocess result. Flush stdout before running subprocess. (Context.bot): New function. (get_parser): Allow bot action.
* Add build-many-glibcs.py bot-cycle action.Joseph Myers2016-11-302-9/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch continues the process of setting up build-many-glibcs.py to run as a bot monitoring for and reporting on build issues by adding a bot-cycle action to the script. When this action is used, it will run the checkout action (re-execing itself if it was changed by that action), then rebuild whichever of host-libraries, compilers, glibcs should be rebuilt based on changed versions, time elapsed and state of previous builds. Email is sent with the results of the build (for each build action done). The rebuild logic is: if previous build time or versions aren't recorded, rebuild that component. If the script has changed, rebuild everything. If any relevant component version has changed, rebuild, except for not rebuilding compilers if the time indicated in the bot configuration has not passed since the last build of the compilers. If one piece is rebuilt then rebuild subsequent pieces as well. Using bot-cycle requires a configuration file bot-config.json in the toplevel directory used by build-many-glibcs.py. It might contain e.g. { "compilers-rebuild-delay": 604800, "email-from": "Example Name <user@example.org>", "email-server": "localhost", "email-subject": "GCC 6 %(action)s %(build-time)s build results", "email-to": "libc-testresults@sourceware.org" } My next intended step is adding a further action "bot" which loops running bot-cycle then sleeping for an amount of time given in bot-config.json. Then I'll set up a bot using that action (building with GCC 6 branch; a bot using GCC mainline may wait until the SH out-of-memory issues <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78460> are fixed; I expect the bot to mail to me until it seems ready to switch to mailing to gcc-testresults). * scripts/build-many-glibcs.py: Add bot-cycle to usage message. Import email.mime.text, email.utils and smtplib modules. (Context.__init__): Initialize self.bot_config_json. (Context.run_builds): Handle bot-cycle action. (Context.load_bot_config_json): New function. (Context.part_build_old): Likewise. (Context.bot_cycle): Likewise. (Context.bot_build_mail): Likewise. (Context.bot_run_self): Likewise. (get_parser): Allow bot-cycle action.
* powerpc: Remove stpcpy internal clash with IFUNCAdhemerval Zanella2016-11-302-3/+6
| | | | | | | | | | | | | | | | | | | | | Commit 142e0a99530 redirected the internal stpcpy to default powerpc64 implementation by redefining the weak_alias at sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.c: #undef weak_alias #define weak_alias(name, aliasname) \ extern __typeof (__stpcpy_ppc) aliasname \ __attribute__ ((weak, alias ("__stpcpy_ppc"))); This creates a __GI_stpcpy alias that clashes with the IFUNC symbol in stpcpy.os. There is not need to define the default version for internal version, since ifunc should work internally for powerpc64. This patch removes the weak_alias indirection. Checked on powerpc64le. * sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.c (weak_alias): Remove redirection to __stpcpy_ppc.
* ld.so: Remove __libc_memalignFlorian Weimer2016-11-3048-119/+106
| | | | | | | It is no longer needed since commit 6c444ad6e953dbdf9c7be065308a0a777 (elf: Do not use memalign for TCB/TLS blocks allocation [BZ #17730]). Applications do not link against ld.so and will use the definition in libc.so, so there is no ABI impact.
* Implement _dl_catch_error, _dl_signal_error in libc.so [BZ #16628]Florian Weimer2016-11-3037-315/+595
| | | | | | | | | | | | | | | | | | This change moves the main implementation of _dl_catch_error, _dl_signal_error to libc.so, where TLS variables can be used directly. This removes a writable function pointer from the rtld_global variable. For use during initial relocation, minimal implementations of these functions are provided in ld.so. These are eventually interposed by the libc.so implementations. This is implemented by compiling elf/dl-error-skeleton.c twice, via elf/dl-error.c and elf/dl-error-minimal.c. As a side effect of this change, the static version of dl-error.c no longer includes support for the _dl_signal_cerror/_dl_receive_error mechanism because it is only used in ld.so.
* libio: Limit buffer size to 8192 bytes [BZ #4099]Florian Weimer2016-11-303-1/+13
| | | | | This avoids overly large buffers with network file systems which report very large block sizes.
* Remove out of date PROJECTS file.Carlos O'Donell2016-11-302-107/+4
| | | | | Developers should use: https://sourceware.org/glibc/wiki/Development_Todo/Master
* gconv: Adjust GBK to support the Euro signFlorian Weimer2016-11-292-2/+19
| | | | | Commit aa4d00ca39e604ac4e9fead401ccd4483e11a281 only updated the data used by locales.
* Use XSTAT_IS_XSTAT64 in generic xstat functionsSteve Ellcey2016-11-299-0/+124
| | | | | | | | | | | | | | | | | * sysdeps/unix/sysv/linux/generic/wordsize-32/fxstat.c: Do not define fxstat if XSTAT_IS_XSTAT64 is set to non-zero. * sysdeps/unix/sysv/linux/generic/wordsize-32/fxstatat.c: Ditto for fxstatat. * sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat.c: Ditto for lxstat. * sysdeps/unix/sysv/linux/generic/wordsize-32/xstat.c: Ditto for xstat. * sysdeps/unix/sysv/linux/generic/wordsize-32/fxstat64.c: New file. * sysdeps/unix/sysv/linux/generic/wordsize-32/fxstatat64.c: New file. * sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat64.c: Make __lxstat an alias of __lxstat64 if XSTAT_IS_XSTAT64 is set to non-zero. * sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c: Ditto for __xstat.
* powerpc: Add hidden definition for __sigsetjmpFlorian Weimer2016-11-294-0/+20
| | | | | There already is a hidden prototype for __sigsetjmp, but the architecture-specific definition was missing.
* powerpc: Remove unintended __longjmp symbol from ABIFlorian Weimer2016-11-293-4/+9
| | | | | | | | The __longjmp symbol was left in accidentally. It is not exported through a Versions file, but through a .symver assembler directive. The corresponding exported symbol was removed from the non-fpu powerpc64 targets in commit 9b9ef823581ecee546653d6ac3fd335f7b79faca.
* Refactor FP_FAST_* into bits/fp-fast.h.Joseph Myers2016-11-2912-157/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the refactoring of bits/mathdef.h, this patch moves the FP_FAST_* definitions into a new bits/fp-fast.h header. Currently this is only for FP_FAST_FMA*, but in future it would be the appropriate place for the FP_FAST_* macros from TS 18661-1 as well. The generic bits/mathdef.h header defines these macros based on whether the compiler defines __FP_FAST_*. Most architecture-specific headers, however, fail to do so, meaning that if the architecture (or some particular processors) does in fact have fused operations, and GCC knows to use them inline, the FP_FAST_* macros will still not be defined. By refactoring, this patch causes the generic version (based on __FP_FAST_*) to be used in more cases, and so the macro definitions to be more accurate. Architectures that already defined some or all of these macros other than based on the predefines have their own versions of fp-fast.h, which are arranged so they define FP_FAST_* if either the architecture-specific conditions are true or __FP_FAST_* are defined. After this refactoring, various bits/mathdef.h headers for architectures with long double = double are semantically identical to the generic version. The patch removes those headers that are redundant. (In fact two of the four removed were already redundant before this patch because they did use __FP_FAST_*.) Tested for x86_64 and x86, and compilation-only with build-many-glibcs.py. * bits/fp-fast.h: New file. * sysdeps/aarch64/bits/fp-fast.h: Likewise. * sysdeps/powerpc/bits/fp-fast.h: Likewise. * math/Makefile (headers): Add bits/fp-fast.h. * math/math.h: Include <bits/fp-fast.h>. * bits/mathdef.h (FP_FAST_FMA): Remove. (FP_FAST_FMAF): Likewise. (FP_FAST_FMAL): Likewise. * sysdeps/aarch64/bits/mathdef.h (FP_FAST_FMA): Likewise. (FP_FAST_FMAF): Likewise. * sysdeps/powerpc/bits/mathdef.h (FP_FAST_FMA): Likewise. (FP_FAST_FMAF): Likewise. * sysdeps/x86/bits/mathdef.h (FP_FAST_FMA): Likewise. (FP_FAST_FMAF): Likewise. (FP_FAST_FMAL): Likewise. * sysdeps/arm/bits/mathdef.h: Remove file. * sysdeps/hppa/fpu/bits/mathdef.h: Likewise. * sysdeps/sh/sh4/bits/mathdef.h: Likewise. * sysdeps/tile/bits/mathdef.h: Likewise.
* Make ilogb wrappers type-generic.Joseph Myers2016-11-288-96/+21
| | | | | | | | | | | | | | | | | | | | | This patch converts the ilogb wrappers (which set errno directly rather than doing anything with __kernel_standard) to use the type-generic template machinery. This is intended as preparation for adding llogb. Tested for x86_64 and x86, and tested compile for other architectures with build-many-glibcs.py. * math/w_ilogb_template.c: New file. Based on math/w_ilogb.c. * math/w_ilogb.c: Remove. * math/w_ilogbf.c: Likewise. * math/w_ilogbl.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_ilogb.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_ilogbl.c: Likewise. * math/Makefile (gen-libm-calls): Add w_ilogbF. (libm-calls): Remove w_ilogbF. * sysdeps/ieee754/ldbl-opt/math-type-macros-double.h (LDOUBLE_ilogbl_libm_version): New macro.
* Work around IA64 tst-setcontext2.c compile failure.Joseph Myers2016-11-282-0/+26
| | | | | | | | | | | | | | | | | | | | Building tests for IA64 runs into a build failure compiling stdlib/tst-setcontext2.c: tst-setcontext2.c: In function 'do_test': tst-setcontext2.c:210:20: error: passing argument 1 of 'sigismember' from incompatible pointer type [-Werror=incompatible-pointer-types] if (sigismember (&oldctx.uc_sigmask, SIGUSR2) != 1) ^ Indeed, the IA64 uc_sigmask as unsigned long rather than the larger userspace sigset_t. Fixing this might be hard; this patch works around the build failure by making IA64 wrap the test with a version that #defines sigismember to add a cast (I'd welcome a better approach for fixing this). Tested (compilation only) for ia64. * sysdeps/unix/sysv/linux/ia64/tst-setcontext2.c: New file.
* Fix sysdeps/ia64/fpu/libm-symbols.h for inclusion in testcases.Joseph Myers2016-11-282-18/+25
| | | | | | | | | | | | | | | | | | | IA64 builds in math/ use "-include libm-symbols.h". This breaks the signgam tests, which rely on undefining _LIBC and feature test macros and defining _ISOMAC before including system headers to get them to provide only ISO C declarations (libm-symbols.h ending up indirectly including headers which result in this breaking); similarly, it breaks C++ tests as some headers included from libm-symbols.h are not ready for inclusion in C++ code. This patch disables the contents of libm-symbols.h if __STRICT_ANSI__ or __cplusplus are defined to avoid this problem (this header can only test symbols defined before the source file is processed, so can't test _ISOMAC because that's defined within the source file, after this header is included). Tested (compilation only) for ia64. * sysdeps/ia64/fpu/libm-symbols.h: Make contents conditional on [!__STRICT_ANSI__ && !__cplusplus].
* X86_64: Don't use PLT nor GOT in static archives [BZ #20750]H.J. Lu2016-11-282-1/+8
| | | | | | | | | | | There is no need to use PLT nor GOT in static archives to branch to a function, regardless whether static archives is compiled with PIC or not. When static archives are used to create dynamic executable, PLT/GOT may be used. The resulting executable still works correctly. [BZ #20750] * sysdeps/x86_64/sysdep.h (JUMPTARGET): Check SHARED instead of PIC.
* Partial ILP32 support for aarch64.Steve Ellcey2016-11-2834-167/+384
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sysdeps/aarch64/crti.S: Add include of sysdep.h. (call_weak_fn): Use PTR_REG to get correct reg name in ILP32. * sysdeps/aarch64/dl-irel.h: Add include of sysdep.h. (elf_irela): Use AARCH64_R macro to get correct relocation in ILP32. * sysdeps/aarch64/dl-machine.h: Add include of sysdep.h. (elf_machine_load_address, RTLD_START, RTLD_START_1, RTLD_START, elf_machine_type_class, ELF_MACHINE_JMP_SLOT, elf_machine_rela, elf_machine_lazy_rel): Add ifdef's for ILP32 support. * sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_return, _dl_tlsdesc_return_lazy, _dl_tlsdesc_dynamic, _dl_tlsdesc_resolve_hold): Extend pointers in ILP32, use PTR_REG to get correct reg name for ILP32. * sysdeps/aarch64/dl-trampoline.S (ip01): New Macro. (RELA_SIZE): New Macro. (_dl_runtime_resolve, _dl_runtime_profile): Use new macros and PTR_REG to support ILP32. * sysdeps/aarch64/jmpbuf-unwind.h (_JMPBUF_CFA_UNWINDS_ADJ): Add cast for ILP32 mode. * sysdeps/aarch64/memcmp.S (memcmp): Extend arg pointers for ILP32 mode. * sysdeps/aarch64/memcpy.S (memmove, memcpy): Ditto. * sysdeps/aarch64/memset.S (__memset): Ditto. * sysdeps/aarch64/strchr.S (strchr): Ditto. * sysdeps/aarch64/strchrnul.S (__strchrnul): Ditto. * sysdeps/aarch64/strcmp.S (strcmp): Ditto. * sysdeps/aarch64/strcpy.S (strcpy): Ditto. * sysdeps/aarch64/strlen.S (__strlen): Ditto. * sysdeps/aarch64/strncmp.S (strncmp): Ditto. * sysdeps/aarch64/strnlen.S (strnlen): Ditto. * sysdeps/aarch64/strrchr.S (strrchr): Ditto. * sysdeps/unix/sysv/linux/aarch64/clone.S: Ditto. * sysdeps/unix/sysv/linux/aarch64/setcontext.S (__setcontext): Ditto. * sysdeps/unix/sysv/linux/aarch64/swapcontext.S (__swapcontext): Ditto. * sysdeps/aarch64/__longjmp.S (__longjmp): Extend pointers in ILP32, change PTR_MANGLE call to use register numbers instead of names. * sysdeps/unix/sysv/linux/aarch64/getcontext.S (__getcontext): Ditto. * sysdeps/aarch64/setjmp.S (__sigsetjmp): Extend arg pointers for ILP32 mode, change PTR_MANGLE calls to use register numbers. * sysdeps/aarch64/start.S (_start): Ditto. * sysdeps/aarch64/nptl/bits/pthreadtypes.h (__PTHREAD_RWLOCK_INT_FLAGS_SHARED): New define. (__SIZEOF_PTHREAD_ATTR_T, __SIZEOF_PTHREAD_MUTEX_T, __SIZEOF_PTHREAD_MUTEXATTR_T, __SIZEOF_PTHREAD_COND_T, __SIZEOF_PTHREAD_COND_COMPAT_T, __SIZEOF_PTHREAD_CONDATTR_T, __SIZEOF_PTHREAD_RWLOCK_T, __SIZEOF_PTHREAD_RWLOCKATTR_T, __SIZEOF_PTHREAD_BARRIER_T, __SIZEOF_PTHREAD_BARRIERATTR_T): Make defined values dependent on __ILP32__. * sysdeps/aarch64/nptl/bits/semaphore.h (__SIZEOF_SEM_T): Change define. (sem_t): Change __align type. * sysdeps/aarch64/sysdep.h (AARCH64_R, PTR_REG, PTR_LOG_SIZE, DELOUSE, PTR_SIZE): New Macros. (LDST_PCREL, LDST_GLOBAL) Update to use PTR_REG. * sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h (O_LARGEFILE): Set when in ILP32 mode. (F_GETLK64, F_SETLK64, F_SETLKW64): Only set in LP64 mode. * sysdeps/unix/sysv/linux/aarch64/dl-cache.h (DL_CACHE_DEFAULT_ID): Set elf flags for ILP32. (add_system_dir): Set ILP32 library directories. * sysdeps/unix/sysv/linux/aarch64/init-first.c (_libc_vdso_platform_setup): Set minimum kernel version for ILP32. * sysdeps/unix/sysv/linux/aarch64/ldconfig.h (SYSDEP_KNOWN_INTERPRETER_NAMES): Add ILP32 names. * sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h (GET_PC, SET_PC): New Macros. * sysdeps/unix/sysv/linux/aarch64/sysdep.h: Handle ILP32 pointers.
* Fix for [f]statfs64/[f]statfs aliasing patchSteve Ellcey2016-11-283-16/+28
| | | | | | * sysdeps/unix/sysv/linux/fstatfs64.c: Reorder include files, only alias fstatfs and __fstatfs if STATFS_IS_STATFS64 is non-zero. * sysdeps/unix/sysv/linux/statfs64.c: Ditto for statfs and __statfs.
* Do not include asm/cachectl.h in nios2 sys/cachectl.h.Joseph Myers2016-11-282-3/+5
| | | | | | | | | | | The nios2 sys/cachectl.h includes a kernel header asm/cachectl.h, which does not exist, so causing the check-installed-headers tests to fail. This patch removes the include of a nonexistent header. Tested (compilation only) for nios2. * sysdeps/unix/sysv/linux/nios2/sys/cachectl.h: Do not include <asm/cachectl.h>.
* Minor problems exposed by compiling C++ tests under _ISOMAC.Zack Weinberg2016-11-273-1/+7
| | | | | * libio/libio.h: Use __USE_GNU, not _GNU_SOURCE, in a conditional. * test-skeleton.c: Include stdint.h to ensure uintptr_t is available.
* hurd: fix using hurd/signal.h in C++ programsSamuel Thibault2016-11-272-3/+8
| | | | | * hurd/hurd/signal.h (HURD_MSGPORT_RPC): Cast expressions results to error_t to fix usage in C++ programs.
* localedata: GBK: add mapping for 0x80->Euro sign [BZ #20864]Mike Frysinger2016-11-262-0/+12
| | | | | | | | Microsoft long ago added a mapping for 0x80 to the Euro sign to their CP936. While GBK 1.0 doesn't include this mapping, it is compatible, and Microsoft and glibc alias the two codepages. We could split them apart so GBK wouldn't include the mapping, but that seems like a lot of work for little gain.
* Make build-many-glibcs.py store more information about builds.Joseph Myers2016-11-262-4/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes build-many-glibcs.py store information about builds in JSON format. This is part of preparing it for use in a bot checking for regressions. The information stored is: time of last build (of host-libraries, compilers or glibcs); versions of components used in the last build (for compilers, host library versions are properly copied from those used for the previous host-libraries build, and for glibcs, component versions other than that of glibc are similarly copied from the last compilers build); PASS/FAIL/UNRESOLVED results of the individual build steps; a list of changed results; a list of tests (that are still run at all) that have ever been recorded to PASS. The first pieces of information are intended to be used by a bot to decide whether a rebuild is appropriate (based on some combination of elapsed time and changes to versions; a bot might want to rebuild glibcs if there had been any change but only rebuild compilers after enough time had elapsed, for example). All the information is intended to be used in generating mails with results information. This state is specifically for full builds (no individual configs for building compilers or glibcs specified). If individual configs are specified, build-time and build-versions information is cleared (since it will no longer accurately reflect the install directory contents), while the other information is left unchanged. This reflects the motivation of providing information for a bot checking for regressions; the contents of build-state.json in a tree used for manual builds that may be only for some configurations are not particularly important. * scripts/build-many-glibcs.py: Import datetime module. (Context.__init__): Load JSON build state. Initialize list of status logs. (Context.run_builds): Update saved build state. (Context.add_makefile_cmdlist): Update list of status logs. (Context.load_build_state_json): New function. (Context.store_build_state_json): Likewise. (Context.clear_last_build_state): Likewise. (Context.update_build_state): Likewise. (CommandList.status_logs): Likewise.
* Make build-many-glibcs.py re-exec itself if changed by checkout.Joseph Myers2016-11-252-0/+22
| | | | | | | | | | | | | | | | | | | Updating build-many-glibcs.py may result in changes to the default versions of components, or to the set of components (if e.g. Hurd support is added and that requires a new component). It's desirable for the checkout process to leave a source tree that is ready to use. If the checkout updated the script itself, that means it needs to be rerun to cause any new versions or components referenced by the new script version to be properly checked out. This patch makes the script check if it was modified by the checkout process, and re-exec itself (with the same arguments) if so. * scripts/build-many-glibcs.py (Context.__init__): Save text of script being executed. (Context.get_script_text): New function. (Context.exec_self): Likewise. (Context.checkout): Re-exec script if changed by checkout process.
* Add setpayloadsig, setpayloadsigf, setpayloadsigl.Joseph Myers2016-11-2442-5/+300
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines functions for manipulating the payloads of NaNs. This patch implements the setpayloadsig functions for glibc; these are like the setpayload functions, but produce a signaling NaN instead of a quiet NaN. The substance of the implementation was included with the setpayload implementation, so the new files here just need to wrap the main files with different defines to build the new functions. Because the functions store a signaling NaN via a pointer and the libm-test macros choose a suitable initial value for the variable in such a case by comparing with the expected value, the relevant macro needs to clear exceptions after FE_INVALID may have been raised by that comparison. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (setpayloadsig): New declaration. * math/Versions (setpayloadsig): New libm symbol at version GLIBC_2.25. (setpayloadsigf): Likewise. (setpayloadsigl): Likewise. * math/Makefile (libm-calls): Add s_setpayloadsigF. * math/libm-test.inc (RUN_TEST_Ff_b1): Call feclearexcept (FE_ALL_EXCEPT) after initializing EXTRA_VAR. (setpayloadsig_test_data): New array. (setpayloadsig_test): New function. (main): Call setpayloadsig_test. * manual/arith.texi (FP Bit Twiddling): Document setpayloadsig, setpayloadsigf and setpayloadsigl. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated. * sysdeps/ieee754/dbl-64/s_setpayloadsig.c: New file. * sysdeps/ieee754/flt-32/s_setpayloadsigf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_setpayloadsigl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_setpayloadsigl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-setpayloadsig.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add setpayloadsig. (CFLAGS-nldbl-setpayloadsig.c): New variable. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Make build-many-glibcs.py track component versions requested and used.Joseph Myers2016-11-242-10/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes build-many-glibcs.py record the component versions checked out, and whether those versions were explicitly requested or defaults, in a file versions.json in the source directory. The preferred version of a component is the first of: one explicitly specified on the command line; one explicitly specified on the command line in a previous run of build-many-glibcs.py; a default version for that component. Thus, once you've run build-many-glibcs.py checkout once with the updated script (making sure to specify the right versions of any components previously checked out with a non-default version), in future you can just run it without version specifiers and it will know when a default-version component has changed its default version and so should be checked out again. Because you might have local changes and not want a default-version component checkout replaced, you need to pass the --replace-sources option to allow the script to delete and replace a component source directory automatically; otherwise, it will give an error if a version has changed. The script does not try to change branches of git or SVN checkouts without checking out from scratch; if the version number requested has changed and --replace-sources is used, the relevant source directory will be removed completely and a new one checked out from scratch. Apart from allowing automatic updates of components with default versions, this also facilitates bots reporting on the versions used in a given build. versions.json contains not just information on the version number and whether that was requested explicitly, but also git or SVN revision information intended to be used in email reports from bots. * scripts/build-many-glibcs.py: Import json module. (Context.__init__): Take replace_sources argument. Load versions.json. (Context.load_versions_json): New function. (Context.store_json): Likewise. (Context.store_versions_json): Likewise. (Context.set_component_version): Likewise. (Context.checkout): Update versions.json. Check for and handle changes of version. Prefer previously explicitly specified version to default version. (Context.checkout_vcs): Return a revision identifier. (Context.git_checkout): Likewise. (Context.gcc_checkout): Likewise. (get_parser): Add --replace-sources option. (main): Pass replace_sources argument to Context call.
* Remove cached PID/TID in cloneAdhemerval Zanella2016-11-2470-827/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch remove the PID cache and usage in current GLIBC code. Current usage is mainly used a performance optimization to avoid the syscall, however it adds some issues: - The exposed clone syscall will try to set pid/tid to make the new thread somewhat compatible with current GLIBC assumptions. This cause a set of issue with new workloads and usecases (such as BZ#17214 and [1]) as well for new internal usage of clone to optimize other algorithms (such as clone plus CLONE_VM for posix_spawn, BZ#19957). - The caching complexity also added some bugs in the past [2] [3] and requires more effort of each port to handle such requirements (for both clone and vfork implementation). - Caching performance gain in mainly on getpid and some specific code paths. The getpid performance leverage is questionable [4], either by the idea of getpid being a hotspot as for the getpid implementation itself (if it is indeed a justifiable hotspot a vDSO symbol could let to a much more simpler solution). Other usage is mainly for non usual code paths, such as pthread cancellation signal and handling. For thread creation (on stack allocation) the code simplification in fact adds some performance gain due the no need of transverse the stack cache and invalidate each element pid. Other thread usages will require a direct getpid syscall, such as cancellation/setxid signal, thread cancellation, thread fail path (at create_thread), and thread signal (pthread_kill and pthread_sigqueue). However these are hardly usual hotspots and I think adding a syscall is justifiable. It also simplifies both the clone and vfork arch-specific implementation. And by review each fork implementation there are some discrepancies that this patch also solves: - microblaze clone/vfork does not set/reset the pid/tid field - hppa uses the default vfork implementation that fallback to fork. Since vfork is deprecated I do not think we should bother with it. The patch also removes the TID caching in clone. My understanding for such semantic is try provide some pthread usage after a user program issue clone directly (as done by thread creation with CLONE_PARENT_SETTID and pthread tid member). However, as stated before in multiple discussions threads, GLIBC provides clone syscalls without further supporting all this semantics. I ran a full make check on x86_64, x32, i686, armhf, aarch64, and powerpc64le. For sparc32, sparc64, and mips I ran the basic fork and vfork tests from posix/ folder (on a qemu system). So it would require further testing on alpha, hppa, ia64, m68k, nios2, s390, sh, and tile (I excluded microblaze because it is already implementing the patch semantic regarding clone/vfork). [1] https://codereview.chromium.org/800183004/ [2] https://sourceware.org/ml/libc-alpha/2006-07/msg00123.html [3] https://sourceware.org/bugzilla/show_bug.cgi?id=15368 [4] http://yarchive.net/comp/linux/getpid_caching.html * sysdeps/nptl/fork.c (__libc_fork): Remove pid cache setting. * nptl/allocatestack.c (allocate_stack): Likewise. (__reclaim_stacks): Likewise. (setxid_signal_thread): Obtain pid through syscall. * nptl/nptl-init.c (sigcancel_handler): Likewise. (sighandle_setxid): Likewise. * nptl/pthread_cancel.c (pthread_cancel): Likewise. * sysdeps/unix/sysv/linux/pthread_kill.c (__pthread_kill): Likewise. * sysdeps/unix/sysv/linux/pthread_sigqueue.c (pthread_sigqueue): Likewise. * sysdeps/unix/sysv/linux/createthread.c (create_thread): Likewise. * sysdeps/unix/sysv/linux/getpid.c: Remove file. * nptl/descr.h (struct pthread): Change comment about pid value. * nptl/pthread_getattr_np.c (pthread_getattr_np): Remove thread pid assert. * sysdeps/unix/sysv/linux/pthread-pids.h (__pthread_initialize_pids): Do not set pid value. * nptl_db/td_ta_thr_iter.c (iterate_thread_list): Remove thread pid cache check. * nptl_db/td_thr_validate.c (td_thr_validate): Likewise. * sysdeps/aarch64/nptl/tcb-offsets.sym: Remove pid offset. * sysdeps/alpha/nptl/tcb-offsets.sym: Likewise. * sysdeps/arm/nptl/tcb-offsets.sym: Likewise. * sysdeps/hppa/nptl/tcb-offsets.sym: Likewise. * sysdeps/i386/nptl/tcb-offsets.sym: Likewise. * sysdeps/ia64/nptl/tcb-offsets.sym: Likewise. * sysdeps/m68k/nptl/tcb-offsets.sym: Likewise. * sysdeps/microblaze/nptl/tcb-offsets.sym: Likewise. * sysdeps/mips/nptl/tcb-offsets.sym: Likewise. * sysdeps/nios2/nptl/tcb-offsets.sym: Likewise. * sysdeps/powerpc/nptl/tcb-offsets.sym: Likewise. * sysdeps/s390/nptl/tcb-offsets.sym: Likewise. * sysdeps/sh/nptl/tcb-offsets.sym: Likewise. * sysdeps/sparc/nptl/tcb-offsets.sym: Likewise. * sysdeps/tile/nptl/tcb-offsets.sym: Likewise. * sysdeps/x86_64/nptl/tcb-offsets.sym: Likewise. * sysdeps/unix/sysv/linux/aarch64/clone.S: Remove pid and tid caching. * sysdeps/unix/sysv/linux/alpha/clone.S: Likewise. * sysdeps/unix/sysv/linux/arm/clone.S: Likewise. * sysdeps/unix/sysv/linux/hppa/clone.S: Likewise. * sysdeps/unix/sysv/linux/i386/clone.S: Likewise. * sysdeps/unix/sysv/linux/ia64/clone2.S: Likewise. * sysdeps/unix/sysv/linux/mips/clone.S: Likewise. * sysdeps/unix/sysv/linux/nios2/clone.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/clone.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/clone.S: Likewise. * sysdeps/unix/sysv/linux/sh/clone.S: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/clone.S: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise. * sysdeps/unix/sysv/linux/tile/clone.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/clone.S: Likewise. * sysdeps/unix/sysv/linux/aarch64/vfork.S: Remove pid set and reset. * sysdeps/unix/sysv/linux/alpha/vfork.S: Likewise. * sysdeps/unix/sysv/linux/arm/vfork.S: Likewise. * sysdeps/unix/sysv/linux/i386/vfork.S: Likewise. * sysdeps/unix/sysv/linux/ia64/vfork.S: Likewise. * sysdeps/unix/sysv/linux/m68k/clone.S: Likewise. * sysdeps/unix/sysv/linux/m68k/vfork.S: Likewise. * sysdeps/unix/sysv/linux/mips/vfork.S: Likewise. * sysdeps/unix/sysv/linux/nios2/vfork.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/vfork.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/vfork.S: Likewise. * sysdeps/unix/sysv/linux/sh/vfork.S: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S: Likewise. * sysdeps/unix/sysv/linux/tile/vfork.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/vfork.S: Likewise. * sysdeps/unix/sysv/linux/tst-clone2.c (f): Remove direct pthread struct access. (clone_test): Remove function. (do_test): Rewrite to take in consideration pid is not cached anymore.
* Refactor float_t, double_t information into bits/flt-eval-method.h.Joseph Myers2016-11-2421-93/+205
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present, definitions of float_t and double_t are split among many bits/mathdef.h headers. For all but three architectures, these types are float and double. Furthermore, if you assume __FLT_EVAL_METHOD__ to be defined, that provides a more generic way of determining the correct values of these typedefs. Defining these typedefs more generally based on __FLT_EVAL_METHOD__ was previously proposed by Paul Eggert in <https://sourceware.org/ml/libc-alpha/2012-02/msg00002.html>. This patch refactors things in the way I proposed in <https://sourceware.org/ml/libc-alpha/2016-11/msg00745.html>. A new header bits/flt-eval-method.h defines a single macro, __GLIBC_FLT_EVAL_METHOD, which is then used by math.h to define float_t and double_t. The default is based on __FLT_EVAL_METHOD__ (although actually a default to 0 would have the same effect for current ports, because ports where values other than 0 or 16 are possible all have their own headers). To avoid changing the existing semantics in any case, including for compilers not defining __FLT_EVAL_METHOD__, architecture-specific files are then added for m68k, s390, x86 which replicate the existing semantics. At least with __FLT_EVAL_METHOD__ values possible with GCC, there should be no change to the choices of float_t and double_t for any supported configuration. Architecture maintainer notes: * m68k: sysdeps/m68k/m680x0/bits/flt-eval-method.h always defines __GLIBC_FLT_EVAL_METHOD to 2 to replicate the existing logic. But actually GCC defines __FLT_EVAL_METHOD__ to 0 if TARGET_68040. It might make sense to make the header prefer to base things on __FLT_EVAL_METHOD__ if defined, like the x86 version, and so make the choices of these types more accurate (with a NEWS entry as for the other changes to these types on particular architectures). * s390: sysdeps/s390/bits/flt-eval-method.h always defines __GLIBC_FLT_EVAL_METHOD to 1 to replicate the existing logic. As previously discussed, it might make sense in coordination with GCC to eliminate the historic mistake, avoid excess precision in the -fexcess-precision=standard case and make the typedefs match (with a NEWS entry, again). Tested for x86-64 and x86. Also did compilation-only testing with build-many-glibcs.py. * bits/flt-eval-method.h: New file. * sysdeps/m68k/m680x0/bits/flt-eval-method.h: Likewise. * sysdeps/s390/bits/flt-eval-method.h: Likewise. * sysdeps/x86/bits/flt-eval-method.h: Likewise. * math/Makefile (headers): Add bits/flt-eval-method.h. * math/math.h: Include <bits/flt-eval-method.h>. [__USE_ISOC99] (float_t): Define based on __GLIBC_FLT_EVAL_METHOD. [__USE_ISOC99] (double_t): Likewise. * bits/mathdef.h (float_t): Remove. (double_t): Likewise. * sysdeps/aarch64/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/alpha/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/arm/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/hppa/fpu/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/ia64/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/m68k/m680x0/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/mips/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/powerpc/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/s390/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/sh/sh4/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/sparc/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/tile/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/x86/bits/mathdef.h (float_t): Likewise. (double_t): Likewise.
* x86_64: fix static build of __memcpy_chk for compilers defaulting to PIC/PIEAurelien Jarno2016-11-242-1/+6
| | | | | | | | | | | When glibc is compiled with gcc 6.2 that has been configured with to default to PIC/PIE, the static version of __memcpy_chk is not built, as the test is done on PIC instead of SHARED. Fix the test to check for SHARED, like it is done for similar functions like memmove_chk. Changelog: * sysdeps/x86_64/memcpy_chk.S (__memcpy_chk): Check for SHARED instead of PIC.
* More NEWS entries / fixes for float_t / double_t changes.Joseph Myers2016-11-231-2/+9
| | | | | Document changes for x86_64 -mfpmath=sse and -mfpmath=sse+387. Don't put these NEWS entries in the middle of TS 18661-1 entries.
* Fix SH4 FP_ILOGB0 (bug 20859).Joseph Myers2016-11-234-2/+51
| | | | | | | | | | | | | | | | | | | | | | ISO C requires that the value of FP_ILOGB0 must be INT_MIN or -INT_MAX. In sysdeps/sh/sh4/bits/mathdef.h, it's 0x80000001; that is, a positive unsigned value that would be -INT_MAX if converted to int, which is not valid (there's no actual constraint on the type, but whatever the type the integer value must be one of the two permitted, and types other than int don't really make sense). This patch makes the ABI-compatible change to (-0x7fffffff). (The testcase handles positive and negative sign separately to avoid any issues with implicit conversions that could result in e.g. INT_MIN converted to uintmax_t wrongly passing.) Tested (compilation only) with build-many-glibcs.py. [BZ #20859] * sysdeps/sh/sh4/bits/mathdef.h (FP_ILOGB0): Define to (-0x7fffffff) instead of 0x80000001. * math/test-fp-ilogb-constants.c: New file. * math/Makefile (tests): Add test-fp-ilogb-constants.
* MIPS: Use R_MICROMIPS_JALR rather than R_MIPS_JALR in microMIPS codeMaciej W. Rozycki2016-11-234-6/+33
| | | | | | | | | | | | | | In a microMIPS compilation of `.init' code use the R_MICROMIPS_JALR relocation intended for PIC call relaxation in microMIPS code rather than the corresponding R_MIPS_JALR relocation meant for regular MIPS code only. * sysdeps/mips/mips32/crti.S (JALR_RELOC): New macro. (_init): Use it in place of hardcoded R_MIPS_JALR. * sysdeps/mips/mips64/n32/crti.S (JALR_RELOC): New macro. (_init): Use it in place of hardcoded R_MIPS_JALR. * sysdeps/mips/mips64/n64/crti.S (JALR_RELOC): New macro. (_init): Use it in place of hardcoded R_MIPS_JALR.