about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* Remove __need macros from stdio.h and wchar.h.Zack Weinberg2017-06-082-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wint_t is a little finicky because it might be defined by stddef.h, which belongs to the compiler. In addition to the _types_, a bunch of other declarations shared between wctype.h and wchar.h are factored out to their own header. * libio/bits/types/FILE.h, libio/bits/types/__FILE.h * wcsmbs/bits/types/mbstate_t.h, wcsmbs/bits/types/__mbstate_t.h * wcsmbs/bits/types/wint_t.h: New single-type definition files. * wctype/bits/wctype-wchar.h: New file holding declarations shared between wctype.h and wchar.h. * libio/Makefile, wcsmbs/Makefile, wctype/Makefile: Install them. * include/bits/types/FILE.h, include/bits/types/__FILE.h * include/bits/types/mbstate_t.h, include/bits/types/__mbstate_t.h * include/bits/types/wint_t.h, include/bits/wcsmbs-wchar.h: New wrappers. * include/stdio.h, include/wchar.h, include/wctype.h: No need to handle __need macros. * grp/grp.h, gshadow/gshadow.h, hurd/hurd.h, iconv/gconv.h * libio/stdio.h, mach/mach.h, misc/mntent.h, pwd/pwd.h * shadow/shadow.h, stdio-common/printf.h, wcsmbs/uchar.h * wcsmbs/wchar.h, wctype/wctype.h * sysdeps/generic/_G_config.h, sysdeps/unix/sysv/linux/_G_config.h Use the new files instead of __need macros.
* x86-64: Rename wmemset.h to ifunc-wmemset.hH.J. Lu2017-06-074-4/+4
| | | | | | | | | | No code changes. * sysdeps/x86_64/multiarch/wmemset.c: Include ifunc-wmemset.h instead of wmemset.h. * sysdeps/x86_64/multiarch/wmemset_chk.c: Likewise. * sysdeps/x86_64/multiarch/wmemset.h: Renamed to ... * sysdeps/x86_64/multiarch/ifunc-wmemset.h: This.
* float128: Add strfromf128Gabriel F. T. Gomes2017-06-073-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | Add strfromf128 to stdlib when _Float128 support is enabled. * stdio-common/printf-parsemb.c (__parse_one_specmb): Initialize spec->info.is_binary128 to zero. * stdio-common/printf.h (printf_info): Add new member is_binary128 to indicate that the number being converted to string is compatible with the IEC 60559 binary128 format. * stdio-common/printf_fp.c (__printf_fp_l): Add code to deal with _Float128 numbers. * stdio-common/printf_fphex.c: Include ieee754_float128.h and ldbl-128/printf_fphex_macros.h (__printf_fphex): Add code to deal with _Float128 numbers. * stdio-common/printf_size.c (__printf_size): Likewise. * stdio-common/vfprintf.c (process_arg): Initialize member info.is_binary128 to zero. * stdlib/fpioconst.h (FLT128_MAX_10_EXP_LOG): New macro. * stdlib/stdlib.h: Include bits/floatn.h for _Float128 support. (strfromf128): New declaration. * stdlib/strfrom-skeleton.c (STRFROM): Set member info.is_binary128 to one. * sysdeps/ieee754/float128/Makefile: Add strfromf128. * sysdeps/ieee754/float128/Versions: Likewise. * sysdeps/ieee754/float128/strfromf128.c: New file.
* Refactor PRINT_FPHEX_LONG_DOUBLE into a reusable macroGabriel F. T. Gomes2017-06-072-85/+107
| | | | | | | | | | | | | | This patch refactors the macro PRINT_FPHEX_LONG_DOUBLE from the file sysdeps/ieee754/ldbl-128/printf_fphex.c into a function-like macro to enable its use for both long double and _Float128, when they are ABI-distinct. * sysdeps/ieee754/ldbl-128/printf_fphex.c: Include ldbl-128/printf_fphex_macros.h for the definition of PRINT_FPHEX. (PRINT_FPHEX_LONG_DOUBLE): Define based on PRINT_FPHEX. * sysdeps/ieee754/ldbl-128/printf_fphex_macros.h (PRINT_FPHEX): New function-like macro that can be used for long double, as well as for _Float128
* float128: Add conversion from float128 to mpnGabriel F. T. Gomes2017-06-074-1/+27
| | | | | | | | | | | | | | | | | | Reuse the code for __mpn_extract_long_double to implement __mpn_extract_float128. * include/gmp.h: Include bits/floatn.h (__mpn_extract_float128): Declare when __HAVE_DISTINCT_FLOAT128 is 1. * stdlib/gmp-impl.h: Also check if alloca is not defined before including stack-alloc.h. It could have been defined by other header which not necessarily defines HAVE_ALLOCA. * sysdeps/ieee754/float128/Makefile: New file. * sysdeps/ieee754/float128/float1282mpn.c: New file. * sysdeps/ieee754/float128/float128_private.h: Include gmp.h before redefining __mpn_extract_long_double to __mpn_extract_float128, then redefine __mpn_extract_long_double to __mpn_extract_float128. * sysdeps/ieee754/ldbl-128/ldbl2mpn.c: Replace long double with _Float128 to allow float128_private.h overrides.
* x86-64: Fold ifunc-sse4_1.h into wcsnlen.cH.J. Lu2017-06-072-35/+15
| | | | | | | | | | | | Since ifunc-sse4_1.h is included only by wcsnlen.c, we can fold it into wcsnlen.c. No code changes in wcsnlen.o. 2017-06-07 H.J. Lu <hongjiu.lu@intel.com> * sysdeps/x86_64/multiarch/ifunc-sse4_1.h: Removed and folded into ... * sysdeps/x86_64/multiarch/wcsnlen.c: Here. Don't include ifunc-sse4_1.h.
* Remove check for NULL buffer passed to `ptsname_r'Arjun Shankar2017-06-071-6/+0
| | | | | | | | | | | | | | `ptsname_r' is declared in stdlib.h to only accept a `nonnull' second argument and therefore GCC may choose to make optimizations based on the assumption that this argument is NULL. This means that potentially, GCC can optimize away the NULL check at some point in the future. Since this is a programming interface, we might as well remove the NULL check ourselves. This also warrants a change to the `ptsname_r' manual page that must be submitted to the corresponding mailing list. In addition, remove the NULL buffer test in login/tst-ptsname.c.
* Use test-driver in sysdeps/unix/sysv/linux/tst-clone2.cArjun Shankar2017-06-071-4/+3
|
* aarch64: Add hwcap string routinesSiddhesh Poyarekar2017-06-072-8/+65
| | | | | | | | | | | | | Add support for routines in dl-procinfo.h to show string versions of HWCAP entries when a program is invoked with the LD_SHOW_AUXV environment variable set and also to aid in path resolution for ldconfig. * sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c (_dl_aarch64_cap_flags): New array. * sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h (_dl_hwcap_string, _dl_string_hwcap, _dl_procinfo): Implement functions.
* Make LD_HWCAP_MASK usable for static binariesSiddhesh Poyarekar2017-06-072-6/+4
| | | | | | | | | | | | | | | | | | The LD_HWCAP_MASK environment variable was ignored in static binaries, which is inconsistent with the behaviour of dynamically linked binaries. This seems to have been because of the inability of ld_hwcap_mask being read early enough to influence anything but now that it is in tunables, the mask is usable in static binaries as well. This feature is important for aarch64, which relies on HWCAP_CPUID being masked out to disable multiarch. A sanity test on x86_64 shows that there are no failures. Likewise for aarch64. * elf/dl-hwcaps.h [HAVE_TUNABLES]: Always read hwcap_mask. * sysdeps/sparc/sparc32/dl-machine.h [HAVE_TUNABLES]: Likewise. * sysdeps/x86/cpu-features.c (init_cpu_features): Always set up hwcap and hwcap_mask.
* aarch64: Allow overriding HWCAP_CPUID feature check using HWCAP_MASKSiddhesh Poyarekar2017-06-072-4/+50
| | | | | | | | | | | | | | | | Now that LD_HWCAP_MASK (or glibc.tune.hwcap_mask) is read early enough to influence cpu feature check in aarch64, use it to influence multiarch selection. Setting LD_HWCAP_MASK such that it clears HWCAP_CPUID will now disable multiarch for the binary. HWCAP_CPUID is also now set in HWCAP_IMPORTANT so that it is set by default. With this patch, this feature is only usable with dyanmically linked binaries because LD_HWCAP_MASK is not read for static binaries. A future patch fixes that. * sysdeps/unix/sysv/linux/aarch64/cpu-features.c (init_cpu_features): Use glibc.tune.hwcap_mask. * sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h: New file.
* tunables: Use glibc.tune.hwcap_mask tunable instead of _dl_hwcap_maskSiddhesh Poyarekar2017-06-073-1/+9
| | | | | | | | | | | | | | | | | | | | | | | Drop _dl_hwcap_mask when building with tunables. This completes the transition of hwcap_mask reading from _dl_hwcap_mask to tunables. * elf/dl-hwcaps.h: New file. * elf/dl-hwcaps.c: Include it. (_dl_important_hwcaps)[HAVE_TUNABLES]: Read and update glibc.tune.hwcap_mask. * elf/dl-cache.c: Include dl-hwcaps.h. (_dl_load_cache_lookup)[HAVE_TUNABLES]: Read glibc.tune.hwcap_mask. * sysdeps/sparc/sparc32/dl-machine.h: Likewise. * elf/dl-support.c (_dl_hwcap2)[HAVE_TUNABLES]: Drop _dl_hwcap_mask. * elf/rtld.c (rtld_global_ro)[HAVE_TUNABLES]: Drop _dl_hwcap_mask. (process_envvars)[HAVE_TUNABLES]: Likewise. * sysdeps/generic/ldsodefs.h (rtld_global_ro)[HAVE_TUNABLES]: Likewise. * sysdeps/x86/cpu-features.c (init_cpu_features): Don't initialize dl_hwcap_mask when tunables are enabled.
* Add include guards to dl-procinfo.hSiddhesh Poyarekar2017-06-072-0/+6
| | | | | | | | | | | | | | The dl-procinfo.h for linux/s390 and linux/i386 don't have include guards, which causes them to fail since addition of LD_HWCAP_MASK to tunables. Add _DL_I386_PROCINFO_H guard to avoid redefining _dl_procinfo on multiple includes and also allow the subsequent include of another dl-procinfo.h to work. Verified with a build test on i686. * sysdeps/unix/sysv/linux/i386/dl-procinfo.h: Add include guard. * sysdeps/unix/sysv/linux/s390/dl-procinfo.h: Likewise.
* x86-64: Move wcsnlen.S to multiarch/wcsnlen-sse4_1.SH.J. Lu2017-06-067-8/+88
| | | | | | | | | | | | | | | | Since wcsnlen.S uses pminud which is the part of SSE4.1, move wcsnlen.S to multiarch/wcsnlen-sse4_1.S. * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add wcsnlen-sse4_1 and wcsnlen-c. * sysdeps/x86_64/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Test __wcsnlen_sse4_1 and __wcsnlen_sse2. * sysdeps/x86_64/multiarch/ifunc-sse4_1.h: New file. * sysdeps/x86_64/multiarch/wcsnlen-c.c: Likewise. * sysdeps/x86_64/multiarch/wcsnlen-sse4_1.S: Likewise. * sysdeps/x86_64/multiarch/wcsnlen.c: Likewise. * sysdeps/x86_64/wcsnlen.S: Removed.
* S390: Use generic spinlock code.Stefan Liebler2017-06-064-115/+0
| | | | | | | | | | | | This patch removes the s390 specific implementation of spinlock code and is now using the generic one. ChangeLog: * sysdeps/s390/nptl/pthread_spin_init.c: Delete File. * sysdeps/s390/nptl/pthread_spin_lock.c: Likewise. * sysdeps/s390/nptl/pthread_spin_trylock.c: Likewise. * sysdeps/s390/nptl/pthread_spin_unlock.c: Likewise.
* Optimize generic spinlock code and use C11 like atomic macros.Stefan Liebler2017-06-0629-167/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch optimizes the generic spinlock code. The type pthread_spinlock_t is a typedef to volatile int on all archs. Passing a volatile pointer to the atomic macros which are not mapped to the C11 atomic builtins can lead to extra stores and loads to stack if such a macro creates a temporary variable by using "__typeof (*(mem)) tmp;". Thus, those macros which are used by spinlock code - atomic_exchange_acquire, atomic_load_relaxed, atomic_compare_exchange_weak - have to be adjusted. According to the comment from Szabolcs Nagy, the type of a cast expression is unqualified (see http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_423.htm): __typeof ((__typeof (*(mem)) *(mem)) tmp; Thus from spinlock perspective the variable tmp is of type int instead of type volatile int. This patch adjusts those macros in include/atomic.h. With this construct GCC >= 5 omits the extra stores and loads. The atomic macros are replaced by the C11 like atomic macros and thus the code is aligned to it. The pthread_spin_unlock implementation is now using release memory order instead of sequentially consistent memory order. The issue with passed volatile int pointers applies to the C11 like atomic macros as well as the ones used before. I've added a glibc_likely hint to the first atomic exchange in pthread_spin_lock in order to return immediately to the caller if the lock is free. Without the hint, there is an additional jump if the lock is free. I've added the atomic_spin_nop macro within the loop of plain reads. The plain reads are also realized by C11 like atomic_load_relaxed macro. The new define ATOMIC_EXCHANGE_USES_CAS determines if the first try to acquire the spinlock in pthread_spin_lock or pthread_spin_trylock is an exchange or a CAS. This is defined in atomic-machine.h for all architectures. The define SPIN_LOCK_READS_BETWEEN_CMPXCHG is now removed. There is no technical reason for throwing in a CAS every now and then, and so far we have no evidence that it can improve performance. If that would be the case, we have to adjust other spin-waiting loops elsewhere, too! Using a CAS loop without plain reads is not a good idea on many targets and wasn't used by one. Thus there is now no option to do so. Architectures are now using the generic spinlock automatically if they do not provide an own implementation. Thus the pthread_spin_lock.c files in sysdeps folder are deleted. ChangeLog: * NEWS: Mention new spinlock implementation. * include/atomic.h: (__atomic_val_bysize): Cast type to omit volatile qualifier. (atomic_exchange_acq): Likewise. (atomic_load_relaxed): Likewise. (ATOMIC_EXCHANGE_USES_CAS): Check definition. * nptl/pthread_spin_init.c (pthread_spin_init): Use atomic_store_relaxed. * nptl/pthread_spin_lock.c (pthread_spin_lock): Use C11-like atomic macros. * nptl/pthread_spin_trylock.c (pthread_spin_trylock): Likewise. * nptl/pthread_spin_unlock.c (pthread_spin_unlock): Use atomic_store_release. * sysdeps/aarch64/nptl/pthread_spin_lock.c: Delete File. * sysdeps/arm/nptl/pthread_spin_lock.c: Likewise. * sysdeps/hppa/nptl/pthread_spin_lock.c: Likewise. * sysdeps/m68k/nptl/pthread_spin_lock.c: Likewise. * sysdeps/microblaze/nptl/pthread_spin_lock.c: Likewise. * sysdeps/mips/nptl/pthread_spin_lock.c: Likewise. * sysdeps/nios2/nptl/pthread_spin_lock.c: Likewise. * sysdeps/aarch64/atomic-machine.h (ATOMIC_EXCHANGE_USES_CAS): Define. * sysdeps/alpha/atomic-machine.h: Likewise. * sysdeps/arm/atomic-machine.h: Likewise. * sysdeps/i386/atomic-machine.h: Likewise. * sysdeps/ia64/atomic-machine.h: Likewise. * sysdeps/m68k/coldfire/atomic-machine.h: Likewise. * sysdeps/m68k/m680x0/m68020/atomic-machine.h: Likewise. * sysdeps/microblaze/atomic-machine.h: Likewise. * sysdeps/mips/atomic-machine.h: Likewise. * sysdeps/powerpc/powerpc32/atomic-machine.h: Likewise. * sysdeps/powerpc/powerpc64/atomic-machine.h: Likewise. * sysdeps/s390/atomic-machine.h: Likewise. * sysdeps/sparc/sparc32/atomic-machine.h: Likewise. * sysdeps/sparc/sparc32/sparcv9/atomic-machine.h: Likewise. * sysdeps/sparc/sparc64/atomic-machine.h: Likewise. * sysdeps/tile/tilegx/atomic-machine.h: Likewise. * sysdeps/tile/tilepro/atomic-machine.h: Likewise. * sysdeps/unix/sysv/linux/hppa/atomic-machine.h: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h: Likewise. * sysdeps/unix/sysv/linux/nios2/atomic-machine.h: Likewise. * sysdeps/unix/sysv/linux/sh/atomic-machine.h: Likewise. * sysdeps/x86_64/atomic-machine.h: Likewise.
* x86: Don't use dl_x86_cpu_features in cacheinfo.cH.J. Lu2017-06-051-15/+22
| | | | | | | | | | | | Since cpu_features is available, use it instead of dl_x86_cpu_features. * sysdeps/x86/cacheinfo.c (intel_check_word): Accept cpu_features and use it instead of dl_x86_cpu_features. (handle_intel): Replace maxidx with cpu_features. Pass cpu_features to intel_check_word. (__cache_sysconf): Pass cpu_features to handle_intel. (init_cacheinfo): Likewise. Use cpu_features instead of dl_x86_cpu_features.
* x86-64: Optimize memcmp/wmemcmp with AVX2 and MOVBEH.J. Lu2017-06-057-3/+466
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimize x86-64 memcmp/wmemcmp with AVX2. It uses vector compare as much as possible. It is as fast as SSE4 memcmp for size <= 16 bytes and up to 2X faster for size > 16 bytes on Haswell and Skylake. Select AVX2 memcmp/wmemcmp on AVX2 machines where vzeroupper is preferred and AVX unaligned load is fast. NB: It uses TZCNT instead of BSF since TZCNT produces the same result as BSF for non-zero input. TZCNT is faster than BSF and is executed as BSF if machine doesn't support TZCNT. Key features: 1. For size from 2 to 7 bytes, load as big endian with movbe and bswap to avoid branches. 2. Use overlapping compare to avoid branch. 3. Use vector compare when size >= 4 bytes for memcmp or size >= 8 bytes for wmemcmp. 4. If size is 8 * VEC_SIZE or less, unroll the loop. 5. Compare 4 * VEC_SIZE at a time with the aligned first memory area. 6. Use 2 vector compares when size is 2 * VEC_SIZE or less. 7. Use 4 vector compares when size is 4 * VEC_SIZE or less. 8. Use 8 vector compares when size is 8 * VEC_SIZE or less. * sysdeps/x86/cpu-features.h (index_cpu_MOVBE): New. * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add memcmp-avx2 and wmemcmp-avx2. * sysdeps/x86_64/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Test __memcmp_avx2 and __wmemcmp_avx2. * sysdeps/x86_64/multiarch/memcmp-avx2.S: New file. * sysdeps/x86_64/multiarch/wmemcmp-avx2.S: Likewise. * sysdeps/x86_64/multiarch/memcmp.S: Use __memcmp_avx2 on AVX 2 machines if AVX unaligned load is fast and vzeroupper is preferred. * sysdeps/x86_64/multiarch/wmemcmp.S: Use __wmemcmp_avx2 on AVX 2 machines if AVX unaligned load is fast and vzeroupper is preferred.
* x86-64: Optimize wmemset with SSE2/AVX2/AVX512H.J. Lu2017-06-0513-9/+250
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The difference between memset and wmemset is byte vs int. Add stubs to SSE2/AVX2/AVX512 memset for wmemset with updated constant and size: SSE2 wmemset: shl $0x2,%rdx movd %esi,%xmm0 mov %rdi,%rax pshufd $0x0,%xmm0,%xmm0 jmp entry_from_wmemset SSE2 memset: movd %esi,%xmm0 mov %rdi,%rax punpcklbw %xmm0,%xmm0 punpcklwd %xmm0,%xmm0 pshufd $0x0,%xmm0,%xmm0 entry_from_wmemset: Since the ERMS versions of wmemset requires "rep stosl" instead of "rep stosb", only the vector store stubs of SSE2/AVX2/AVX512 wmemset are added. The SSE2 wmemset is about 3X faster and the AVX2 wmemset is about 6X faster on Haswell. * include/wchar.h (__wmemset_chk): New. * sysdeps/x86_64/memset.S (VDUP_TO_VEC0_AND_SET_RETURN): Renamed to MEMSET_VDUP_TO_VEC0_AND_SET_RETURN. (WMEMSET_VDUP_TO_VEC0_AND_SET_RETURN): New. (WMEMSET_CHK_SYMBOL): Likewise. (WMEMSET_SYMBOL): Likewise. (__wmemset): Add hidden definition. (wmemset): Add weak hidden definition. * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add wmemset_chk-nonshared. * sysdeps/x86_64/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add __wmemset_sse2_unaligned, __wmemset_avx2_unaligned, __wmemset_avx512_unaligned, __wmemset_chk_sse2_unaligned, __wmemset_chk_avx2_unaligned and __wmemset_chk_avx512_unaligned. * sysdeps/x86_64/multiarch/memset-avx2-unaligned-erms.S (VDUP_TO_VEC0_AND_SET_RETURN): Renamed to ... (MEMSET_VDUP_TO_VEC0_AND_SET_RETURN): This. (WMEMSET_VDUP_TO_VEC0_AND_SET_RETURN): New. (WMEMSET_SYMBOL): Likewise. * sysdeps/x86_64/multiarch/memset-avx512-unaligned-erms.S (VDUP_TO_VEC0_AND_SET_RETURN): Renamed to ... (MEMSET_VDUP_TO_VEC0_AND_SET_RETURN): This. (WMEMSET_VDUP_TO_VEC0_AND_SET_RETURN): New. (WMEMSET_SYMBOL): Likewise. * sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S: Updated. (WMEMSET_CHK_SYMBOL): New. (WMEMSET_CHK_SYMBOL (__wmemset_chk, unaligned)): Likewise. (WMEMSET_SYMBOL (__wmemset, unaligned)): Likewise. * sysdeps/x86_64/multiarch/memset.S (WMEMSET_SYMBOL): New. (libc_hidden_builtin_def): Also define __GI_wmemset and __GI___wmemset. (weak_alias): New. * sysdeps/x86_64/multiarch/wmemset.c: New file. * sysdeps/x86_64/multiarch/wmemset.h: Likewise. * sysdeps/x86_64/multiarch/wmemset_chk-nonshared.S: Likewise. * sysdeps/x86_64/multiarch/wmemset_chk.c: Likewise. * sysdeps/x86_64/wmemset.c: Likewise. * sysdeps/x86_64/wmemset_chk.c: Likewise.
* x86: Add macros to implement ifunce selection in CH.J. Lu2017-06-051-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These macros are used to implement ifunc selection in C. To implement an ifunc function, foo, which returns the address of __foo_sse2 or __foo_avx2: __foo_avx2: #define foo __redirect_foo #define __foo __redirect___foo #include <foo.h> #undef foo #undef __foo #define SYMBOL_NAME foo #include <init-arch.h> extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2) attribute_hidden; extern __typeof (REDIRECT_NAME) OPTIMIZE (avx2) attribute_hidden; static inline void * foo_selector (void) { if (use AVX2) return OPTIMIZE (avx2); return OPTIMIZE (sse2); } libc_ifunc_redirected (__redirect_foo, foo, foo_selector ()); * sysdeps/x86/init-arch.h (PASTER1): New. (EVALUATOR1): Likewise. (PASTER2): Likewise. (EVALUATOR2): Likewise. (REDIRECT_NAME): Likewise. (OPTIMIZE): Likewise. (IFUNC_SELECTOR): Likewise.
* x86-64: Update strlen.S to support wcslen/wcsnlenH.J. Lu2017-06-052-21/+47
| | | | | | | | | | | | | | The difference between strlen and wcslen is byte vs int. We can replace pminub and pcmpeqb with pminud and pcmpeqd to turn strlen into wcslen. * sysdeps/x86_64/strlen.S (PMINU): New. (PCMPEQ): Likewise. (SHIFT_RETURN): Likewise. (FIND_ZERO): Replace pcmpeqb with PCMPEQ. (strlen): Add SHIFT_RETURN before ret. Replace pcmpeqb and pminub with PCMPEQ and PMINU. * sysdeps/x86_64/wcsnlen.S: New file.
* x86_64: Remove redundant REX bytes from memrchr.SH.J. Lu2017-06-051-19/+17
| | | | | | | | | | | | | | | | | | By x86-64 specification, 32-bit destination registers are zero-extended to 64 bits. There is no need to use 64-bit registers when only the lower 32 bits are non-zero. Also 2 instructions in: mov %rdi, %rcx and $15, %rcx jz L(length_less16_offset0) mov %rdi, %rcx <<< redundant and $15, %rcx <<< redundant are redundant. * sysdeps/x86_64/memrchr.S (__memrchr): Use 32-bit registers for the lower 32 bits. Remove redundant instructions.
* x86-64: Update LO_HI_LONG for p{readv,writev}{64}v2H.J. Lu2017-06-052-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The kernel interface for p{readv,writev}{64}v is (unsigned long fd, {const }struct iovec *iov, unsigned long vlen, unsigned long pos_l, unsigned long pos_h) Except for targets which define __ARCH_WANT_COMPAT_SYS_PREADV64 and __ARCH_WANT_COMPAT_SYS_PWRITEV64, (unsigned long fd, {const }struct iovec *iov, unsigned long vlen, off64_t pos) is used for p{readv,writev}{64}v. X32 is the only such target. The LO_HI_LONG macro is used to pass offset to the pos_l and pos_h pair. Since pos_h is ignored when size of offset == sizeof of pos_l, x86-64 has #define LO_HI_LONG(val) (val) But the kernel interface for p{readv,writev}{64}v2 is (unsigned long fd, {const }struct iovec *iov, unsigned long vlen, unsigned long pos_l, unsigned long pos_h, int flags) Except for targets which define __ARCH_WANT_COMPAT_SYS_PREADV64V2 and __ARCH_WANT_COMPAT_SYS_PWRITEV64V2, (unsigned long fd, {const }struct iovec *iov, unsigned long vlen, off64_t pos, int flags) is used for p{readv,writev}{64}v2. X32 is the only such target. Update x86-64 LO_HI_LONG to pass 0 as the high part of the offset argument for p{readv,writev}{64}v2 and define a different LO_HI_LONG for x32 to only pass one argument for offset. Tested on x32 and x86-64. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (LO_HI_LONG): Pass 0 as the high part of offset. * sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h (LO_HI_LONG): New.
* Define SIG_HOLD for XPG4 (bug 21538).Joseph Myers2017-06-056-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | Various bits/signum.h headers define SIG_HOLD if __USE_UNIX98. That should be __USE_XOPEN, as this macro is in XPG4. This patch fixes the conditionals accordingly. Because of other header bugs, this does not allow any XFAILs to be removed (however, the XPG4/signal.h/conform XFAIL only depends on a few such straightforward header bugs, not on the more complicated to fix ucontext_t issues, as ucontext_t isn't included in signal.h in XPG4). Tested for x86_64. [BZ #21538] * bits/signum.h (SIG_HOLD): Define if [__USE_XOPEN], not [__USE_UNIX98]. * sysdeps/unix/bsd/bits/signum.h (SIG_HOLD): Likewise. * sysdeps/unix/sysv/linux/alpha/bits/signum.h (SIG_HOLD): Likewise. * sysdeps/unix/sysv/linux/bits/signum.h (SIG_HOLD): Likewise. * sysdeps/unix/sysv/linux/hppa/bits/signum.h (SIG_HOLD): Likewise. * sysdeps/unix/sysv/linux/mips/bits/signum.h (SIG_HOLD): Likewise. * sysdeps/unix/sysv/linux/sparc/bits/signum.h (SIG_HOLD): Likewise.
* Fix struct sigaltstack namespace (bug 21517).Joseph Myers2017-06-0512-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | glibc defines the stack_t type with the tag struct sigaltstack. This is not permitted by POSIX; sigaltstack is only reserved with file scope in the namespace of ordinary identifiers, not the tag namespace, and in the case where stack_t is obtained from ucontext.h rather than signal.h, it's not reserved with file scope at all. This patch removes the tag accordingly and updates uses in glibc of struct sigaltstack. This is similar to the removal of the "struct siginfo" tag a few years ago: C++ name mangling changes are an unavoidable consequence. A NEWS item is added to note the changed mangling. There is inevitably some risk of breaking builds of anything that relies on the struct sigaltstack name (though the first few hits I looked at from codesearch.debian.net generally seemed to involve code that could use the stack_t name conditionally, so depending on how they determine the conditionals they may work with glibc not defining the struct tag anyway). Tested for x86_64 and x86, and with build-many-glibcs.py. [BZ #21517] * bits/types/stack_t.h (stack_t): Remove struct tag. * sysdeps/unix/sysv/linux/bits/types/stack_t.h (stack_t): Likewise. * sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h (stack_t): Likewise. * debug/segfault.c (install_handler): Use stack_t instead of struct sigaltstack. * hurd/hurd/signal.h (struct hurd_sigstate): Likewise. * hurd/trampoline.c (_hurd_setup_sighandler): Likewise. * include/signal.h (__sigaltstack): Likwise. * signal/sigaltstack.c (__sigaltstack): Likewise. * signal/signal.h (sigaltstack): Likewise. * sysdeps/mach/hurd/i386/signal-defines.sym (SIGALTSTACK__SS_SP__OFFSET): Likewise. (SIGALTSTACK__SS_SIZE__OFFSET): Likewise. (SIGALTSTACK__SS_FLAGS__OFFSET): Likewise. * sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise. * sysdeps/mach/hurd/sigstack.c (sigstack): Likewise. * sysdeps/unix/sysv/linux/alpha/sys/procfs.h (struct elf_prstatus): Likewise. * sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c (CHECK_SP): Likewise. * sysdeps/unix/sysv/linux/ia64/sys/procfs.h (struct elf_prstatus): Likewise. * sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c (CHECK_SP): Likewise. * sysdeps/unix/sysv/linux/powerpc/sys/procfs.h (struct elf_prstatus): Likewise. * sysdeps/unix/sysv/linux/sh/sys/procfs.h (struct elf_prstatus): Likewise. * sysdeps/unix/sysv/linux/sys/procfs.h (struct elf_prstatus): Likewise.
* Regenerate sysdeps/gnu/errlist.c.Zack Weinberg2017-06-041-45/+37
| | | | This file needs to be regenerated whenever errno.texi changes.
* getaddrinfo: Eliminate another strdup callFlorian Weimer2017-06-031-1/+1
|
* x86: Update __x86_shared_non_temporal_thresholdH.J. Lu2017-06-021-2/+4
| | | | | | | | | | | | | __x86_shared_non_temporal_threshold was set to 6 times of per-core shared cache size, based on the large memcpy micro benchmark in glibc on a 8-core processor. For a processor with more than 8 cores, the threshold is too low. Set __x86_shared_non_temporal_threshold to the 3/4 of the total shared cache size so that it is unchanged on 8-core processors. On processors with less than 8 cores, the threshold is lower. * sysdeps/x86/cacheinfo.c (__x86_shared_non_temporal_threshold): Set to the 3/4 of the total shared cache size.
* getaddrinfo: Fix localplt failure involving strdupFlorian Weimer2017-06-021-4/+11
|
* getaddrinfo: Always allocate canonical name on the heapFlorian Weimer2017-06-021-67/+42
| | | | | | | A further simplification could eliminate the canon variable in gaih_inet and replace it with canonbuf. However, canonbuf is used as a flag in the nscd code, which makes this somewhat non-straightforward.
* Add shim header for bits/syscall.h.Zack Weinberg2017-06-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | On Linux-based configurations, bits/syscall.h is a generated file. To avoid build-ordering problems, the Linux sys/syscall.h only includes bits/syscall.h if _LIBC is not defined. After the _ISOMAC-testsuite changes, this means any test case that includes sys/syscall.h tries to pull in bits/syscall.h. This would be fine, because it'll definitely have been generated by the time we start compiling tests, except that the generated <builddir>/misc/bits/syscall.h is not visible in the include path, because nothing needed it till now. So we either get the bits/syscall.h from the host system, or the build fails. The fix is simple: add a shim header for bits/syscall.h. I put it in sysdeps/unix/sysv/linux/include instead of the top-level include/ because bits/syscall.h doesn't exist at all on other configurations as far as I can tell. This is known to affect nptl/tst-cond2[45]. Thanks to John David Anglin for noticing the problem. [BZ #21514] * sysdeps/unix/sysv/linux/include/bits/syscall.h: New shim header pointing to the generated file in <builddir>/misc/bits/syscall.h.
* Fix more namespace issues in sys/ucontext.h (bug 21457).Joseph Myers2017-06-0112-178/+318
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the fixes for namespace issues in sys/ucontext.h, this patch moves various symbols into the implementation namespace in the absence of __USE_MISC. As with previous changes, it is nonexhaustive, just covering more straightforward cases. Structure fields are generally changed to have a prefix __ in the absence of __USE_MISC, via a macro __ctx (used without a space before the open parenthesis, since the result is a single identifier). Various macros such as NGREG also have leading __ added. No changes are made to structure tags (and thus to C++ name mangling), except that in the (unused) file sysdeps/i386/sys/ucontext.h, structures defined inside other structures as the type for a field have their tags removed in the non-__USE_MISC case (those structure tags would not in any case have been visible in C++, because in C++ the scope of such a tag is limited to the containing structure). No changes are made to the contents of bits/sigcontext.h, or to whether it is included. Because of remaining namespace issues, this patch does not yet fix the bug or allow any XFAILs to be removed. Tested for x86_64 and x86, and with build-many-glibcs.py. [BZ #21457] * sysdeps/arm/sys/ucontext.h (NGREG): Rename to __NGREG and define NGREG to __NGREG if [__USE_MISC]. (gregset_t): Define using __NGREG. (__ctx): New macro. (mcontext_t): Use __ctx in defining fields. * sysdeps/i386/sys/ucontext.h (NGREG): Rename to __NGREG and define NGREG to __NGREG if [__USE_MISC]. (gregset_t): Define using __NGREG. (__ctx): New macro. (__ctxt): Likewise. (fpregset_t): Use __ctx and __ctxt in defining fields. (mcontext_t): Likewise. * sysdeps/m68k/sys/ucontext.h (NGREG): Rename to __NGREG and define NGREG to __NGREG if [__USE_MISC]. (gregset_t): Define using __NGREG. (__ctx): New macro. (mcontext_t): Use __ctx in defining fields. * sysdeps/mips/sys/ucontext.h (NGREG): Rename to __NGREG and define NGREG to __NGREG if [__USE_MISC]. (gregset_t): Define using __NGREG. (__ctx): New macro. (fpregset_t): Use __ctx in defining fields. (mcontext_t): Likewise. * sysdeps/unix/sysv/linux/alpha/sys/ucontext.h (NGREG): Rename to __NGREG and define NGREG to __NGREG if [__USE_MISC]. (gregset_t): Define using __NGREG. (NFPREG): Rename to __NFPREG and define NFPREG to __NFPREG if [__USE_MISC]. (fpregset_t): Define using __NFPREG. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (NGREG): Rename to __NGREG and define NGREG to __NGREG if [__USE_MISC]. (gregset_t): Define using __NGREG. (__ctx): New macro. (fpregset_t): Use __ctx in defining fields. (mcontext_t): Likewise. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h (NGREG): Rename to __NGREG and define NGREG to __NGREG if [__USE_MISC]. (NFPREG): Rename to __NFPREG and define NFPREG to __NFPREG if [__USE_MISC]. (gregset_t): Define using __NGREG. (__ctx): New macro. (fpregset_t): Use __ctx in defining fields. (mcontext_t): Likewise. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (__ctx): New macro. (mcontext_t): Use __ctx in defining fields. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (__ctx): New macro. [__WORDSIZE == 32] (NGREG): Rename to __NGREG and define NGREG to __NGREG if [__USE_MISC]. [__WORDSIZE == 32] (gregset_t): Define using __NGREG. [__WORDSIZE == 32] (fpregset_t): Use __ctx in defining fields. (mcontext_t): Likewise. [__WORDSIZE != 32] (NGREG): Rename to __NGREG and define NGREG to __NGREG if [__USE_MISC]. [__WORDSIZE != 32] (NFPREG): Rename to __NFPREG and define NFPREG to __NFPREG if [__USE_MISC]. [__WORDSIZE != 32] (NVRREG): Rename to __NVRREG and define NVRREG to __NVRREG if [__USE_MISC]. [__WORDSIZE != 32] (gregset_t): Define using __NGREG. [__WORDSIZE != 32] (fpregset_t): Define using __NFPREG. [__WORDSIZE != 32] (vscr_t): Use __ctx in defining fields. [__WORDSIZE != 32] (vrregset_t): Likewise. [__WORDSIZE != 32] (mcontext_t): Likewise. * sysdeps/unix/sysv/linux/s390/sys/ucontext.h (__ctx): New macro. (__psw_t): Use __ctx in defining fields. (NGREG): Rename to __NGREG and define NGREG to __NGREG if [__USE_MISC]. (gregset_t): Define using __NGREG. (fpreg_t): Use __ctx in defining fields. (fpregset_t): Likewise. (mcontext_t): Likewise. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h (NGREG): Rename to __NGREG and define NGREG to __NGREG if [__USE_MISC]. (gregset_t): Define using __NGREG. (NFPREG): Rename to __NFPREG and define NFPREG to __NFPREG if [__USE_MISC]. (fpregset_t): Define using __NFPREG. (__ctx): New macro. (mcontext_t): Use __ctx in defining fields. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h (__ctx): New macro. [__x86_64__] (NGREG): Rename to __NGREG and define NGREG to __NGREG if [__USE_MISC]. [__x86_64__] (gregset_t): Define using __NGREG. [__x86_64__] (struct _libc_fpxreg): Use __ctx in defining fields. [__x86_64__] (struct _libc_fpstate): Likewise. [__x86_64__] (mcontext_t): Likewise. [!__x86_64__] (NGREG): Rename to __NGREG and define NGREG to __NGREG if [__USE_MISC]. [!__x86_64__] (gregset_t): Define using __NGREG. [!__x86_64__] (struct _libc_fpreg): Use __ctx in defining fields. [!__x86_64__] (struct _libc_fpstate): Likewise. [!__x86_64__] (mcontext_t): Likewise.
* Avoid tickling a linker bug from microblaze pt-vfork.S.Zack Weinberg2017-06-013-2/+50
| | | | | | | | | | | | | | | | | | | | libpthread used to have its own vfork implementation that differed from libc's only in having a pointless micro-optimization. There is no longer any use to having a separate copy in libpthread, but the historical ABI requires a compatibility shim. microblaze was trying to be slightly too clever about how it did this, and tickled a linker bug. The linker bug should get fixed eventually, but there's no reason for us to keep tickling it in the meantime. This doesn't reuse the generic pt-vfork.c because microblaze doesn't have IFUNC support yet, and it doesn't reuse aarch64/pt-vfork.c because that fails to generate a tailcall (with GCC 7.1.1). * sysdeps/unix/sysv/linux/microblaze/pt-vfork.S: Don't include alpha/pt-vfork.S. Provide own compat shim for vfork and __vfork. * sysdeps/unix/sysv/linux/microblaze/vfork.S: Add __libc_vfork alias. * sysdeps/unix/sysv/linux/microblaze/localplt.data: libpthread.so no longer references __errno_location.
* posix: Implement preadv2 and pwritev2Adhemerval Zanella2017-05-3143-0/+499
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support of preadv2 and pwritev2 which are similar to preadv/pwritev but with an extra flag argument. As for preadv/pwritev both interfaces are added a non-standard GNU API. For default 'posix' implementation trying to emulate the Linux supported flags is troublesome: * We can not temporary change the file state of the O_DSYNC and O_SYNC flags to emulate RWF_{D}SYNC (attempts to change the state of using fcntl are silently ignored). * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal semantic not provided by any other flag (O_NONBLOCK for instance). So default sysdeps/posix implementations fails with EOPNOTSUPP for any non supported flag (which are none currently) calls generic preadv/pwritev. Basically this implementation supports only preadv2 called as preadv (with flags sets to 0). The Linux one uses the preadv2/pwritev2 syscall if defined, otherwise it call preadv/writev. Instead of using the previous __ASSUME_* to unconditionally issue the syscall (and avoid building the fallback routine), it call pread/write if the preadv2/pwritev2 syscalls fails. The idea is just avoid adding another __ASSUME_* and checking each architecture on every kernel bump and simplify code conditionals. Checked on x86_64-linux-gnu and on i686-linux-gnu and a check with run-built-tests=no on aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, mips{64,64n32}-linux-gnu, nios2-linux-gnu, powerpc{64,64le}-linux-gnu, s390{x}-linux-gnu, sparc{64,v9}-linux-gnu, tile{gx,pro}-linux-gnu, and sh4-linux-gnu (all using gcc 6.3). * NEWS: Add note about pwritev2 and preadv2 inclusion. * misc/Makefile (routines): Add preadv2, preadv64v2, pwritev2, and pwritev64v2. (tests): Add tst-preadvwritev2 and tst-preadvwritev64v2. * misc/Versions (GLIBC_2.26): Add preadv2, preadv64v2, pwritev2, and pwritev64v2. * misc/preadv2.c: New file. * misc/preadv64v2.c: Likewise. * misc/pwritev2.c: Likewise. * misc/pwritev64v2.c: Likewise. * misc/tst-preadvwritev2.c: Likewise. * misc/tst-preadvwritev64v2.c: Likewise. * manual/llio.texi: Add preadv2 and pwritev2 documentation. * misc/sys/uio.h [__USE_GNU && !__USE_FILE_OFFSET64] (preadv2): New prototype. [__USE_GNU && !__USE_FILE_OFFSET64] (pwritev2): Likewise. [__USE_GNU && __USE_FILE_OFFSET64] (preadv64v2): Likewise. [__USE_GNU && __USE_FILE_OFFSET64] (pwritev64v2): Likewise. * misc/tst-preadvwritev-common.c (PREADV): Define if not defined. (PWRITEV): Likewise. (do_test_with_offset): Use PREADV and PWRITEV macros and check for ENOSYS. * nptl/tst-cancel4.c (tf_pwritev2): New test. (tf_preadv2): Likewise. (tf_fsync): Add tf_pwritev2 and tf_preadv2. * sysdeps/posix/preadv2.c: Likewise. * sysdeps/posix/preadv64v2.c: Likewise. * sysdeps/posix/pwritev2.c: Likewise. * sysdeps/posix/pwritev64v2.c: Likewise. * sysdeps/unix/sysv/linux/kernel-features.h: Add comment for syscall support in kernel. * sysdeps/unix/sysv/linux/preadv2.c: Likewise. * sysdeps/unix/sysv/linux/preadv64v2.c: Likewise. * sysdeps/unix/sysv/linux/pwritev2.c: Likewise. * sysdeps/unix/sysv/linux/pwritev64v2.c: Likewise. * sysdeps/unix/sysv/linux/preadv.c (preadv): Add libc_hidden_def. * sysdeps/unix/sysv/linux/preadv64.c (preadv64): Likewise. * sysdeps/unix/sysv/linux/pwritev.c (pwritev): Likewise. * sysdeps/unix/sysv/linux/pwritev64.c (pwritev64): Likewise. * sysdeps/unix/sysv/linux/bits/uio.h: Add supported preadv2/pwritev2 support flags on Linux. * sysdeps/unix/sysv/linux/aarch64/libc.abilist (GLIBC_2.26): Add preadv2, preadv64v2, pwritev2, pwritev64v2. * sysdeps/unix/sysv/linux/alpha/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/arm/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/hppa/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/ia64/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/microblaze/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/nios2/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/sh/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/sysv/linux/tile/tilegx/tilegx32/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/sysv/linux/tile/tilegx/tilegx64/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist (GLIBC_2.26): Likewise.
* Delay initialization of CPU features struct in static binariesSiddhesh Poyarekar2017-05-312-36/+10
| | | | | | | | | | | | | | | | | | | | | Allow the CPU features structure set up to be overridden by tunables by delaying it to until after tunables are initialized. The initialization is already delayed in dynamically linked glibc, it is only in static binaries that the initialization is set early to allow it to influence IFUNC relocations that happen in libc-start. It is a bit too early however and there is a good place between tunables initialization and IFUNC relocations where this can be done. Verified that this does not regress the testsuite. * csu/libc-start.c [!ARCH_INIT_CPU_FEATURES]: Define ARCH_INIT_CPU_FEATURES. (LIBC_START_MAIN): Call it. * sysdeps/unix/sysv/linux/aarch64/libc-start.c (__libc_start_main): Remove. (ARCH_INIT_CPU_FEATURES): New macro. * sysdeps/x86/libc-start.c (__libc_start_main): Remove. (ARCH_INIT_CPU_FEATURES): New macro.
* Add reallocarray functionDennis Wölfing2017-05-3028-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reallocarray function is an extension from OpenBSD. It is an integer-overflow-safe replacement for realloc(p, X*Y) and malloc(X*Y) (realloc(NULL, X*Y)). It can therefore help in preventing certain security issues in code. This is an updated version of a patch originally submitted by Rüdiger Sonderfeld in May 2014 [1]. Checked on i686-linux-gnu and x86_64-linux-gnu. [1] <https://sourceware.org/ml/libc-alpha/2014-05/msg00481.html>. 2017-05-30 Dennis Wölfing <denniswoelfing@gmx.de> Rüdiger Sonderfeld <ruediger@c-plusplus.de> * include/stdlib.h (__libc_reallocarray): New declaration. * malloc/Makefile (routines): Add reallocarray. (tests): Add tst-reallocarray.c. * malloc/Versions: Add reallocarray and __libc_reallocarray. * malloc/malloc-internal.h (check_mul_overflow_size_t): New inline function. * malloc/malloc.h (reallocarray): New declaration. * stdlib/stdlib.h (reallocarray): Likewise. * malloc/reallocarray.c: New file. * malloc/tst-reallocarray.c: New test file. * manual/memory.texi: Document reallocarray. * sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add reallocarray. * 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/nios2/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/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/tilepro/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* x86_64: Remove redundant REX bytes from memchr.SH.J. Lu2017-05-301-14/+14
| | | | | | | | | By x86-64 specification, 32-bit destination registers are zero-extended to 64 bits. There is no need to use 64-bit registers when only the lower 32 bits are non-zero. * sysdeps/x86_64/memchr.S (MEMCHR): Use 32-bit registers for the lower 32 bits.
* m68k: handle default PIEAndreas Schwab2017-05-291-0/+4
|
* float128: Add wrappers to override ldbl-128 as float128.Paul E. Murphy2017-05-2586-0/+646
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change defines float128_private.h which contains macros used to override long double naming conventions when building a ldbl file. * math/math.h [__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (SNANF128): New macro. * math/e_sqrtf128.c: New file. * math/s_fmaxmag_template.c: Include math_private.h in order to make inline expansion of fabs128(). * math/s_fminmag_template.c: Likewise. * sysdeps/ieee754/float128/e_acosf128.c: New file. * sysdeps/ieee754/float128/e_acoshf128.c: New file. * sysdeps/ieee754/float128/e_asinf128.c: New file. * sysdeps/ieee754/float128/e_atan2f128.c: New file. * sysdeps/ieee754/float128/e_atanhf128.c: New file. * sysdeps/ieee754/float128/e_coshf128.c: New file. * sysdeps/ieee754/float128/e_exp10f128.c: New file. * sysdeps/ieee754/float128/e_expf128.c: New file. * sysdeps/ieee754/float128/e_fmodf128.c: New file. * sysdeps/ieee754/float128/e_gammaf128_r.c: New file. * sysdeps/ieee754/float128/e_hypotf128.c: New file. * sysdeps/ieee754/float128/e_ilogbf128.c: New file. * sysdeps/ieee754/float128/e_j0f128.c: New file. * sysdeps/ieee754/float128/e_j1f128.c: New file. * sysdeps/ieee754/float128/e_jnf128.c: New file. * sysdeps/ieee754/float128/e_lgammaf128_r.c: New file. * sysdeps/ieee754/float128/e_log10f128.c: New file. * sysdeps/ieee754/float128/e_log2f128.c: New file. * sysdeps/ieee754/float128/e_logf128.c: New file. * sysdeps/ieee754/float128/e_powf128.c: New file. * sysdeps/ieee754/float128/e_rem_pio2f128.c: New file. * sysdeps/ieee754/float128/e_remainderf128.c: New file. * sysdeps/ieee754/float128/e_scalbf128.c: New file. * sysdeps/ieee754/float128/e_sinhf128.c: New file. * sysdeps/ieee754/float128/float128_private.h: New file. * sysdeps/ieee754/float128/gamma_productf128.c: New file. * sysdeps/ieee754/float128/ieee754_float128.h: New file. * sysdeps/ieee754/float128/k_cosf128.c: New file. * sysdeps/ieee754/float128/k_sincosf128.c: New file. * sysdeps/ieee754/float128/k_sinf128.c: New file. * sysdeps/ieee754/float128/k_tanf128.c: New file. * sysdeps/ieee754/float128/lgamma_negf128.c: New file. * sysdeps/ieee754/float128/lgamma_productf128.c: New file. * sysdeps/ieee754/float128/s_asinhf128.c: New file. * sysdeps/ieee754/float128/s_atanf128.c: New file. * sysdeps/ieee754/float128/s_cbrtf128.c: New file. * sysdeps/ieee754/float128/s_ceilf128.c: New file. * sysdeps/ieee754/float128/s_copysignf128.c: New file. * sysdeps/ieee754/float128/s_cosf128.c: New file. * sysdeps/ieee754/float128/s_erff128.c: New file. * sysdeps/ieee754/float128/s_expm1f128.c: New file. * sysdeps/ieee754/float128/s_fabsf128.c: New file. * sysdeps/ieee754/float128/s_finitef128.c: New file. * sysdeps/ieee754/float128/s_floorf128.c: New file. * sysdeps/ieee754/float128/s_fmaf128.c: New file. * sysdeps/ieee754/float128/s_fpclassifyf128.c: New file. * sysdeps/ieee754/float128/s_frexpf128.c: New file. * sysdeps/ieee754/float128/s_fromfpf128.c: New file. * sysdeps/ieee754/float128/s_fromfpxf128.c: New file. * sysdeps/ieee754/float128/s_getpayloadf128.c: New file. * sysdeps/ieee754/float128/s_isinff128.c: New file. * sysdeps/ieee754/float128/s_isnanf128.c: New file. * sysdeps/ieee754/float128/s_issignalingf128.c: New file. * sysdeps/ieee754/float128/s_llrintf128.c: New file. * sysdeps/ieee754/float128/s_llroundf128.c: New file. * sysdeps/ieee754/float128/s_log1pf128.c: New file. * sysdeps/ieee754/float128/s_logbf128.c: New file. * sysdeps/ieee754/float128/s_lrintf128.c: New file. * sysdeps/ieee754/float128/s_lroundf128.c: New file. * sysdeps/ieee754/float128/s_modff128.c: New file. * sysdeps/ieee754/float128/s_nearbyintf128.c: New file. * sysdeps/ieee754/float128/s_nextafterf128.c: New file. * sysdeps/ieee754/float128/s_nexttowardf128.c: New file. * sysdeps/ieee754/float128/s_nextupf128.c: New file. * sysdeps/ieee754/float128/s_remquof128.c: New file. * sysdeps/ieee754/float128/s_rintf128.c: New file. * sysdeps/ieee754/float128/s_roundevenf128.c: New file. * sysdeps/ieee754/float128/s_roundf128.c: New file. * sysdeps/ieee754/float128/s_scalblnf128.c: New file. * sysdeps/ieee754/float128/s_scalbnf128.c: New file. * sysdeps/ieee754/float128/s_setpayloadf128.c: New file. * sysdeps/ieee754/float128/s_setpayloadsigf128.c: New file. * sysdeps/ieee754/float128/s_signbitf128.c: New file. * sysdeps/ieee754/float128/s_significandf128.c: New file. * sysdeps/ieee754/float128/s_sincosf128.c: New file. * sysdeps/ieee754/float128/s_sinf128.c: New file. * sysdeps/ieee754/float128/s_tanf128.c: New file. * sysdeps/ieee754/float128/s_tanhf128.c: New file. * sysdeps/ieee754/float128/s_totalorderf128.c: New file. * sysdeps/ieee754/float128/s_totalordermagf128.c: New file. * sysdeps/ieee754/float128/s_truncf128.c: New file. * sysdeps/ieee754/float128/s_ufromfpf128.c: New file. * sysdeps/ieee754/float128/s_ufromfpxf128.c: New file. * sysdeps/ieee754/float128/t_sincosf128.c: New file. * sysdeps/ieee754/float128/x2y2m1f128.c: New file. * sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h: (__iscanonicalf128): Define as a macro.
* aarch64: Thunderx specific memcpy and memmoveSteve Ellcey2017-05-248-10/+540
| | | | | | | | | | | | | | * sysdeps/aarch64/memcpy.S (MEMMOVE, MEMCPY): New macros. (memmove): Use MEMMOVE for name. (memcpy): Use MEMCPY for name. Change internal labels to external labels. * sysdeps/aarch64/multiarch/Makefile: New file. * sysdeps/aarch64/multiarch/ifunc-impl-list.c: Likewise. * sysdeps/aarch64/multiarch/init-arch.h: Likewise. * sysdeps/aarch64/multiarch/memcpy.c: Likewise. * sysdeps/aarch64/multiarch/memcpy_generic.S: Likewise. * sysdeps/aarch64/multiarch/memcpy_thunderx.S: Likewise. * sysdeps/aarch64/multiarch/memmove.c: Likewise.
* arm: Fix typo in array countSiddhesh Poyarekar2017-05-242-2/+2
| | | | | | | | | | I just noticed that the array count for the hwcap flags list in ARM is off by 10, i.e. 37 instead of 27. Following patch fixes this. * sysdeps/unix/sysv/linux/arm/dl-procinfo.c (_dl_arm_cap_flags): Fix array subscript. * sysdeps/unix/sysv/linux/arm/dl-procinfo.h (_DL_HWCAP_COUNT): Fix count.
* x86: Don't include cacheinfo.c in ld.soH.J. Lu2017-05-241-0/+4
| | | | | | | Since cacheinfo.c isn't used by ld.so, there is no need to include it in ld.so. * sysdeps/x86/cacheinfo.c: Skip if not in libc.
* x86: Use __get_cpu_features to get cpu_featuresH.J. Lu2017-05-241-10/+9
| | | | | | | | | | | Remove is_intel, is_amd and max_cpuid macros. Use __get_cpu_features to get cpu_features instead. * sysdeps/x86/cacheinfo.c (is_intel): Removed. (is_amd): Likewise. (max_cpuid): Likewise. (__cache_sysconf): Use __get_cpu_features to get cpu_features. (init_cacheinfo): Likewise.
* Fix sys/ucontext.h namespace from signal.h etc. inclusion (bug 21457).Joseph Myers2017-05-2320-149/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The various sys/ucontext.h headers include <signal.h> and all the headers split out of <bits/sigstack.h>. (Except that the powerpc version does not include <signal.h>.) None of the standard versions defining ucontext.h require or permit such inclusions; rather, they all say that the stack_t and sigset_t types from signal.h are defined. This patch fixes the headers to include just the bits/ headers for those types (and the existing includes of bits/sigcontext.h). Since bits/types/sigset_t.h is now being included instead of bits/types/__sigset_t.h, __sigset_t uses in the headers are replaced by direct use of the public sigset_t type. sysdeps/unix/sysv/linux/x86/bits/sigcontext.h was relying on the prior inclusion of <signal.h> to define types such as __uint32_t, so gets a bits/types.h include added to provide those types. Although one could keep some or all of the includes under a __USE_MISC conditional, that seems unnecessary to me, especially given the lack of a <signal.h> include in the powerpc version meaning that portable programs already cannot rely on such an include. Tested for x86_64 and x86, and with build-many-glibcs.py. As with other such fixes, more namespace issues remain so this does not permit any XFAILs to be removed or bugs to be closed. [BZ #21457] * sysdeps/arm/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/generic/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/i386/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/m68k/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/mips/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h>. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. * sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t. * sysdeps/unix/sysv/linux/x86/bits/sigcontext.h: Include <bits/types.h>. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include <signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or <bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of <bits/types/__sigset_t.h>. (ucontext_t): Use sigset_t instead of __sigset_t.
* Fix a bug in 'Remove __need macros from signal.h' (a992f506)Zack Weinberg2017-05-227-16/+21
| | | | | | | | | | | | | | | | | | | | | siginfo-arch.h is included in two different places, so the default definitions of the macros that it might or might not define need to be done conditionally afterward, not unconditionally beforehand. * sysdeps/unix/sysv/linux/bits/siginfo-consts.h (__SI_ASYNCIO_AFTER_SIGIO): Define default after including bits/siginfo-arch.h, only if not already defined. * sysdeps/unix/sysv/linux/bits/types/siginfo_t.h (__SI_ALIGNMENT, __SI_BAND_TYPE, __SI_CLOCK_T) (__SI_ERRNO_THEN_CODE, __SI_HAVE_SIGSYS, __SI_SEGFAULT_ADDL): Likewise. * sysdeps/unix/sysv/linux/ia64/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/mips/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/sparc/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/tile/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/x86/bits/siginfo-arch.h: Unconditionally define __SI_* macros.
* Remove useless comment from sysdeps/sparc/sparc32/dl-machine.hSiddhesh Poyarekar2017-05-231-2/+0
| | | | | | | | David Miller has not been shot yet AFAIK (yes, I googled for any news that may seem relevant and I poked him on twitter some days ago) so either nobody uses SPARC or the code is correct or nobody read the instructions in the comment to shoot him. In all of those cases the comment is clearly not useful, so getting rid of it.
* Remove __need macros from signal.h.Zack Weinberg2017-05-2057-2631/+831
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The types affected are __sig_atomic_t, sig_atomic_t, __sigset_t, sigset_t, sigval_t, sigevent_t, and siginfo_t. __sig_atomic_t is a scalar, so it's now directly available from bits/types.h. The others get bits/types/ headers. Side effects include: There have been small changes to which non-signal headers expose which subset of the signal-related types. A couple of architectures' nested siginfo_t fields had to be renamed to prevent undesired macro expansion. Internal code that wants to manipulate signal masks must now include <sigsetops.h> (which is not installed) and should be aware that __sigaddset, __sigandset, __sigdelset, __sigemptyset, and __sigorset no longer return a value (unlike the public API). Relatedly, the public signal.h no longer declares any of those functions. The obsolete sigmask() macro no longer has a system-specific definition -- in the cases where it matters, it didn't work anyway. New Linux architectures should create bits/siginfo-arch.h and/or bits/siginfo-consts-arch.h to customize their siginfo_t, rather than duplicating everything in bits/siginfo.h (which no longer exists). Add new __SI_* macros if necessary. Ports to other operating systems are strongly encouraged to generalize this scheme further. * bits/sigevent-consts.h * bits/siginfo-consts.h * bits/types/__sigset_t.h * bits/types/sigevent_t.h * bits/types/siginfo_t.h * sysdeps/unix/sysv/linux/bits/sigevent-consts.h * sysdeps/unix/sysv/linux/bits/siginfo-consts.h * sysdeps/unix/sysv/linux/bits/types/__sigset_t.h * sysdeps/unix/sysv/linux/bits/types/sigevent_t.h * sysdeps/unix/sysv/linux/bits/types/siginfo_t.h: New system-dependent bits headers. * sysdeps/unix/sysv/linux/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/bits/siginfo-consts-arch.h * sysdeps/unix/sysv/linux/ia64/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/ia64/bits/siginfo-consts-arch.h * sysdeps/unix/sysv/linux/mips/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/sparc/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/tile/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/tile/bits/siginfo-consts-arch.h * sysdeps/unix/sysv/linux/x86/bits/siginfo-arch.h: New Linux-only system-dependent bits headers. * signal/bits/types/sig_atomic_t.h * signal/bits/types/sigset_t.h * signal/bits/types/sigval_t.h: New non-system-dependent bits headers. * sysdeps/generic/sigsetops.h * sysdeps/unix/sysv/linux/sigsetops.h: New internal headers. * include/bits/types/sig_atomic_t.h * include/bits/types/sigset_t.h * include/bits/types/sigval_t.h: New wrappers. * signal/sigsetops.h * bits/siginfo.h * bits/sigset.h * sysdeps/unix/sysv/linux/bits/siginfo.h * sysdeps/unix/sysv/linux/bits/sigset.h * sysdeps/unix/sysv/linux/ia64/bits/siginfo.h * sysdeps/unix/sysv/linux/mips/bits/siginfo.h * sysdeps/unix/sysv/linux/s390/bits/siginfo.h * sysdeps/unix/sysv/linux/sparc/bits/siginfo.h * sysdeps/unix/sysv/linux/tile/bits/siginfo.h * sysdeps/unix/sysv/linux/x86/bits/siginfo.h: Deleted. * signal/Makefile, sysdeps/unix/sysv/linux/Makefile: Update lists of installed headers. * posix/bits/types.h: Define __sig_atomic_t here. * signal/signal.h: Use the new bits headers; no need to handle __need_sig_atomic_t nor __need_sigset_t. Don't use __sigmask to define sigmask. * include/signal.h: No need to handle __need_sig_atomic_t nor __need_sigset_t. Don't define __sigemptyset. * io/sys/poll.h, setjmp/setjmp.h * sysdeps/arm/sys/ucontext.h, sysdeps/generic/sys/ucontext.h * sysdeps/i386/sys/ucontext.h, sysdeps/m68k/sys/ucontext.h * sysdeps/mach/hurd/i386/bits/sigcontext.h * sysdeps/mips/sys/ucontext.h, sysdeps/powerpc/novmxsetjmp.h * sysdeps/pthread/bits/sigthread.h * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h * sysdeps/unix/sysv/linux/mips/sys/ucontext.h * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h * sysdeps/unix/sysv/linux/s390/sys/ucontext.h * sysdeps/unix/sysv/linux/sh/sys/ucontext.h * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h * sysdeps/unix/sysv/linux/tile/sys/ucontext.h * sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Use bits/types/__sigset_t.h. * misc/sys/select.h, posix/spawn.h * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h * sysdeps/unix/sysv/linux/sys/epoll.h * sysdeps/unix/sysv/linux/sys/signalfd.h: Use bits/types/sigset_t.h. * resolv/netdb.h, rt/mqueue.h: Use bits/types/sigevent_t.h. * rt/aio.h: Use bits/types/sigevent_t.h and bits/sigevent-consts.h. * socket/sys/socket.h: Don't include bits/sigset.h. * login/utmp_file.c, shadow/lckpwdf.c, signal/sigandset.c * signal/sigisempty.c, stdlib/abort.c, sysdeps/posix/profil.c * sysdeps/posix/sigignore.c, sysdeps/posix/sigintr.c * sysdeps/posix/signal.c, sysdeps/posix/sigset.c * sysdeps/posix/sprofil.c, sysdeps/posix/sysv_signal.c * sysdeps/unix/sysv/linux/nptl-signals.h: Include sigsetops.h. * signal/sigaddset.c, signal/sigandset.c, signal/sigdelset.c * signal/sigorset.c, stdlib/abort.c, sysdeps/posix/sigignore.c * sysdeps/posix/signal.c, sysdeps/posix/sigset.c: __sigaddset, __sigandset, __sigdelset, __sigemptyset, __sigorset now return no value. * signal/sigaddset.c, signal/sigdelset.c, signal/sigismem.c Include <errno.h>, <signal.h>, and <sigsetops.h> instead of "sigsetops.h". * signal/sigsetops.c: Explicitly define __sigismember, __sigaddset, and __sigdelset as compatibility symbols. * signal/Versions: Correct commentary on __sigpause, __sigaddset, __sigdelset, __sigismember. * inet/rcmd.c: Include sigsetops.h. Convert old code using __sigblock/__sigsetmask to use __sigprocmask and friends.
* x86_64: Remove L(return_null) from rawmemchr.SH.J. Lu2017-05-201-5/+0
| | | | | | L(return_null) is unused. * sysdeps/x86_64/rawmemchr.S (L(return_null)): Removed.
* Remove sfi_* annotations from ARM assembly files.Zack Weinberg2017-05-2021-882/+442
| | | | | | | | | | | | | | | | | | | | | | This semi-mechanical patch removes all uses and definitions of the sfi_breg, sfi_pld, and sfi_sp macros from various ARM-specific assembly files. These were only used by NaCl. * sysdeps/arm/sysdep.h (ARM_SFI_MACROS, sfi_breg, sfi_pld, sfi_sp): Delete definitions. * sysdeps/arm/__longjmp.S, sysdeps/arm/add_n.S * sysdeps/arm/addmul_1.S, sysdeps/arm/arm-mcount.S * sysdeps/arm/armv6/rawmemchr.S, sysdeps/arm/armv6/strchr.S * sysdeps/arm/armv6/strcpy.S, sysdeps/arm/armv6/strlen.S * sysdeps/arm/armv6/strrchr.S, sysdeps/arm/armv6t2/memchr.S * sysdeps/arm/armv6t2/strlen.S * sysdeps/arm/armv7/multiarch/memcpy_impl.S * sysdeps/arm/armv7/strcmp.S, sysdeps/arm/dl-tlsdesc.S * sysdeps/arm/memcpy.S, sysdeps/arm/memmove.S * sysdeps/arm/memset.S, sysdeps/arm/setjmp.S * sysdeps/arm/strlen.S, sysdeps/arm/submul_1.S: Remove all uses of sfi_breg, sfi_pld, and sfi_sp.
* Remove the bulk of the NaCl port.Zack Weinberg2017-05-20149-8625/+0
| | | | | | | | | | | | | | | | The NaCl port has not been actively maintained since before the 2.25 release. The complementary GCC back-end was never contributed to GCC, and we are given to understand that the current NaCl SDK has switched to Clang and therefore cannot be used to build glibc anymore, so we doubt that the port remains useful. This commit simply removes the sysdeps/arm/nacl and sysdeps/nacl directories and the abi-tags entry. Remove the NaCl port. * abi-tags: Remove .*-.*-nacl.* entry. * sysdeps/arm/nacl: Remove directory and contents. * sysdeps/nacl: Likewise.