]> sourceware.org Git - glibc.git/log
glibc.git
3 years agoUpdate mallinfo2 ABI, and test
DJ Delorie [Tue, 1 Sep 2020 20:17:25 +0000 (16:17 -0400)]
Update mallinfo2 ABI, and test

This patch adds the ABI-related bits to reflect the new mallinfo2
function, and adds a test case to verify basic functionality.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoAllow memset local PLT reference for RISC-V.
Alistair Francis [Fri, 19 Jun 2020 16:00:23 +0000 (09:00 -0700)]
Allow memset local PLT reference for RISC-V.

This is similar to commit a26e2e9feab87d4f745c31411458b048742ac733
"Allow memset local PLT reference for powerpc soft-float.".

GCC 10.1 results in the localplt test failing for RISC-V.

From the original commit for power-pc:
    Since memset is documented as a function GCC may always implicitly
    generate calls to, it seems reasonable to allow that local PLT
    reference (just like those for libgcc functions that GCC implicitly
    generates calls to and that are also exported from libc.so), which
    this patch does.

Acked-by: Palmer Dabbelt <palmerdabbelt@google.com>
3 years agopowerpc: fix ifunc implementation list for POWER9 strlen and stpcpy
Raphael Moreira Zinsly [Thu, 17 Sep 2020 14:16:36 +0000 (11:16 -0300)]
powerpc: fix ifunc implementation list for POWER9 strlen and stpcpy

__strlen_power9 and __stpcpy_power9 were added to their ifunc lists
using the wrong function names.

3 years agonscd: bump GC cycle during cache pruning (bug 26130)
Andreas Schwab [Wed, 17 Jun 2020 14:05:13 +0000 (16:05 +0200)]
nscd: bump GC cycle during cache pruning (bug 26130)

While nscd prunes a cache it becomes inconsistent temporarily, which is
visible to clients if that cache is shared.  Bump the GC cycle counter so
that the clients notice the modification window.

Uniformly use atomic_fetch_add to modify the GC cycle counter.

