aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
AgeCommit message (Collapse)Author
2020-02-28ldbl-128ibm-compat: Provide nexttoward functionsGabriel F. T. Gomes
The functions in the nexttoward family are special, in the sense that they always have a long double argument, regardless of their suffix (i.e.: nexttowardf and nexttoward have a long double argument, besides the float and double arguments). On top of that, they are also special because nexttoward functions are not part of the _FloatN API, hence __nexttowardf128 do not exist. This patch adds 4 new function implementations for the new long double format: __nexttoward_to_ieee128 __nexttowardf_to_ieee128 __nexttowardieee128 (as an alias to __nextafterieee128) Likewise, rename "long double" "_Float128" in shared ldbl-128 files to ensure correct type is used irrespective of ABI switches. Thank you to those who helped out with this patch: Co-Authored-By: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2020-02-28ldbl-128ibm-compat: Provide a significand implementationTulio Magno Quites Machado Filho
Reuse the template in order to provide the global symbol __significandieee128.
2020-02-28ldbl-128ibm-compat: Redirect long double functions to f128/ieee128 functionsTulio Magno Quites Machado Filho
Modify the headers to redirect long double functions to global __*f128 symbols or to __*ieee128 otherwise. Most of the functions in math.h benefit from the infrastructure already available for __LDBL_COMPAT. The only exceptions are nexttowardf and nexttoward that need especial treatment. Both math/bits/mathcalls-helper-functions.h and math/bits/mathcalls.h were modified in order to provide alternative redirection destinations that are essential to support functions that should not be redirected to the same name pattern of the rest of the functions, i.e.: __fpclassify, __signbit, __iseqsig, __issignaling, isinf, finite and isnan, which will be redirected to __*f128 instead of __*ieee128 used for the rest.
2020-02-27posix: Remove posix waitidAdhemerval Zanella
The POSIX waitid implementation is problematic in some ways: - It emulates using waitpid, which default implementation calls wait4 and wait4 returns ENOSYS as default. - Also by using waitpid it does not allod support the WNOWAIT, WEXITED, WSTOPPED, or WCONTINUED flag. With current POSIX specification the flags are no longer marked as optional. Also due BZ#23091 Hurd still uses the implementation, so it is moved to as a Hurd arch-specific folder (with some minor cleanups). Checked against a i686-gnu (run-built-tests=no)
2020-02-25powerpc: Refactor fenvinline.hRogerio Alves
This patch refactor fenviline.h replaces some statements for builtins. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2020-02-21ldbl-128ibm: make ieee754.h work with IEEE 128 long doublePaul E. Murphy
Instead of attempting something more creative, just copy the small struct from ldbl-128 and enable it when IEEE long double is present, and update the ibm long double variant if supported. Likewise, provide a shadow copy of math_ldbl.h to prevent the ibm128 specific long double header from poisoning unrelated files due to it's usage in math_private.h. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2020-02-21ldbl-128ibm-compat: fixup subdir location of several funcsPaul E. Murphy
We want to ensure that if a second file is built to support ieee128 long double, we built its companion implementation with ibm128 long double. The shared object versions of these files build correctly because the aliasing is sufficiently complex to prevent the redirects from applying when defining them. However, this does not prevent the static object variants from becoming quietly broken due to redirects. This is intentionally avoided by marking such objects to be built with -mabi=ibmlongdouble. Shuffle the misplaced routines to build against the subdir which defines the needed symbols.
2020-02-21ldbl-128ibm-compat: enforce correct abi flags on internal filePaul E. Murphy
A number of utility files and helper objects should also be explicitly configured to build with the ibm128 ABI to prevent gremlins when enabling IEEE long double.
2020-02-20ldbl-128ibm-compat: Provide ieee128 symbols to narrow functionsTulio Magno Quites Machado Filho
Move the narrow math aliasing macros into a new sysdep header file math-narrow-alias-float128.h. Then, provide an override header to supply the necessary changes to supply the *ieee128 aliases of these symbols. This adds ieee128 aliases for faddl, fdivl, fmull, fsubl, daddl, ddivl, dmull, dsubl.
2020-02-20Undefine redirections after long double definition on __LDBL_COMPAT [BZ #23294]Tulio Magno Quites Machado Filho
After defining the long double redirections to double, __MATHDECL_1 has to be redefined to its previous state in order to avoid redirecting all subsequent types.
2020-02-20nios2: Fix Linux kABI for syscall returnAdhemerval Zanella
From the type introduced at 861be5fd66.
2020-02-20nptl: Move pthread_setschedparam implementation into libcFlorian Weimer
This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-20nptl: Move pthread_getschedparam implementation into libcFlorian Weimer
This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-20nptl: Move pthread_cond_init implementation into libcFlorian Weimer
It is necessary to export __pthread_cond_init from libc because the C11 condition variable needs it and is still left in libpthread. This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-20nptl: Move pthread_cond_destroy implementation into libcFlorian Weimer
It is necessary to export __pthread_cond_destroy from libc because the C11 condition variable needs it and is still left in libpthread. This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-20nptl: Move pthread_condattr_init implementation into libcFlorian Weimer
This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-20nptl: Move pthread_condattr_destroy implementation into libcFlorian Weimer
This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-20nptl: Move pthread_attr_setscope implementation into libcFlorian Weimer
This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-20nptl: Move pthread_attr_getscope implementation into libcFlorian Weimer
This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-20nptl: Move pthread_attr_setschedpolicy implementation into libcFlorian Weimer
This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-20nptl: Move pthread_attr_getschedpolicy implementation into libcFlorian Weimer
This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-19Block all signals on timer_create thread (BZ#10815)Adhemerval Zanella
The behavior of the signal mask on threads created by timer_create for SIGEV_THREAD timers are implementation-defined and glibc explicit unblocks all signals before calling the user-defined function. This behavior, although not incorrect standard-wise, opens a race if a program using a blocked rt-signal plus sigwaitinfo (and without an installed signal handler for the rt-signal) receives a signal while executing the used-defined function for SIGEV_THREAD. A better alternative discussed in bug report is to rather block all signals (besides the internal ones not available to application usage). This patch fixes this issue by only unblocking SIGSETXID (used on set*uid function) and SIGCANCEL (used for thread cancellation). Checked on x86_64-linux-gnu and i686-linux-gnu.
2020-02-19Fix tst-pkey expectations on pkey_get [BZ #23202]Lucas A. M. Magalhaes
From the GNU C Library manual, the pkey_set can receive a combination of PKEY_DISABLE_WRITE and PKEY_DISABLE_ACCESS. However PKEY_DISABLE_ACCESS is more restrictive than PKEY_DISABLE_WRITE and includes its behavior. The test expects that after setting (PKEY_DISABLE_WRITE|PKEY_DISABLE_ACCESS) pkey_get should return the same. This may not be true as PKEY_DISABLE_ACCESS will succeed in describing the state of the key in this case. The pkey behavior during signal handling is different between x86 and POWER. This change make the test compatible with both architectures. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2020-02-18y2038: linux: Provide __gettimeofday64 implementationLukasz Majewski
In the glibc the gettimeofday can use vDSO (on power and x86 the USE_IFUNC_GETTIMEOFDAY is defined), gettimeofday syscall or 'default' ___gettimeofday() from ./time/gettime.c (as a fallback). In this patch the last function (___gettimeofday) has been refactored and moved to ./sysdeps/unix/sysv/linux/gettimeofday.c to be Linux specific. The new __gettimeofday64 explicit 64 bit function for getting 64 bit time from the kernel (by internally calling __clock_gettime64) has been introduced. Moreover, a 32 bit version - __gettimeofday has been refactored to internally use __gettimeofday64. The __gettimeofday is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary check for time_t potential overflow and conversion of struct __timeval64 to 32 bit struct timespec. The iFUNC vDSO direct call optimization has been removed from both i686 and powerpc32 (USE_IFUNC_GETTIMEOFDAY is not defined for those architectures anymore). The Linux kernel does not provide a y2038 safe implementation of gettimeofday neither it plans to provide it in the future, clock_gettime64 should be used instead. Keeping support for this optimization would require to handle another build permutation (!__ASSUME_TIME64_SYSCALLS && USE_IFUNC_GETTIMEOFDAY) which adds more complexity and has limited use (since the idea is to eventually have a y2038 safe glibc build). Build tests: ./src/scripts/build-many-glibcs.py glibcs Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master Above tests were performed with Y2038 redirection applied as well as without to test proper usage of both __gettimeofday64 and __gettimeofday. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> [Including some commit message improvement]
2020-02-18Linux: Work around kernel bugs in chmod on /proc/self/fd paths [BZ #14578]Florian Weimer
It appears that the ability to change symbolic link modes through such paths is unintended. On several file systems, the operation fails with EOPNOTSUPP, even though the symbolic link permissions are updated. The expected behavior is a failure to update the permissions, without file system changes. Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
2020-02-18Introduce <elf-initfini.h> and ELF_INITFINI for all architecturesFlorian Weimer
This supersedes the init_array sysdeps directory. It allows us to check for ELF_INITFINI in both C and assembler code, and skip DT_INIT and DT_FINI processing completely on newer architectures. A new header file is needed because <dl-machine.h> is incompatible with assembler code. <sysdep.h> is compatible with assembler code, but it cannot be included in all assembler files because on some architectures, it redefines register names, and some assembler files conflict with that. <elf-initfini.h> is replicated for legacy architectures which need DT_INIT/DT_FINI support. New architectures follow the generic default and disable it.
2020-02-18mips: Fix bracktrace result for signal framesAdhemerval Zanella
MIPS fallback code handle a frame where its FDE can not be obtained (for instance a signal frame) by reading the kernel allocated signal frame and adding '2' to the value of 'sc_pc' [1]. The added value is used to recognize an end of an EH region on mips16 [2]. The fix adjust the obtained signal frame value and remove the libgcc added value by checking if the previous frame is a signal frame one. Checked with backtrace and tst-sigcontext-get_pc tests on mips-linux-gnu and mips64-linux-gnu. [1] libgcc/config/mips/linux-unwind.h from gcc code. [2] gcc/config/mips/mips.h from gcc code. */
2020-02-18<fd_to_filename.h>: Add type safety and port to HurdFlorian Weimer
The new type struct fd_to_filename makes the allocation of the backing storage explicit. Hurd uses /dev/fd, not /proc/self/fd. Co-Authored-By: Paul Eggert <eggert@cs.ucla.edu>
2020-02-17x86: Avoid single-argument _Static_assert in <tls.h>Florian Weimer
Older GCC versions do not support this extension. Fixes commit f1bdee61797 ("x86 tls: Use _Static_assert for TLS access size assertion").
2020-02-17x86 tls: Use _Static_assert for TLS access size assertionSamuel Thibault
2020-02-16pthread: Fix building tst-robust8 with nptlSamuel Thibault
NPTL's pthreadP.h needs internal definitions
2020-02-16pthread: Move robust mutex tests from nptl to sysdeps/pthreadSamuel Thibault
tst-robust8.c prints some mutex internals for nptl debugging, this needed to be made conditioned by getting built with nptl.
2020-02-16htl: Remove stub warning for pthread_mutexattr_setpsharedSamuel Thibault
It actually is implemented.
2020-02-16htl: Add missing functions and defines for robust mutexesSamuel Thibault
2020-02-15htl: Only check pthread_self coherency when DEBUG is setSamuel Thibault
htl has been widely tested for a long time now with this coherency checked successfully.
2020-02-15hurd: Add THREAD_GET/SETMEM/_NCSamuel Thibault
Store them in the TCB, and use them for accessing _hurd_sigstate.
2020-02-15hurd tls: update comment about fields at the end of tcbheadSamuel Thibault
2020-02-15ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486]Florian Weimer
Exporting functions and relying on symbol interposition from libc.so makes the choice of implementation dependent on DT_NEEDED order, which is not what some compiler drivers expect. This commit replaces one magic mechanism (symbol interposition) with another one (preprocessor-/compiler-based redirection). This makes the hand-over from the minimal malloc to the full malloc more explicit. Removing the ABI symbols is backwards-compatible because libc.so is always in scope, and the dynamic loader will find the malloc-related symbols there since commit f0b2132b35248c1f4a80f62a2c38cddcc802aa8c ("ld.so: Support moving versioned symbols between sonames [BZ #24741]"). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-02-15arm: fix use of INTERNAL_SYSCALL_CALLAndreas Schwab
Remove extra argument from INTERNAL_SYSCALL_CALL macro call. Fixes commit bc2eb9321e ("linux: Remove INTERNAL_SYSCALL_DECL").
2020-02-14linux: Remove INTERNAL_SYSCALL_DECLAdhemerval Zanella
With all Linux ABIs using the expected Linux kABI to indicate syscalls errors, the INTERNAL_SYSCALL_DECL is an empty declaration on all ports. This patch removes the 'err' argument on INTERNAL_SYSCALL* macro and remove the INTERNAL_SYSCALL_DECL usage. Checked with a build against all affected ABIs.
2020-02-14linux: Consolidate INLINE_SYSCALLAdhemerval Zanella
With all Linux ABIs using the expected Linux kABI to indicate syscalls errors, there is no need to replicate the INLINE_SYSCALL. The generic Linux sysdep.h includes errno.h even for !__ASSEMBLER__, which is ok now and it allows cleanup some archaic code that assume otherwise. Checked with a build against all affected ABIs.
2020-02-14s390: Consolidate Linux syscall definitionAdhemerval Zanella
The {INTERNAL,INLINE}_SYSCALL are defined only on s390 sysdep.h. Checked on s390x-linux-gnu and s390-linux-gnu.
2020-02-14riscv: Avoid clobbering register parameters in syscallAdhemerval Zanella
The riscv INTERNAL_SYSCALL macro might clobber the register parameter if the argument itself might clobber any register (a function call for instance). This patch fixes it by using temporary variables for the expressions between the register assignments (as indicated by GCC documentation, 6.47.5.2 Specifying Registers for Local Variables). It is similar to the fix done for MIPS (bug 25523). Checked with riscv64-linux-gnu-rv64imafdc-lp64d build.
2020-02-14microblaze: Avoid clobbering register parameters in syscallAdhemerval Zanella
The microblaze INTERNAL_SYSCALL macro might clobber the register parameter if the argument itself might clobber any register (a function call for instance). This patch fixes it by using temporary variables for the expressions between the register assignments (as indicated by GCC documentation, 6.47.5.2 Specifying Registers for Local Variables). It is similar to the fix done for MIPS (bug 25523). Checked with microblaze-linux-gnu and microblazeel-linux-gnu build.
2020-02-14nios2: Use Linux kABI for syscall returnAdhemerval Zanella
It changes the nios INTERNAL_SYSCALL_RAW macro to return a negative value instead of the 'r2' register value on the 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P macro follows the other Linux kABIs. Checked with a build against nios2-linux-gnu.
2020-02-14mips: Use Linux kABI for syscall returnAdhemerval Zanella
It changes the mips INTERNAL_SYSCALL* and internal_syscall* macros to return a negative value instead of the 'a3' register value on then 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P macro follows the other Linux kABIs. The redefinition of INTERNAL_VSYSCALL_CALL is also no longer required. Checked on mips64-linux-gnu, mips64n32-linux-gnu, and mips-linux-gnu.
2020-02-14mips64: Consolidate Linux sysdep.hAdhemerval Zanella
The mips64 Linux syscall macros only differs argument type and the requirement of sign-extending values on n32. The headers are consolidate by parameterizing the arguments with a new type, __syscall_arg_t, and by defining the ARGIFY for n64. Also, the generic unix mips64 sysdep is essentially the same, only the load instruction need to be adjusted depending of the ABI. Checked on mips64-linux-gnu and mips64n32-linux-gnu.
2020-02-14ia64: Use Linux kABI for syscall returnAdhemerval Zanella
It changes the ia64 INTERNAL_SYSCALL_NCS macro to return a negative value instead of the 'r10' register value on the 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P macro follows the other Linux kABIs. Checked on ia64-linux-gnu.
2020-02-14alpha: Refactor syscall and Use Linux kABI for syscall returnAdhemerval Zanella
It highly unlikely that alpha will be ported to anything else than Linux, so this patch moves the generic unix syscall definition to Linux and adapt it to Linux kernel ABI. It changes the internal_syscall* macros to return a negative value instead of the '$19' register value on the 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P macro follows the other Linux kABIs. Checked on alpha-linux-gnu.
2020-02-14sparc: Avoid clobbering register parameters in syscallAdhemerval Zanella
The sparc INTERNAL_SYSCALL macro might clobber the register parameter if the argument itself might clobber any register (a function call for instance). This patch fixes it by using temporary variables for the expressions between the register assignments (as indicated by GCC documentation, 6.47.5.2 Specifying Registers for Local Variables). It is similar to the fix done for MIPS (bug 25523). Checked on sparc64-linux-gnu and sparcv9-linux-gnu.