diff options
Diffstat (limited to 'sysdeps')
21 files changed, 75 insertions, 149 deletions
diff --git a/sysdeps/ieee754/flt-32/s_modff.c b/sysdeps/ieee754/flt-32/s_modff.c index e6d2e4a..965136b 100644 --- a/sysdeps/ieee754/flt-32/s_modff.c +++ b/sysdeps/ieee754/flt-32/s_modff.c @@ -64,4 +64,6 @@ __modff (float x, float *iptr) return asfloat (t & SIGN_MASK); #endif } +#ifndef __modff libm_alias_float (__modf, modf) +#endif diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile index 994de00..c905949 100644 --- a/sysdeps/mach/hurd/Makefile +++ b/sysdeps/mach/hurd/Makefile @@ -311,9 +311,6 @@ endif ifeq ($(subdir),htl) tests-unsupported += tst-basic7 endif -ifeq ($(subdir),io) -tests-unsupported += test-lfs -endif ifeq ($(subdir),libio) tests-unsupported += tst-asprintf-null endif diff --git a/sysdeps/posix/libc_fatal.c b/sysdeps/posix/libc_fatal.c index d90cc6c..6f75197 100644 --- a/sysdeps/posix/libc_fatal.c +++ b/sysdeps/posix/libc_fatal.c @@ -16,23 +16,13 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ -#include <atomic.h> -#include <errno.h> -#include <fcntl.h> +#include <assert.h> #include <ldsodefs.h> -#include <libc-pointer-arith.h> -#include <paths.h> +#include <setvmaname.h> #include <stdarg.h> -#include <stdbool.h> #include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sysdep.h> -#include <unistd.h> -#include <sys/mman.h> #include <sys/uio.h> -#include <not-cancel.h> -#include <setvmaname.h> +#include <unistd.h> #ifdef FATAL_PREPARE_INCLUDE #include FATAL_PREPARE_INCLUDE @@ -47,6 +37,10 @@ writev_for_fatal (int fd, const struct iovec *iov, size_t niov, size_t total) } #endif +/* At most a substring before each conversion specification and the + trailing substring (the plus one). */ +#define IOVEC_MAX (LIBC_MESSAGE_MAX_ARGS * 2 + 1) + /* Abort with an error message. */ void __libc_message_impl (const char *fmt, ...) @@ -61,7 +55,7 @@ __libc_message_impl (const char *fmt, ...) if (fd == -1) fd = STDERR_FILENO; - struct iovec iov[LIBC_MESSAGE_MAX_ARGS * 2 - 1]; + struct iovec iov[IOVEC_MAX]; int iovcnt = 0; ssize_t total = 0; @@ -99,6 +93,16 @@ __libc_message_impl (const char *fmt, ...) iov[iovcnt].iov_len = len; total += len; iovcnt++; + + if (__glibc_unlikely (iovcnt > IOVEC_MAX)) + { + len = IOVEC_MAX_ERR_MSG_LEN; + iov[0].iov_base = (char *) IOVEC_MAX_ERR_MSG; + iov[0].iov_len = len; + total = len; + iovcnt = 1; + break; + } } va_end (ap); diff --git a/sysdeps/powerpc/fpu/math-use-builtins-trunc.h b/sysdeps/powerpc/fpu/math-use-builtins-trunc.h new file mode 100644 index 0000000..3e6a55d --- /dev/null +++ b/sysdeps/powerpc/fpu/math-use-builtins-trunc.h @@ -0,0 +1,9 @@ +#ifdef _ARCH_PWR5X +# define USE_TRUNCF_BUILTIN 1 +# define USE_TRUNC_BUILTIN 1 +#else +# define USE_TRUNCF_BUILTIN 0 +# define USE_TRUNC_BUILTIN 0 +#endif +#define USE_TRUNCL_BUILTIN 0 +#define USE_TRUNCF128_BUILTIN 0 diff --git a/sysdeps/powerpc/fpu/s_modf.c b/sysdeps/powerpc/fpu/s_modf.c deleted file mode 100644 index 831072b..0000000 --- a/sysdeps/powerpc/fpu/s_modf.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (C) 2013-2025 Free Software Foundation, Inc. - This file is part of the GNU C Library - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, see <https://www.gnu.org/licenses/>. */ - -/* ISA 2.07 provides fast GPR to FP instruction (mfvsr{d,wz}) which make - generic implementation faster. Also disables for old ISAs that do not - have ceil/floor instructions. */ -#if defined(_ARCH_PWR8) || !defined(_ARCH_PWR5X) -# include <sysdeps/ieee754/ldbl-opt/s_modf.c> -#else -# include <math.h> -# include <math_ldbl_opt.h> -# include <libm-alias-double.h> - -double -__modf (double x, double *iptr) -{ - if (__builtin_isinf (x)) - { - *iptr = x; - return copysign (0.0, x); - } - else if (__builtin_isnan (x)) - { - *iptr = NAN; - return NAN; - } - - if (x >= 0.0) - { - *iptr = floor (x); - return copysign (x - *iptr, x); - } - else - { - *iptr = ceil (x); - return copysign (x - *iptr, x); - } -} -# ifndef __modf -libm_alias_double (__modf, modf) -# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __modf, modfl, GLIBC_2_0); -# endif -# endif -#endif diff --git a/sysdeps/powerpc/fpu/s_modff.c b/sysdeps/powerpc/fpu/s_modff.c deleted file mode 100644 index 79eeb7b..0000000 --- a/sysdeps/powerpc/fpu/s_modff.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 2013-2025 Free Software Foundation, Inc. - This file is part of the GNU C Library - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, see <https://www.gnu.org/licenses/>. */ - -/* ISA 2.07 provides fast GPR to FP instruction (mfvsr{d,wz}) which make - generic implementation faster. Also disables for old ISAs that do not - have ceil/floor instructions. */ -#if defined(_ARCH_PWR8) || !defined(_ARCH_PWR5X) -# include <sysdeps/ieee754/flt-32/s_modff.c> -#else -# include <math.h> -# include <libm-alias-float.h> - -float -__modff (float x, float *iptr) -{ - if (__builtin_isinff (x)) - { - *iptr = x; - return copysignf (0.0, x); - } - else if (__builtin_isnanf (x)) - { - *iptr = NAN; - return NAN; - } - - if (x >= 0.0) - { - *iptr = floorf (x); - return copysignf (x - *iptr, x); - } - else - { - *iptr = ceilf (x); - return copysignf (x - *iptr, x); - } -} -# ifndef __modff -libm_alias_float (__modf, modf) -# endif -#endif diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c index b8315c5..48f3a19 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c @@ -17,4 +17,4 @@ <https://www.gnu.org/licenses/>. */ #define __modf __modf_power5plus -#include <sysdeps/powerpc/fpu/s_modf.c> +#include <sysdeps/ieee754/dbl-64/s_modf.c> diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c index 69591da..15bfa0b 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c @@ -17,4 +17,4 @@ <https://www.gnu.org/licenses/>. */ #define __modff __modff_power5plus -#include <sysdeps/powerpc/fpu/s_modff.c> +#include <sysdeps/ieee754/flt-32/s_modff.c> diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c index b8315c5..48f3a19 100644 --- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c @@ -17,4 +17,4 @@ <https://www.gnu.org/licenses/>. */ #define __modf __modf_power5plus -#include <sysdeps/powerpc/fpu/s_modf.c> +#include <sysdeps/ieee754/dbl-64/s_modf.c> diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c index 69591da..15bfa0b 100644 --- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c @@ -17,4 +17,4 @@ <https://www.gnu.org/licenses/>. */ #define __modff __modff_power5plus -#include <sysdeps/powerpc/fpu/s_modff.c> +#include <sysdeps/ieee754/flt-32/s_modff.c> diff --git a/sysdeps/powerpc/powerpc64/le/power10/memcmp.S b/sysdeps/powerpc/powerpc64/le/power10/memcmp.S index 9c1a41b..734bf5f 100644 --- a/sysdeps/powerpc/powerpc64/le/power10/memcmp.S +++ b/sysdeps/powerpc/powerpc64/le/power10/memcmp.S @@ -40,7 +40,7 @@ #ifndef MEMCMP # define MEMCMP memcmp #endif - .machine power9 + .machine power10 ENTRY_TOCLESS (MEMCMP, 4) CALL_MCOUNT 3 diff --git a/sysdeps/powerpc/powerpc64/le/power10/memcpy.S b/sysdeps/powerpc/powerpc64/le/power10/memcpy.S index ed7a9f5..f2a503e 100644 --- a/sysdeps/powerpc/powerpc64/le/power10/memcpy.S +++ b/sysdeps/powerpc/powerpc64/le/power10/memcpy.S @@ -26,7 +26,7 @@ /* __ptr_t [r3] memcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]); Returns 'dst'. */ - .machine power9 + .machine power10 ENTRY_TOCLESS (MEMCPY, 5) CALL_MCOUNT 3 diff --git a/sysdeps/powerpc/powerpc64/le/power10/memmove.S b/sysdeps/powerpc/powerpc64/le/power10/memmove.S index 47c2ac3..4aaa1ef 100644 --- a/sysdeps/powerpc/powerpc64/le/power10/memmove.S +++ b/sysdeps/powerpc/powerpc64/le/power10/memmove.S @@ -28,7 +28,7 @@ #ifndef MEMMOVE # define MEMMOVE memmove #endif - .machine power9 + .machine power10 ENTRY_TOCLESS (MEMMOVE, 5) CALL_MCOUNT 3 diff --git a/sysdeps/powerpc/powerpc64/le/power10/memset.S b/sysdeps/powerpc/powerpc64/le/power10/memset.S index 29d5114..f9442e7 100644 --- a/sysdeps/powerpc/powerpc64/le/power10/memset.S +++ b/sysdeps/powerpc/powerpc64/le/power10/memset.S @@ -25,7 +25,7 @@ # define MEMSET memset #endif - .machine power9 + .machine power10 ENTRY_TOCLESS (MEMSET, 5) CALL_MCOUNT 3 diff --git a/sysdeps/powerpc/powerpc64/le/power10/strlen.S b/sysdeps/powerpc/powerpc64/le/power10/strlen.S index 74f572c..ec644d5 100644 --- a/sysdeps/powerpc/powerpc64/le/power10/strlen.S +++ b/sysdeps/powerpc/powerpc64/le/power10/strlen.S @@ -92,7 +92,7 @@ The implementation can load bytes past a matching byte, but only up to the next 64B boundary, so it never crosses a page. */ -.machine power9 +.machine power10 ENTRY_TOCLESS (FUNCNAME, 4) CALL_MCOUNT MCOUNT_NARGS diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index c6b2db8..c47cbdf 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -612,6 +612,7 @@ endif ifeq ($(subdir),io) sysdep_routines += \ close_nocancel \ + close_nocancel_nostatus \ fallocate \ fallocate64 \ fcntl_nocancel \ diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions index b721331..585dec7 100644 --- a/sysdeps/unix/sysv/linux/Versions +++ b/sysdeps/unix/sysv/linux/Versions @@ -346,6 +346,7 @@ libc { __read_nocancel; __pread64_nocancel; __close_nocancel; + __close_nocancel_nostatus; __sigtimedwait; # functions used by nscd __netlink_assert_response; diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c index 6d63c8a..1acc82d 100644 --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c @@ -23,6 +23,7 @@ #include <sys/prctl.h> #include <sys/utsname.h> #include <dl-tunables-parse.h> +#include <dl-symbol-redir-ifunc.h> #define DCZID_DZP_MASK (1 << 4) #define DCZID_BS_MASK (0xf) diff --git a/sysdeps/unix/sysv/linux/close_nocancel_nostatus.c b/sysdeps/unix/sysv/linux/close_nocancel_nostatus.c new file mode 100644 index 0000000..b1df5ed --- /dev/null +++ b/sysdeps/unix/sysv/linux/close_nocancel_nostatus.c @@ -0,0 +1,28 @@ +/* Linux close syscall implementation -- non-cancellable, no errno update. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <unistd.h> +#include <sysdep-cancel.h> +#include <not-cancel.h> + +void +__close_nocancel_nostatus (int fd) +{ + INTERNAL_SYSCALL_CALL (close, fd); +} +libc_hidden_def (__close_nocancel_nostatus) diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h index ece3297..5ac6dd4 100644 --- a/sysdeps/unix/sysv/linux/not-cancel.h +++ b/sysdeps/unix/sysv/linux/not-cancel.h @@ -53,6 +53,9 @@ __typeof (__write) __write_nocancel; /* Uncancelable close. */ __typeof (__close) __close_nocancel; +/* Uncancellable close that does not also set errno in case of failure. */ +void __close_nocancel_nostatus (int); + /* Uncancelable fcntl. */ int __fcntl64_nocancel (int, int, ...); @@ -65,17 +68,10 @@ hidden_proto (__read_nocancel) hidden_proto (__pread64_nocancel) hidden_proto (__write_nocancel) hidden_proto (__close_nocancel) +hidden_proto (__close_nocancel_nostatus) hidden_proto (__fcntl64_nocancel) #endif -/* Non cancellable close syscall that does not also set errno in case of - failure. */ -static inline void -__close_nocancel_nostatus (int fd) -{ - __close_nocancel (fd); -} - /* Non cancellable writev syscall that does not also set errno in case of failure. */ static inline void diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h index ee015df..05e0e05 100644 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h @@ -145,11 +145,12 @@ # define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres" # define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime" # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" +# define HAVE_GETRANDOM_VSYSCALL "__vdso_getrandom" # else # define VDSO_NAME "LINUX_5.4" # define VDSO_HASH 61765876 -/* RV32 does not support the gettime VDSO syscalls. */ +/* RV32 does not support the gettime and getrandom VDSO syscalls. */ # endif # define HAVE_CLONE3_WRAPPER 1 |