about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/sh
Commit message (Collapse)AuthorAgeFilesLines
* linux: Consolidate sigaction implementationAdhemerval Zanella2018-04-051-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates all Linux sigaction implementations on the default sysdeps/unix/sysv/linux/sigaction.c. The idea is remove redundant code and simplify new ports addition by following the current generic Linux User API (UAPI). The UAPI for new ports defines a generic extensible sigaction struct as: struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; #ifdef SA_RESTORER void (*sa_restorer) (void); #endif sigset_t sa_mask; }; Where SA_RESTORER is just placed for compatibility reasons (news ports should not add it). A similar definition is used on generic kernel_sigaction.h. The user exported sigaction definition is not changed, so for most architectures it requires an adjustment to kernel expected one for the syscall. The main changes are: - All architectures now define and use a kernel_sigaction struct meant for the syscall, even for the architectures where the user sigaction has the same layout of the kernel expected one (s390-64 and ia64). Although it requires more work for these architectures, it simplifies the generic implementation. Also, sigaction is hardly a hotspot where micro optimization would play an important role. - The generic kernel_sigaction definition is now aligned with expected UAPI one for newer ports, where SA_RESTORER and sa_restorer are not expected to be defined. This means adding kernel_sigaction for current architectures that does define it (m68k, nios2, powerpc, s390, sh, sparc, and tile) and which rely on previous generic definition. - Remove old MIPS usage of sa_restorer. This was removed since 2.6.27 (2957c9e61ee9c - "[MIPS] IRIX: Goodbye and thanks for all the fish"). - The remaining arch-specific sigaction.c are to handle ABI idiosyncrasies (like SPARC kernel ABI for rt_sigaction that requires an additional stub argument). So for new ports the generic implementation should work if its uses Linux UAPI. If SA_RESTORER is still required (due some architecture limitation), it should define its own kernel_sigaction.h, define it and include generic header (assuming it still uses the default generic kernel layout). Checked on x86_64-linux-gnu, i686-linux-gnu, arm-linux-gnueabihf, aarch64-linux-gnu, sparc64-linux-gnu, sparcv9-linux-gnu, powerpc-linux-gnu, powerpc64-linux-gnu, ia64-linux-gnu and alpha-linux-gnu. I also checked the build on all remaining affected ABIs. * sysdeps/unix/sysv/linux/aarch64/sigaction.c: Use default Linux version as base implementation. * sysdeps/unix/sysv/linux/arm/sigaction.c: Likewise. * sysdeps/unix/sysv/linux/i386/sigaction.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/sigaction.c: Likewise. * sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h: Add include guards, remove unrequired definitions and update comments. * sysdeps/unix/sysv/linux/kernel_sigaction.h: Likewise. * sysdeps/unix/sysv/linux/mips/kernel_sigaction.h: Likewise. * sysdeps/unix/sysv/linux/ia64/kernel_sigaction.h: New file. * sysdeps/unix/sysv/linux/m68k/kernel_sigaction.h: Likewise. * sysdeps/unix/sysv/linux/nios2/kernel_sigaction.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/kernel_sigaction: Likewise. * sysdeps/unix/sysv/linux/s390/kernel_sigaction.h: Likewise. * sysdeps/unix/sysv/linux/sh/kernel_sigaction.h: Likewise. * sysdeps/unix/sysv/linux/sparc/kernel_sigaction.h: Likewise. * sysdeps/unix/sysv/linux/tile/kernel_sigaction.h: Likewise. * sysdeps/unix/sysv/linux/ia64/sigaction.c: Remove file. * sysdeps/unix/sysv/linux/mips/sigaction.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c: Likewise. * sysdeps/unix/sysv/linux/sigaction.c: Add STUB, SET_SA_RESTORER, and RESET_SA_RESTORER hooks.
* Remove unused frame.h header, sigcontextinfo.h macros.Joseph Myers2018-03-221-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The glibc-internal header frame.h was used in the old debug/backtrace.c but is now unused. Similarly, there are some sigcontextinfo.h macros that are used nowhere in glibc - ADVANCE_STACK_FRAME and FIRST_FRAME_POINTER were used in the old debug/backtrace.c, while SIGCONTEXT_EXTRA_ARGS, GET_FRAME, GET_STACK and CALL_SIGHANDLER were unused even before the removal of that old implementation (beyond uses of SIGCONTEXT_EXTRA_ARGS in definitions of CALL_SIGHANDLER). This patch removes all the unused frame.h headers and definitions of those macros. Tested with build-many-glibcs.py. * sysdeps/generic/frame.h: Remove file. * sysdeps/arm/frame.h: Likewise. * sysdeps/hppa/frame.h: Likewise. * sysdeps/generic/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Remove macro. (GET_FRAME): Likewise. (GET_STACK): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/mach/hurd/i386/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (GET_FRAME): Likewise. (GET_STACK): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (GET_FRAME): Likewise. (GET_STACK): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/arm/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (GET_FRAME): Likewise. (GET_STACK): Likewise. (ADVANCE_STACK_FRAME): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/i386/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (GET_FRAME): Likewise. (GET_STACK): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/ia64/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (GET_FRAME): Likewise. (GET_STACK): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (GET_FRAME): Likewise. (GET_STACK): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/microblaze/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (GET_FRAME): Likewise. (GET_STACK): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/mips/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (GET_FRAME): Likewise. (GET_STACK): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (GET_FRAME): Likewise. (GET_STACK): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (GET_FRAME): Likewise. (GET_STACK): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/s390/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (GET_FRAME): Likewise. (GET_STACK): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/sh/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (GET_FRAME): Likewise. (GET_STACK): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (FIRST_FRAME_POINTER): Likewise. (ADVANCE_STACK_FRAME): Likewise. (GET_STACK): Likewise. (GET_FRAME): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (ADVANCE_STACK_FRAME): Likewise. (GET_STACK): Likewise. (GET_FRAME): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/tile/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (GET_FRAME): Likewise. (GET_STACK): Likewise. (CALL_SIGHANDLER): Likewise. * sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Likewise. (GET_FRAME): Likewise. (GET_STACK): Likewise. (CALL_SIGHANDLER): Likewise.
* Add narrowing subtract functions.Joseph Myers2018-03-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the narrowing subtract functions from TS 18661-1 to glibc's libm: fsub, fsubl, dsubl, f32subf64, f32subf32x, f32xsubf64 for all configurations; f32subf64x, f32subf128, f64subf64x, f64subf128, f32xsubf64x, f32xsubf128, f64xsubf128 for configurations with _Float64x and _Float128; __nldbl_dsubl for ldbl-opt. The changes are essentially the same as for the narrowing add functions, so the description of those generally applies to this patch as well. Tested for x86_64, x86, mips64 (all three ABIs, both hard and soft float) and powerpc, and with build-many-glibcs.py. * math/Makefile (libm-narrow-fns): Add sub. (libm-test-funcs-narrow): Likewise. * math/Versions (GLIBC_2.28): Add narrowing subtract functions. * math/bits/mathcalls-narrow.h (sub): Use __MATHCALL_NARROW. * math/gen-auto-libm-tests.c (test_functions): Add sub. * math/math-narrow.h (CHECK_NARROW_SUB): New macro. (NARROW_SUB_ROUND_TO_ODD): Likewise. (NARROW_SUB_TRIVIAL): Likewise. * sysdeps/ieee754/float128/float128_private.h (__fsubl): New macro. (__dsubl): Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fsub and dsub. (CFLAGS-nldbl-dsub.c): New variable. (CFLAGS-nldbl-fsub.c): Likewise. * sysdeps/ieee754/ldbl-opt/Versions (GLIBC_2.28): Add __nldbl_dsubl. * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__nldbl_dsubl): New prototype. * manual/arith.texi (Misc FP Arithmetic): Document fsub, fsubl, dsubl, fMsubfN, fMsubfNx, fMxsubfN and fMxsubfNx. * math/auto-libm-test-in: Add tests of sub. * math/auto-libm-test-out-narrow-sub: New generated file. * math/libm-test-narrow-sub.inc: New file. * sysdeps/i386/fpu/s_f32xsubf64.c: Likewise. * sysdeps/ieee754/dbl-64/s_f32xsubf64.c: Likewise. * sysdeps/ieee754/dbl-64/s_fsub.c: Likewise. * sysdeps/ieee754/float128/s_f32subf128.c: Likewise. * sysdeps/ieee754/float128/s_f64subf128.c: Likewise. * sysdeps/ieee754/float128/s_f64xsubf128.c: Likewise. * sysdeps/ieee754/ldbl-128/s_dsubl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_f64xsubf128.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fsubl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_dsubl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fsubl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_dsubl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fsubl.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-dsub.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-fsub.c: Likewise. * sysdeps/ieee754/soft-fp/s_dsubl.c: Likewise. * sysdeps/ieee754/soft-fp/s_fsub.c: Likewise. * sysdeps/ieee754/soft-fp/s_fsubl.c: Likewise. * sysdeps/powerpc/fpu/libm-test-ulps: Update. * sysdeps/mach/hurd/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Refactor Linux ARCH_FORK implementationAdhemerval Zanella2018-03-071-28/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch refactors the ARCH_FORK macro and the required architecture specific header to simplify the required architecture definitions to provide the fork syscall semantic and proper document current Linux clone ABI variant. Instead of require the reimplementation of arch-fork.h header, this patch changes the ARCH_FORK to an inline function with clone ABI defined by kernel-features.h define. The generic kernel ABI meant for newer ports is used as default and redefine if the architecture requires. Checked on x86_64-linux-gnu and i686-linux-gnu. Also with a build for all the afected ABIs. * sysdeps/nptl/fork.c (ARCH_FORK): Replace by auch_fork. * sysdeps/unix/sysv/linux/alpha/arch-fork.h: Remove file. * sysdeps/unix/sysv/linux/riscv/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/aarch64/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/arm/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/hppa/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/i386/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/ia64/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/m68k/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/microblaze/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/mips/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/nios2/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/s390/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/sh/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/sparc/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/tile/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/arch-fork.h (arch_fork): New function. * sysdeps/unix/sysv/linux/aarch64/kernel-features.h: New file. * sysdeps/unix/sysv/linux/riscv/kernel-features.h: Likewise. * sysdeps/unix/sysv/linux/arm/kernel-features.h (__ASSUME_CLONE_BACKWARDS): Define. * sysdeps/unix/sysv/linux/createthread.c (ARCH_CLONE): Define to __clone2 if __NR_clone2 is defined. * sysdeps/unix/sysv/linux/hppa/kernel-features.h (__ASSUME_CLONE_BACKWARDS): Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_CLONE_BACKWARDS): Likewise. * sysdeps/unix/sysv/linux/ia64/kernel-features.h (__ASSUME_CLONE2): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_CLONE_BACKWARDS3): Likewise. * sysdeps/unix/sysv/linux/kernel-features.h: Document possible clone variants and the define architecture can use. (__ASSUME_CLONE_DEFAULT): Define as default. * sysdeps/unix/sysv/linux/mips/kernel-features.h (__ASSUME_CLONE_BACKWARDS): Likewise. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_CLONE_BACKWARDS): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_CLONE_BACKWARDS2): Likewise.
* Add narrowing add functions.Joseph Myers2018-02-101-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the narrowing add functions from TS 18661-1 to glibc's libm: fadd, faddl, daddl, f32addf64, f32addf32x, f32xaddf64 for all configurations; f32addf64x, f32addf128, f64addf64x, f64addf128, f32xaddf64x, f32xaddf128, f64xaddf128 for configurations with _Float64x and _Float128; __nldbl_daddl for ldbl-opt. As discussed for the build infrastructure patch, tgmath.h support is deliberately deferred, and FP_FAST_* macros are not applicable without optimized function implementations. Function implementations are added for all relevant pairs of formats (including certain cases of a format and itself where more than one type has that format). The main implementations use round-to-odd, or a trivial computation in the case where both formats are the same or where the wider format is IBM long double (in which case we don't attempt to be correctly rounding). The sysdeps/ieee754/soft-fp implementations use soft-fp, and are used automatically for configurations without exceptions and rounding modes by virtue of existing Implies files. As previously discussed, optimized versions for particular architectures are possible, but not included. i386 gets a special version of f32xaddf64 to avoid problems with double rounding (similar to the existing fdim version), since this function must round just once without an intermediate rounding to long double. (No such special version is needed for any other function, because the nontrivial functions use round-to-odd, which does the intermediate computation with the rounding mode set to round-to-zero, and double rounding is OK except in round-to-nearest mode, so is OK for that intermediate round-to-zero computation.) mul and div will need slightly different special versions for i386 (using round-to-odd on long double instead of precision control) because of the possibility of inexact intermediate results in the subnormal range for double. To reduce duplication among the different function implementations, math-narrow.h gets macros CHECK_NARROW_ADD, NARROW_ADD_ROUND_TO_ODD and NARROW_ADD_TRIVIAL. In the trivial cases and for any architecture-specific optimized implementations, the overhead of the errno setting might be significant, but I think that's best handled through compiler built-in functions rather than providing separate no-errno versions in glibc (and likewise there are no __*_finite entry points for these function provided, __*_finite effectively being no-errno versions at present in most cases). Tested for x86_64 and x86, with both GCC 6 and GCC 7. Tested for mips64 (all three ABIs, both hard and soft float) and powerpc with GCC 7. Tested with build-many-glibcs.py with both GCC 6 and GCC 7. * math/Makefile (libm-narrow-fns): Add add. (libm-test-funcs-narrow): Likewise. * math/Versions (GLIBC_2.28): Add narrowing add functions. * math/bits/mathcalls-narrow.h (add): Use __MATHCALL_NARROW . * math/gen-auto-libm-tests.c (test_functions): Add add. * math/math-narrow.h (CHECK_NARROW_ADD): New macro. (NARROW_ADD_ROUND_TO_ODD): Likewise. (NARROW_ADD_TRIVIAL): Likewise. * sysdeps/ieee754/float128/float128_private.h (__faddl): New macro. (__daddl): Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fadd and dadd. (CFLAGS-nldbl-dadd.c): New variable. (CFLAGS-nldbl-fadd.c): Likewise. * sysdeps/ieee754/ldbl-opt/Versions (GLIBC_2.28): Add __nldbl_daddl. * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__nldbl_daddl): New prototype. * manual/arith.texi (Misc FP Arithmetic): Document fadd, faddl, daddl, fMaddfN, fMaddfNx, fMxaddfN and fMxaddfNx. * math/auto-libm-test-in: Add tests of add. * math/auto-libm-test-out-narrow-add: New generated file. * math/libm-test-narrow-add.inc: New file. * sysdeps/i386/fpu/s_f32xaddf64.c: Likewise. * sysdeps/ieee754/dbl-64/s_f32xaddf64.c: Likewise. * sysdeps/ieee754/dbl-64/s_fadd.c: Likewise. * sysdeps/ieee754/float128/s_f32addf128.c: Likewise. * sysdeps/ieee754/float128/s_f64addf128.c: Likewise. * sysdeps/ieee754/float128/s_f64xaddf128.c: Likewise. * sysdeps/ieee754/ldbl-128/s_daddl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_f64xaddf128.c: Likewise. * sysdeps/ieee754/ldbl-128/s_faddl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_daddl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_faddl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_daddl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_faddl.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-dadd.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-fadd.c: Likewise. * sysdeps/ieee754/soft-fp/s_daddl.c: Likewise. * sysdeps/ieee754/soft-fp/s_fadd.c: Likewise. * sysdeps/ieee754/soft-fp/s_faddl.c: Likewise. * sysdeps/powerpc/fpu/libm-test-ulps: Update. * sysdeps/mach/hurd/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Add MAP_SYNC from Linux 4.15.Joseph Myers2018-02-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the MAP_SYNC macro from Linux 4.15 to various bits/mman.h headers. Note that this is *not* added to all architectures: in Linux 4.15, this macro is only in asm-generic/mman.h, and only some architectures' asm/mman.h include the asm-generic file - the architectures not using the asm-generic file will need their own values of MAP_SYNC allocated to support this functionality (some of them also already have conflicting mmap flags so the value there will have to be different from the generic 0x80000). Specifically, for glibc architectures, alpha hppa mips powerpc sparc tile lack allocations of values for MAP_SYNC. Tested for x86_64. * sysdeps/unix/sysv/linux/aarch64/bits/mman.h [__USE_MISC] (MAP_SYNC): New macro. * sysdeps/unix/sysv/linux/arm/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/ia64/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/m68k/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/microblaze/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/nios2/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/riscv/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/s390/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/sh/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/x86/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2018-01-0130-30/+30
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* copy_file_range: New function to copy file dataFlorian Weimer2017-12-221-0/+1
| | | | | The semantics are based on the Linux system call, but a very close emulation in user space is provided.
* sh: Fix clone exit return code (BZ #22605)Adhemerval Zanella2017-12-191-0/+1
| | | | | | | | | | | | | | | | Since 3f823e87cc (Call exit directly in clone (BZ #21512)) SH clone implementation fails to set the exit code resulting in the failures: FAIL: nptl/tst-align-clone FAIL: nptl/tst-getpid1 This patch fixes the both testcases. [BZ #22605] * sysdeps/unix/sysv/linux/sh/clone.S (__clone): Fix exit return code. Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add _Float32 function aliases.Joseph Myers2017-12-072-0/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch concludes filling out TS 18661-3 support for different types by adding *f32 function aliases of float functions to support _Float32. As with _Float64 and _Float32x, this is supported for all glibc configurations. As with the previous such patches there are some x86 ulps updates because of inline functions present for float but not for _Float32. The patch also has the usual bits/floatn-common.h update, symbol versions, ABI baselines updates, test enablement and documentation. Tested for x86_64 and x86, and with build-many-glibcs.py, with both GCC 6 and GCC 7. * bits/floatn-common.h (__HAVE_FLOAT32): Define to 1. * manual/math.texi (Mathematics): Document support for _Float32. * math/Makefile (test-types): Add float32. * math/Versions (GLIBC_2.27): Add _Float32 functions. * stdlib/Versions (GLIBC_2.27): Likewise. * wcsmbs/Versions (GLIBC_2.27): Likewise. * sysdeps/unix/sysv/linux/aarch64/libc.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.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/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.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/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise. * sysdeps/i386/fpu/libm-test-ulps: Likewise. * sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
* Add _Float64, _Float32x function aliases.Joseph Myers2017-12-062-0/+218
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch continues filling out TS 18661-3 support by adding *f64 and *f32x function aliases, supporting _Float64 and _Float32x, as aliases for double functions. These types are supported for all glibc configurations. The API corresponds exactly to that for _Float128 and _Float64x. _Float32 aliases to float functions remain to be added in subsequent patches to complete this process (then there are a few miscellaneous functions in TS 18661-3 to implement that aren't simply versions of existing functions for new types). The patch enables the feature in bits/floatn-common.h, adds symbol versions and documentation with updates to ABI baselines, and arranges for the libm functions for the new types to be tested. As with the _Float64x changes there are some x86 ulps updates because of header inlines not used for the new types (and one other change to the non-multiarch libm-test-ulps, which I suppose comes from using a different compiler version / configuration from when it was last regenerated). Tested for x86_64 and x86, and with build-many-glibcs.py, with both GCC 6 and GCC 7. * bits/floatn-common.h (__HAVE_FLOAT64): Define to 1. (__HAVE_FLOAT32X): Likewise. * manual/math.texi (Mathematics): Document support for _Float64 and _Float32x. * math/Makefile (test-types): Add float64 and float32x. * math/Versions (GLIBC_2.27): Add _Float64 and _Float32x functions. * stdlib/Versions (GLIBC_2.27): Likewise. * wcsmbs/Versions (GLIBC_2.27): Likewise. * sysdeps/unix/sysv/linux/aarch64/libc.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.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/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.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/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise. * sysdeps/i386/fpu/libm-test-ulps: Likewise. * sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
* Linux: Implement interfaces for memory protection keysFlorian Weimer2017-12-051-0/+5
| | | | | | | | | | | | | | | | This adds system call wrappers for pkey_alloc, pkey_free, pkey_mprotect, and x86-64 implementations of pkey_get and pkey_set, which abstract over the PKRU CPU register and hide the actual number of memory protection keys supported by the CPU. pkey_mprotect with a -1 key is implemented using mprotect, so it will work even if the kernel does not support the pkey_mprotect system call. The system call wrapers use unsigned int instead of unsigned long for parameters, so that no special treatment for x32 is needed. The flags argument is currently unused, and the access rights bit mask is limited to two bits by the current PKRU register layout anyway. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Implement the mlock2 functionFlorian Weimer2017-11-271-0/+1
| | | | | | Fallback using mlock is provided if the flags argument is zero. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: Add memfd_create system call wrapperFlorian Weimer2017-11-231-0/+1
| | | | | | | | | | | | | | The system call is somewhat obscure because it is closely related to file descriptor sealing. However, it is also the recommended way to create alias mappings, which is why it has more general use. No emulation is provided. Except for the name of the /proc/self/fd links, it would be possible to implement an approximation using O_TMPFILE and tmpfs, but this does not appear to be worth the added complexity. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
* Add jmp_buf-macros.hH.J. Lu2017-11-091-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Verify that sizes, alignments and field offsets of jmp_buf as well as sigjmp_buf are unchanged regardless how struct __jmp_buf_tag is defined. Since jmp_buf is target specific, jmp_buf-macros.h is added for each Linux target. A new target must provides its own jmp_buf-macros.h. TODO: Hurd needs to provide a jmp_buf-macros.h. Tested with build-many-glibcs.py. * include/setjmp.h [!_ISOMAC]: Include <stddef.h> and <jmp_buf-macros.h>. [!_ISOMAC] (STR_HELPER): New. [!_ISOMAC] (STR): Likewise. [!_ISOMAC] (TEST_SIZE): Likewise. [!_ISOMAC] (TEST_ALIGN): Likewise. [!_ISOMAC] (TEST_OFFSET): Likewise. [!_ISOMAC] Add _Static_assert to check sizes, alignments and field offsets of jmp_buf as well as sigjmp_buf. * sysdeps/unix/sysv/linux/aarch64/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/alpha/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/arm/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/hppa/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/i386/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/ia64/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/m68k/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/microblaze/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/nios2/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/sh/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/jmp_buf-macros.h: Likewise.
* Linux: Consolidate {RTLD_}SINGLE_THREAD_P definitionAdhemerval Zanella2017-10-111-34/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current GLIBC has two ways to implement the single thread optimization on syscalls to avoid calling the cancellation path: either by using global variables (__{libc,pthread}_multiple_thread) or by accessing the TCB field (defined by TLS_MULTIPLE_THREADS_IN_TCB). Both the variables and the macros to acces its value are defined in the architecture sysdep-cancel.h header. This patch consolidates its definition on only one header, sysdeps/unix/sysv/linux/sysdep-cancel.h, and adds a new define (SINGLE_THREAD_BY_GLOBAL) which the architecture defines if it prefer to use the global variables instead of the TCB field. This is an optimization, so if the architecture does not define it, the TCB method will be used as default. Checked on x86_64-linux-gnu and on a build with major touched ABIs (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf, hppa-linux-gnu, i686-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, mips-linux-gnu, mips64-linux-gnu, powerpc-linux-gnu, powerpc64le-linux-gnu, s390-linux-gnu, s390x-linux-gnu, sh4-linux-gnu, sparcv9-linux-gnu, sparc64-linux-gnu, tilegx-linux-gnu). * sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h: Remove file. * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/arm/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/mips/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/tile/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Define. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/alpha/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/arm/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/microblaze/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise.
* New symbol version for logf, log2f and powf without SVID compatSzabolcs Nagy2017-10-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the logf, log2f and powf error handling semantics to only set errno accoring to POSIX rules. New symbol version is introduced at GLIBC_2.27. The old wrappers are kept for compat symbols. ia64 needed assembly change to have the new and compat versioned symbol map to the same function. All linux libm abilists are updated. * math/Versions (logf): New libm symbol at GLIBC_2.27. (log2f): Likewise. (powf): Likewise. * math/w_log2f.c: New file. * math/w_logf.c: New file. * math/w_powf.c: New file. * math/w_log2f_compat.c (__log2f_compat): For compat symbol only. * math/w_logf_compat.c (__logf_compat): Likewise. * math/w_powf_compat.c (__powf_compat): Likewise. * sysdeps/ia64/fpu/e_log2f.S: Add versioned symbols. * sysdeps/ia64/fpu/e_logf.S: Likewise. * sysdeps/ia64/fpu/e_powf.S: Likewise. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Update. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* posix: Add compat glob symbol to not follow dangling symbolsAdhemerval Zanella2017-09-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch follows commit 5554304f0 (posix: Allow glob to match dangling symlinks [BZ #866]) by adding a compat symbol that follow previous semantic of not following dangling symlinks and thus avoiding call gl_lstat with GLOB_ALTDIRFUNC. It avoids failure with old binaries that not set the alternate function pointer for lstat (GNUmake for instance). The following scenario, for instance, fails with current GNUmake because glibc will access unitialized memory when calling gl_lstat: $ cat src/t/t.c int main () { return 0; } $ cat Makefile SRC = $(wildcard src/*/t.c) OBJ = $(patsubst src/%.c, obj/%.o, $(SRC)) prog: $(OBJ) $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJ) -o prog obj/%.o: src/%.c $(CC) $(CFLAGS) -c $< -o $@ $ make This works as expected with the patch applied. Since it is for generic ABI, default compat symbols are added with override for Linux due LFS. Now we have two compat symbols for glob on Linux: 1. sysdeps/unix/sysv/linux/oldglob.c which implements glob64 with the old dirent layout. For this implementation I also set it to not follow dangling symlinks (which is the safest path). 2. sysdeps/unix/sysv/linux/glob{64}-lstat-compat.c which implements the compat symbol for dangling symlinks. As for generic glob, the implementation uses XSTAT_IS_XSTAT64 to define whether both __glob_lstat_compat and __glob64_lstat_compat should be different implementations. For archictures that define XSTAT_IS_XSTAT64, __glob_lstat_compat is aliased to __glob64_lstat_compat. 3. sysdeps/unix/sysv/linux/alpha/oldglob.c with a different glob_t layout. As for 1. this patch changes it to not follow dangling symlinks. The patch also bumps _GNU_GLOB_INTERFACE_VERSION to 2 to advertise the new semantic. On GNUmake, for instance, it will force to it use its internal glob implementation instead and avoiding triggering the same failure on builds against newer GLIBCs. Checked on x86_64-linux-gnu and i686-linux-gnu. I also checked with a build against the major ABIs required to check for the abilist. The changes should also work on gnulib (I run gnulib-tool.py check glob and it shown no regressions). [BZ #22183] * include/gnu-versions.h (_GNU_GLOB_INTERFACE_VERSION): Increase version to 2. * posix/Makefile (routines): Add glob-lstat-compat and glob64-lstat-compat. * posix/Versions (GLIBC_2.27, glob, glob64): Add symbol version. * posix/glob-lstat-compat.c: New file. * posix/glob64-lstat-compat.c: Likewise. * posix/tst-glob_lstat_compat.c: Likewise. * sysdeps/unix/sysv/linux/glob-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/alpha/glob-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/glob64-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/alpha/glob.c: Remove file. * posix/glob.c (glob_lstat): New function. (glob): Rename to __glob and add versioned symbol to 2.27. (glob_in_dir): Use glob_lstat. * posix/glob64.c (glob64): Add GLOB_ATTRIBUTE. * sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/glob.c (glob): Add versioned symbol for 2.27. * sysdeps/unix/sysv/linux/glob64.c (glob64): Likewise. * sysdeps/unix/sysv/linux/oldglob.c (GLOB_NO_LSTAT): Define. * sysdeps/unix/sysv/linux/alpha/oldglob.c (__old_glob): Do not use gl_lstat on glob call. * sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add GLIBC_2.27 glob and glob64 symbols. * 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.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/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.
* New expf and exp2f version without SVID compat wrapperSzabolcs Nagy2017-09-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the expf and exp2f error handling semantics to only set errno accoring to POSIX rules. New symbol version is introduced at GLIBC_2.27. The old wrappers are kept for compat symbols. Internal calls to __expf now get the new error semantics, this seems to only affect sysdeps/i386/fpu/s_expm1f.S where the errno-only behaviour should be correct. ia64 needed assembly change to have the new and compat versioned symbol map to the same function. All linux libm abilists are updated. * math/Versions (expf): New libm symbol at GLIBC_2.27. (exp2f): Likewise. * math/w_exp2f.c: New file. * math/w_expf.c: New file. * math/w_exp2f_compat.c (__exp2f_compat): For compat symbol only. * math/w_expf_compat.c (__expf_compat): Likewise. * sysdeps/ia64/fpu/e_exp2f.S: Add versioned symbols. * sysdeps/ia64/fpu/e_expf.S: Likewise. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Update. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Remove NO_CANCELLATION macroAdhemerval Zanella2017-08-311-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The NO_CANCELLATION macro is used currently on generic headers to define non cancellable syscalls and on Linux fcntl to implement the non cancellable variation. Former should be single-handled by not-cancel.h header and former could be simplified build both cancellable and non cancellable for default objects and alias the non-cancellable to default one for rtld ones (since Linux already support cancellation as default). This patch thus removes the NO_CANCELLATION macro and its usage. The generic non cancellable fcntl is route to internal fcntl. Checked on x86_64-linux-gnu and i686-linux-gnu. Also checked with a build again major ABIs. * sysdeps/generic/not-cancel.h (NO_CANCELLATION): Remove macro. * sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/arm/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (NO_CANCELLATION): Likewise * sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/tile/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/not-cancel.h (__fcntl_nocancel): Add hidden prototype. * sysdeps/unix/sysv/linux/fcntl.c (__fcntl_nocancel): Define only for !IS_IN (rtld) and remove NO_CANCELLATION usage.
* Fix mcontext_t sigcontext namespace (bug 21457).Joseph Myers2017-08-301-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch completes the ucontext.h namespace fixes by fixing issues related to the use of struct sigcontext as mcontext_t, and inclusion of <bits/sigcontext.h> even when struct sigcontext is not so used. Inclusion of <bits/sigcontext.h> by <sys/ucontext.h> is removed; the way to get the sigcontext structure is by including <signal.h> (in a context where __USE_MISC is defined); the sysdeps/generic version of sys/ucontext.h keeps the inclusion by necessity, with a comment about how this is not namespace-clean, but the only configuration that used it, MicroBlaze, gets its own version of the header in this patch. Where mcontext_t was typedefed to struct sigcontext, the contents of struct sigcontext are inserted (with appropriate namespace handling to prefix fields with __ when __USE_MISC is not defined); review should check that this has been done correctly in each case, whether the definition of struct sigcontext comes from glibc headers or from the Linux kernel. This changes C++ name mangling on affected architectures (which do not include x86_64/x86). Tested for x86_64, and with build-many-glibcs.py. 2017-08-14 Joseph Myers <joseph@codesourcery.com> [BZ #21457] * sysdeps/arm/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/generic/sys/ucontext.h: Add comment about use of struct sigcontext and namespace requirements. * sysdeps/i386/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/m68k/sys/ucontext.h: Likewise. * sysdeps/mips/sys/ucontext.h: Likewise. Include <bits/types.h>. * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym (oEXTENSION): Use __glibc_reserved1 instead of __reserved. * sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym: Use mcontext_t instead of struct sigcontext. * sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/ia64/makecontext.c (__makecontext): Use mcontext_t instead of struct sigcontext. * sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym: Use mcontext_t instead of struct sigcontext. * sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): New macro. (struct __ia64_fpreg_mcontext): New type. (mcontext_t): Define structure contents rather than using struct sigcontext. (_SC_GR0_OFFSET): Use mcontext_t instead of struct sigcontext. (uc_sigmask): Define using __ctx. (uc_stack): Likewise. * sysdeps/unix/sysv/linux/ia64/sys/procfs.h: Include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: New file. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include <bits/sigcontext.h>. Include <bits/types.h>. * conform/Makefile (test-xfail-XPG42/signal.h/conform): Remove. (test-xfail-XPG42/sys/wait.h/conform): Likewise. (test-xfail-XPG42/ucontext.h/conform): Likewise. (test-xfail-UNIX98/signal.h/conform): Likewise. (test-xfail-UNIX98/sys/wait.h/conform): Likewise. (test-xfail-UNIX98/ucontext.h/conform): Likewise. (test-xfail-XOPEN2K/signal.h/conform): Likewise. (test-xfail-XOPEN2K/sys/wait.h/conform): Likewise. (test-xfail-XOPEN2K/ucontext.h/conform): Likewise. (test-xfail-POSIX2008/signal.h/conform): Likewise. (test-xfail-POSIX2008/sys/wait.h/conform): Likewise. (test-xfail-XOPEN2K8/signal.h/conform): Likewise. (test-xfail-XOPEN2K8/sys/wait.h/conform): Likewise.
* Remove cancellation support for syscall generationAdhemerval Zanella2017-08-241-140/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the cancellation mark from the auto-generation syscall script. Now all the cancellable syscalls are done throught C code using the SYSCALL_CANCEL macro. It simplifies the assembly required to each architecture port, since the SYSCALL_CANCEL uses the already defined INLINE_SYSCALL macros, and allows a more straigh fix on cancellation machanism (since no more specific assembly fixes will be required). Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.A Also with build-many-glibc.py with remaning touched architectures. * sysdeps/unix/make-syscalls.sh: Remove cancellable tagging for syscall definitions. * sysdeps/unix/syscall-template.S (SYSCALL_CANCELLABLE): Remove definition. * sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (__local_enable_asynccancel): Likewise. [IS_IN (libpthread)] (__local_disable_asynccancel): Likewise. [IS_IN (libc)] (__local_enable_asynccancel): Likewise. [IS_IN (libc)] (__local_enable_asynccancel): Likewise. [IS_IN (librt)] (__local_disable_asynccancel): Likewise. [IS_IN (librt)] (__local_disable_asynccancel): Likewise. (CENABLE): Likewise. (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/arm/sysdep-cancel.h (PSEUDO): Remove defintion. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/sysv/linux/powerpc/powerpc32/sysdep-cancel.h: Remove file. * sysdeps/sysv/linux/powerpc/powerpc64/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h: New file. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h: Remove file. * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h: New file. * sysdeps/unix/sysv/linux/tile/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* Allow abort PLT references in libc.so for SH.Joseph Myers2017-08-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | Given my patch <https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00965.html> for the ICEs building a glibc string function test for SH, the testsuite can build completely for SH with GCC 7 and mainline. However, there is a test failure that does not appear for GCC 6: check-localplt fails because of an abort PLT reference in libc.so. Given the lack of a trap insn pattern for SH, it seems unavoidable that the compiler might sometimes generate abort calls, and such abort calls (generated from __builtin_trap when there is no trap insn pattern) will be unaffected by the normal mapping to __GI_abort for calls within glibc. Thus, this patch allows (but does not require) an abort PLT reference in libc.so for SH. Tested for sh4-linux-gnu with build-many-glibcs.py (GCC 7, with my patch applied). * sysdeps/unix/sysv/linux/sh/localplt.data: Allow abort in libc.so.
* ld.so: Introduce struct dl_exceptionFlorian Weimer2017-08-101-0/+2
| | | | | | This commit separates allocating and raising exceptions. This simplifies catching and re-raising them because it is no longer necessary to make a temporary, on-stack copy of the exception message.
* Fix uc_* namespace (bug 21457).Joseph Myers2017-08-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The standard members of ucontext_t, in all standard versions with that type, are uc_link, uc_sigmask, uc_stack and uc_mcontext. The uc_* namespace is mostly reserved for additions to the structure. However, in XPG4.2, it's only reserved when <ucontext.h> is included, not when <signal.h> is included, while <signal.h> is required to define ucontext_t (but not allowed to make visible other symbols from <ucontext.h>). Thus, nonstandard members should avoid uc_* names. Some already do use __uc_*, but others don't; most architectures (all except ia64, I think) have a member uc_flags and some have additional members beyond that. This patch makes nonstandard members have an __ prefix unless __USE_MISC is defined. Members whose names indicate they are solely padding / reserved for future use are renamed unconditionally to use the __glibc_reserved1 naming convention. This is part of the preparation for a revised version of the mcontext_t / sigcontext patch to be able to eliminate all 13 of the miscellaneous XFAILs in conform/Makefile, rather than only 11 of them as at present (at least one further fix on top of this one will be needed for that as well). Tested for x86_64, and with build-many-glibcs.py. [BZ #21457] * sysdeps/arm/sys/ucontext.h (__ctx): Move undefine further down. (ucontext_t): Use __ctx with uc_flags. Rename uc_filler to __glibc_reserved1. * sysdeps/generic/sys/ucontext.h (__ctx): New macro. (ucontext_t): Use __ctx with uc_flags. * sysdeps/i386/sys/ucontext.h (__ctx): Move undefine further down. (__ctxt): Likewise. (ucontext_t): Use __ctx with uc_flags. Rename uc_filler to __glibc_reserved1. * sysdeps/m68k/sys/ucontext.h (__ctx): Move undefine further down. (ucontext_t): Use __ctx with uc_flags. Rename uc_filler to __glibc_reserved1. * sysdeps/mips/sys/ucontext.h (__ctx): Move undefine further down. (ucontext_t): Use __ctx with uc_flags. Rename uc_filler to __glibc_reserved1. * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (__ctx): New macro. (ucontext_t): Use __ctx with uc_flags. * sysdeps/unix/sysv/linux/alpha/sys/ucontext.h (__ctx): New macro. (ucontext_t): Use __ctx with uc_flags. * sysdeps/unix/sysv/linux/arm/sys/ucontext.h (__ctx): New macro. (ucontext_t): Use __ctx with uc_flags and uc_regspace. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h (__ctx): New macro. (ucontext_t): Use __ctx with uc_flags. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (__ctx): Move undefine further down. (ucontext_t): Use __ctx with uc_flags. Rename uc_filler to __glibc_reserved1. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h (__ctx): Move undefine further down. (ucontext_t): Use __ctx with uc_flags. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (__ctx): Move undefine further down. (ucontext_t): Use __ctx with uc_flags. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (ucontext_t): Use __ctx with uc_flags, uc_regs_ptr, uc_regs and uc_reg_space. Rename uc_pad to __glibc_reserved1. * sysdeps/unix/sysv/linux/s390/sys/ucontext.h (__ctx): Move undefine further down. (ucontext_t): Use __ctx with uc_flags. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h (__ctx): Move undefine further down. (ucontext_t): Use __ctx with uc_flags. * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (ucontext_t): Use __ctx with uc_flags. * sysdeps/unix/sysv/linux/tile/sys/ucontext.h (__ctx): New macro. (ucontext_t): Use __ctx with uc_flags. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h (ucontext_t): Use __ctx with uc_flags.
* Consolidate Linux fcntl implementationAdhemerval Zanella2017-06-301-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the fcntl Linux syscall generation on sysdeps/unix/sysv/linux/fcntl.c. It basically removes all the architecture specific implementations. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/arm/fcntl.c: Remove file. * sysdeps/unix/sysv/linux/generic/wordsize-32/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/hppa/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/i386/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/m68k/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/microblaze/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/sh/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/fcntl.c: New file. * sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c: Refactor to use default implementation.
* Rename struct ucontext tag (bug 21457).Joseph Myers2017-06-262-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ucontext_t type has a tag struct ucontext. As with previous such issues for siginfo_t and stack_t, this tag is not permitted by POSIX (is not in a reserved namespace), and so namespace conformance means breaking C++ name mangling for this type. In this case, the type does need to have some tag rather than just a typedef name, because it includes a pointer to itself. This patch uses struct ucontext_t as the new tag, so the type is mangled as ucontext_t (the POSIX *_t reservation applies in all namespaces, not just the namespace of ordinary identifiers). Another reserved name such as struct __ucontext could of course be used. Because of other namespace issues, this patch does not by itself fix bug 21457 or allow any XFAILs to be removed. Tested for x86_64, and with build-many-glibcs.py. [BZ #21457] * sysdeps/arm/sys/ucontext.h (struct ucontext): Rename to struct ucontext_t. * sysdeps/generic/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/i386/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/m68k/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/mips/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/alpha/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/arm/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/ia64/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/s390/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/tile/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/powerpc/powerpc32/backtrace.c (struct rt_signal_frame_32): Likewise. * sysdeps/powerpc/powerpc64/backtrace.c (struct signal_frame_64): Likewise. * sysdeps/unix/sysv/linux/aarch64/kernel_rt_sigframe.h (struct kernel_rt_sigframe): Likewise. * sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h (SIGCONTEXT): Likewise. * sysdeps/unix/sysv/linux/arm/register-dump.h (register_dump): Likewise. * sysdeps/unix/sysv/linux/arm/sigcontextinfo.h (SIGCONTEXT): Likewise. * sysdeps/unix/sysv/linux/hppa/profil-counter.h (__profil_counter): Likewise. * sysdeps/unix/sysv/linux/microblaze/sigcontextinfo.h (SIGCONTEXT): Likewise. * sysdeps/unix/sysv/linux/mips/kernel_rt_sigframe.h (struct kernel_rt_sigframe): Likewise. * sysdeps/unix/sysv/linux/nios2/kernel_rt_sigframe.h (struct kernel_rt_sigframe): Likewise. * sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h (SIGCONTEXT): Likewise. * sysdeps/unix/sysv/linux/sh/makecontext.S (__makecontext): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/makecontext.c (__start_context): Likewise. * sysdeps/unix/sysv/linux/tile/sigcontextinfo.h (SIGCONTEXT): Likewise. * sysdeps/unix/sysv/linux/x86_64/register-dump.h (register_dump): Likewise. * sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h (SIGCONTEXT): Likewise.
* Call exit directly in clone (BZ #21512)Adhemerval Zanella2017-06-261-19/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On aarch64, alpha, arm, hppa, mips, nios2, powerpc, sh, sparc, tile, and x86_64 the clone syscall jumps to _exit after the child execution and the function ends the process execution by calling exit_group. This behavior have a small issue where threads created with CLONE_THREAD using clone syscall directly will eventually exit the whole group altogether instead of just the thread created. Also, s390, microblaze, ia64, i386, and m68k differs by calling exit syscall directly. This patch changes all architectures to call the exit syscall directly, as for s390, microblaze, ia64, i386, and m68k. This do not have change glibc internal behavior in any sort, since the only usage of clone implementation in posix_spawn calls _exit directly in the created child (fork uses a direct call to clone). Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu, powerpc-linux-gnu, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. [BZ #21512] * sysdeps/unix/sysv/linux/aarch64/clone.S (__clone): Call exit syscall instead of jump to _exit. (CLONE_VM_BIT): Remove unused define. (CLONE_VM): Likewise. (CLONE_THREAD_BIT): Likewise. (CLONE_THREAD): Likewise. * sysdeps/unix/sysv/linux/alpha/clone.S (__clone): Likewise. (CLONE_VM): Remove unused define. * sysdeps/unix/sysv/linux/arm/clone.S (__clone): Likewise. (CLONE_VM): Remove unused define. (CLONE_THREAD): Likewise. * sysdeps/unix/sysv/linux/i386/clone.S (CLONE_VM): Likewise. * sysdeps/unix/sysv/linux/ia64/clone2.S (__clone2): Call exit syscall instead of jump to _exit. * sysdeps/unix/sysv/linux/hppa/clone.S (__clone): Likewise. * sysdeps/unix/sysv/linux/mips/clone.S (__clone): Likewise. (CLONE_VM): Remove unused define. (CLONE_THREAD): Likewise. * sysdeps/unix/sysv/linux/nios2/clone.S (__clone): Likewise. (CLONE_VM): Remove unused define. * sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S (__clone): Likewise. (CLONE_VM): Remove unused define. (CLONE_THREAD): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S (__clone): Likewise. (CLONE_VM): Remove unused define. (CLONE_THREAD): Likewise. * sysdeps/unix/sysv/linux/sh/clone.S (__clone): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/clone.S (__clone): Likewise. (CLONE_VM): Remove unused define. * sysdeps/unix/sysv/linux/sparc/sparc64/clone.S (__clone): Likewise. (CLONE_VM): Remove unused define. * sysdeps/unix/sysv/linux/tile/clone.S (__clone): Likewise. * sysdeps/unix/sysv/linux/x86_64/clone.S (__clone): Likewise. (CLONE_VM): Remove unused define. * sysdeps/unix/sysv/linux/Makefile (tests): Add tst-clone3. * sysdeps/unix/sysv/linux/tst-clone3.c: New file. Fix
* Optimize generic spinlock code and use C11 like atomic macros.Stefan Liebler2017-06-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix struct sigaltstack namespace (bug 21517).Joseph Myers2017-06-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix more namespace issues in sys/ucontext.h (bug 21457).Joseph Myers2017-06-011-17/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* posix: Implement preadv2 and pwritev2Adhemerval Zanella2017-05-311-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add reallocarray functionDennis Wölfing2017-05-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix sys/ucontext.h namespace from signal.h etc. inclusion (bug 21457).Joseph Myers2017-05-231-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove __need macros from signal.h.Zack Weinberg2017-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Split up bits/sigstack.h.Joseph Myers2017-05-191-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bits/sigstack.h contains four things: the legacy struct sigstack type, the preferred stack_t type, the SS_* enum values and macros for signal stack sizes. These vary in different ways between glibc configurations; in particular, the stack sizes vary much more than any of the other pieces. Furthermore, these pieces have different standard namespace rules for when they should be visible (not currently visible in conform/ results both because the relevant tests are XFAILed for sys/ucontext.h namespace issues, and because some of the expectations are incorrect in the same way as the headers, e.g. neither expectations nor headers reflect that current POSIX no longer has either the sigstack function or the sigstack structure). To reduce duplication of identical definitions, and facilitate namespace fixes without requiring the same feature test macro conditions to be repeated in many versions of the same header, this patch splits bits/sigstack.h up into four headers. It keeps the stack size macros, while new bits/types/struct_sigstack.h, bits/types/stack_t.h and bits/ss_flags.h are added for the other pieces. bits/types/struct_sigstack.h is the same everywhere, bits/types/stack_t.h has three variants different in the order of the structure elements (generic = MIPS Linux, and other Linux), and bits/ss_flags.h has generic and Linux variants. This patch includes the new headers everywhere that included <bits/sigstack.h>, so should cause no difference to what any public header defines. Subsequent namespace fixes would then remove or condition some of those includes. There should be no conflicts with Zack's changes to signal.h types, beyond the trivial conflict of both making additions to signal/Makefile's headers list; the two patches affect disjoint sets of types and other definitions. Tested for x86_64 and x86, and with build-many-glibcs.py. * bits/ss_flags.h: New file. * bits/types/stack_t.h: Likewise. * include/bits/types/struct_sigstack.h: Likewise. * signal/bits/types/struct_sigstack.h: Likewise. * sysdeps/unix/sysv/linux/bits/ss_flags.h: Likewise. * sysdeps/unix/sysv/linux/bits/types/stack_t.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h: Likewise. * signal/Makefile (headers): Add bits/types/struct_sigstack.h, bits/types/stack_t.h and bits/ss_flags.h. * signal/signal.h [__USE_XOPEN_EXTENDED || __USE_XOPEN2K8]: Include <bits/types/struct_sigstack.h>, <bits/types/stack_t.h> and <bits/ss_flags.h>. * bits/sigstack.h (struct sigstack): Remove. (stack_t): Likewise. (SS_ONSTACK): Likewise. (SS_DISABLE): Likewise. * sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h (struct sigstack): Likewise. (stack_t): Likewise. (SS_ONSTACK): Likewise. (SS_DISABLE): Likewise. * sysdeps/unix/sysv/linux/alpha/bits/sigstack.h (struct sigstack): Likewise. (stack_t): Likewise. (SS_ONSTACK): Likewise. (SS_DISABLE): Likewise. * sysdeps/unix/sysv/linux/bits/sigstack.h (struct sigstack): Likewise. (stack_t): Likewise. (SS_ONSTACK): Likewise. (SS_DISABLE): Likewise. * sysdeps/unix/sysv/linux/mips/bits/sigstack.h: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/sigstack.h (struct sigstack): Likewise. (stack_t): Likewise. (SS_ONSTACK): Likewise. (SS_DISABLE): Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h (struct sigstack): Likewise. (stack_t): Likewise. (SS_ONSTACK): Likewise. (SS_DISABLE): Likewise. * sysdeps/unix/sysv/linux/sparc/bits/sigstack.h (struct sigstack): Likewise. (stack_t): Likewise. (SS_ONSTACK): Likewise. (SS_DISABLE): Likewise. * sysdeps/arm/sys/ucontext.h: Include <bits/types/struct_sigstack.h>, <bits/types/stack_t.h> and <bits/ss_flags.h>. * sysdeps/generic/sys/ucontext.h: Likewise. * sysdeps/i386/sys/ucontext.h: Likewise. * sysdeps/m68k/sys/ucontext.h: Likewise. * sysdeps/mips/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h: Likewise. * sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Likewise.
* posix: Consolidate Linux waitpid syscallAdhemerval Zanella2017-05-181-2/+0
| | | | | | | | | | | | | | | | | | This patch consolidates the waitpid Linux syscall generation on sysdeps/unix/sysv/linux/waitpid.c. It basically removes it from architecture auto-generation list and also remove arch specific implementations. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/sh/syscalls.list: Remove waitpid from auto-generated list. * sysdeps/unix/sysv/linux/m68k/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/syscalls.list: Remove file. * sysdeps/unix/sysv/linux/tile/waitpid.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/syscalls.list: Likewise.
* Condition some sys/ucontext.h contents on __USE_MISC (bug 21457).Joseph Myers2017-05-111-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the fixes for namespace issues arising from sys/ucontext.h, this patch conditions various definitions, that are not needed for defining mcontext_t / ucontext_t, on __USE_MISC, so they do not appear in strict POSIX modes. This patch is non-exhaustive; that is, it only conditions straightforward cases and there may be more such definitions that can be conditioned for these and other architectures, to be dealt with later in separate patches. Also, using __USE_MISC is the minimum change for these definitions where they conflict with POSIX; some headers already have __USE_GNU conditionals on similar definitions of names for registers. The patch specifically does not do anything with definitions in bits/sigcontext.h, and nor does it condition any inclusions of bits/sigcontext.h even where in fact that is not needed on some architectures for the definitions of mcontext_t / ucontext_t. As other namespace issues in these headers remain, this patch does not fix bug 21457, nor allow any XFAILs to be removed. Tested with build-many-glibcs.py. [BZ #21457] * sysdeps/arm/sys/ucontext.h (R0): Condition on [__USE_MISC]. (R1): Likewise. (R2): Likewise. (R3): Likewise. (R4): Likewise. (R5): Likewise. (R6): Likewise. (R7): Likewise. (R8): Likewise. (R9): Likewise. (R10): Likewise. (R11): Likewise. (R12): Likewise. (R13): Likewise. (R14): Likewise. (R15): Likewise. * sysdeps/i386/sys/ucontext.h (REG_GS): Likewise. (REG_FS): Likewise. (REG_ES): Likewise. (REG_DS): Likewise. (REG_EDI): Likewise. (REG_ESI): Likewise. (REG_EBP): Likewise. (REG_ESP): Likewise. (REG_EBX): Likewise. (REG_EDX): Likewise. (REG_ECX): Likewise. (REG_EAX): Likewise. (REG_TRAPNO): Likewise. (REG_ERR): Likewise. (REG_EIP): Likewise. (REG_CS): Likewise. (REG_EFL): Likewise. (REG_UESP): Likewise. (REG_SS): Likewise. * sysdeps/m68k/sys/ucontext.h (R_D0): Likewise. (R_D1): Likewise. (R_D2): Likewise. (R_D3): Likewise. (R_D4): Likewise. (R_D5): Likewise. (R_D6): Likewise. (R_D7): Likewise. (R_A0): Likewise. (R_A1): Likewise. (R_A2): Likewise. (R_A3): Likewise. (R_A4): Likewise. (R_A5): Likewise. (R_A6): Likewise. (R_A7): Likewise. (R_SP): Likewise. (R_PC): Likewise. (R_PS): Likewise. (fpregset_t): Likewise. (MCONTEXT_VERSION): Likewise. * sysdeps/mips/sys/ucontext.h (CTX_R0): Likewise. (CTX_AT): Likewise. (CTX_V0): Likewise. (CTX_V1): Likewise. (CTX_A0): Likewise. (CTX_A1): Likewise. (CTX_A2): Likewise. (CTX_A3): Likewise. (CTX_T0): Likewise. (CTX_T1): Likewise. (CTX_T2): Likewise. (CTX_T3): Likewise. (CTX_T4): Likewise. (CTX_T5): Likewise. (CTX_T6): Likewise. (CTX_T7): Likewise. (CTX_S0): Likewise. (CTX_S1): Likewise. (CTX_S2): Likewise. (CTX_S3): Likewise. (CTX_S4): Likewise. (CTX_S5): Likewise. (CTX_S6): Likewise. (CTX_S7): Likewise. (CTX_T8): Likewise. (CTX_T9): Likewise. (CTX_K0): Likewise. (CTX_K1): Likewise. (CTX_GP): Likewise. (CTX_SP): Likewise. (CTX_S8): Likewise. (CTX_RA): Likewise. (CTX_MDLO): Likewise. (CTX_MDHI): Likewise. (CTX_CAUSE): Likewise. (CTX_EPC): Likewise. * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Condition inclusion of <sys/procfs.h> on [__USE_MISC]. (greg_t): Condition on [__USE_MISC]. (gregset_t): Likewise. (fpregset_t): Likewise. * sysdeps/unix/sysv/linux/arm/sys/ucontext.h (greg_t): Likewise. (NGREG): Likewise. (gregset_t): Likewise. (REG_R0): Likewise. (REG_R1): Likewise. (REG_R2): Likewise. (REG_R3): Likewise. (REG_R4): Likewise. (REG_R5): Likewise. (REG_R6): Likewise. (REG_R7): Likewise. (REG_R8): Likewise. (REG_R9): Likewise. (REG_R10): Likewise. (REG_R11): Likewise. (REG_R12): Likewise. (REG_R13): Likewise. (REG_R14): Likewise. (REG_R15): Likewise. (struct _libc_fpstate): Likewise. (fpregset_t): Likewise. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h (NGREG): Likewise. (NFPREG): Likewise. (gregset_t): Likewise. (fpregset_t): Likewise. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (R_D0): Likewise. (R_D1): Likewise. (R_D2): Likewise. (R_D3): Likewise. (R_D4): Likewise. (R_D5): Likewise. (R_D6): Likewise. (R_D7): Likewise. (R_A0): Likewise. (R_A1): Likewise. (R_A2): Likewise. (R_A3): Likewise. (R_A4): Likewise. (R_A5): Likewise. (R_A6): Likewise. (R_A7): Likewise. (R_SP): Likewise. (R_PC): Likewise. (R_PS): Likewise. (fpregset_t): Likewise. (MCONTEXT_VERSION): Likewise. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (MCONTEXT_VERSION): Likewise. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h (REG_R0): Likewise. (REG_R1): Likewise. (REG_R2): Likewise. (REG_R3): Likewise. (REG_R4): Likewise. (REG_R5): Likewise. (REG_R6): Likewise. (REG_R7): Likewise. (REG_R8): Likewise. (REG_R9): Likewise. (REG_R10): Likewise. (REG_R11): Likewise. (REG_R12): Likewise. (REG_R13): Likewise. (REG_R14): Likewise. (REG_R15): Likewise. * sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Condition inclusion of <arch/abi.h> on [__USE_MISC]. (greg_t): Condition on [__USE_MISC]. (NGREG): Likewise. (gregset_t): Likewise.
* Simplify accept4, recvmmsg, sendmmsg code.Joseph Myers2017-05-091-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The accept4, recvmmsg and sendmmsg functions had macros __ASSUME_*_SYSCALL_WITH_SOCKETCALL. Before we could assume kernels with the relevant functionality, these macros represented the conditions under which, on a socketcall architecture, glibc could just call the syscall unconditionally and not have to deal with socketcall at all for those functions, because if the syscall didn't work for them the socketcall call wouldn't either. Now we can assume kernels with the relevant functionality, the only question is whether we can assume the syscall is present; if not, we are on a socketcall architecture and just use socketcall instead. Thus, this patch removes the macros that are no longer necessary, and simplifies the code for accept4, recvmmsg and sendmmsg to use the same logic as the other C implementations of socket functions that may use a syscall or socketcall depending on kernel support. Tested for x86_64 and x86. * sysdeps/unix/sysv/linux/accept4.c (accept4): Use syscall if [__ASSUME_ACCEPT4_SYSCALL], otherwise socketcall. * sysdeps/unix/sysv/linux/recvmmsg.c (recvmmsg): Use syscall if [__ASSUME_RECVMMSG_SYSCALL], otherwise socketcall. * sysdeps/unix/sysv/linux/sendmmsg.c (__sendmmsg): Use syscall if [__ASSUME_SENDMMSG_SYSCALL], otherwise socketcall. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_ACCEPT4_SYSCALL): Move to general list of macros for socket syscalls. (__ASSUME_RECVMMSG_SYSCALL): Likewise. (__ASSUME_SENDMMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL): Remove. (__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL): Remove. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_ACCEPT4_SYSCALL_WITH_SOCKETCALL): Likewise. (__ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL): Likewise. (__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL): Likewise.
* Consolidate set* Linux implementationAdhemerval Zanella2017-03-289-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the Linux setegid, seteuid, setgid, setgroups, setregid, setresgid, setresuid, setreuid, and setuid implementation on default sysdeps/unix/sysv/linux/set*.c implementation. It basically removes all the architecture define implementations and add support for __NR_set*32 syscall on Linux default implementation. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/arm/setegid.c: Remove file. * sysdeps/unix/sysv/linux/arm/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setgid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/arm/setregid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setegid.c: Likewise. * sysdeps/unix/sysv/linux/i386/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setgid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/i386/setregid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setegid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setgid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setregid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setuid.c: Likewise. * sysdeps/unix/sysv/linux/microblaze/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setegid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setgid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setregid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setegid.c: Likewise. * sysdeps/unix/sysv/linux/sh/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setgid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/sh/setregid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setgid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setregid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setuid.c: Likewise. * sysdeps/unix/sysv/linux/setegid.c (setegid): Use INLINE_SYSCALL_ERROR_RETURN_VALUE. * sysdeps/unix/sysv/linux/seteuid.c (seteuid): Likewise. * sysdeps/unix/sysv/linux/setgid.c (setgid): Use __NR_setgid32 if defined. * sysdeps/unix/sysv/linux/setgroups.c (setgroups): Use __NR_setgroups32 if defined. * sysdeps/unix/sysv/linux/setregid.c (__setregid): Use __NR_setregid32 if defined. * sysdeps/unix/sysv/linux/setresgid.c (__setresgid): Use __NR_setresgid32 is defined. * sysdeps/unix/sysv/linux/setresuid.c (__setresuid): Use __NR_setresuid32 if defined. * sysdeps/unix/sysv/linux/setreuid.c (__setreuid): Use __NR_setreuid32 if defined. * sysdeps/unix/sysv/linux/setuid.c (__setuid): Use __NR_setuid32 if defined.
* Consolidate Linux sendto implementationAdhemerval Zanella2017-03-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the sendto Linux syscall implementation on sysdeps/unix/sysv/linux/sendto.c. The changes are: 1. Define __ASSUME_SENDTO_SYSCALL by default. 2. Undef it for architectures that do not support __NR_sendto. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove sendto from auto-generation list. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Define by default. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Undef it is kernel does not support __NR_sendto. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Remove definition. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h: (__ASSUME_SENDTO_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sendto.c: Simplify includes.
* Consolidate Linux recvfrom implementationAdhemerval Zanella2017-03-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the recvfrom Linux syscall implementation on sysdeps/unix/sysv/linux/recvfrom.c. The changes are: 1. Define __ASSUME_RECVFROM_SYSCALL by default 2. Undef it for architectures that do not support __NR_recvfrom. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove recvfrom from auto-generation list. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Define by default. (__ASSUME_RECVFROM_SYSCALL): Undef it if kernel does not support __NR_recvfrom. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Remove definition. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/recvfrom.c: Simplify includes.
* Consolidate Linux accept implementationAdhemerval Zanella2017-03-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the accept Linux syscall implementation on sysdeps/unix/sysv/linux/accept.c. The changes are: 1. Remove accept from auto-generation syscalls.list on the architecture that uses __NR_accept. 2. Define __NR_accept as default (__ASSUME_ACCEPT_SYSCALL) and undef for architectures that do not support it. 3. Remove __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL and decide to use __NR_accept4 for accept generation based on __ASSUME_ACCEPT4_SYSCALL. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/accept.c (__libc_accept): Replace __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL by __ASSUME_ACCEPT4_SYSCALL. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove accept from auto-generation list. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define. (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): New define. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define. (__ASSUME_ACCEPT_SYSCALL): Define wheter kernel version supports. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Define. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define. (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Undefine for 32 bits.
* Bug 21053: sh: Reduce namespace pollution from sys/ucontext.hJames Clarke2017-01-243-68/+66
| | | | | | | | | | | | | | | | | | | | | | | The problem is basically that sys/ucontext.h is defining R0..R15 which happens to conflict with some packages like Firefox when trying to build on SH. The very same problem existed on arm back then [1] and it was fixed by renaming R0..R15 to REG_R0..REG_R15. This patch imploy a similar strategy for SH. Checked on sh4-linux-gnu with run-built-tests=no and I also got reports that it fixes Firefox build on Debian sh4. * sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym: Use new REG_R* constants instead of the old R* ones. * sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym: Likewise. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h (NGPREG): Rename... (NGREG): ... to this, to fit in with other architectures. (gpregset_t): Use new NGREG macro. [__USE_GNU]: Remove condition; all architectures other than tile are unconditional. (R*): Rename to REG_R*.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-0131-31/+31
|
* Add fromfp functions.Joseph Myers2016-12-311-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines fromfp functions (fromfp, fromfpx, ufromfp, ufromfpx, and float and long double variants) to convert from floating-point to an integer type with any signedness and any given width up to that of intmax_t, in any of the five IEEE rounding modes (the usual four for binary floating point, plus rounding to nearest with ties rounding away from zero), with control of whether in-range non-integer values should result in the "inexact" exception being raised. This patch implements these functions for glibc. These implementations are (apart from raising exceptions) pure integer implementations; it's entirely possible optimized versions could be devised for some architectures. A common math/fromfp.h header provides various common helper code that can readily be shared between the implementations for different types. For each type, the bulk of the implementation is also shared between the four functions, with wrappers that define UNSIGNED and INEXACT macros appropriately before including the main implementation. As the functions return intmax_t and uintmax_t without math.h being allowed to expose those typedef names, they are declared using __intmax_t and __uintmax_t as obtained from <bits/types.h>. The FP_INT_* rounding direction macros are defined as ascending integers in the order the names are listed in the TS; I see no significant value in allowing architectures to vary the values of them. The libm-test machinery is duly adapted to handle unsigned int arguments, and intmax_t and uintmax_t results. Because each test input is generally tested for four functions, five rounding modes and several different widths, the libm-test.inc additions are very large. Thus, the diffs in the body of this message exclude the libm-test.inc changes, with the full patch being attached gzipped. The bulk of the new tests were generated (expanded from a test input plus rounding results and information about where it lies in the relevant interval between integers, to libm-test tests for all relevant combinations of function, rounding direction and width) by a script that's included in the patch as math/gen-fromfp-tests.py (input data math/gen-fromfp-tests-inputs); as an ad hoc script that's not really expected to be rerun, it's not very polished, but it's at least plausibly useful for adding any further tests for these functions in future. I may split the libm-test tests up by function in future (so both libm-test.inc and auto-libm-test-out are split into separate files, and the tests for each function are also built and run separately), but not for 2.25. For no obvious reason, adding tgmath tests for the new functions resulted in -Wuninitialized errors from test-tgmath.c about the variable i being used uninitialized. Those errors were correct - the variable is read by the frexp version in test-tgmath.c (where real frexp would write through that pointer instead of reading it) - but I don't know why this patch would result in the pre-existing issue being newly detected. The patch initializes the variable to avoid those errors. With these changes, glibc 2.25 should have all the library features from TS 18661-1 other than the functions that round result to narrower type (and constant rounding directions, but I'm considering those mainly a compiler feature not a library one). Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfp): New declaration. [__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfpx): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfp): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfpx): Likewise. * math/tgmath.h (__TGMATH_TERNARY_FIRST_REAL_RET_ONLY): New macro. [__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfp): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfp): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfpx): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfpx): Likewise. * math/math.h: Include <bits/types.h>. [__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_INT_UPWARD): New enum constant and macro. (FP_INT_DOWNWARD): Likewise. (FP_INT_TOWARDZERO): Likewise. (FP_INT_TONEARESTFROMZERO): Likewise. (FP_INT_TONEAREST): Likewise. * math/Versions (fromfp): New libm symbol at version GLIBC_2.25. (fromfpf): Likewise. (fromfpl): Likewise. (ufromfp): Likewise. (ufromfpf): Likewise. (ufromfpl): Likewise. (fromfpx): Likewise. (fromfpxf): Likewise. (fromfpxl): Likewise. (ufromfpx): Likewise. (ufromfpxf): Likewise. (ufromfpxl): Likewise. * math/Makefile (libm-calls): Add s_fromfpF, s_ufromfpF, s_fromfpxF and s_ufromfpxF. * math/gen-fromfp-tests.py: New file. * math/gen-fromfp-tests-inputs: Likewise. * math/libm-test.inc: Include <stdint.h> (check_intmax_t): New function. (check_uintmax_t): Likewise. (struct test_fiu_M_data): New type. (struct test_fiu_U_data): Likewise. (RUN_TEST_fiu_M): New macro. (RUN_TEST_LOOP_fiu_M): Likewise. (RUN_TEST_fiu_U): Likewise. (RUN_TEST_LOOP_fiu_U): Likewise. (fromfp_test_data): New array. (fromfp_test): New function. (fromfpx_test_data): New array. (fromfpx_test): New function. (ufromfp_test_data): New array. (ufromfp_test): New function. (ufromfpx_test_data): New array. (ufromfpx_test): New function. (main): Call fromfp_test, fromfpx_test, ufromfp_test and ufromfpx_test. * math/gen-libm-test.pl (parse_args): Handle u, M and U descriptor characters. * math/test-tgmath-ret.c: Include <stdint.h>. (rm): New variable. (width): Likewise. (CHECK_RET_CONST_TYPE): Take extra arguments and pass them to called function. (CHECK_RET_CONST_FLOAT): Take extra arguments and pass them to CHECK_RET_CONST_TYPE. (CHECK_RET_CONST_DOUBLE): Likewise. (CHECK_RET_CONST_LDOUBLE): Likewise. (CHECK_RET_CONST): Take extra arguments and pass them to calls macros. (fromfp): New CHECK_RET_CONST call. (ufromfp): Likewise. (fromfpx): Likewise. (ufromfpx): Likewise. (do_test): Call check_return_fromfp, check_return_ufromfp, check_return_fromfpx and check_return_ufromfpx. * math/test-tgmath.c: Include <stdint.h> (NCALLS): Increase to 138. (F(compile_test)): Initialize i. Call fromfp functions. (F(fromfp)): New function. (F(fromfpx)): Likewise. (F(ufromfp)): Likewise. (F(ufromfpx)): Likewise. * manual/arith.texi (Rounding Functions): Document FP_INT_UPWARD, FP_INT_DOWNWARD, FP_INT_TOWARDZERO, FP_INT_TONEARESTFROMZERO, FP_INT_TONEAREST, fromfp, fromfpf, fromfpl, ufromfp, ufromfpf, ufromfpl, fromfpx, fromfpxf, fromfpxl, ufromfpx, ufromfpxf and ufromfpxl. * manual/libm-err-tab.pl (@all_functions): Add fromfp, fromfpx, ufromfp and ufromfpx. * math/fromfp.h: New file. * sysdeps/ieee754/dbl-64/s_fromfp.c: Likewise. * sysdeps/ieee754/dbl-64/s_fromfp_main.c: Likewise. * sysdeps/ieee754/dbl-64/s_fromfpx.c: Likewise. * sysdeps/ieee754/dbl-64/s_ufromfp.c: Likewise. * sysdeps/ieee754/dbl-64/s_ufromfpx.c: Likewise. * sysdeps/ieee754/flt-32/s_fromfpf.c: Likewise. * sysdeps/ieee754/flt-32/s_fromfpf_main.c: Likewise. * sysdeps/ieee754/flt-32/s_fromfpxf.c: Likewise. * sysdeps/ieee754/flt-32/s_ufromfpf.c: Likewise. * sysdeps/ieee754/flt-32/s_ufromfpxf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fromfpl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fromfpl_main.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_ufromfpl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_ufromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fromfpl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fromfpl_main.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_ufromfpl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_ufromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fromfpl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fromfpl_main.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_ufromfpl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_ufromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fromfp, ufromfp, fromfpx and ufromfpx. (CFLAGS-nldbl-fromfp.c): New variable. (CFLAGS-nldbl-fromfpx.c): Likewise. (CFLAGS-nldbl-ufromfp.c): Likewise. (CFLAGS-nldbl-ufromfpx.c): Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-compat.h: Include <stdint.h>. * sysdeps/ieee754/ldbl-opt/nldbl-fromfp.c: New file. * sysdeps/ieee754/ldbl-opt/nldbl-fromfpx.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-ufromfp.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-ufromfpx.c: Likewise. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Add __ASSUME_DIRECT_SYSVIPC_SYSCALL for LinuxAdhemerval Zanella2016-12-281-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On current minimum supported kernels, the SysV IPC on Linux is provided by either the ipc syscalls or correspondent wire syscalls. Also, for architectures that supports wire syscalls all syscalls are supported in a set (msgct, msgrcv, msgsnd, msgget, semctl, semget, semop, semtimedop, shmctl, shmat, shmget, shmdt). The architectures that only supports ipc syscall are: - i386, m68k, microblaze, mips32, powerpc (powerpc32, powerpc64, and powerpc64le), s390 (32 and 64 bits), sh, sparc32, and sparc64. And the architectures that only supports wired syscalls are: - aarch64, alpha, hppa, ia64, mips64, mips64n32, nios2, tile (tilepro, tilegx, and tilegx64), and x86_64 Also arm is the only one that supports both wire syscalls and the ipc, although the ipc one is deprecated. This patch adds a new define, __ASSUME_DIRECT_SYSVIPC_SYSCALL, that wired syscalls are supported on the system and the general idea is to use it where possible. I also checked the syscall table for all architectures on Linux 4.9 and there is no change on described support for Linux 2.6.32/3.2. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_DIRECT_SYSVIPC_SYSCALL): New define. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_DIRECT_SYSVIPC_SYSCALL): Undef. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/kernel-features.h (__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise.
* Add roundeven, roundevenf, roundevenl.Joseph Myers2016-12-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines roundeven functions that round a floating-point number to the nearest integer, in that floating-point type, with ties rounding to even (whereas the round functions round ties away from zero). As with other such functions, they raise no exceptions apart from "invalid" for signaling NaNs. There was a previous user request for this functionality in glibc in <https://sourceware.org/ml/libc-help/2015-02/msg00005.html>. This patch implements these functions for glibc. The implementations use integer bit-manipulation (or roundeven on the high and low parts, in the IBM long double case). It's possible that there may be faster approaches on some architectures (in particular, on AArch64 the frintn instruction should do exactly what's required); I'll leave it to architecture maintainers or others interested to implement such architecture-specific versions if desired. (Where architectures have instructions to round to nearest integer in the current rounding mode, implementations saving and restoring the rounding mode - and dealing with exceptions if those instructions generate "inexact" - are also possible, though their performance depends on the cost of manipulating exceptions / rounding mode state.) Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (roundeven): New declaration. * math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (roundeven): New macro. * math/Versions (roundeven): New libm symbol at version GLIBC_2.25. (roundevenf): Likewise. (roundevenl): Likewise. * math/Makefile (libm-calls): Add s_roundevenF. * math/libm-test.inc (roundeven_test_data): New array. (roundeven_test): New function. (main): Call roundeven_test. * math/test-tgmath.c (NCALLS): Increase to 134. (F(compile_test)): Call roundeven. (F(roundeven)): New function. * manual/arith.texi (Rounding Functions): Document roundeven, roundevenf and roundevenl. * manual/libm-err-tab.pl (@all_functions): Add roundeven. * include/math.h (roundeven): Use libm_hidden_proto. * sysdeps/ieee754/dbl-64/s_roundeven.c: New file. * sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c: Likewise. * sysdeps/ieee754/flt-32/s_roundevenf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_roundevenl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_roundevenl.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add roundeven. (CFLAGS-nldbl-roundeven.c): New variable. * sysdeps/ieee754/ldbl-opt/nldbl-roundeven.c: New file. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Add fmaxmag, fminmag functions.Joseph Myers2016-12-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines fmaxmag and fminmag functions that return the argument with maximum / minimum magnitude (acting like fmax / fmin if the arguments have the same magnitude or either argument is a NaN). These correspond to the IEEE 754-2008 operations maxNumMag and minNumMag. This patch implements these functions for glibc. They are implemented with type-generic templates. Tests are based on those for fmax and fmin. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fmaxmag): New declaration. (fminmag): Likewise. * math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fmaxmag): New macro. [__GLIBC_USE (IEC_60559_BFP_EXT)] (fminmag): Likewise. * math/Versions (fmaxmag): New libm symbol at version GLIBC_2.25. (fmaxmagf): Likewise. (fmaxmagl): Likewise. (fminmag): Likewise. (fminmagf): Likewise. (fminmagl): Likewise. * math/Makefile (gen-libm-calls): Add s_fmaxmagF and s_fminmagF. * math/s_fmaxmag_template.c: New file. * math/s_fminmag_template.c: Likewise. * math/libm-test.inc (fmaxmag_test_data): New array. (fmaxmag_test): New function. (fminmag_test_data): New array. (fminmag_test): New function. (main): Call fmaxmag_test and fminmag_test. * math/test-tgmath.c (NCALLS): Increase to 132. (F(compile_test)): Call fmaxmag and fminmag. (F(fminmag)): New function. (F(fmaxmag)): Likewise. * manual/arith.texi (Misc FP Arithmetic): Document fminmag, fminmagf, fminmagl, fmaxmag, fmaxmagf and fmaxmagl. * manual/libm-err-tab.pl (@all_functions): Add fmaxmag and fminmag. * sysdeps/ieee754/ldbl-opt/nldbl-fmaxmag.c: New file. * sysdeps/ieee754/ldbl-opt/nldbl-fminmag.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_fminmagl.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fmaxmag and fminmag. (CFLAGS-nldbl-fmaxmag.c): New variable. (CFLAGS-nldbl-fminmag.c): Likewise. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* New string function explicit_bzero (from OpenBSD).Zack Weinberg2016-12-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | explicit_bzero(s, n) is the same as memset(s, 0, n), except that the compiler is not allowed to delete a call to explicit_bzero even if the memory pointed to by 's' is dead after the call. Right now, this effect is achieved externally by having explicit_bzero be a function whose semantics are unknown to the compiler, and internally, with a no-op asm statement that clobbers memory. This does mean that small explicit_bzero operations cannot be expanded inline as small memset operations can, but on the other hand, small memset operations do get deleted by the compiler. Hopefully full compiler support for explicit_bzero will happen relatively soon. There are two new tests: test-explicit_bzero.c verifies the visible semantics in the same way as the existing test-bzero.c, and tst-xbzero-opt.c verifies the not-being-optimized-out property. The latter is conceptually based on a test written by Matthew Dempsky for the OpenBSD regression suite. The crypt() implementation has an immediate use for this new feature. We avoid having to add a GLIBC_PRIVATE alias for explicit_bzero by running all of libcrypt's calls through the fortified variant, __explicit_bzero_chk, which is in the impl namespace anyway. Currently I'm not aware of anything in libc proper that needs this, but the glue is all in place if it does become necessary. The legacy DES implementation wasn't bothering to clear its buffers, so I added that, mostly for consistency's sake. * string/explicit_bzero.c: New routine. * string/test-explicit_bzero.c, string/tst-xbzero-opt.c: New tests. * string/Makefile (routines, strop-tests, tests): Add them. * string/test-memset.c: Add ifdeffage for testing explicit_bzero. * string/string.h [__USE_MISC]: Declare explicit_bzero. * debug/explicit_bzero_chk.c: New routine. * debug/Makefile (routines): Add it. * debug/tst-chk1.c: Test fortification of explicit_bzero. * string/bits/string3.h: Fortify explicit_bzero. * manual/string.texi: Document explicit_bzero. * NEWS: Mention addition of explicit_bzero. * crypt/crypt-entry.c (__crypt_r): Clear key-dependent intermediate data before returning, using explicit_bzero. * crypt/md5-crypt.c (__md5_crypt_r): Likewise. * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise. * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise. * include/string.h: Redirect internal uses of explicit_bzero to __explicit_bzero_chk[_internal]. * string/Versions [GLIBC_2.25]: Add explicit_bzero. * debug/Versions [GLIBC_2.25]: Add __explicit_bzero_chk. * sysdeps/arm/nacl/libc.abilist * sysdeps/unix/sysv/linux/aarch64/libc.abilist * sysdeps/unix/sysv/linux/alpha/libc.abilist * sysdeps/unix/sysv/linux/arm/libc.abilist * sysdeps/unix/sysv/linux/hppa/libc.abilist * sysdeps/unix/sysv/linux/i386/libc.abilist * sysdeps/unix/sysv/linux/ia64/libc.abilist * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist * sysdeps/unix/sysv/linux/microblaze/libc.abilist * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist * sysdeps/unix/sysv/linux/nios2/libc.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist * sysdeps/unix/sysv/linux/sh/libc.abilist * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Add entries for explicit_bzero and __explicit_bzero_chk.