summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv
Commit message (Collapse)AuthorAgeFilesLines
* microblaze: Resolve non-relocatable branch in pt-vfork.S (BZ#21779)Nathan Rossi2017-07-281-1/+1
| | | | | | | | | | | | | | | | | The relative branch directly to __libc_vfork results in an relocation that cannot be resolved. Specifically a R_MICROBLAZE_64_PCREL relocation is created for this branch, however for MicroBlaze R_MICROBLAZE_64_PCREL type relocations symbols are not resolved. Additionally due to the branch being located in the .text section the instruction cannot be rewritten as the section is not writable, and causes a segfault at runtime when loading libpthread. To resolve this issue, ensure the branch is done using PLT. This removes the need to modify the instruction and trades the R_MICROBLAZE_64_PCREL for a more common R_MICROBLAZE_JUMP via the PLT. [BZ #21779] * sysdeps/unix/sysv/linux/microblaze/pt-vfork.S: Branch using PLT.
* tunables: Use direct syscall for access (BZ#21744)Adhemerval Zanella2017-07-242-15/+35
| | | | | | | | | | | | | | | | | | | | | | | The function maybe_enable_malloc_check, which is called by __tunables_init, calls __access_noerrno. It isn't problem when symbol is is in ld.so, which has a special version of __access_noerrno without stack protector. But when glibc is built with stack protector, maybe_enable_malloc_check in libc.a can't call the regular version of __access_noerrno with stack protector. This patch changes how Linux defines the __access_noerrno to be an inline call instead and thus preventing defining different build rules for ld/static and shared. H.J. Lu <hongjiu.lu@intel.com> Adhemerval Zanella <adhemerval.zanella@linaro.org> [BZ #21744] * elf/dl-tunables.c: Include not-errno.h header. * include/unistd.h (__access_noerrno): Remove definition. * sysdeps/unix/sysv/linux/access.c (__access_noerrno): Likewise. * sysdeps/generic/not-errno.h: New file. * sysdeps/unix/sysv/linux/not-errno.h: Likewise.
* S390: fix sys/ptrace.h to make it includible again after asm/ptrace.hDmitry V. Levin2017-07-231-16/+52
| | | | | | | | | | | | | sys/ptrace.h on S390 used to be includible both before and after asm/ptrace.h, until commit b08a6a0dea63742313ed3d9577c1e2d83436b196 among other changes introduced PTRACE_SINGLEBLOCK enum constant which is also defined in asm/ptrace.h as a macro, making sys/ptrace.h fail to compile when included after asm/ptrace.h. * sysdeps/unix/sysv/linux/s390/sys/ptrace.h [_LINUX_PTRACE_H || _S390_PTRACE_H]: Undefine all PTRACE_* macro constants defined later as enum constants, except PTRACE_PEEKUSER, PTRACE_POKEUSER, and PTRACE_SEIZE_DEVEL that are not defined by Linux headers.
* alpha: Fix clone exit syscall argument passing (BZ#21512)Adhemerval Zanella2017-07-191-0/+1
| | | | | | | | | | | | This patch fixes the argument passing for exit syscall after the clone function returns on hppa. This fixes misc/tst-clone2 on alpha-linux-gnu. Checked misc/tst-clone2 on alpha-linux-gnu. [BZ #21512] * sysdeps/unix/sysv/linux/alpha/clone.S (__clone): Fix argument passing to syscall exit.
* [AArch64] Update dl-procinfo for new HWCAP flags in Linux 4.12Szabolcs Nagy2017-07-192-4/+6
| | | | | | | | | Follow up to commit 512d245bc30cca893db6979f42f058e734f345c3. * sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c: (_dl_aarch64_cap_flags): Update. * sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h (_DL_HWCAP_COUNT, _DL_HWCAP_LAST): Update.
* [AArch64] Fix out of bound array access regressionSzabolcs Nagy2017-07-181-30/+8
| | | | | | Partially revert ea01a4da219011f4a4db97eef3c5bfc2f6e8fc6b "aarch64: Add hwcap string routines" because _dl_procinfo cannot be future proof and avoid oob access in _dl_hwcap_string.
* powerpc: Fix float128 IFUNC relocations [BZ #21707]Tulio Magno Quites Machado Filho2017-07-171-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch proposed by Peter Bergner [1] to libgcc in order to fix [BZ #21707] adds a dependency on a symbol provided by the loader, forcing the loader to be linked to tests after libgcc was linked. It also requires to read the thread pointer during IRELA relocations. Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64. [1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html [BZ #21707] * csu/libc-start.c (LIBC_START_MAIN): Perform IREL{,A} relocations before or after initializing the TCB on statically linked executables. That's a per-architecture definition. * elf/rtld.c (dl_main): Add a comment about thread-local variables initialization. * sysdeps/generic/libc-start.h: New file. Define ARCH_APPLY_IREL and ARCH_SETUP_IREL. * sysdeps/powerpc/Makefile: [$(subdir) = elf && $(multi-arch) != no] (tests-static-internal): Add tst-tlsifunc-static. [$(subdir) = elf && $(multi-arch) != no && $(build-shared) == yes] (tests-internal): Add tst-tlsifunc. * sysdeps/powerpc/tst-tlsifunc.c: New file. * sysdeps/powerpc/tst-tlsifunc-static.c: Likewise. * sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New variable. [$(subdir) = math] (test-float128% test-ifloat128%): Force linking to the loader after linking to libgcc. [$(subdir) = wcsmbs || $(subdir) = stdlib] (bug-strtod bug-strtod2) (bug-strtod2 tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom) (tst-strfrom-locale strfrom-skeleton): Likewise. * sysdeps/unix/sysv/linux/powerpc/libc-start.h: New file. Define ARCH_APPLY_IREL and ARCH_SETUP_IREL.
* hppa: Fix clone exit syscall argument passing (BZ#21512)Adhemerval Zanella2017-07-171-1/+1
| | | | | | | | | | | | This patch fixes the argument passing for exit syscall after the clone function returns on hppa. This fixes misc/tst-clone2 on hppa-linux-gnu. Checked misc/tst-clone2 on hppa-linux-gnu. [BZ #21512] * sysdeps/unix/sysv/linux/hppa/clone.S (__clone): Fix argument passing to syscall exit.
* Add HWCAP_ macros from Linux 4.12 to AArch64 bits/hwcap.h.Szabolcs Nagy2017-07-171-0/+3
| | | | | | | | This patch adds the HWCAP_JSCVT, HWCAP_FCMA and HWCAP_LRCPC macros from Linux 4.12 to the AArch64 bits/hwcap.h. * sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_FCMA): New macro. (HWCAP_JSCVT, HWCAP_LRCPC): Likewise.
* Add CFI annotation.John David Anglin2017-07-164-0/+12
|
* Fix stack offset for r19 load in __getcontext.John David Anglin2017-07-161-1/+1
|
* Fix __setcontext return value on hppa.John David Anglin2017-07-161-1/+1
|
* Fix syscall cancellation on hppa.John David Anglin2017-07-162-39/+23
|
* Remove _exit entry from sysdeps/unix/sysv/linux/hppa/localplt.data.John David Anglin2017-07-161-1/+0
|
* Fix [BZ locale/19838].John David Anglin2017-07-151-1/+1
|
* posix: Add p{read,write}v2 RWF_NOWAIT flag (BZ#21738)Adhemerval Zanella2017-07-111-0/+1
| | | | | | | | | | | | | | Linux 4.12 (b745fafaf70c0a98a2e1e7ac8cb14542889ceb0e) adds a new p{read,write}v2 flag RWF_NOWAIT. This patch adds it for linux uio-ext.h header. Checked on x86_64-linux-gnu (on a 4.10 kernel). [BZ #21738] * manual/llio.texi (RWF_NOWAIT): New item. * misc/tst-preadvwritev2-common.c (do_test_with_invalid_flags): Add RWF_NOWAIT check. * sysdeps/unix/sysv/linux/bits/uio-ext.h (RWF_NOWAIT): New flag.
* S390: Fix tst-ptrace-singleblock if kernel does not support PTRACE_SINGLEBLOCK.Stefan Liebler2017-07-111-2/+52
| | | | | | | | | | | | | | | | | | The request PTRACE_SINGLEBLOCK was introduced in Linux 3.15. Thus the ptrace call will fail on older kernels. Thus the test is now testing PTRACE_SINGLEBLOCK with data argument pointing to a buffer on stack which is assumed to fail. If the request would be interpreted as PTRACE_GETREGS, then the ptrace call will not fail and the regs are written to buf. If we run with a kernel with support for PTRACE_SINGLEBLOCK a ptrace call with data=NULL, returns zero with no error. If we run with a kernel without support for PTRACE_SINGLEBLOCK a ptrace call with data=NULL reports an error. In the latter case, the test is just continuing with PTRACE_CONT. ChangeLog: * sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c: Support running on kernels without PTRACE_SINGLEBLOCK.
* Use generic pthread support on hppa.John David Anglin2017-07-097-381/+19
|
* sysconf: Use conservative default for _SC_NPROCESSORS_ONLN [BZ #21542]Florian Weimer2017-07-041-1/+4
|
* Fix typo in glibc.tune.cpu nameSiddhesh Poyarekar2017-07-011-1/+1
|
* Consolidate Linux fcntl implementationAdhemerval Zanella2017-06-3014-224/+34
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* tunables, aarch64: New tunable to override cpuSiddhesh Poyarekar2017-06-301-6/+41
| | | | | | | | | | | | | | | | | | | | Add a new tunable (glibc.tune.cpu) to override CPU identification on aarch64. This is useful in two cases: one where it is desirable to pretend to be another CPU for purposes of testing or because routines written for that CPU are beneficial for specific workloads and second where the underlying kernel does not support emulation of MRS to get the MIDR of the CPU. * elf/dl-tunables.h (tunable_is_name): Move from... * elf/dl-tunables.c (is_name): ... here. (parse_tunables, __tunables_init): Adjust. * manual/tunables.texi: Document glibc.tune.cpu. * sysdeps/aarch64/dl-tunables.list: New file. * sysdeps/unix/sysv/linux/aarch64/cpu-features.c (struct cpu_list): New type. (cpu_list): New list of CPU names and their MIDR. (get_midr_from_mcpu): New function. (init_cpu_features): Override MIDR if necessary.
* SPARC sys/ucontext.h namespace fixes (bug 21457).Joseph Myers2017-06-292-119/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes various miscellaneous namespace issues in the SPARC sys/ucontext.h header. These are similar to changes made previous to other sys/ucontext.h headers, where the SPARC header was excluded from those previous patches because of its complexity. Tested for SPARC with build-many-glibcs.py. [BZ #21457] * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (__ctx): New macro. [__WORDSIZE == 64] (MC_TSTATE): Define only for [__USE_MISC]. [__WORDSIZE == 64] (MC_PC): Likewise. [__WORDSIZE == 64] (MC_NPC): Likewise. [__WORDSIZE == 64] (MC_Y): Likewise. [__WORDSIZE == 64] (MC_G1): Likewise. [__WORDSIZE == 64] (MC_G2): Likewise. [__WORDSIZE == 64] (MC_G3): Likewise. [__WORDSIZE == 64] (MC_G4): Likewise. [__WORDSIZE == 64] (MC_G5): Likewise. [__WORDSIZE == 64] (MC_G6): Likewise. [__WORDSIZE == 64] (MC_G7): Likewise. [__WORDSIZE == 64] (MC_O0): Likewise. [__WORDSIZE == 64] (MC_O1): Likewise. [__WORDSIZE == 64] (MC_O2): Likewise. [__WORDSIZE == 64] (MC_O3): Likewise. [__WORDSIZE == 64] (MC_O4): Likewise. [__WORDSIZE == 64] (MC_O5): Likewise. [__WORDSIZE == 64] (MC_O6): Likewise. [__WORDSIZE == 64] (MC_O7): Likewise. [__WORDSIZE == 64] (MC_NGREG): Rename to __MC_NGREG and define to __MC_NGREG if [__USE_MISC]. [__WORDSIZE == 64] (MC_MAXFPQ): Define only for [__USE_MISC]. [__WORDSIZE == 64] (mc_gregset_t): Define using __MC_NGREG. [__WORDSIZE == 64] (struct mc_fq): Rename to struct __mc_fq. Define fields using __ctx. [__WORDSIZE == 64] (mc_fpu_t): Remove struct tag. Define fields using __ctx. [__WORDSIZE == 64] (mcontext_t): Define fields using __ctx. (REG_PSR): Define only for [__USE_MISC]. (REG_PC): Likewise. (REG_nPC): Likewise. (REG_Y): Likewise. (REG_G1): Likewise. (REG_G2): Likewise. (REG_G3): Likewise. (REG_G4): Likewise. (REG_G5): Likewise. (REG_G6): Likewise. (REG_G7): Likewise. (REG_O0): Likewise. (REG_O1): Likewise. (REG_O2): Likewise. (REG_O3): Likewise. (REG_O4): Likewise. (REG_O5): Likewise. (REG_O6): Likewise. (REG_O7): Likewise. [__WORDSIZE == 64] (REG_ASI): Define only for [__USE_MISC]. [__WORDSIZE == 64] (REG_FPRS): Likewise. (NGREG): Rename to __NGREG and define to __NGREG if [__USE_MISC]. (gregset_t): Define using __NGREG. (SPARC_MAXREGWINDOW): Rename to __SPARC_MAXREGWINDOW and define to __SPARC_MAXREGWINDOW if [__USE_MISC]. (struct rwindow): Rename to struct __rwindow. Define fields using __ctx. (rw_fp): Define only for [__USE_MISC]. (rw_rtn): Likewise. (gwindows_t): Remove struct tag. Define fields using __ctx and __SPARC_MAXREGWINDOW. (MAXFPQ): Define only for [__USE_MISC]. (struct fpq): Rename to struct __fpq. Define fields using __ctx. (struct fq): Rename to struct __fq. Define fields using __ctx. (FPU_REGS_TYPE): Define only for [__USE_MISC]. (FPU_DREGS_TYPE): Likewise. (V7_FPU_FSR_TYPE): Likewise. (V9_FPU_FSR_TYPE): Likewise. (V9_FPU_FPRS_TYPE): Likewise. [__WORDSIZE == 64] (fpregset_t): Remove struct tag. Define fields using __ctx. [__WORDSIZE != 64] (fpregset_t): Likewise. [__WORDSIZE != 64] (xrs_t): Define fields using __ctx. [__WORDSIZE != 64] (XRS_ID): Define only for [__USE_MISC]. [__WORDSIZE != 64] (mcontext_t): Define fields using __ctx. Rename field filler to __glibc_reserved1. * sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym (MC_FILLER): Remove.
* Miscellaneous sys/ucontext.h namespace fixes (bug 21457).Joseph Myers2017-06-284-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes various miscellaneous namespace issues in sys/ucontext.h headers. Some struct tags are removed where the structs also have *_t typedef names, while other struct tags without such names are renamed to start __; the changes are noted in NEWS as they can affect C++ name mangling (although there seems to be little if any external use of these types, at least based on checking codesearch.debian.net). For powerpc, pointers to struct pt_regs (not defined in this header) are changed to point to struct __ctx(pt_regs), so in the __USE_MISC case those struct fields continue to point to the existing struct pt_regs type for maximum compatibility, while when that's a namespace issue they point to a struct __pt_regs type which is always an incomplete struct. Tested for affected architectures with build-many-glibcs.py. [BZ #21457] * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (fpregset_t): Remove struct tag. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h (fpregset_t): Likewise. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (mcontext_t): Likewise. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (pt_regs): Declare struct type with __ctx. [__WORDSIZE != 32] (mcontext_t): Use __ctx with pt_regs struct tag. (ucontext_t) [__WORDSIZE == 32]: Use __ctx with pt_regs struct tag and regs field name.
* S390: Add new hwcap values for new cpu architecture - arch12.Stefan Liebler2017-06-271-0/+3
| | | | | | | | | | | | | | | | | | | The new hwcap values indicate support for: - Vector packed decimal facility - Vector enhancements facility 1 - Guarded storage facility Note: arch12 is NOT the official name of the new CPU. It refers to the edition number of the Principle of Operations manual. ChangeLog: * sysdeps/s390/dl-procinfo.c (_dl_s390_cap_flags): Add vxd, vxe, gs flag. * sysdeps/s390/dl-procinfo.h: Add HWCAP_S390_VXD, HWCAP_S390_VXE, HWCAP_S390_GS capability. * sysdeps/unix/sysv/linux/s390/bits/hwcap.h (HWCAP_S390_VXD, HWCAP_S390_VXE, HWCAP_S390_GS): Define.
* Add float128 support for ia64.Joseph Myers2017-06-262-0/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enables float128 support for ia64, so that all the configurations where GCC supports _Float128 / __float128 as an ABI-distinct type now have glibc support as well. bits/floatn.h declares the support to be available for GCC 4.4 and later, which is when the libgcc support was added. The removal of sysdeps/ia64/fpu/k_rem_pio2.c is because the generic k_rem_pio2.c defines a function required by the float128 code. Tested (compilation only) with build-many-glibcs.py for ia64 (GCC 6 and GCC 7). Given how long it is since libm-test-ulps has been updated for ia64, I think truncating the file and regenerating it from scratch would be a good idea when doing a regeneration to add float128 ulps. I expect various ia64 libm issues (at least some already filed in Bugzilla) to result in test failures even after ulps regeneration, but hopefully the float128 code will pass tests as it's the same as used on other architectures. * sysdeps/ia64/Implies: Add ieee754/float128. * sysdeps/ia64/bits/floatn.h: New file. * sysdeps/ia64/float128-abi.h: Likewise. * manual/math.texi (Mathematics): Document support for _Float128 on ia64. * sysdeps/ia64/Makefile [$(subdir) = math] (CPPFLAGS): Append to Makefile variable. * sysdeps/ia64/fpu/e_sqrtf128.c: New file. * sysdeps/ia64/fpu/k_rem_pio2.c: Remove file. * sysdeps/ia64/fpu/sfp-machine.h: New file. Based on libgcc. * sysdeps/ia64/math-tests.h: New file. * math/libm-test-support.h (XFAIL_FLOAT128_PAYLOAD): Also define based on TEST_COND_binary128 for [__ia64__]. * sysdeps/unix/sysv/linux/ia64/libc.abilist: Update. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise,
* Rename struct ucontext tag (bug 21457).Joseph Myers2017-06-2628-47/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add float128 support for x86_64, x86.Joseph Myers2017-06-266-0/+435
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enables float128 support for x86_64 and x86. All GCC versions that can build glibc provide the required support, but since GCC 6 and before don't provide __builtin_nanq / __builtin_nansq, sNaN tests and some tests of NaN payloads need to be disabled with such compilers (this does not affect the generated glibc binaries at all, just the tests). bits/floatn.h declares float128 support to be available for GCC versions that provide the required libgcc support (4.3 for x86_64, 4.4 for i386 GNU/Linux, 4.5 for i386 GNU/Hurd); compilation-only support was present some time before then, but not really useful without the libgcc functions. fenv_private.h needed updating to avoid trying to put _Float128 values in registers. I make no assertion of optimality of the math_opt_barrier / math_force_eval definitions for this case; they are simply intended to be sufficient to work correctly. Tested for x86_64 and x86, with GCC 7 and GCC 6. (Testing for x32 was compilation tests only with build-many-glibcs.py to verify the ABI baseline updates. I have not done any testing for Hurd, although the float128 support is enabled there as for GNU/Linux.) * sysdeps/i386/Implies: Add ieee754/float128. * sysdeps/x86_64/Implies: Likewise. * sysdeps/x86/bits/floatn.h: New file. * sysdeps/x86/float128-abi.h: Likewise. * manual/math.texi (Mathematics): Document support for _Float128 on x86_64 and x86. * sysdeps/i386/fpu/fenv_private.h: Include <bits/floatn.h>. (math_opt_barrier): Do not put _Float128 values in floating-point registers. (math_force_eval): Likewise. [__x86_64__] (SET_RESTORE_ROUNDF128): New macro. * sysdeps/x86/fpu/Makefile [$(subdir) = math] (CPPFLAGS): Append to Makefile variable. * sysdeps/x86/fpu/e_sqrtf128.c: New file. * sysdeps/x86/fpu/sfp-machine.h: Likewise. Based on libgcc. * sysdeps/x86/math-tests.h: New file. * math/libm-test-support.h (XFAIL_FLOAT128_PAYLOAD): New macro. * math/libm-test-getpayload.inc (getpayload_test_data): Use XFAIL_FLOAT128_PAYLOAD. * math/libm-test-setpayload.inc (setpayload_test_data): Likewise. * math/libm-test-totalorder.inc (totalorder_test_data): Likewise. * math/libm-test-totalordermag.inc (totalordermag_test_data): Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilist: Update. * sysdeps/unix/sysv/linux/i386/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. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Call exit directly in clone (BZ #21512)Adhemerval Zanella2017-06-2618-104/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* powerpc64le: Enable float128Paul E. Murphy2017-06-263-0/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds ULPs for the float128 type, updates the abilist for libc and libm, and adds the files bits/floatn.h and float128-abi.h, in order to enable the new type for powerpc64le. This patch also adds the implementation of sqrtf128 for powerpc64le, since it is not implemented in libgcc. The sfp-machine.h header is taken from libgcc. Tested for powerpc64le (GCC 6.2 and GCC 7.1), powerpc64 and s390x. * manual/math.texi (Mathematics): Mention the enabling of float128 for powerpc64le. * sysdeps/powerpc/bits/floatn.h: New file. * sysdeps/powerpc/fpu/libm-test-ulps: Regenerated. * sysdeps/powerpc/fpu/math_private.h: (__ieee754_sqrtf128): New inline override. * sysdeps/powerpc/powerpc64le/Implies-before: New file. * sysdeps/powerpc/powerpc64le/Makefile: New file. * sysdeps/powerpc/powerpc64le/fpu/e_sqrtf128.c: New file. * sysdeps/powerpc/powerpc64le/fpu/sfp-machine.h: New file. * sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c: New file. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Updated. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64le/float128-abi.h: New file.
* Clean pthread functions namespaces for C11 threadsAdhemerval Zanella2017-06-237-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds internal definition (through {libc_}hidden_{proto,def}) and also change some strong to weak alias for symbols that might be used by C11 threads implementations. The patchset should not change libc/libpthread functional, although object changes are expected (since now internal symbols are used instead) and final exported symbols through GLIBC_PRIVATE is also expanded (to cover libpthread usage of __mmap{64}, __munmap, __mprotect). Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu, powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu, tile{pro,gx}-linux-gnu, and x86_64-linux-gnu). * include/sched.h (__sched_get_priority_max): Add libc hidden proto. (__sched_get_prioriry_min): Likewise. * include/sys/mman.h (__mmap): Likewise. (__mmap64): Likewise. (__munmap): Likewise. (__mprotect): Likewise. * include/termios.h (__tcsetattr): Likewise. * include/time.h (__nanosleep): Use hidden_proto instead of libc_hidden_proto. * posix/nanosleep.c (__nanosleep): Likewise. * misc/Versions (libc): Export __mmap, __munmap, __mprotect, __sched_get_priority_min, and __sched_get_priority_max under GLIBC_PRIVATE. * nptl/allocatestack.c (__free_stacks): Use internal definition for libc symbols. (change_stack_perm): Likewise. (allocate_stack): Likewise. * sysdeps/posix/gethostname.c: Likewise. * nptl/tpp.c (__init_sched_fifo_prio): Likewise. * sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise. * sysdeps/unix/sysv/linux/powerpc/ioctl.c (__ioctl): Likewise. * nptl/pthreadP.h (__pthread_mutex_timedlock): Add definition. (__pthread_key_delete): Likewise. (__pthread_detach): Likewise. (__pthread_cancel): Likewise. (__pthread_mutex_trylock): Likewise. (__pthread_mutexattr_init): Likewise. (__pthread_mutexattr_settype): Likewise. * nptl/pthread_cancel.c (pthread_cancel): Change to internal name and create alias for exported one. * nptl/pthread_join.c (pthread_join): Likewise. * nptl/pthread_detach.c (pthread_detach): Likewise. * nptl/pthread_key_delete.c (pthread_key_delete): Likewise. * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise. * nptl/pthread_create.c: Change static requirements for pthread symbols. * nptl/pthread_equal.c (__pthread_equal): Change strong alias to weak for internal definition. * nptl/pthread_exit.c (__pthread_exit): Likewise. * nptl/pthread_getspecific.c (__pthread_getspecific): Likewise. * nptl/pthread_key_create.c (__pthread_key_create): Likewise. * nptl/pthread_mutex_destroy.c (__pthread_mutex_destroy): Likewise. * nptl/pthread_mutex_init.c (__pthread_mutex_init): Likewise. * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise. * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): Likewise. * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock): Likewise. * nptl/pthread_mutexattr_init.c (__pthread_mutexattr_init): Likwise. * nptl/pthread_mutexattr_settype.c (__pthread_mutexattr_settype): Likewise. * nptl/pthread_self.c (__pthread_self): Likewise. * nptl/pthread_setspecific.c (__pthread_setspecific): Likewise. * sysdeps/unix/sysv/linux/tcsetattr.c (tcsetattr): Likewise. * misc/mmap.c (__mmap): Add internal symbol definition. * misc/mmap.c (__mmap64): Likewise. * sysdeps/unix/sysv/linux/mmap.c (__mmap): Likewise. * sysdeps/unix/sysv/linux/mmap64.c (__mmap): Likewise. (__mmap64): Likewise. * sysdeps/unix/sysv/linux/i386/Versions (libc) [GLIBC_PRIVATE): Add __uname.
* powerpc: fix sysconf support for cache geometriesPaul Clarke2017-06-231-29/+8
| | | | | | | | | Commit cdfbe5037f2f67bf5f560b73732b69d0fabe2314 added sysconf support for cache geometries on powerpc, but mishandled errno. For valid input parameters, sysconf() should not set errno. * sysdeps/unix/sysv/linux/powerpc/sysconf.c: Remove references to errno, and simplify remaining related code.
* Fix tile SA_* conditions for POSIX.1:2008 (bug 21622).Joseph Myers2017-06-211-0/+2
| | | | | | | | | | | | | | | | | | | As shown by conform/ tests once the remaining namespace issues are fixed, the tile bits/sigaction.h fails to declare SA_RESETHAND, SA_RESTART and SA_NODEFER for non-XSI POSIX.1:2008 as other versions do. Those constants were moved from XSI to Base in the 2008 edition of POSIX. This patch fixes the conditions to match other versions of this header. Tested (compilation only) for tilegx-linux-gnu with build-many-glibcs.py. [BZ #21622] * sysdeps/unix/sysv/linux/tile/bits/sigaction.h (SA_RESTART): Define for [__USE_UNIX98 || __USE_XOPEN2K8], not [__USE_UNIX98 || __USE_MISC]. (SA_NODEFER): Likewise. (SA_RESETHAND): Likewise.
* Factor out shared definitions from bits/signum.h.Zack Weinberg2017-06-207-282/+252
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many of the things defined by bits/signum.h are invariant across all supported operating systems. This patch factors out all of them to a new header bits/signum-generic.h, which each bits/signum.h will include and then override whichever things need adjustment. Normally that will mean, at most, adding or changing a few signal numbers. A user-visible side effect is that the obsolete signal constant SIGUNUSED (which is an alias for SIGSYS on all platforms that define it) is no longer exposed by any version of bits/signum.h. A side effect only relevant to glibc hackers is that _NSIG is now defined in terms of __SIGRTMAX, instead of the other way around. This is because __SIGRTMAX varies from platform to platform, but _NSIG==__SIGRTMAX+1 is true universally. If your platform doesn't support realtime signals, leave __SIGRTMAX equal to __SIGRTMIN. I also added a Linux-specific test to make sure that our signal constants match the ones in <asm/signal.h>, since we can't use that header (it's not even vaguely namespace-clean). * bits/signum-generic.h: Renamed from bits/signum.h. Add proper multiple include guard and misuse check. Define __SIGRTMIN = __SIGRTMAX = 32, and define _NSIG = __SIGRTMAX+1. Move definition of SIGIO to "archaic names for compatibility" section. * bits/signum.h: New file which just includes bits/signum-generic.h. * sysdeps/unix/bsd/bits/signum.h * sysdeps/unix/sysv/linux/bits/signum.h * sysdeps/unix/sysv/linux/alpha/bits/signum.h * sysdeps/unix/sysv/linux/hppa/bits/signum.h * sysdeps/unix/sysv/linux/mips/bits/signum.h * sysdeps/unix/sysv/linux/sparc/bits/signum.h Just include <bits/signum-generic.h> and then add or adjust signal constants. Do not define SIGUNUSED, SIGRTMIN, or SIGRTMAX. * signal/Makefile: Install bits/signum-generic.h. * signal/signal.h: Define SIGRTMIN and SIGRTMAX here. * sysdeps/generic/siglist.h: SIGSYS and SIGWINCH are universal. Prefer SIGPOLL to SIGIO. Simplify #ifdeffage. * sysdeps/unix/sysv/linux/tst-signal-numbers.sh: New test. * sysdeps/unix/sysv/linux/Makefile: Run it.
* Consolidate Linux openat implementationAdhemerval Zanella2017-06-204-38/+62
| | | | | | | | | | | | | | | | | | | | This patch consolidates the open Linux syscall implementation on sysdeps/unix/sysv/linux/open{64}.c. The changes are: 1. Remove wordsize-64 openat{64}. 2. For architetures that define __OFF_T_MATCHES_OFF64_T openat64 will be default one with alias to required symbols. Otherwise openat64 will pass the required O_LARGEFILE flag on syscall. 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/openat.c (__libc_openat): Build only for !__OFF_T_MATCHES_OFF64_T. * sysdeps/unix/sysv/linux/openat64.c (__libc_openat64): New implementation based on open64. * sysdeps/unix/sysv/linux/wordsize-64/openat.c: Remove file. * sysdeps/unix/sysv/linux/wordsize-64/openat64.c: Likewise.
* conformtest: XFAIL uc_mcontext test for powerpc32 (bug 21635).Joseph Myers2017-06-201-0/+5
| | | | | | | | | | | | | | | This patch XFAILs one test where the powerpc32 ucontext_t has the wrong type of a field, to allow the conform/ tests as a whole to pass once the namespace issues are fixed. Tested with build-many-glibcs.py. [BZ #21635] * sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile [$(subdir) = conform] (conformtest-xfail-conds): New variable. * conform/data/signal.h-data (uc_mcontext): XFAIL for powerpc32-linux. * conform/data/ucontext.h-data (uc_mcontext): Likewise.
* conformtest: XFAIL uc_sigmask test for ia64 (bug 21634).Joseph Myers2017-06-201-0/+5
| | | | | | | | | | | | | | This patch XFAILs one test where the ia64 ucontext_t has the wrong type of a field, to allow the conform/ tests as a whole to pass once the namespace issues are fixed. Tested with build-many-glibcs.py. [BZ #21634] * sysdeps/unix/sysv/linux/ia64/Makefile [$(subdir) = conform] (conformtest-xfail-conds): New variable. * conform/data/signal.h-data (uc_sigmask): XFAIL for ia64-linux. * conform/data/ucontext.h-data (uc_sigmask): Likewise.
* tunables: Add IFUNC selection and cache sizesH.J. Lu2017-06-201-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current IFUNC selection is based on microbenchmarks in glibc. It should give the best performance for most workloads. But other choices may have better performance for a particular workload or on the hardware which wasn't available at the selection was made. The environment variable, GLIBC_TUNABLES=glibc.tune.ifunc=-xxx,yyy,-zzz...., can be used to enable CPU/ARCH feature yyy, disable CPU/ARCH feature yyy and zzz, where the feature name is case-sensitive and has to match the ones in cpu-features.h. It can be used by glibc developers to override the IFUNC selection to tune for a new processor or improve performance for a particular workload. It isn't intended for normal end users. NOTE: the IFUNC selection may change over time. Please check all multiarch implementations when experimenting. Also, GLIBC_TUNABLES=glibc.tune.x86_non_temporal_threshold=NUMBER is provided to set threshold to use non temporal store to NUMBER, GLIBC_TUNABLES=glibc.tune.x86_data_cache_size=NUMBER to set data cache size, GLIBC_TUNABLES=glibc.tune.x86_shared_cache_size=NUMBER to set shared cache size. * elf/dl-tunables.list (tune): Add ifunc, x86_non_temporal_threshold, x86_data_cache_size and x86_shared_cache_size. * manual/tunables.texi: Document glibc.tune.ifunc, glibc.tune.x86_data_cache_size, glibc.tune.x86_shared_cache_size and glibc.tune.x86_non_temporal_threshold. * sysdeps/unix/sysv/linux/x86/dl-sysdep.c: New file. * sysdeps/x86/cpu-tunables.c: Likewise. * sysdeps/x86/cacheinfo.c (init_cacheinfo): Check and get data cache size, shared cache size and non temporal threshold from cpu_features. * sysdeps/x86/cpu-features.c [HAVE_TUNABLES] (TUNABLE_NAMESPACE): New. [HAVE_TUNABLES] Include <unistd.h>. [HAVE_TUNABLES] Include <elf/dl-tunables.h>. [HAVE_TUNABLES] (TUNABLE_CALLBACK (set_ifunc)): Likewise. [HAVE_TUNABLES] (init_cpu_features): Use TUNABLE_GET to set IFUNC selection, data cache size, shared cache size and non temporal threshold. * sysdeps/x86/cpu-features.h (cpu_features): Add data_cache_size, shared_cache_size and non_temporal_threshold.
* S390: Sync ptrace.h with kernel. [BZ #21539]Stefan Liebler2017-06-193-20/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS and PTRACE_SETFPREGS as these requests does not exist on s390 kernel. But the kernel has support for PTRACE_SINGLEBLOCK, PTRACE_SECCOMP_GET_FILTER, PTRACE_PEEKUSR_AREA, PTRACE_POKEUSR_AREA, PTRACE_GET_LAST_BREAK, PTRACE_ENABLE_TE, PTRACE_DISABLE_TE and PTRACE_TE_ABORT_RAND. Thus those are defined now. The current kernel s390 specific ptrace.h file also defines PTRACE_PEEKTEXT_AREA, PTRACE_PEEKDATA_AREA, PTRACE_POKETEXT_AREA, PTRACE_POKEDATA_AREA, PTRACE_PEEK_SYSTEM_CALL, PTRACE_POKE_SYSTEM_CALL and PTRACE_PROT, but those requests are not supported. Thus those defines are skipped in glibc ptrace.h. There were old includes of ptrace.h in sysdeps/s390/fpu/fesetenv.c. The ptrace feature isn't used there anymore, thus I removed the includes. Before this patch, <glibc>/sysdeps/unix/sysv/linux/s390/sys/ptrace.h uses ptrace-request 12 for PTRACE_GETREGS, but <kernel>/include/uapi/linux/ptrace.h uses 12 for PTRACE_SINGLEBLOCK. The s390 kernel has never had support for PTRACE_GETREGS! Thus glibc ptrace.h is adjusted to match kernel ptrace.h. The new s390 specific test ensures, that PTRACE_SINGLEBLOCK defined in glibc works as expected. If the kernel would interpret it as PTRACE_GETREGS, then the testcase will not make any progress and will time out. ChangeLog: [BZ #21539] * NEWS: Mention s390 ptrace request changes. * sysdeps/unix/sysv/linux/s390/sys/ptrace.h (PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS): Remove enum constant. (PT_GETREGS, PT_SETREGS, PT_GETFPREGS, T_SETFPREGS): Remove defines. (PTRACE_SINGLEBLOCK): New enum constant. (PT_STEPBLOCK): New define. (PTRACE_PEEKUSR_AREA, PTRACE_POKEUSR_AREA, PTRACE_GET_LAST_BREAK, PTRACE_ENABLE_TE, PTRACE_DISABLE_TE, PTRACE_TE_ABORT_RAND): New enum constant and define. * sysdeps/s390/fpu/fesetenv.c: Remove ptrace.h includes. * sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c: New file. * sysdeps/unix/sysv/linux/s390/Makefile: Add test.
* Fix another x86 sys/ucontext.h namespace issue (bug 21457).Joseph Myers2017-06-191-1/+1
| | | | | | | | | | | This patch fixes a namespace issue for one more field in the x86 sys/ucontext.h that I missed in my previous changes. Tested for x86_64. [BZ #21457] * sysdeps/unix/sysv/linux/x86/sys/ucontext.h [__x86_64__] (struct _libc_xmmreg): Use __ctx in defining field.
* Define struct rusage in sys/wait.h when required (bug 21575).Joseph Myers2017-06-194-234/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some older standards (XPG4.2 through POSIX.1:2001, XSI only) require sys/wait.h to include the definition of struct rusage. This is missing in glibc. This patch adds the required definition. struct rusage is moved to a new header bits/types/struct_rusage.h to avoid bringing in the whole of sys/resource.h (although the standards in question do allow the whole of sys/resource.h to be brought in). In the five bits/resource.h headers, the only variation between the definitions of struct rusage is that the sysdeps/unix/sysv/linux version is prepared for x32 (by having anonymous unions with __syscall_slong_t fields) and the others are not. Thus, this version is suitable for use generically (everything other than x32 simply has __syscall_slong_t the same as long int, so there are no API or ABI changes involved, and anonymous unions are already a required language feature for glibc headers elsewhere), and this patch uses it as a base for the single implementation of bits/types/struct_rusage.h. Tested for x86_64, and with build-many-glibcs.py. [BZ #21575] * resource/bits/types/struct_rusage.h: New file. * include/bits/types/struct_rusage.h: Likewise. * bits/resource.h (struct rusage): Include <bits/types/struct_rusage.h> instead of defining here. * sysdeps/unix/sysv/linux/bits/resource.h (struct rusage): Likewise. * sysdeps/unix/sysv/linux/alpha/bits/resource.h (struct rusage): Likewise. * sysdeps/unix/sysv/linux/mips/bits/resource.h (struct rusage): Likewise. * sysdeps/unix/sysv/linux/sparc/bits/resource.h (struct rusage): Likewise. * resource/Makefile (headers): Add bits/types/struct_rusage.h. * posix/sys/wait.h [__USE_XOPEN_EXTENDED && !__USE_XOPEN2K8]: Include <bits/types/struct_rusage.h>
* S390: Fix build with gcc configured with --enable-default-pie. [BZ #21537]Stefan Liebler2017-06-191-19/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Building glibc with gcc configured with --enable-default-pie failed on s390 due to assembler messages: ../sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S:44: Error: junk at end of line, first unrecognized character is `@' HIDDEN_JUMPTARGET was expanded to exit@PLT@GOTOFF. If SHARED is not defined, HIDDEN_JUMPTARGET is defined to JUMPTARGET in sysdeps/s390/s390-32/sysdep.h. There it expanded to exit@PLT in non SHARED case as PIC is defined if gcc is configured with --enable-default-pie. Thus I've changed the "ifdef PIC" to "ifdef SHARED" as we do not want PLTs in the static obj files. I've also changed this in sysdeps/s390/s390-64/sysdep.h. I've also adjusted sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S. If glibc is configured with --disable-hidden-plt, then NO_HIDDEN is defined. In SHARED case HIDDEN_JUMPTARGET would be expanded to exit@PLT@GOTOFF instead of __GI_exit@GOTOFF. Now we jump to: - __GI_exit if SHARED is defined - exit@PLT if SHARED and NO_HIDDEN is defined - exit if both are not defined. On s390 31bit we have to setup GOT pointer in r12 if we use a PLT stub. Therefore I use SYSCALL_PIC_SETUP from sysdep.h and added the missing semicolons. ChangeLog: [BZ #21537] * sysdeps/s390/s390-32/sysdep.h (JUMPTARGET, SYSCALL_PIC_SETUP): Check SHARED instead of PIC. (SYSCALL_PIC_SETUP): Add missing semicolons. * sysdeps/s390/s390-64/sysdep.h (JUMPTARGET, SYSCALL_PIC_SETUP): Check SHARED instead of PIC. * sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S (__makecontext_ret): Adjust code to jump to exit.
* s390: optimize syscall functionChristian Borntraeger2017-06-192-18/+6
| | | | | | | | | | | | | | Since kernel 2.6.0 all Linux version accept the system call number in register 1 for svc 0. There is no need to have special handling that uses EX for system calls < 256. This will simplify and speed up that code. A microbenchmark doing "syscall(__NR_getpid);" in a loops gets faster by ~12%. * sysdeps/unix/sysv/linux/s390/s390-32/syscall.S: Simplify code by always using SVC 0 instead of EX. * sysdeps/unix/sysv/linux/s390/s390-64/syscall.S: Likewise.
* linux: Consolidate sync_file_range implementationAdhemerval Zanella2017-06-152-1/+1
| | | | | | | | | | | | | | | This patch consolidates Linux sync_file_range at default sysdeps/unix/sysv/linux/sync_file_range.c implementation. It also moves the rules flags from generic io/Makefile to Linux one due the fact it is a Linux-only symbol. Checked on i686-linux-gnu and x86_64-linux-gnu. * io/Makefile (CFLAGS-sync_file_range.c): Remove rule. * sysdeps/unix/sysv/linux/Makefile (CFLAGS-sync_file_range.c): New rule. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Remove sync_file_range.
* Remove __need macros from errno.h (__need_Emath, __need_error_t).Zack Weinberg2017-06-145-135/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is fairly complicated, not because the users of __need_Emath and __need_error_t have complicated requirements, but because the core changes had a lot of fallout. __need_error_t exists for gnulib compatibility in argz.h and argp.h. error_t itself is a Hurdism, an enum containing all the E-constants, so you can do 'p (error_t) errno' in gdb and get a symbolic value. argz.h and argp.h use it for function return values, and they want to fall back to 'int' when that's not available. There is no reason why these nonstandard headers cannot just go ahead and include all of errno.h; so we do that. __need_Emath is defined only by .S files; what they _really_ need is for errno.h to avoid declaring anything other than the E-constants (e.g. 'extern int __errno_location(void);' is a syntax error in assembly language). This is replaced with a check for __ASSEMBLER__ in errno.h, plus a carefully documented requirement for bits/errno.h not to define anything other than macros. That in turn has the consequence that bits/errno.h must not define errno - fortunately, all live ports use the same definition of errno, so I've moved it to errno.h. The Hurd bits/errno.h must also take care not to define error_t when __ASSEMBLER__ is defined, which involves repeating all of the definitions twice, but it's a generated file so that's okay. * stdlib/errno.h: Remove __need_Emath and __need_error_t logic. Reorganize file. Declare errno here. When __ASSEMBLER__ is defined, don't declare anything other than the E-constants. * include/errno.h: Change conditional for exposing internal declarations to (not _ISOMAC and not __ASSEMBLER__). * bits/errno.h: Remove logic for __need_Emath. Document requirements for a port-specific bits/errno.h. * sysdeps/unix/sysv/linux/bits/errno.h * sysdeps/unix/sysv/linux/alpha/bits/errno.h * sysdeps/unix/sysv/linux/hppa/bits/errno.h * sysdeps/unix/sysv/linux/mips/bits/errno.h * sysdeps/unix/sysv/linux/sparc/bits/errno.h: Add multiple-include guard and check against improper inclusion. Remove __need_Emath logic. Don't declare errno here. Ensure all constants are defined as simple integer literals. Consistent formatting. * sysdeps/mach/hurd/errnos.awk: Likewise. Only define error_t and enum __error_t_codes if __ASSEMBLER__ is not defined. * sysdeps/mach/hurd/bits/errno.h: Regenerate. * argp/argp.h, string/argz.h: Don't define __need_error_t before including errno.h. * sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S * sysdeps/i386/i686/fpu/multiarch/s_sincosf-sse2.S * sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S * sysdeps/x86_64/fpu/s_cosf.S * sysdeps/x86_64/fpu/s_sincosf.S * sysdeps/x86_64/fpu/s_sinf.S: Just include errno.h; don't define __need_Emath or include bits/errno.h directly.
* Remove __need_IOV_MAX and __need_FOPEN_MAX.Zack Weinberg2017-06-143-61/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __need_FOPEN_MAX wasn't being used anywhere. __need_IOV_MAX was more complicated; the basic deal is that sys/uio.h wants to define a constant named UIO_MAXIOV and bits/xopen_lim.h wants to define a constant named IOV_MAX, with the same meaning. For no apparent reason this was being handled via bits/stdio_lim.h -- stdio.h is NOT supposed to define IOV_MAX -- and some mess in Makerules. Also, bits/uio.h on Linux was being used as a dumping ground for extension functions. So now we have bits/uio_lim.h, which defines __IOV_MAX. bits/xopen_lim.h and sys/uio.h use that to define their respective constants. We also now have bits/uio-ext.h, which is the official Proper Home for extensions to sys/uio.h. bits/uio.h is removed, and stdio_lim.h doesn't define IOV_MAX at all. * bits/uio_lim.h, sysdeps/unix/sysv/linux/bits/uio_lim.h * bits/uio-ext.h, sysdeps/unix/sysv/linux/bits/uio-ext.h: New file. * bits/uio.h, sysdeps/unix/sysv/linux/bits/uio.h: Delete file. * include/bits/xopen_lim.h: Use bits/uio_lim.h to get the value for IOV_MAX. * misc/Makefile: Install bits/uio-ext.h and bits/uio_lim.h. Don't install bits/uio.h. * misc/sys/uio.h: Don't include bits/uio.h. Do include bits/types/struct_iovec.h and bits/uio_lim.h. Set UIO_MAXIOV based on __IOV_MAX. Under __USE_GNU, also include bits/uio-ext.h. * stdio-common/stdio_lim.h.in: Remove logic for __need_FOPEN_MAX and __need_IOV_MAX. Don't define IOV_MAX at all. * Makerules (stdio_lim.h): Remove logic for setting IOV_MAX. * sysdeps/unix/sysv/linux/bits/fcntl-linux.h: Include bits/types/struct_iovec.h, not bits/uio.h. Use __ssize_t, not ssize_t, in function prototypes. Don't use hard TAB for double space after period in comments.
* PowerPC64 FRAME_PARM_SAVEAlan Modra2017-06-141-13/+13
| | | | | | | | | | | | | I think FRAME_PARM[1-9]_SAVE confuse the code, particularly FRAME_PARM9_SAVE. There are only 8 parameter save slots! * sysdeps/powerpc/powerpc64/sysdep.h: (FRAME_BACKCHAIN, FRAME_CR_SAVE, FRAME_LR_SAVE): Move out of conditional. (FRAME_PARM1_SAVE, FRAME_PARM2_SAVE, FRAME_PARM3_SAVE, FRAME_PARM4_SAVE, FRAME_PARM5_SAVE, FRAME_PARM6_SAVE, FRAME_PARM7_SAVE, FRAME_PARM8_SAVE, FRAME_PARM9_SAVE): Delete. * sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: Replace uses of FRAME_PARM[1-9]_SAVE with FRAME_PARM_SAVE plus offset.
* mips: Fix store/load gp registers to/from ucontext_tGordana Cmiljanovic2017-06-136-81/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | General purpose registers in mcontext_t structure are 8 bytes long for both MIPS32/MIPS64. get/set/make/swap context implementations for MIPS O32 incorrectly assume that general purpose registers in this structure are 4 bytes long. This patch is fixing that. Tested for MIPS O32 LE and BE. Compared objdump of modified functions for mips n32 and mips n64. [BZ #21548] * sysdeps/unix/sysv/linux/mips/getcontext.S: Define MCONTEXT_SZGREG as 8 and use it when copying general purpose registers. * sysdeps/unix/sysv/linux/mips/makecontext.S: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/Makefile: Include new test for mips o32. * sysdeps/unix/sysv/linux/mips/mips32/bug-getcontext-mips-gp.c: Added new test for mips o32. * sysdeps/unix/sysv/linux/mips/setcontext.S: Define MCONTEXT_SZGREG as 8 and use it when copying general purpose registers. * sysdeps/unix/sysv/linux/mips/swapcontext.S: Likewise.
* Remove __need_schedparam and __cpu_set_t_defined.Zack Weinberg2017-06-121-121/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bits/sched.h has logic to expose only an impl-namespace variant of struct sched_param (i.e. struct __sched_param), but nothing uses it, and the only header that includes bits/sched.h is sched.h. The __need_schedparam logic can therefore be removed. bits/sched.h also has a great deal of code relating to cpu_set_t objects that was *almost* the same between the two versions of bits/sched.h in the tree; a little spelunking indicated that this is because some bug fixes got applied to the Linux-specific bits/sched.h but not the generic one. Introduce a new header, bits/cpu-set.h, containing the version of that code with the bugfixes, have sched.h include it directly, and delete all of the code from both versions of bits/sched.h. Also remove the unnecessary name mangling in the definition of struct sched_param -- POSIX specifies a field 'sched_priority', so there is no reason to define it as '__sched_priority' and then paper over that with a macro. (Just in case someone was using the internal name, 'sched_priority' remains a macro defined to expand to itself, and '__sched_priority' now expands to 'sched_priority'.) Finally, as long as I'm touching these files anyway, merge new constants from linux/sched.h into the Linux bits/sched.h. * bits/sched.h: Remove __need_schedparam logic and replace with a normal multiple-include guard. Change field name in struct sched_param from __sched_priority to sched_priority. Delete everything under #ifndef __cpu_set_t_defined. * sysdeps/unix/sysv/linux/bits/sched.h: Likewise. Also sync with kernel sched.h, adding SCHED_ISO and SCHED_DEADLINE constants. * posix/sched.h: Include bits/cpu-set.h as well as bits/sched.h. For compatibility, #define sched_priority to itself, and #define __sched_priority as sched_priority. * posix/bits/cpu-set.h: New file containing, verbatim, the code that was under #ifndef __cpu_set_t_defined in sysdeps/unix/sysv/linux/bits/sched.h. * include/bits/cpu-set.h: New wrapper. * posix/Makefile: Install bits/cpu-set.h.
* powerpc: add sysconf support for cache geometriesPaul Clarke2017-06-093-0/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | There is currently no "cross-platform" (x86 and POWER) support for determining the cacheline size. This patch adds support to sysconf() to correctly report cacheline sizes based on the information in the auxilliary vector. Thus, using sysconf() is a cross-platform (x86 and POWER) solution for determining cacheline sizes. Support is added (on powerpc) for: _SC_LEVEL1_ICACHE_SIZE _SC_LEVEL1_ICACHE_ASSOC _SC_LEVEL1_ICACHE_LINESIZE _SC_LEVEL1_DCACHE_SIZE _SC_LEVEL1_DCACHE_ASSOC _SC_LEVEL1_DCACHE_LINESIZE _SC_LEVEL2_CACHE_SIZE _SC_LEVEL2_CACHE_ASSOC _SC_LEVEL2_CACHE_LINESIZE _SC_LEVEL3_CACHE_SIZE _SC_LEVEL3_CACHE_ASSOC _SC_LEVEL3_CACHE_LINESIZE * sysdeps/unix/sysv/linux/powerpc/sysconf.c: New file. Add powerpc-specific overrides for L1, L2, L3 CACHE_SIZEs, CACHE_ASSOCs, and CACHE_LINESIZEs, retrieving from auxv. * sysdeps/unix/sysv/linux/powerpc/test-powerpc-linux-sysconf.c: New file. Invoke newly supported sysconf values for powerpc, and report results. If none are supported, report so. * sysdeps/unix/sysv/linux/powerpc/Makefile (tests): Add new test, tst-sysconf.