3 years agox86: Use HAS_CPU_FEATURE with IBT and SHSTK [BZ #26625]
H.J. Lu [Wed, 16 Sep 2020 12:27:32 +0000 (05:27 -0700)]
x86: Use HAS_CPU_FEATURE with IBT and SHSTK [BZ #26625]

commit 04bba1e5d84b6fd8d3a3b006bc240cd5d241ee30
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Aug 5 13:51:56 2020 -0700

    x86: Set CPU usable feature bits conservatively [BZ #26552]

    Set CPU usable feature bits only for CPU features which are usable in
    user space and whose usability can be detected from user space, excluding
    features like FSGSBASE whose enable bit can only be checked in the kernel.

no longer turns on the usable bits of IBT and SHSTK since we don't know
if IBT and SHSTK are usable until much later.  Use HAS_CPU_FEATURE to
check if the processor supports IBT and SHSTK.

3 years ago<sys/platform/x86.h>: Add Intel Key Locker support
H.J. Lu [Tue, 15 Sep 2020 12:49:27 +0000 (05:49 -0700)]
<sys/platform/x86.h>: Add Intel Key Locker support

Add Intel Key Locker:

https://software.intel.com/content/www/us/en/develop/download/intel-key-locker-specification.html

support to <sys/platform/x86.h>.  Intel Key Locker has

1. KL: AES Key Locker instructions.
2. WIDE_KL: AES wide Key Locker instructions.
3. AESKLE: AES Key Locker instructions are enabled by OS.

Applications should use

if (CPU_FEATURE_USABLE (KL))

and

if (CPU_FEATURE_USABLE (WIDE_KL))

to check if AES Key Locker instructions and AES wide Key Locker
instructions are usable.

3 years agoFix handling of collating symbols in fnmatch (bug 26620)
Andreas Schwab [Wed, 16 Sep 2020 10:41:14 +0000 (12:41 +0200)]
Fix handling of collating symbols in fnmatch (bug 26620)

The variable idx contains the index into the extra array, whereas wextra
points into the extra array at this index, containing the length of the
following collating sequence in the wide character representation.

3 years agopselect.c: Pass a pointer to SYSCALL_CANCEL [BZ #26606]
H.J. Lu [Sat, 12 Sep 2020 02:36:12 +0000 (19:36 -0700)]
pselect.c: Pass a pointer to SYSCALL_CANCEL [BZ #26606]

commit a92f4e6299fe0e3cb6f77e79de00817aece501ce
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Mon Jul 6 13:27:12 2020 -0300

    linux: Add time64 pselect support

changed pselect.c to

     r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds,
  timeout,
  ((__syscall_ulong_t[]){ (uintptr_t) sigmask,
  __NSIG_BYTES }));

which doesn't work with x32's ARGIFY and data passed to syscall isn't
initialized with sigmask and __NSIG_BYTES.  Change to

     __syscall_ulong_t data[2] =
{
  (uintptr_t) sigmask, __NSIG_BYTES
};
      r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds,
  timeout, data);

fixes [BZ #26606].

3 years agoy2038: nptl: Convert sem_{clock|timed}wait to support 64 bit time
Lukasz Majewski [Mon, 7 Sep 2020 08:22:21 +0000 (10:22 +0200)]
y2038: nptl: Convert sem_{clock|timed}wait to support 64 bit time

The sem_clockwait and sem_timedwait have been converted to support 64 bit time.

This change reuses futex_abstimed_wait_cancelable64 function introduced earlier.
The sem_{clock|timed}wait only accepts absolute time. Moreover, there is no
need to check for NULL passed as *abstime pointer to the syscalls as both calls
have exported symbols marked with __nonull attribute for abstime.

For systems with __TIMESIZE != 64 && __WORDSIZE == 32:
- Conversion from 32 bit time to 64 bit struct __timespec64 was necessary
- Redirection to __sem_{clock|timed}wait64 will provide support for 64 bit
  time

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 __sem_{clock|timed}wait64 and
__sem_{clock|timed}wait.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agohurd: Add __x86_get_cpu_features to ld.abilist
H.J. Lu [Sun, 13 Sep 2020 12:30:11 +0000 (05:30 -0700)]
hurd: Add __x86_get_cpu_features to ld.abilist

Add __x86_get_cpu_features to ld.abilist for <sys/platform/x86.h>.

3 years agox86: Install <sys/platform/x86.h> [BZ #26124]
H.J. Lu [Tue, 30 Jun 2020 01:30:54 +0000 (18:30 -0700)]
x86: Install <sys/platform/x86.h> [BZ #26124]

Install <sys/platform/x86.h> so that programmers can do

 #if __has_include(<sys/platform/x86.h>)
 #include <sys/platform/x86.h>
 #endif
 ...

   if (CPU_FEATURE_USABLE (SSE2))
 ...
   if (CPU_FEATURE_USABLE (AVX2))
 ...

<sys/platform/x86.h> exports only:

enum
{
  COMMON_CPUID_INDEX_1 = 0,
  COMMON_CPUID_INDEX_7,
  COMMON_CPUID_INDEX_80000001,
  COMMON_CPUID_INDEX_D_ECX_1,
  COMMON_CPUID_INDEX_80000007,
  COMMON_CPUID_INDEX_80000008,
  COMMON_CPUID_INDEX_7_ECX_1,
  /* Keep the following line at the end.  */
  COMMON_CPUID_INDEX_MAX
};

struct cpuid_features
{
  struct cpuid_registers cpuid;
  struct cpuid_registers usable;
};

struct cpu_features
{
  struct cpu_features_basic basic;
  struct cpuid_features features[COMMON_CPUID_INDEX_MAX];
};

/* Get a pointer to the CPU features structure.  */
extern const struct cpu_features *__x86_get_cpu_features
  (unsigned int max) __attribute__ ((const));

Since all feature checks are done through macros, programs compiled with
a newer <sys/platform/x86.h> are compatible with the older glibc binaries
as long as the layout of struct cpu_features is identical.  The features
array can be expanded with backward binary compatibility for both .o and
.so files.  When COMMON_CPUID_INDEX_MAX is increased to support new
processor features, __x86_get_cpu_features in the older glibc binaries
returns NULL and HAS_CPU_FEATURE/CPU_FEATURE_USABLE return false on the
new processor feature.  No new symbol version is neeeded.

Both CPU_FEATURE_USABLE and HAS_CPU_FEATURE are provided.  HAS_CPU_FEATURE
can be used to identify processor features.

Note: Although GCC has __builtin_cpu_supports, it only supports a subset
of <sys/platform/x86.h> and it is equivalent to CPU_FEATURE_USABLE.  It
doesn't support HAS_CPU_FEATURE.

3 years agolinux: Add time64 pselect support
Adhemerval Zanella [Mon, 6 Jul 2020 16:27:12 +0000 (13:27 -0300)]
linux: Add time64 pselect support

The syscall __NR_pselect6_time64 (32-bit) or __NR_pselect6 (64-bit)
is used as default.  For architectures with __ASSUME_TIME64_SYSCALLS
the 32-bit fallback uses __NR_pselec6.

To accomodate microblaze missing pselect6 support on kernel older
than 3.15 the fallback is moved to its own function to the microblaze
specific implementation can override it.

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
3 years agolinux: Add time64 semtimedop support
Adhemerval Zanella [Mon, 6 Jul 2020 20:40:34 +0000 (17:40 -0300)]
linux: Add time64 semtimedop support

Either the __NR_semtimedop_time64 (for 32-bit) or the __NR_semtimedop
(for 64-bit) syscall is used as default.  The 32-bit fallback is used
iff __ASSUME_TIME64_SYSCALLS is not defined, which assumes the kernel
ABI provides either __NR_ipc or __NR_semtimeop (for 32-bit time_t).

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
3 years agolinux: Add ppoll time64 optimization
Adhemerval Zanella [Fri, 10 Jul 2020 16:50:56 +0000 (13:50 -0300)]
linux: Add ppoll time64 optimization

It avoid continuing issue the __NR_ppoll_time64 syscall once the kernel
advertise it does not support it.

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
3 years agolinux: Simplify clock_getres
Adhemerval Zanella [Thu, 9 Jul 2020 20:46:34 +0000 (17:46 -0300)]
linux: Simplify clock_getres

With arch-syscall.h it can now assumes the existance of either
__NR_clock_getres or __NR_clock_getres_time64.  The 32-bit time_t
support is now only build for !__ASSUME_TIME64_SYSCALLS.

It also uses the time64-support functions to simplify it further.

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
3 years agoUpdate sparc libm-test-ulps
Adhemerval Zanella [Fri, 11 Sep 2020 17:39:03 +0000 (14:39 -0300)]
Update sparc libm-test-ulps

3 years agoRemove internal usage of extensible stat functions
Adhemerval Zanella [Wed, 15 Jul 2020 19:35:58 +0000 (19:35 +0000)]
Remove internal usage of extensible stat functions

It replaces the internal usage of __{f,l}xstat{at}{64} with the
__{f,l}stat{at}{64}.  It should not change the generate code since
sys/stat.h explicit defines redirections to internal calls back to
xstat* symbols.

Checked with a build for all affected ABIs.  I also check on
x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agoLinux: Consolidate xmknod
Adhemerval Zanella [Wed, 15 Jul 2020 18:42:42 +0000 (18:42 +0000)]
Linux: Consolidate xmknod

The __NR_mknodat syscall is supported on all kernels, so the generic
implementation is used as default.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Consolidate fxstatat{64}
Adhemerval Zanella [Wed, 15 Jul 2020 18:05:52 +0000 (18:05 +0000)]
linux: Consolidate fxstatat{64}

The LFS support is implemented on fxstat64.c, instead of fxstat.c for
64-bit architectures.  The fxstatat.c implements the non-LFS and it is
a no-op for !XSTAT_IS_XSTAT64.

The generic non-LFS implementation handles two cases:

  1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and
     nios): it issues __NR_fstatat64 plus handle the overflow on st_ino,
     st_size, or st_blocks.  It only handles _STAT_VER_KERNEL.

  2. Old kABIs with old non-LFS support (arm, i386, hppa, m68k, mips32,
     microblaze, s390, sh, powerpc, and sparc32).  it issues
     __NR_fstatat64 and convert to non-LFS stat struct based on the
     version.

Also non-LFS mips64 is an outlier and it has its own implementation
since _STAT_VER_LINUX requires a different conversion function (it
uses the kernel_stat as the sysissues argument since its exported ABI
is different than the kernel one for both non-LFS and LFS
implementation).

The generic LFS implementation handles multiple cases:

  1. XSTAT_IS_XSTAT64 being 1:

    1.1. 64-bit kABI (aarch64, ia64, powerpc64*, s390x, riscv64, and
         x86_64): it issues __NR_newfstatat for _STAT_VER_KERNEL or
         _STAT_VER_LINUX.

    1.2. 64-bit kABI outlier (sparc64): it issuess fstatat64 with a
         temporary stat64 and convert to output stat64 based on the
         input version (and using a sparc64 specific __xstat32_conv).

    1.3. New 32-bit kABIs with only 64-bit time_t support (arc and
 riscv32): it issues __NR_statx and covert to struct stat64.

  2. Old ABIs with XSTAT_IS_XSTAT64 being 0 (arm, csky, i386, hppa, m68k,
     microblaze, mips32, nios2, sh, powerpc32, and sparc32): it issues
     __NR_fstat64.

Also, two special cases requires specific implementations:

  1. alpha: it uses the __NR_fstatat64 syscall instead.

  2. mips64: as for non-LFS implementation its ABIs differ from
     glibc exported one, which requires an specific conversion
     function to handle the kernel_stat.

Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Consolidate fxstat{64}
Adhemerval Zanella [Wed, 15 Jul 2020 16:34:47 +0000 (16:34 +0000)]
linux: Consolidate fxstat{64}

The LFS support is implemented on fxstat64.c, instead of fxstat.c for
64-bit architectures.  The fxstat.c implements the non-LFS and it is
a no-op for !XSTAT_IS_XSTAT64.

The generic non-LFS implementation handles two cases:

  1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and
     nios): it issuess __NR_fstat64 plus handle the overflow on st_ino,
     st_size, or st_blocks.  It only handles _STAT_VER_KERNEL.

  2. Old KABIs with old non-LFS support (arm, i386, hppa, m68k,
     microblaze, s390, sh, powerpc, and sparc32).  For _STAT_VER_KERNEL
     it issues __NR_fstat, otherwise it calls __NR_fstat64 and convert
     to non-LFS stat struct and handle possible overflows on st_ino,
     st_size, or st_blocks.

Also non-LFS mips is an outlier and it has its own implementation since
_STAT_VER_LINUX requires a different conversion function (it uses the
kernel_stat as the sysissues argument since its exported ABI is
different than the kernel one for both non-LFS and LFS implementation).

The generic LFS implementation handles multiple cases:

  1. XSTAT_IS_XSTAT64 being 1:

    1.1. 64-bit kABI (aarch64, ia64, powerpc64*, s390x, riscv64, and
 x86_64): it issuess __NR_fstat for _STAT_VER_KERNEL or
 _STAT_VER_LINUX.

    1.2. Old 64-bit kABI with defines __NR_fstat64 instead of __NR_fstat
         (sparc64): it issues __NR_fstat for _STAT_VER_KERNEL or
         __NR_fstat64 and convert to struct stat64.

    1.3. New 32-bit kABIs with only 64-bit time_t support (arc and
 riscv32): it issuess __NR_statx and covert to struct stat64.

  2. Old ABIs with XSTAT_IS_XSTAT64 being 0 (arm, csky, i386, hppa,
     m68k, microblaze, mips32, nios2, sh, powerpc32, and sparc32): it
     issues __NR_fstat64.

Also, two special cases requires specific implementations:

  1. alpha: it requires to handle _STAT_VER_KERNEL64 to issues
     __NR_fstat64 and use the kernel_stat with __NR_fstat otherwise.

  2. mips64: as for non-LFS implementation its ABIs differ from
     glibc exported one, which requires an specific conversion
     function to handle the kernel_stat.

Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Consolidate lxstat{64}
Adhemerval Zanella [Wed, 15 Jul 2020 14:08:13 +0000 (14:08 +0000)]
linux: Consolidate lxstat{64}

The LFS support is implemented on lxstat64.c, instead of lxstat.c for
64-bit architectures.  The xstat.c implements the non-LFS and it is
a no-op for !XSTAT_IS_XSTAT64.

The generic non-LFS implementation handles two cases:

  1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and
     nios): it issues __NR_fstat64 with AT_SYMLINK_NOFOLLOW plus handles
     the possible overflow off st_ino, st_size, or st_blocks.  It only
     handles _STAT_VER_KERNEL.

  2. Old KABIs with old non-LFS support (arm, i386, hppa, m68k,
     microblaze, s390, sh, powerpc, and sparc32).  For _STAT_VER_KERNEL
     it issues __NR_lstat, otherwise it isseus __NR_lstat64 and convert
     to non-LFS stat struct and handle possible overflows on st_ino,
     st_size, or st_blocks.

Also non-LFS mips is an outlier and it has its own implementation since
_STAT_VER_LINUX requires a different conversion function (it uses the
kernel_stat as the syscall argument since its exported ABI is different
than the kernel one for both non-LFS and LFS implementation).

The generic LFS implementation handles multiple cases:

  1. XSTAT_IS_XSTAT64 being 1:

    1.1. Old 64-bit kABI (ia64, powerpc64*, s390x, sparc64, x86_64): it
         issues __NR_lstat for _STAT_VER_KERNEL or _STAT_VER_LINUX.

    1.2. Old 64-bit kABI with defines __NR_lstat64 instead of __NR_lstat
         (sparc64): it issues __NR_lstat for _STAT_VER_KERNEL or
         __NR_lstat64 and convert to struct stat64.

    1.3. New kABIs which uses generic 64-bit Linux ABI (aarch64 and
         riscv64): it issues __NR_newfstatat with AT_SYMLINK_NOFOLLOW
 and only for _STAT_VER_KERNEL.

    1.4. New 32-bit kABIs with only 64-bit time_t support (arc and
         riscv32): it issues __NR_statx and covert to struct stat64.

  2. Old ABIs with XSTAT_IS_XSTAT64 being 0:

    2.1. New kABIs which uses generic pre 64-bit time Linux ABI (csky
 and nios2): it issues __NR_fstatat64 for _STAT_VER_KERNEL.

    2.2. Old kABIs with old non-LFS support (arm, i386, hppa, m68k,
 microblaze, s390, sh, mips32, powerpc32, and sparc32): it
 issues __NR_lstat64.

Also, two special cases requires specific LFS implementations:

  1. alpha: it requires to handle _STAT_VER_KERNEL64 to issue
     __NR_lstat64 and use the kernel_stat with __NR_lstat otherwise.

  2. mips64: as for non-LFS implementation its ABIs differ from
     glibc exported one, which requires a specific conversion
     function to handle the kernel_stat.

Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Consolidate xstat{64}
Adhemerval Zanella [Mon, 13 Jul 2020 12:13:12 +0000 (09:13 -0300)]
linux: Consolidate xstat{64}

The LFS support is implemented on xstat64.c, instead of xstat.c for
64-bit architectures.  The xstat.c implements the non-LFS it is
no-op for !XSTAT_IS_XSTAT64.

The generic non-LFS implementation handle two cases:

  1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and
     nios): it issues __NR_fstat64 plus handle the overflow on st_ino,
     st_size, or st_blocks.  It only handles _STAT_VER_KERNEL.

  2. Old KABIs with old non-LFS support (arm, i386, hppa, m68k,
     microblaze, s390, sh, powerpc, and sparc32).  For _STAT_VER_KERNEL
     it issues __NR_stat, otherwise it issues __NR_stat64 and convert
     to non-LFS stat struct handling possible overflows on st_ino,
     st_size, or st_blocks.

Also the non-LFS mips is an outlier and it has its own implementation
since _STAT_VER_LINUX requires a different conversion function (it uses
the kernel_stat as the syscall argument since its exported ABI is
different than the kernel one for both non-LFS and LFS implementation).

The generic LFS implementation handles multiple cases:

  1. XSTAT_IS_XSTAT64 being 1:

    1.1. Old 64-bit kABI (ia64, powerpc64*, s390x, x86_64): it
         issues __NR_stat for _STAT_VER_KERNEL or _STAT_VER_LINUX.

    1.2. Old 64-bit kABI with defines __NR_stat64 instead of __NR_stat
 (sparc64): it issues __NR_stat for _STAT_VER_KERNEL or
 __NR_stat64 and convert to struct stat64.

    1.3. New kABIs which uses generic 64-bit Linux ABI (aarch64 and
         riscv64): it issues __NR_newfstatat and only for
         _STAT_VER_KERNEL.

    1.4. New 32-bit kABIs with only 64-bit time_t support (arc and
 riscv32): it issues __NR_statx and covert to struct stat64.

  2. Old ABIs with XSTAT_IS_XSTAT64 being 0:

    2.1. New kABIs which uses generic pre 64-bit time Linux ABI (csky
 and nios2): it issues __NR_fstatat64 for _STAT_VER_KERNEL.

    2.2. Old kABIs with old non-LFS support (arm, i386, hppa, m68k,
 microblaze, s390, sh, mips32, powerpc32, and sparc32): it
 issues __NR_stat64.

Also, two special cases requires specific LFS implementations:

  1. alpha: it requires to handle _STAT_VER_KERNEL64 to call __NR_stat64
     or use the kernel_stat with __NR_stat otherwise.

  2. mips64: as for non-LFS implementation its ABIs differ from glibc
     exported one, which requires an specific conversion function to
     handle the kernel_stat.

Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Define STAT64_IS_KERNEL_STAT64
Adhemerval Zanella [Sat, 18 Jul 2020 02:49:50 +0000 (23:49 -0300)]
linux: Define STAT64_IS_KERNEL_STAT64

It indicates that the glibc export stat64 is similar in size and
layout of the kernel stat64 used on the syscall.  It is not currently
used on stat implementation, but the idea is to indicate whether
to use the kernel_stat to issue on the syscall on the *stat*64
variant (more specifically on mips which its exported ABI does not
match the kernel).

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Always define STAT_IS_KERNEL_STAT
Adhemerval Zanella [Wed, 15 Jul 2020 12:42:32 +0000 (12:42 +0000)]
linux: Always define STAT_IS_KERNEL_STAT

It allows to check for its value instead of its existence.

Checked with a build for all affected ABIS.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agoUpdate powerpc libm-test-ulps
Matheus Castanho [Thu, 10 Sep 2020 18:06:34 +0000 (15:06 -0300)]
Update powerpc libm-test-ulps

Before this patch, the following tests were failing:

ppc and ppc64:
    FAIL: math/test-ldouble-j0

ppc64le:
    FAIL: math/test-float128-j0
    FAIL: math/test-float64x-j0
    FAIL: math/test-ibm128-j0
    FAIL: math/test-ldouble-j0

3 years agobenchtests: Add "workload" traces for sinf128
Paul Zimmermann [Thu, 27 Aug 2020 13:28:56 +0000 (10:28 -0300)]
benchtests: Add "workload" traces for sinf128

This patch adds workload traces for sinf128 in binary32.  The trace is
made of 1000 random numbers, generated with SageMath.

3 years agobenchtests: Add "workload" traces for sinf
Paul Zimmermann [Thu, 27 Aug 2020 13:27:44 +0000 (10:27 -0300)]
benchtests: Add "workload" traces for sinf

This patch adds workload traces for sinf in binary32.  The trace is
made of 1000 random numbers, generated with SageMath.

3 years agobenchtests: Add "workload" traces for sin
Paul Zimmermann [Thu, 27 Aug 2020 13:26:45 +0000 (10:26 -0300)]
benchtests: Add "workload" traces for sin

This patch adds workload traces for sin in binary64.  The trace is
made of 1000 random numbers, generated with SageMath.

3 years agobenchtests: Add "workload" traces for powf128
Paul Zimmermann [Thu, 27 Aug 2020 13:25:04 +0000 (10:25 -0300)]
benchtests: Add "workload" traces for powf128

This patch adds workload traces for pow in binary128.  The trace is
made of 1000 random numbers, generated with SageMath.

3 years agobenchtests: Add "workload" traces for pow
Paul Zimmermann [Thu, 27 Aug 2020 13:23:11 +0000 (10:23 -0300)]
benchtests: Add "workload" traces for pow

This patch adds workload traces for pow in binary64.  The trace is
made of 1000 random numbers, generated with SageMath.

3 years agobenchtests: Add "workload" traces for expf128
Paul Zimmermann [Thu, 27 Aug 2020 13:21:37 +0000 (10:21 -0300)]
benchtests: Add "workload" traces for expf128

This patch adds workload traces for exp in binary128.  The trace is
made of 1000 random numbers, generated with SageMath.

3 years agobenchtests: Add "workload" traces for exp
Paul Zimmermann [Thu, 27 Aug 2020 13:17:09 +0000 (10:17 -0300)]
benchtests: Add "workload" traces for exp

This patch adds workload traces for exp in binary64.  The trace is
made of 1000 random numbers, generated with SageMath.

3 years agonptl: futex: Provide correct indentation for part of __futex_abstimed_wait_cancelable64
Lukasz Majewski [Tue, 8 Sep 2020 13:01:59 +0000 (15:01 +0200)]
nptl: futex: Provide correct indentation for part of __futex_abstimed_wait_cancelable64

By mistake the if for calling __futex_abstimed_wait_cancellable32 was
misaligned with the rest of the function body.

3 years agoDisable -Wstringop-overread for some string tests
Joseph Myers [Mon, 7 Sep 2020 18:11:12 +0000 (18:11 +0000)]
Disable -Wstringop-overread for some string tests

Similarly to Maciej's changes to fix the build of rawmemchr in the
presence of GCC 11's -Wstringop-overread, also disable that option in
two string function tests that have similar warnings and other string
function warnings already disabled.

Tested with build-many-glibcs.py for aarch64-linux-gnu and
arm-linux-gnueabi that it fixes building the glibc testsuite.

3 years agostring: Fix GCC 11 `-Werror=stringop-overread' error
Maciej W. Rozycki [Mon, 31 Aug 2020 13:26:47 +0000 (14:26 +0100)]
string: Fix GCC 11 `-Werror=stringop-overread' error

Fix a compilation error:

In function '__rawmemchr',
    inlined from '__rawmemchr' at rawmemchr.c:27:1:
rawmemchr.c:36:12: error: 'memchr' specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overread]
   36 |     return memchr (s, c, (size_t)-1);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
../o-iterator.mk:9: recipe for target '.../string/rawmemchr.o' failed

introduced with GCC 11 commit d14c547abd48 ("Add -Wstringop-overread
for reading past the end by string functions.").

3 years agoC11 threads: Fix inaccuracies in testsuite
Corinna Vinschen [Mon, 7 Sep 2020 09:42:51 +0000 (11:42 +0200)]
C11 threads: Fix inaccuracies in testsuite

- tst-mtx-recursive.c: mtx_init fails to use mtx_plain.  Per C11
  specs, using mtx_recursive alone is not supported.  This isn't
  catched because mtx_plain is defined as 0.

- tst-thrd-sleep.c: thrd_sleep returns 0 on success, a negative
  value on failure.  Testing against thrd_success is incorrect.

- tst-tss-basic.c: tss_set is incorrectly checkd for a non-0
  value.  The test should test aginst C11 threads error codes.
  This isn't catched because thrd_success is defined as 0.

Note that all three tests fail on FreeBSD, which defines all mutex type
values, as well as all C11 threads error codes with non-0 values.

3 years agoelf.h: Add aarch64 bti/pac dynamic tag constants
Mark Wielaard [Fri, 28 Aug 2020 16:44:16 +0000 (18:44 +0200)]
elf.h: Add aarch64 bti/pac dynamic tag constants

Constants double checked against binutils and the ELF for the Arm 64-bit
Architecture (AArch64) Release 2020Q2 document.

Only BTI PLT is used in glibc, there's no PAC PLT with glibc, and people
are expected to use BIND_NOW.

3 years agox86: Set CPU usable feature bits conservatively [BZ #26552]
H.J. Lu [Wed, 5 Aug 2020 20:51:56 +0000 (13:51 -0700)]
x86: Set CPU usable feature bits conservatively [BZ #26552]

Set CPU usable feature bits only for CPU features which are usable in
user space and whose usability can be detected from user space, excluding
features like FSGSBASE whose enable bit can only be checked in the kernel.

3 years agoUpdate i686 ulps.
Patsy Griffin [Tue, 1 Sep 2020 20:48:23 +0000 (16:48 -0400)]
Update i686 ulps.

Without this ULP patch these 3 tests fail on i686:
FAIL: math/test-float128-j0
FAIL: math/test-float64x-j0
FAIL: math/test-ldouble-j0

CPU info:
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           85
Model name:                      Intel Xeon Processor (Cascadelake)

3 years agoUse LFS readdir in generic POSIX getcwd [BZ# 22899]
Adhemerval Zanella [Tue, 25 Aug 2020 20:22:09 +0000 (17:22 -0300)]
Use LFS readdir in generic POSIX getcwd [BZ# 22899]

Checked on x86_64-linux-gnu and i686-linux-gnu.

3 years agolinux: Remove __ASSUME_ATFCTS
Adhemerval Zanella [Tue, 25 Aug 2020 19:57:12 +0000 (16:57 -0300)]
linux: Remove __ASSUME_ATFCTS

The __have_atfcts is not used anywhere.

Checked on x86_64-linux-gnu.

3 years agoSync getcwd with gnulib
Adhemerval Zanella [Thu, 20 Aug 2020 12:04:16 +0000 (09:04 -0300)]
Sync getcwd with gnulib

This is the first of a series of patches to sync with Gnulib commit
615b43e1f9.  This patch adopts most of the changes of Gnulib, except it
retains GETCWD_RETURN_TYPE and does not always use a 64-bit internal
API. These remaining discrepancies will be addressed in later patches
in this series.

Checked on x86_64-linux-gnu and i686-linux-gnu.

3 years agox86-64: Fix FMA4 detection in ifunc [BZ #26534]
Ondřej Hošek [Wed, 26 Aug 2020 02:26:50 +0000 (04:26 +0200)]
x86-64: Fix FMA4 detection in ifunc [BZ #26534]

A typo in commit 107e6a3c2212ba7a3a4ec7cae8d82d73f7c95d0b causes the
FMA4 code path to be taken on systems that support FMA, even if they do
not support FMA4. Fix this to detect FMA4.

3 years agoy2038: nptl: Convert pthread_cond_{clock|timed}wait to support 64 bit time
Lukasz Majewski [Tue, 11 Aug 2020 08:49:03 +0000 (10:49 +0200)]
y2038: nptl: Convert pthread_cond_{clock|timed}wait to support 64 bit time

The pthread_cond_clockwait and pthread_cond_timedwait have been converted
to support 64 bit time.

This change introduces new futex_abstimed_wait_cancelable64 function in
./sysdeps/nptl/futex-helpers.c, which uses futex_time64 where possible
and tries to replace low-level preprocessor macros from
lowlevellock-futex.h
The pthread_cond_{clock|timed}wait only accepts absolute time. Moreover,
there is no need to check for NULL passed as *abstime pointer as
__pthread_cond_wait_common() always passes non-NULL struct __timespec64
pointer to futex_abstimed_wait_cancellable64().

For systems with __TIMESIZE != 64 && __WORDSIZE == 32:
- Conversions between 64 bit time to 32 bit are necessary
- Redirection to __pthread_cond_{clock|timed}wait64 will provide support
  for 64 bit time

The futex_abstimed_wait_cancelable64 function has been put into a separate
file on the purpose - to avoid issues apparent on the m68k architecture
related to small number of available registers (there is not enough
registers to put all necessary arguments in them if the above function
would be added to futex-internal.h with __always_inline attribute).

In fact - new function - namely __futex_abstimed_wait_cancellable32 is
used to reduce number of needed registers (as some in-register values are
stored on the stack when function call is made).

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 __pthread_cond_{clock|timed}wait64 and
__pthread_cond_{clock|timed}wait.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agomalloc: Fix mallinfo deprecation declaration
Adhemerval Zanella [Mon, 31 Aug 2020 14:14:01 +0000 (11:14 -0300)]
malloc: Fix mallinfo deprecation declaration

It fixes the build issue below introduced by e3960d1c57e57 (Add
mallinfo2  function that support sizes >= 4GB).  It moves the
__MALLOC_DEPRECATED to the usual place for function attributes:

  In file included from ../include/malloc.h:3,
                   from ../sysdeps/x86_64/multiarch/../../../test-skeleton.c:31,
                   from ../sysdeps/x86_64/multiarch/test-multiarch.c:96:
  ../malloc/malloc.h:118:1: error: empty declaration [-Werror]
    118 | __MALLOC_DEPRECATED;

It also adds the required deprecated warning suppression on the tests.

Checked on x86_64-linux-gnu.

3 years agox32: Add <fixup-asm-unistd.h> and regenerate arch-syscall.h
H.J. Lu [Tue, 25 Aug 2020 12:35:45 +0000 (05:35 -0700)]
x32: Add <fixup-asm-unistd.h> and regenerate arch-syscall.h

X32 uses the same 64-bit syscall interface for set_thread_area.  But
__NR_set_thread_area is missing from <asm/unistd_x32.h>.  A kernel patch
was submitted:

From 7b05d5b43ae2545e0d4a3edb24205d18bc883626 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sat, 15 Aug 2020 10:34:00 -0700
Subject: [PATCH] x86-64: Enable x32 set_thread_area

X32 uses the common 64-bit syscall interface for set_thread_area.  Add
<fixup-asm-unistd.h> to provide __NR_set_thread_area.

Co-authored-by: Florian Weimer <fweimer@redhat.com>
3 years agoAdd mallinfo2 function that support sizes >= 4GB.
Martin Liska [Tue, 7 Jul 2020 11:58:24 +0000 (13:58 +0200)]
Add mallinfo2 function that support sizes >= 4GB.

The current int type can easily overflow for allocation of more
than 4GB.

3 years agoRemove obsolete default/nss code
Thorsten Kukuk [Sat, 29 Aug 2020 09:42:39 +0000 (11:42 +0200)]
Remove obsolete default/nss code

All code reading /etc/default/nss and using the internal
defines got removed, so the config file should be removed, too.

3 years agoAArch64: Improve backwards memmove performance
Wilco Dijkstra [Fri, 28 Aug 2020 16:51:40 +0000 (17:51 +0100)]
AArch64: Improve backwards memmove performance

On some microarchitectures performance of the backwards memmove improves if
the stores use STR with decreasing addresses.  So change the memmove loop
in memcpy_advsimd.S to use 2x STR rather than STP.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoAdd RISC-V 32-bit target to build-many-glibcs.py
Zong Li [Fri, 30 Nov 2018 09:18:40 +0000 (17:18 +0800)]
Add RISC-V 32-bit target to build-many-glibcs.py

Support building three variants of 32-bit RISC-V glibc as follows:
- riscv32-linux-gnu-rv32imac-ilp32
- riscv32-linux-gnu-rv32imafdc-ilp32
- riscv32-linux-gnu-rv32imafdc-ilp32d

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoDocumentation for the RISC-V 32-bit port
Alistair Francis [Tue, 14 Jul 2020 13:29:56 +0000 (06:29 -0700)]
Documentation for the RISC-V 32-bit port

There is already RISC-V 64-bit port information in the documentation.
Let's add some documentation entries for the RISC-V 32-bit as well.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoRISC-V: Build infrastructure for 32-bit port
Zong Li [Fri, 30 Nov 2018 09:18:00 +0000 (17:18 +0800)]
RISC-V: Build infrastructure for 32-bit port

This patch lays out the top-level organisation of the RISC-V 32-bit port.
It provides all the Implies files as well as various other fragments of
the build infrastructure.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoRISC-V: Add rv32 path to RTLDLIST in ldd
Zong Li [Tue, 10 Sep 2019 04:35:50 +0000 (21:35 -0700)]
RISC-V: Add rv32 path to RTLDLIST in ldd

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoriscv32: Specify the arch_minimum_kernel as 5.4
Alistair Francis [Sat, 21 Dec 2019 02:29:42 +0000 (18:29 -0800)]
riscv32: Specify the arch_minimum_kernel as 5.4

Specify the minimum kernel version for RISC-V 32-bit as the 5.4 kernel.
We require this commit: "waitid: Add support for waiting for the current
process group" for the kernel as it adds support for the P_PGID id for
the waitid syscall.  Without this patch we can't replace the wait4
syscall on 64-bit time_t only systems.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoRISC-V: Fix llrint and llround missing exceptions on RV32
Zong Li [Fri, 30 Nov 2018 09:18:20 +0000 (17:18 +0800)]
RISC-V: Fix llrint and llround missing exceptions on RV32

Conversions from a float to a long long on 32-bit RISC-V (RV32) may not
raise the correct exceptions on overflow, it also may raise spurious
"inexact" exceptions on non overflow cases.  This patch fixes the
problem, similarly to the fix for MIPS, ARM and S390.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoRISC-V: Add the RV32 libm-test-ulps
Alistair Francis [Sat, 4 Jan 2020 01:56:50 +0000 (17:56 -0800)]
RISC-V: Add the RV32 libm-test-ulps

Add a libm-test-ulps for RV32, this is the same as the RV64 one.

This dosn't match what is generated by running `make regen-ulps` on RV32
QEMU, but the current in tree RV64 doesn't match that either.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoRISC-V: Add 32-bit ABI lists
Alistair Francis [Mon, 13 Jul 2020 16:08:25 +0000 (09:08 -0700)]
RISC-V: Add 32-bit ABI lists

Use the update-abi Make target to generate the abilist for RV32.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoRISC-V: Add hard float support for 32-bit CPUs
Zong Li [Fri, 30 Nov 2018 09:16:38 +0000 (17:16 +0800)]
RISC-V: Add hard float support for 32-bit CPUs

This patch adds support for hardware floating-point support for the
RV32IF and RV32IFD platforms.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoRISC-V: Support the 32-bit ABI implementation
Alistair Francis [Mon, 10 Feb 2020 18:36:21 +0000 (10:36 -0800)]
RISC-V: Support the 32-bit ABI implementation

This patch adds the ABI implementation for 32-bit RISC-V.  It contains
the Linux-specific and RISC-V architecture code.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoRISC-V: Add arch-syscall.h for RV32
Alistair Francis [Thu, 2 Jan 2020 19:38:27 +0000 (11:38 -0800)]
RISC-V: Add arch-syscall.h for RV32

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoRISC-V: Add path of library directories for the 32-bit
Alistair Francis [Thu, 9 Jul 2020 17:02:06 +0000 (10:02 -0700)]
RISC-V: Add path of library directories for the 32-bit

With RV32 support the list of possible RISC-V system directories
increases to:
     - /lib64/lp64d
     - /lib64/lp64
     - /lib32/ilp32d
     - /lib32/ilp32
     - /lib (only ld.so)

This patch changes the add_system_dir () macro to support the new ilp32d
and ilp32 directories for RV32.  While refactoring this code let's split
out the confusing if statements into a loop to make it easier to
understand and extend.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoRISC-V: Support dynamic loader for the 32-bit
Zong Li [Fri, 30 Nov 2018 09:14:35 +0000 (17:14 +0800)]
RISC-V: Support dynamic loader for the 32-bit

Add the LD_SO_ABI definition for RISC-V 32-bit.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoRISC-V: Add support for 32-bit vDSO calls
Alistair Francis [Wed, 18 Sep 2019 15:41:59 +0000 (08:41 -0700)]
RISC-V: Add support for 32-bit vDSO calls

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoRISC-V: Use 64-bit-time syscall numbers with the 32-bit port
Alistair Francis [Tue, 25 Jun 2019 23:32:38 +0000 (16:32 -0700)]
RISC-V: Use 64-bit-time syscall numbers with the 32-bit port

sysdep.h redefines only the syscall where the generic implementation
still does not have actual 64-bit time_t support:

   /* Workarounds for generic code needing to handle 64-bit time_t.  */

   /* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c.  */
   #define __NR_clock_getres    __NR_clock_getres_time64
   /* Fix sysdeps/nptl/lowlevellock-futex.h.  */
   #define __NR_futex           __NR_futex_time64
   [...]

This patch also adds a comment that it is a workaround to handle 64-bit
time_t and on each #define comment for which implementation it intends
to.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoRISC-V: Cleanup some of the sysdep.h code
Alistair Francis [Wed, 8 Jul 2020 14:49:40 +0000 (07:49 -0700)]
RISC-V: Cleanup some of the sysdep.h code

Remove a duplicate inclusion of <sysdeps/unix/sysdep.h> which is already
pulled via <sysdeps/unix/sysv/linux/generic/sysdep.h>, and the inclusion
of <errno.h> whose definition of `__set_errno' is not needed here.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoRISC-V: Use 64-bit time_t and off_t for RV32 and RV64
Alistair Francis [Fri, 21 Jun 2019 18:31:56 +0000 (11:31 -0700)]
RISC-V: Use 64-bit time_t and off_t for RV32 and RV64

Using the original glibc headers under bits/ let's make small
modifications to use 64-bit time_t and off_t for both RV32 and RV64.

For the typesizes.h, here are justifications for the changes from the
generic version (based on Arnd's very helpful feedback):
- All the !__USE_FILE_OFFSET64 types (__off_t, __ino_t, __rlim_t, ...)
  are changed to match the 64-bit replacements.

- __time_t is defined to 64 bit, but no __time64_t is added. This makes
  sense as we don't have the time64 support for other 32-bit
  architectures yet, and it will be easy to change when that happens.

- __suseconds_t is 64-bit. This matches what we use the kernel ABI for
  the few drivers that are relying on 'struct timeval' input arguments
  in ioctl, as well as the adjtimex system call. It means that timeval
  has to be defined without the padding, unlike timespec, which needs
  padding.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
3 years agoio/lockf: Include bits/types.h before __OFF_T_MATCHES_OFF64_T check
Alistair Francis [Tue, 25 Aug 2020 18:15:27 +0000 (11:15 -0700)]
io/lockf: Include bits/types.h before __OFF_T_MATCHES_OFF64_T check

It's possible that although __OFF_T_MATCHES_OFF64_T is defined the
included the relevent header file.  This results in a io/tst-lockf
failure for RV32 by calling the non 64-bit version of lockf.  This
patch fixes the failure by including bits/types.h.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoelf/tst-libc_dlvsym: Add a TEST_COMPAT around some symbol tests
Alistair Francis [Mon, 24 Aug 2020 22:35:44 +0000 (15:35 -0700)]
elf/tst-libc_dlvsym: Add a TEST_COMPAT around some symbol tests

The _sys_errlist and _sys_siglist symbols are deprecated since 2.32.
This patch adds a TEST_COMPAT check around the tests. This fixes test
failures on new architectures (such as RV32) that don't have this
symbol defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agohurd: define BSD 4.3 ioctls only under __USE_MISC
Samuel Thibault [Thu, 27 Aug 2020 11:35:58 +0000 (13:35 +0200)]
hurd: define BSD 4.3 ioctls only under __USE_MISC

3 years agostring: test strncasecmp and strncpy near page boundaries
Raphael Moreira Zinsly [Fri, 21 Aug 2020 15:10:22 +0000 (12:10 -0300)]
string: test strncasecmp and strncpy near page boundaries

Add tests to check if strings placed at page boundaries are
handled correctly by strncasecmp and strncpy similar to tests
for strncmp and strnlen.

3 years agolinux: Simplify utimensat
Adhemerval Zanella [Fri, 10 Jul 2020 18:13:48 +0000 (15:13 -0300)]
linux: Simplify utimensat

With arch-syscall.h it can now assumes the existance of either
__NR_utimensat or __NR_utimensat_time64.  The 32-bit time_t
support is now only build for !__ASSUME_TIME64_SYSCALLS.

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Simplify timerfd_settime
Adhemerval Zanella [Fri, 10 Jul 2020 18:11:13 +0000 (15:11 -0300)]
linux: Simplify timerfd_settime

 With arch-syscall.h it can now assumes the existance of either
__NR_timer_settime or __NR_time_settime_time64.  The 32-bit time_t
support is now only build for !__ASSUME_TIME64_SYSCALLS.

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Simplify timer_gettime
Adhemerval Zanella [Fri, 10 Jul 2020 18:05:51 +0000 (15:05 -0300)]
linux: Simplify timer_gettime

With arch-syscall.h it can now assumes the existance of either
__NR_timer_gettime or __NR_time_gettime_time64.  The 32-bit time_t
support is now only build for !__ASSUME_TIME64_SYSCALLS.

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Simplify sched_rr_get_interval
Adhemerval Zanella [Fri, 10 Jul 2020 17:04:48 +0000 (14:04 -0300)]
linux: Simplify sched_rr_get_interval

With arch-syscall.h it can now assumes the existance of either
__NR_sched_rr_get_interval or __NR_sched_rr_get_interval_time64.
The 32-bit time_t support is now only build for
!__ASSUME_TIME64_SYSCALLS.

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Simplify ppoll
Adhemerval Zanella [Fri, 10 Jul 2020 16:33:40 +0000 (13:33 -0300)]
linux: Simplify ppoll

With arch-syscall.h it can now assumes the existance of either
__NR_ppoll or __NR_ppoll_time64.  The 32-bit time_t support is now
only build for !__ASSUME_TIME64_SYSCALLS.

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Simplify mq_timedsend
Adhemerval Zanella [Fri, 10 Jul 2020 14:15:42 +0000 (11:15 -0300)]
linux: Simplify mq_timedsend

 With arch-syscall.h it can now assumes the existance of either
__NR_mq_timedsend or __NR_mq_timedsend_time64.  The 32-bit
time_t support is now only build for !__ASSUME_TIME64_SYSCALLS.

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Simplify mq_timedreceive
Adhemerval Zanella [Fri, 10 Jul 2020 13:41:23 +0000 (10:41 -0300)]
linux: Simplify mq_timedreceive

With arch-syscall.h it can now assumes the existance of either
__NR_mq_timedreceive or __NR_mq_timedreceive_time64.  The 32-bit
time_t support is now only build for !__ASSUME_TIME64_SYSCALLS.

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Simplify clock_settime
Adhemerval Zanella [Fri, 10 Jul 2020 13:04:14 +0000 (10:04 -0300)]
linux: Simplify clock_settime

With arch-syscall.h it can now assumes the existance of either
__NR_clock_settime or __NR_clock_settime_time64.  The 32-bit
time_t support is now only build for !__ASSUME_TIME64_SYSCALLS.

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Simplify clock_nanosleep
Adhemerval Zanella [Fri, 10 Jul 2020 12:54:35 +0000 (09:54 -0300)]
linux: Simplify clock_nanosleep

With arch-syscall.h it can now assumes the existance of either
__NR_clock_nanosleep or __NR_clock_nanosleep_time64.  The 32-bit
time_t support is now only build for !__ASSUME_TIME64_SYSCALLS.

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Simplify clock_gettime
Adhemerval Zanella [Fri, 10 Jul 2020 12:50:04 +0000 (09:50 -0300)]
linux: Simplify clock_gettime

With arch-syscall.h it can now assumes the existance of either
__NR_clock_gettime or __NR_clock_gettime_time64.  The 32-bit time_t
support is now only build for !__ASSUME_TIME64_SYSCALLS.

It also uses the time64-support functions to simplify it further.

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

3 years agolinux: Simplify clock_adjtime
Adhemerval Zanella [Thu, 9 Jul 2020 19:42:14 +0000 (16:42 -0300)]
linux: Simplify clock_adjtime

With arch-syscall.h it can now assumes the existance of either
__NR_clock_adjtime or __NR_clock_adjtime_time64.  The 32-bit time_t
support is now only build for !__ASSUME_TIME64_SYSCALLS.

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agolinux: Add helper function to optimize 64-bit time_t fallback support
Adhemerval Zanella [Thu, 20 Aug 2020 12:18:15 +0000 (09:18 -0300)]
linux: Add helper function to optimize 64-bit time_t fallback support

These helper functions are used to optimize the 64-bit time_t support on
configurations that requires support for 32-bit time_t fallback
(!__ASSUME_TIME64_SYSCALLS).  The idea is once the kernel advertises that
it does not have 64-bit time_t support, glibc will stop to try issue the
64-bit time_t syscall altogether.

For instance:

  #ifndef __NR_symbol_time64
  # define __NR_symbol_time64 __NR_symbol
  #endif
  int r;
  if (supports_time64 ())
    {
      r = INLINE_SYSCALL_CALL (symbol, ...);
      if (r == 0 || errno != ENOSYS)
        return r;

      mark_time64_unsupported ();
    }
  #ifndef __ASSUME_TIME64_SYSCALLS
  <32-bit fallback syscall>
  #endif
  return r;

On configuration with default 64-bit time_t this optimization should be
optimized away by the compiler resulting in no overhead.

3 years agoS390: Sync HWCAP names with kernel by adding aliases [BZ #25971]
Stefan Liebler [Fri, 21 Aug 2020 09:23:17 +0000 (11:23 +0200)]
S390: Sync HWCAP names with kernel by adding aliases [BZ #25971]

Unfortunately some HWCAP names like HWCAP_S390_VX differs between
kernel (see <kernel>/arch/s390/include/asm/elf.h) and glibc.

Therefore, those HWCAP names from kernel are now introduced as alias

3 years ago[vcstocl] Import ProjectQuirks from its own file
Siddhesh Poyarekar [Thu, 20 Aug 2020 03:15:02 +0000 (08:45 +0530)]
[vcstocl] Import ProjectQuirks from its own file

ProjectQuirks moved into its own file in gnulib because one cannot
import modules with hyphens in them.  Adjust the quirks file to
reflect this reality.

3 years agobuild-many-glibcs.py: Add a s390x -O3 glibc variant.
Stefan Liebler [Thu, 20 Aug 2020 08:51:42 +0000 (10:51 +0200)]
build-many-glibcs.py: Add a s390x -O3 glibc variant.

On s390x, gcc inlines more aggresive compared to other architectures.
This occaisionally leads to build warnings / errors.

Therefore this patch adds a s390x glibc variant with optimization.

There is the ccopts field which contain ABI options which are passed
to configure as CC / CXX.  Now there is also the cflags field which
contains non-ABI options like -g or -O. Those are passed to configure
as CFLAGS / CXXFLAGS.

Currently CC is passed to conformtest.py or linknamespace.py but not
the CFLAGS.

3 years agoFix namespace violation in stdio.h and sys/stat.h if build with optimization. [BZ...
Stefan Liebler [Thu, 20 Aug 2020 08:45:26 +0000 (10:45 +0200)]
Fix namespace violation in stdio.h and sys/stat.h if build with optimization. [BZ #26376]

If build with optimization, stdio.h and sys/stat.h are defining some inlining
functions.  This leads to test fails if glibc is build with the following
commands. (Note that the conformtests usually builds without optimization or
other CFLAGS):
<glibc>/configure CC="gcc -O3" --prefix=/usr
make
make subdirs=conform check
- FAIL: conform/XPG4/stdio.h/conform
- FAIL: conform/XPG42/stdio.h/conform
out-files:
...
PASSCOMBINED: Availability of variable optopt
PASSCOMBINED: Type of variable optopt
    Namespace violation: "getc_unlocked"
    Namespace violation: "getchar_unlocked"
    Namespace violation: "putc_unlocked"
    Namespace violation: "putchar_unlocked"
FAIL: Namespace of <stdio.h>
----------------------------------------------------------------------------
  Total number of tests   :  168
  Number of failed tests  :    1
  Number of xfailed tests :    0
  Number of skipped tests :    0

- FAIL: conform/POSIX2008/sys/stat.h/conform
out-file:
...
PASSCOMBINED: Availability of function utimensat
PASSCOMBINED: Type of function utimensat
    Namespace violation: "mknodat"
FAIL: Namespace of <sys/stat.h>
----------------------------------------------------------------------------
  Total number of tests   :   97
  Number of failed tests  :    1
  Number of xfailed tests :    0
  Number of skipped tests :    0

For getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked in stdio.h,
those are defined "# ifdef __USE_POSIX" instead of "#ifdef __USE_POSIX199506"
for the non-inlining declaration. See also
"Bug 20014 - stdio.h namespace for pre-threads POSIX"
(https://sourceware.org/bugzilla/show_bug.cgi?id=20014).

For mknodat in sys/stat.h, those are defined "# ifdef __USE_ATFILE" instead of
the additional guard "# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED".

3 years agoAdd C2x BOOL_MAX and BOOL_WIDTH to limits.h.
Joseph Myers [Wed, 19 Aug 2020 22:46:41 +0000 (22:46 +0000)]
Add C2x BOOL_MAX and BOOL_WIDTH to limits.h.

C2x adds BOOL_MAX and BOOL_WIDTH macros to <limits.h>.  This patch
adds them to glibc's <limits.h> for the case when they aren't defined
by GCC's <limits.h>.

Tested for x86_64.

3 years agoUse MPC 1.2.0 in build-many-glibcs.py.
Joseph Myers [Wed, 19 Aug 2020 13:48:14 +0000 (13:48 +0000)]
Use MPC 1.2.0 in build-many-glibcs.py.

This patch makes build-many-glibcs.py use the new MPC 1.2.0 release.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).

3 years agoAdd new STATX_* constants from Linux 5.8 to bits/statx-generic.h.
Joseph Myers [Wed, 19 Aug 2020 13:47:37 +0000 (13:47 +0000)]
Add new STATX_* constants from Linux 5.8 to bits/statx-generic.h.

This patch adds the new STATX_MNT_ID, STATX_ATTR_MOUNT_ROOT and
STATX_ATTR_DAX macros from Linux 5.8 to glibc's bits/statx-generic.h.
(As with previous such changes, this only does anything if glibc is
being used with old kernel headers.)

A comment in the Linux kernel headers indicates that STATX_ALL is
deliberately not being changed.

Tested for x86_64.

3 years agoCorrect locking and cancellation cleanup in syslog functions (bug 26100)
Andreas Schwab [Tue, 23 Jun 2020 10:55:49 +0000 (12:55 +0200)]
Correct locking and cancellation cleanup in syslog functions (bug 26100)

Properly serialize the access to the global state shared between the
syslog functions, to avoid races in multithreaded processes.  Protect a
local allocation in the __vsyslog_internal function from leaking during
cancellation.

3 years agonptl: Handle NULL abstime [BZ #26394]
H.J. Lu [Sat, 15 Aug 2020 18:06:35 +0000 (11:06 -0700)]
nptl: Handle NULL abstime [BZ #26394]

Since abstime passed to pthread_{clock|timed}join_np may be NULL, convert
to 64 bit abstime only if abstime isn't NULL.

3 years agoUpdate build-many-glibcs.py for binutils ia64 obsoletion.
Joseph Myers [Thu, 13 Aug 2020 18:51:10 +0000 (18:51 +0000)]
Update build-many-glibcs.py for binutils ia64 obsoletion.

Since binutils has obsoleted ia64 support, use --enable-obsolete for
now when configuring binutils for ia64 in build-many-glibcs.py (which
requires adding support for architecture-specific binutils configure
options there).  As with other obsoletions, the removal of support for
ia64 in any of (binutils, GCC, Linux kernel) should imply its removal
from glibc.

Tested with build-many-glibcs.py for ia64-linux-gnu (compilers and
glibcs build).

3 years agoUpdate kernel version to 5.8 in tst-mman-consts.py.
Joseph Myers [Thu, 13 Aug 2020 18:50:24 +0000 (18:50 +0000)]
Update kernel version to 5.8 in tst-mman-consts.py.

This patch updates the kernel version in the test tst-mman-consts.py
to 5.8.  (There are no new MAP_* constants covered by this test in 5.8
that need any other header changes.)

Tested with build-many-glibcs.py.

3 years agoy2038: nptl: Convert pthread_{clock|timed}join_np to support 64 bit time
Lukasz Majewski [Mon, 20 Jul 2020 13:50:12 +0000 (15:50 +0200)]
y2038: nptl: Convert pthread_{clock|timed}join_np to support 64 bit time

The pthread_clockjoin_np and pthread_timedjoin_np have been converted to
support 64 bit time.

This change introduces new futex_timed_wait_cancel64 function in
./sysdeps/nptl/futex-internal.h, which uses futex_time64 where possible
and tries to replace low-level preprocessor macros from
lowlevellock-futex.h
The pthread_{timed|clock}join_np only accept absolute time. Moreover,
there is no need to check for NULL passed as *abstime pointer as
clockwait_tid() always passes struct __timespec64.

For systems with __TIMESIZE != 64 && __WORDSIZE == 32:
- Conversions between 64 bit time to 32 bit are necessary
- Redirection to __pthread_{clock|timed}join_np64 will provide support
  for 64 bit time

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 __pthread_{timed|clock}join_np64 and
__pthread_{timed|clock}join_np.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
3 years agoaarch64: update ulps.
Szabolcs Nagy [Thu, 13 Aug 2020 12:02:35 +0000 (13:02 +0100)]
aarch64: update ulps.

For new j0 test.

3 years agoS390: Regenerate ULPs.
Stefan Liebler [Wed, 12 Aug 2020 14:23:12 +0000 (16:23 +0200)]
S390: Regenerate ULPs.

Updates needed after new j0 test:
commit 9bfc225078219521439ec8b0f665915e769d40c2
math: Regenerate auto-libm-test-out-j0

3 years agomanual: Fix sigdescr_np and sigabbrev_np return type (BZ #26343)
Adhemerval Zanella [Sat, 8 Aug 2020 19:49:53 +0000 (16:49 -0300)]
manual: Fix sigdescr_np and sigabbrev_np return type (BZ #26343)

3 years agomath: Update x86_64 ulps
Adhemerval Zanella [Sat, 8 Aug 2020 19:43:11 +0000 (16:43 -0300)]
math: Update x86_64 ulps

From new j0 test.

3 years agomath: Regenerate auto-libm-test-out-j0
Adhemerval Zanella [Sat, 8 Aug 2020 19:41:40 +0000 (16:41 -0300)]
math: Regenerate auto-libm-test-out-j0

This is a missing bit for b7dd366dbe.

3 years agomanual: Put the istrerrorname_np and strerrordesc_np return type in braces
Adhemerval Zanella [Fri, 7 Aug 2020 20:14:49 +0000 (17:14 -0300)]
manual: Put the istrerrorname_np and strerrordesc_np return type in braces

Otherwise it is not rendered or indexed correctly.

This page took 0.08767 seconds and 5 git commands to generate.