about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/microblaze
Commit message (Collapse)AuthorAgeFilesLines
* posix: Add compat glob symbol to not follow dangling symbolsAdhemerval Zanella2017-09-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch follows commit 5554304f0 (posix: Allow glob to match dangling symlinks [BZ #866]) by adding a compat symbol that follow previous semantic of not following dangling symlinks and thus avoiding call gl_lstat with GLOB_ALTDIRFUNC. It avoids failure with old binaries that not set the alternate function pointer for lstat (GNUmake for instance). The following scenario, for instance, fails with current GNUmake because glibc will access unitialized memory when calling gl_lstat: $ cat src/t/t.c int main () { return 0; } $ cat Makefile SRC = $(wildcard src/*/t.c) OBJ = $(patsubst src/%.c, obj/%.o, $(SRC)) prog: $(OBJ) $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJ) -o prog obj/%.o: src/%.c $(CC) $(CFLAGS) -c $< -o $@ $ make This works as expected with the patch applied. Since it is for generic ABI, default compat symbols are added with override for Linux due LFS. Now we have two compat symbols for glob on Linux: 1. sysdeps/unix/sysv/linux/oldglob.c which implements glob64 with the old dirent layout. For this implementation I also set it to not follow dangling symlinks (which is the safest path). 2. sysdeps/unix/sysv/linux/glob{64}-lstat-compat.c which implements the compat symbol for dangling symlinks. As for generic glob, the implementation uses XSTAT_IS_XSTAT64 to define whether both __glob_lstat_compat and __glob64_lstat_compat should be different implementations. For archictures that define XSTAT_IS_XSTAT64, __glob_lstat_compat is aliased to __glob64_lstat_compat. 3. sysdeps/unix/sysv/linux/alpha/oldglob.c with a different glob_t layout. As for 1. this patch changes it to not follow dangling symlinks. The patch also bumps _GNU_GLOB_INTERFACE_VERSION to 2 to advertise the new semantic. On GNUmake, for instance, it will force to it use its internal glob implementation instead and avoiding triggering the same failure on builds against newer GLIBCs. Checked on x86_64-linux-gnu and i686-linux-gnu. I also checked with a build against the major ABIs required to check for the abilist. The changes should also work on gnulib (I run gnulib-tool.py check glob and it shown no regressions). [BZ #22183] * include/gnu-versions.h (_GNU_GLOB_INTERFACE_VERSION): Increase version to 2. * posix/Makefile (routines): Add glob-lstat-compat and glob64-lstat-compat. * posix/Versions (GLIBC_2.27, glob, glob64): Add symbol version. * posix/glob-lstat-compat.c: New file. * posix/glob64-lstat-compat.c: Likewise. * posix/tst-glob_lstat_compat.c: Likewise. * sysdeps/unix/sysv/linux/glob-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/alpha/glob-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/glob64-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/alpha/glob.c: Remove file. * posix/glob.c (glob_lstat): New function. (glob): Rename to __glob and add versioned symbol to 2.27. (glob_in_dir): Use glob_lstat. * posix/glob64.c (glob64): Add GLOB_ATTRIBUTE. * sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/glob.c (glob): Add versioned symbol for 2.27. * sysdeps/unix/sysv/linux/glob64.c (glob64): Likewise. * sysdeps/unix/sysv/linux/oldglob.c (GLOB_NO_LSTAT): Define. * sysdeps/unix/sysv/linux/alpha/oldglob.c (__old_glob): Do not use gl_lstat on glob call. * sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add GLIBC_2.27 glob and glob64 symbols. * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist: Likewise. * sysdeps/unix/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* New expf and exp2f version without SVID compat wrapperSzabolcs Nagy2017-09-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the expf and exp2f error handling semantics to only set errno accoring to POSIX rules. New symbol version is introduced at GLIBC_2.27. The old wrappers are kept for compat symbols. Internal calls to __expf now get the new error semantics, this seems to only affect sysdeps/i386/fpu/s_expm1f.S where the errno-only behaviour should be correct. ia64 needed assembly change to have the new and compat versioned symbol map to the same function. All linux libm abilists are updated. * math/Versions (expf): New libm symbol at GLIBC_2.27. (exp2f): Likewise. * math/w_exp2f.c: New file. * math/w_expf.c: New file. * math/w_exp2f_compat.c (__exp2f_compat): For compat symbol only. * math/w_expf_compat.c (__expf_compat): Likewise. * sysdeps/ia64/fpu/e_exp2f.S: Add versioned symbols. * sysdeps/ia64/fpu/e_expf.S: Likewise. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Update. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Use execveat syscall in fexecve (bug 22134)Andreas Schwab2017-09-191-0/+5
| | | | | By using execveat we no longer depend on /proc. The execveat syscall was introduced in 3.19, except for a few late comers.
* Remove NO_CANCELLATION macroAdhemerval Zanella2017-08-311-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The NO_CANCELLATION macro is used currently on generic headers to define non cancellable syscalls and on Linux fcntl to implement the non cancellable variation. Former should be single-handled by not-cancel.h header and former could be simplified build both cancellable and non cancellable for default objects and alias the non-cancellable to default one for rtld ones (since Linux already support cancellation as default). This patch thus removes the NO_CANCELLATION macro and its usage. The generic non cancellable fcntl is route to internal fcntl. Checked on x86_64-linux-gnu and i686-linux-gnu. Also checked with a build again major ABIs. * sysdeps/generic/not-cancel.h (NO_CANCELLATION): Remove macro. * sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/arm/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (NO_CANCELLATION): Likewise * sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/tile/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/not-cancel.h (__fcntl_nocancel): Add hidden prototype. * sysdeps/unix/sysv/linux/fcntl.c (__fcntl_nocancel): Define only for !IS_IN (rtld) and remove NO_CANCELLATION usage.
* Fix mcontext_t sigcontext namespace (bug 21457).Joseph Myers2017-08-301-0/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch completes the ucontext.h namespace fixes by fixing issues related to the use of struct sigcontext as mcontext_t, and inclusion of <bits/sigcontext.h> even when struct sigcontext is not so used. Inclusion of <bits/sigcontext.h> by <sys/ucontext.h> is removed; the way to get the sigcontext structure is by including <signal.h> (in a context where __USE_MISC is defined); the sysdeps/generic version of sys/ucontext.h keeps the inclusion by necessity, with a comment about how this is not namespace-clean, but the only configuration that used it, MicroBlaze, gets its own version of the header in this patch. Where mcontext_t was typedefed to struct sigcontext, the contents of struct sigcontext are inserted (with appropriate namespace handling to prefix fields with __ when __USE_MISC is not defined); review should check that this has been done correctly in each case, whether the definition of struct sigcontext comes from glibc headers or from the Linux kernel. This changes C++ name mangling on affected architectures (which do not include x86_64/x86). Tested for x86_64, and with build-many-glibcs.py. 2017-08-14 Joseph Myers <joseph@codesourcery.com> [BZ #21457] * sysdeps/arm/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/generic/sys/ucontext.h: Add comment about use of struct sigcontext and namespace requirements. * sysdeps/i386/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/m68k/sys/ucontext.h: Likewise. * sysdeps/mips/sys/ucontext.h: Likewise. Include <bits/types.h>. * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym (oEXTENSION): Use __glibc_reserved1 instead of __reserved. * sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym: Use mcontext_t instead of struct sigcontext. * sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/ia64/makecontext.c (__makecontext): Use mcontext_t instead of struct sigcontext. * sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym: Use mcontext_t instead of struct sigcontext. * sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): New macro. (struct __ia64_fpreg_mcontext): New type. (mcontext_t): Define structure contents rather than using struct sigcontext. (_SC_GR0_OFFSET): Use mcontext_t instead of struct sigcontext. (uc_sigmask): Define using __ctx. (uc_stack): Likewise. * sysdeps/unix/sysv/linux/ia64/sys/procfs.h: Include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: New file. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include <bits/sigcontext.h>. Include <bits/types.h>. * conform/Makefile (test-xfail-XPG42/signal.h/conform): Remove. (test-xfail-XPG42/sys/wait.h/conform): Likewise. (test-xfail-XPG42/ucontext.h/conform): Likewise. (test-xfail-UNIX98/signal.h/conform): Likewise. (test-xfail-UNIX98/sys/wait.h/conform): Likewise. (test-xfail-UNIX98/ucontext.h/conform): Likewise. (test-xfail-XOPEN2K/signal.h/conform): Likewise. (test-xfail-XOPEN2K/sys/wait.h/conform): Likewise. (test-xfail-XOPEN2K/ucontext.h/conform): Likewise. (test-xfail-POSIX2008/signal.h/conform): Likewise. (test-xfail-POSIX2008/sys/wait.h/conform): Likewise. (test-xfail-XOPEN2K8/signal.h/conform): Likewise. (test-xfail-XOPEN2K8/sys/wait.h/conform): Likewise.
* Remove cancellation support for syscall generationAdhemerval Zanella2017-08-241-119/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the cancellation mark from the auto-generation syscall script. Now all the cancellable syscalls are done throught C code using the SYSCALL_CANCEL macro. It simplifies the assembly required to each architecture port, since the SYSCALL_CANCEL uses the already defined INLINE_SYSCALL macros, and allows a more straigh fix on cancellation machanism (since no more specific assembly fixes will be required). Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.A Also with build-many-glibc.py with remaning touched architectures. * sysdeps/unix/make-syscalls.sh: Remove cancellable tagging for syscall definitions. * sysdeps/unix/syscall-template.S (SYSCALL_CANCELLABLE): Remove definition. * sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (__local_enable_asynccancel): Likewise. [IS_IN (libpthread)] (__local_disable_asynccancel): Likewise. [IS_IN (libc)] (__local_enable_asynccancel): Likewise. [IS_IN (libc)] (__local_enable_asynccancel): Likewise. [IS_IN (librt)] (__local_disable_asynccancel): Likewise. [IS_IN (librt)] (__local_disable_asynccancel): Likewise. (CENABLE): Likewise. (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/arm/sysdep-cancel.h (PSEUDO): Remove defintion. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/sysv/linux/powerpc/powerpc32/sysdep-cancel.h: Remove file. * sysdeps/sysv/linux/powerpc/powerpc64/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h: New file. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h: Remove file. * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h: New file. * sysdeps/unix/sysv/linux/tile/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* ld.so: Introduce struct dl_exceptionFlorian Weimer2017-08-101-0/+2
| | | | | | This commit separates allocating and raising exceptions. This simplifies catching and re-raising them because it is no longer necessary to make a temporary, on-stack copy of the exception message.
* microblaze: Resolve non-relocatable branch in pt-vfork.S (BZ#21779)Nathan Rossi2017-07-281-1/+1
| | | | | | | | | | | | | | | | | The relative branch directly to __libc_vfork results in an relocation that cannot be resolved. Specifically a R_MICROBLAZE_64_PCREL relocation is created for this branch, however for MicroBlaze R_MICROBLAZE_64_PCREL type relocations symbols are not resolved. Additionally due to the branch being located in the .text section the instruction cannot be rewritten as the section is not writable, and causes a segfault at runtime when loading libpthread. To resolve this issue, ensure the branch is done using PLT. This removes the need to modify the instruction and trades the R_MICROBLAZE_64_PCREL for a more common R_MICROBLAZE_JUMP via the PLT. [BZ #21779] * sysdeps/unix/sysv/linux/microblaze/pt-vfork.S: Branch using PLT.
* Consolidate Linux fcntl implementationAdhemerval Zanella2017-06-301-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the fcntl Linux syscall generation on sysdeps/unix/sysv/linux/fcntl.c. It basically removes all the architecture specific implementations. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/arm/fcntl.c: Remove file. * sysdeps/unix/sysv/linux/generic/wordsize-32/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/hppa/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/i386/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/m68k/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/microblaze/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/sh/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/fcntl.c: New file. * sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c: Refactor to use default implementation.
* Rename struct ucontext tag (bug 21457).Joseph Myers2017-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ucontext_t type has a tag struct ucontext. As with previous such issues for siginfo_t and stack_t, this tag is not permitted by POSIX (is not in a reserved namespace), and so namespace conformance means breaking C++ name mangling for this type. In this case, the type does need to have some tag rather than just a typedef name, because it includes a pointer to itself. This patch uses struct ucontext_t as the new tag, so the type is mangled as ucontext_t (the POSIX *_t reservation applies in all namespaces, not just the namespace of ordinary identifiers). Another reserved name such as struct __ucontext could of course be used. Because of other namespace issues, this patch does not by itself fix bug 21457 or allow any XFAILs to be removed. Tested for x86_64, and with build-many-glibcs.py. [BZ #21457] * sysdeps/arm/sys/ucontext.h (struct ucontext): Rename to struct ucontext_t. * sysdeps/generic/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/i386/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/m68k/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/mips/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/alpha/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/arm/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/ia64/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/s390/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/tile/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h (struct ucontext): Likewise. * sysdeps/powerpc/powerpc32/backtrace.c (struct rt_signal_frame_32): Likewise. * sysdeps/powerpc/powerpc64/backtrace.c (struct signal_frame_64): Likewise. * sysdeps/unix/sysv/linux/aarch64/kernel_rt_sigframe.h (struct kernel_rt_sigframe): Likewise. * sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h (SIGCONTEXT): Likewise. * sysdeps/unix/sysv/linux/arm/register-dump.h (register_dump): Likewise. * sysdeps/unix/sysv/linux/arm/sigcontextinfo.h (SIGCONTEXT): Likewise. * sysdeps/unix/sysv/linux/hppa/profil-counter.h (__profil_counter): Likewise. * sysdeps/unix/sysv/linux/microblaze/sigcontextinfo.h (SIGCONTEXT): Likewise. * sysdeps/unix/sysv/linux/mips/kernel_rt_sigframe.h (struct kernel_rt_sigframe): Likewise. * sysdeps/unix/sysv/linux/nios2/kernel_rt_sigframe.h (struct kernel_rt_sigframe): Likewise. * sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h (SIGCONTEXT): Likewise. * sysdeps/unix/sysv/linux/sh/makecontext.S (__makecontext): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/makecontext.c (__start_context): Likewise. * sysdeps/unix/sysv/linux/tile/sigcontextinfo.h (SIGCONTEXT): Likewise. * sysdeps/unix/sysv/linux/x86_64/register-dump.h (register_dump): Likewise. * sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h (SIGCONTEXT): Likewise.
* Avoid tickling a linker bug from microblaze pt-vfork.S.Zack Weinberg2017-06-013-2/+50
| | | | | | | | | | | | | | | | | | | | libpthread used to have its own vfork implementation that differed from libc's only in having a pointless micro-optimization. There is no longer any use to having a separate copy in libpthread, but the historical ABI requires a compatibility shim. microblaze was trying to be slightly too clever about how it did this, and tickled a linker bug. The linker bug should get fixed eventually, but there's no reason for us to keep tickling it in the meantime. This doesn't reuse the generic pt-vfork.c because microblaze doesn't have IFUNC support yet, and it doesn't reuse aarch64/pt-vfork.c because that fails to generate a tailcall (with GCC 7.1.1). * sysdeps/unix/sysv/linux/microblaze/pt-vfork.S: Don't include alpha/pt-vfork.S. Provide own compat shim for vfork and __vfork. * sysdeps/unix/sysv/linux/microblaze/vfork.S: Add __libc_vfork alias. * sysdeps/unix/sysv/linux/microblaze/localplt.data: libpthread.so no longer references __errno_location.
* posix: Implement preadv2 and pwritev2Adhemerval Zanella2017-05-311-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support of preadv2 and pwritev2 which are similar to preadv/pwritev but with an extra flag argument. As for preadv/pwritev both interfaces are added a non-standard GNU API. For default 'posix' implementation trying to emulate the Linux supported flags is troublesome: * We can not temporary change the file state of the O_DSYNC and O_SYNC flags to emulate RWF_{D}SYNC (attempts to change the state of using fcntl are silently ignored). * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal semantic not provided by any other flag (O_NONBLOCK for instance). So default sysdeps/posix implementations fails with EOPNOTSUPP for any non supported flag (which are none currently) calls generic preadv/pwritev. Basically this implementation supports only preadv2 called as preadv (with flags sets to 0). The Linux one uses the preadv2/pwritev2 syscall if defined, otherwise it call preadv/writev. Instead of using the previous __ASSUME_* to unconditionally issue the syscall (and avoid building the fallback routine), it call pread/write if the preadv2/pwritev2 syscalls fails. The idea is just avoid adding another __ASSUME_* and checking each architecture on every kernel bump and simplify code conditionals. Checked on x86_64-linux-gnu and on i686-linux-gnu and a check with run-built-tests=no on aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, mips{64,64n32}-linux-gnu, nios2-linux-gnu, powerpc{64,64le}-linux-gnu, s390{x}-linux-gnu, sparc{64,v9}-linux-gnu, tile{gx,pro}-linux-gnu, and sh4-linux-gnu (all using gcc 6.3). * NEWS: Add note about pwritev2 and preadv2 inclusion. * misc/Makefile (routines): Add preadv2, preadv64v2, pwritev2, and pwritev64v2. (tests): Add tst-preadvwritev2 and tst-preadvwritev64v2. * misc/Versions (GLIBC_2.26): Add preadv2, preadv64v2, pwritev2, and pwritev64v2. * misc/preadv2.c: New file. * misc/preadv64v2.c: Likewise. * misc/pwritev2.c: Likewise. * misc/pwritev64v2.c: Likewise. * misc/tst-preadvwritev2.c: Likewise. * misc/tst-preadvwritev64v2.c: Likewise. * manual/llio.texi: Add preadv2 and pwritev2 documentation. * misc/sys/uio.h [__USE_GNU && !__USE_FILE_OFFSET64] (preadv2): New prototype. [__USE_GNU && !__USE_FILE_OFFSET64] (pwritev2): Likewise. [__USE_GNU && __USE_FILE_OFFSET64] (preadv64v2): Likewise. [__USE_GNU && __USE_FILE_OFFSET64] (pwritev64v2): Likewise. * misc/tst-preadvwritev-common.c (PREADV): Define if not defined. (PWRITEV): Likewise. (do_test_with_offset): Use PREADV and PWRITEV macros and check for ENOSYS. * nptl/tst-cancel4.c (tf_pwritev2): New test. (tf_preadv2): Likewise. (tf_fsync): Add tf_pwritev2 and tf_preadv2. * sysdeps/posix/preadv2.c: Likewise. * sysdeps/posix/preadv64v2.c: Likewise. * sysdeps/posix/pwritev2.c: Likewise. * sysdeps/posix/pwritev64v2.c: Likewise. * sysdeps/unix/sysv/linux/kernel-features.h: Add comment for syscall support in kernel. * sysdeps/unix/sysv/linux/preadv2.c: Likewise. * sysdeps/unix/sysv/linux/preadv64v2.c: Likewise. * sysdeps/unix/sysv/linux/pwritev2.c: Likewise. * sysdeps/unix/sysv/linux/pwritev64v2.c: Likewise. * sysdeps/unix/sysv/linux/preadv.c (preadv): Add libc_hidden_def. * sysdeps/unix/sysv/linux/preadv64.c (preadv64): Likewise. * sysdeps/unix/sysv/linux/pwritev.c (pwritev): Likewise. * sysdeps/unix/sysv/linux/pwritev64.c (pwritev64): Likewise. * sysdeps/unix/sysv/linux/bits/uio.h: Add supported preadv2/pwritev2 support flags on Linux. * sysdeps/unix/sysv/linux/aarch64/libc.abilist (GLIBC_2.26): Add preadv2, preadv64v2, pwritev2, pwritev64v2. * sysdeps/unix/sysv/linux/alpha/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/arm/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/hppa/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/ia64/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/microblaze/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/nios2/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/sh/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/sysv/linux/tile/tilegx/tilegx32/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/sysv/linux/tile/tilegx/tilegx64/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist (GLIBC_2.26): Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist (GLIBC_2.26): Likewise.
* Add reallocarray functionDennis Wölfing2017-05-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reallocarray function is an extension from OpenBSD. It is an integer-overflow-safe replacement for realloc(p, X*Y) and malloc(X*Y) (realloc(NULL, X*Y)). It can therefore help in preventing certain security issues in code. This is an updated version of a patch originally submitted by Rüdiger Sonderfeld in May 2014 [1]. Checked on i686-linux-gnu and x86_64-linux-gnu. [1] <https://sourceware.org/ml/libc-alpha/2014-05/msg00481.html>. 2017-05-30 Dennis Wölfing <denniswoelfing@gmx.de> Rüdiger Sonderfeld <ruediger@c-plusplus.de> * include/stdlib.h (__libc_reallocarray): New declaration. * malloc/Makefile (routines): Add reallocarray. (tests): Add tst-reallocarray.c. * malloc/Versions: Add reallocarray and __libc_reallocarray. * malloc/malloc-internal.h (check_mul_overflow_size_t): New inline function. * malloc/malloc.h (reallocarray): New declaration. * stdlib/stdlib.h (reallocarray): Likewise. * malloc/reallocarray.c: New file. * malloc/tst-reallocarray.c: New test file. * manual/memory.texi: Document reallocarray. * sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add reallocarray. * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tilepro/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* Simplify accept4, recvmmsg, sendmmsg code.Joseph Myers2017-05-091-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The accept4, recvmmsg and sendmmsg functions had macros __ASSUME_*_SYSCALL_WITH_SOCKETCALL. Before we could assume kernels with the relevant functionality, these macros represented the conditions under which, on a socketcall architecture, glibc could just call the syscall unconditionally and not have to deal with socketcall at all for those functions, because if the syscall didn't work for them the socketcall call wouldn't either. Now we can assume kernels with the relevant functionality, the only question is whether we can assume the syscall is present; if not, we are on a socketcall architecture and just use socketcall instead. Thus, this patch removes the macros that are no longer necessary, and simplifies the code for accept4, recvmmsg and sendmmsg to use the same logic as the other C implementations of socket functions that may use a syscall or socketcall depending on kernel support. Tested for x86_64 and x86. * sysdeps/unix/sysv/linux/accept4.c (accept4): Use syscall if [__ASSUME_ACCEPT4_SYSCALL], otherwise socketcall. * sysdeps/unix/sysv/linux/recvmmsg.c (recvmmsg): Use syscall if [__ASSUME_RECVMMSG_SYSCALL], otherwise socketcall. * sysdeps/unix/sysv/linux/sendmmsg.c (__sendmmsg): Use syscall if [__ASSUME_SENDMMSG_SYSCALL], otherwise socketcall. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_ACCEPT4_SYSCALL): Move to general list of macros for socket syscalls. (__ASSUME_RECVMMSG_SYSCALL): Likewise. (__ASSUME_SENDMMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL): Remove. (__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL): Remove. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_ACCEPT4_SYSCALL_WITH_SOCKETCALL): Likewise. (__ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL): Likewise. (__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL): Likewise.
* posix: Fix internal p{read,write} plt usageAdhemerval Zanella2017-05-021-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds internal alias for __pread, __pread64, and __pwrite following the already in place one for __pwrite64. This is not used in any implementation but on microblaze on preadv/pwritev fallback (since it does not define __ASSUME_PREADV). In fact it was signaled by commit c35db50ff5 which update the expected localptl.data for the architecture based on resulted value. This patch updates the plt for microblaze now that p{read,write}{64} are correctly routed to use internal alias. Checked on x86_64-linux-gnu and a build for all supported architectures (no all variants although). * include/unistd.h (__pread): Add libc_hidden_proto. (__pread64): Likewise. (__pwrite): Likewise. * sysdeps/unix/sysv/linux/microblaze/localplt.data [libc.so] (__pread64): Remove. * sysdeps/unix/sysv/linux/pread.c (__pread64): Add libc_hidden_weak. * sysdeps/unix/sysv/linux/pread64.c (__pread64): Likewise. * sysdeps/unix/sysv/linux/pwrite.c (__pwrite): Likewise.
* Consolidate Linux mmap implementation (BZ#21270)Adhemerval Zanella2017-04-121-50/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates all Linux mmap implementations on default sysdeps/unix/sysv/linux/mmap{64}.c one. To accomodate all required architecture specific requeriments a new internal header is created (mmap_internal.h) where each architecture add its specific code requirements. Currently only x86_64 (to define MMAP_PREPARE to add MAP_32BITS), s390 (which have a different kernel ABI for mmap), m68k (which have variable minimum page sizes), and MIPS n32 (which zero extend the offset to handle negative one correctly) redefine the new header. The patch also fixes BZ#21270 where default mmap64 on architectures which uses mmap2 silent truncates large offsets value (larger than 1 << (page shift + 8 * sizeof (off_t)) or 1<<44 on architectures with 4096 bytes page size). The new consolidate implementation returns EINVAL as allowed by POSIX. It also adds a tests for on current tst-mmap-offset one. I have run a full make check on x86_64, x86_64-32, i686, aarch64, armhf, powerpc, powerpc64le, sparc64, and sparcv9 without any regressions. I also ran some basic tests (tst-mmap-offset) on sh4, m68k, and on qemu simulated MIPS32 and MIPS64. [BZ #21270] * posix/tst-mmap-offset.c (do_prepare): New function. (do_test): Rename to do_test_bz18877 and use FAIL_RET. (do_test_bz21270): New function. * sysdeps/unix/sysv/linux/aarch64/mmap.c: Remove file. * sysdeps/unix/sysv/linux/arm/mmap.c: Remove file. * sysdeps/unix/sysv/linux/generic/wordsize-32/mmap.c: Likewise. * sysdeps/unix/sysv/linux/hppa/mmap.c: Likewise. * sysdeps/unix/sysv/linux/i386/mmap.c: Likewise. * sysdeps/unix/sysv/linux/m68k/mmap.S: Likewise. * sysdeps/unix/sysv/linux/m68k/mmap64.c: Likewise. * sysdeps/unix/sysv/linux/microblaze/mmap.S: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/mmap.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/mmap.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/mmap64.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/mmap.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/mmap.S: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/mmap.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/mmap64.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/mmap.c: Likewise. * sysdeps/unix/sysv/linux/mmap_internal.h: New file. * sysdeps/unix/sysv/linux/m68k/mmap_internal.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/mmap_internal.h: Likewise. * sysdeps/unix/sysv/linux/s390/mmap_internal.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/mmap_internal.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list: Remove mmap from auto-generation list. * sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mmap.c: New file. * sysdeps/unix/sysv/linux/mmap64.c (__mmap64): Add check for invalid offsets and support for mmap2 syscall.
* Consolidate set* Linux implementationAdhemerval Zanella2017-03-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the Linux setegid, seteuid, setgid, setgroups, setregid, setresgid, setresuid, setreuid, and setuid implementation on default sysdeps/unix/sysv/linux/set*.c implementation. It basically removes all the architecture define implementations and add support for __NR_set*32 syscall on Linux default implementation. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/arm/setegid.c: Remove file. * sysdeps/unix/sysv/linux/arm/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setgid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/arm/setregid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setegid.c: Likewise. * sysdeps/unix/sysv/linux/i386/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setgid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/i386/setregid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setegid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setgid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setregid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setuid.c: Likewise. * sysdeps/unix/sysv/linux/microblaze/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setegid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setgid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setregid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setegid.c: Likewise. * sysdeps/unix/sysv/linux/sh/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setgid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/sh/setregid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setgid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setregid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setuid.c: Likewise. * sysdeps/unix/sysv/linux/setegid.c (setegid): Use INLINE_SYSCALL_ERROR_RETURN_VALUE. * sysdeps/unix/sysv/linux/seteuid.c (seteuid): Likewise. * sysdeps/unix/sysv/linux/setgid.c (setgid): Use __NR_setgid32 if defined. * sysdeps/unix/sysv/linux/setgroups.c (setgroups): Use __NR_setgroups32 if defined. * sysdeps/unix/sysv/linux/setregid.c (__setregid): Use __NR_setregid32 if defined. * sysdeps/unix/sysv/linux/setresgid.c (__setresgid): Use __NR_setresgid32 is defined. * sysdeps/unix/sysv/linux/setresuid.c (__setresuid): Use __NR_setresuid32 if defined. * sysdeps/unix/sysv/linux/setreuid.c (__setreuid): Use __NR_setreuid32 if defined. * sysdeps/unix/sysv/linux/setuid.c (__setuid): Use __NR_setuid32 if defined.
* Consolidate Linux sendto implementationAdhemerval Zanella2017-03-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the sendto Linux syscall implementation on sysdeps/unix/sysv/linux/sendto.c. The changes are: 1. Define __ASSUME_SENDTO_SYSCALL by default. 2. Undef it for architectures that do not support __NR_sendto. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove sendto from auto-generation list. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Define by default. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Undef it is kernel does not support __NR_sendto. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Remove definition. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h: (__ASSUME_SENDTO_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sendto.c: Simplify includes.
* Consolidate Linux recvfrom implementationAdhemerval Zanella2017-03-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the recvfrom Linux syscall implementation on sysdeps/unix/sysv/linux/recvfrom.c. The changes are: 1. Define __ASSUME_RECVFROM_SYSCALL by default 2. Undef it for architectures that do not support __NR_recvfrom. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove recvfrom from auto-generation list. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Define by default. (__ASSUME_RECVFROM_SYSCALL): Undef it if kernel does not support __NR_recvfrom. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Remove definition. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/recvfrom.c: Simplify includes.
* Consolidate Linux accept implementationAdhemerval Zanella2017-03-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the accept Linux syscall implementation on sysdeps/unix/sysv/linux/accept.c. The changes are: 1. Remove accept from auto-generation syscalls.list on the architecture that uses __NR_accept. 2. Define __NR_accept as default (__ASSUME_ACCEPT_SYSCALL) and undef for architectures that do not support it. 3. Remove __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL and decide to use __NR_accept4 for accept generation based on __ASSUME_ACCEPT4_SYSCALL. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/accept.c (__libc_accept): Replace __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL by __ASSUME_ACCEPT4_SYSCALL. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove accept from auto-generation list. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define. (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): New define. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define. (__ASSUME_ACCEPT_SYSCALL): Define wheter kernel version supports. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Define. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define. (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Undefine for 32 bits.
* Restore clock_* librt exports for MicroBlaze (bug 21061).Joseph Myers2017-01-191-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | MicroBlaze had clock_* functions exported from librt in glibc 2.18 and 2.19, as confirmed in <https://sourceware.org/ml/libc-alpha/2017-01/msg00369.html>, and they then disappeared in 2.20, presumably as a result of the fix <https://sourceware.org/ml/libc-alpha/2014-02/msg00598.html> for a Versions.def bug that had resulted in their unintended inclusion in 2.18 (followed by removal of the Versions.def mechanism that allowed such bugs). As they were released in that library, they should be considered part of the GLIBC_2.18 ABI and so restored for the sake of any binaries that expect them in that library. This patch restores them by adding a MicroBlaze version of clock-compat.c that overrides SHLIB_COMPAT. Tested (compilation only) with build-many-glibcs.py (where this fixes the librt ABI test failure; elf/check-execstack still fails and still needs architecture maintainer attention to fix it or XFAIL it with an appropriate explanatory comment). [BZ #21061] * sysdeps/unix/sysv/linux/microblaze/clock-compat.c: New file.
* Update MicroBlaze localplt.data.Joseph Myers2017-01-091-1/+2
| | | | | | | | | | | | | This patch updates the MicroBlaze localplt.data based on the results of a build with build-many-glibcs.py. This is simply an empirical update; quite possibly the port could be optimized to remove more local PLT entry usage. Tested (compilation tests) with build-many-glibcs.py. * sysdeps/unix/sysv/linux/microblaze/localplt.data (__pread64): Add libc.so PLT entry. (__tls_get_addr): Make ld.so PLT entry optional.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-0119-19/+19
|
* Add fromfp functions.Joseph Myers2016-12-311-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines fromfp functions (fromfp, fromfpx, ufromfp, ufromfpx, and float and long double variants) to convert from floating-point to an integer type with any signedness and any given width up to that of intmax_t, in any of the five IEEE rounding modes (the usual four for binary floating point, plus rounding to nearest with ties rounding away from zero), with control of whether in-range non-integer values should result in the "inexact" exception being raised. This patch implements these functions for glibc. These implementations are (apart from raising exceptions) pure integer implementations; it's entirely possible optimized versions could be devised for some architectures. A common math/fromfp.h header provides various common helper code that can readily be shared between the implementations for different types. For each type, the bulk of the implementation is also shared between the four functions, with wrappers that define UNSIGNED and INEXACT macros appropriately before including the main implementation. As the functions return intmax_t and uintmax_t without math.h being allowed to expose those typedef names, they are declared using __intmax_t and __uintmax_t as obtained from <bits/types.h>. The FP_INT_* rounding direction macros are defined as ascending integers in the order the names are listed in the TS; I see no significant value in allowing architectures to vary the values of them. The libm-test machinery is duly adapted to handle unsigned int arguments, and intmax_t and uintmax_t results. Because each test input is generally tested for four functions, five rounding modes and several different widths, the libm-test.inc additions are very large. Thus, the diffs in the body of this message exclude the libm-test.inc changes, with the full patch being attached gzipped. The bulk of the new tests were generated (expanded from a test input plus rounding results and information about where it lies in the relevant interval between integers, to libm-test tests for all relevant combinations of function, rounding direction and width) by a script that's included in the patch as math/gen-fromfp-tests.py (input data math/gen-fromfp-tests-inputs); as an ad hoc script that's not really expected to be rerun, it's not very polished, but it's at least plausibly useful for adding any further tests for these functions in future. I may split the libm-test tests up by function in future (so both libm-test.inc and auto-libm-test-out are split into separate files, and the tests for each function are also built and run separately), but not for 2.25. For no obvious reason, adding tgmath tests for the new functions resulted in -Wuninitialized errors from test-tgmath.c about the variable i being used uninitialized. Those errors were correct - the variable is read by the frexp version in test-tgmath.c (where real frexp would write through that pointer instead of reading it) - but I don't know why this patch would result in the pre-existing issue being newly detected. The patch initializes the variable to avoid those errors. With these changes, glibc 2.25 should have all the library features from TS 18661-1 other than the functions that round result to narrower type (and constant rounding directions, but I'm considering those mainly a compiler feature not a library one). Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfp): New declaration. [__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfpx): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfp): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfpx): Likewise. * math/tgmath.h (__TGMATH_TERNARY_FIRST_REAL_RET_ONLY): New macro. [__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfp): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfp): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfpx): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfpx): Likewise. * math/math.h: Include <bits/types.h>. [__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_INT_UPWARD): New enum constant and macro. (FP_INT_DOWNWARD): Likewise. (FP_INT_TOWARDZERO): Likewise. (FP_INT_TONEARESTFROMZERO): Likewise. (FP_INT_TONEAREST): Likewise. * math/Versions (fromfp): New libm symbol at version GLIBC_2.25. (fromfpf): Likewise. (fromfpl): Likewise. (ufromfp): Likewise. (ufromfpf): Likewise. (ufromfpl): Likewise. (fromfpx): Likewise. (fromfpxf): Likewise. (fromfpxl): Likewise. (ufromfpx): Likewise. (ufromfpxf): Likewise. (ufromfpxl): Likewise. * math/Makefile (libm-calls): Add s_fromfpF, s_ufromfpF, s_fromfpxF and s_ufromfpxF. * math/gen-fromfp-tests.py: New file. * math/gen-fromfp-tests-inputs: Likewise. * math/libm-test.inc: Include <stdint.h> (check_intmax_t): New function. (check_uintmax_t): Likewise. (struct test_fiu_M_data): New type. (struct test_fiu_U_data): Likewise. (RUN_TEST_fiu_M): New macro. (RUN_TEST_LOOP_fiu_M): Likewise. (RUN_TEST_fiu_U): Likewise. (RUN_TEST_LOOP_fiu_U): Likewise. (fromfp_test_data): New array. (fromfp_test): New function. (fromfpx_test_data): New array. (fromfpx_test): New function. (ufromfp_test_data): New array. (ufromfp_test): New function. (ufromfpx_test_data): New array. (ufromfpx_test): New function. (main): Call fromfp_test, fromfpx_test, ufromfp_test and ufromfpx_test. * math/gen-libm-test.pl (parse_args): Handle u, M and U descriptor characters. * math/test-tgmath-ret.c: Include <stdint.h>. (rm): New variable. (width): Likewise. (CHECK_RET_CONST_TYPE): Take extra arguments and pass them to called function. (CHECK_RET_CONST_FLOAT): Take extra arguments and pass them to CHECK_RET_CONST_TYPE. (CHECK_RET_CONST_DOUBLE): Likewise. (CHECK_RET_CONST_LDOUBLE): Likewise. (CHECK_RET_CONST): Take extra arguments and pass them to calls macros. (fromfp): New CHECK_RET_CONST call. (ufromfp): Likewise. (fromfpx): Likewise. (ufromfpx): Likewise. (do_test): Call check_return_fromfp, check_return_ufromfp, check_return_fromfpx and check_return_ufromfpx. * math/test-tgmath.c: Include <stdint.h> (NCALLS): Increase to 138. (F(compile_test)): Initialize i. Call fromfp functions. (F(fromfp)): New function. (F(fromfpx)): Likewise. (F(ufromfp)): Likewise. (F(ufromfpx)): Likewise. * manual/arith.texi (Rounding Functions): Document FP_INT_UPWARD, FP_INT_DOWNWARD, FP_INT_TOWARDZERO, FP_INT_TONEARESTFROMZERO, FP_INT_TONEAREST, fromfp, fromfpf, fromfpl, ufromfp, ufromfpf, ufromfpl, fromfpx, fromfpxf, fromfpxl, ufromfpx, ufromfpxf and ufromfpxl. * manual/libm-err-tab.pl (@all_functions): Add fromfp, fromfpx, ufromfp and ufromfpx. * math/fromfp.h: New file. * sysdeps/ieee754/dbl-64/s_fromfp.c: Likewise. * sysdeps/ieee754/dbl-64/s_fromfp_main.c: Likewise. * sysdeps/ieee754/dbl-64/s_fromfpx.c: Likewise. * sysdeps/ieee754/dbl-64/s_ufromfp.c: Likewise. * sysdeps/ieee754/dbl-64/s_ufromfpx.c: Likewise. * sysdeps/ieee754/flt-32/s_fromfpf.c: Likewise. * sysdeps/ieee754/flt-32/s_fromfpf_main.c: Likewise. * sysdeps/ieee754/flt-32/s_fromfpxf.c: Likewise. * sysdeps/ieee754/flt-32/s_ufromfpf.c: Likewise. * sysdeps/ieee754/flt-32/s_ufromfpxf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fromfpl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fromfpl_main.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_ufromfpl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_ufromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fromfpl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fromfpl_main.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_ufromfpl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_ufromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fromfpl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fromfpl_main.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_ufromfpl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_ufromfpxl.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fromfp, ufromfp, fromfpx and ufromfpx. (CFLAGS-nldbl-fromfp.c): New variable. (CFLAGS-nldbl-fromfpx.c): Likewise. (CFLAGS-nldbl-ufromfp.c): Likewise. (CFLAGS-nldbl-ufromfpx.c): Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-compat.h: Include <stdint.h>. * sysdeps/ieee754/ldbl-opt/nldbl-fromfp.c: New file. * sysdeps/ieee754/ldbl-opt/nldbl-fromfpx.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-ufromfp.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-ufromfpx.c: Likewise. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Use shmget syscall for linux implementationAdhemerval Zanella2016-12-281-4/+0
| | | | | | | | | | | | | | | | | | | | | this patch add a direct call to shmget syscall if it is supported by kernel features. Checked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/alpha/syscalls.list (shmget): Remove. * sysdeps/unix/sysv/linux/arm/syscalls.list (shmget): Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list (shmget): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (shmget): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (shmget): Likewise. * sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmget): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmget): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmget): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmget): Likewise. * sysdeps/unix/sysv/linux/shmget.c (shmget): Use shmget syscall if it is defined.
* Use shmdt syscall for linux implementationAdhemerval Zanella2016-12-281-1/+0
| | | | | | | | | | | | | | | | | | | | | this patch add a direct call to shmdt syscall if it is supported by kernel features. hecked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/alpha/syscalls.list (shmdt): Remove. * sysdeps/unix/sysv/linux/arm/syscalls.list (shmdt): Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list (shmdt): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (shmdt): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (shmdt): Likewise. * sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmdt): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmdt): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmdt): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmdt): Likewise. * sysdeps/unix/sysv/linux/shmdt.c (shmdt): Use shmdt syscall if it is defined.
* Consolidate Linux shmctl implementationAdhemerval Zanella2016-12-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the shmctl Linux implementation in only one default file, sysdeps/unix/sysv/linux/shmctl.c. If tries to use the direct syscall if it is supported, otherwise will use the old ipc multiplex mechanism. The patch also simplify header inclusion and reorganize internal compat symbol to be built only if old ipc is defined. Checked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove oldshmctl. * sysdeps/unix/sysv/linux/alpha/syscalls.list (shmctl): Remove. * sysdeps/unix/sysv/linux/arm/syscalls.list (shmctl): Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list (shmctl): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (shmctl): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (shmctl): Likewise. * sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmctl): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmctl): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmctl): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmctl): Likewise. * sysdeps/unix/sysv/linux/alpha/shmctl.c: Remove file. * sysdeps/unix/sysv/linux/arm/shmctl.c: Likewise. * sysdeps/unix/sysv/linux/microblaze/shmctl.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/shmctl.c: Use default implementation. * sysdeps/unix/sysv/linux/shmctl.c (__new_shmctl): Use shmctl syscall if it is defined.
* Use shmat syscall for Linux implementationAdhemerval Zanella2016-12-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | This patch add a direct call to shmat syscall if it is supported by kernel features. Checked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/alpha/syscalls.list (shmat): Remove. * sysdeps/unix/sysv/linux/arm/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/alpha/kernel-features.h (__NR_shmat): Define to __NR_osf_shmat. * sysdeps/unix/sysv/linux/shmat.c (shmat): Use shmat syscall if it is defined.
* Consolidate Linux semtimedop implementationAdhemerval Zanella2016-12-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the semtimedop Linux implementation in only one default file, sysdeps/unix/sysv/linux/semtimedop.c. If tries to use the direct syscall if it is supported, otherwise will use the old ipc multiplex mechanism. Checked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/alpha/syscalls.list (semtimedop): Remove. * sysdeps/unix/sysv/linux/arm/syscalls.list (semtimedop): Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list (semtimedop): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (semtimedop): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (semtimedop): Likewise. * sysdeps/unix/sysv/linux/microblaze/syscalls.list (semtimedop): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semtimedop): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (semtimedop): Likewise. * sysdeps/unix/sysv/linux/m68k/semtimedop.S: Remove file. * sysdeps/unix/sysv/linux/s390/semtimedop.c: Reorganize headers and add a comment about s390 syscall difference from default one. * sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Use semtimedop syscall if it is defined.
* Use semop syscall for Linux implementationAdhemerval Zanella2016-12-281-1/+0
| | | | | | | | | | | | | | | | | | | | | This patch add a direct call to semop syscall if it is supported by kernel headers. Checked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/alpha/syscalls.list (semop): Remove. * sysdeps/unix/sysv/linux/arm/syscalls.list (semop): Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list (semop): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (semop): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (semop): Likewise. * sysdeps/unix/sysv/linux/microblaze/syscalls.list (semop): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semop): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semop): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (semop): Likewise. * sysdeps/unix/sysv/linux/semop.c (semop): Use semop syscall if it is defined.
* Use semget syscall for Linux implementationAdhemerval Zanella2016-12-281-1/+0
| | | | | | | | | | | | | | | | | | | | | This patch add a direct call to semget syscall if it is supported by kernel features. hecked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/alpha/syscalls.list (semget): Remove. * sysdeps/unix/sysv/linux/arm/syscalls.list (semget): Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list (semget): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (semget): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (semget): Likewise. * sysdeps/unix/sysv/linux/microblaze/syscalls.list (semget): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semget): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semget): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (semget): Likewise. * sysdeps/unix/sysv/linux/semget.c (semget): Use semget syscall if it is defined.
* Consolidate Linux semctl implementationAdhemerval Zanella2016-12-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the semctl Linux implementation in only one default file, sysdeps/unix/sysv/linux/semctl.c. If tries to use the direct syscall if it is supported, otherwise will use the old ipc multiplex mechanism. The patch also simplify header inclusion and reorganize internal compat symbol to be built only if old ipc is defined. Checked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove oldsemctl. * sysdeps/unix/sysv/linux/alpha/semctl.c: Remove file. * sysdeps/unix/sysv/linux/arm/semctl.c: Likewise. * sysdeps/unix/sysv/linux/microblaze/semctl.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/semctl.c: Use defaulf implementation. * sysdeps/unix/sysv/linux/semctl.c (__new_semctl): Use semctl syscall if it is defined. * sysdeps/unix/sysv/linux/generic/syscalls.list (semctl): Remove. * sysdeps/unix/sysv/linux/alpha/syscalls.list (semctl): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (semctl): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (semctl): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semctl): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (semctl): Likewise.
* Use msgget syscall for Linux implementationAdhemerval Zanella2016-12-281-1/+0
| | | | | | | | | | | | | | | | | | | | | This patch add a direct call to msgget syscall if it is supported by kernel features. hecked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/alpha/syscalls.list (msgget): Remove. * sysdeps/unix/sysv/linux/arm/syscalls.list (msgget): Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list (msgget): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (msgget): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (msgget): Likewise. * sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgget): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgget): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgget): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgget): Likewise. * sysdeps/unix/sysv/linux/msgget.c (msgget): Use msgget syscall if define.
* Use msgsnd syscall for Linux implementationAdhemerval Zanella2016-12-281-1/+0
| | | | | | | | | | | | | | | | | | | | | This patch add a direct call to msgsnd syscall if it is supported by kernel features. hecked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/alpha/syscalls.list (msgsnd): Remove. * sysdeps/unix/sysv/linux/arm/syscalls.list (msgsnd): Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list (msgsnd): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (msgsnd): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (msgsnd): Likewise. * sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgsnd): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgsnd): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgsnd): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgsnd): Likewise. * sysdeps/unix/sysv/linux/msgsnd.c (__libc_msgsnd): Use msgsnd syscall if defined.
* Consolidate Linux msgrcv implementationAdhemerval Zanella2016-12-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the msgrcv Linux implementation in only one default file, sysdeps/unix/sysv/linux/msgrcv.c. If tries to use the direct syscall if it is supported, otherwise will use the old ipc multiplex mechanism. Checked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/alpha/syscalls.list (msgctl): Remove. * sysdeps/unix/sysv/linux/arm/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise, * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/msgrcv.c (__libc_msgrcv): Use msgrcv syscall if defined. * sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c: Remove file.
* Consolidate Linux msgctl implementationAdhemerval Zanella2016-12-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the msgctl Linux implementation in only one default file, sysdeps/unix/sysv/linux/msgctl.c. If tries to use the direct syscall if it is supported, otherwise will use the old ipc multiplex mechanism. The patch also simplify header inclusion and reorganize internal compat symbol to be built only if old ipc is defined. Checked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove oldmsgctl. * sysdeps/unix/sysv/linux/alpha/msgctl.c: Remove file. * sysdeps/unix/sysv/linux/arm/msgctl.c: Likewise. * sysdeps/unix/sysv/linux/microblaze/msgctl.c: Likewise. * sysdeps/unix/sysv/linux/alpha/syscalls.list (oldmsgctl): Remove. * sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/msgctl.c: Use default implementation. * sysdeps/unix/sysv/linux/msgctl.c (__new_msgctl): Use msgctl syscall if defined.
* Add roundeven, roundevenf, roundevenl.Joseph Myers2016-12-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines roundeven functions that round a floating-point number to the nearest integer, in that floating-point type, with ties rounding to even (whereas the round functions round ties away from zero). As with other such functions, they raise no exceptions apart from "invalid" for signaling NaNs. There was a previous user request for this functionality in glibc in <https://sourceware.org/ml/libc-help/2015-02/msg00005.html>. This patch implements these functions for glibc. The implementations use integer bit-manipulation (or roundeven on the high and low parts, in the IBM long double case). It's possible that there may be faster approaches on some architectures (in particular, on AArch64 the frintn instruction should do exactly what's required); I'll leave it to architecture maintainers or others interested to implement such architecture-specific versions if desired. (Where architectures have instructions to round to nearest integer in the current rounding mode, implementations saving and restoring the rounding mode - and dealing with exceptions if those instructions generate "inexact" - are also possible, though their performance depends on the cost of manipulating exceptions / rounding mode state.) Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (roundeven): New declaration. * math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (roundeven): New macro. * math/Versions (roundeven): New libm symbol at version GLIBC_2.25. (roundevenf): Likewise. (roundevenl): Likewise. * math/Makefile (libm-calls): Add s_roundevenF. * math/libm-test.inc (roundeven_test_data): New array. (roundeven_test): New function. (main): Call roundeven_test. * math/test-tgmath.c (NCALLS): Increase to 134. (F(compile_test)): Call roundeven. (F(roundeven)): New function. * manual/arith.texi (Rounding Functions): Document roundeven, roundevenf and roundevenl. * manual/libm-err-tab.pl (@all_functions): Add roundeven. * include/math.h (roundeven): Use libm_hidden_proto. * sysdeps/ieee754/dbl-64/s_roundeven.c: New file. * sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c: Likewise. * sysdeps/ieee754/flt-32/s_roundevenf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_roundevenl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_roundevenl.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add roundeven. (CFLAGS-nldbl-roundeven.c): New variable. * sysdeps/ieee754/ldbl-opt/nldbl-roundeven.c: New file. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Add fmaxmag, fminmag functions.Joseph Myers2016-12-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines fmaxmag and fminmag functions that return the argument with maximum / minimum magnitude (acting like fmax / fmin if the arguments have the same magnitude or either argument is a NaN). These correspond to the IEEE 754-2008 operations maxNumMag and minNumMag. This patch implements these functions for glibc. They are implemented with type-generic templates. Tests are based on those for fmax and fmin. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fmaxmag): New declaration. (fminmag): Likewise. * math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fmaxmag): New macro. [__GLIBC_USE (IEC_60559_BFP_EXT)] (fminmag): Likewise. * math/Versions (fmaxmag): New libm symbol at version GLIBC_2.25. (fmaxmagf): Likewise. (fmaxmagl): Likewise. (fminmag): Likewise. (fminmagf): Likewise. (fminmagl): Likewise. * math/Makefile (gen-libm-calls): Add s_fmaxmagF and s_fminmagF. * math/s_fmaxmag_template.c: New file. * math/s_fminmag_template.c: Likewise. * math/libm-test.inc (fmaxmag_test_data): New array. (fmaxmag_test): New function. (fminmag_test_data): New array. (fminmag_test): New function. (main): Call fmaxmag_test and fminmag_test. * math/test-tgmath.c (NCALLS): Increase to 132. (F(compile_test)): Call fmaxmag and fminmag. (F(fminmag)): New function. (F(fmaxmag)): Likewise. * manual/arith.texi (Misc FP Arithmetic): Document fminmag, fminmagf, fminmagl, fmaxmag, fmaxmagf and fmaxmagl. * manual/libm-err-tab.pl (@all_functions): Add fmaxmag and fminmag. * sysdeps/ieee754/ldbl-opt/nldbl-fmaxmag.c: New file. * sysdeps/ieee754/ldbl-opt/nldbl-fminmag.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_fminmagl.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fmaxmag and fminmag. (CFLAGS-nldbl-fmaxmag.c): New variable. (CFLAGS-nldbl-fminmag.c): Likewise. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* New string function explicit_bzero (from OpenBSD).Zack Weinberg2016-12-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | explicit_bzero(s, n) is the same as memset(s, 0, n), except that the compiler is not allowed to delete a call to explicit_bzero even if the memory pointed to by 's' is dead after the call. Right now, this effect is achieved externally by having explicit_bzero be a function whose semantics are unknown to the compiler, and internally, with a no-op asm statement that clobbers memory. This does mean that small explicit_bzero operations cannot be expanded inline as small memset operations can, but on the other hand, small memset operations do get deleted by the compiler. Hopefully full compiler support for explicit_bzero will happen relatively soon. There are two new tests: test-explicit_bzero.c verifies the visible semantics in the same way as the existing test-bzero.c, and tst-xbzero-opt.c verifies the not-being-optimized-out property. The latter is conceptually based on a test written by Matthew Dempsky for the OpenBSD regression suite. The crypt() implementation has an immediate use for this new feature. We avoid having to add a GLIBC_PRIVATE alias for explicit_bzero by running all of libcrypt's calls through the fortified variant, __explicit_bzero_chk, which is in the impl namespace anyway. Currently I'm not aware of anything in libc proper that needs this, but the glue is all in place if it does become necessary. The legacy DES implementation wasn't bothering to clear its buffers, so I added that, mostly for consistency's sake. * string/explicit_bzero.c: New routine. * string/test-explicit_bzero.c, string/tst-xbzero-opt.c: New tests. * string/Makefile (routines, strop-tests, tests): Add them. * string/test-memset.c: Add ifdeffage for testing explicit_bzero. * string/string.h [__USE_MISC]: Declare explicit_bzero. * debug/explicit_bzero_chk.c: New routine. * debug/Makefile (routines): Add it. * debug/tst-chk1.c: Test fortification of explicit_bzero. * string/bits/string3.h: Fortify explicit_bzero. * manual/string.texi: Document explicit_bzero. * NEWS: Mention addition of explicit_bzero. * crypt/crypt-entry.c (__crypt_r): Clear key-dependent intermediate data before returning, using explicit_bzero. * crypt/md5-crypt.c (__md5_crypt_r): Likewise. * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise. * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise. * include/string.h: Redirect internal uses of explicit_bzero to __explicit_bzero_chk[_internal]. * string/Versions [GLIBC_2.25]: Add explicit_bzero. * debug/Versions [GLIBC_2.25]: Add __explicit_bzero_chk. * sysdeps/arm/nacl/libc.abilist * sysdeps/unix/sysv/linux/aarch64/libc.abilist * sysdeps/unix/sysv/linux/alpha/libc.abilist * sysdeps/unix/sysv/linux/arm/libc.abilist * sysdeps/unix/sysv/linux/hppa/libc.abilist * sysdeps/unix/sysv/linux/i386/libc.abilist * sysdeps/unix/sysv/linux/ia64/libc.abilist * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist * sysdeps/unix/sysv/linux/microblaze/libc.abilist * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist * sysdeps/unix/sysv/linux/nios2/libc.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist * sysdeps/unix/sysv/linux/sh/libc.abilist * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Add entries for explicit_bzero and __explicit_bzero_chk.
* Add getentropy, getrandom, <sys/random.h> [BZ #17252]Florian Weimer2016-12-121-0/+2
|
* Add llogb, llogbf, llogbl.Joseph Myers2016-12-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines llogb functions that are like ilogb except that they return long int instead of int. Corresponding FP_LLOGB* macros are defined, whose values are required to have the obvious correspondence to those of the FP_ILOGB* macros. This patch implements these functions and macros for glibc. llogb uses the type-generic infrastructure, with an implementation similar to the wrapper for ilogb but with additional conversion from FP_ILOGB* to FP_LLOGB*; this approach avoids needing to modify or duplicate any of the architecture-specific ilogb implementations. Tests are also based on those for ilogb. Ideally the llogb functions would alias the ilogb ones when long is 32-bit, but such aliasing requires the associated header declarations of the different-type alias to be hidden, typically by defining macros before including the header (see e.g. how sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c defines lround to __hidden_lround before including <math.h>). The infrastructure for type-generic function implementations does not support defining such macros at present (since C code can't define a macro whose name is determined by other macros). So this patch leaves them as separate functions (similar to e.g. scalbln and scalbn being separate in such a case as well), but with the remapping of FP_ILOGB* to FP_LLOGB* conditioned out in the case where it would be the identity map. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (llogb): New declaration. * math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (llogb): New macro. * math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (__FP_LONG_MAX): New macro. [__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_LLOGB0): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_LLOGBNAN): Likewise. * math/Versions (llogb): New libm symbol at version GLIBC_2.25. (llogbf): Likewise. (llogbl): Likewise. * math/Makefile (gen-libm-calls): Add w_llogbF. (tests): Add test-fp-llogb-constants. * math/w_llogb_template.c: New file. Based on math/w_ilogb_template.c. * math/libm-test.inc (llogb_test_data): New array. (llogb_test): New function. (main): Call llogb_test. * math/test-fp-llogb-constants.c: New file. Based on math/test-fp-ilogb-constants.c. * math/test-tgmath-ret.c (llogb): New CHECK_RET_CONST call. (do_test): Call check_return_llogb. * math/test-tgmath.c (NCALLS): Increase to 126. (F(compile_test)): Call llogb. (F(llogb)): New function. * manual/math.texi (Exponents and Logarithms): Document llogb, llogbf, llogbl, FP_LLOGB0 and FP_LLOGBNAN. * manual/libm-err-tab.pl (@all_functions): Add llogb. * sysdeps/ieee754/ldbl-opt/nldbl-llogb.c: New file. * sysdeps/ieee754/ldbl-opt/w_llogbl.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add llogb. (CFLAGS-nldbl-llogb.c): New variable. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* ld.so: Remove __libc_memalignFlorian Weimer2016-11-302-5/+3
| | | | | | | It is no longer needed since commit 6c444ad6e953dbdf9c7be065308a0a777 (elf: Do not use memalign for TCB/TLS blocks allocation [BZ #17730]). Applications do not link against ld.so and will use the definition in libc.so, so there is no ABI impact.
* Implement _dl_catch_error, _dl_signal_error in libc.so [BZ #16628]Florian Weimer2016-11-301-0/+3
| | | | | | | | | | | | | | | | | | This change moves the main implementation of _dl_catch_error, _dl_signal_error to libc.so, where TLS variables can be used directly. This removes a writable function pointer from the rtld_global variable. For use during initial relocation, minimal implementations of these functions are provided in ld.so. These are eventually interposed by the libc.so implementations. This is implemented by compiling elf/dl-error-skeleton.c twice, via elf/dl-error.c and elf/dl-error-minimal.c. As a side effect of this change, the static version of dl-error.c no longer includes support for the _dl_signal_cerror/_dl_receive_error mechanism because it is only used in ld.so.
* Add setpayloadsig, setpayloadsigf, setpayloadsigl.Joseph Myers2016-11-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines functions for manipulating the payloads of NaNs. This patch implements the setpayloadsig functions for glibc; these are like the setpayload functions, but produce a signaling NaN instead of a quiet NaN. The substance of the implementation was included with the setpayload implementation, so the new files here just need to wrap the main files with different defines to build the new functions. Because the functions store a signaling NaN via a pointer and the libm-test macros choose a suitable initial value for the variable in such a case by comparing with the expected value, the relevant macro needs to clear exceptions after FE_INVALID may have been raised by that comparison. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (setpayloadsig): New declaration. * math/Versions (setpayloadsig): New libm symbol at version GLIBC_2.25. (setpayloadsigf): Likewise. (setpayloadsigl): Likewise. * math/Makefile (libm-calls): Add s_setpayloadsigF. * math/libm-test.inc (RUN_TEST_Ff_b1): Call feclearexcept (FE_ALL_EXCEPT) after initializing EXTRA_VAR. (setpayloadsig_test_data): New array. (setpayloadsig_test): New function. (main): Call setpayloadsig_test. * manual/arith.texi (FP Bit Twiddling): Document setpayloadsig, setpayloadsigf and setpayloadsigl. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated. * sysdeps/ieee754/dbl-64/s_setpayloadsig.c: New file. * sysdeps/ieee754/flt-32/s_setpayloadsigf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_setpayloadsigl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_setpayloadsigl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-setpayloadsig.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add setpayloadsig. (CFLAGS-nldbl-setpayloadsig.c): New variable. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Allow [f]statfs64 to alias [f]statfsSteve Ellcey2016-11-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * sysdeps/unix/sysv/linux/fstatfs64.c: Hide prototypes for fstatfs and __fstatfs. Make them aliases of __fstatfs64 if STATFS_IS_STATFS64 is set to non-zero. * sysdeps/unix/sysv/linux/statfs64.c: Ditto for __statfs, statfs, and __statfs64. * sysdeps/unix/sysv/linux/generic/wordsize-32/fstatfs.c: Do not define __fstatfs and fstatfs if STATFS_IS_STATFS64 is non-zero. * sysdeps/unix/sysv/linux/generic/wordsize-32/statfs.c: Ditto for __statfs and statfs. * sysdeps/unix/sysv/linux/alpha/kernel_stat.h: Set STATFS_IS_STATFS64 to 0. * sysdeps/unix/sysv/linux/generic/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/hppa/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/ia64/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/microblaze/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/mips/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/x86_64/kernel_stat.h: Ditto.
* Always define XSTAT_IS_XSTAT64Steve Ellcey2016-11-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | * sysdeps/unix/sysv/linux/generic/kernel_stat.h: Set XSTAT_IS_XSTAT64 to 0 when in 32 bit mode. * sysdeps/unix/sysv/linux/hppa/kernel_stat.h: Set XSTAT_IS_XSTAT64 to 0. * sysdeps/unix/sysv/linux/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/microblaze/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/mips/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h: Ditto. * sysdeps/unix/sysv/linux/fxstat.c: Replace #ifdef with #if on XSTAT_IS_XSTAT64 test. * sysdeps/unix/sysv/linux/fxstatat.c: Ditto. * sysdeps/unix/sysv/linux/generic/lxstat.c: Ditto. * sysdeps/unix/sysv/linux/generic/xstat.c: Ditto. * sysdeps/unix/sysv/linux/i386/fxstat.c: Ditto. * sysdeps/unix/sysv/linux/i386/fxstatat.c: Ditto. * sysdeps/unix/sysv/linux/i386/lxstat.c: Ditto. * sysdeps/unix/sysv/linux/i386/xstat.c: Ditto. * sysdeps/unix/sysv/linux/lxstat.c: Ditto. * sysdeps/unix/sysv/linux/mips/xstatconv.c: Ditto. * sysdeps/unix/sysv/linux/xstat.c: Ditto. * sysdeps/unix/sysv/linux/xstatconv.c: Ditto.
* Add setpayload, setpayloadf, setpayloadl.Joseph Myers2016-11-191-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines functions for manipulating the payloads of NaNs. This patch implements the setpayload functions for glibc; these set a number (pointed to by a function argument) to a quiet NaN with the given payload, or to +0 if the given payload is not valid. The implementations are structured to allow the substance of the implementation to be shared with the setpayloadsig functions when those are added. The semantics in the TS are not entirely clear in the case where the payload passed to the function is zero (see discussion on the WG14 reflector last month). This patch implements what seems the most sensible interpretation, that -0 is never valid to give as the payload, but +0 is valid in the case where the kind of NaN being generated has its high mantissa bit set so payload 0 is actually possible in such a NaN. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (setpayload): New declaration. * math/Versions (setpayload): New libm symbol at version GLIBC_2.25. (setpayloadf): Likewise. (setpayloadl): Likewise. * math/Makefile (libm-calls): Add s_setpayloadF. * math/libm-test.inc (struct test_Ffp_b1_data): Rename to struct test_Ff_b1_data. (RUN_TEST_Ff_b1): New macro. (RUN_TEST_LOOP_Ff_b1): Likewise. (canonicalize_test_data): Update type. (setpayload_test_data): New array. (setpayload_test): New function. (main): Call setpayload_test. * manual/arith.texi (FP Bit Twiddling): Document setpayload, setpayloadf and setpayloadl. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated. * sysdeps/ieee754/dbl-64/s_setpayload.c: New file. * sysdeps/ieee754/dbl-64/s_setpayload_main.c: Likewise. * sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c: Likewise. * sysdeps/ieee754/flt-32/s_setpayloadf.c: Likewise. * sysdeps/ieee754/flt-32/s_setpayloadf_main.c: Likewise. * sysdeps/ieee754/ldbl-128/s_setpayloadl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_setpayloadl_main.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_setpayloadl_main.c: Likewise. * sysdeps/ieee754/ldbl-96/s_setpayloadl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_setpayloadl_main.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-setpayload.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add setpayload. (CFLAGS-nldbl-setpayload.c): New variable. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Add canonicalize, canonicalizef, canonicalizel.Joseph Myers2016-10-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines canonicalize functions to produce a canonical version of a floating-point representation. This patch implements these functions for glibc. As with the iscanonical macro, these functions are oriented to the decimal floating-point case, where some values have both canonical and noncanonical representations. However, the functions have a return value that says whether they succeeded in storing a canonical result; thus, they can fail for the case of an invalid representation (while still not making any particular choice from among multiple equally canonical valid representations of the same value). Since no floating-point formats in glibc actually have noncanonical valid representations, a type-generic implementation of these functions can be used that expects iscanonical to return 0 only for invalid representations. Now that iscanonical is used within libm.so, libm_hidden_proto / libm_hidden_def are added for __iscanonicall. The definition of these functions is intended to correspond to a convertFormat operation to the same floating-point format. Thus, they convert signaling NaNs to quiet NaNs, raising the "invalid" exception. Such a conversion "should" produce "the canonical version of that signaling NaN made quiet". libm-test.inc is made to check NaN payloads for the output of these functions, a new feature (at some point manipulation functions such as fabs and copysign should have tests added that verify payload preservation for them). As however some architectures may not follow the recommended practice of preserving NaN payloads when converting a signaling NaN to quiet, a new math-tests.h macro SNAN_TESTS_PRESERVE_PAYLOAD is added, and defined to 0 for non-NAN2008 MIPS; any other architectures seeing test failures for lack of payload preservation in this case should also define this macro to 0. (If any cases arise where the sign isn't preserved either, those should have a similar macro added.) The ldbl-96 and ldbl-128ibm tests of iscanonical are renamed and adapted to test canonicalizel as well on the same representations. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (canonicalize): New declaration. * math/Versions (canonicalize): New libm symbol at version GLIBC_2.25. (canonicalizef): Likewise. (canonicalizel): Likewise. * math/Makefile (gen-libm-calls): Add s_canonicalizeF. * math/s_canonicalize_template.c: New file. * math/libm-test.inc: Update comment on functions tested and testing of NaN payloads. (TEST_NAN_PAYLOAD): New macro. (NO_TEST_INLINE): Update value. (XFAIL_TEST): Likewise. (ERRNO_UNCHANGED): Likewise. (ERRNO_EDOM): Likewise. (ERRNO_ERANGE): Likewise. (IGNORE_RESULT): Likewise. (NON_FINITE): Likewise. (TEST_SNAN): Likewise. (NO_TEST_MATHVEC): Likewise. (TEST_NAN_PAYLOAD_CANONICALIZE): New macro. (check_float_internal): Check NaN payloads if TEST_NAN_PAYLOAD. (struct test_Ffp_b1_data): New type. (RUN_TEST_Ffp_b1): New macro. (RUN_TEST_LOOP_Ffp_b1): Likewise. (canonicalize_test_data): New array. (canonicalize_test): New function. (main): Call canonicalize_test. * manual/arith.texi (FP Bit Twiddling): Document canonicalize, canonicalizef and canonicalizel. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated. * sysdeps/ieee754/ldbl-opt/nldbl-canonicalize.c: New file. * sysdeps/ieee754/ldbl-opt/s_canonicalizel.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add canonicalize. (CFLAGS-nldbl-canonicalize.c): New variable. * sysdeps/ieee754/ldbl-128ibm/test-iscanonical-ldbl-128ibm.c: Move to ... * sysdeps/ieee754/ldbl-128ibm/test-canonical-ldbl-128ibm.c: ... here. (do_test): Also test canonicalizel. * sysdeps/ieee754/ldbl-128ibm/Makefile (tests): Change test-iscanonical-ldbl-128ibm to test-canonical-ldbl-128ibm. * sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h: New file. * sysdeps/ieee754/ldbl-128ibm/s_iscanonicall.c (__iscanonicall): Use libm_hidden_def. * sysdeps/ieee754/ldbl-96/test-iscanonical-ldbl-96.c: Move to ... * sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c: ... here. (do_test): Also test canonicalizel. * sysdeps/ieee754/ldbl-96/Makefile (tests): Change test-iscanonical-ldbl-96 to test-canonical-ldbl-96. * sysdeps/ieee754/ldbl-96/include/bits/iscanonical.h: New file. * sysdeps/ieee754/ldbl-96/s_iscanonicall.c (__iscanonicall): Use libm_hidden_def. * sysdeps/generic/math-tests.h (SNAN_TESTS_PRESERVE_PAYLOAD): New macro. * sysdeps/mips/math-tests.h [__mips_hard_float && !__mips_nan2008] (SNAN_TESTS_PRESERVE_PAYLOAD): Likewise. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Add strfromd, strfromf, and strfroml functionsGabriel F. T. Gomes2016-10-251-0/+3
| | | | | | | ISO/IEC TS 18661-1 adds several functions in the strfrom family to stdlib. This patch adds strfromd, strfromf, and strfroml. This is being done in preparation for the new floating-point type, float128. The added functions convert a floating-point value into a string, with configurable format.
* Add getpayload, getpayloadf, getpayloadl.Joseph Myers2016-10-191-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines functions for manipulating the payloads of NaNs. This patch implements the getpayload functions for glibc; these extract the NaN payload (from an argument passed as a pointer, for which corresponding libm-test support is added) and return it in the same floating-point type. The return value of these functions is unspecified for non-NaN arguments; the patch does the simplest thing to implement, which is that the functions do not check whether the argument is a NaN and just treat the relevant bits of the representation as a payload regardless. A conversion from integer to floating-point is used to produce the required return value, except in the ldbl-128 case; as 128-bit integers are not supported for all configurations using ldbl-128, the code constructs the required floating-point representation of the return value directly instead. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (getpayload): New declaration. * math/Versions (getpayload): New libm symbol at version GLIBC_2.25. (getpayloadf): Likewise. (getpayloadl): Likewise. * math/Makefile (libm-calls): Add s_getpayloadF. * math/libm-test.inc: Include <nan-high-order-bit.h>. (struct test_f_f_data): Add comment. (RUN_TEST_fp_f): New macro. (RUN_TEST_LOOP_fp_f): Likewise. (getpayload_test_data): New array. (getpayload_test): New function. (main): Call getpayload_test. * math/gen-libm-test.pl (parse_args): Handle 'p' in argument descriptor. * manual/arith.texi (FP Bit Twiddling): Document getpayload, getpayloadf and getpayloadl. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated. * sysdeps/ieee754/dbl-64/s_getpayload.c: New file. * sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c: Likewise. * sysdeps/ieee754/flt-32/s_getpayloadf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_getpayloadl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_getpayloadl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_getpayloadl.c: Likewise. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.