about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* Consolidate Linux truncate implementationsAdhemerval Zanella2016-11-0910-159/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates all Linux truncate implementation on sysdeps/unix/sysv/linux/truncate{64}.c. It is based on {INTERNAL,INLINE}_SYSCALL patch [1] to simplify the syscall construction. General idea is to build ftruncate iff __OFF_T_MATCHES_OFF64_T is not defined, otherwise ftruncate64 will be build and ftruncate will be an alias. The fallocate will use old compat syscall and pass 32-bit off_t argument, while fallocate64 will handle the correct off64_t passing using __ALIGNMENT_ARG and SYSCALL_LL64 macros. Tested on x86_64, i386, aarch64, and armhf. * sysdeps/unix/sysv/linux/arm/truncate64.c: Remove file. * sysdeps/unix/sysv/linux/generic/wordsize-32/truncate.c: Likewise. * sysdeps/sysv/linux/generic/wordsize-32/truncate64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/truncate64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/truncate64.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/truncate64.c: Likewise. * sysdeps/unix/sysv/linux/truncate.c: New file. * sysdeps/unix/sysv/linux/truncate64.c (truncate64): Use INLINE_SYSCALL_CALL, __ALIGNMENT_ARG and SYSCALL_LL64 macros. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (truncate): Remove. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (truncate): Likewise. [1] https://sourceware.org/ml/libc-alpha/2016-08/msg00646.html
* Consolidate Linux ftruncate implementationsAdhemerval Zanella2016-11-0910-162/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | THis patch consolidates all Linux ftruncate implementation on sysdeps/unix/sysv/linux/ftruncate{64}.c. It is based on {INTERNAL,INLINE}_SYSCALL patch [1] to simplify the syscall construction. General idea is to build ftruncate iff __OFF_T_MATCHES_OFF64_T is not defined, otherwise ftruncate64 will be build and ftruncate will be an alias. The fallocate will use old compat syscall and pass 32-bit off_t argument, while fallocate64 will handle the correct off64_t passing using __ALIGNMENT_ARG and SYSCALL_LL64 macros. Tested on x86_64, i386, aarch64, and armhf. * posix/tst-truncate-common.c: New file. * posix/tst-truncate.c: Use tst-truncate-common.c. * posix/tst-truncate64.c: Likewise and add LFS tests. * sysdeps/unix/sysv/linux/arm/ftruncate64.c: Remove file. * sysdeps/unix/sysv/linux/generic/wordsize-32/ftruncate.c: Likewise. * sysdeps/unix/sysv/linux/generic/wordsize-32/ftruncate64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/ftruncate64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/ftruncate64.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/ftruncate64.c: Likewise. * sysdeps/unix/sysv/linux/ftruncate.c: New file. * sysdeps/unix/sysv/linux/ftruncate64.c (__ftruncate64): Use INLINE_SYSCALL_CALL, __ALIGNMENT_ARG and SYSCALL_LL64 macros. [__OFF_T_MATCHES_OFF64_T] (ftruncate): Add alias. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (ftruncate): Remove. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (ftruncate): Likewise. [1] https://sourceware.org/ml/libc-alpha/2016-08/msg00646.html
* Add localplt.data for sh.Joseph Myers2016-11-081-0/+20
| | | | | | | | | | This patch adds a localplt.data file for sh so that test passes. The architecture-specific entries are for _Unwind_Find_FDE, _exit and __errno_location. Tested for sh3 and sh4. * sysdeps/unix/sysv/linux/sh/localplt.data: New file.
* Add localplt.data for hppa.Joseph Myers2016-11-081-0/+23
| | | | | | | | | | | | | | | | | | | | | This patch adds a localplt.data file for hppa so that test passes. Architecture maintainers should feel free to clean up the sysdeps code so that some or all of the system-specific entries libc.so: _exit libc.so: __sigsetjmp libc.so: _IO_funlockfile libc.so: sigprocmask libc.so: __errno_location libpthread.so: __errno_location are no longer needed. Tested for hppa. Note: check-execstack and check-textrel still fail; you may wish to look at those to get to a clean baseline there (they are less obvious for people not familiar with the architecture). * sysdeps/unix/sysv/linux/hppa/localplt.data: New file.
* Update alpha localplt.data.Joseph Myers2016-11-081-11/+11
| | | | | | | | | | | | | | | | | | | | | | This patch updates alpha localplt.data so the localplt test passes in my compile-only all-ABIs glibc testing. The failures I see without this patch are: Missing required PLT reference: ld.so: __tls_get_addr Missing required PLT reference: ld.so: free Now, __tls_get_addr can be made optional. For free, rather than making it optional as in libc.so it seems better to mark all the malloc-related symbols in both libc.so and ld.so as allowing an R_ALPHA_GLOB_DAT relocation as an alternative to using a PLT entry, so this patch does so. Tested for alpha. * sysdeps/unix/sysv/linux/alpha/localplt.data: Make __tls_get_addr optional in ld.so. Allow R_ALPHA_GLOB_DAT relocation for malloc, calloc, realloc, free, memalign and __libc_memalign rather than making them optional.
* Update nios2 localplt.data.Joseph Myers2016-11-081-0/+1
| | | | | | | | | | | This patch updates nios2 localplt.data so the localplt test passes in my compile-only all-ABIs glibc testing. A new PLT entry for __extendsfdf2 is added. Tested for nios2. * sysdeps/unix/sysv/linux/nios2/localplt.data: Add __extendsfdf2 for libc.so.
* Consolidate lseek/lseek64/llseek implementationsAdhemerval Zanella2016-11-0811-110/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates all Linux lseek/lseek64/llseek implementation in on on sysdeps/unix/sysv/linux/lseek{64}.c. It also removes the llseek file and instead consolidate the LFS lseek implementation on lseek64.c as for other LFS symbols implementations. The general idea is: - lseek: ABIs that not define __OFF_T_MATCHES_OFF64_T will preferable use __NR__llseek if kernel supports it, otherwise they will use __NR_lseek. ABIs that defines __OFF_T_MATCHES_OFF64_T won't produce any symbol. - lseek64: ABIs with __OFF_T_MATCHES_OFF64_T will preferable use __NR_lseek (since it will use 64-bit arguments without low/high splitting) and __NR__llseek if __NR_lseek is not defined (for some ILP32 ports). - llseek: files will be removed and symbols will be aliased ot lseek64. ABI without __OFF_T_MATCHES_OFF64_T and without __NR_llseek (basically MIPS64n32 so far) are covered by building lseek with off_t as expected and lseek64 using __NR_lseek (as expected for off64_t being passed using 64-bit registers). For this consolidation I mantained the x32 assembly specific implementation because to correctly fix this it would required both the x32 fix for {INLINE,INTERNAL}_SYSCALL [1] and a wrapper to correctly subscribe it to return 64 bits instead of default 32 bits (as for times). It could a future cleanup. It is based on my previous {INTERNAL,INLINE}_SYSCALL_CALL macro [2], although it is mainly for simplification. Tested on x86_64, i686, aarch64, armhf, and powerpc64le. * nptl/Makefile (libpthread-routines): Remove ptw-llseek and add ptw-lseek64. * sysdeps/unix/sysv/linux/Makefile (sysdeps_routines): Remove llseek. * sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Likewise. * sysdeps/unix/sysv/linux/generic/wordsize-32/llseek.c: Remove file. * sysdeps/unix/sysv/linux/generic/wordsize-32/lseek.c: Remove file. * sysdeps/unix/sysv/linux/mips/mips64/llseek.c: Likewise. * sysdeps/unix/sysv/linux/llseek.c: Remove file. * sysdeps/unix/sysv/linux/lseek.c: New file. * sysdeps/unix/sysv/linux/lseek64.c: Add default Linux implementation. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list: Remove lseek and __libc_lseek64 from auto-generation. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/lseek64.S: New file. [1] https://sourceware.org/ml/libc-alpha/2016-08/msg00443.html [2] https://sourceware.org/ml/libc-alpha/2016-08/msg00646.html
* Define __ASSUME_ST_INO_64_BIT on all platforms.Steve Ellcey2016-11-076-4/+6
| | | | | | | | | | | * sysdeps/unix/sysv/linux/alpha/kernel-features.h: #define __ASSUME_ST_INO_64_BIT as 0 * sysdeps/unix/sysv/linux/sh/kernel-features.h: Likewise. * sysdeps/unix/sysv/linux/fxstat64.c: Replace #ifdef with #if over the code where __ASSUME_ST_INO_64_BIT is used. * sysdeps/unix/sysv/linux/lxstat64.c: Likewise. * sysdeps/unix/sysv/linux/xstat64.c: Likewise. * sysdeps/unix/sysv/linux/xstatconv.c: Likewise.
* nptl: Document the reason why __kind in pthread_mutex_t is part of the ABIFlorian Weimer2016-11-0715-14/+16
|
* Fix sparc build due missing __WORDSIZE_TIME64_COMPAT32 definitionAdhemerval Zanella2016-11-041-0/+2
| | | | | | | | | | | This patch adds the missing Linux sparc definitions from d060cd0. Both value are copied from default sparc value [1] and with this fix now both sparc 32 and 64 bits builds on Linux. * sysdeps/unix/sysv/linux/sparc/bits/wordsize.h (__WORDSIZE_TIME64_COMPAT32): Define for both 32 and 64 bits. [1] sysdeps/sparc/sparc{32,64}/bits/wordsize.h
* Fix alpha sqrt fegetenv namespace (bug 20768).Joseph Myers2016-11-041-1/+1
| | | | | | | | | | | | | | | | | On alpha, sqrt (a C90 function) brings in references to fegetenv (C99), resulting in linknamespace test failures: [initial] __sqrt -> [libm.a(w_sqrt.o)] __ieee754_sqrt -> [libm.a(e_sqrt.o)] __feholdexcept -> [libm.a(feholdexcpt.o)] fegetenv This patch fixes this by making __feholdexcept call __fegetenv instead of fegetenv. Tested for Alpha (compilation only). [BZ #20768] * sysdeps/alpha/fpu/feholdexcpt.c (__feholdexcept): Call __fegetenv instead of fegetenv.
* Do not hardcode platform names in manual/libm-err-tab.pl (bug 14139).Joseph Myers2016-11-0421-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | manual/libm-err-tab.pl hardcodes a list of names for particular platforms (mapping from sysdeps directory name to friendly name for the manual). This goes against the principle of keeping information about individual platforms in their corresponding sysdeps directory, and the list is also very out-of-date regarding supported platforms and their corresponding sysdeps directories. This patch fixes this by adding a libm-test-ulps-name file alongside each libm-test-ulps file. The script then gets the friendly name from that file, which is required to exist, so it no longer needs to allow for the mapping being missing. Tested for x86_64. [BZ #14139] * manual/libm-err-tab.pl (%pplatforms): Initialize to empty. (find_files): Obtain platform name from libm-test-ulps-name and store in %pplatforms. (canonicalize_platform): Remove. (print_platforms): Use $pplatforms directly. (by_platforms): Do not allow for platforms missing from %pplatforms. * sysdeps/aarch64/libm-test-ulps-name: New file. * sysdeps/alpha/fpu/libm-test-ulps-name: Likewise. * sysdeps/arm/libm-test-ulps-name: Likewise. * sysdeps/generic/libm-test-ulps-name: Likewise. * sysdeps/hppa/fpu/libm-test-ulps-name: Likewise. * sysdeps/i386/fpu/libm-test-ulps-name: Likewise. * sysdeps/i386/i686/fpu/multiarch/libm-test-ulps-name: Likewise. * sysdeps/ia64/fpu/libm-test-ulps-name: Likewise. * sysdeps/m68k/coldfire/fpu/libm-test-ulps-name: Likewise. * sysdeps/m68k/m680x0/fpu/libm-test-ulps-name: Likewise. * sysdeps/microblaze/libm-test-ulps-name: Likewise. * sysdeps/mips/mips32/libm-test-ulps-name: Likewise. * sysdeps/mips/mips64/libm-test-ulps-name: Likewise. * sysdeps/nios2/libm-test-ulps-name: Likewise. * sysdeps/powerpc/fpu/libm-test-ulps-name: Likewise. * sysdeps/powerpc/nofpu/libm-test-ulps-name: Likewise. * sysdeps/s390/fpu/libm-test-ulps-name: Likewise. * sysdeps/sh/libm-test-ulps-name: Likewise. * sysdeps/sparc/fpu/libm-test-ulps-name: Likewise. * sysdeps/tile/libm-test-ulps-name: Likewise. * sysdeps/x86_64/fpu/libm-test-ulps-name: Likewise.
* Make MIPS <sys/user.h> self-contained.Joseph Myers2016-11-041-0/+1
| | | | | | | | | | | The check-installed-headers tests show up that the MIPS <sys/user.h> is not self-contained, using size_t without including any header that defines it. This patch fixes it by including <stddef.h>, as done for other architectures' versions of this header. Tested for MIPS (all 24 ABIs, compilation only). * sysdeps/unix/sysv/linux/mips/sys/user.h: Include <stddef.h>.
* XFAIL check-execstack for MIPS.Joseph Myers2016-11-041-0/+6
| | | | | | | | | | | This patch marks the check-execstack test as expected to fail for MIPS, with a comment referencing previous RFC discussion of the changes that would be needed to support non-executable stacks on MIPS. Tested for MIPS (all 24 ABIs). * sysdeps/unix/sysv/linux/mips/Makefile [$(subdir) = elf] (test-xfail-check-execstack): New variable.
* Add localplt.data for MIPS.Joseph Myers2016-11-041-0/+3
| | | | | | | | | | | This patch adds a localplt.data file for MIPS, reflecting the peculiarities of MIPS ELF that mean this test cannot detect PLT entries (there aren't any in shared libraries), not GOT entries (because of the implicit relocation). Tested for MIPS (all 24 ABIs). * sysdeps/mips/localplt.data: New file.
* Define wordsize.h macros everywhereSteve Ellcey2016-11-0419-10/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * bits/wordsize.h: Add documentation. * sysdeps/aarch64/bits/wordsize.h : New file * sysdeps/generic/stdint.h (PTRDIFF_MIN, PTRDIFF_MAX): Update definitions. (SIZE_MAX): Change ifdef to if in __WORDSIZE32_SIZE_ULONG check. * sysdeps/gnu/bits/utmp.h (__WORDSIZE_TIME64_COMPAT32): Check with #if instead of #ifdef. * sysdeps/gnu/bits/utmpx.h (__WORDSIZE_TIME64_COMPAT32): Ditto. * sysdeps/mips/bits/wordsize.h (__WORDSIZE32_SIZE_ULONG, __WORDSIZE32_PTRDIFF_LONG, __WORDSIZE_TIME64_COMPAT32): Add or change defines. * sysdeps/powerpc/powerpc32/bits/wordsize.h: Likewise. * sysdeps/powerpc/powerpc64/bits/wordsize.h: Likewise. * sysdeps/s390/s390-32/bits/wordsize.h: Likewise. * sysdeps/s390/s390-64/bits/wordsize.h: Likewise. * sysdeps/sparc/sparc32/bits/wordsize.h: Likewise. * sysdeps/sparc/sparc64/bits/wordsize.h: Likewise. * sysdeps/tile/tilegx/bits/wordsize.h: Likewise. * sysdeps/tile/tilepro/bits/wordsize.h: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/wordsize.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/wordsize.h: Likewise. * sysdeps/wordsize-32/bits/wordsize.h: Likewise. * sysdeps/wordsize-64/bits/wordsize.h: Likewise. * sysdeps/x86/bits/wordsize.h: Likewise.
* An optimized memchr was missing for AArch64. This version is similar toWilco Dijkstra2016-11-041-0/+157
| | | | | | | | | strchr and is significantly faster than the C version. 2016-11-04 Wilco Dijkstra <wdijkstr@arm.com> Kevin Petit <kevin.petit@arm.com> * sysdeps/aarch64/memchr.S (__memchr): New file.
* Handle tilegx* machine names.Joseph Myers2016-11-041-1/+1
| | | | | | | | | | | | | | | This patch makes sysdeps/tile/preconfigure handle tilegx* machine names instead of just plain tilegx. That matches GCC, and in particular allows a big-endian toolchain to use the tilegxbe-linux-gnu name when configuring both GCC and glibc. Tested with compilation for tilegxbe-linux-gnu, both 32-bit and 64-bit (building a subsequent GCC against that glibc still falls over because of both 32-bit and 64-bit libraries going in the lib directory, as noted at <https://sourceware.org/ml/libc-alpha/2016-11/msg00129.html>). * sysdeps/tile/preconfigure: Accept tilegx* instead of tilegx.
* hurd: Fix spurious port deallocationBrent W. Baccala2016-10-311-1/+2
| | | | | * sysdeps/mach/hurd/dl-sysdep.c (__mmap): Do not deallocate memobj_wr when it is MACH_PORT_NULL.
* Document a behavior of an elided pthread_rwlock_unlockTulio Magno Quites Machado Filho2016-10-281-0/+3
| | | | | Explain that pthread_rwlock_unlock may crash if called on a lock not held by the current thread.
* powerpc: Fix TOC stub on powerpc64 clone()Tulio Magno Quites Machado Filho2016-10-281-1/+1
| | | | | | | Use a function call to _exit() so that the linker can create a TOC stub instead of just a branch. Tested on powerpc64.
* crypt: Use internal names for the SHA-2 block functionsFlorian Weimer2016-10-282-14/+18
| | | | | These functions are externally visible with a static libcrypt library.
* Check IFUNC definition in unrelocated shared library [BZ #20019]H.J. Lu2016-10-282-2/+34
| | | | | | | | | | | | Calling an IFUNC function defined in unrelocated shared library may lead to segfault. This patch issues an error message to request relinking the shared library if it references IFUNC function defined in the unrelocated shared library. [BZ #20019] * sysdeps/i386/dl-machine.h (elf_machine_rel): Check IFUNC definition in unrelocated shared library. * sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise.
* i386: Support CFLAGS which imply -fno-omit-frame-pointer [BZ #20729]Florian Weimer2016-10-281-12/+35
|
* Fix a sparc header conformtest failure.David S. Miller2016-10-271-0/+2
| | | | * sysdeps/unix/sysv/linux/sparc/sys/user.h: Include stddef.h
* Add canonicalize, canonicalizef, canonicalizel.Joseph Myers2016-10-2640-9/+203
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines canonicalize functions to produce a canonical version of a floating-point representation. This patch implements these functions for glibc. As with the iscanonical macro, these functions are oriented to the decimal floating-point case, where some values have both canonical and noncanonical representations. However, the functions have a return value that says whether they succeeded in storing a canonical result; thus, they can fail for the case of an invalid representation (while still not making any particular choice from among multiple equally canonical valid representations of the same value). Since no floating-point formats in glibc actually have noncanonical valid representations, a type-generic implementation of these functions can be used that expects iscanonical to return 0 only for invalid representations. Now that iscanonical is used within libm.so, libm_hidden_proto / libm_hidden_def are added for __iscanonicall. The definition of these functions is intended to correspond to a convertFormat operation to the same floating-point format. Thus, they convert signaling NaNs to quiet NaNs, raising the "invalid" exception. Such a conversion "should" produce "the canonical version of that signaling NaN made quiet". libm-test.inc is made to check NaN payloads for the output of these functions, a new feature (at some point manipulation functions such as fabs and copysign should have tests added that verify payload preservation for them). As however some architectures may not follow the recommended practice of preserving NaN payloads when converting a signaling NaN to quiet, a new math-tests.h macro SNAN_TESTS_PRESERVE_PAYLOAD is added, and defined to 0 for non-NAN2008 MIPS; any other architectures seeing test failures for lack of payload preservation in this case should also define this macro to 0. (If any cases arise where the sign isn't preserved either, those should have a similar macro added.) The ldbl-96 and ldbl-128ibm tests of iscanonical are renamed and adapted to test canonicalizel as well on the same representations. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (canonicalize): New declaration. * math/Versions (canonicalize): New libm symbol at version GLIBC_2.25. (canonicalizef): Likewise. (canonicalizel): Likewise. * math/Makefile (gen-libm-calls): Add s_canonicalizeF. * math/s_canonicalize_template.c: New file. * math/libm-test.inc: Update comment on functions tested and testing of NaN payloads. (TEST_NAN_PAYLOAD): New macro. (NO_TEST_INLINE): Update value. (XFAIL_TEST): Likewise. (ERRNO_UNCHANGED): Likewise. (ERRNO_EDOM): Likewise. (ERRNO_ERANGE): Likewise. (IGNORE_RESULT): Likewise. (NON_FINITE): Likewise. (TEST_SNAN): Likewise. (NO_TEST_MATHVEC): Likewise. (TEST_NAN_PAYLOAD_CANONICALIZE): New macro. (check_float_internal): Check NaN payloads if TEST_NAN_PAYLOAD. (struct test_Ffp_b1_data): New type. (RUN_TEST_Ffp_b1): New macro. (RUN_TEST_LOOP_Ffp_b1): Likewise. (canonicalize_test_data): New array. (canonicalize_test): New function. (main): Call canonicalize_test. * manual/arith.texi (FP Bit Twiddling): Document canonicalize, canonicalizef and canonicalizel. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated. * sysdeps/ieee754/ldbl-opt/nldbl-canonicalize.c: New file. * sysdeps/ieee754/ldbl-opt/s_canonicalizel.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add canonicalize. (CFLAGS-nldbl-canonicalize.c): New variable. * sysdeps/ieee754/ldbl-128ibm/test-iscanonical-ldbl-128ibm.c: Move to ... * sysdeps/ieee754/ldbl-128ibm/test-canonical-ldbl-128ibm.c: ... here. (do_test): Also test canonicalizel. * sysdeps/ieee754/ldbl-128ibm/Makefile (tests): Change test-iscanonical-ldbl-128ibm to test-canonical-ldbl-128ibm. * sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h: New file. * sysdeps/ieee754/ldbl-128ibm/s_iscanonicall.c (__iscanonicall): Use libm_hidden_def. * sysdeps/ieee754/ldbl-96/test-iscanonical-ldbl-96.c: Move to ... * sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c: ... here. (do_test): Also test canonicalizel. * sysdeps/ieee754/ldbl-96/Makefile (tests): Change test-iscanonical-ldbl-96 to test-canonical-ldbl-96. * sysdeps/ieee754/ldbl-96/include/bits/iscanonical.h: New file. * sysdeps/ieee754/ldbl-96/s_iscanonicall.c (__iscanonicall): Use libm_hidden_def. * sysdeps/generic/math-tests.h (SNAN_TESTS_PRESERVE_PAYLOAD): New macro. * sysdeps/mips/math-tests.h [__mips_hard_float && !__mips_nan2008] (SNAN_TESTS_PRESERVE_PAYLOAD): Likewise. * 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.
* Add getpayloadl to libnldbl.Joseph Myers2016-10-262-1/+28
| | | | | | | | | | | | This patch adds getpayloadl to libnldbl, missed in my patch that originally implemented getpayload functions. Tested for powerpc. * sysdeps/ieee754/ldbl-opt/nldbl-getpayload.c: New file. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add getpayload. (CFLAGS-nldbl-getpayload.c): New variable.
* Add strfromd, strfromf, and strfroml functionsGabriel F. T. Gomes2016-10-2531-0/+96
| | | | | | | ISO/IEC TS 18661-1 adds several functions in the strfrom family to stdlib. This patch adds strfromd, strfromf, and strfroml. This is being done in preparation for the new floating-point type, float128. The added functions convert a floating-point value into a string, with configurable format.
* Fix cmpli usage in power6 memset.Joseph Myers2016-10-252-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Building glibc for powerpc64 with recent (2.27.51.20161012) binutils, with multi-arch enabled, I get the error: ../sysdeps/powerpc/powerpc64/power6/memset.S: Assembler messages: ../sysdeps/powerpc/powerpc64/power6/memset.S:254: Error: operand out of range (5 is not between 0 and 1) ../sysdeps/powerpc/powerpc64/power6/memset.S:254: Error: operand out of range (128 is not between 0 and 31) ../sysdeps/powerpc/powerpc64/power6/memset.S:254: Error: missing operand Indeed, cmpli is documented as a four-operand instruction, and looking at nearby code it seems likely cmpldi was intended. This patch fixes this powerpc64 code accordingly, and makes a corresponding change to the powerpc32 code. Tested for powerpc, powerpc64 and powerpc64le by Tulio Magno Quites Machado Filho * sysdeps/powerpc/powerpc32/power6/memset.S (memset): Use cmplwi instead of cmpli. * sysdeps/powerpc/powerpc64/power6/memset.S (memset): Use cmpldi instead of cmpli.
* * sysdeps/unix/sysv/linux/fxstat.c: Remove useless cast.Yury Norov2016-10-246-6/+6
| | | | | | | | * sysdeps/unix/sysv/linux/lxstat.c: Likewise. * sysdeps/unix/sysv/linux/xstat.c: Likewise. * sysdeps/unix/sysv/linux/i386/fxstat.c: Likewise. * sysdeps/unix/sysv/linux/i386/lxstat.c: Likewise. * sysdeps/unix/sysv/linux/i386/xstat.c: Likewise.
* Fix Linux sh4 pread/pwrite argument passingAdhemerval Zanella2016-10-2410-100/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although conceptually correct for p{read,write}{64} offset argument passing, sh4 implementation does not generate the correct expected code. The __ALIGNMENT_ARG redefinition is incorrect for two reasons: 1. the kernel-features.h header is included multiple times (since it contains no guards) and 2. the value it redefines is also incorrect (should be '0, ' instead of empty definition). This patch fixes it by adding another macro, SYSCALL_LL_PRW{64}, meant to be used to pass the offset argument on p{read,write}64. It is basically the already define SYSCALL_LL{64} plus __ALIGNMENT_ARG unless __ASSUME_PRW_DUMMY_ARG is define. In this case an empty dummy argument is used regardless how __ALIGNMENT_ARG is defined (sh4 case). Checked on x86_64, i686, aarch64, armhf, and powerpc64le (basically a sanity check). Also, John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> and James Clarke <jrtc27@jrtc27.com> help me check on a debian sh4 bootstrap using 2.24 plus this patch to verify it also corrected fixed the regression issue. I also verified the generated object for a 2.24 build and master with this patch for sh4 and both look identical. * sysdeps/unix/sysv/linux/pread.c (__libc_pread): Use SYSCALL_LL_PRW. * sysdeps/unix/sysv/linux/pwrite.c (__libc_pwrite): Likewise. * sysdeps/unix/sysv/linux/pread64.c (__libc_pread64): Use SYSCALL_LL64_PRW. * sysdeps/unix/sysv/linux/pwrite64.c (__libc_pwrite64): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h: Define __ASSUME_PRW_DUMMY_ARG. * sysdeps/unix/sysv/linux/sh/pread.c: Remove file. * sysdeps/unix/sysv/linux/sh/pread64.c: Likewise. * sysdeps/unix/sysv/linux/sh/pwrite.c: Likewise. * sysdeps/unix/sysv/linux/sh/pwrite64.c: Likewise. * sysdeps/unix/sysv/linux/sysdep.h: Define SYSCALL_LL_PRW and SYSCALL_LL_PRW64 based on __ASSUME_PRW_DUMMY_ARG.
* Fix -Wformat-length warning in tst-setgetname.cSteve Ellcey2016-10-241-1/+1
| | | | * sysdeps/unix/sysv/linux/tst-setgetname.c: Increase buffer size.
* powerpc: Cleanup fenv_private.hPaul Murphy2016-10-211-103/+53
| | | | | | | | | | | | | | | | | | | | | | | | Some of the masks are wrong, and the naming is confusing. There are two basic cases we really care about: 1. Stacking a new rounding mode when running certain sections of code, and pausing exception handling. 2. Likewise, but discarding any exceptions which occur while running under the new rounding mode. libc_feholdexcept_setround_ppc_ctx has been removed as it basically does the same thing as libc_feholdsetround_ppc_ctx but also clearing any sticky bits. The restore behavior is what differentiates these two cases as the SET_RESTORE_ROUND{,_NOEX} macros will either merge or discard all exceptions occurring during scope of their usage. Likewise, there are a number of routines to swap, replace, or merge FP environments. This change reduces much of the common and sometimes wrong code. Tested on ppc64le, with results before and after.
* Use VSQRT instruction for ARM sqrt (bug 20660).Joseph Myers2016-10-202-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes ARM sqrt and sqrtf use the VSQRT VFP square root instruction when available, instead of much larger generic code for computing square roots. Now, GCC will normally inline sqrt calls except for negative arguments where errno needs to be set, and because the benchtests fail to use -fno-builtin that means no significant difference in benchmark results for sqrt (note, however, there are lots of __ieee754_sqrt calls internally in libm, which are *not* inlined - although some architectures define __ieee754_sqrt in their math_private.h for that purpose, ARM doesn't - so improving out-of-line sqrt performance is still relevant to those other functions, if not for most ordinary direct users of sqrt). With the benchtests changed to use -fno-builtin for sqrt tests, typical performance results before the change are ("max" is wildly varying in any case): "duration": 9.88358e+09, "iterations": 4.8783e+07, "max": 457.764, "min": 183.105, "mean": 202.603 and after it are: "duration": 9.45663e+09, "iterations": 2.24385e+08, "max": 274.659, "min": 30.517, "mean": 42.1447 Tested for ARM (hard-float and soft-float). [BZ #20660] * sysdeps/arm/e_sqrt.c: New file. * sysdeps/arm/e_sqrtf.c: Likewise.
* Stop powerpc copysignl raising "invalid" for sNaN argument (bug 20718).Joseph Myers2016-10-192-9/+24
| | | | | | | | | | | | | | | | | | | | | | The powerpc (hard-float) implementations of copysignl, both 32-bit and 64-bit, raise spurious "invalid" exceptions when the first argument is a signaling NaN. copysign functions should never raise exceptions even for signaling NaNs. The problem is the use of an fcmpu instruction to test the sign of the high part of the long double argument. This patch fixes the functions to use fsel instead (as used for fabsl following my fixes for a similar bug there), or to examine the integer representation for older 32-bit processors without fsel. Tested for powerpc64 and powerpc32 (configurations with and without fsel used). [BZ #20718] * sysdeps/powerpc/powerpc32/fpu/s_copysignl.S (__copysignl): Do not use floating-point comparisons to test sign. * sysdeps/powerpc/powerpc64/fpu/s_copysignl.S (__copysignl): Likewise.
* Add getpayload, getpayloadf, getpayloadl.Joseph Myers2016-10-1933-0/+307
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines functions for manipulating the payloads of NaNs. This patch implements the getpayload functions for glibc; these extract the NaN payload (from an argument passed as a pointer, for which corresponding libm-test support is added) and return it in the same floating-point type. The return value of these functions is unspecified for non-NaN arguments; the patch does the simplest thing to implement, which is that the functions do not check whether the argument is a NaN and just treat the relevant bits of the representation as a payload regardless. A conversion from integer to floating-point is used to produce the required return value, except in the ldbl-128 case; as 128-bit integers are not supported for all configurations using ldbl-128, the code constructs the required floating-point representation of the return value directly instead. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (getpayload): New declaration. * math/Versions (getpayload): New libm symbol at version GLIBC_2.25. (getpayloadf): Likewise. (getpayloadl): Likewise. * math/Makefile (libm-calls): Add s_getpayloadF. * math/libm-test.inc: Include <nan-high-order-bit.h>. (struct test_f_f_data): Add comment. (RUN_TEST_fp_f): New macro. (RUN_TEST_LOOP_fp_f): Likewise. (getpayload_test_data): New array. (getpayload_test): New function. (main): Call getpayload_test. * math/gen-libm-test.pl (parse_args): Handle 'p' in argument descriptor. * manual/arith.texi (FP Bit Twiddling): Document getpayload, getpayloadf and getpayloadl. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated. * sysdeps/ieee754/dbl-64/s_getpayload.c: New file. * sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c: Likewise. * sysdeps/ieee754/flt-32/s_getpayloadf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_getpayloadl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_getpayloadl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_getpayloadl.c: Likewise. * 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.
* Fix Linux fallocate tests for EOPNOTSUPPAdhemerval Zanella2016-10-182-2/+10
| | | | | | | | | | | | | | The fallocate syscall might fail on Linux due missing support from underlying filesystem (for instance some NFS versions). This patch adds this check for fallocate tests. It also moves tst-fallocate{64} to 'io' folder (since it is on fallocate{64} is built). Checked on x86_64. * sysdeps/unix/sysv/linux/Makefile [$(subdir) = math] (tests): Move tst-fallocate{64}. * sysdeps/unix/sysv/linux/tst-fallocate-common.c: Check for EOPNOTSUPP on syscall return.
* Bug 20689: Fix FMA and AVX2 detection on IntelCarlos O'Donell2016-10-171-10/+14
| | | | | | | | | | | | | | | | | | | | In the Intel Architecture Instruction Set Extensions Programming reference the recommended way to test for FMA in section '2.2.1 Detection of FMA' is: "Application Software must identify that hardware supports AVX as explained in ... after that it must also detect support for FMA..." We don't do that in glibc. We use osxsave to detect the use of xgetbv, and after that we check for AVX and FMA orthogonally. It is conceivable that you could have the AVX bit clear and the FMA bit in an undefined state. This commit fixes FMA and AVX2 detection to depend on usable AVX as required by the recommended Intel sequences. v1: https://www.sourceware.org/ml/libc-alpha/2016-10/msg00241.html v2: https://www.sourceware.org/ml/libc-alpha/2016-10/msg00265.html
* Define HIGH_ORDER_BIT_IS_SET_FOR_SNAN to 0 or 1.Joseph Myers2016-10-1722-36/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch moves the HIGH_ORDER_BIT_IS_SET_FOR_SNAN macro from being defined or undefined to the preferred convention of always being defined, to either 0 or 1, so allowing typo-proof tests with #if. The macro is moved from math_private.h to a new header nan-high-order-bit.h to make it easy for all architectures to define, either through the sysdeps/generic version of the header or through providing their own version of the header, without needing #ifndef in the generic math_private.h to give a default definition. The move also allows the macro to be used without needing math_private.h to be included; the immediate motivation of this patch is to allow tests to access this information (to know what kinds of NaNs 0 is a valid payload for) without needing to include math_private.h. Existing C level rather than preprocessor conditionals at all, but this patch does not make such a change). Tested for x86_64 and x86 (testsuite); also verified for x86_64, x86, mips64 and powerpc that installed stripped shared libraries are unchanged by the patch. * sysdeps/generic/nan-high-order-bit.h: New file. * sysdeps/hppa/nan-high-order-bit.h: Likewise. * sysdeps/mips/nan-high-order-bit.h: Likewise. * sysdeps/hppa/math_private.h: Remove file. * sysdeps/mips/math_private.h (HIGH_ORDER_BIT_IS_SET_FOR_SNAN): Do not define here. * sysdeps/ieee754/dbl-64/s_issignaling.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/dbl-64/s_totalorder.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/dbl-64/s_totalordermag.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/dbl-64/wordsize-64/s_issignaling.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/flt-32/s_issignalingf.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/flt-32/s_totalorderf.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/flt-32/s_totalordermagf.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/ldbl-128/s_issignalingl.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/ldbl-128/s_totalorderl.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/ldbl-128/s_totalordermagl.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/ldbl-128ibm/s_issignalingl.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/ldbl-96/s_issignalingl.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/ldbl-96/s_totalorderl.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef. * sysdeps/ieee754/ldbl-96/s_totalordermagl.c: Include <nan-high-order-bit.h>. [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Test with #if not #ifdef.
* S390: Fix fp comparison not raising FE_INVALID.Stefan Liebler2016-10-171-0/+36
| | | | | | | As gcc is using unordered comparison instructions which do not raise invalid exception if any operand is quiet NAN, FIX_COMPARE_INVALID is defined to 1. Thus iseqsig is calling feraiseexcept as workaround.
* hppa: Optimize atomic_compare_and_exchange_val_acqJohn David Anglin2016-10-151-17/+5
| | | | | | | | | | Changelog: * sysdeps/unix/sysv/linux/hppa/atomic-machine.h: Don't include abort-instr.h. (EFAULT): Remove conditional define. (ENOSYS): Likewise. (atomic_compare_and_exchange_val_acq): Use instruction nullification instead of conditional branch instructions.
* Add totalordermag, totalordermagf, totalordermagl.Joseph Myers2016-10-1537-3/+428
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In addition to the totalorder functions, TS 18661-1 defines totalordermag functions, which do the same comparison but on the absolute values of the arguments. This patch implements these functions for glibc, including the type-generic macro in <tgmath.h>. In general the implementations are similar to but simpler than those for the totalorder functions. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (totalordermag): New declaration. * math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (totalordermag): New macro. * math/Versions (totalordermag): New libm symbol at version GLIBC_2.25. (totalordermagf): Likewise. (totalordermagl): Likewise. * math/Makefile (libm-calls): Add s_totalordermagF. * math/libm-test.inc (totalordermag_test_data): New array. (totalordermag_test): New function. (main): Call totalordermag_test. * math/test-tgmath.c (NCALLS): Increase to 125. (F(compile_test)): Call totalordermag. (F(totalordermag)): New function. * manual/arith.texi (FP Comparison Functions): Document totalordermag, totalordermagf and totalordermagl. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated. * sysdeps/ieee754/dbl-64/s_totalordermag.c: New file. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c: Likewise. * sysdeps/ieee754/flt-32/s_totalordermagf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_totalordermagl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_totalordermagl.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-totalordermag.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add totalordermag. (CFLAGS-nldbl-totalordermag.c): New variable. * sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c (do_test): Also test totalordermagl. * sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c (do_test): Likewise. * 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.
* Fix warnings from latest GCC.steve ellcey-CA Eng-Software2016-10-141-4/+4
| | | | | * sysdeps/ieee754/dbl-64/e_pow.c (checkint) Make conditions explicitly boolean.
* Fix posix_fadvise64 build on mips64n64Adhemerval Zanella2016-10-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent binutils versions (at least 2.27) complains about libc.so when linking sotruss-lib.so with: libc.so:(*IND*+0x0): multiple definition of `posix_fadvise64@GLIBC_2.2' libc.so::(.text+0xcf940): first defined here libc.so:(*IND*+0x0): multiple definition of `posix_fadvise64' collect2: error: ld returned 1 exit status Dynamic symbols for libc.so shows (readelf --dyn-syms): 262: 000000000010b950 28 FUNC GLOBAL DEFAULT 12 posix_fadvise64@GLIBC_2.2 417: 000000000010b950 28 FUNC WEAK DEFAULT 12 posix_fadvise64@@GLIBC_2.2 1505: 000000000010b950 28 FUNC GLOBAL DEFAULT 12 posix_fadvise64@@GLIBC_2.3.3 That is, two separate definitions at version GLIBC_2.2. The issue is sysdeps/unix/sysv/linux/posix_fadvise64.c creates posix_fadvise64 weak_alias, while sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise64.c then adds compat_symbol / versioned_symbol calls. The patch remove the weak_alias definition on mips64 specific version so direct weak_alias is disabled. Checked on mips64n64 build with binutils 2.27.51.20161012. * sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise64.c: Undefine weak_alias.
* X86: Don't assert on older Intel CPUs [BZ #20647]H.J. Lu2016-10-121-1/+3
| | | | | | | | | | Since the maximum CPUID level of older Intel CPUs is 1, change handle_intel to return -1, instead of assert, when the maximum CPUID level is less than 2. [BZ #20647] * sysdeps/x86/cacheinfo.c (handle_intel): Return -1 if the maximum CPUID level is less than 2.
* Add totalorder, totalorderf, totalorderl.Joseph Myers2016-10-1239-3/+564
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines totalorder functions implementing the totalOrder comparison operation from IEEE 754-2008. This patch implements these functions for glibc, including the type-generic macro in <tgmath.h>. (The totalordermag functions will be added in a separate patch.) The description of the totalOrder operation is complicated. However, for IEEE interchange binary formats and the preferred quiet NaN convention, what that complicated description means is that you interpret the representation as a sign-magnitude integer (with -0 coming before +0) and do a <= comparison on that interpretation. For finite values and infinities the ordering of the sign-magnitude integers is just the same as the ordering of floating-point values, so this extends that to all representations. (Different representations of the same floating-point value - which includes same quantum in the decimal case - must still be considered equal by this operation, but that issue doesn't arise for IEEE interchange binary formats.) So the complications are: * When MIPS quiet NaN conventions are in use, the representation of NaNs needs adjusting before making such an integer comparison. This patch does this adjustment only when both arguments are NaNs, as there's no need for it if only one is a NaN, and as long as both are NaNs you can just flip the relevant bits without any problems from this turning a NaN into an infinity. * For the m68k version of ldbl-96, where the high mantissa bit is "don't care" for infinities and NaNs, representations where it differs must compare the same. Note: although the testcase for this compiles, I have not actually tested on m68k. * For ldbl-128ibm, the low part must be ignored when the high part is NaN, and low parts of +0 and -0 must be considered the same whatever the high part. The new tests in libm-test.inc are the first tests there specifying particular payloads for input NaNs. Separate tests are also added for the ldbl-96 and ldbl-128ibm special cases where there are different representations of the same value that must compare equal (which can't be covered in libm-test.inc as that only specifies values, not representations). Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (totalorder): New declaration. * math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (totalorder): New macro. * math/Versions (totalorder): New libm symbol at version GLIBC_2.25. (totalorderf): Likewise. (totalorderl): Likewise. * math/Makefile (libm-calls): Add s_totalorderF. * math/gen-libm-test.pl (parse_args): Escape quotes in test name string. * math/libm-test.inc (PAYLOAD_DIG): New macro. (qnan_value_pl): Likewise. (snan_value_pl): Likewise. (qnan_value): Define using qnan_value_pl. (snan_value): Define using snan_value_pl. (struct test_ff_i_data): Add comment about which tests use this structure. (RUN_TEST_ff_b): New macro. (RUN_TEST_LOOP_ff_b): Likewise. (totalorder_test_data): New array. (totalorder_test): New function. (main): Call totalorder_test. * math/test-tgmath.c (NCALLS): Increase to 122. (F(compile_test)): Call totalorder. (F(totalorder)): New function. * manual/arith.texi (FP Comparison Functions): Document totalorder, totalorderf and totalorderl. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated. * sysdeps/ieee754/dbl-64/s_totalorder.c: New file. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c: Likewise. * sysdeps/ieee754/flt-32/s_totalorderf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_totalorderl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_totalorderl.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-totalorder.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add totalorder. (CFLAGS-nldbl-totalorder.c): New variable. * sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c: New file. * sysdeps/ieee754/ldbl-128ibm/Makefile [$(subdir) = math] (tests): Add test-totalorderl-ldbl-128ibm. * sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c: New file. * sysdeps/ieee754/ldbl-96/Makefile [$(subdir) = math] (tests): Add test-totalorderl-ldbl-96. * 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.
* Consolidate Linux sync_file_range implementationsAdhemerval Zanella2016-10-117-94/+140
| | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates all the sync_file_range implementation for Linux in only one (sysdeps/unix/sysv/linux/sync_file_range.c). It also removes the syscall from the auto-generation using assembly macros (except for x86_64 due x32 [1]). For current minimum supported kernel (2.6.32 for x86_64 and 3.2 for all other architectures) either sync_file_range or sync_file_range2 is supported and it is expected that any future Linux ABI will provide either of one syscall. So the code path that returns ENOSYS in the case of missing syscall is removed. Checked on x86_64, i386, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/Makefile (tests): Add tst-sync_file_range. * sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c: Remove file. * sysdeps/sysv/linux/powerpc/powerpc64/sync_file_range.c: Likewise. * sysdeps/unix/sysv/linux/sync_file_range.c: New file. * sysdeps/unix/sysv/linux/tst-sync_file_range.c (sync_file_range): Consolidate all Linux implementations. [1] https://patchwork.ozlabs.org/patch/659794/
* powerpc32: make PLT call in _mcount compatible with -msecure-plt (bug 20554)Alan Modra2016-10-091-3/+24
|
* Consolidate posix_fadvise implementationsAdhemerval Zanella2016-10-0719-572/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates mostly of the Linux posix_fadvise{64} implementations on sysdeps/unix/sysv/linux/posix_fadvise{64}.c. It still keeps arch-specific files for: * S390-32: it uses a packed structure to pass all the arguments on syscall. It is the only supported port that implements __NR_fadvise64_64 in this way. * ARM: it does not implement __NR_fadvise64 (as other 32-bits ports), so posix_fadvise calls internal posix_fadvise64 symbol. * MIPS64 n64: it requires a different version number that other ports. The new macro SYSCALL_LL{64} is used to handle the offset argument and INTERNAL_SYSCALL_CALL to handle passing the correct number of expect arguments. The default Linux adds two new defines a port can use to control how __NR_fadvise64_64 passes the kernel arguments: * __ASSUME_FADVISE64_64_6ARG: the 'advise' argument is moved on second position. This is the case of powerpc32 and arm to avoid implement 7 argument syscall. * __ASSUME_FADVISE64_64_NO_ALIGN: for ABIs that defines __ASSUME_ALIGNED_REGISTER_PAIRS packs the offset without the leading '0'. This is the case of tile 32 bits. ARM also defines __NR_fadvise64_64 as __NR_arm_fadvise64_64 (which is also handled on arch kernel-feature.h). Tested on x86_64, x32, i686, armhf, and aarch64. * posix/Makefile (tests): Add tst-posix_fadvise and tst-posix_fadvise64. * posix/tst-posix_fadvise.c: New file. * posix/tst-posix_fadvise64.c: Likewise. * posix/tst-posix_fadvise-common.c: Likewise. * sysdeps/unix/sysv/linux/arm/kernel-features.h (__ASSUME_FADVISE64_64_6ARG): Define. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h [!__powerpc64__] (__ASSUME_FADVISE64_64_6ARG): Add define. * sysdeps/unix/sysv/linux/arm/posix_fadvise64.c: Remove file. * sysdeps/unix/sysv/linux/generic/wordsize-32/posix_fadvise.c: Likewise. * sysdeps/unix/sysv/linux/i386/posix_fadvise64.S: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/posix_fadvise.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/posix_fadvise64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise64.c (SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3) [__posix_fadvise64_l64]: Alias to __posix_fadvise64_l32. (SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3) [__posix_fadvise64_l32]: Add compat definition to posix_fadvise64. (SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3) [__posix_fadvise64_l64]: Add versioned definition to posix_fadvise64. * sysdeps/unix/sysv/linux/posix_fadvise.c (posix_fadvise): Build iff __OFF_T_MATCHES_OFF64_T is defined, use INTERNAL_SYSCALL_CALL, add __ASSUME_FADVISE64_64_6ARG/__ASSUME_FADVISE64_64_NO_ALIGN support. * sysdeps/unix/sysv/linux/posix_fadvise64.c (posix_fadvise64): Add __ASSUME_FADVISE64_64_NO_ALIGN support and use INTERNAL_SYSCALL_CALL.
* Consolidate posix_fallocate{64} implementationsAdhemerval Zanella2016-10-079-135/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates all the posix_fallocate{64} implementation for Linux in only one (sysdeps/unix/sysv/linux/posix_fallocate{64}.c). It also removes the syscall from the auto-generation using assembly macros. The macro SYSCALL_LL{64} is used to handle the offset argument along with the new INTERNAL_SYSCALL_CALL macro to define correct argument count for internal INTERNAL_SYSCALL call. Tested on x86_64, i686, x32, aarch64, ppc64le, and armhf. * io/Makefile (tests): Add tst-posix_fallocate and tst-posix_fallocate64. * io/tst-posix_fallocate-common.c: New file. * io/tst-posix_fallocate.c: Likewise. * io/tst-posix_fallocate64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fallocate.c: Remove file. * sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fallocate64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fallocate.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fallocate64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate64.c: Likewise. * sysdeps/unix/sysv/linux/posix_fallocate.c (posix_fallocate): Use SYSCALL_LL to pass both offset and len arguments. * sysdeps/unix/sysv/linux/posix_fallocate64.c (posix_fallocate64): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (pwrite64): Add __libc_pwrite64 alias used by posix_fallocate64.