about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* Revert {send,sendm,recv,recvm}msg conformance changesAdhemerval Zanella2016-06-1059-575/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After some discussion in libc-alpha about this POSIX compliance fix, I see that GLIBC should indeed revert back to previous definition of msghdr and cmsghdr and implementation of sendmsg, recvmsg, sendmmsg, recvmmsg due some reasons: * The possible issue where the syscalls wrapper add the compatibility layer is quite limited in scope and range. And kernel current also add some limits to the values on the internal msghdr and cmsghdr fields: - msghdr::msg_iovlen larger than UIO_MAXIOV (1024) returns EMSGSIZE. - msghdr::msg_controllen larger than INT_MAX returns ENOBUFS. * There is a small performance hit for recvmsg/sendmsg/recmmsg which is neglectable, but it is a big hit for sendmmsg since now instead of calling the syscall for the packed structure, GLIBC is calling multiple sendmsg. This defeat the very existence of the syscall. * It currently breaks libsanitizer build on GCC [1] (I fixed on compiler-rt). However the fix is incomplete because it does add any runtime check since libsanitizer currently does not have any facility to intercept symbols with multiple version [2]. This, along with incorret dlsym/dlvsym return for versioned symbol due another bug [3], makes hard to interpose versioned symbols. Also, current approach of fixing GCC PR#71445 leads to half-baked solutions without versioned symbol interposing. This patch basically reverts commits 2f0dc39029ae08, 222c2d7f4357d66, af7f7c7ec8dea1. I decided to not revert abf29edd4a3918 (Adjust kernel-features.h defaults for recvmsg and sendmsg) mainly because it does not really address the POSIX compliance original issue and also adds some cleanups. Tested on x86, i386, s390, s390x, aarch64, and powerpc64le. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71445 [2] https://github.com/google/sanitizers/issues/628 [3] https://sourceware.org/bugzilla/show_bug.cgi?id=14932 * conform/data/sys/socket.h-data (msghdr.msg_iovlen): Add xfail-. (msghdr.msg_controllen): Likewise. (cmsghdr.cmsg_len): Likewise. * nptl/Makefile (libpthread-routines): Remove ptw-oldrecvmsg and ptw-oldsendmsg. (CFLAGS-oldrecvmsg.c): Remove rule. (CFLAGS-oldsendmsg.c): Likewise. (CFLAGS-recvmsg.c): Add rule. (CFLAGS-sendmsg.c): Likewise. * sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove oldrecvmsg, oldsendmsg, oldrecvmmsg, oldsendmmsg. (CFLAGS-recvmsg.c): Remove rule. (CFLAGS-sendmsg.c): Likewise. (CFLAGS-oldrecvmsg.c): Likewise. (CFLAGS-oldsendmsg.c): Likewise. (CFLAGS-recvmmsg.c): Likewise. * sysdeps/unix/sysv/linux/bits/socket.h (msghdr.msg_iovlen): Revert to kernel defined interfaces. (msghdr.msg_controllen): Likewise. (cmsghdr.cmsg_len): Likewise. (msghdr.__glibc_reserved1): Remove member. (msghdr.__glibc_reserved2): Likewise. (cmsghdr.__glibc_reserved1): Likewise. * sysdeps/unix/sysv/linux/oldrecvmmsg.c: Remove file. * sysdeps/unix/sysv/linux/oldrecvmsg.c: Likewise. * sysdeps/unix/sysv/linux/oldsendmmsg.c: Likewise. * sysdeps/unix/sysv/linux/oldsendmsg.c: Likewise. * sysdeps/unix/sysv/linux/recvmmsg.c: Revert back to previous version. * sysdeps/unix/sysv/linux/recvmsg.c: Likewise. * sysdeps/unix/sysv/linux/sendmmsg.c: Likewise. * sysdeps/unix/sysv/linux/sendmsg.c: Likewise. * sysdeps/unix/sysv/linux/aarch64/Versions [libc] (GLIBC_2.24): Remove recvmsg and sendmsg. * sysdeps/unix/sysv/linux/alpha/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/hppa/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/i386/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/m68k/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/microblaze/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/nios2/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/powerpc/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/sh/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/sparc/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/tile/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/x86_64/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/Versions: Remove file * sysdeps/unix/sysv/linux/x86_64/64/Versions: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/Versions: Likewise. * sysdeps/unix/sysv/linux/aarch64/libc.abilist: Remove new 2.24 version for {recv,send,recm,sendm}msg. * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* Fix i386/x86_64 log2l (sNaN) (bug 20235).Joseph Myers2016-06-092-0/+2
| | | | | | | | | | | | | | The i386/x86_64 versions of log2l return sNaN for sNaN input. This patch fixes them to add NaN inputs to themselves so that qNaN is returned in this case. Tested for x86_64 and x86. [BZ #20235] * sysdeps/i386/fpu/e_log2l.S (__ieee754_log2l): Add NaN input to itself. * sysdeps/x86_64/fpu/e_log2l.S (__ieee754_log2l): Likewise. * math/libm-test.inc (log2_test_data): Add sNaN tests.
* Fix ldbl-128ibm log1pl (sNaN) (bug 20234).Joseph Myers2016-06-091-1/+1
| | | | | | | | | | | | The ldbl-128ibm version of log1pl returns sNaN for sNaN input. This patch fixes it to add such inputs to themselves so that qNaN is returned in this case. Tested for powerpc. [BZ #20234] * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Add positive infinity or NaN input to itself.
* Fix ldbl-128ibm expm1l (sNaN) (bug 20233).Joseph Myers2016-06-091-2/+2
| | | | | | | | | | | | The ldbl-128ibm version of expm1l returns sNaN for sNaN input. This patch fixes it to add such inputs to themselves so that qNaN is returned in this case. Tested for powerpc. [BZ #20233] * sysdeps/ieee754/ldbl-128ibm/s_expm1l.c (__expm1l): Add NaN input to itself.
* Fix ldbl-128 expm1l (sNaN) (bug 20232).Joseph Myers2016-06-091-2/+2
| | | | | | | | | | | | The ldbl-128 version of expm1l returns sNaN for sNaN input. This patch fixes it to add such inputs to themselves so that qNaN is returned in this case. Tested for mips64. [BZ #20232] * sysdeps/ieee754/ldbl-128/s_expm1l.c (__expm1l): Add NaN input to itself.
* Always indirect branch to __libc_start_main via GOTH.J. Lu2016-06-091-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Since __libc_start_main in libc.so is called very early, lazy binding isn't relevant. Always call __libc_start_main with indirect branch via GOT to avoid extra branch to PLT slot. In case of static executable, ld in binutils 2.26 or above can convert indirect branch into direct branch: 0000000000400a80 <_start>: 400a80: 31 ed xor %ebp,%ebp 400a82: 49 89 d1 mov %rdx,%r9 400a85: 5e pop %rsi 400a86: 48 89 e2 mov %rsp,%rdx 400a89: 48 83 e4 f0 and $0xfffffffffffffff0,%rsp 400a8d: 50 push %rax 400a8e: 54 push %rsp 400a8f: 49 c7 c0 20 1b 40 00 mov $0x401b20,%r8 400a96: 48 c7 c1 90 1a 40 00 mov $0x401a90,%rcx 400a9d: 48 c7 c7 c0 03 40 00 mov $0x4003c0,%rdi 400aa4: 67 e8 96 09 00 00 addr32 callq 401440 <__libc_start_main> 400aaa: f4 hlt * sysdeps/x86_64/start.S (_start): Always indirect branch to __libc_start_main via GOT.
* X86-64: Add dummy memcopy.h and wordcopy.cH.J. Lu2016-06-092-0/+2
| | | | | | | | | Since x86-64 no longer uses memory copy functions, add dummy memcopy.h and wordcopy.c to reduce code size. It reduces the size of libc.so by about 1 KB. * sysdeps/x86_64/memcopy.h: New file. * sysdeps/x86_64/wordcopy.c: Likewise.
* Fix i386/x86_64 log1pl (sNaN) (bug 20229).Joseph Myers2016-06-082-0/+2
| | | | | | | | | | | | | The i386/x86_64 versions of log1pl return sNaN for sNaN input. This patch fixes them to add a NaN input to itself so that qNaN is returned in this case. Tested for x86_64 and x86. [BZ #20229] * sysdeps/i386/fpu/s_log1pl.S (__log1pl): Add NaN input to itself. * sysdeps/x86_64/fpu/s_log1pl.S (__log1pl): Likewise. * math/libm-test.inc (log1p_test_data): Add sNaN tests.
* Fix i386/x86_64 log10l (sNaN) (bug 20228).Joseph Myers2016-06-082-0/+2
| | | | | | | | | | | | | | The i386/x86_64 versions of log10l return sNaN for sNaN input. This patch fixes them to add a NaN input to itself so that qNaN is returned in this case. Tested for x86_64 and x86. [BZ #20228] * sysdeps/i386/fpu/e_log10l.S (__ieee754_log10l): Add NaN input to itself. * sysdeps/x86_64/fpu/e_log10l.S (__ieee754_log10l): Likewise. * math/libm-test.inc (log10_test_data): Add sNaN tests.
* Fix i386/x86_64 logl (sNaN) (bug 20227).Joseph Myers2016-06-083-0/+3
| | | | | | | | | | | | | | | | The i386/x86_64 versions of logl return sNaN for sNaN input. This patch fixes them to add a NaN input to itself so that qNaN is returned in this case. Tested for x86_64 and x86 (including a build for i586 to cover the non-i686 logl version). [BZ #20227] * sysdeps/i386/fpu/e_logl.S (__ieee754_logl): Add NaN input to itself. * sysdeps/i386/i686/fpu/e_logl.S (__ieee754_logl): Likewise. * sysdeps/x86_64/fpu/e_logl.S (__ieee754_logl): Likewise. * math/libm-test.inc (log_test_data): Add sNaN tests.
* Fix i386/x86_64 expl, exp10l, expm1l for sNaN input (bug 20226).Joseph Myers2016-06-082-4/+10
| | | | | | | | | | | | | | | | | The i386 and x86_64 implementations of expl, exp10l and expm1l (code shared between the functions) return sNaN for sNaN input. This patch fixes them to add NaN inputs to themselves so that qNaN is returned in this case. Tested for x86_64 and x86. [BZ #20226] * sysdeps/i386/fpu/e_expl.S (IEEE754_EXPL): Add NaN argument to itself. * sysdeps/x86_64/fpu/e_expl.S (IEEE754_EXPL): Likewise. * math/libm-test.inc (exp_test_data): Add sNaN tests. (exp10_test_data): Likewise. (expm1_test_data): Likewise.
* Fix i386 cbrtl (sNaN) (bug 20224).Joseph Myers2016-06-081-0/+1
| | | | | | | | | | | | | | | The i386 version of cbrtl returns sNaN (without raising any exceptions) for sNaN input. This patch fixes it to add non-finite arguments to themselves (the code path in question is also reached for zero arguments, for which adding them to themselves is also harmless), so that "invalid" is raised and qNaN returned. Tested for x86_64 and x86. [BZ #20224] * sysdeps/i386/fpu/s_cbrtl.S (__cbrtl): Add non-finite or zero argument to itself. * math/libm-test.inc (cbrt_test_data): Add sNaN tests.
* X86-64: Remove previous default/SSE2/AVX2 memcpy/memmoveH.J. Lu2016-06-0819-1490/+394
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the new SSE2/AVX2 memcpy/memmove are faster than the previous ones, we can remove the previous SSE2/AVX2 memcpy/memmove and replace them with the new ones. No change in IFUNC selection if SSE2 and AVX2 memcpy/memmove weren't used before. If SSE2 or AVX2 memcpy/memmove were used, the new SSE2 or AVX2 memcpy/memmove optimized with Enhanced REP MOVSB will be used for processors with ERMS. The new AVX512 memcpy/memmove will be used for processors with AVX512 which prefer vzeroupper. Since the new SSE2 memcpy/memmove are faster than the previous default memcpy/memmove used in libc.a and ld.so, we also remove the previous default memcpy/memmove and make them the default memcpy/memmove, except that non-temporal store isn't used in ld.so. Together, it reduces the size of libc.so by about 6 KB and the size of ld.so by about 2 KB. [BZ #19776] * sysdeps/x86_64/memcpy.S: Make it dummy. * sysdeps/x86_64/mempcpy.S: Likewise. * sysdeps/x86_64/memmove.S: New file. * sysdeps/x86_64/memmove_chk.S: Likewise. * sysdeps/x86_64/multiarch/memmove.S: Likewise. * sysdeps/x86_64/multiarch/memmove_chk.S: Likewise. * sysdeps/x86_64/memmove.c: Removed. * sysdeps/x86_64/multiarch/memcpy-avx-unaligned.S: Likewise. * sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S: Likewise. * sysdeps/x86_64/multiarch/memmove-avx-unaligned.S: Likewise. * sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S: Likewise. * sysdeps/x86_64/multiarch/memmove.c: Likewise. * sysdeps/x86_64/multiarch/memmove_chk.c: Likewise. * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Remove memcpy-sse2-unaligned, memmove-avx-unaligned, memcpy-avx-unaligned and memmove-sse2-unaligned-erms. * sysdeps/x86_64/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Replace __memmove_chk_avx512_unaligned_2 with __memmove_chk_avx512_unaligned. Remove __memmove_chk_avx_unaligned_2. Replace __memmove_chk_sse2_unaligned_2 with __memmove_chk_sse2_unaligned. Remove __memmove_chk_sse2 and __memmove_avx_unaligned_2. Replace __memmove_avx512_unaligned_2 with __memmove_avx512_unaligned. Replace __memmove_sse2_unaligned_2 with __memmove_sse2_unaligned. Remove __memmove_sse2. Replace __memcpy_chk_avx512_unaligned_2 with __memcpy_chk_avx512_unaligned. Remove __memcpy_chk_avx_unaligned_2. Replace __memcpy_chk_sse2_unaligned_2 with __memcpy_chk_sse2_unaligned. Remove __memcpy_chk_sse2. Remove __memcpy_avx_unaligned_2. Replace __memcpy_avx512_unaligned_2 with __memcpy_avx512_unaligned. Remove __memcpy_sse2_unaligned_2 and __memcpy_sse2. Replace __mempcpy_chk_avx512_unaligned_2 with __mempcpy_chk_avx512_unaligned. Remove __mempcpy_chk_avx_unaligned_2. Replace __mempcpy_chk_sse2_unaligned_2 with __mempcpy_chk_sse2_unaligned. Remove __mempcpy_chk_sse2. Replace __mempcpy_avx512_unaligned_2 with __mempcpy_avx512_unaligned. Remove __mempcpy_avx_unaligned_2. Replace __mempcpy_sse2_unaligned_2 with __mempcpy_sse2_unaligned. Remove __mempcpy_sse2. * sysdeps/x86_64/multiarch/memcpy.S (__new_memcpy): Support __memcpy_avx512_unaligned_erms and __memcpy_avx512_unaligned. Use __memcpy_avx_unaligned_erms and __memcpy_sse2_unaligned_erms if processor has ERMS. Default to __memcpy_sse2_unaligned. (ENTRY): Removed. (END): Likewise. (ENTRY_CHK): Likewise. (libc_hidden_builtin_def): Likewise. Don't include ../memcpy.S. * sysdeps/x86_64/multiarch/memcpy_chk.S (__memcpy_chk): Support __memcpy_chk_avx512_unaligned_erms and __memcpy_chk_avx512_unaligned. Use __memcpy_chk_avx_unaligned_erms and __memcpy_chk_sse2_unaligned_erms if if processor has ERMS. Default to __memcpy_chk_sse2_unaligned. * sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S Change function suffix from unaligned_2 to unaligned. * sysdeps/x86_64/multiarch/mempcpy.S (__mempcpy): Support __mempcpy_avx512_unaligned_erms and __mempcpy_avx512_unaligned. Use __mempcpy_avx_unaligned_erms and __mempcpy_sse2_unaligned_erms if processor has ERMS. Default to __mempcpy_sse2_unaligned. (ENTRY): Removed. (END): Likewise. (ENTRY_CHK): Likewise. (libc_hidden_builtin_def): Likewise. Don't include ../mempcpy.S. (mempcpy): New. Add a weak alias. * sysdeps/x86_64/multiarch/mempcpy_chk.S (__mempcpy_chk): Support __mempcpy_chk_avx512_unaligned_erms and __mempcpy_chk_avx512_unaligned. Use __mempcpy_chk_avx_unaligned_erms and __mempcpy_chk_sse2_unaligned_erms if if processor has ERMS. Default to __mempcpy_chk_sse2_unaligned.
* X86-64: Remove the previous SSE2/AVX2 memsetsH.J. Lu2016-06-088-319/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the new SSE2/AVX2 memsets are faster than the previous ones, we can remove the previous SSE2/AVX2 memsets and replace them with the new ones. This reduces the size of libc.so by about 900 bytes. No change in IFUNC selection if SSE2 and AVX2 memsets weren't used before. If SSE2 or AVX2 memset was used, the new SSE2 or AVX2 memset optimized with Enhanced REP STOSB will be used for processors with ERMS. The new AVX512 memset will be used for processors with AVX512 which prefer vzeroupper. [BZ #19881] * sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S: Folded into ... * sysdeps/x86_64/memset.S: This. (__bzero): Removed. (__memset_tail): Likewise. (__memset_chk): Likewise. (memset): Likewise. (MEMSET_CHK_SYMBOL): New. Define only if MEMSET_SYMBOL isn't defined. (MEMSET_SYMBOL): Define only if MEMSET_SYMBOL isn't defined. * sysdeps/x86_64/multiarch/memset-avx2.S: Removed. (__memset_zero_constant_len_parameter): Check SHARED instead of PIC. * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Remove memset-avx2 and memset-sse2-unaligned-erms. * sysdeps/x86_64/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Remove __memset_chk_sse2, __memset_chk_avx2, __memset_sse2 and __memset_avx2_unaligned. * sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S (__bzero): Enabled. * sysdeps/x86_64/multiarch/memset.S (memset): Replace __memset_sse2 and __memset_avx2 with __memset_sse2_unaligned and __memset_avx2_unaligned. Use __memset_sse2_unaligned_erms or __memset_avx2_unaligned_erms if processor has ERMS. Support __memset_avx512_unaligned_erms and __memset_avx512_unaligned. (memset): Removed. (__memset_chk): Likewise. (MEMSET_SYMBOL): New. (libc_hidden_builtin_def): Replace __memset_sse2 with __memset_sse2_unaligned. * sysdeps/x86_64/multiarch/memset_chk.S (__memset_chk): Replace __memset_chk_sse2 and __memset_chk_avx2 with __memset_chk_sse2_unaligned and __memset_chk_avx2_unaligned_erms. Use __memset_chk_sse2_unaligned_erms or __memset_chk_avx2_unaligned_erms if processor has ERMS. Support __memset_chk_avx512_unaligned_erms and __memset_chk_avx512_unaligned.
* Fix i386 atanhl (sNaN) (bug 20219).Joseph Myers2016-06-071-0/+1
| | | | | | | | | | | | | The i386 version of atanhl returns sNaN for sNaN input. This patch fixes it to add NaN arguments to themselves so it returns qNaN in this case. Tested for x86_64 and x86. [BZ #20219] * sysdeps/i386/fpu/e_atanhl.S (__ieee754_atanhl): Add NaN argument to itself. * math/libm-test.inc (atanh_test_data): Add sNaN tests.
* Fix i386 asinhl (sNaN) (bug 20218).Joseph Myers2016-06-071-0/+1
| | | | | | | | | | | | | | The i386 version of asinhl returns sNaN (without raising any exceptions) for sNaN input. This patch fixes it to add non-finite arguments to themselves, so that "invalid" is raised and qNaN returned. Tested for x86_64 and x86. [BZ #20218] * sysdeps/i386/fpu/s_asinhl.S (__asinhl): Add non-finite argument to itself. * math/libm-test.inc (asinh_test_data): Add sNaN tests.
* Check FMA after COMMON_CPUID_INDEX_80000001H.J. Lu2016-06-071-4/+9
| | | | | | | | | | | Since the FMA4 bit is in COMMON_CPUID_INDEX_80000001 and FMA4 requires AVX, determine if FMA4 is usable after COMMON_CPUID_INDEX_80000001 is available and if AVX is usable. [BZ #20195] * sysdeps/x86/cpu-features.c (get_common_indeces): Move FMA4 check to ... (init_cpu_features): Here.
* Bug 20214: Fix linux/in6.h and netinet/in.h sync.Carlos O'Donell2016-06-071-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | In: https://sourceware.org/glibc/wiki/Synchronizing_Headers we explain how we synchronize our headers with Linux kernel headers. In order to synchronize with the Linux linux/in6.h and linux/ipv6.h headers we checked for their guard macros and then defined __USE_KERNEL_IPV6_DEFS and conditionalized code on this macro. In upstream kernel 56c176c9 the _UAPI prefix was stripped and this broke our synchronized headers again. We now need to check for _LINUX_IN6_H and _IPV6_H, and keep checking the old versions of the header guard checks for maximum backwards compatibility with older Linux headers (the history is actually a bit muddled here and it appears upstream linus kernel broke this 10 months *before* our fix was ever applied to glibc, but without glibc testing we didn't notice and distro kernels have their own testing to fix this). This patch fixes synchronization with linux/in6.h and with netinet/in.h.
* Bug 20198: quick_exit should not call destructors.Carlos O'Donell2016-06-0629-0/+29
| | | | | | | | | | | | | | | | | | In C++11 18.5.12 says "Objects shall not be destroyed as a result of calling quick_exit." In C11 quick_exit is silent about thread object destruction. Therefore to make glibc C++ compliant we do not call any thread local destructors. A new regression test verifies the fix. I will note that C++11 18.5.3 makes it clear that C++ defines additional requirements for _Exit() to prevent it from executing destructors. Given that the point of _Exit() is to terminate the process immediately it makes sense the C and C++ should line up and avoid calling destructors. No failures. New regtest passes.
* Fix a typo in comments in memmove-vec-unaligned-erms.SH.J. Lu2016-06-061-1/+1
| | | | | * sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: Fix a typo in comments.
* Fix dbl-64 asin (sNaN) (bug 20213).Joseph Myers2016-06-061-1/+1
| | | | | | | | | | | | | The dbl-64 version of asin returns sNaN for sNaN arguments. This patch fixes it to add NaN arguments to themselves so that qNaN is returned in this case. Tested for x86_64 and x86. [BZ #20213] * sysdeps/ieee754/dbl-64/e_asin.c (__ieee754_asin): Add NaN argument to itself. * math/libm-test.inc (asin_test_data): Add sNaN tests.
* Consolidate pwritev/pwritev64 implementationsAdhemerval Zanella2016-06-068-199/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates all the pwritev{64} implementation for Linux in only one (sysdeps/unix/sysv/linux/pwritev{64}.c). It also removes the syscall from the auto-generation using assembly macros. It was based on previous pwrite/pwrite64 consolidation patch. The new macro SYSCALL_LL{64} is used to handle the offset argument and alias is created for __ASSUME_OFF_DIFF_OFF64 in case of pread64. Checked on x86_64, i386, aarch64, and powerpc64le. * misc/Makefile (CFLAGS-pwritev.c): New variable: add cancellation required flags. (CFLAGS-pwritev64.c): Likewise. * sysdeps/unix/sysv/linux/generic/wordsize-32/pwritev.c: Remove file. * sysdeps/unix/sysv/linux/generic/wordsize-32/pwritev64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/pwritev64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/pwritev.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/pwritev64.: Likwise. * sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list (pwritev): Remove syscall from auto-generation. * sysdeps/unix/sysv/linux/pwritev.c: Rewrite implementation. [WORDSIZE == 64] (pwritev64): Remove macro. [!PWRITEV] (PWRITEV): Likewise. [!PWRITEV] (PWRITEV_REPLACEMENT): Likewise. [!PWRITEV] (PWRITE): Likewise. [!PWRITEV] (OFF_T): Likewise. [!__ASSUME_PWRITEV] (PWRITEV_REPLACEMENT): Likewise. (LO_HI_LONG): Remove macro. [__WORDSIZE != 64 || __ASSUME_OFF_DIFF_OFF64] (pwritev): Add function. * sysdeps/unix/sysv/linux/pwritev64.c: Rewrite implementation. (PWRITEV): Remove macro. (PWRITEV_REPLACEMENTE): Likewise. (PWRITE): Likewise. (OFF_T): Likewise. (pwritev64): New function. * nptl/tst-cancel4.c (tf_writev): Add test.
* Consolidate preadv/preadv64 implementationAdhemerval Zanella2016-06-068-200/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates all the preadv{64} implementation for Linux in only one (sysdeps/unix/sysv/linux/preadv{64}.c). It also removes the syscall from the auto-generation using assembly macros. It was based on previous pread/pread64 consolidation patch. The new macro SYSCALL_LL{64} is used to handle the offset argument and alias is created for __ASSUME_OFF_DIFF_OFF64 in case of pread64. Checked on x86_64, i386, aarch64, and powerpc64le. * misc/Makefile (CFLAGS-preadv.c): New variable: add cancellation required flags. (CFLAGS-preadv64.c): Likewise. * sysdeps/unix/sysv/linux/generic/wordsize-32/preadv.c: Remove file. * sysdeps/unix/sysv/linux/generic/wordsize-32/preadv64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/preadv64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/preadv.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/preadv64.: Likwise. * sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list (preadv): Remove syscall from auto-generation. * sysdeps/unix/sysv/linux/preadv.c: Rewrite implementation. [WORDSIZE == 64] (preadv64): Remove macro. [!PREADV] (PREADV): Likewise. [!PREADV] (PREADV_REPLACEMENT): Likewise. [!PREADV] (PREAD): Likewise. [!PREADV] (OFF_T): Likewise. [!__ASSUME_PREADV] (PREADV_REPLACEMENT): Likewise. (LO_HI_LONG): Remove macro. [__WORDSIZE != 64 || __ASSUME_OFF_DIFF_OFF64] (preadv): Add function. * sysdeps/unix/sysv/linux/preadv64.c: Rewrite implementation. (PREADV): Remove macro. (PREADV_REPLACEMENTE): Likewise. (PREAD): Likewise. (OFF_T): Likewise. (preadv64): New function. * nptl/tst-cancel4.c (tf_preadv): Add test.
* Fix dbl-64 acos (sNaN) (bug 20212).Joseph Myers2016-06-061-1/+1
| | | | | | | | | | | | | The dbl-64 version of acos returns sNaN for sNaN arguments. This patch fixes it to add NaN arguments to themselves so that qNaN is returned in this case. Tested for x86_64 and x86. [BZ #20212] * sysdeps/ieee754/dbl-64/e_asin.c (__ieee754_acos): Add NaN argument to itself. * math/libm-test.inc (acos_test_data): Add sNaN tests.
* powerpc: Fix --disable-multi-arch build on POWER8Tulio Magno Quites Machado Filho2016-06-065-6/+27
| | | | | | Add missing symbols of stpncpy and strcasestr when multi-arch is disabled. Fix memset call from strncpy/stpncpy when multi-arch is disabled.
* Fix x86/x86_64 nextafterl incrementing negative subnormals (bug 20205).Joseph Myers2016-06-031-1/+1
| | | | | | | | | | | | | | | | | The x86 / x86_64 implementation of nextafterl (also used for nexttowardl) produces incorrect results (NaNs) when negative subnormals, the low 32 bits of whose mantissa are zero, are incremented towards zero. This patch fixes this by disabling the logic to decrement the exponent in that case. Tested for x86_64 and x86. [BZ #20205] * sysdeps/i386/fpu/s_nextafterl.c (__nextafterl): Do not adjust exponent when incrementing negative subnormal with low mantissa word zero. * math/libm-test.inc (nextafter_test_data) [TEST_COND_intel96]: Add another test.
* Fix macro API for __USE_KERNEL_IPV6_DEFS.Carlos O'Donell2016-06-021-1/+3
| | | | | | | | | | | | | | | | The use of __USE_KERNEL_IPV6_DEFS with ifndef is bad practice per: https://sourceware.org/glibc/wiki/Wundef. This change moves it to use 'if' and always define the macro. Please note that this is not the only problem with this code. I have a series of fixes after this one to resolve breakage with this code and add regression tests for it via compile-only source testing (to be discussed in another thread). Unfortunately __USE_KERNEL_XATTR_DEFS is set by the kernel and not glibc, and uses 'define', so we can't fix that yet.
* hurd: disable ifunc for nowSamuel Thibault2016-05-302-0/+8
| | | | | | * sysdeps/mach/hurd/configure.ac (libc_cv_ld_gnu_indirect_function): Set to no. * sysdeps/mach/hurd/configure: Refresh.
* posix: Call _exit in failure case for posix_spawn{p} (BZ#20178)Adhemerval Zanella2016-05-301-1/+1
| | | | | | | | | | | This patch call _exit instead of exit in failure case for the spawned child in Linux posix_spawn{p} implementation. Tested on x86_64. [BZ #20178] * sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Call _exit on failure instead of exit.
* hurd: fix _hurd_self_sigstate reference from ____longjmp_chkSamuel Thibault2016-05-301-1/+6
| | | | | * sysdeps/mach/hurd/i386/____longjmp_chk.S (____longjmp_chk) [PIC]: Use PLT entry for calling _hurd_self_sigstate.
* Count number of logical processors sharing L2 cacheH.J. Lu2016-05-271-34/+116
| | | | | | | | | | | | | For Intel processors, when there are both L2 and L3 caches, SMT level type should be ued to count number of available logical processors sharing L2 cache. If there is only L2 cache, core level type should be used to count number of available logical processors sharing L2 cache. Number of available logical processors sharing L2 cache should be used for non-inclusive L2 and L3 caches. * sysdeps/x86/cacheinfo.c (init_cacheinfo): Count number of available logical processors with SMT level type sharing L2 cache for Intel processors.
* Fix powerpc64 ceil, rint etc. on sNaN input (bug 20160).Joseph Myers2016-05-2712-12/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | The powerpc64 versions of ceil, floor, round, trunc, rint, nearbyint and their float versions return sNaN for sNaN input when they should return qNaN. This patch fixes them to add a NaN argument to itself to quiet sNaNs before returning. Tested for powerpc64. [BZ #20160] * sysdeps/powerpc/powerpc64/fpu/s_ceil.S (__ceil): Add NaN argument to itself before returning the result. * sysdeps/powerpc/powerpc64/fpu/s_ceilf.S (__ceilf): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_floor.S (__floor): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_floorf.S (__floorf): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S (__nearbyint): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S (__nearbyintf): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_rint.S (__rint): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_rintf.S (__rintf): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_round.S (__round): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_roundf.S (__roundf): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_trunc.S (__trunc): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_truncf.S (__truncf): Likewise.
* Fix powerpc32 ceil, rint etc. on sNaN input (bug 20160).Joseph Myers2016-05-2712-12/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | The powerpc32 versions of ceil, floor, round, trunc, rint, nearbyint and their float versions return sNaN for sNaN input when they should return qNaN. This patch fixes them to add a NaN argument to itself to quiet sNaNs before returning. The powerpc64 versions, which have the same bug, will be addressed separately. Tested for powerpc32. [BZ #20160] * sysdeps/powerpc/powerpc32/fpu/s_ceil.S (__ceil): Add NaN argument to itself before returning the result. * sysdeps/powerpc/powerpc32/fpu/s_ceilf.S (__ceilf): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_floor.S (__floor): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_floorf.S (__floorf): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S (__nearbyint): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S (__nearbyintf): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_rint.S (__rint): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_rintf.S (__rintf): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_round.S (__round): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_roundf.S (__roundf): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_trunc.S (__trunc): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_truncf.S (__truncf): Likewise.
* Avoid "invalid" exceptions from powerpc fabsl (sNaN) (bug 20157).Joseph Myers2016-05-272-5/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The powerpc implementations of fabsl for ldbl-128ibm (both powerpc32 and powerpc64) wrongly raise the "invalid" exception for sNaN arguments. fabs functions should be quiet for all inputs including signaling NaNs. The problem is the use of a comparison instruction fcmpu to determine if the high part of the argument is negative and so the low part needs to be negated; such instructions raise "invalid" for sNaNs. There is a pure integer implementation of fabsl in sysdeps/ieee754/ldbl-128ibm/s_fabsl.c. However, it's not necessary to use it to avoid such exceptions. The fsel instruction does not raise exceptions for sNaNs, and can be used in place of the original comparison. (Note that if the high part is zero or a NaN, it does not matter whether the low part is negated; the choice of whether the low part of a zero is +0 or -0 does not affect the value, and the low part of a NaN does not affect the value / payload either.) The condition in GCC for fsel to be available is TARGET_PPC_GFXOPT, corresponding to the _ARCH_PPCGR predefined macro. fsel is available on all 64-bit processors supported by GCC. A few 32-bit processors supported by GCC do not have TARGET_PPC_GFXOPT despite having hard float support. To support those processors, integer code (similar to that in copysignl) is included for the !_ARCH_PPCGR case for powerpc32. Tested for powerpc32 (configurations with and without _ARCH_PPCGR) and powerpc64. [BZ #20157] * sysdeps/powerpc/powerpc32/fpu/s_fabsl.S (__fabsl): Use fsel to determine whether to negate low half if [_ARCH_PPCGR], and integer comparison otherwise. * sysdeps/powerpc/powerpc64/fpu/s_fabsl.S (__fabsl): Use fsel to determine whether to negate low half.
* Fix ldbl-128ibm ceill, rintl etc. for sNaN arguments (bug 20156).Joseph Myers2016-05-275-0/+15
| | | | | | | | | | | | | | | | | | | The ldbl-128ibm implementations of ceill, floorl, roundl, truncl, rintl and nearbyintl wrongly return an sNaN when given an sNaN argument. This patch fixes them to add such an argument to itself to turn it into a quiet NaN. (The code structure means this "else" case applies to any argument which is zero or not finite; it's OK to do this in all such cases.) Tested for powerpc. [BZ #20156] * sysdeps/ieee754/ldbl-128ibm/s_ceill.c (__ceill): Add high part to itself when zero or not finite. * sysdeps/ieee754/ldbl-128ibm/s_floorl.c (__floorl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_rintl.c (__rintl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_roundl.c (__roundl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_truncl.c (__truncl): Likewise.
* Fix ldbl-128ibm sqrtl (sNaN) (bug 20153).Joseph Myers2016-05-261-5/+3
| | | | | | | | | | | | | | The ldbl-128ibm implementation of sqrtl wrongly returns an sNaN for signaling NaN arguments. This patch fixes it to quiet its argument, using the same x * x + x return for infinities and NaNs as the dbl-64 implementation uses to ensure that +Inf maps to +Inf while -Inf and NaN map to NaN. Tested for powerpc. [BZ #20153] * sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c (__ieee754_sqrtl): Return x * x + x for infinities and NaNs.
* Fix ldbl-128 j0l, j1l, y0l, y1l for sNaN argument (bug 20151).Joseph Myers2016-05-262-4/+4
| | | | | | | | | | | | | | | The ldbl-128 implementations of j0l, j1l, y0l, y1l (also used for ldbl-128ibm) return an sNaN argument unchanged. This patch fixes them to add a NaN argument to itself to quiet it before return. Tested for mips64. [BZ #20151] * sysdeps/ieee754/ldbl-128/e_j0l.c (__ieee754_j0l): Add NaN argument to itself before returning result. (__ieee754_y0l): Likewise. * sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_j1l): Likewise. (__ieee754_y1l).
* network: Fix missing bits from {recv,send}{m}msg standard com,plianceAdhemerval Zanella2016-05-262-2/+2
| | | | | | | | | | | | | | | | | | | This patch fixes wrong/missing bits from the Fix {recv,send}{m}msg standard compliance (BZ#16919) patches: * nptl/Makefile sets CFLAGS-oldrecvfrom.c, but there's no such file as oldrecvfrom.c. It should be oldsendmsg.c as defined by ChangeLog. * sysdeps/unix/sysv/linux/hppa/Versions and sysdeps/unix/sysv/linux/i386/Versions list a symbol recvms instead of recvmsg at version GLIBC_2.24. * nptl/Makefile (CFLAGS-oldrecvfrom.c): Remove rule. (CFLAGS-oldsendmsg.c): Add rule. * sysdeps/unix/sysv/linux/hppa/Versions [libc] (GLIBC_2.24): Correct recvmsg symbol name. * sysdeps/unix/sysv/linux/i386/Versions [libc] (GLIBC_2.24): Likewise.
* network: recvmmsg and sendmmsg standard compliance (BZ#16919)Adhemerval Zanella2016-05-2515-44/+275
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | POSIX specifies that both msghdr::msg_iovlen and msghdr::msg_controllen to be of size int and socklen_t respectively, however Linux implements it as a size_t. So for 64-bits architecture where sizeof of size_t is larger than socklen_t, both sendmmsg and recvmmsg need to adjust the mmsghdr::msg_hdr internal fields before issuing the syscall itself. This patch fixes it by operating on the padding if it the case. For recvmmsg, the most straightfoward case, only zero padding the fields is suffice. However, for sendmmsg, where adjusting the buffer is out of the contract (since it may point to a read-only data), the function is rewritten to use sendmsg instead (which from previous patch allocates a temporary msghdr to operate on). Also for 64-bit ports that requires it, a new recvmmsg and sendmmsg compat version is created (which uses size_t for both cmsghdr::cmsg_len and internal Tested on x86_64, i686, aarch64, armhf, and powerpc64le. * sysdeps/unix/sysv/linux/Makefile [$(subdir) = socket] (sysdep_routines): Add oldrecvmmsg and oldsendmmsg. * sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add recvmmsg and sendmmsg. * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise. * sysdeps/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/oldrecvmmsg.c: New file. * sysdeps/unix/sysv/linux/oldsendmmsg.c: Likewise. * sysdeps/unix/sysv/linux/recvmmsg.c (__recvmmsg): Adjust msghdr iovlen and controllen fields to adjust to POSIX specification. * sysdeps/unix/sysv/linux/sendmmsg.c (__sendmmsg): Likewise.
* network: recvmsg and sendmsg standard compliance (BZ#16919)Adhemerval Zanella2016-05-2560-37/+350
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | POSIX specifies that both msghdr::msg_iovlen and msghdr::msg_controllen to be of size int and socklen_t respectively. However Linux defines it as both size_t and for 64-bit it requires some adjustments to make the functions standard compliance. This patch fixes it by creating a temporary header and zeroing the pad fields for 64-bits architecture where size of size_t exceeds the size of the int. Also the new recvmsg and sendmsg implementation is only added on libc, with libpthread only containing a compat symbol. Tested on x86_64, i686, aarch64, armhf, and powerpc64le. * conform/data/sys/socket.h-data (msghdr.msg_iovlen): Remove xfail- and change to correct expected type. (msghdr.msg_controllen): Likewise. (cmsghdr.cmsg_len): Likewise. * sysdeps/unix/sysv/linux/bits/socket.h (msghdr.msg_iovlen): Fix expected POSIX assumption about the size. (msghdr.msg_controllen): Likewise. (msghdr.__glibc_reserved1): Likewise. (msghdr.__glibc_reserved2): Likewise. (cmsghdr.cmsg_len): Likewise. (cmsghdr.__glibc_reserved1): Likewise. * nptl/Makefile (libpthread-routines): Remove ptw-recvmsg and ptw-sendmsg. Add ptw-oldrecvmsg and ptw-oldsendmsg. (CFLAGS-sendmsg.c): Remove rule. (CFLAGS-recvmsg.c): Likewise. (CFLAGS-oldsendmsg.c): Add rule. (CFLAGS-oldrecvmsg.c): Likewise. * sysdeps/unix/sysv/linux/alpha/Versions [libc] (GLIBC_2.24): Add recvmsg and sendmsg. * sysdeps/unix/sysv/linux/aarch64/Version [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/arm/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/hppa/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/i386/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/ia64/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/m68k/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/microblaze/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/nios2/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/powerpc/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/sh/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/sparc/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/Versions [libc] (GLIBC_2.24): Likewise. ( sysdeps/unix/sysv/linux/tile/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/Versions [libc] (GLIBC_2.24): Likewise. ( sysdeps/unix/sysv/linux/x86_64/64/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/x84_64/Versions [libc] (GLIBC_2.24): Likewise. * sysdeps/unix/sysv/linux/Makefile [$(subdir) = socket)] (sysdep_headers): Add oldrecvmsg and oldsendmsg. (CFLAGS-sendmsg.c): Add rule. (CFLAGS-recvmsg.c): Likewise. (CFLAGS-oldsendmsg.c): Likewise. (CFLAGS-oldrecvmsg.c): Likewise. * sysdeps/unix/sysv/linux/check_native.c (__check_native): Fix msghdr initialization. * sysdeps/unix/sysv/linux/check_pf.c (make_request): Likewise. * sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Likewise. * sysdeps/unix/sysv/linux/oldrecvmsg.c: New file. * sysdeps/unix/sysv/linux/oldsendmsg.c: Likewise. * sysdeps/unix/sysv/linux/recvmsg.c (__libc_recvmsg): Adjust msghdr iovlen and controllen fields to adjust to POSIX specification. * sysdeps/unix/sysv/linux/sendmsg.c (__libc_sendmsg): Likewise. * sysdeps/unix/sysv/linux/aarch64/libc.abilist: New version and added recvmsg and sendmsg. * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist: Likewise. * sysdeps/unix/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise. * sysdepe/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise. Likewise. Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise. Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* Adjust kernel-features.h defaults for recvmsg and sendmsgAdhemerval Zanella2016-05-2515-28/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the auto-generation for recvmsg and sendmsg syscall and adjust the kernel-features.h for all architectures supported on Linux. This patch follows the idea of 'Adjust kernel-features.h defaults for socket syscalls.' (35ade9f11b9007ee9683529f2d33698ff35255c8) by define __ASSUME_SENDMSG_SYSCALL and __ASSUME_RECVMSG_SYSCALL as supported by default and undefine it for the architecture that do not support it directly. The main rationale is to make is easier add code wrapper over the syscall to fix BZ#16919 (recvmsg standard compliance). Tested on x86_64, i686, aarch64, armhf, and powerpc64le. * sysdeps/unix/sysv/linux/alpha/syscalls.list (recvmsg): Remove from auto-generation. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/arm/syscalls.list (recvmsg): Likewise. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list (recvmsg): Likewise. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (recvmsg): Likewise. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (recvmsg): Likewise. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list (recvmsg): Likewise. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list (recvmsg): Likewise. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (recvmsg): Likewise. (sendmsg): Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL): Remove. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_SENDMSG_SYSCALL): Undefine. [__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_RECVMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_SENDMSG_SYSCALL): Define. (__ASSUME_RECVMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/m68k/kernel-features.h [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL): Remove. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_SENDMSG_SYSCALL): Undefine. [__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_RECVMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL): Remove. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_SENDMSG_SYSCALL): Undefine. [__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_RECVMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_SENDMSG_SYSCALL): Undefine. (__ASSUME_RECVMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_SENDMSG_SYSCALL): Likewise. (__ASSUME_RECVMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_SENDMSG_SYSCALL): Likewise. (__ASSUME_RECVMSG_SYSCALL): Likewise.
* Do not raise "inexact" from powerpc64 ceil, floor, trunc (bug 15479).Joseph Myers2016-05-256-18/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing fixes for ceil, floor and trunc functions not to raise the "inexact" exception, this patch fixes the versions used on older powerpc64 processors. As was done with the round implementations some time ago, the save of floating-point state is moved after the first floating-point operation on the input to ensure that any "invalid" exception from signaling NaN input is included in the saved state, and then the whole state gets restored rather than just the rounding mode. This has no effect on configurations using the power5+ code, since such processors can do these operations with a single instruction (and those instructions do not set "inexact", so are correct for TS 18661-1 semantics). Tested for powerpc64. [BZ #15479] * sysdeps/powerpc/powerpc64/fpu/s_ceil.S (__ceil): Move save of floating-point state after first floating-point operation on input. Restore full floating-point state instead of just rounding mode. * sysdeps/powerpc/powerpc64/fpu/s_ceilf.S (__ceilf): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_floor.S (__floor): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_floorf.S (__floorf): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_trunc.S (__trunc): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_truncf.S (__truncf): Likewise.
* Do not raise "inexact" from powerpc32 ceil, floor, trunc (bug 15479).Joseph Myers2016-05-256-18/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing fixes for ceil, floor and trunc functions not to raise the "inexact" exception, this patch fixes the versions used on older powerpc32 processors. As was done with the round implementations some time ago, the save of floating-point state is moved after the first floating-point operation on the input to ensure that any "invalid" exception from signaling NaN input is included in the saved state, and then the whole state gets restored rather than just the rounding mode. This has no effect on configurations using the power5+ code, since such processors can do these operations with a single instruction (and those instructions do not set "inexact", so are correct for TS 18661-1 semantics). Tested for powerpc32. [BZ #15479] * sysdeps/powerpc/powerpc32/fpu/s_ceil.S (__ceil): Move save of floating-point state after first floating-point operation on input. Restore full floating-point state instead of just rounding mode. * sysdeps/powerpc/powerpc32/fpu/s_ceilf.S (__ceilf): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_floor.S (__floor): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_floorf.S (__floorf): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_trunc.S (__trunc): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_truncf.S (__truncf): Likewise.
* S390: Fix utf32 to utf16 handling of low surrogates (disable cu42).Stefan Liebler2016-05-251-93/+62
| | | | | | | | | | | | | | | | | According to the latest Unicode standard, a conversion from/to UTF-xx has to report an error if the character value is in range of an utf16 surrogate (0xd800..0xdfff). See https://sourceware.org/ml/libc-help/2015-12/msg00015.html. Thus the cu42 instruction, which converts from utf32 to utf16, has to be disabled because it does not report an error in case of a value in range of a low surrogate (0xdc00..0xdfff). The etf3eh variant is removed and the c, vector variant is adjusted to handle the value in range of an utf16 low surrogate correctly. ChangeLog: * sysdeps/s390/utf16-utf32-z9.c: Disable cu42 instruction and report an error in case of a value in range of an utf16 low surrogate.
* S390: Fix utf32 to utf8 handling of low surrogates (disable cu41).Stefan Liebler2016-05-251-73/+115
| | | | | | | | | | | | | | | | | According to the latest Unicode standard, a conversion from/to UTF-xx has to report an error if the character value is in range of an utf16 surrogate (0xd800..0xdfff). See https://sourceware.org/ml/libc-help/2015-12/msg00015.html. Thus the cu41 instruction, which converts from utf32 to utf8, has to be disabled because it does not report an error in case of a value in range of a low surrogate (0xdc00..0xdfff). The etf3eh variant is removed and the c, vector variant is adjusted to handle the value in range of an utf16 low surrogate correctly. ChangeLog: * sysdeps/s390/utf8-utf32-z9.c: Disable cu41 instruction and report an error in case of a value in range of an utf16 low surrogate.
* S390: Use s390-64 specific ionv-modules on s390-32, too.Stefan Liebler2016-05-256-46/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch reworks the existing s390 64bit specific iconv modules in order to use them on s390 31bit, too. Thus the parts for subdirectory iconvdata in sysdeps/s390/s390-64/Makefile were moved to sysdeps/s390/Makefile so that they apply on 31bit, too. All those modules are moved from sysdeps/s390/s390-64 directory to sysdeps/s390. The iso-8859-1 to/from cp037 module was adjusted, to use brct (branch relative on count) instruction on 31bit s390 instead of brctg, because the brctg is a zarch instruction and is not available on a 31bit kernel. The utf modules are using zarch instructions, thus the directive machinemode zarch_nohighgprs was added to the inline assemblies to omit the high-gprs flag in the shared libraries. Otherwise they can't be loaded on a 31bit kernel. The ifunc resolvers were adjusted in order to call the etf3eh or vector variants only if zarch instructions are available (64bit kernel in 31bit compat-mode). Furthermore some variable types were changed. E.g. unsigned long long would be a register pair on s390 31bit, but we want only one single register. For variables of type size_t the register contents have to be enlarged from a 32bit to a 64bit value on 31bit, because the inline assemblies uses 64bit values in such cases. ChangeLog: * sysdeps/s390/s390-64/Makefile (iconvdata-subdirectory): Move to ... * sysdeps/s390/Makefile: ... here. * sysdeps/s390/s390-64/iso-8859-1_cp037_z900.c: Move to ... * sysdeps/s390/iso-8859-1_cp037_z900.c: ... here. (BRANCH_ON_COUNT): New define. (TR_LOOP): Use BRANCH_ON_COUNT instead of brctg. * sysdeps/s390/s390-64/utf16-utf32-z9.c: Move to ... * sysdeps/s390/utf16-utf32-z9.c: ... here and adjust to run on s390-32, too. * sysdeps/s390/s390-64/utf8-utf16-z9.c: Move to ... * sysdeps/s390/utf8-utf16-z9.c: ... here and adjust to run on s390-32, too. * sysdeps/s390/s390-64/utf8-utf32-z9.c: Move to ... * sysdeps/s390/utf8-utf32-z9.c: ... here and adjust to run on s390-32, too.
* S390: Optimize utf16-utf32 module.Stefan Liebler2016-05-251-92/+379
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch reworks the s390 specific module to convert between utf16 and utf32. Now ifunc is used to choose either the c or etf3eh (with convert utf instruction) variants at runtime. Furthermore a new vector variant for z13 is introduced which will be build and chosen if vector support is available at build / runtime. In case of converting utf 32 to utf16, the vector variant optimizes input of 2byte utf16 characters. The convert utf instruction is used if an utf16 surrogate is found. For the other direction utf16 to utf32, the cu24 instruction can't be re- enabled, because it does not report an error, if the input-stream consists of a single low surrogate utf16 char (e.g. 0xdc00). This applies to the newest z13, too. Thus there is only the c or the new vector variant, which can handle utf16 surrogate characters. This patch also fixes some whitespace errors. Furthermore, the etf3eh variant is handling the "UTF-xx//IGNORE" case now. Before they ignored the ignore-case and always stopped at an error. ChangeLog: * sysdeps/s390/s390-64/utf16-utf32-z9.c: Use ifunc to select c, etf3eh or new vector loop-variant.
* S390: Optimize utf8-utf16 module.Stefan Liebler2016-05-251-106/+441
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch reworks the s390 specific module to convert between utf8 and utf16. Now ifunc is used to choose either the c or etf3eh (with convert utf instruction) variants at runtime. Furthermore a new vector variant for z13 is introduced which will be build and chosen if vector support is available at build / runtime. In case of converting utf 8 to utf16, the vector variant optimizes input of 1byte utf8 characters. The convert utf instruction is used if a multibyte utf8 character is found. For the other direction utf16 to utf8, the cu21 instruction can't be re-enabled, because it does not report an error, if the input-stream consists of a single low surrogate utf16 char (e.g. 0xdc00). This applies to the newest z13, too. Thus there is only the c or the new vector variant, which can handle 1..4 byte utf8 characters. The c variant from utf16 to utf8 has beed fixed. If a high surrogate was at the end of the input-buffer, then errno was set to EINVAL and the input-pointer pointed just after the high surrogate. Now it points to the beginning of the high surrogate. This patch also fixes some whitespace errors. The c variant from utf8 to utf16 is now checking that tail-bytes starts with 0b10... and the value is not in range of an utf16 surrogate. Furthermore, the etf3eh variants are handling the "UTF-xx//IGNORE" case now. Before they ignored the ignore-case and always stopped at an error. ChangeLog: * sysdeps/s390/s390-64/utf8-utf16-z9.c: Use ifunc to select c, etf3eh or new vector loop-variant.
* S390: Optimize utf8-utf32 module.Stefan Liebler2016-05-251-184/+480
| | | | | | | | | | | | | | | | | | | | This patch reworks the s390 specific module to convert between utf8 and utf32. Now ifunc is used to choose either the c or etf3eh (with convert utf instruction) variants at runtime. Furthermore a new vector variant for z13 is introduced which will be build and chosen if vector support is available at build / runtime. The vector variants optimize input of 1byte utf8 characters. The convert utf instruction is used if a multibyte utf8 character is found. This patch also fixes some whitespace errors. The c variants are rejecting UTF-16 surrogates and values above 0x10ffff now. Furthermore, the etf3eh variants are handling the "UTF-xx//IGNORE" case now. Before they ignored the ignore-case and always stopped at an error. ChangeLog: * sysdeps/s390/s390-64/utf8-utf32-z9.c: Use ifunc to select c, etf3eh or new vector loop-variant.
* S390: Optimize iso-8859-1 to ibm037 iconv-module.Stefan Liebler2016-05-251-37/+56
| | | | | | | | | | | This patch reworks the s390 specific module which used the z900 translate one to one instruction. Now the g5 translate instruction is used, because it outperforms the troo instruction. ChangeLog: * sysdeps/s390/s390-64/iso-8859-1_cp037_z900.c (TROO_LOOP): Rename to TR_LOOP and usage of tr instead of troo instruction.