about summary refs log tree commit diff
path: root/sysdeps/unix/sysv
Commit message (Collapse)AuthorAgeFilesLines
* riscv: Use __has_include__ to include <asm/syscalls.h> [BZ #24022]H.J. Lu2018-12-311-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <asm/syscalls.h> has been removed by commit 27f8899d6002e11a6e2d995e29b8deab5aa9cc25 Author: David Abdurachmanov <david.abdurachmanov@gmail.com> Date: Thu Nov 8 20:02:39 2018 +0100 riscv: add asm/unistd.h UAPI header Marcin Juszkiewicz reported issues while generating syscall table for riscv using 4.20-rc1. The patch refactors our unistd.h files to match some other architectures. - Add asm/unistd.h UAPI header, which has __ARCH_WANT_NEW_STAT only for 64-bit - Remove asm/syscalls.h UAPI header and merge to asm/unistd.h - Adjust kernel asm/unistd.h So now asm/unistd.h UAPI header should show all syscalls for riscv. <asm/syscalls.h> may be restored by Subject: [PATCH] riscv: restore asm/syscalls.h UAPI header Date: Tue, 11 Dec 2018 09:09:35 +0100 UAPI header asm/syscalls.h was merged into UAPI asm/unistd.h header, which did resolve issue with missing syscalls macros resulting in glibc (2.28) build failure. It also broke glibc in a different way: asm/syscalls.h is being used by glibc. I noticed this while doing Fedora 30/Rawhide mass rebuild. The patch returns asm/syscalls.h header and incl. it into asm/unistd.h. I plan to send a patch to glibc to use asm/unistd.h instead of asm/syscalls.h In the meantime, we use __has_include__, which was added to GCC 5, to check if <asm/syscalls.h> exists before including it. Tested with build-many-glibcs.py for riscv against kernel 4.19.12 and 4.20-rc7. [BZ #24022] * sysdeps/unix/sysv/linux/riscv/flush-icache.c: Check if <asm/syscalls.h> exists with __has_include__ before including it.
* Update nios2, sparc32 localplt.data for difftime changes (bug 24023).Joseph Myers2018-12-212-0/+3
| | | | | | | | | | | | | | | | | | | | | | The recent difftime changes introduced localplt test failures on nios2 and sparc32, two configurations where some soft-fp functions are defined in / exported from libc.so, and where the difftime changes affected the particular set of floating-point operations used in libc.so. This patch adds those functions to localplt.data, alongside other such functions already there. (In the sparc32 case, and more generally on any platform where long double is a software floating-point type, it would probably be more efficient to avoid using long double at all in difftime, but that's a pre-existing issue.) Tested with build-many-glibcs.py for its nios2 and sparcv9 configurations. [BZ #24023] * sysdeps/unix/sysv/linux/nios2/localplt.data: Allow __floatundidf PLT reference in libc.so. * sysdeps/unix/sysv/linux/sparc/sparc32/localplt.data: Allow _Q_lltoq and _Q_qtod PLT references in libc.so.
* Add C-SKY portMao Han2018-12-2144-0/+5175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch add two abi combinations support for C-SKY ABIV2: soft-float little endian, hard float little endian. C-SKY ABI manual and architecture user guide are available from: https://github.com/c-sky/csky-doc * config.h.in (CSKYABI, CSKY_HARD_FLOAT): New Define. * scripts/build-many-glibcs.py: Add C-SKY targets. * sysdeps/csky/Implies: New file. * sysdeps/csky/Makefile: Likewise. * sysdeps/csky/abiv2/__longjmp.S: Likewise. * sysdeps/csky/abiv2/csky-mcount.S: Likewise. * sysdeps/csky/abiv2/dl-trampoline.S: Likewise. * sysdeps/csky/abiv2/memcmp.S: Likewise. * sysdeps/csky/abiv2/memcpy.S: Likewise. * sysdeps/csky/abiv2/memmove.S: Likewise. * sysdeps/csky/abiv2/memset.S: Likewise. * sysdeps/csky/abiv2/setjmp.S: Likewise. * sysdeps/csky/abiv2/start.S: Likewise. * sysdeps/csky/abiv2/strcmp.S: Likewise. * sysdeps/csky/abiv2/strcpy.S: Likewise. * sysdeps/csky/abiv2/strlen.S: Likewise. * sysdeps/csky/abiv2/tls-macros.h: Likewise. * sysdeps/csky/abort-instr.h: Likewise. * sysdeps/csky/atomic-machine.h: Likewise. * sysdeps/csky/bits/endian.h: Likewise. * sysdeps/csky/bits/fenv.h: Likewise. * sysdeps/csky/bits/link.h: Likewise. * sysdeps/csky/bits/setjmp.h: Likewise. * sysdeps/csky/bsd-_setjmp.S: Likewise. * sysdeps/csky/bsd-setjmp.S: Likewise. * sysdeps/csky/configure: Likewise. * sysdeps/csky/configure.ac: Likewise. * sysdeps/csky/dl-machine.h: Likewise. * sysdeps/csky/dl-procinfo.c: Likewise. * sysdeps/csky/dl-procinfo.h: Likewise. * sysdeps/csky/dl-sysdep.h: Likewise. * sysdeps/csky/dl-tls.h: Likewise. * sysdeps/csky/fpu/fclrexcpt.c: Likewise. * sysdeps/csky/fpu/fedisblxcpt.c: Likewise. * sysdeps/csky/fpu/feenablxcpt.c: Likewise. * sysdeps/csky/fpu/fegetenv.c: Likewise. * sysdeps/csky/fpu/fegetexcept.c: Likewise. * sysdeps/csky/fpu/fegetmode.c: Likewise. * sysdeps/csky/fpu/fegetround.c: Likewise. * sysdeps/csky/fpu/feholdexcpt.c: Likewise. * sysdeps/csky/fpu/fenv_libc.h: Likewise. * sysdeps/csky/fpu/fenv_private.h: Likewise. * sysdeps/csky/fpu/fesetenv.c: Likewise. * sysdeps/csky/fpu/fesetexcept.c: Likewise. * sysdeps/csky/fpu/fesetmode.c: Likewise. * sysdeps/csky/fpu/fesetround.c: Likewise. * sysdeps/csky/fpu/feupdateenv.c: Likewise. * sysdeps/csky/fpu/fgetexcptflg.c: Likewise. * sysdeps/csky/fpu/fix-fp-int-convert-overflow.h: Likewise. * sysdeps/csky/fpu/fraiseexcpt.c: Likewise. * sysdeps/csky/fpu/fsetexcptflg.c: Likewise. * sysdeps/csky/fpu/ftestexcept.c: Likewise. * sysdeps/csky/fpu/libm-test-ulps: Likewise. * sysdeps/csky/fpu/libm-test-ulps-name: Likewise. * sysdeps/csky/fpu_control.h: Likewise. * sysdeps/csky/gccframe.h: Likewise. * sysdeps/csky/jmpbuf-unwind.h: Likewise. * sysdeps/csky/ldsodefs.h: Likewise. * sysdeps/csky/libc-tls.c: Likewise. * sysdeps/csky/linkmap.h: Likewise. * sysdeps/csky/machine-gmon.h: Likewise. * sysdeps/csky/memusage.h: Likewise. * sysdeps/csky/nofpu/Implies: Likewise. * sysdeps/csky/nofpu/libm-test-ulps: Likewise. * sysdeps/csky/nofpu/libm-test-ulps-name: Likewise. * sysdeps/csky/nptl/Makefile: Likewise. * sysdeps/csky/nptl/bits/pthreadtypes-arch.h: Likewise. * sysdeps/csky/nptl/bits/semaphore.h: Likewise. * sysdeps/csky/nptl/pthread-offsets.h: Likewise. * sysdeps/csky/nptl/pthreaddef.h: Likewise. * sysdeps/csky/nptl/tcb-offsets.sym: Likewise. * sysdeps/csky/nptl/tls.h: Likewise. * sysdeps/csky/preconfigure: Likewise. * sysdeps/csky/sfp-machine.h: Likewise. * sysdeps/csky/sotruss-lib.c: Likewise. * sysdeps/csky/stackinfo.h: Likewise. * sysdeps/csky/sysdep.h: Likewise. * sysdeps/csky/tininess.h: Likewise. * sysdeps/csky/tst-audit.h: Likewise. * sysdeps/unix/sysv/linux/csky/Implies: Likewise. * sysdeps/unix/sysv/linux/csky/Makefile: Likewise. * sysdeps/unix/sysv/linux/csky/Versions: Likewise. * sysdeps/unix/sysv/linux/csky/abiv2/____longjmp_chk.S: Likewise. * sysdeps/unix/sysv/linux/csky/abiv2/clone.S: Likewise. * sysdeps/unix/sysv/linux/csky/abiv2/getcontext.S: Likewise. * sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S: Likewise. * sysdeps/unix/sysv/linux/csky/abiv2/swapcontext.S: Likewise. * sysdeps/unix/sysv/linux/csky/abiv2/syscall.S: Likewise. * sysdeps/unix/sysv/linux/csky/abiv2/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym: Likewise. * sysdeps/unix/sysv/linux/csky/bits/procfs.h: Likewise. * sysdeps/unix/sysv/linux/csky/bits/shmlba.h: Likewise. * sysdeps/unix/sysv/linux/csky/c++-types.data: Likewise. * sysdeps/unix/sysv/linux/csky/configure: Likewise. * sysdeps/unix/sysv/linux/csky/configure.ac: Likewise. * sysdeps/unix/sysv/linux/csky/ipc_priv.h: Likewise. * sysdeps/unix/sysv/linux/csky/jmp_buf-macros.h: Likewise. * sysdeps/unix/sysv/linux/csky/kernel-features.h: Likewise. * sysdeps/unix/sysv/linux/csky/ld.abilist: Likewise. * sysdeps/unix/sysv/linux/csky/ldconfig.h: Likewise. * sysdeps/unix/sysv/linux/csky/libBrokenLocale.abilist: Likewise. * sysdeps/unix/sysv/linux/csky/libanl.abilist: Likewise. * sysdeps/unix/sysv/linux/csky/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/csky/libcrypt.abilist: Likewise. * sysdeps/unix/sysv/linux/csky/libdl.abilist: Likewise. * sysdeps/unix/sysv/linux/csky/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/csky/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/csky/libresolv.abilist: Likewise. * sysdeps/unix/sysv/linux/csky/librt.abilist: Likewise. * sysdeps/unix/sysv/linux/csky/libthread_db.abilist: Likewise. * sysdeps/unix/sysv/linux/csky/libutil.abilist: Likewise. * sysdeps/unix/sysv/linux/csky/localplt.data: Likewise. * sysdeps/unix/sysv/linux/csky/makecontext.c: Likewise. * sysdeps/unix/sysv/linux/csky/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/csky/pt-vfork.S: Likewise. * sysdeps/unix/sysv/linux/csky/register-dump.h: Likewise. * sysdeps/unix/sysv/linux/csky/shlib-versions: Likewise. * sysdeps/unix/sysv/linux/csky/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/csky/sys/cachectl.h: Likewise. * sysdeps/unix/sysv/linux/csky/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/csky/sys/user.h: Likewise. * sysdeps/unix/sysv/linux/csky/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/csky/sysdep.h: Likewise.
* s390: Use generic kernel_sigaction.hAdhemerval Zanella2018-12-181-26/+3
| | | | | | | | | S390 kernel sigaction is the same as the Linux generic one. Checked with a s390-linux-gnu and s390x-linux-gnu build. * sysdeps/unix/sysv/linux/s390/kernel_sigaction.h: Use Linux generic kernel_sigction definition.
* ia64: Remove kernel_sigaction.hAdhemerval Zanella2018-12-181-7/+0
| | | | | | | | | IA64 kernel_sigaction.h definition is the sama as the Linux generic one. Checked on ia64-linux-gnu. * sysdeps/unix/sysv/linux/ia64/kernel_sigaction.h: Remove file.
* hppa: Remove kernel_sigaction.hAdhemerval Zanella2018-12-181-18/+0
| | | | | | | | | HPPA kernel_sigaction.h definition is the sama as the Linux generic one and old_kernel_sigaction is not used. Checked on hppa-linux-gnu. * sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h: Remove file.
* alpha: Use Linux generic sigaction implementationAdhemerval Zanella2018-12-188-115/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Alpha rt_sigaction syscall uses a slight different kernel ABI than generic one: arch/alpha/kernel/signal.c 90 SYSCALL_DEFINE5(rt_sigaction, int, sig, const struct sigaction __user *, act, 91 struct sigaction __user *, oact, 92 size_t, sigsetsize, void __user *, restorer) Similar as sparc, the syscall expects a restorer function. However different than sparc, alpha defines the restorer as the 5th argument (sparc defines as the 4th). This patch removes the arch-specific alpha sigaction implementation, adapt the Linux generic one to different restore placements (through STUB macro), and make alpha use the Linux generic kernel_sigaction definition. Checked on alpha-linux-gnu and x86_64-linux-gnu (for sanity). * sysdeps/unix/sysv/linux/alpha/Makefile: Update comment about __syscall_rt_sigaction. * sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h (kernel_sigaction): Use Linux generic defintion. (STUB): Define. (__syscall_rt_sigreturn, __syscall_sigreturn): Add prototype. * sysdeps/unix/sysv/linux/alpha/rt_sigaction.S (__syscall_rt_sigaction): Remove implementation. (__syscall_sigreturn, __syscall_rt_sigreturn): Define as global and hidden. * sysdeps/unix/sysv/linux/alpha/sigaction.c: Remove file. * sysdeps/unix/sysv/linux/alpha/sysdep.h (INLINE_SYSCALL, INTERNAL_SYSCALL): Remove definitions. * sysdeps/unix/sysv/linux/sigaction.c: Define STUB to accept both the action and signal set size. * sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c (STUB): Redefine. * sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c (STUB): Likewise.
* m68k: Fix sigaction kernel definition (BZ #23960)Adhemerval Zanella2018-12-187-34/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit b4a5d26d883 (linux: Consolidate sigaction implementation) added a wrong kernel_sigaction definition for m68k, meant for __NR_sigaction instead of __NR_rt_sigaction as used on generic Linux sigaction implementation. This patch fixes it by using the Linux generic definition meant for the RT kernel ABI. Checked the signal tests on emulated m68-linux-gnu (Aranym). It fixes the faulty signal/tst-sigaction and man works as expected. Adhemerval Zanella <adhemerval.zanella@linaro.org> James Clarke <jrtc27@jrtc27.com> [BZ #23960] * sysdeps/unix/sysv/linux/kernel_sigaction.h (HAS_SA_RESTORER): Define if SA_RESTORER is defined. (kernel_sigaction): Define sa_restorer if HAS_SA_RESTORER is defined. (SET_SA_RESTORER, RESET_SA_RESTORER): Define iff the macro are not already defined. * sysdeps/unix/sysv/linux/m68k/kernel_sigaction.h (SA_RESTORER, kernel_sigaction, SET_SA_RESTORER, RESET_SA_RESTORER): Remove definitions. (HAS_SA_RESTORER): Define. * sysdeps/unix/sysv/linux/sparc/kernel_sigaction.h (SA_RESTORER, SET_SA_RESTORER, RESET_SA_RESTORER): Remove definition. (HAS_SA_RESTORER): Define. * sysdeps/unix/sysv/linux/nios2/kernel_sigaction.h: Include generic kernel_sigaction after define SET_SA_RESTORER and RESET_SA_RESTORER. * sysdeps/unix/sysv/linux/powerpc/kernel_sigaction.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/sigaction.c: Likewise.
* Remove __ASSUME_ST_INO_64_BIT.Joseph Myers2018-12-187-43/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kernel-features.h has a macro __ASSUME_ST_INO_64_BIT, with a comment "However, SH is lame, and still does not have a 64-bit inode field.". The macro is, in fact, defined to 0 by Alpha as well as SH. The Alpha case is, however, trivially useless: none of the files that test __ASSUME_ST_INO_64_BIT are built for Alpha (which gained kernel support for stat64 syscalls, with a 64-bit st_ino field, in Linux 2.6.4; the define to 0 for Alpha in glibc predates that). The SH kernel gained support for a 64-bit st_ino in struct stat64 in commit 760bcb1deec13c50e20399c84cb6a8ea41cc2820 ("sh: Fix fstatat64() syscall."), which is in Linux 2.6.22 and later. So the redefinition of __ASSUME_ST_INO_64_BIT to 0 is of no use for SH either; three of the files testing it do so immediately after a stat64-family syscall has been used, which will always have set the 64-bit st_ino correctly (in addition to the 32-bit __st_ino), while the relevant code __xstat32_conv executes only after such a syscall in the function calling __xstat32_conv. Thus this patch removes __ASSUME_ST_INO_64_BIT and code testing it. Removing the useless [!__ASSUME_ST_INO_64_BIT] code in __xstat32_conv renders the [_HAVE_STAT64___ST_INO] and [!_HAVE_STAT64___ST_INO] cases around it identical, so that conditional is also removed. Tested compilation with build-many-glibcs.py for its Alpha and SH configurations; also ran the glibc testsuite for x86_64 and x86. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_ST_INO_64_BIT): Remove macro definition. * sysdeps/unix/sysv/linux/alpha/kernel-features.h (__ASSUME_ST_INO_64_BIT): Do not undefine and define. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_ST_INO_64_BIT): Likewise. * sysdeps/unix/sysv/linux/fxstat64.c: Do not include <kernel-features.h>. (___fxstat64) [_HAVE_STAT64___ST_INO && !__ASSUME_ST_INO_64_BIT]: Remove conditional code. * sysdeps/unix/sysv/linux/lxstat64.c: Do not include <kernel-features.h>. (___lxstat64) [_HAVE_STAT64___ST_INO && !__ASSUME_ST_INO_64_BIT]: Remove conditional code. * sysdeps/unix/sysv/linux/xstat64.c: Do not include <kernel-features.h>. (___xstat64) [_HAVE_STAT64___ST_INO && !__ASSUME_ST_INO_64_BIT]: Remove conditional code. * sysdeps/unix/sysv/linux/xstatconv.c: Do not include <kernel-features.h>. (__xstat32_conv) [_HAVE_STAT64___ST_INO]: Remove conditional code. [!_HAVE_STAT64___ST_INO]: Make code unconditional.
* Do not clobber r12 for ia64 syscalls.Joseph Myers2018-12-171-1/+1
| | | | | | | | | | | | | GCC mainline now gives errors for an asm that clobbers the stack pointer. According to <https://gcc.gnu.org/ml/gcc-patches/2018-12/msg00932.html> GCC previously ignored such a clobber; thus, this patch removes it from the clobbers for ia64 syscalls. Tested with build-many-glibcs.py for ia64-linux-gnu. * sysdeps/unix/sysv/linux/ia64/sysdep.h (ASM_CLOBBERS_6_COMMON): Do not clobber r12.
* Add test that MAP_* constants agree with kernel.Joseph Myers2018-12-172-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the process of building up and using Python infrastructure for extracting and using values in headers, this patch adds a test that MAP_* constants from sys/mman.h agree with those in the Linux kernel headers. (Other sys/mman.h constants could be added to the test separately.) This set of constants has grown over time, so the generic code is enhanced to allow saying extra constants are OK on either side of the comparison (where the caller sets those parameters based on the Linux kernel headers version, compared with the version the headers were last updated from). Although the test is a custom Python file, my intention is to move in future to a single Python script for such tests and text files it takes as inputs, once there are enough examples to provide a guide to the common cases in such tests (I'd like to end up with most or all such sets of constants copied from kernel headers having such tests, and likewise for structure layouts from the kernel). The Makefile code is essentially the same as for tst-signal-numbers, but I didn't try to find an object file to depend on to represent the dependency on the headers used by the test (the conform/ tests don't try to represent such header dependencies at all, for example). Tested with build-many-glibcs.py, and also for x86_64 with older kernel headers. * scripts/glibcextract.py (compare_macro_consts): Take parameters to allow extra macros from first or second sources. * sysdeps/unix/sysv/linux/tst-mman-consts.py: New file. * sysdeps/unix/sysv/linux/Makefile [$(subdir) = misc] (tests-special): Add $(objpfx)tst-mman-consts.out. ($(objpfx)tst-mman-consts.out): New makefile target.
* Add statx conditionals for wordsize-32 *xstat.cMao Han2018-12-1713-6/+169
| | | | | | | | | | | | | | | | | | | | | | | Linux kernel have remove stat64 family from default syscall set, new implementations with statx is needed when __ARCH_WANT_STAT64 is not define. This patch add conditionals for relevant functions, using statx system call to get information and then copy to the return buf, ref to include/linux/fs.h from linux kernel. * sysdeps/unix/sysv/linux/Makefile: Add statx_cp.c. * sysdeps/unix/sysv/linux/fxstat64.c: Add conditionals for kernel without stat64 system call support. * sysdeps/unix/sysv/linux/fxstatat64.c: Likewise. * sysdeps/unix/sysv/linux/generic/wordsize-32/fxstat.c: Likewise. * sysdeps/unix/sysv/linux/generic/wordsize-32/fxstatat.c: Likewise. * sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat.c: Likewise. * sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat64.c: Likewise. * sysdeps/unix/sysv/linux/generic/wordsize-32/xstat.c: Likewise. * sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/statx_cp.c: New file. * sysdeps/unix/sysv/linux/statx_cp.c: Likewise. * sysdeps/unix/sysv/linux/statx_cp.h: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/statx_cp.c: Likewise.
* Move tst-signal-numbers to Python.Joseph Myers2018-12-103-90/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch converts the tst-signal-numbers test from shell + awk to Python. As with gen-as-const, the point is not so much that shell and awk are problematic for this code, as that it's useful to build up general infrastructure in Python for use of a range of code involving extracting values from C headers. This patch moves some code from gen-as-const.py to a new glibcextract.py, which also gains functions relating to listing macros, and comparing the values of a set of macros from compiling two different pieces of code. It's not just signal numbers that should have such tests; pretty much any case where glibc copies constants from Linux kernel headers should have such tests that the values and sets of constants agree except where differences are known to be OK. Much the same also applies to structure layouts (although testing those without hardcoding lists of fields to test will be more complicated). Given this patch, another test for a set of macros would essentially be just a call to glibcextract.compare_macro_consts (plus boilerplate code - and we could move to having separate text files defining such tests, like the .sym inputs to gen-as-const, so that only a single Python script is needed for most such tests). Some such tests would of course need new features, e.g. where the set of macros changes in new kernel versions (so you need to allow new macro names on the kernel side if the kernel headers are newer than the version known to glibc, and extra macros on the glibc side if the kernel headers are older). tst-syscall-list.sh could become a Python script that uses common code to generate lists of macros but does other things with its own custom logic. There are a few differences from the existing shell + awk test. Because the new test evaluates constants using the compiler, no special handling is needed any more for one signal name being defined to another. Because asm/signal.h now needs to pass through the compiler, not just the preprocessor, stddef.h is included as well (given the asm/signal.h issue that it requires an externally provided definition of size_t). The previous code defined __ASSEMBLER__ with asm/signal.h; this is removed (__ASSEMBLY__, a different macro, eliminates the requirement for stddef.h on some but not all architectures). Tested for x86_64, and with build-many-glibcs.py. * scripts/glibcextract.py: New file. * scripts/gen-as-const.py: Do not import os.path, re, subprocess or tempfile. Import glibcexctract. (compute_c_consts): Remove. Moved to glibcextract.py. (gen_test): Update reference to compute_c_consts. (main): Likewise. * sysdeps/unix/sysv/linux/tst-signal-numbers.py: New file. * sysdeps/unix/sysv/linux/tst-signal-numbers.sh: Remove. * sysdeps/unix/sysv/linux/Makefile ($(objpfx)tst-signal-numbers.out): Use tst-signal-numbers.py. Redirect stderr as well as stdout.
* Enable VDSO for static linking on mipsRafael Ávila de Espíndola2018-12-105-10/+13
| | | | | | | | | | | | | | | | | I have tested that this builds and the resulting program still work. This was tested on gcc23.fsffrance.org, and for some reason the vdso there seems unused even when using shared libraries. [BZ #19767] * sysdeps/unix/sysv/linux/mips/init-first.c: Remove #ifdef SHARED. * sysdeps/unix/sysv/linux/mips/libc-vdso.h: Remove #ifdef SHARED. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h: Define ALWAYS_USE_VSYSCALL. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h: Define ALWAYS_USE_VSYSCALL. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h: Define ALWAYS_USE_VSYSCALL.
* compat getdents64: Use correct offset for retry [BZ #23972]Florian Weimer2018-12-102-3/+17
| | | | | d_off is the offset of the *next* entry, not the offset of the current entry.
* Move *-le.abilist to le/*.abilistAndreas Schwab2018-12-1026-0/+0
| | | | | Now that powerpc is using separate sysdep dirs for BE vs LE ABI, there is no need for abilist-pattern any more.
* Fix potential stack overflow [BZ #23490]Paul Pluzhnikov2018-12-081-2/+2
| | | | | Since we are expecting the exact "IBT" string, adjust stack buffer size and scanf format accordingly.
* Add getcpuH.J. Lu2018-12-0731-1/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add #include <sched.h> int getcpu (unsigned int *cpu, unsigned int *node); to return currently used CPU and NUMA node. Tested on x86-64, x32 and i686 as well as with build-many-glibcs.py. * NEWS: Mention getcpu. * include/sched.h (__getcpu): New libc_hidden_proto. * manual/resource.texi: Document getcpu. * sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add getcpu. * sysdeps/unix/sysv/linux/Versions (GLIBC_2.29): Add getcpu. * sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add getcpu. * 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/riscv/rv64/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/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/bits/sched.h (getcpu): New prototype. * sysdeps/unix/sysv/linux/getcpu.c: New file. * sysdeps/unix/sysv/linux/tst-skeleton-affinity.c (test_size): Also check getcpu.
* posix: New function posix_spawn_file_actions_addfchdir_np [BZ #17405]Florian Weimer2018-12-0727-0/+31
| | | | | | Along with posix_spawn_file_actions_addchdir, posix_spawn_file_actions_addfchdir is the subject of a change proposal for POSIX: <http://austingroupbugs.net/view.php?id=1208>
* Enable VDSO for static linking on armRafael Ávila de Espíndola2018-12-033-10/+8
| | | | | | | | | | | | I have tested that this builds and the resulting program still work. The kernel in gcc117 (which I ussed for testing) seems to be missing https://patchwork.kernel.org/patch/10060431/, so the vdso is never used. [BZ #19767] * sysdeps/unix/sysv/linux/arm/init-first.c: Remove #ifdef SHARED. * sysdeps/unix/sysv/linux/arm/libc-vdso.h: Remove #ifdef SHARED. * sysdeps/unix/sysv/linux/arm/sysdep.h: Define ALWAYS_USE_VSYSCALL.
* Enable VDSO on i386 statically linked programsRafael Ávila de Espíndola2018-11-302-7/+8
| | | | | | | [BZ #19767] * sysdeps/unix/sysv/linux/i386/init-first.c: Don't check SHARED. * sysdeps/unix/sysv/linux/i386/sysdep.h (ALWAYS_USE_VSYSCALL): New.
* posix: Use posix_spawn on systemAdhemerval Zanella2018-11-306-166/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch uses posix_spawn on system implementation. On Linux this has the advantage of much lower memory consumption (usually 32 Kb minimum for the mmap stack area). Although POSIX does not require, glibc system implementation aims to be thread and cancellation safe. The cancellation code is moved to generic implementation and enabled iff SIGCANCEL is defined (similar on how the cancellation handler is enabled on nptl-init.c). Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Use __sigismember instead of sigismember. * sysdeps/posix/system.c [SIGCANCEL] (cancel_handler_args, cancel_handler): New definitions. (CLEANUP_HANDLER, CLEANUP_RESET): Likewise. (DO_LOCK, DO_UNLOCK, INIT_LOCK, ADD_REF, SUB_REF): Remove. (do_system): Use posix_spawn instead of fork and execl and remove reentracy code. * sysdeps/generic/not-errno.h (__kill_noerrno): New prototype. * sysdeps/unix/sysv/linux/not-errno.h (__kill_noerrno): Likewise. * sysdeps/unix/sysv/linux/ia64/system.c: Remove file. * sysdeps/unix/sysv/linux/s390/system.c: Likewise. * sysdeps/unix/sysv/linux/sparc/system.c: Likewise. * sysdeps/unix/sysv/linux/system.c: Likewise.
* CVE-2018-19591: if_nametoindex: Fix descriptor for overlong name [BZ #23927]Florian Weimer2018-11-271-5/+6
|
* Enable VDSO for static linking on aarch64Rafael Ávila de Espíndola2018-11-273-10/+8
| | | | | | | | [BZ #19767] * sysdeps/unix/sysv/linux/aarch64/init-first.c: Remove #ifdef SHARED. * sysdeps/unix/sysv/linux/aarch64/libc-vdso.h: Remove #ifdef SHARED. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (ALWAYS_USE_VSYSCALL): Define.
* Enable VDSO on powerpc statically linked programs (bug 19767)Rafael Ávila de Espíndola2018-11-264-9/+10
| | | | | | | | | | | | | [BZ #19767] * sysdeps/unix/sysv/linux/powerpc/init-first.c: Remove #ifdef SHARED. * sysdeps/unix/sysv/linux/powerpc/libc-vdso.h: Remove #ifdef SHARED. Include sysdep.h. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Define ALWAYS_USE_VSYSCALL. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Define ALWAYS_USE_VSYSCALL. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* Enable VDSO on x86_64 statically linked programs [BZ #19767]Rafael Ávila de Espíndola2018-11-237-10/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | All the required code already existed, and some of it was already running. AT_SYSINFO_EHDR is processed if NEED_DL_SYSINFO_DSO is defined, but it looks like it always is. The call to setup_vdso is also unconditional, so all that was left to do was setup the function pointers and use them. This patch just deletes some #ifdef to enable that. [BZ #19767] * nptl/Makefile (tests-static): Add tst-cond11-static. (tests): Likewise. * nptl/tst-cond11-static.c: New File. * sysdeps/unix/sysv/linux/Makefile (tests-static): Add tst-affinity-static. (tests): Likewise. * sysdeps/unix/sysv/linux/sysdep-vdso.h: Check USE_VSYSCALL instead of SHARED. * sysdeps/unix/sysv/linux/sysdep.h (ALWAYS_USE_VSYSCALL): New. (USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/tst-affinity-static.c: New file. * sysdeps/unix/sysv/linux/x86/libc-vdso.h: Check USE_VSYSCALL instead of SHARED. * sysdeps/unix/sysv/linux/x86_64/init-first.c: Don't check SHARED. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (ALWAYS_USE_VSYSCALL): New.
* Fix Arm __ASSUME_COPY_FILE_RANGE (bug 23915).Joseph Myers2018-11-231-3/+4
| | | | | | | | | | | | | | | | | The generic kernel-features.h defines __ASSUME_COPY_FILE_RANGE for 4.5 and later kernels. However, for 32-bit Arm binaries running on 64-bit Arm kernels, the syscall was only wired up in the 4.7 kernel, although the 32-bit Arm kernel had the syscall from 4.5 onwards. This patch corrects the Arm kernel-features.h to undefine the macro for configured minimum kernel versions before 4.7. Tested (compilation only) with a build-many-glibcs.py build for arm-linux-gnueabi. [BZ #23915] * sysdeps/unix/sysv/linux/arm/kernel-features.h [__LINUX_KERNEL_VERSION < 0x040700] (__ASSUME_COPY_FILE_RANGE): Undefine.
* Remove the error handling wrapper from powSzabolcs Nagy2018-11-2123-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce new pow symbol version that doesn't do SVID compatible error handling. The standard errno and fp exception based error handling is inline in the new code and does not have significant overhead. The wrapper is disabled for sysdeps/ieee754/dbl-64 by using empty w_pow.c and enabled for targets with their own pow implementation or ifunc dispatch on __ieee754_pow by including math/w_pow.c. The compatibility symbol version still uses the wrapper with SVID error handling around the new code. There is no new symbol version nor compatibility code on !LIBM_SVID_COMPAT targets (e.g. riscv). On targets where previously powl was an alias of pow, now it points to the compatibility symbol with the wrapper, because it still need the SVID compatible error handling. This affects NO_LONG_DOUBLE (e.g. arm) and LONG_DOUBLE_COMPAT (e.g. alpha) targets as well. The __pow_finite symbol is now an alias of pow. Both __pow_finite and pow set errno and thus not const functions. The ia64 asm is changed so the compat and new symbol versions map to the same address. On x86_64 #include <math.h> was added before macro definitions that may affect that header. Tested with build-many-glibcs.py. * math/Versions (GLIBC_2.29): Add pow. * math/w_pow_compat.c (__pow_compat): Change to versioned compat symbol. * math/w_pow.c: New file. * sysdeps/i386/fpu/w_pow.c: New file. * sysdeps/ia64/fpu/e_pow.S: Add versioned symbols. * sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Rename to __pow and add necessary aliases. * sysdeps/ieee754/dbl-64/w_pow.c: New file. * sysdeps/m68k/m680x0/fpu/w_pow.c: New file. * sysdeps/mach/hurd/i386/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Update. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Update. * sysdeps/unix/sysv/linux/arm/libm.abilist: Update. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Update. * sysdeps/unix/sysv/linux/i386/libm.abilist: Update. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Update. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Update. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Update. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Update. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Update. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Update. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Update. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Update. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Update. * sysdeps/unix/sysv/linux/sh/libm.abilist: Update. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Update. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Update. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Update. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Update. * sysdeps/x86_64/fpu/multiarch/e_pow-fma.c (__ieee754_pow): Rename to __pow. * sysdeps/x86_64/fpu/multiarch/e_pow-fma4.c (__ieee754_pow): Likewise. * sysdeps/x86_64/fpu/multiarch/e_pow.c (__ieee754_pow): Likewise. * sysdeps/x86_64/fpu/multiarch/w_pow.c: New file.
* Remove the error handling wrapper from log2Szabolcs Nagy2018-11-2123-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce new log2 symbol version that doesn't do SVID compatible error handling. The standard errno and fp exception based error handling is inline in the new code and does not have significant overhead. The wrapper is disabled for sysdeps/ieee754/dbl-64 by using empty w_log2.c and enabled for targets with their own log2 implementation by including math/w_log2.c. The compatibility symbol version still uses the wrapper with SVID error handling around the new code. There is no new symbol version nor compatibility code on !LIBM_SVID_COMPAT targets (e.g. riscv). On targets where previously log2l was an alias of log2, now it points to the compatibility symbol with the wrapper, because it still need the SVID compatible error handling. This affects NO_LONG_DOUBLE (e.g. arm) and LONG_DOUBLE_COMPAT (e.g. alpha) targets as well. The __log2_finite symbol is now an alias of log2. Both __log2_finite and log2 set errno and thus not const functions. The ia64 asm is changed so the compat and new symbol versions map to the same address. Tested with build-many-glibcs.py. * math/Versions (GLIBC_2.29): Add log2. * math/w_log2_compat.c (__log2_compat): Change to versioned compat symbol. * math/w_log2.c: New file. * sysdeps/i386/fpu/w_log2.c: New file. * sysdeps/ia64/fpu/e_log2.S: Add versioned symbols. * sysdeps/ieee754/dbl-64/e_log2.c (__ieee754_log2): Rename to __log2 and add necessary aliases. * sysdeps/ieee754/dbl-64/w_log2.c: New file. * sysdeps/m68k/m680x0/fpu/w_log2.c: New file. * sysdeps/mach/hurd/i386/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Update. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Update. * sysdeps/unix/sysv/linux/arm/libm.abilist: Update. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Update. * sysdeps/unix/sysv/linux/i386/libm.abilist: Update. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Update. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Update. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Update. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Update. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Update. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Update. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Update. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Update. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Update. * sysdeps/unix/sysv/linux/sh/libm.abilist: Update. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Update. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Update. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Update. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Update.
* Remove the error handling wrapper from logSzabolcs Nagy2018-11-2123-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce new log symbol version that doesn't do SVID compatible error handling. The standard errno and fp exception based error handling is inline in the new code and does not have significant overhead. The wrapper is disabled for sysdeps/ieee754/dbl-64 by using empty w_log.c and enabled for targets with their own log implementation by including math/w_log.c. The compatibility symbol version still uses the wrapper with SVID error handling around the new code. There is no new symbol version nor compatibility code on !LIBM_SVID_COMPAT targets (e.g. riscv). On targets where previously logl was an alias of log, now it points to the compatibility symbol with the wrapper, because it still need the SVID compatible error handling. This affects NO_LONG_DOUBLE (e.g. arm) and LONG_DOUBLE_COMPAT (e.g. alpha) targets as well. The __log_finite symbol is now an alias of log. Both __log_finite and log set errno and thus not const functions. The ia64 asm is changed so the compat and new symbol versions map to the same address. On x86_64 #include <math.h> was added before macro definitions that may affect that header. Tested with build-many-glibcs.py. * math/Versions (GLIBC_2.29): Add log. * math/w_log_compat.c (__log_compat): Change to versioned compat symbol. * math/w_log.c: New file. * sysdeps/i386/fpu/w_log.c: New file. * sysdeps/ia64/fpu/e_log.S: Update. * sysdeps/ieee754/dbl-64/e_log.c (__ieee754_log): Rename to __log and add necessary aliases. * sysdeps/ieee754/dbl-64/w_log.c: New file. * sysdeps/m68k/m680x0/fpu/w_log.c: New file. * sysdeps/mach/hurd/i386/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Update. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Update. * sysdeps/unix/sysv/linux/arm/libm.abilist: Update. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Update. * sysdeps/unix/sysv/linux/i386/libm.abilist: Update. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Update. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Update. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Update. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Update. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Update. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Update. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Update. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Update. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Update. * sysdeps/unix/sysv/linux/sh/libm.abilist: Update. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Update. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Update. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Update. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Update. * sysdeps/x86_64/fpu/multiarch/e_log-avx.c (__ieee754_log): Rename to __log. * sysdeps/x86_64/fpu/multiarch/e_log-fma.c (__ieee754_log): Likewise. * sysdeps/x86_64/fpu/multiarch/e_log-fma4.c (__ieee754_log): Likewise. * sysdeps/x86_64/fpu/multiarch/e_log.c (__ieee754_log): Likewise. * sysdeps/x86_64/fpu/multiarch/w_log.c: New file.
* Remove the error handling wrapper from exp and exp2Szabolcs Nagy2018-11-2123-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce new exp and exp2 symbol version that don't do SVID compatible error handling. The standard errno and fp exception based error handling is inline in the new code and does not have significant overhead. The double precision wrappers are disabled for sysdeps/ieee754/dbl-64 by using empty w_exp.c and w_exp2.c files, the math/w_exp.c and math/w_exp2.c files use the wrapper template and can be included by targets that have their own exp and exp2 implementations or use ifunc on the glibc internal __ieee754_exp symbol. The compatibility symbol versions still use the wrapper with SVID error handling around the new code. There is no new symbol version nor compatibility code on !LIBM_SVID_COMPAT targets (e.g. riscv). On targets where previously expl and exp2l were aliases of exp and exp2, now they point to the compatibility symbols with the wrapper, because they still need the SVID compatible error handling. This affects NO_LONG_DOUBLE (e.g arm) and LONG_DOUBLE_COMPAT (e.g. alpha) targets as well. The _finite symbols are now aliases of the standard symbols (they have no performance advantage anymore). Both the standard symbols and _finite symbols set errno and thus not const functions. The ia64 asm is changed so the compat and new symbol versions map to the same address. On x86_64 #include <math.h> was added before macro definitions that may affect that header (the new macro name is __exp instead of __ieee754_exp which breaks some math.h macros). Tested with build-many-glibcs.py. * math/Versions (GLIBC_2.29): Add exp and exp2. * math/w_exp2_compat.c (__exp2_compat): Change to versioned compat symbol, handle NO_LONG_DOUBLE and LONG_DOUBLE_COMPAT explicitly. * math/w_exp_compat.c (__exp_compat): Likewise. * math/w_exp.c: New file. * math/w_exp2.c: New file. * sysdeps/i386/fpu/w_exp.c: New file. * sysdeps/i386/fpu/w_exp2.c: New file. * sysdeps/ia64/fpu/e_exp.S: Add versioned symbols. * sysdeps/ia64/fpu/e_exp2.S: Likewise. * sysdeps/ieee754/dbl-64/e_exp.c (__ieee754_exp): Rename to __exp and add necessary aliases. * sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Rename to __exp2 and add necessary aliases. * sysdeps/ieee754/dbl-64/w_exp.c: New file. * sysdeps/ieee754/dbl-64/w_exp2.c: New file. * sysdeps/m68k/m680x0/fpu/w_exp.c: New file. * sysdeps/m68k/m680x0/fpu/w_exp2.c: New file. * sysdeps/mach/hurd/i386/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Update. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Update. * sysdeps/unix/sysv/linux/arm/libm.abilist: Update. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Update. * sysdeps/unix/sysv/linux/i386/libm.abilist: Update. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Update. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Update. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Update. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Update. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Update. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Update. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Update. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Update. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Update. * sysdeps/unix/sysv/linux/sh/libm.abilist: Update. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Update. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Update. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Update. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Update. * sysdeps/x86_64/fpu/multiarch/e_exp-avx.c (__exp1): Remove. (__ieee754_exp): Rename to __exp. * sysdeps/x86_64/fpu/multiarch/e_exp-fma.c (__exp1): Remove. (__ieee754_exp): Rename to __exp. * sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c (__exp1): Remove. (__ieee754_exp): Rename to __exp. * sysdeps/x86_64/fpu/multiarch/e_exp.c (__ieee754_exp): Rename to __exp. * sysdeps/x86_64/fpu/multiarch/w_exp.c: New file.
* Remove __ASSUME_SOCKETCALL.Joseph Myers2018-11-088-25/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The __ASSUME_SOCKETCALL macro in kernel-features.h is no longer used for anything. (It used to be used in defining other macros related to accept4 / recvmmsg / sendmmsg availability, but the code in that area was simplified once we could assume a kernel with those features, whether through a syscall or through socketcall, so allowing those functions to be handled much like other socket operations, without requring __ASSUME_SOCKETCALL.) This patch removes that unused macro. (Note: once we can assume a Linux 4.4 or later kernel, much of the support for using socketcall at all can be removed from glibc, although a few functions may need that support in glibc for longer.) Tested with build-many-glibcs.py. * sysdeps/unix/sysv/linux/kernel-features.h: Remove comment about __ASSUME_SOCKETCALL. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_SOCKETCALL): Remove. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_SOCKETCALL): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_SOCKETCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_SOCKETCALL): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_SOCKETCALL): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_SOCKETCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_SOCKETCALL): Likewise.
* Fix __ASSUME_MLOCK2 for ARM, MicroBlaze (bug 23867).Joseph Myers2018-11-072-0/+12
| | | | | | | | | | | | | | | | | | The generic kernel-features.h defines __ASSUME_MLOCK2 for 4.4 and later kernels. However, for 32-bit ARM binaries running on 64-bit ARM kernels, and for MicroBlaze, the syscall was only wired up in the 4.7 kernel. (32-bit ARM kernels did have the syscall from 4.4 onwards.) This patch duly arranges for the macro to be undefined for those architectures for kernels before 4.7. Tested with build-many-glibcs.py for its ARM and MicroBlaze configurations. [BZ #23867] * sysdeps/unix/sysv/linux/arm/kernel-features.h [__LINUX_KERNEL_VERSION < 0x040700] (__ASSUME_MLOCK2): Undefine. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h [__LINUX_KERNEL_VERSION < 0x040700] (__ASSUME_MLOCK2): Undefine.
* RISC-V: don't assume PI mutexes and robust futexes before 4.20 (bug 23864)Andreas Schwab2018-11-071-0/+5
| | | | Support for futex_cmpxchg as only been added to 4.20-rc1.
* Correct SH kernel-features.h undefines (bug 23862).Joseph Myers2018-11-061-1/+4
| | | | | | | | | | | | | | | | | | The SH kernel-features.h undefines __ASSUME_RENAMEAT2 for kernel versions before 4.8, but fails to undefine __ASSUME_EXECVEAT, __ASSUME_MLOCK2 and __ASSUME_COPY_FILE_RANGE, although all those syscalls (and several others) were added for SH in the same Linux kernel commit (first released in 4.8). This patch adds the proper undefines of those macros. Tested with build-many-glibcs.py for its SH configurations. [BZ #23862] * sysdeps/unix/sysv/linux/sh/kernel-features.h [__LINUX_KERNEL_VERSION < 0x040800] (__ASSUME_EXECVEAT): Undefine. [__LINUX_KERNEL_VERSION < 0x040800] (__ASSUME_MLOCK2): Likewise. [__LINUX_KERNEL_VERSION < 0x040800] (__ASSUME_COPY_FILE_RANGE): Likewise.
* posix: New function posix_spawn_file_actions_addchdir_np [BZ #17405]Florian Weimer2018-11-0627-0/+31
|
* Update and correct SPARC configuration for supported socket syscalls (bug ↵Joseph Myers2018-11-012-4/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 23848). Looking at kernel-features.h files, I saw that SPARC was missing full information on when it gained separate socket syscalls. This patch adds such information to the SPARC kernel-features.h. It also corrects what appear to be bugs in the existing code (that would cause syscalls to be assumed to be present when not actually present). Various __ASSUME_* macros, defined by default, were not undefined for 32-bit despite those syscalls only being added for 32-bit in Linux 4.4. Some syscalls were used in the SPARC64 syscalls.list but only added in 4.4; this was harmless before the __NR_* macros were defined at all, but once the macros were defined it means a build with post-4.4 headers would assume the syscalls to be present regardless of --enable-kernel version. Then, various __ASSUME_* macros were previously not defined in cases where they could be defined (this part of the patch is just an optimization, not a bug fix). Note the observation in a comment in the patch that even the latest Linux kernel for SPARC does not have getpeername and getsockname syscalls in the compat syscall table for 32-bit binaries on 64-bit kernels (so glibc can't assume those syscalls to be present for 32-bit at all, although the 32-bit syscall table gained them in 4.4). Tested (compilation only) for SPARC with build-many-glibcs.py. [BZ #23848] * sysdeps/unix/sysv/linux/sparc/kernel-features.h [!__arch64__ && __LINUX_KERNEL_VERSION < 0x040400] (__ASSUME_SENDMSG_SYSCALL): Undefine. [!__arch64__ && __LINUX_KERNEL_VERSION < 0x040400] (__ASSUME_RECVMSG_SYSCALL): Likewise. [!__arch64__ && __LINUX_KERNEL_VERSION < 0x040400] (__ASSUME_SENDTO_SYSCALL): Likewise. [!__arch64__ && __LINUX_KERNEL_VERSION < 0x040400] (__ASSUME_ACCEPT_SYSCALL): Undefine under this condition, not just [!__arch64__]. [!__arch64__ && __LINUX_KERNEL_VERSION < 0x040400] (__ASSUME_CONNECT_SYSCALL): Likewise. [!__arch64__ && __LINUX_KERNEL_VERSION < 0x040400] (__ASSUME_RECVFROM_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040400] (__ASSUME_BIND_SYSCALL): Define. [__LINUX_KERNEL_VERSION >= 0x040400] (__ASSUME_LISTEN_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040400] (__ASSUME_SETSOCKOPT_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list (bind): Remove. (listen): Likewise. (setsockopt): Likewise.
* Simplify an #if #else #endifRafael Avila de Espindola2018-10-311-19/+10
| | | | | | | | | The #else of two nested #if clauses were identical. * sysdeps/unix/sysv/linux/sysdep-vdso.h: Simplify an #if #else #endif. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* Add IN_MASK_CREATE from Linux 4.19 to sys/inotify.h.Joseph Myers2018-10-251-0/+1
| | | | | | | | | | This patch adds the IN_MASK_CREATE macro from Linux 4.19 to sys/inotify.h. Tested for x86_64. * sysdeps/unix/sysv/linux/sys/inotify.h (IN_MASK_CREATE): New macro.
* conform: XFAIL siginfo_t si_band test on sparc64Florian Weimer2018-10-252-1/+11
| | | | | We can use long int on sparcv9, but on sparc64, we must match the int type used by the kernel (and not long int, as in POSIX).
* Y2038: provide size of default time_t for target architectureAlbert ARIBAUD (3ADEV)2018-10-2415-68/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To determine whether the default time_t interfaces are 32-bit and so need conversions, or are 64-bit and so are compatible with the internal 64-bit type without conversions, a macro giving the size of the default time_t is also required. This macro is called __TIMESIZE. This macro can then be used instead of __WORDSIZE in msq-pad.h and shm-pad.h files, which in turn allows removing their x86 variants, and in sem-pad.h files but keeping the x86 variant. This patch was tested by running 'make check' on branch master then applying this patch and running 'make check' again, and checking that both 'make check' yield identical results. This was done on x86_64-linux-gnu and i686-linux-gnu. * bits/timesize.h: New file. * stdlib/Makefile (headers): Add bits/timesize.h. * sysdeps/unix/sysv/linux/bits/msq-pad.h (__MSQ_PAD_AFTER_TIME): Use __TIMESIZE instead of __WORDSIZE. * sysdeps/unix/sysv/linux/bits/sem-pad.h (__SEM_PAD_AFTER_TIME): Likewise. * sysdeps/unix/sysv/linux/bits/shm-pad.h (__SHM_PAD_AFTER_TIME): Likewise. * sysdeps/unix/sysv/linux/hppa/bits/msq-pad.h (__MSQ_PAD_BEFORE_TIME): Likewise. * sysdeps/unix/sysv/linux/hppa/bits/sem-pad.h (__SEM_PAD_BEFORE_TIME): Likewise. * sysdeps/unix/sysv/linux/hppa/bits/shm-pad.h (__SHM_PAD_BEFORE_TIME, __SHM_PAD_BETWEEN_TIME_AND_SEGSZ): Likewise. * sysdeps/unix/sysv/linux/mips/bits/msq-pad.h (__MSQ_PAD_AFTER_TIME, __MSQ_PAD_BEFORE_TIME): Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/msq-pad.h (__MSQ_PAD_BEFORE_TIME): Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/sem-pad.h (__SEM_PAD_BEFORE_TIME): Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/shm-pad.h (__SHM_PAD_BEFORE_TIME, __SHM_PAD_BETWEEN_TIME_AND_SEGSZ): Likewise. * sysdeps/unix/sysv/linux/sparc/bits/msq-pad.h (__MSQ_PAD_BEFORE_TIME): Likewise. * sysdeps/unix/sysv/linux/sparc/bits/sem-pad.h (__SEM_PAD_BEFORE_TIME): Likewise. * sysdeps/unix/sysv/linux/sparc/bits/shm-pad.h (__SHM_PAD_BEFORE_TIME): Likewise. * sysdeps/unix/sysv/linux/x86/bits/msq-pad.h: Delete file. * sysdeps/unix/sysv/linux/x86/bits/shm-pad.h: Likewise. * sysdeps/unix/sysv/linux/x86/bits/timesize.h: New file.
* Don't use PSEUDO_END for non-PSEUDO functionAndreas Schwab2018-10-231-2/+2
|
* Update kernel version in syscall-names.list to 4.19.Joseph Myers2018-10-221-2/+2
| | | | | | | | | | | Linux 4.19 does not add any new syscalls (some existing ones are added to more architectures); this patch updates the version number in syscall-names.list to reflect that it's still current for 4.19. Tested with build-many-glibcs.py. * sysdeps/unix/sysv/linux/syscall-names.list: Update kernel version to 4.19.
* signal: Use correct type for si_band in siginfo_t [BZ #23562]Ilya Yu. Malakhov2018-10-191-1/+1
|
* Add VDSO support to sparc.David S. Miller2018-10-185-0/+98
| | | | | | | | | | | | | * sysdeps/unix/sysv/linux/sparc/init-first.c: New file. * sysdeps/unix/sysv/linux/sparc/libc-vdso.h: New file. * sysdeps/unix/sysv/linux/sparc/Makefile: Add dl-vdso to sysdep_routines in subdir elf. * sysdeps/unix/sysv/linux/sparc/Versions: Add GLIBC_PRIVATE version for __vdso_clock_gettime. * sysdeps/unix/sysv/linux/sparc/sysdep.h (INTERNAL_VSYSCALL_CALL): Define. (HAVE_CLOCK_GETTIME_VSYSCALL): Define. (HAVE_GETTIMEOFDAY_VSYSCALL): Define.
* Use single bits/shm.h for all architectures.Joseph Myers2018-10-1713-552/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After my patch to move SHMLBA to its own header, the bits/shm.h headers for architectures using the Linux kernel still vary in a few ways: the use of __syscall_ulong_t; whether padding for 32-bit systems is present before or after time fields, or missing altogether (mips, x32); whether shm_segsz is before or after the time fields; whether, if after time fields, there is extra padding before shm_segsz. This patch arranges for a single header to be used. __syscall_ulong_t is safe to use everywhere, while bits/shm-pad.h is added with new macros __SHM_PAD_AFTER_TIME, __SHM_PAD_BEFORE_TIME, __SHM_SEGSZ_AFTER_TIME and __SHM_PAD_BETWEEN_TIME_AND_SEGSZ to describe the differences. Tested for x86_64 and x86, and with build-many-glibcs.py. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add bits/shm-pad.h. * sysdeps/unix/sysv/linux/bits/shm.h: Include <bits/shm-pad.h>. (shmatt_t): Define as __syscall_ulong_t. (__SHM_PAD_TIME): New macro, depending on [__SHM_PAD_BEFORE_TIME] and [__SHM_PAD_AFTER_TIME]. (struct shmid_ds): Define time fields using __SHM_PAD_TIME. Define shm_segsz and associated padding based on [__SHM_SEGSZ_AFTER_TIME] and [__SHM_PAD_BETWEEN_TIME_AND_SEGSZ]. Use __syscall_ulong_t instead of unsigned long int. [__USE_MISC] (struct shminfo): Use __syscall_ulong_t instead of unsigned long int. [__USE_MISC] (struct shm_info): Likewise. * sysdeps/unix/sysv/linux/bits/shm-pad.h: New file. * sysdeps/unix/sysv/linux/hppa/bits/shm-pad.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/shm-pad.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/shm-pad.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/shm-pad.h: Likewise. * sysdeps/unix/sysv/linux/x86/bits/shm-pad.h: Likewise. * sysdeps/unix/sysv/linux/hppa/bits/shm.h: Remove. * sysdeps/unix/sysv/linux/mips/bits/shm.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/shm.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/shm.h: Likewise. * sysdeps/unix/sysv/linux/x86/bits/shm.h: Likewise.
* Move SHMLBA to its own header.Joseph Myers2018-10-1717-325/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One difference between bits/shm.h headers for architectures using the Linux kernel is the definition of SHMLBA. This was noted in <https://sourceware.org/ml/libc-alpha/2018-09/msg00175.html> as a reason why even a new architecture (C-SKY) might need its own bits/shm.h; thus, splitting it out of bits/shm.h can allow less duplication of headers for new architectures. This patch moves that definition to its own header, bits/shmlba.h, to allow more sharing of headers between architectures. That move allows the arm, ia64 and sh variants of bits/shm.h to be removed, as they had no other significant differences from the generic bits/shm.h; powerpc and x86 have their own bits/shm.h but do not need to get their own bits/shmlba.h because they use the same SHMLBA as the generic header. Other architectures with their own bits/shm.h get their own bits/shmlba.h without being able to remove their own bits/shm.h until the generic one has been adapted to be able to handle more architectures (where, in addition to the differences seen for bits/msq.h and bits/sem.h, the position of shm_segsz in struct shmid_ds also depends on the architecture). Tested for x86_64 and x86, and with build-many-glibcs.py. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add bits/shmlba.h. * sysdeps/unix/sysv/linux/bits/shm.h: Include <bits/shmlba.h>. (SHMLBA): Remove macro. (__getpagesize): Remove function declaration. * sysdeps/unix/sysv/linux/hppa/bits/shm.h: Include <bits/shmlba.h>. (SHMLBA): Remove macro. * sysdeps/unix/sysv/linux/mips/bits/shm.h: Include <bits/shmlba.h>. (SHMLBA): Remove macro. * sysdeps/unix/sysv/linux/powerpc/bits/shm.h: Include <bits/shmlba.h>. (SHMLBA): Remove macro. (__getpagesize): Remove function declaration. * sysdeps/unix/sysv/linux/sparc/bits/shm.h: Include <bits/shmlba.h>. (SHMLBA): Remove macro. (__getshmlba): Remove function declaration. * sysdeps/unix/sysv/linux/x86/bits/shm.h: Include <bits/shmlba.h>. (SHMLBA): Remove macro. (__getpagesize): Remove function declaration. * sysdeps/unix/sysv/linux/arm/bits/shm.h: Remove file. * sysdeps/unix/sysv/linux/ia64/bits/shm.h: Likewise. * sysdeps/unix/sysv/linux/sh/bits/shm.h: Likewise. * sysdeps/unix/sysv/linux/bits/shmlba.h: New file. * sysdeps/unix/sysv/linux/arm/bits/shmlba.h: Likewise. * sysdeps/unix/sysv/linux/hppa/bits/shmlba.h: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/shmlba.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/shmlba.h: Likewise. * sysdeps/unix/sysv/linux/sh/bits/shmlba.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/shmlba.h: Likewise.
* Fix race in pthread_mutex_lock while promoting to PTHREAD_MUTEX_ELISION_NP ↵Stefan Liebler2018-10-173-12/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [BZ #23275] The race leads either to pthread_mutex_destroy returning EBUSY or triggering an assertion (See description in bugzilla). This patch is fixing the race by ensuring that the elision path is used in all cases if elision is enabled by the GLIBC_TUNABLES framework. The __kind variable in struct __pthread_mutex_s is accessed concurrently. Therefore we are now using the atomic macros. The new testcase tst-mutex10 is triggering the race on s390x and intel. Presumably also on power, but I don't have access to a power machine with lock-elision. At least the code for power is the same as on the other two architectures. ChangeLog: [BZ #23275] * nptl/tst-mutex10.c: New File. * nptl/Makefile (tests): Add tst-mutex10. (tst-mutex10-ENV): New variable. * sysdeps/unix/sysv/linux/s390/force-elision.h: (FORCE_ELISION): Ensure that elision path is used if elision is available. * sysdeps/unix/sysv/linux/powerpc/force-elision.h (FORCE_ELISION): Likewise. * sysdeps/unix/sysv/linux/x86/force-elision.h: (FORCE_ELISION): Likewise. * nptl/pthreadP.h (PTHREAD_MUTEX_TYPE, PTHREAD_MUTEX_TYPE_ELISION) (PTHREAD_MUTEX_PSHARED): Use atomic_load_relaxed. * nptl/pthread_mutex_consistent.c (pthread_mutex_consistent): Likewise. * nptl/pthread_mutex_getprioceiling.c (pthread_mutex_getprioceiling): Likewise. * nptl/pthread_mutex_lock.c (__pthread_mutex_lock_full) (__pthread_mutex_cond_lock_adjust): Likewise. * nptl/pthread_mutex_setprioceiling.c (pthread_mutex_setprioceiling): Likewise. * nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock): Likewise. * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): Likewise. * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_full): Likewise. * sysdeps/nptl/bits/thread-shared-types.h (struct __pthread_mutex_s): Add comments. * nptl/pthread_mutex_destroy.c (__pthread_mutex_destroy): Use atomic_load_relaxed and atomic_store_relaxed. * nptl/pthread_mutex_init.c (__pthread_mutex_init): Use atomic_store_relaxed.
* Use single bits/sem.h for all architectures.Joseph Myers2018-10-1513-460/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bits/sem.h headers for architectures using the Linux kernel vary in a few ways: * x32 uses __syscall_ulong_t instead of unsigned long int. * The x86 header uses padding after time fields unconditionally (including for both x86_64 ABIs), not just for 32-bit time (unlike in msqid_ds where there is only padding for 32-bit time). Because this padding is present for x32, and is __syscall_ulong_t there, it does have to be __syscall_ulong_t, not unsigned long int. * The MIPS header never uses padding around time fields, even when 32-bit (unlike in msqid_ds where it has endian-dependent padding for 32-bit time). * Some older 32-bit big-endian architectures have padding before rather than after time fields, although the preferred generic approach is padding after the time fields independent of endianness. (There are also insubstantial differences such as use of unsigned int for padding instead of unsigned long int, which makes no difference to layout since the padding fields using unsigned int are only present on 32-bit architectures.) For the first, __syscall_ulong_t can be used in the generic version as it's the same as unsigned long int everywhere except x32. For the other differences, this patch adds macros __SEM_PAD_BEFORE_TIME and __SEM_PAD_AFTER_TIME in a new bits/sem-pad.h header, so that header is the only one needing to be provided on architectures with differences in this area, and everything else can go in a single common bits/sem.h header. Tested for x86_64 and x86, and with build-many-glibcs.py. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add bits/sem-pad.h. * sysdeps/unix/sysv/linux/bits/sem.h: Include <bits/sem-pad.h> instead of <bits/wordsize.h>. (__SEM_PAD_TIME): New macro, depending on [__SEM_PAD_BEFORE_TIME] and [__SEM_PAD_AFTER_TIME]. (struct semid_ds): Define time fields using __SEM_PAD_TIME. Use __syscall_ulong_t instead of unsigned long int. * sysdeps/unix/sysv/linux/bits/sem-pad.h: New file. * sysdeps/unix/sysv/linux/hppa/bits/sem-pad.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/sem-pad.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/sem-pad.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/sem-pad.h: Likewise. * sysdeps/unix/sysv/linux/x86/bits/sem-pad.h: Likewise. * sysdeps/unix/sysv/linux/hppa/bits/sem.h: Remove. * sysdeps/unix/sysv/linux/mips/bits/sem.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/sem.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/sem.h: Likewise. * sysdeps/unix/sysv/linux/x86/bits/sem.h: Likewise.
* Use single bits/msq.h for all architectures.Joseph Myers2018-10-1113-449/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bits/msq.h headers for architectures using the Linux kernel vary in a few ways: * x32 uses __syscall_ulong_t instead of unsigned long int. * x32 has 64-bit time_t, so no padding around time fields despite __WORDSIZE == 32. * Some older 32-bit big-endian architectures have padding before rather than after time fields, although the preferred generic approach is padding after the time fields independent of endianness. (There are also insubstantial differences such as use of unsigned int for padding instead of unsigned long int, which makes no difference to layout since the padding fields using unsigned int are only present on 32-bit architectures.) For the first, __syscall_ulong_t can be used in the generic version as it's the same as unsigned long int everywhere except x32. For the other two differences, this patch adds macros __MSQ_PAD_BEFORE_TIME and __MSQ_PAD_AFTER_TIME in a new bits/msq-pad.h header, so that header is the only one needing to be provided on architectures with differences in this area, and everything else can go in a single common bits/msq.h header. Once we have __TIMESIZE, the generic bits/msq-pad.h can change to use that instead of __WORDSIZE, at which point the x86 version of bits/msq-pad.h won't be needed either. Tested for x86_64 and x86, and with build-many-glibcs.py. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add bits/msq-pad.h. * sysdeps/unix/sysv/linux/bits/msq.h: Include <bits/msq-pad.h> instead of <bits/wordsize.h>. (msgqnum_t): Define as __syscall_ulong_t. (msglen_t): Likewise. (__MSQ_PAD_TIME): New macro, depending on [__MSQ_PAD_BEFORE_TIME] and [__MSQ_PAD_AFTER_TIME]. (struct msqid_ds): Define time fields using __MSQ_PAD_TIME. Use __syscall_ulong_t instead of unsigned long int. * sysdeps/unix/sysv/linux/bits/msq-pad.h: New file. * sysdeps/unix/sysv/linux/hppa/bits/msq-pad.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/msq-pad.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/msq-pad.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/msq-pad.h: Likewise. * sysdeps/unix/sysv/linux/x86/bits/msq-pad.h: Likewise. * sysdeps/unix/sysv/linux/hppa/bits/msq.h: Remove. * sysdeps/unix/sysv/linux/mips/bits/msq.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/msq.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/msq.h: Likewise. * sysdeps/unix/sysv/linux/x86/bits/msq.h: Likewise.