about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/sparc
Commit message (Collapse)AuthorAgeFilesLines
* ipc: Refactor sysvipc internal definitionsAdhemerval Zanella2019-10-172-14/+8
| | | | | | | | | | | | | | | | | | | | | | | This patch refactor the internal sysvipc in two main points: 1. Add a new __ASSUME_SYSVIPC_DEFAULT_IPC_64 to infer the __IPC_64 value to be used along either the multiplexed __NR_ipc or wired-up syscall. The defaut value assumed for __IPC_64 is also changed from 0x100 to 0x0, aligning with Linux generic UAPI. The idea is to simplify the Linux 5.1 wire-up for sysvipc syscalls for some 32-bit ABIs (which expectes __IPC_64 being 0x0) and simplify new ports (which will no longer need to add ipc_priv.h). 2. It also removes some duplicated internal definition used on compat sysvipc symbols defined at ipc_priv.h (more specifically the __old_ipc_perm, SEMCTL_ARG_ADDRESS, MSGRCV_ARGS, and SEMTIMEDOP_IPC_ARGS). The idea is also to make it simpler to enable the new wire-up sysvipc syscall provided by Linux v5.1. There is no semantic change expected on any port. Checked with a build against all affected ABIs. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Add PTRACE_GET_SYSCALL_INFO from Linux 5.3 to sys/ptrace.h.Joseph Myers2019-10-141-1/+5
| | | | | | | | | | | | | Linux 5.3 adds a PTRACE_GET_SYSCALL_INFO constant, with an associated structure and PTRACE_SYSCALL_INFO_* constants. This patch adds these to sys/ptrace.h in glibc (PTRACE_GET_SYSCALL_INFO in each architecture version, the rest in bits/ptrace-shared.h). As with previous such constants and associated structures, the glibc version of the structure is named struct __ptrace_syscall_info. Tested for x86_64, and with build-many-glibcs.py.
* sysvipc: Set ipc_perm mode as mode_t (BZ#18231)Adhemerval Zanella2019-10-101-28/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch sets the mode field in ipc_perm as mode_t for all architectures, as POSIX specification [1]. The changes required are as follow: 1. It moves the ipc_perm definition out of ipc.h to its own header ipc_perm.h. It also allows consolidate the IPC_* definition on only one header. 2. The generic implementation follow the kernel ipc64_perm size so the syscall can be made directly without temporary buffer copy. However, since glibc defines the MODE field as mode_t, it omits the __PAD1 field (since glibc does not export mode_t as 16-bit for any architecture). It is a two-fold improvement: 2.1. New implementation which follow Linux UAPI will not need to provide an arch-specific ipc-perm.h header neither wrongly use the wrong 16-bit definition from previous default ipc.h (as csky did). 2.1. It allows consolidate ipc_perm definition for architectures that already provide mode_t as 32-bit. 3. All kernel ABIs for the supported architectures already provides the expected padding for mode type extension to 32-bit. However, some architectures the padding has the wrong placement, so it requires the ipc control routines (msgctl, semctl, and shmctl) to adjust the mode field accordingly. Currently they are armeb, microblaze, m68k, s390, and sheb. A new assume is added, __ASSUME_SYSVIPC_BROKEN_MODE_T, which the required ABIs define. 4. For the ABIs that define __ASSUME_SYSVIPC_BROKEN_MODE_T, it also require compat symbols that do not adjust the mode field. Checked on arm-linux-gnueabihf, aarch64-linux-gnu, powerpc64le-linux-gnu, and x86_64-linux-gnu. I also checked the sysvipc tests on hppa-linux-gnu, sh4-linux-gnu, s390x-linux-gnu, and s390-linux-gnu. I also did a sanity test against armeb qemu usermode for the sysvipc tests. [BZ #18231] * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add bits/ipc-perm.h. * sysdeps/unix/sysv/linux/aarch64/bits/ipc.h: Remove file. * sysdeps/unix/sysv/linux/alpha/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/hppa/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/s390/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/arm/kernel-features.h [__BYTE_ORDER == __BIG_ENDIAN] (__ASSUME_SYSVIPC_BROKEN_MODE_T): Define. * sysdeps/sysv/linux/microblaze/kernel-features.h: Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h [!__s390x__] (__ASSUME_SYSVIPC_BROKEN_MODE_T): Define. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_SYSVIPC_BROKEN_MODE_T): Define. * sysdeps/unix/sysv/linux/m68k/kernel-features.h: Likewise. * sysdeps/unix/sysv/linux/bits/ipc-perm.h: New file. * sysdeps/unix/sysv/linux/powerpc/bits/ipc-perm.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/ipc-perm.h: Likewise. * sysdeps/unix/sysv/linux/bits/ipc.h (ipc_perm): Move to bits/ipc-perm.h. * sysdeps/unix/sysv/linux/hppa/bits/ipc-perm.h: New file. * sysdeps/unix/sysv/linux/kernel-features.h: Add comment about __ASSUME_SYSVIPC_BROKEN_MODE_T semantic. * sysdeps/unix/sysv/linux/msgctl.c (DEFAULT_VERSION): Define as 2.31 if __ASSUME_SYSVIPC_BROKEN_MODE_T is defined. (msgctl_syscall, __msgctl_mode16): New symbol. (__new_msgctl): Add bits for __ASSUME_SYSVIPC_BROKEN_MODE_T. * sysdeps/unix/sysv/linux/semctl.c: Likewise. * sysdeps/unix/sysv/linux/shmctl.c: Likewise. * sysdeps/unix/sysv/linux/arm/be/libc.abilist (GLIBC_2.31): Add msgctl, semctl, and shmctl. * sysdeps/sysv/linux/microblaze/be/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/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/be/libc.abilist: Likewise. * conform/data/sys/ipc.h-data: Only xfail {struct ipc_perm} mode_t mode for Hurd. * sysdeps/unix/sysv/linux/m68k/Versions (libc) [GLIBC_2.31]: Add msgctl, semctl, and shmctl. * sysdeps/unix/sysv/linux/arm/be/Versions: New file. * sysdeps/unix/sysv/linux/microblaze/be/Versions: Likewise. * sysdeps/unix/sysv/linux/sh/be/Versions: Likewise. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_ipc.h.html
* nptl: Move pthread_attr_setschedparam implementation into libcFlorian Weimer2019-10-072-2/+0
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_attr_getschedparam implementation into libcFlorian Weimer2019-10-072-2/+0
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_attr_setinheritsched implementation into libc.Florian Weimer2019-10-042-2/+0
| | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html>
* Update bits/mman.h constants and tst-mman-consts.py for Linux 5.3.Joseph Myers2019-09-301-0/+2
| | | | | | | | | | | | | | | | | | The Linux 5.3 uapi headers have some rearrangement relating to MAP_* constants, which includes the effect of adding definitions of MAP_SYNC on powerpc and sparc. This patch updates the corresponding glibc bits/mman.h headers accordingly, and updates the Linux kernel version number in tst-mman-consts.py to reflect that these constants are now current with that kernel version. Tested with build-many-glibcs.py. * sysdeps/unix/sysv/linux/powerpc/bits/mman.h [__USE_MISC] (MAP_SYNC): New macro. * sysdeps/unix/sysv/linux/sparc/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/tst-mman-consts.py (main): Update Linux kernel version number to 5.3.
* sparc64: Use linux generic time implementationAdhemerval Zanella2019-09-171-1/+0
| | | | | | | | | | There is no need to sparc64 provide an arch-specific implementation to route to POSIX one (which uses gettimeofday). Linux one already handles the case for architecture that does not have __NR_time. No semantic changes, checked against a build for sparc64-linux-gnu. * sysdeps/unix/sysv/linux/sparc/sparc64/time.c: Remove file.
* Refactor vDSO initialization codeAdhemerval Zanella2019-09-173-73/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux vDSO initialization code the internal function pointers require a lot of duplicated boilerplate over different architectures. This patch aims to simplify not only the code but the required definition to enable a vDSO symbol. The changes are: 1. Consolidate all init-first.c on only one implementation and enable the symbol based on HAVE_*_VSYSCALL existence. 2. Set the HAVE_*_VSYSCALL to the architecture expected names string. 3. Add a new internal implementation, get_vdso_mangle_symbol, which returns a mangled function pointer. Currently the clock_gettime, clock_getres, gettimeofday, getcpu, and time are handled in an arch-independent way, powerpc still uses some arch-specific vDSO symbol handled in a specific init-first implementation. Checked on aarch64-linux-gnu, arm-linux-gnueabihf, i386-linux-gnu, mips64-linux-gnu, powerpc64le-linux-gnu, s390x-linux-gnu, sparc64-linux-gnu, and x86_64-linux-gnu. * sysdeps/powerpc/powerpc32/backtrace.c (is_sigtramp_address, is_sigtramp_address_rt): Use HAVE_SIGTRAMP_{RT}32 instead of SHARED. * sysdeps/powerpc/powerpc64/backtrace.c (is_sigtramp_address): Likewise. * sysdeps/unix/sysv/linux/aarch64/init-first.c: Remove file. * sysdeps/unix/sysv/linux/aarch64/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/arm/init-first.c: Likewise. * sysdeps/unix/sysv/linux/arm/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/mips/init-first.c: Likewise. * sysdeps/unix/sysv/linux/mips/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/i386/init-first.c: Likewise. * sysdeps/unix/sysv/linux/riscv/init-first.c: Likewise. * sysdeps/unix/sysv/linux/riscv/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/s390/init-first.c: Likewise. * sysdeps/unix/sysv/linux/s390/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/sparc/init-first.c: Likewise. * sysdeps/unix/sysv/linux/sparc/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/x86/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/init-first.c: Likewise. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Define value based on kernel exported name. * sysdeps/unix/sysv/linux/arm/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETCPU_VSYSCALL, HAVE_TIME_VSYSCALL, HAVE_GET_TBFREQ, HAVE_SIGTRAMP_RT64, HAVE_SIGTRAMP_32, HAVE_SIGTRAMP_RT32i, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/riscv/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/dl-vdso.h (VDSO_NAME, VDSO_HASH): Define to invalid names if architecture does not define them. (get_vdso_mangle_symbol): New symbol. * sysdeps/unix/sysv/linux/init-first.c: New file. * sysdeps/unix/sysv/linux/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/init-first.c (gettimeofday, clock_gettime, clock_getres, getcpu, time): Remove declaration. (__libc_vdso_platform_setup_arch): Likewise and use get_vdso_mangle_symbol to setup vDSO symbols. (sigtramp_rt64, sigtramp32, sigtramp_rt32, get_tbfreq): Add attribute_hidden. * sysdeps/unix/sysv/linux/powerpc/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/sysdep-vdso.h (VDSO_SYMBOL): Remove definition.
* Remove PREPARE_VERSION and PREPARE_VERSION_KNOWAdhemerval Zanella2019-09-172-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the PREPARE_VERSION and PREPARE_VERSION_KNOW macro and uses a static inline function instead, get_vdso_symbol. Each architecture that supports vDSO must define the Linux version and its hash for symbol resolution (VDSO_NAME and VDSO_HASH macro respectively). It also organizes the HAVE_*_VSYSCALL for mips, powerpc, and s390 to define them on a common header. The idea is to require less code to configure and enable vDSO support for newer ports. No semantic changes are expected. Checked with a build against all affected architectures. * sysdeps/unix/make-syscalls.sh: Make vDSO call use get_vdso_symbol. * sysdeps/unix/sysv/linux/aarch64/gettimeofday.c (__gettimeofday): Use get_vdso_symbol instead of _dl_vdso_vsym. * sysdeps/unix/sysv/linux/powerpc/time.c (time): Likewise. * sysdeps/unix/sysv/linux/riscv/flush-icache.c (__lookup_riscv_flush_icache): Likewise. * sysdeps/unix/sysv/linux/x86/gettimeofday.c (__gettimeofday): Likewise. * sysdeps/unix/sysv/linux/x86/time.c (time): Likewise. * sysdeps/unix/sysv/linux/powerpc/gettimeofday.c: Likewise. * sysdeps/unix/sysv/linux/aarch64/init-first.c: Likewise. * sysdeps/unix/sysv/linux/arm/init-first.c: Likewise. * sysdeps/unix/sysv/linux/i386/init-first.c: Likewise. * sysdeps/unix/sysv/linux/mips/init-first.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/init-first.c: Likewise. * sysdeps/unix/sysv/linux/riscv/init-first.c: Likewise. * sysdeps/unix/sysv/linux/sparc/init-first.c: Likewise. * sysdeps/unix/sysv/linux/s390/init-first.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/init-first.c: Likewise. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (VDSO_NAME, VDSO_HASH): Define. * sysdeps/unix/sysv/linux/arm/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/riscv/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Remove definition. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep.h: New file. * sysdeps/unix/sysv/linux/powerpc/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION, PREPARE_VERSION_KNOWN, VDSO_NAME_LINUX_2_6, VDSO_HASH_LINUX_2_6, VDSO_NAME_LINUX_2_6_15, VDSO_HASH_LINUX_2_6_15, VDSO_NAME_LINUX_2_6_29, VDSO_HASH_LINUX_2_6_29, VDSO_NAME_LINUX_4_15, VDSO_HASH_LINUX_4_15): Remove defines. (get_vdso_symbol): New function.
* Prefer https to http for gnu.org and fsf.org URLsPaul Eggert2019-09-0789-89/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
* Finish move of clock_* functions to libc. [BZ #24959]Zack Weinberg2019-09-044-10/+10
| | | | | | | | | | | | | | | | In glibc 2.17, the functions clock_getcpuclockid, clock_getres, clock_gettime, clock_nanosleep, and clock_settime were moved from librt.so to libc.so, leaving compatibility stubs behind. Now that the dynamic linker no longer insists on finding versioned symbols in the same library that originally defined them, we do not need the stubs anymore, and this means we don't need GLIBC_PRIVATE __-prefix aliases for most of the functions anymore either. (clock_gettime still needs one.) For ports added before 2.17, libc.so needs to provide two symbol versions for each, the default at GLIBC_2.17 plus a compat version matching what librt had. While I'm at it, move the clock_*.c files and their tests from rt/ to time/.
* nptl: Move pthread_attr_getinheritsched implementation into libcFlorian Weimer2019-08-302-2/+0
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_attr_setdetachstate implementation into libcFlorian Weimer2019-08-282-2/+0
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* linux: Make profil_counter a compat_symbol (BZ#17726)Adhemerval Zanella2019-08-231-1/+4
| | | | | | | | | | | | | | | As indicated by Joseph's comment on BZ#17726, this symbol is most likely a historical ABI accident. This patch make it on both arm and sparc ABIs a compat_symbol. Checked against a build arm-linux-gnueabihf, sparcv9-linux-gnu, adn sparc64-linux-gnu to see if the symbol is still present. * gmon/Versions (libc) [GLIBC_2.31]: New entry. * sysdeps/unix/sysv/linux/arm/profil-counter.h (profil_counter): Make a compat_symbol. * sysdeps/unix/sysv/linux/sparc/profil-counter.h (__profil_counter_global): Likewise.
* Refactor sigcontextinfo.hAdhemerval Zanella2019-08-236-62/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch refactor sigcontextinfo.h header to use SA_SIGINFO as default for both gmon and debug implementations. This allows simplify profil-counter.h on Linux to use a single implementation and remove the requirements for newer ports to redefine __sigaction/sigaction to use SA_SIGINFO. The GET_PC macro is also replaced with a function sigcontext_get_pc that returns an uintptr_t instead of a void pointer. It allows easier convertion to integer on ILP32 architecture, such as x32, without the need to suppress compiler warnings. The patch also requires some refactor of register-dump.h file for some architectures (to reflect it is now called from a sa_sigaction instead of sa_handler signal context). - Alpha, i386, and s390 are straighfoward to take in consideration the new argument type. - ia64 takes in consideration the kernel pass a struct sigcontextt as third argument for sa_sigaction. - sparc take in consideration the kernel pass a pt_regs struct as third argument for sa_sigaction. - m68k dummy function is removed and the FP state is dumped on register_dump itself. - For SH the register-dump.h file is consolidate on a common implementation and the floating-point state is checked based on ownedfp field. The register_dump does not change its output format in any affected architecture. I checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu, arm-linux-gnueabihf, sparcv9-linux-gnu, sparc64-linux-gnu, powerpc-linux-gnu, powerpc64-linux-gnu, and powerpc64le-linux-gnu. I also checked the libSegFault.so through catchsegv on alpha-linux-gnu, m68k-linux-gnu and sh4-linux-gnu to confirm the output has not changed. Adhemerval Zanella <adhemerval.zanella@linaro.org> Florian Weimer <fweimer@redhat.com> * debug/segfault.c (install_handler): Use SA_SIGINFO if defined. * sysdeps/generic/profil-counter.h (__profil_counter): Cast to uintptr_t. * sysdeps/generic/sigcontextinfo.h (GET_PC): Rename to sigcontext_get_pc and return aligned cast to uintptr_t. * sysdeps/mach/hurd/i386/sigcontextinfo.h (GET_PC): Likewise. * sysdeps/posix/profil.c (profil_count): Change PC argument to uintptr_t. (__profil): Use SA_SIGINFO. * sysdeps/posix/sprofil.c (profil_count): Change PCP argument to uintptr_t. (__sprofil): Use SA_SIGINFO. * sysdeps/unix/sysv/linux/profil-counter.h: New file. * sysdeps/unix/sysv/linux/aarch64/profil-counter.h: Remove file. * sysdeps/unix/sysv/linux/csky/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/hppa/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/i386/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/ia64/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/microblaze/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/mips/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/nios2/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/riscv/profil-counter.h: Likewise. * sysdeps/sysv/linux/s390/s390-32/profil-counter.h: Likewise. * sysdeps/sysv/linux/s390/s390-64/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/sh/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/arm/profil-counter.h (__profil_counter): Assume SA_SIGINFO and use sigcontext_get_pc instead of GET_PC. * sysdeps/unix/sysv/linux/sparc/profil-counter.h: New file. * sysdeps/unix/sysv/linux/sparc/sparc64/profil-counter.h: Remove file. * sysdeps/unix/sysv/linux/sparc/sparc32/profil-counter.h: Likewise. * sysdpes/unix/sysv/linux/aarch64/sigcontextinfo.h (SIGCONTEXT, GET_PC, __sigaction, sigaction): Remove defines. (sigcontext_get_pc): New function. * sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/arm/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/csky/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/hppa/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/i386/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/ia64/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/mips/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/s390/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/microblaze/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/sh/sigcontextinfo.h: Likewise. * sysdeps/sysv/linux/sparc/sparc32/sigcontextinfo.h: Likewise. * sysdeps/sysv/linux/sparc/sparc64/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/alpha/register-dump.h (register_dump): Handle CTX argument as ucontext_t. * sysdeps/unix/sysv/linux/i386/register-dump.h: Likewise. Likewise. * sysdeps/unix/sysv/linux/m68k/register-dump.h: Likewise. * sysdeps/sysv/linux/s390/s390-32/register-dump.h: Likewise. * sysdeps/sysv/linux/s390/s390-64/register-dump.h: Likewise. * sysdeps/unix/sysv/linux/sh/register-dump.h: New file. * sysdeps/unix/sysv/linux/sh/sh4/register-dump.h: Remove File. * sysdeps/unix/sysv/linux/sh/sh3/register-dump.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h: Likewise. * sysdeps/unix/sysv/linux/Makefile (tests-internal): Add tst-sigcontextinfo-get_pc. * sysdeps/unix/sysv/linux/tst-sigcontextinfo-get_pc.c: New file. (CFLAGS-tst-sigcontextinfo-get_pc.c): New rule.
* nptl: Move pthread_attr_getdetachstate implementation into libcFlorian Weimer2019-08-162-2/+0
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_attr_init implementation into libcFlorian Weimer2019-08-152-3/+0
| | | | | Both the original GLIB_2.0 version and the current GLIBC_2.1 version need to be moved.
* Make totalorder and totalordermag functions take pointer arguments.Joseph Myers2019-08-152-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The resolution of C floating-point Clarification Request 25 <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2397.htm#dr_25> is that the totalorder and totalordermag functions should take pointer arguments, and this has been adopted in C2X (with const added; note that the integration of this change into C2X is present in the C standard git repository but postdates the most recent public PDF draft). This patch updates glibc accordingly. As a defect resolution, the API is changed unconditionally rather than supporting any sort of TS 18661-1 mode for compilation with the old version of the API. There are compat symbols for existing binaries that pass floating-point arguments directly. As a consequence of changing to pointer arguments, there are no longer type-generic macros in tgmath.h for these functions. Because of the fairly complicated logic for creating libm function aliases and determining the set of aliases to create in a given glibc configuration, rather than duplicating all that in individual source files to create the versioned and compat symbols, the source files for the various versions of totalorder functions are set up to redefine weak_alias before using libm_alias_* macros to create the symbols required. In turn, this requires creating a separate alias for each symbol version pointing to the same implementation (see binutils bug <https://sourceware.org/bugzilla/show_bug.cgi?id=23840>), which is done automatically using __COUNTER__. (As I noted in <https://sourceware.org/ml/libc-alpha/2018-10/msg00631.html>, it might well make sense for glibc's symbol versioning macros to do that alias creation with __COUNTER__ themselves, which would somewhat simplify the logic in the totalorder source files.) It is of course desirable to test the compat symbols. I did this with the generic libm-test machinery, but didn't wish to duplicate the actual tables of test inputs and outputs, and thought it risky to attempt to have a single object file refer to both default and compat versions of the same function in order to test them together. Thus, I created libm-test-compat_totalorder.inc and libm-test-compat_totalordermag.inc which include the generated .c files (with the processed version of those tables of inputs) from the non-compat tests, and added appropriate dependencies. I think this provides sufficient test coverage for the compat symbols without also needing to make the special ldbl-96 and ldbl-128ibm tests (of peculiarities relating to the representations of those formats that can't be covered in the generic tests) run for the compat symbols. Tests of compat symbols need to be internal tests, meaning _ISOMAC is not defined. Making some libm-test tests into internal tests showed up two other issues. GCC diagnoses duplicate macro definitions of __STDC_* macros, including __STDC_WANT_IEC_60559_TYPES_EXT__; I added an appropriate conditional and filed <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91451> for this issue. On ia64, include/setjmp.h ends up getting included indirectly from libm-symbols.h, resulting in conflicting definitions of the STR macro (also defined in libm-test-driver.c); I renamed the macros in include/setjmp.h. (It's arguable that we should have common internal headers used everywhere for stringizing and concatenation macros.) Tested for x86_64 and x86, and with build-many-glibcs.py. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN] (totalorder): Take pointer arguments. [__GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN] (totalordermag): Likewise. * manual/arith.texi (totalorder): Likewise. (totalorderf): Likewise. (totalorderl): Likewise. (totalorderfN): Likewise. (totalorderfNx): Likewise. (totalordermag): Likewise. (totalordermagf): Likewise. (totalordermagl): Likewise. (totalordermagfN): Likewise. (totalordermagfNx): Likewise. * math/tgmath.h (__TGMATH_BINARY_REAL_RET_ONLY): Remove macro. [__GLIBC_USE (IEC_60559_BFP_EXT)] (totalorder): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (totalordermag): Likewise. * math/Versions (GLIBC_2.31): Add totalorder, totalorderf, totalorderl, totalordermag, totalordermagf, totalordermagl, totalorderf32, totalorderf64, totalorderf32x, totalordermagf32, totalordermagf64, totalordermagf32x, totalorderf64x, totalordermagf64x, totalorderf128 and totalordermagf128. * math/Makefile (libm-test-funcs-noauto): Add compat_totalorder and compat_totalordermag. (libm-test-funcs-compat): New variable. (libm-tests-compat): Likewise. (tests): Do not include compat tests. (tests-internal): Add compat tests. ($(foreach t,$(libm-tests-base), $(objpfx)$(t)-compat_totalorder.o)): Depend on $(objpfx)libm-test-totalorder.c. ($(foreach t,$(libm-tests-base), $(objpfx)$(t)-compat_totalordermag.o): Depend on $(objpfx)libm-test-totalordermag.c. (tgmath3-macros): Remove totalorder and totalordermag. * math/libm-test-compat_totalorder.inc: New file. * math/libm-test-compat_totalordermag.inc: Likewise. * math/libm-test-driver.c (struct test_ff_i_data): Update comment. (RUN_TEST_fpfp_b): New macro. (RUN_TEST_LOOP_fpfp_b): Likewise. * math/libm-test-totalorder.inc (totalorder_test_data): Use TEST_fpfp_b. (totalorder_test): Condition on [!COMPAT_TEST]. (do_test): Likewise. * math/libm-test-totalordermag.inc (totalordermag_test_data): Use TEST_fpfp_b. (totalordermag_test): Condition on [!COMPAT_TEST]. (do_test): Likewise. * math/gen-tgmath-tests.py (Tests.add_all_tests): Remove totalorder and totalordermag. * math/test-tgmath.c (NCALLS): Change to 132. (F(compile_test)): Do not call totalorder or totalordermag. (F(totalorder)): Remove. (F(totalordermag)): Likewise. * include/float.h (__STDC_WANT_IEC_60559_TYPES_EXT__): Do not define if [__STDC_WANT_IEC_60559_TYPES_EXT__]. * include/setjmp.h [!_ISOMAC] (STR_HELPER): Rename to SJSTR_HELPER. [!_ISOMAC] (STR): Rename to SJSTR. Update call to STR_HELPER. [!_ISOMAC] (TEST_SIZE): Update call to STR. [!_ISOMAC] (TEST_ALIGN): Likewise. [!_ISOMAC] (TEST_OFFSET): Likewise. * sysdeps/ieee754/dbl-64/s_totalorder.c: Include <shlib-compat.h> and <first-versions.h>. (__totalorder): Take pointer arguments. Add symbol versions and compat symbols. * sysdeps/ieee754/dbl-64/s_totalordermag.c: Include <shlib-compat.h> and <first-versions.h>. (__totalordermag): Take pointer arguments. Add symbol versions and compat symbols. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c: Include <shlib-compat.h> and <first-versions.h>. (__totalorder): Take pointer arguments. Add symbol versions and compat symbols. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c: Include <shlib-compat.h> and <first-versions.h>. (__totalordermag): Take pointer arguments. Add symbol versions and compat symbols. * sysdeps/ieee754/float128/float128_private.h (__totalorder_compatl): New macro. (__totalordermag_compatl): Likewise. * sysdeps/ieee754/flt-32/s_totalorderf.c: Include <shlib-compat.h> and <first-versions.h>. (__totalorderf): Take pointer arguments. Add symbol versions and compat symbols. * sysdeps/ieee754/flt-32/s_totalordermagf.c: Include <shlib-compat.h> and <first-versions.h>. (__totalordermagf): Take pointer arguments. Add symbol versions and compat symbols. * sysdeps/ieee754/ldbl-128/s_totalorderl.c: Include <shlib-compat.h> and <first-versions.h>. (__totalorderl): Take pointer arguments. Add symbol versions and compat symbols. * sysdeps/ieee754/ldbl-128/s_totalordermagl.c: Include <shlib-compat.h> and <first-versions.h>. (__totalordermagl): Take pointer arguments. Add symbol versions and compat symbols. * sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c: Include <shlib-compat.h>. (__totalorderl): Take pointer arguments. Add symbol versions and compat symbols. * sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c: Include <shlib-compat.h>. (__totalordermagl): Take pointer arguments. Add symbol versions and compat symbols. * sysdeps/ieee754/ldbl-96/s_totalorderl.c: Include <shlib-compat.h> and <first-versions.h>. (__totalorderl): Take pointer arguments. Add symbol versions and compat symbols. * sysdeps/ieee754/ldbl-96/s_totalordermagl.c: Include <shlib-compat.h> and <first-versions.h>. (__totalordermagl): Take pointer arguments. Add symbol versions and compat symbols. * sysdeps/ieee754/ldbl-opt/nldbl-totalorder.c (totalorderl): Take pointer arguments. * sysdeps/ieee754/ldbl-opt/nldbl-totalordermag.c (totalordermagl): Likewise. * sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c (do_test): Update calls to totalorderl and totalordermagl. * sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c (do_test): Update calls to totalorderl and totalordermagl. * sysdeps/mach/hurd/i386/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/csky/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* nptl: Remove pthread_self compatibility symbol from libpthreadFlorian Weimer2019-08-152-2/+0
| | | | | The symbol is no longer needed because since glibc 2.30, the dynamic loader continues searching for the symbol in libc.
* nptl: Move pthread_attr_destroy implementation into libcFlorian Weimer2019-08-152-2/+0
|
* nptl: Move pthread_equal implementation into libcFlorian Weimer2019-08-152-2/+0
|
* linux: Enable vDSO for static linking as default (BZ#19767)Adhemerval Zanella2019-08-051-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch assumes static vDSO is supported as default, it is now supported on all current architectures that support vDSO. It allows removing both ALWAYS_USE_VSYSCALL define, which an architecture requires to explicit define and USE_VSYSCALL (which defines vDSO only for shared or if architecture defines ALWAYS_USE_VSYSCALL). Checked with a build against all affected ABIs. [BZ #19767] * sysdeps/unix/sysv/linux/aarch64/sysdep.h (ALWAYS_USE_VSYSCALL): Remove definition. * sysdeps/unix/sysv/linux/arm/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/riscv/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/x86/libc-vdso.h: Remove #if USE_VSYSCALL. * sysdeps/unix/sysv/linux/sysdep-vdso.h: Likewise. * sysdeps/unix/sysv/linux/sysdep.h (ALWAYS_USE_VSYSCALL, USE_VSYSCALL): Remove defitions.
* sparc: Enable VDSO for static linkingAdhemerval Zanella2019-08-053-10/+7
| | | | | | | | | | Checked on sparc64-linux-gnu and sparcv9-linux-gnu. [BZ #19767] * sysdeps/unix/sysv/linux/sparc/init-first.c: Remove #ifdef SHARED. * sysdeps/unix/sysv/linux/sparc/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h (ALWAYS_USE_VSYSCALL): Define.
* Linux: Use in-tree copy of SO_ constants for !__USE_MISC [BZ #24532]Florian Weimer2019-07-241-0/+38
| | | | | | | | | | | | | | | | | | | | The kernel changes for a 64-bit time_t on 32-bit architectures resulted in <asm/socket.h> indirectly including <linux/posix_types.h>. The latter is not namespace-clean for the POSIX version of <sys/socket.h>. This issue has persisted across several Linux releases, so this commit creates our own copy of the SO_* definitions for !__USE_MISC mode. The new test socket/tst-socket-consts ensures that the copy is consistent with the kernel definitions (which vary across architectures). The test is tricky to get right because CPPFLAGS includes include/libc-symbols.h, which in turn defines _GNU_SOURCE unconditionally. Tested with build-many-glibcs.py. I verified that a discrepancy in the definitions actually results in a failure of the socket/tst-socket-consts test.
* nptl: Add POSIX-proposed pthread_mutex_clocklockMike Crowe2019-07-122-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add POSIX-proposed pthread_mutex_clocklock function that works like pthread_mutex_timedlock but takes a clockid parameter to measure the abstime parameter against. * sysdeps/nptl/pthread.h: Add pthread_mutex_clocklock. * nptl/DESIGN-systemtap-probes.txt: Likewise. * nptl/pthread_mutex_timedlock.c (__pthread_mutex_clocklock_common): Rename from __pthread_mutex_timedlock and add clockid parameter. Pass this parameter to lll_clocklock and lll_clocklock_elision in place of CLOCK_REALTIME. (__pthread_mutex_clocklock): New function to add LIBC_PROBE and validate clockid parameter before calling __pthread_mutex_clocklock_common. (__pthread_mutex_timedlock): New implementation to add LIBC_PROBE and calls __pthread_mutex_clocklock_common passing CLOCK_REALTIME as the clockid. * nptl/Makefile: Add tst-mutex11.c. * nptl/tst-abstime.c (th): Add tests for pthread_mutex_clocklock. * nptl/tst-mutex11.c: New tests for passing invalid and unsupported clockid parameters to pthread_mutex_clocklock. * nptl/tst-mutex5.c (do_test_clock): Rename from do_test and take clockid parameter to indicate which clock to be used. Call pthread_mutex_timedlock or pthread_mutex_clocklock as appropriate. (do_test): Call do_test_clock to separately test pthread_mutex_timedlock, pthread_mutex_clocklock(CLOCK_REALTIME) and pthread_mutex_clocklock(CLOCK_MONOTONIC). * nptl/tst-mutex9.c: Likewise. * nptl/Versions (GLIBC_2.30): Add pthread_mutex_clocklock. * sysdeps/unix/sysv/linux/aarch64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/alpha/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/arm/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/csky/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/hppa/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/i386/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/ia64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/microblaze/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/nios2/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/sh/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist (GLIBC_2.30): Likewise. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Rename lll_timedlock to lll_clocklock and add clockid parameterMike Crowe2019-07-121-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename lll_timedlock to lll_clocklock and add clockid parameter to indicate the clock that the abstime parameter should be measured against in preparation for adding pthread_mutex_clocklock. The name change mirrors the naming for the exposed pthread functions: timed => absolute timeout measured against CLOCK_REALTIME (or clock specified by attribute in the case of pthread_cond_timedwait.) clock => absolute timeout measured against clock specified in preceding parameter. * sysdeps/nptl/lowlevellock.h (lll_clocklock): Rename from lll_timedlock and add clockid parameter. (__lll_clocklock): Rename from __lll_timedlock and add clockid parameter. * sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_clocklock): Likewise. * nptl/lll_timedlock_wait.c (__lll_clocklock_wait): Rename from __lll_timedlock_wait and add clockid parameter. Use __clock_gettime rather than __gettimeofday so that clockid can be used. This means that conversion from struct timeval is no longer required. * sysdeps/sparc/sparc32/lowlevellock.c (lll_clocklock_wait): Likewise. * sysdeps/sparc/sparc32/lll_timedlock_wait.c: Update comment to refer to __lll_clocklock_wait rather than __lll_timedlock_wait. * nptl/pthread_mutex_timedlock.c (lll_clocklock_elision): Rename from lll_timedlock_elision, add clockid parameter and use meaningful names for other parameters. (__pthread_mutex_timedlock): Pass CLOCK_REALTIME where necessary to lll_clocklock and lll_clocklock_elision. * sysdeps/unix/sysv/linux/powerpc/lowlevellock.h (lll_clocklock_elision): Rename from lll_timedlock_elision and add clockid parameter. (__lll_clocklock_elision): Rename from __lll_timedlock_elision and add clockid parameter. * sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/x86/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/elision-timed.c (__lll_lock_elision): Call __lll_clocklock_elision rather than __lll_timedlock_elision. (EXTRAARG): Add clockid parameter. (LLL_LOCK): Likewise. * sysdeps/unix/sysv/linux/s390/elision-timed.c: Likewise. * sysdeps/unix/sysv/linux/x86/elision-timed.c: Likewise. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Add POSIX-proposed pthread_rwlock_clockrdlock & pthread_rwlock_clockwrlockMike Crowe2019-07-122-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add: int pthread_rwlock_clockrdlock (pthread_rwlock_t *rwlock, clockid_t clockid, const struct timespec *abstime) and: int pthread_rwlock_clockwrlock (pthread_rwlock_t *rwlock, clockid_t clockid, const struct timespec *abstime) which behave like pthread_rwlock_timedrdlock and pthread_rwlock_timedwrlock respectively, except they always measure abstime against the supplied clockid. The functions currently support CLOCK_REALTIME and CLOCK_MONOTONIC and return EINVAL if any other clock is specified. * sysdeps/nptl/pthread.h: Add pthread_rwlock_clockrdlock and pthread_wrlock_clockwrlock. * nptl/Makefile: Build pthread_rwlock_clockrdlock.c and pthread_rwlock_clockwrlock.c. * nptl/pthread_rwlock_clockrdlock.c: Implement pthread_rwlock_clockrdlock. * nptl/pthread_rwlock_clockwrlock.c: Implement pthread_rwlock_clockwrlock. * nptl/pthread_rwlock_common.c (__pthread_rwlock_rdlock_full): Add clockid parameter and verify that it indicates a supported clock on entry so that we fail even if it doesn't end up being used. Pass that clock on to futex_abstimed_wait when necessary. (__pthread_rwlock_wrlock_full): Likewise. * nptl/pthread_rwlock_rdlock.c: (__pthread_rwlock_rdlock): Pass CLOCK_REALTIME to __pthread_rwlock_rdlock_full even though it won't be used because there's no timeout. * nptl/pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock): Pass CLOCK_REALTIME to __pthread_rwlock_wrlock_full even though it won't be used because there is no timeout. * nptl/pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock): Pass CLOCK_REALTIME to __pthread_rwlock_rdlock_full since abstime uses that clock. * nptl/pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock): Pass CLOCK_REALTIME to __pthread_rwlock_wrlock_full since abstime uses that clock. * sysdeps/unix/sysv/linux/aarch64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/alpha/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/arm/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/csky/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/hppa/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/i386/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/ia64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/microblaze/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/nios2/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/sh/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist (GLIBC_2.30): Likewise. * nptl/tst-abstime.c (th): Add pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock timeout tests to match the existing pthread_rwlock_timedrdloock and pthread_rwlock_timedwrlock tests. * nptl/tst-rwlock14.c (do_test): Likewise. * nptl/tst-rwlock6.c Invent verbose_printf macro, and use for ancillary output throughout. (tf): Accept thread_args structure so that rwlock, a clockid and function name can be passed to the thread. (do_test_clock): Rename from do_test. Accept clockid parameter to specify test clock. Use the magic clockid value of CLOCK_USE_TIMEDLOCK to indicate that pthread_rwlock_timedrdlock and pthread_rwlock_timedwrlock should be tested, otherwise pass the specified clockid to pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock. Use xpthread_create and xpthread_join. (do_test): Call do_test_clock to test each clockid in turn. * nptl/tst-rwlock7.c: Likewise. * nptl/tst-rwlock9.c (writer_thread, reader_thread): Accept thread_args structure so that the (now int) thread number, the clockid and the function name can be passed to the thread. (do_test_clock): Renamed from do_test. Pass the necessary thread_args when creating the reader and writer threads. Use xpthread_create and xpthread_join. (do_test): Call do_test_clock to test each clockid in turn. * manual/threads.texi: Add documentation for pthread_rwlock_clockrdlock and pthread_rwlock_clockwrclock. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Add POSIX-proposed pthread_cond_clockwaitMike Crowe2019-07-122-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add: int pthread_cond_clockwait (pthread_cond_t *cond, pthread_mutex_t *mutex, clockid_t clockid, const struct timespec *abstime) which behaves just like pthread_cond_timedwait except it always measures abstime against the supplied clockid. Currently supports CLOCK_REALTIME and CLOCK_MONOTONIC and returns EINVAL if any other clock is specified. Includes feedback from many others. This function was originally proposed[1] as pthread_cond_timedwaitonclock_np, but The Austin Group preferred the new name. * nptl/Makefile: Add tst-cond26 and tst-cond27 * nptl/Versions (GLIBC_2.30): Add pthread_cond_clockwait * sysdeps/nptl/pthread.h: Likewise * nptl/forward.c: Add __pthread_cond_clockwait * nptl/forward.c: Likewise * nptl/pthreadP.h: Likewise * sysdeps/nptl/pthread-functions.h: Likewise * nptl/pthread_cond_wait.c (__pthread_cond_wait_common): Add clockid parameter and comment describing why we don't need to check its value. Use that value when calling futex_abstimed_wait_cancelable rather than reading the clock from the flags. (__pthread_cond_wait): Pass unused clockid parameter. (__pthread_cond_timedwait): Read clock from flags and pass it to __pthread_cond_wait_common. (__pthread_cond_clockwait): Add new function with weak alias from pthread_cond_clockwait. * sysdeps/mach/hurd/i386/libpthread.abilist (GLIBC_2.30): * Likewise. * sysdeps/unix/sysv/linux/aarch64/libpthread.abilist * (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/alpha/libpthread.abilist (GLIBC_2.30): * Likewise. * sysdeps/unix/sysv/linux/arm/libpthread.abilist (GLIBC_2.30): * Likewise. * sysdeps/unix/sysv/linux/csky/libpthread.abilist (GLIBC_2.30): * Likewise. * sysdeps/unix/sysv/linux/hppa/libpthread.abilist (GLIBC_2.30): * Likewise. * sysdeps/unix/sysv/linux/i386/libpthread.abilist (GLIBC_2.30): * Likewise. * sysdeps/unix/sysv/linux/ia64/libpthread.abilist (GLIBC_2.30): * Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/microblaze/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/nios2/libpthread.abilist (GLIBC_2.30): * Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/sh/libpthread.abilist (GLIBC_2.30): * Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist (GLIBC_2.30): Likewise. * nptl/tst-cond11.c (run_test): Support testing pthread_cond_clockwait too by using a special magic CLOCK_USE_ATTR_CLOCK value to determine whether to call pthread_cond_timedwait or pthread_cond_clockwait. (do_test): Pass CLOCK_USE_ATTR_CLOCK for existing tests, and add new tests using all combinations of CLOCK_MONOTONIC and CLOCK_REALTIME. * ntpl/tst-cond26.c: New test for passing unsupported and * invalid clocks to pthread_cond_clockwait. * nptl/tst-cond27.c: Add test similar to tst-cond5.c, but using struct timespec and pthread_cond_clockwait. * manual/threads.texi: Document pthread_cond_clockwait. The * comment was provided by Carlos O'Donell. [1] https://sourceware.org/ml/libc-alpha/2015-07/msg00193.html Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Add POSIX-proposed sem_clockwaitMike Crowe2019-07-122-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add: int sem_clockwait (sem_t *sem, clockid_t clock, const struct timespec *abstime) which behaves just like sem_timedwait, but measures abstime against the specified clock. Currently supports CLOCK_REALTIME and CLOCK_MONOTONIC and sets errno == EINVAL if any other clock is specified. * nptl/sem_waitcommon.c (do_futex_wait, __new_sem_wait_slow): Add clockid parameters to indicate the clock which abstime should be measured against. * nptl/sem_timedwait.c (sem_timedwait), nptl/sem_wait.c (__new_sem_wait): Pass CLOCK_REALTIME as clockid to __new_sem_wait_slow. * nptl/sem_clockwait.c: New file to implement sem_clockwait based on sem_timedwait.c. * nptl/Makefile: Add sem_clockwait.c source file. Add CFLAGS for sem_clockwait.c to match those used for sem_timedwait.c. * sysdeps/pthread/semaphore.h: Add sem_clockwait. * nptl/Versions (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/aarch64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/alpha/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/arm/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/csky/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/hppa/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/i386/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/ia64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/microblaze/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/nios2/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/sh/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist (GLIBC_2.30): Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist (GLIBC_2.30): Likewise. * nptl/tst-sem17.c: Add new test for passing invalid clock to sem_clockwait. * nptl/tst-sem13.c, nptl/tst-sem5.c: Modify existing sem_timedwait tests to also test sem_clockwait. * manual/threads.texi: Document sem_clockwait. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Remove vfork IFUNC-based forwarder from libpthread [BZ #20188]Florian Weimer2019-07-023-5/+1
| | | | | | | | | | | | | | | | | | | | | With commit f0b2132b35248c1f4a80f62a2c38cddcc802aa8c ("ld.so: Support moving versioned symbols between sonames [BZ #24741]"), the dynamic linker will find the definition of vfork in libc and binds a vfork reference to that symbol, even if the soname in the version reference says that the symbol should be located in libpthread. As a result, the forwarder (whether it's IFUNC-based or a duplicate of the libc implementation) is no longer necessary. On older architectures, a placeholder symbol is required, to make sure that the GLIBC_2.1.2 symbol version does not go away, or is turned in to a weak symbol definition by the link editor. (The symbol version needs to preserved so that the symbol coverage check in elf/dl-version.c does not fail for old binaries.) mips32 is an outlier: It defined __vfork@@GLIBC_2.2, but the baseline is GLIBC_2.0. Since there are other @@GLIBC_2.2 symbols, the placeholder symbol is not needed there.
* Linux: Add getdents64 system callFlorian Weimer2019-06-072-0/+2
| | | | | | | | | | | No 32-bit system call wrapper is added because the interface is problematic because it cannot deal with 64-bit inode numbers and 64-bit directory hashes. A future commit will deprecate the undocumented getdirentries and getdirentries64 functions. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Remove unused get_clockfreq filesAdhemerval Zanella2019-05-291-1/+0
| | | | | | | | | | | The patch 6e8ba7fd574f meant to remove the all get_clockfreq.c. This patch removes the missing files for sparcv9 and x86_64. Checked against a build to x86_64-linux-gnu and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/get_clockfreq.c: Remove file. * sysdeps/unix/sysv/linux/x86_64/get_clockfreq.c: Likewise.
* sysvipc: Add missing bit of semtimedop s390 consolidationAdhemerval Zanella2019-05-211-0/+3
| | | | | | | | | | | | This patch add the missing SEMTIMEDOP_IPC_ARGS definions on powerpc and sparc ipc_priv.h. Checked on powerpc64le-linux-gnu and with a build for sparc64-linux-gnu. * sysdeps/unix/sysv/linux/powerpc/ipc_priv.h (SEMTIMEDOP_IPC_ARGS): New define. * sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h (SEMTIMEDOP_IPC_ARGS): Likewise.
* Linux: Add the tgkill functionFlorian Weimer2019-05-142-0/+2
| | | | | | | | | The tgkill function is sometimes used in crash handlers. <bits/signal_ext.h> follows the same approach as <bits/unistd_ext.h> (which was added for the gettid system call wrapper). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* misc: Add twalk_r functionFlorian Weimer2019-05-022-0/+2
| | | | | | | | | The twalk function is very difficult to use in a multi-threaded program because there is no way to pass external state to the iterator function. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Remove __get_clockfreqAdhemerval Zanella2019-03-221-250/+0
| | | | | | | | | | | | | | | | | | | With clock_getres, clock_gettime, and clock_settime refactor to remove the generic CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID support through hp-timing, there is no usage of internal __get_clockfreq. This patch removes both generic and Linux implementation.. Checked with a build against aarch64-linux-gnu, i686-linux-gnu, ia64-linux-gnu, sparc64-linux-gnu, powerpc-linux-gnu-power4. * include/libc-internal.h (__get_clockfreq): Remove prototype. * rt/Makefile (clock-routines): Remove get_clockfreq. * rt/get_clockfreq.c: Remove file. * sysdeps/unix/sysv/linux/i386/get_clockfreq.c: Likewise. * sysdeps/unix/sysv/linux/ia64/get_clockfreq.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c: Move code to ... * sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c: ... here.
* ldbl-opt: Add error and error_at_line (bug 23984)Gabriel F. T. Gomes2019-03-011-0/+2
| | | | | | | | | | On platforms where long double may have the same format as double (-mlong-double-64), error and error_at_line do not take that into account and might produce wrong output if a long double conversion is requested by the format string ('%Lf'). This patch adds compatibility functions for this situation and redirects calls via header magic. Tested for powerpc, powerpc64 and powerpc64le.
* ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984)Gabriel F. T. Gomes2019-03-011-0/+8
| | | | | | | | | | | | | | | When support for long double format with 128-bits (-mlong-double-128) was added for platforms where long double had the same format as double, such as powerpc, compatibility versions for the functions listed in the commit title were missed. Since the older format of long double can still be used (with -mlong-double-64), using these functions with a format string that requests the printing of long double variables will produce wrong outputs. This patch adds the missing compatibility functions and header magic to redirect calls to them when -mlong-double-64 is in use. Tested for powerpc, powerpc64 and powerpc64le.
* ldbl-opt: Add argp_error and argp_failure (bug 23983)Gabriel F. T. Gomes2019-03-011-0/+2
| | | | | | | | | | The functions argp_error and argp_failure are missing support for printing long double values when long double has the same format as double. This patch adds the new functions __nldbl_argp_error and __nldbl_argp_failure, as well as header magic to redirect calls to them when -mlong-double-64 is in use. Tested for powerpc, powerpc64 and powerpc64le.
* Break further lines before not after operators.Joseph Myers2019-02-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch continues the process of fixing coding style to break lines before not after operators in accordance with the GNU Coding Standards, fixing such issues in a non-exhaustive selection of sysdeps files that had them. Tested for x86_64, and with build-many-glibcs.py. * sysdeps/arm/sysdep.h (#if condition): Break lines before rather than after operators. * sysdeps/mach/hurd/fork.c (__fork): Likewise. * sysdeps/mach/hurd/getcwd.c (__hurd_canonicalize_directory_name_internal): Likewise. * sysdeps/mach/hurd/htl/pt-mutex-consistent.c (pthread_mutex_consistent): Likewise. * sysdeps/mach/hurd/htl/pt-mutex-init.c (_pthread_mutex_init): Likewise. * sysdeps/mach/hurd/htl/pt-mutex-transfer-np.c (__pthread_mutex_transfer_np): Likewise. * sysdeps/mach/hurd/htl/pt-mutex-unlock.c (__pthread_mutex_unlock): Likewise. * sysdeps/mach/hurd/htl/pt-mutex.h (ROBUST_LOCK): Likewise. (mtx_owned_p): Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getrobust.c (pthread_mutexattr_getrobust): Likewise. * sysdeps/mach/hurd/i386/init-first.c (init1): Likewise. * sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler): Likewise. * sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise. * sysdeps/mach/hurd/jmp-unwind.c (_longjmp_unwind): Likewise. * sysdeps/mach/hurd/kill.c (__kill): Likewise. * sysdeps/mach/hurd/mig-reply.c (__mig_get_reply_port): Likewise. * sysdeps/mach/hurd/ptrace.c (ptrace): Likewise. * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (#if condition): Likewise. * sysdeps/unix/sysv/linux/alpha/ioperm.c (process_cpuinfo): Likewise. * sysdeps/unix/sysv/linux/bits/timex.h (STA_RONLY): Likewise. * sysdeps/unix/sysv/linux/csky/sysdep.h (#if condition): Likewise. * sysdeps/unix/sysv/linux/generic/____longjmp_chk.c (____longjmp_chk): Likewise. * sysdeps/unix/sysv/linux/generic/futimesat.c (futimesat): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (INTERNAL_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (INTERNAL_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c (__get_clockfreq_via_cpuinfo): Likewise.
* io: Consolidate lockf implementationAdhemerval Zanella2019-02-151-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With internal fcntl64 internal (commit 06ab719d), it is possible to consolidate lockf implementation by using the LFS fcntl interface instead of using arch and system-specific implementations. For Linux, the i386 implementation is used as generic implementation by replacing the direct syscall with fcntl64 call. The LFS symbol alias for default LFS ABI (__OFF_T_MATCHES_OFF64_T) is used to avoid the duplicate symbol (instead of overriding the implementation with an empty file). For Hurd lockf64 semantic is changed: previous generic lockf64 implementation returned EOVERFLOW if LEN input is larger than 32-bit off_t. However, Hurd fcntl64 implementation for F_GETLK64, F_SETLK64, and F_SETLKW64 do accept off64_t inputs (__f_setlk accepts only off64_t inputs). Checked on i686-linux-gnu and x86_64-linux-gnu along with a i686-gnu build. * io/Makefile (tests): Add tst-lockf. * io/lockf.c (lockf): Use __fcntl and only define for !__OFF_T_MATCHES_OFF64_T. * io/lockf64.c (__lockf64): Call __fcntl64 and alias to lockf for __OFF_T_MATCHES_OFF64_T case. * io/tst-lockf.c: New file. * sysdeps/unix/sysv/linux/i386/lockf64.c: Remove file. * sysdeps/unix/sysv/linux/arm/lockf64.c: Likewise. * sysdeps/unix/sysv/linux/m68k/lockf64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/lockf64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/lockf64.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/lockf64.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/lockf64.c: Likewise. * sysdeps/unix/sysv/linux/sh/lockf64.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/lockf64.c: Likewise.
* nptl: Reinstate pthread_timedjoin_np as a cancellation point (BZ#24215)Adhemerval Zanella2019-02-141-25/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch ce7eb0e90315 ("nptl: Cleanup cancellation macros") changed the join sequence for internal common __pthread_timedjoin_ex to use the new macro lll_wait_tid. The idea was this macro would issue the cancellable futex operation depending whether the timeout is used or not. However if a timeout is used, __lll_timedwait_tid is called and it is not a cancellable entrypoint. This patch fixes it by simplifying the code in various ways: - Instead of adding the cancellation handling on __lll_timedwait_tid, it moves the generic implementation to pthread_join_common.c (called now timedwait_tid with some fixes to use the correct type for pid). - The llvm_wait_tid macro is removed, along with its replication on x86_64, i686, and sparc arch-specific lowlevellock.h. - sparc32 __lll_timedwait_tid is also removed, since the code is similar to generic one. - x86_64 and i386 provides arch-specific __lll_timedwait_tid which is also removed since they are similar in functionality to generic C code and there is no indication it is better than compiler generated code. New tests, tst-join8 and tst-join9, are provided to check if pthread_timedjoin_np acts as a cancellation point. Checked on x86_64-linux-gnu, i686-linux-gnu, sparcv9-linux-gnu, and aarch64-linux-gnu. [BZ #24215] * nptl/Makefile (lpthread-routines): Remove lll_timedwait_tid. (tests): Add tst-join8 tst-join9. * nptl/lll_timedwait_tid.c: Remove file. * sysdeps/sparc/sparc32/lll_timedwait_tid.c: Likewise. * sysdeps/unix/sysv/linux/i386/lll_timedwait_tid.c: Likewise. * sysdeps/sysv/linux/x86_64/lll_timedwait_tid.c: Likewise. * nptl/pthread_join_common.c (timedwait_tid): New function. (__pthread_timedjoin_ex): Act as cancellation entrypoint is block is set. * nptl/tst-join5.c (thread_join): New function. (tf1, tf2, do_test): Use libsupport and add pthread_timedjoin_np check. * nptl/tst-join8.c: New file. * nptl/tst-join9.c: Likewise. * sysdeps/nptl/lowlevellock-futex.h (lll_futex_wait_cancel, lll_futex_timed_wait_cancel): Add generic macros. * sysdeps/nptl/lowlevellock.h (__lll_timedwait_tid, lll_wait_tid): Remove definitions. * sysdeps/unix/sysv/linux/i386/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise. * sysdeps/sparc/sparc32/lowlevellock.c (__lll_timedwait_tid): Remove function. * sysdeps/unix/sysv/linux/i386/lowlevellock.S (__lll_timedwait_tid): Likewise. * sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise. * sysdeps/unix/sysv/linux/lowlevellock-futex.h (lll_futex_timed_wait_cancel): New macro.
* Linux: Add gettid system call wrapper [BZ #6399]Florian Weimer2019-02-082-0/+2
| | | | | | | | | | This commit adds gettid to <unistd.h> on Linux, and not to the kernel-independent GNU API. gettid is now supportable on Linux because too many things assume a 1:1 mapping between libpthread threads and kernel threads. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* nptl: Cleanup cancellation macrosAdhemerval Zanella2019-01-031-19/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch wraps all uses of *_{enable,disable}_asynccancel and and *_CANCEL_{ASYNC,RESET} in either already provided macros (lll_futex_timed_wait_cancel) or creates new ones if the functionality is not provided (SYSCALL_CANCEL_NCS, lll_futex_wait_cancel, and lll_futex_timed_wait_cancel). Also for some generic implementations, the direct call of the macros are removed since the underlying symbols are suppose to provide cancellation support. This is a priliminary patch intended to simplify the work required for BZ#12683 fix. It is a refactor change, no semantic changes are expected. Checked on x86_64-linux-gnu and i686-linux-gnu. * nptl/pthread_join_common.c (__pthread_timedjoin_ex): Use lll_wait_tid with timeout. * nptl/sem_wait.c (__old_sem_wait): Use lll_futex_wait_cancel. * sysdeps/nptl/aio_misc.h (AIO_MISC_WAIT): Use futex_reltimed_wait_cancelable for cancelabla mode. * sysdeps/nptl/gai_misc.h (GAI_MISC_WAIT): Likewise. * sysdeps/posix/open64.c (__libc_open64): Do not call cancelation macros. * sysdeps/posix/sigwait.c (__sigwait): Likewise. * sysdeps/posix/waitid.c (__sigwait): Likewise. * sysdeps/unix/sysdep.h (__SYSCALL_CANCEL_CALL, SYSCALL_CANCEL_NCS): New macro. * sysdeps/nptl/lowlevellock.h (lll_wait_tid): Add timeout argument. (lll_timedwait_tid): Remove macro. * sysdeps/unix/sysv/linux/i386/lowlevellock.h (lll_wait_tid): Likewise. (lll_timedwait_tid): Likewise. * sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_wait_tid): Likewise. (lll_timedwait_tid): Likewise. * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (lll_wait_tid): Likewise. (lll_timedwait_tid): Likewise. * sysdeps/unix/sysv/linux/clock_nanosleep.c (__clock_nanosleep): Use INTERNAL_SYSCALL_CANCEL. * sysdeps/unix/sysv/linux/futex-internal.h (futex_reltimed_wait_cancelable): Use LIBC_CANCEL_{ASYNC,RESET} instead of __pthread_{enable,disable}_asynccancel. * sysdeps/unix/sysv/linux/lowlevellock-futex.h (lll_futex_wait_cancel): New macro.
* termios: Consolidate termios.hAdhemerval Zanella2019-01-031-74/+0
| | | | | | | | | | | | | | | | | This patch consolidates the Linux termios.h by removing the arch-specific one. No semantic change is expected, checked on a build against x86_64-linux-gnu, alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add bits/termios-misc.h. * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Remove file. * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/bits/termios-misc.h: New file. * sysdeps/unix/sysv/linux/bits/termios.h: Include termios-misc.h.
* termios: Consolidate tcflow symbolic constantsAdhemerval Zanella2019-01-031-4/+1
| | | | | | | | | | | | | | | | | | | | | This patch consolidates the termios symbolic constants for use with tcflow in its own header. The Linux generic implementation values match the kernel UAPI and each architecture with deviate values have their own implementation (currently only mips). No semantic change is expected, checked on a build against x86_64-linux-gnu, alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add termios-tcflow.h. * sysdeps/unix/sysv/linux/bits/termios-tcflow.h: New file. * sysdeps/unix/sysv/linux/mips/bits/termios-tcflow.h: Likewise. * sysdeps/unix/sysv/linux/bits/termios.h (TCSANOW, TCSADRAIN, TCSAFLUSH): Move to termios-tcflow.h. * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
* termios: Consolidate local mode definitionsAdhemerval Zanella2019-01-031-25/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the termios symbolic constants used for local mode with c_lflag member on its own header. The Linux generic implementation values match the kernel UAPI and each architecture with deviate values have their own implementation (in this case alpha, mips, and powerpc). No semantic change is expected, checked on a build against x86_64-linux-gnu, alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add termios-c_lflag.h. * sysdeps/unix/sysv/linux/bits/termios-c_lflag.h: New file. * sysdeps/unix/sysv/linux/alpha/bits/termios-c_lflag.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/termios-c_lflag.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/termios-c_lflag.h: Likewise. * sysdeps/unix/sysv/linux/bits/termios.h (ISIG, ISCANON, ECHO, ECHOE, ECHOK, ECHONL, NOFLSH, TOSTOP, IEXTEN): Move to termios-c_lflag.h. [__USE_MISC || (__USE_XOPEN && !__USE_XOPEN2K)] (XCASE): Likewise. [__USE_MISC] (ECHOCTL, ECHOPRT, ECHOKE, FLUSHO, PENDIN, EXTPROC): Likewise. * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
* termios: Consolidate control mode definitionsAdhemerval Zanella2019-01-031-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the termios symbolic constants used for output mode with c_cflag memver on its own header. The Linux generic implementation values match the kernel UAPI and each architecture with deviate values have their own implementation (in this case alpha and powerpc). No semantic change is expected, checked on a build against x86_64-linux-gnu, alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add termios-c_cflag.h. * sysdeps/unix/sysv/linux/bits/termios-c_cflag.h: New file. * sysdeps/unix/sysv/linux/alpha/bits/termios-c_cflag.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cflag.h: Likewise. * sysdeps/unix/sysv/linux/bits/termios.h (CSIZE, CS5, CS6, CS7, CS8, CSTOPB, CREAD, PARENB, PARODD, HUPCL, CLOCAL): Move to termios-c_cflag.h. * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
* termios: Consolidate Baud Rate Selection definitions (BZ#23783)Adhemerval Zanella2019-01-032-28/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the termios symbolic constants used for baud rates selection used along with speed_t on its own header. The Linux generic implementation values match the kernel UAPI and each architecture with deviate values have their own implementation (in this case alpha and powerpc). No semantic change is expected, checked on a build against x86_64-linux-gnu, alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu. [BZ #23783] * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add termios-baud.h. * sysdeps/unix/sysv/linux/bits/termios-baud.h: New file. * sysdeps/unix/sysv/linux/alpha/bits/termios-baud.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/termios-baud.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/termios-baud.h: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/termios.h (B57600, B115200, B230400, B460800, B500000, B576000, B921600, B1000000, B1152000, B1500000, B2000000, B2500000, B3000000, B3500000, B4000000, __MAX_BAUD): Move to termios-baud.h. [__USE_MISC] (CBAUD, CBAUDEX): Likewise. * sysdeps/unix/sysv/linux/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.