Commit Graph

35725 Commits

Author SHA1 Message Date
Lukasz Majewski
7975f9a48a y2038: fix: Add missing libc_hidden_def for __futimens64
The libc_hidden_def () declaration for __futimens64 function was missing,
so it is added in this patch.
2020-03-07 12:45:27 +01:00
Adhemerval Zanella
b33e946fbb sparc: Move sigreturn stub to assembly
It seems that some gcc versions might generates a stack frame for the
sigreturn stub requires on sparc signal handling.  For instance:

  $ cat test.c
  #define _GNU_SOURCE
  #include <sys/syscall.h>

  __attribute__ ((__optimize__ ("-fno-stack-protector")))
  void
  __sigreturn_stub (void)
  {
    __asm__ ("mov %0, %%g1\n\t"
            "ta  0x10\n\t"
            : /* no outputs */
            : "i" (SYS_rt_sigreturn));
  }
  $ gcc -v
  [...]
  gcc version 9.2.1 20200224 (Debian 9.2.1-30)
  $ gcc -O2 -m64 test.c -S -o -
  [...]
    __sigreturn_stub:
          save    %sp, -176, %sp
  #APP
  ! 9 "t.c" 1
          mov 101, %g1
          ta  0x10

  ! 0 "" 2
  #NO_APP
          .size   __sigreturn_stub, .-__sigreturn_stub

As indicated by kernel developers [1], the sigreturn stub can not change
the register window or the stack pointer since the kernel has setup the
restore frame at a precise location relative to the stack pointer when
the stub is invoked.

I tried to play with some compiler flags and even with _Noreturn and
__builtin_unreachable after the asm does not help (and Sparc does not
support naked functions).

To avoid similar issues, as the stack-protector support also have
stumbled, this patch moves the implementation of the sigreturn stubs to
assembly.

Checked on sparcv9-linux-gnu and sparc64-linux-gnu with gcc 9.2.1
and gcc 7.5.0.

[1] https://lkml.org/lkml/2016/5/27/465
2020-03-06 13:17:20 -03:00
Tulio Magno Quites Machado Filho
d2b2acefa6 ldbl-128ibm: Let long double files have specific compiler flags
Soon, powerpc64le will need to provide extra compiler flags to the long
double files in order to continue to build using the IBM 128-bit
extended floating point type as long double.
2020-03-06 09:17:32 -06:00
Rajalakshmi Srinivasaraghavan
0059122aa0 ldbl-128ibm-compat: Add tests for IBM long double functions
This patch creates test-ibm128* tests from the long double function tests.
In order to explicitly test IBM long double functions -mabi=ibmlongdouble is
added to CFLAGS.

Likewise, update the test headers to correct choose ULPs when redirects
are enabled.

Co-authored-by: Tulio Magno Quites Machado Filho  <tuliom@linux.ibm.com>
Co-authored-by: Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
2020-03-06 09:17:32 -06:00
Matheus Castanho
1c252f0e7e powerpc: Fix feraiseexcept and feclearexcept macros
A recent change to fenvinline.h modified the check if __e is a
a power of 2 inside feraiseexcept and feclearexcept macros.  It
introduced the use of the powerof2 macro but also removed the
if statement checking whether __e != 0 before issuing an mtfsb*
instruction.  This is problematic because powerof2 (0) evaluates
to 1 and without the removed if __e is allowed to be 0 when
__builtin_clz is called.  In that case the value 32 is passed
to __MTFSB*, which is invalid.

