about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* elf: Turn _dl_printf, _dl_error_printf, _dl_fatal_printf into functionsFlorian Weimer2020-05-252-12/+8
| | | | | | | | | | | | | | This change makes it easier to set a breakpoint on these calls. This also addresses the issue that including <ldsodefs.h> without <unistd.h> does not result usable _dl_*printf macros because of the use of the STD*_FILENO macros there. (The private symbol for _dl_fatal_printf will go away again once the exception handling implementation is unified between libc and ld.so.) Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* x86: Update Intel Atom processor family optimizationH.J. Lu2020-05-211-1/+19
| | | | | | Enable Intel Silvermont optimization for Intel Goldmont Plus. Detect more Intel Airmont processors. Optimize Intel Tremont like Intel Silvermont with rep string instructions.
* nptl: Add __pthread_attr_copy for copying pthread_attr_t objectsFlorian Weimer2020-05-201-0/+7
| | | | | | | | Also add the private type union pthread_attr_transparent, to reduce the amount of casting that is required. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* nptl: Move pthread_gettattr_np into libcFlorian Weimer2020-05-2057-27/+74
| | | | | | | | | | | | | | | | | | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Use __getline instead of __getdelim to avoid a localplt failure. Likewise for __getrlimit/getrlimit. The abilist updates were performed by: git ls-files 'sysdeps/unix/sysv/linux/**/libc.abilist' \ | while read x ; do echo "GLIBC_2.32 pthread_getattr_np F" >> $x done python3 scripts/move-symbol-to-libc.py --only-linux pthread_getattr_np The private export of __pthread_getaffinity_np is no longer needed, but the hidden alias still necessary so that the symbol can be exported with versioned_symbol. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* nptl: Move pthread_getaffinity_np into libcFlorian Weimer2020-05-2057-43/+79
| | | | | | | | | | | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> The abilist updates were performed by: git ls-files 'sysdeps/unix/sysv/linux/**/libc.abilist' \ | while read x ; do echo "GLIBC_2.32 pthread_getaffinity_np F" >> $x done python3 scripts/move-symbol-to-libc.py pthread_getaffinity_np Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* nptl: Move pthread_attr_setaffinity_np into libcFlorian Weimer2020-05-2057-43/+79
| | | | | | | | | | | | | | | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> The symbol did not previously exist in libc, so a new GLIBC_2.32 symbol is needed, to get correct dependency for binaries which use the symbol but no longer link against libpthread. The abilist updates were performed by: git ls-files 'sysdeps/unix/sysv/linux/**/libc.abilist' \ | while read x ; do echo "GLIBC_2.32 pthread_attr_setaffinity_np F" >> $x done python3 scripts/move-symbol-to-libc.py pthread_attr_setaffinity_np Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* nptl: Replace some stubs with the Linux implementationFlorian Weimer2020-05-209-723/+1
| | | | | | | | | | | | | The stubs for pthread_getaffinity_np, pthread_getname_np, pthread_setaffinity_np, pthread_setname_np are replaced, and corresponding tests are moved. After the removal of the NaCl port, nptl is Linux-specific, and the stubs are no longer needed. This effectively reverts commit c76d1ff5149bd03210f2bb8cd64446c51618d016 ("NPTL: Add stubs for Linux-only extension functions."). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Linux: Add missing handling of tai field to __ntp_gettime64Florian Weimer2020-05-201-0/+1
| | | | | | | | | This fixes a build error: ../sysdeps/unix/sysv/linux/ntp_gettime.c: In function ‘__ntp_gettime’: ../sysdeps/unix/sysv/linux/ntp_gettime.c:56:10: error: ‘ntv64.tai’ is used uninitialized in this function [-Werror=uninitialized] 56 | *ntv = valid_ntptimeval64_to_ntptimeval (ntv64); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* y2038: Replace __clock_gettime with __clock_gettime64Lukasz Majewski2020-05-204-11/+8
| | | | | | | | | | | | The __clock_gettime internal function is not supporting 64 bit time on architectures with __WORDSIZE == 32 and __TIMESIZE != 64 (like e.g. ARM 32 bit). The __clock_gettime64 function shall be used instead in the glibc itself as it supports 64 bit time on those systems. This patch does not bring any changes to systems with __WORDSIZE == 64 as for them the __clock_gettime64 is aliased to __clock_gettime (in ./include/time.h).
* y2038: linux: Provide __ntp_gettimex64 implementationLukasz Majewski2020-05-202-3/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __ntp_gettimex64 explicit 64 bit function for getting time parameters via NTP interface. The call to __adjtimex in __ntp_gettime64 function has been replaced with direct call to __clock_adjtime64 syscall, to simplify the code. Moreover, a 32 bit version - __ntp_gettimex has been refactored to internally use __ntp_gettimex64. The __ntp_gettimex is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversions between struct ntptimeval and 64 bit struct __ntptimeval64. 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 the proper usage of both __ntp_gettimex64 and __ntp_gettimex. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: linux: Provide __ntp_gettime64 implementationLukasz Majewski2020-05-202-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __ntp_gettime64 explicit 64 bit function for getting time parameters via NTP interface. Internally, the __clock_adjtime64 syscall is used instead of __adjtimex. This patch is necessary for having architectures with __WORDSIZE == 32 Y2038 safe. Moreover, a 32 bit version - __ntp_gettime has been refactored to internally use __ntp_gettime64. The __ntp_gettime is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversions between struct ntptimeval and 64 bit struct __ntptimeval64. 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 the proper usage of both __ntp_gettime64 and __ntp_gettime. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: Provide conversion helpers for struct __ntptimeval64Lukasz Majewski2020-05-201-0/+36
| | | | | | | | | | | | | | | | | | Those functions allow easy conversion between Y2038 safe, glibc internal struct __ntptimeval64 and struct ntptimeval. The reserved fields (i.e. __glibc_reserved{1234}) during conversion are zeroed as well, to provide behavior similar to one in ntp_gettimex function (where those are cleared before the struct ntptimeval is returned). Those functions are put in Linux specific sys/timex.h file, as putting them into glibc's local include/time.h would cause build break on HURD as it doesn't support struct timex related syscalls. Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: Introduce struct __ntptimeval64 - new internal glibc typeLukasz Majewski2020-05-201-0/+14
| | | | | | | | | | | This type is a glibc's "internal" type to get time parameters data from Linux kernel (NTP daemon interface). It stores time in struct __timeval64 rather than struct timeval, which makes it Y2038-proof. Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: linux: Provide __adjtime64 implementationLukasz Majewski2020-05-201-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __adjtime64 explicit 64 bit function for adjusting Linux kernel clock. Internally, the __clock_adjtime64 syscall is used instead of __adjtimex. This patch is necessary for having architectures with __WORDSIZE == 32 Y2038 safe. Moreover, a 32 bit version - __adjtime has been refactored to internally use __adjtime64. The __adjtime is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversions between struct timeval and 64 bit struct __timeval64. 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 the proper usage of both __adjtime64 and __adjtime. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: linux: Provide ___adjtimex64 implementationLukasz Majewski2020-05-202-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new ___adjtimex64 explicit 64 bit function for adjusting Linux kernel clock. Internally, the __clock_adjtime64 syscall is used. This patch is necessary for having architectures with __WORDSIZE == 32 Y2038 safe. Moreover, a 32 bit version - ___adjtimex has been refactored to internally use ___adjtimex64. The ___adjtimex is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversions between struct timex and 64 bit struct __timex64. Last but not least, in ___adjtimex64 function the __clock_adjtime syscall has been replaced with __clock_adjtime64 to support 64 bit time on architectures with __WORDSIZE == 32 and __TIMESIZE != 64. 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 the proper usage of both ___adjtimex64 and ___adjtimex. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: linux: Provide __clock_adjtime64 implementationLukasz Majewski2020-05-204-2/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces auto generated wrapper (as described in sysdeps/unix/sysv/linux/syscalls.list) for clock_adjtime with one which adds extra support for reading 64 bit time values on machines with __TIMESIZE != 64. To achieve this goal new __clock_adjtime64 explicit 64 bit function for adjusting Linux clock has been added. Moreover, a 32 bit version - __clock_adjtime has been refactored to internally use __clock_adjtime64. The __clock_adjtime is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversions between 64 bit struct __timespec64 and struct timespec. The new __clock_adjtime64 syscall available from Linux 5.1+ has been used, when applicable. Up till v5.4 in the Linux kernel there was a bug preventing this call from obtaining correct struct's timex time.tv_sec time after time_t overflow (i.e. not being Y2038 safe). 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 Linux kernel, headers and minimal kernel version for glibc build test matrix: - Linux v5.1 (with clock_adjtime64) and glibc build with v5.1 as minimal kernel version (--enable-kernel="5.1.0") The __ASSUME_TIME64_SYSCALLS flag defined. - Linux v5.1 and default minimal kernel version The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports clock_adjtime64 syscall. - Linux v4.19 (no clock_adjtime64 support) with default minimal kernel version for contemporary glibc (3.2.0) This kernel doesn't support clock_adjtime64 syscall, so the fallback to clock_adjtime is tested. Above tests were performed with Y2038 redirection applied as well as without (so the __TIMESIZE != 64 execution path is checked as well). No regressions were observed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* powerpc: Optimized rawmemchr for POWER9Anton Blanchard2020-05-185-3/+145
| | | | | | | | | | | This version uses vector instructions and is up to 60% faster on medium matches and up to 90% faster on long matches, compared to the POWER7 version. A few examples: __rawmemchr_power9 __rawmemchr_power7 Length 32, alignment 0: 2.27566 3.77765 Length 64, alignment 2: 2.46231 3.51064 Length 1024, alignment 0: 17.3059 32.6678
* x86: Add --enable-cet=permissiveH.J. Lu2020-05-187-44/+70
| | | | | | | | | | | | | | | | | | | | | | | | | When CET is enabled, it is an error to dlopen a non CET enabled shared library in CET enabled application. It may be desirable to make CET permissive, that is disable CET when dlopening a non CET enabled shared library. With the new --enable-cet=permissive configure option, CET is disabled when dlopening a non CET enabled shared library. Add DEFAULT_DL_X86_CET_CONTROL to config.h.in: /* The default value of x86 CET control. */ #define DEFAULT_DL_X86_CET_CONTROL cet_elf_property which enables CET features based on ELF property note. --enable-cet=permissive it to /* The default value of x86 CET control. */ #define DEFAULT_DL_X86_CET_CONTROL cet_permissive which enables CET features permissively. Update tst-cet-legacy-5a, tst-cet-legacy-5b, tst-cet-legacy-6a and tst-cet-legacy-6b to check --enable-cet and --enable-cet=permissive.
* Remove NO_CTORS_DTORS_SECTIONS macroFlorian Weimer2020-05-181-5/+0
| | | | | | | | | | | This was originally added to support binutils older than version 2.22: <https://sourceware.org/ml/libc-alpha/2010-12/msg00051.html> Since 2.22 is older than the minimum required binutils version for building glibc, we no longer need this. (The changes do not impact the statically linked startup code.)
* powerpc: Optimized stpcpy for POWER9Anton Blanchard via Libc-alpha2020-05-186-21/+123
| | | | | | | | | | Add stpcpy support to the POWER9 strcpy. This is up to 40% faster on small strings and up to 90% faster on long relatively unaligned strings, compared to the POWER8 version. A few examples: __stpcpy_power9 __stpcpy_power8 Length 20, alignments in bytes 4/ 4: 2.58246 4.8788 Length 1024, alignments in bytes 1/ 6: 24.8186 47.8528
* powerpc: Optimized strcpy for POWER9Anton Blanchard via Libc-alpha2020-05-185-1/+182
| | | | | | | | | | This version uses VSX store vector with length instructions and is significantly faster on small strings and relatively unaligned large strings, compared to the POWER8 version. A few examples: __strcpy_power9 __strcpy_power8 Length 16, alignments in bytes 0/ 0: 2.52454 4.62695 Length 412, alignments in bytes 4/ 0: 11.6 22.9185
* x86: Move CET control to _dl_x86_feature_control [BZ #25887]H.J. Lu2020-05-188-68/+79
| | | | | | | | | | 1. Include <dl-procruntime.c> to get architecture specific initializer in rtld_global. 2. Change _dl_x86_feature_1[2] to _dl_x86_feature_1. 3. Add _dl_x86_feature_control after _dl_x86_feature_1, which is a struct of 2 bitfields for IBT and SHSTK control This fixes [BZ #25887].
* Linux: Remove remnants of the getcpu cacheFlorian Weimer2020-05-166-40/+1
| | | | | | The getcpu cache was removed from the kernel in Linux 2.6.24. glibc support from the sched_getcpu implementation was removed in commit dd26c44403582fdf10d663170f947dfe4b3207a0 ("Consolidate sched_getcpu").
* aarch64: fix strcpy and strnlen for big-endian [BZ #25824]Lexi Shao2020-05-152-0/+10
| | | | | | | | | | | | | | | | | | | This patch fixes the optimized implementation of strcpy and strnlen on a big-endian arm64 machine. The optimized method uses neon, which can process 128bit with one instruction. On a big-endian machine, the bit order should be reversed for the whole 128-bits double word. But with instuction rev64 datav.16b, datav.16b it reverses 64bits in the two halves rather than reversing 128bits. There is no such instruction as rev128 to reverse the 128bits, but we can fix this by loading the data registers accordingly. Fixes 0237b61526e7("aarch64: Optimized implementation of strcpy") and 2911cb68ed3d("aarch64: Optimized implementation of strnlen"). Signed-off-by: Lexi Shao <shaolexi@huawei.com> Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* Add arch-syscall.h dependency for generating sysd-syscalls fileguojinhui2020-05-141-0/+1
| | | | | | | | | | | | After using "make update-syscall-lists" to update arch-syscall.h for new kernel versions, sysd-syscalls will not be not be regenerated. This will cause a compile error because the new data is not being picked up. Fixes commit a1bd5f86739926469bbe0054b93305ff5905b070 ("Linux: Use system call tables during build"). Reviewed-by: Florian Weimer <fweimer@redhat.com>
* arm: XFAIL string/tst-memmove-overflow due to bug 25620Florian Weimer2020-05-131-0/+5
| | | | | | | Also reduce the amount of output in case of a large-scale mismatch in the copied data. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* aarch64: Accept PLT calls to __getauxval within libc.soFlorian Weimer2020-05-121-0/+3
| | | | | | | | When using outline atomics (-moutline-atomics, the default for ARMv8-A starting with GCC 10), libgcc contains an ELF constructor which calls __getauxval. This code is built outside of glibc, so none of its internal PLT avoidance schemes can be applied to it. This change suppresses the elf/check-localplt failure.
* Linux: Enhance glibcsyscalls.py to support listing system callsFlorian Weimer2020-05-111-1/+83
| | | | | | | | | | | | | | | | | | | | | The script can now be called to query the definition status of system call numbers across all architectures, like this: $ python3 sysdeps/unix/sysv/linux/glibcsyscalls.py query-syscall sync_file_range sync_file_range2 sync_file_range: defined: aarch64 alpha csky hppa i386 ia64 m68k microblaze mips/mips32 mips/mips64/n32 mips/mips64/n64 nios2 riscv/rv64 s390/s390-32 s390/s390-64 sh sparc/sparc32 sparc/sparc64 x86_64/64 x86_64/x32 undefined: arm powerpc/powerpc32 powerpc/powerpc64 sync_file_range2: defined: arm powerpc/powerpc32 powerpc/powerpc64 undefined: aarch64 alpha csky hppa i386 ia64 m68k microblaze mips/mips32 mips/mips64/n32 mips/mips64/n64 nios2 riscv/rv64 s390/s390-32 s390/s390-64 sh sparc/sparc32 sparc/sparc64 x86_64/64 x86_64/x32 This command lists the headers containing the system call numbers: $ python3 sysdeps/unix/sysv/linux/glibcsyscalls.py list-headers The argument parser code is based on a suggestion from Adhemerval Zanella. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* POWER: Add context-synchronizing instructions to pkey_write [BZ #25954]Florian Weimer2020-05-111-1/+1
| | | | | | | | | | | | | | | | | | | Sandipan Das reported that, "The Power ISA mandates that all writes to the Authority Mask Register (AMR) must always be preceded as well as succeeded by a context-synchronizing instruction. This applies to both the privileged and unprivileged variants of the Move To AMR instruction. This [requirement] is from Table 6 of Chapter 11 in page 1134 of Power ISA 3.0B. The document can be found here: <https://ibm.ent.box.com/s/1hzcwkwf8rbju5h9iyf44wm94amnlcrv> " See this kernel patch submission: <https://lore.kernel.org/linuxppc-dev/5f65cf37be993760de8112a88da194e3ccbb2bf8.1588959697.git.sandipan@linux.ibm.com/>
* x86-64: Use RDX_LP on __x86_shared_non_temporal_threshold [BZ #25966]H.J. Lu2020-05-091-3/+3
| | | | | | | | | Since __x86_shared_non_temporal_threshold is defined as long int __x86_shared_non_temporal_threshold; and long int is 4 bytes for x32, use RDX_LP to compare against __x86_shared_non_temporal_threshold in assembly code.
* linux: Remove assembly umount2 implementationAdhemerval Zanella2020-05-085-20/+63
| | | | | | | | | | Only alpha and ia64 do not support __NR_umount2 (defined as __NR_umount), but recent kernel fixes (74cd2184833f for ia64, and 12b57c5c70f39 for alpha) add the required alias. Checked with a build against all affected ABIs. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* semaphore: consolidate arch headers into a generic oneVineet Gupta2020-05-0613-422/+2
| | | | | | | | | | | | | | | | | | This consolidates the copy-pasted arch specific semaphore header into single version (based on s390) which suffices 32-bit and and 64-bit arch/ABI based on the canonical WORDSIZE. For now I've left out arches which use alternate defines to choose for 32 vs 64-bit builds (aarch64, mips) which in theory can also use the same header. Passes build-many for aarch64-linux-gnu arm-linux-gnueabi arm-linux-gnueabihf riscv64-linux-gnu-rv64imac-lp64 riscv64-linux-gnu-rv64imafdc-lp64 x86_64-linux-gnu microblaze-linux-gnu nios2-linux-gnu Suggested-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: Provide conversion helpers for struct __timex64Lukasz Majewski2020-05-051-0/+61
| | | | | | | | | | | | | | | Those functions allow easy conversion between Y2038 safe, glibc internal struct __timex64 and struct timex. Those functions are put in Linux specific sys/timex.h file, as putting them into glibc's local include/time.h would cause build break on HURD as it doesn't support struct timex related syscalls. Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: Introduce struct __timex64 - new internal glibc typeLukasz Majewski2020-05-051-0/+46
| | | | | | | | | | | | | | | | | | | The introduced glibc's 'internal' struct __timex64 is a copy of Linux kernel's struct __kernel_timex (v5.6) introduced for properly handling data for clock_adjtime64 syscall. As the struct's __kernel_timex size is the same as for archs with __WORDSIZE == 64, proper padding and data types conversion (i.e. long to long long) had to be added for architectures with __WORDSIZE == 32 && __TIMESIZE != 64. Moreover, it stores time in struct __timeval64 rather than struct timeval, which makes it Y2038-proof. Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: hurd: Provide __clock_gettime64 functionLukasz Majewski2020-05-051-0/+14
| | | | | | | | | | | For Linux glibc ports the __TIMESIZE == 64 ensures proper aliasing for __clock_gettime64 (to __clock_gettime). When __TIMESIZE != 64 (like ARM32, PPC) the glibc expects separate definition of the __clock_gettime64. The HURD port only provides __clock_gettime, so this patch adds __clock_gettime64 as a tiny wrapper on it. Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* powerpc64le/power9: guard power9 strcmp against rtld usage [BZ# 25905]Paul E. Murphy2020-05-041-0/+2
| | | | | | | | | | | | | | | | strcmp is used while resolving PLT references. Vector registers should not be used during this. The P9 strcmp makes heavy use of vector registers, so it should be avoided in rtld. This prevents quiet vector register corruption when glibc is configured with --disable-multi-arch and --with-cpu=power9. This can be seen with test-float64x-compat_totalordermag during the first call into totalordermagf64x@GLIBC_2.27. Add a guard to fallback to the power8 implementation when building power9 strcmp for libraries other than libc. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* float128: use builtin_signbitf128 alwaysPaul E. Murphy2020-05-041-18/+1
| | | | | | | | | The minimum GCC version has been raised to 6.2 for building glibc. Therefore, follow the advice inside the implementation and remove the GCC < 6 codepath. Likewise, remove the hidden_proto as all internal usages should inline now.
* nios2: delete sysdeps/unix/sysv/linux/nios2/kernel-features.hChung-Lin Tang2020-05-041-22/+0
| | | | | | Commit 06436acf819d9e6ada7be3ca977d5c0a23d3f138 created a kernel-features.h file with '#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64', which is wrong for Nios II. Deleting the header.
* powerpc: Rename argN to _argN in LOADARGS_N [BZ #25902]H.J. Lu2020-04-301-12/+12
| | | | | | LOADARGS_N in powerpc/sysdep.h uses argN as local variables. It breaks when argN is also a function argument. Rename argN to _argN to avoid conflict.
* i386: Remove unused variable in sysdeps/x86/cacheinfo.cFlorian Weimer2020-04-301-1/+1
| | | | | | | | | | | | Commit a98dc92dd1e278df4c501deb07985018bc2b06de ("x86: Add cache information support for Zhaoxin processors") introduced an unused variable warning in the default i686-linux-gnu build: In file included from ../sysdeps/i386/cacheinfo.c:3: ../sysdeps/x86/cacheinfo.c: In function 'init_cacheinfo': ../sysdeps/x86/cacheinfo.c:762:16: error: unused variable 'eax' [-Werror=unused-variable] 762 | unsigned int eax; | ^~~
* Add a C wrapper for prctl [BZ #25896]H.J. Lu2020-04-303-2/+43
| | | | | | | | | | | | Add a C wrapper to pass arguments in /* Control process execution. */ extern int prctl (int __option, ...) __THROW; to prctl syscall: extern int prctl (int, unsigned long int, unsigned long int, unsigned long int, unsigned long int);
* powerpc64le: Enable support for IEEE long doubleGabriel F. T. Gomes2020-04-306-0/+227
| | | | | | | | | | | | | | On platforms where long double may have two different formats, i.e.: the same format as double (64-bits) or something else (128-bits), building with -mlong-double-128 is the default and function calls in the user program match the name of the function in Glibc. When building with -mlong-double-64, Glibc installed headers redirect such calls to the appropriate function. Likewise, the internals of glibc are now built against IEEE long double. However, the only (minimally) notable usage of long double is difftime. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* powerpc64le: blacklist broken GCC compilers (e.g GCC 7.5.0)Paul E. Murphy2020-04-303-12/+42
| | | | | | | | | | | GCC 7.5.0 (PR94200) will refuse to compile if both -mabi=% and -mlong-double-128 are passed on the command line. Surprisingly, it will work happily if the latter is not. For the sake of maintaining status quo, test for and blacklist such compilers. Tested with a GCC 8.3.1 and GCC 7.5.0 compiler for ppc64le. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* powerpc64le: bump binutils version requirement to >= 2.26Paul E. Murphy2020-04-302-0/+69
| | | | | | | This is a small step up from 2.25 which brings in support for rewriting the .gnu.attributes section of libc/libm.so. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* powerpc64le: raise GCC requirement to 7.4 for long double transitionPaul E. Murphy2020-04-302-0/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add compiler feature tests to ensure we can build ieee128 long double. These test for -mabi=ieeelongdouble, -mno-gnu-attribute, and -Wno-psabi. Likewise, verify some compiler bugs have been addressed. These aren't helpful for building glibc, but may cause test failures when testing the new long double. See notes below from Raji. On powerpc64le, some older compiler versions give error for the function signbit() for 128-bit floating point types. This is fixed by PR83862 in gcc 8.0 and backported to gcc6 and gcc7. This patch adds a test to check compiler version to avoid compiler errors during make check. Likewise, test for -mno-gnu-attribute support which was On powerpc64le, a few files are built on IEEE long double mode (-mabi=ieeelongdouble), whereas most are built on IBM long double mode (-mabi=ibmlongdouble, the default for -mlong-double-128). Since binutils 2.31, linking object files with different long double modes causes errors similar to: ld: libc_pic.a(s_isinfl.os) uses IBM long double, libc_pic.a(ieee128-qefgcvt.os) uses IEEE long double. collect2: error: ld returned 1 exit status make[2]: *** [../Makerules:649: libc_pic.os] Error 1 The warnings are fair and correct, but in order for glibc to have support for both long double modes on powerpc64le, they have to be ignored. This can be accomplished with the use of -mno-gnu-attribute option when building the few files that require IEEE long double mode. However, -mno-gnu-attribute is not available in GCC 6, the minimum version required to build glibc, so this patch adds a test for this feature in powerpc64le builds, and fails early if it's not available. Co-Authored-By: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com> Co-Authored-By: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* Rename __LONG_DOUBLE_USES_FLOAT128 to __LDOUBLE_REDIRECTS_TO_FLOAT128_ABIPaul E. Murphy2020-04-3011-17/+14
| | | | | | | | | | | | | | | Improve the commentary to aid future developers who will stumble upon this novel, yet not always perfect, mechanism to support alternative formats for long double. Likewise, rename __LONG_DOUBLE_USES_FLOAT128 to __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI now that development work has settled down. The command used was git grep -l __LONG_DOUBLE_USES_FLOAT128 ':!./ChangeLog*' | \ xargs sed -i 's/__LONG_DOUBLE_USES_FLOAT128/__LDOUBLE_REDIRECTS_TO_FLOAT128_ABI/g' Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* x86: Add the test case of __get_cpu_features support for Zhaoxin processorsmayshao-oc2020-04-301-0/+2
| | | | | For the test case of the __get_cpu_features interface, add an item in cpu_kinds and a switch case for Zhaoxin support.
* x86: Add cache information support for Zhaoxin processorsmayshao-oc2020-04-301-196/+282
| | | | | | | | | | | To obtain Zhaoxin CPU cache information, add a new function handle_zhaoxin(). Add a new function get_common_cache_info() that extracts the code in init_cacheinfo() to get the value of the variable shared, threads. Add Zhaoxin branch in init_cacheinfo() for initializing variables, such as __x86_shared_cache_size.
* x86: Add CPU Vendor ID detection support for Zhaoxin processorsmayshao2020-04-302-0/+55
| | | | | To recognize Zhaoxin CPU Vendor ID, add a new architecture type arch_kind_zhaoxin for Vendor Zhaoxin detection.
* Add C wrappers for process_vm_readv/process_vm_writev [BZ #25810]H.J. Lu2020-04-294-3/+66
| | | | | | Since the the U marker can only be applied to 2 unsigned long arguments in syscalls.list files, add a C wrapper for process_vm_readv and process_vm_writev syscals which have more than 2 unsigned long arguments.