This commit uses __builtin_popcount instead of powerof2 to fix this
issue and avoid the extra check for __e != 0.  This was the approach
used by the initial versions of that previous patch.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2020-03-06 11:10:12 -03:00
Adhemerval Zanella
af09e5e5d9 arm: Fix softp-fp Implies (BZ #25635)
The commit "arm: Split BE/LE abilist"
(1673ba87fe) changed the soft-fp order for
ARM selection when __SOFTFP__ is defined by the compiler.

On 2.30 the sysdeps order is:

2.30
sysdeps/unix/sysv/linux/arm
sysdeps/arm/nptl
sysdeps/unix/sysv/linux
sysdeps/nptl
sysdeps/pthread
sysdeps/gnu
sysdeps/unix/inet
sysdeps/unix/sysv
sysdeps/unix/arm
sysdeps/unix
sysdeps/posix
sysdeps/arm/nofpu
sysdeps/ieee754/soft-fp
sysdeps/arm
sysdeps/wordsize-32
sysdeps/ieee754/flt-32
sysdeps/ieee754/dbl-64
sysdeps/ieee754
sysdeps/generic

While on master is:

sysdeps/unix/sysv/linux/arm/le
sysdeps/unix/sysv/linux/arm
sysdeps/arm/nptl
sysdeps/unix/sysv/linux
sysdeps/nptl
sysdeps/pthread
sysdeps/gnu
sysdeps/unix/inet
sysdeps/unix/sysv
sysdeps/unix/arm
sysdeps/unix
sysdeps/posix
sysdeps/arm/le
sysdeps/arm
sysdeps/wordsize-32
sysdeps/ieee754/flt-32
sysdeps/ieee754/dbl-64
sysdeps/arm/nofpu
sysdeps/ieee754/soft-fp
sysdeps/ieee754
sysdeps/generic

It make the build select some routines (fadd, fdiv, fmul, fsub, and fma)
on ieee754/flt-32 and ieee754/dbl-64 that requires fenv support to be
correctly rounded which in turns lead to math failures since the
__SOFTFP__ does not have fenv support.

With this patch the order is now:

sysdeps/unix/sysv/linux/arm/le
sysdeps/unix/sysv/linux/arm
sysdeps/arm/nptl
sysdeps/unix/sysv/linux
sysdeps/nptlsysdeps/pthread
sysdeps/gnu
sysdeps/unix/inet
sysdeps/unix/sysv
sysdeps/unix/arm
sysdeps/unix
sysdeps/posix
sysdeps/arm/le/nofpu
sysdeps/arm/nofpu
sysdeps/ieee754/soft-fp
sysdeps/arm/le
sysdeps/arm
sysdeps/wordsize-32
sysdeps/ieee754/flt-32
sysdeps/ieee754/dbl-64
sysdeps/ieee754
sysdeps/generic

Checked on arm-linux-gnuaebi.
2020-03-06 09:53:24 -03:00
Adhemerval Zanella
a63189c021 Remove reference of --without-fp on configure 2020-03-06 09:53:24 -03:00
Adhemerval Zanella
60f071f47a linux/sysipc: Include linux/posix_types.h for __kernel_mode_t
The posix_types.h (where __kernel_mode_t is defined) is included
implicitly, which might not happen on older kernels.
2020-03-06 09:53:23 -03:00
Fangrui Song
87a698a216 Improve IFUNC check [BZ #25506]
GNU ld's RISCV port does not support IFUNC. ld -no-pie produces no
relocation and the test passed incorrectly. Be more rigid by testing
IRELATIVE explicitly.

Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-05 17:05:05 -03:00
Adhemerval Zanella
24fdebe75f linux: Clear mode_t padding bits (BZ#25623)
The kernel might not clear the padding value for the ipc_perm mode
fields in compat mode (32 bit running on a 64 bit kernel).  It was
fixed on v4.14 when the ipc compat code was refactored to move
(commits 553f770ef71b, 469391684626, c0ebccb6fa1e).

Although it is most likely a kernel issue, it was shown only due
BZ#18231 fix which made all the SysVIPC mode_t 32-bit regardless of
the kABI.

This patch fixes it by explicitly zeroing the upper bits for such
cases.  The __ASSUME_SYSVIPC_BROKEN_MODE_T case already handles
it with the shift.

(The aarch64 ipc_priv.h is superflous since
__ASSUME_SYSVIPC_DEFAULT_IPC_64 is now defined as default).

Checked on i686-linux-gnu on 3.10 and on 4.15 kernel.
2020-03-05 14:40:28 -03:00
Adhemerval Zanella
d5e492ba4c linux: Remove aarch64 ipc_priv.h
The aarch64 ipc_priv.h is superflous since
__ASSUME_SYSVIPC_DEFAULT_IPC_64 is now defined as default.
2020-03-05 14:40:22 -03:00
Florian Weimer
e5244cd88a Linux: Use __fstatat64 in fchmodat implementation
fstatat64 depends on inlining to produce the desired __fxstatat64
call, which does not happen with -Os, leading to a link failure
with an undefined reference to fstatat64.  __fxstatat64 has a macro
definition in include/sys/stat.h and thus avoids the problem.
2020-03-05 16:10:26 +01:00
Florian Weimer
c10826a327 Linux: Use AT_FDCWD in utime, utimes when calling utimensat
0 is a valid descriptor without any special meaning.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-03-05 16:09:52 +01:00
Stefan Liebler
1301097665 S390: Remove backchain-based fallback and use generic backtrace.c.
After recent discussions:
- "[PATCH] s390: Remove backchain-based fallback from backtrace"
  https://www.sourceware.org/ml/libc-alpha/2020-02/msg00287.html

- "Re: [PATCH 07/11] s390: Implement backtrace on top of <unwind-link.h>"
  https://www.sourceware.org/ml/libc-alpha/2020-02/msg00637.html

We've checked and decided to remove the backchain:
We don't know of any environments without libgcc. Thus the backchain
unwinder is not used. If somebody builds with -mbackchain and without
fasynchronous-unwind-tables and has libgcc installed, then the
libgcc unwinder is called but not the backchain-based fallback.

This step allows to get rid of the s390x specific backtrace.c files at all.
Furthermore the now used debug/backtrace.c version has some more
advantages:
- Free all resources if necessary. (libc_freeres_fn)
- Remove NULL address above _start.
- Check whether we make any progress while getting addresses.
2020-03-05 12:52:19 +01:00
Girish Joshi
f801cf7bb1 manual: Fix wrong declaration of wcschr [BZ #24654] 2020-03-05 09:31:43 +01:00
Girish Joshi
72bcc9ade0 manual: Fix typo in parse_printf_format example [BZ #24638] 2020-03-04 13:20:07 +01:00
Siddhesh Poyarekar
78c9d0c6ef Update translations
Incorporated updated translations from translationproject.org
2020-03-04 07:27:32 +05:30
Alistair Francis
4f88b38097 Convert Python scripts to Python 3
Change all of the #! lines in Python scripts that are called from
Makefiles to reference /usr/bin/python3.

All of the scripts called from Makefiles are already run with Python 3,
so let's make sure they are explicitly using Python 3 if called
manually.
2020-03-03 15:52:09 -08:00
Florian Weimer
c014359a7d alpha: Do not build with -fpic
The combination of GCC 10 and binutils 2.35 (both unreleased) is no
longer able to link the dynamic linker, due to a GP16 relocation
overflow error:

glibc/alpha-linux-gnu/elf/librtld.os: in function `calloc': glibc/elf/../include/rtld-malloc.h:44:(.text+0xd98): relocation truncated to fit: GPREL16 against symbol `__rtld_calloc' defined in .data.rel.ro section in glibc/alpha-linux-gnu/elf/librtld.os
glibc/alpha-linux-gnu/elf/librtld.os: in function `malloc': glibc/elf/../include/rtld-malloc.h:56:(.text+0x2978): relocation truncated to fit: GPREL16 against symbol `__rtld_malloc' defined in .data.rel.ro section in glibc/alpha-linux-gnu/elf/librtld.os

This is arguably a linker bug; the object files and their section size
requirements look reasonable enough.

Using -fPIC (the default) works around this issue.
2020-03-03 15:42:36 +01:00
Lukasz Majewski
66449d9339 y2038: linux: Provide __utime64 implementation
This patch replaces auto generated wrapper (as described in
sysdeps/unix/sysv/linux/syscalls.list) for utime with one which adds extra
support for setting file's access and modification 64 bit time on machines
with __TIMESIZE != 64.

Internally, the __utimensat_time64 helper function is used. This patch is
necessary for having architectures with __WORDSIZE == 32 && __TIMESIZE != 64
Y2038 safe.

Moreover, a 32 bit version - __utime has been refactored to internally use
__utime64.
The __utime is now supposed to be used on systems still supporting 32
bit time (__TIMESIZE != 64) - hence the necessary conversion between struct
utimbuf and struct __utimbuf64.

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 __utime64 and __utime.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 14:28:08 +01:00
Lukasz Majewski
d962a5d68a y2038: linux: Provide __utimes64 implementation
This patch provides new __utimes64 explicit 64 bit function for setting file's
64 bit attributes for access and modification time.

Internally, the __utimensat64_helper function is used. This patch is necessary
for having architectures with __WORDSIZE == 32 Y2038 safe.

Moreover, a 32 bit version - __utimes has been refactored to internally use
__utimes64.

The __utimes is now supposed to be used on systems still supporting 32
bit time (__TIMESIZE != 64) - hence the necessary conversion of struct
timeval to 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 proper usage of both __utimes64 and __utimes.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 14:28:08 +01:00
Lukasz Majewski
847d3913da y2038: Introduce struct __utimbuf64 - new internal glibc type
This type is a glibc's "internal" type to store file's access and modification
times in __time64_t rather than __time_t, which makes it Y2038-proof.

Build tests:
./src/scripts/build-many-glibcs.py glibcs

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
2020-03-03 14:28:08 +01:00
Florian Weimer
24caa35c57 microblaze: vfork is always available
Due to the built-in tables, __NR_vfork is always defined, so the
fork-based fallback code is never used.

(It appears that the vfork system call was wired up when the port was
contributed to the kernel.)

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:53:11 +01:00
Florian Weimer
bf956afeaa m68k: getpagesize syscall number is always available
Due to the built-in tables, __NR_getpagesize is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:52:47 +01:00
Florian Weimer
e76d4fb014 Linux: epoll_pwait syscall number is always available
Due to the built-in tables, __NR_epoll_pwait is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:51:14 +01:00
Florian Weimer
63e9b4bd9c x86_64: Do not define __NR_semtimedop in <sysdep.h>
The definition is always available from the built-in system call table.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:50:56 +01:00
Florian Weimer
2982d0c18f ia64: Do not define __NR_semtimedop in <sysdep.h>
The definition is always available from the built-in system call table.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:50:35 +01:00
Florian Weimer
ed9ce57e3c Linux: open_by_handle_at syscall number is always available
Due to the built-in tables, __NR_open_by_handle_at is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:50:07 +01:00
Florian Weimer
b03604b1b8 Linux: set_robust_list syscall number is always available
Due to the built-in tables, __NR_set_robust_list is always defined
(although it may not be available at run time).

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:49:44 +01:00
Florian Weimer
75376039be Linux: pciconfig_iobase syscall number is always available on alpha
Due to the built-in tables, __NR_pciconfig_iobase is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:20:59 +01:00
Florian Weimer
4fe5d3867a Linux: getdents64 syscall number is always available on MIPS
Due to the built-in tables, __NR_getdents64 is always defined,
although it may not be supported at run time.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:20:31 +01:00
Florian Weimer
b5350b487c Linux: Clean up preadv2, pwritev2 system call names
With the built-in tables __NR_preadv2 and __NR_pwritev2 are always
defined.

The kernel has never defined __NR_preadv64v2 and __NR_pwritev64v2
and is unlikely to do so, given that the preadv2 and pwritev2 system
calls themselves are 64-bit.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:18:22 +01:00
Florian Weimer
11ae9a185b Linux: exit_group syscall number is always available
Due to the built-in tables, __NR_exit_group is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:17:24 +01:00
Florian Weimer
aa350443c5 Linux: set_tid_address syscall number is always available
Due to the built-in tables, __NR_set_tid_address is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:16:55 +01:00
Florian Weimer
5d9f1add86 Linux: pkey_mprotect syscall number is always available
Due to the built-in tables, __NR_pkey_mprotect is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:16:35 +01:00
Florian Weimer
c99517a738 Linux: rt_sigqueueinfo syscall number is always available
Due to the built-in tables, __NR_rt_sigqueueinfo is always defined.

sysdeps/pthread/time_routines.c is not updated because it is shared with
Hurd.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:16:15 +01:00
Florian Weimer
658b5848a8 Linux: getrandom syscall number is always available
Due to the built-in tables, __NR_getrandom is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:15:38 +01:00
Florian Weimer
d241dee4dd Linux: Clean up preadv, pwritev system call names
The names __NR_preadv64, __NR_pwritev64 appear to be a glibc invention.
With the built-in tables, __NR_preadv and __NR_pwritev are always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:15:06 +01:00
Florian Weimer
71691aae92 Linux: Clean up pread64/pwrite64 system call names
Linux removed the last definitions of __NR_pread and __NR_pwrite
in commit 4ba66a9760722ccbb691b8f7116cad2f791cca7b, the removal
of the blackfin port.  All architectures now define __NR_pread64 and
__NR_pwrite64 only.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:14:40 +01:00
Florian Weimer
1a5f1153a7 Linux: sigaltstack syscall number is always available
Due to the built-in tables, __NR_sigaltstack is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:13:29 +01:00
Florian Weimer
822a391076 Linux: sched_getaffinity syscall number is always available
Due to the built-in tables, __NR_sched_getaffinity is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:13:07 +01:00
Florian Weimer
78e132b319 Linux: sched_setaffinity syscall number is always available
Due to the built-in tables, __NR_sched_setaffinity is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:12:42 +01:00
Florian Weimer
7255ccbec9 Linux: statx syscall number is always available
Due to the built-in tables, __NR_statx is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:12:11 +01:00
Florian Weimer
276e6080c8 Linux: mq_* syscall numbers are always available
Due to the built-in tables, __NR_mq_getsetattr, __NR_mq_notify,
__NR_mq_open, __NR_mq_timedreceive, __NR_mq_timedsend, __NR_mq_unlink
are always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:11:49 +01:00
Florian Weimer
8d25a67650 Linux: mlock2 syscall number is always available
Due to the built-in tables, __NR_mlock2 is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:11:26 +01:00
Florian Weimer
a72ae22d5d Linux: copy_file_range syscall number is always available
Due to the built-in tables, __NR_copy_file_range is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:11:01 +01:00
Florian Weimer
f122f356c5 Linux: renameat2 syscall number is always available
Due to the built-in tables, __NR_renameat2 is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-03-03 12:06:39 +01:00
Florian Weimer
feaa150680 build-many-glibcs.py: Add list-compilers, list-glibcs commands
These commands are helpful for scripting the distribution of
build-many-glibcs.py runs across multiple builders.
2020-03-03 07:39:16 +01:00
Florian Weimer
c592721a5b build-many-glibcs.py: Add --shallow option
The history is not used by build-many-glibcs.py itself.
--replace-sources deletes an existing source tree before switching
the version.  But some users prefer to have the full history
available, therefore make shallow clones optional with the --shallow
option.
2020-03-03 07:39:16 +01:00
Girish Joshi
542160f0b6 Fixed typo in run_command_array() in support/shell-container.c
https://sourceware.org/bugzilla/show_bug.cgi?id=23991
2020-03-02 15:58:16 -05:00