diff --git a/glibc-upstream-2.39-55.patch b/glibc-upstream-2.39-55.patch new file mode 100644 index 0000000..0bb52db --- /dev/null +++ b/glibc-upstream-2.39-55.patch @@ -0,0 +1,38 @@ +commit ab4ef4421f85ea7afeb482ded51003658b08de7e +Author: Gabi Falk +Date: Tue May 7 18:25:00 2024 +0000 + + x86_64: Fix missing wcsncat function definition without multiarch (x86-64-v4) + + This code expects the WCSCAT preprocessor macro to be predefined in case + the evex implementation of the function should be defined with a name + different from __wcsncat_evex. However, when glibc is built for + x86-64-v4 without multiarch support, sysdeps/x86_64/wcsncat.S defines + WCSNCAT variable instead of WCSCAT to build it as wcsncat. Rename the + variable to WCSNCAT, as it is actually a better naming choice for the + variable in this case. + + Reported-by: Kenton Groombridge + Link: https://bugs.gentoo.org/921945 + Fixes: 64b8b6516b ("x86: Add evex optimized functions for the wchar_t strcpy family") + Signed-off-by: Gabi Falk + Reviewed-by: Sunil K Pandey + (cherry picked from commit dd5f891c1ad9f1b43b9db93afe2a55cbb7a6194e) + +diff --git a/sysdeps/x86_64/multiarch/wcsncat-evex.S b/sysdeps/x86_64/multiarch/wcsncat-evex.S +index 392215950afd56be..10bfb0a5314130cf 100644 +--- a/sysdeps/x86_64/multiarch/wcsncat-evex.S ++++ b/sysdeps/x86_64/multiarch/wcsncat-evex.S +@@ -1,9 +1,9 @@ +-#ifndef WCSCAT +-# define WCSCAT __wcsncat_evex ++#ifndef WCSNCAT ++# define WCSNCAT __wcsncat_evex + #endif + + #define USE_AS_WCSCPY + #define USE_AS_STRCAT + +-#define STRNCAT WCSCAT ++#define STRNCAT WCSNCAT + #include "strncat-evex.S" diff --git a/glibc-upstream-2.39-56.patch b/glibc-upstream-2.39-56.patch new file mode 100644 index 0000000..1acf952 --- /dev/null +++ b/glibc-upstream-2.39-56.patch @@ -0,0 +1,71 @@ +commit 2db79c96baa1256b8fc2656596143da92fabd074 +Author: Sergey Kolosov +Date: Wed Apr 10 17:58:04 2024 +0200 + + libsupport: Add xgetpeername + + The patch adds redirections for getpeername. + + Reviewed-by: Arjun Shankar + (cherry picked from commit 6687a6e3f962759536a8019d31c68c1009ccd6eb) + +diff --git a/support/Makefile b/support/Makefile +index 362a51f882787f2b..aa57207bdccc852d 100644 +--- a/support/Makefile ++++ b/support/Makefile +@@ -131,6 +131,7 @@ libsupport-routines = \ + xfreopen \ + xftruncate \ + xgetline \ ++ xgetpeername \ + xgetsockname \ + xlisten \ + xlseek \ +diff --git a/support/xgetpeername.c b/support/xgetpeername.c +new file mode 100644 +index 0000000000000000..6f448e456a1d9e1e +--- /dev/null ++++ b/support/xgetpeername.c +@@ -0,0 +1,30 @@ ++/* getpeername with error checking. ++ Copyright (C) 2024 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 ++ . */ ++ ++#include ++ ++#include ++#include ++#include ++ ++void ++xgetpeername (int fd, struct sockaddr *sa, socklen_t *plen) ++{ ++ if (getpeername (fd, sa, plen) != 0) ++ FAIL_EXIT1 ("getpeername (%d): %m", fd); ++} +diff --git a/support/xsocket.h b/support/xsocket.h +index 3e4410354676cb2a..4ac0e1f5ffe35dc2 100644 +--- a/support/xsocket.h ++++ b/support/xsocket.h +@@ -26,6 +26,7 @@ + int xsocket (int, int, int); + void xsetsockopt (int, int, int, const void *, socklen_t); + void xgetsockname (int, struct sockaddr *, socklen_t *); ++void xgetpeername (int, struct sockaddr *, socklen_t *); + void xconnect (int, const struct sockaddr *, socklen_t); + void xbind (int, const struct sockaddr *, socklen_t); + void xlisten (int, int); diff --git a/glibc-upstream-2.39-57.patch b/glibc-upstream-2.39-57.patch new file mode 100644 index 0000000..aee72fa --- /dev/null +++ b/glibc-upstream-2.39-57.patch @@ -0,0 +1,143 @@ +commit 32969a2b36b8cc74343182b768b3babe6f81c3aa +Author: Sergey Kolosov +Date: Wed Apr 10 17:58:05 2024 +0200 + + socket: Add new test for connect + + This commit adds a simple bind/accept/connect test for an IPv4 TCP + connection to a local process via the loopback interface. + + Reviewed-by: Arjun Shankar + (cherry picked from commit 3a83f79024cc023a74c3892a1673542e8e972485) + +diff --git a/socket/Makefile b/socket/Makefile +index 74ca5b8452cd15d3..fc1bd0a2608f04bc 100644 +--- a/socket/Makefile ++++ b/socket/Makefile +@@ -70,6 +70,7 @@ tests := \ + tst-accept4 \ + tst-cmsg_cloexec \ + tst-cmsghdr \ ++ tst-connect \ + tst-sockopt \ + # tests + +diff --git a/socket/tst-connect.c b/socket/tst-connect.c +new file mode 100644 +index 0000000000000000..ec2fdd92c0a6f1be +--- /dev/null ++++ b/socket/tst-connect.c +@@ -0,0 +1,113 @@ ++/* Test the connect function. ++ Copyright (C) 2024 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 ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static struct sockaddr_in server_address; ++ ++int ++open_socket_inet_tcp (void) ++{ ++ int fd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); ++ if (fd < 0) ++ { ++ if (errno == EAFNOSUPPORT) ++ FAIL_UNSUPPORTED ("The host does not support IPv4"); ++ else ++ FAIL_EXIT1 ("socket (AF_INET, SOCK_STREAM, IPPROTO_TCP): %m\n"); ++ } ++ return fd; ++} ++ ++static pid_t ++start_server (void) ++{ ++ server_address.sin_family = AF_INET; ++ server_address.sin_port = 0; ++ server_address.sin_addr.s_addr = htonl (INADDR_LOOPBACK); ++ ++ int server_sock = open_socket_inet_tcp (); ++ ++ xbind (server_sock, (struct sockaddr *) &server_address, ++ sizeof (server_address)); ++ ++ socklen_t sa_len = sizeof (server_address); ++ xgetsockname (server_sock, (struct sockaddr *) &server_address, &sa_len); ++ xlisten (server_sock, 5); ++ ++ pid_t my_pid = xfork (); ++ if (my_pid > 0) ++ { ++ xclose (server_sock); ++ return my_pid; ++ } ++ ++ struct sockaddr_in client_address; ++ socklen_t ca_len = sizeof (server_address); ++ int client_sock = xaccept (server_sock, (struct sockaddr *) &client_address, ++ &ca_len); ++ printf ("socket accepted %d\n", client_sock); ++ ++ _exit (0); ++} ++ ++static int ++do_test (void) ++{ ++ pid_t serv_pid; ++ struct sockaddr_in peer; ++ socklen_t peer_len; ++ ++ serv_pid = start_server (); ++ int client_sock = open_socket_inet_tcp (); ++ xconnect (client_sock, (const struct sockaddr *) &server_address, ++ sizeof (server_address)); ++ ++ /* A second connect with same arguments should fail with EISCONN. */ ++ int result = connect (client_sock, ++ (const struct sockaddr *) &server_address, ++ sizeof (server_address)); ++ if (result == 0 || errno != EISCONN) ++ FAIL_EXIT1 ("Second connect (%d), should fail with EISCONN: %m", ++ client_sock); ++ ++ peer_len = sizeof (peer); ++ xgetpeername (client_sock, (struct sockaddr *) &peer, &peer_len); ++ TEST_COMPARE (peer_len, sizeof (peer)); ++ TEST_COMPARE (peer.sin_port, server_address.sin_port); ++ TEST_COMPARE_BLOB (&peer.sin_addr, sizeof (peer.sin_addr), ++ &server_address.sin_addr, ++ sizeof (server_address.sin_addr)); ++ ++ int status; ++ xwaitpid (serv_pid, &status, 0); ++ TEST_COMPARE (status, 0); ++ ++ return 0; ++} ++ ++#include diff --git a/glibc-upstream-2.39-58.patch b/glibc-upstream-2.39-58.patch new file mode 100644 index 0000000..cbe201a --- /dev/null +++ b/glibc-upstream-2.39-58.patch @@ -0,0 +1,23 @@ +commit c7c3f5bf80ae86b34501f473f1a9fc545c911b7f +Author: caiyinyu +Date: Sat May 11 10:25:54 2024 +0800 + + LoongArch: Fix undefined `__memset_aligned` reference in ld.so linking. + + This patch from 095067efdf68c8061d6f99a21a0300841bede999 (LoongArch: Add + glibc.cpu.hwcap support.) + +diff --git a/sysdeps/loongarch/lp64/multiarch/dl-symbol-redir-ifunc.h b/sysdeps/loongarch/lp64/multiarch/dl-symbol-redir-ifunc.h +index cb640d77b7695b93..a73390b12f67a3fc 100644 +--- a/sysdeps/loongarch/lp64/multiarch/dl-symbol-redir-ifunc.h ++++ b/sysdeps/loongarch/lp64/multiarch/dl-symbol-redir-ifunc.h +@@ -19,6 +19,9 @@ + #ifndef _DL_IFUNC_GENERIC_H + #define _DL_IFUNC_GENERIC_H + ++#ifndef SHARED + asm ("memset = __memset_aligned"); ++asm ("memcmp = __memcmp_aligned"); ++#endif + + #endif diff --git a/glibc-upstream-2.39-59.patch b/glibc-upstream-2.39-59.patch new file mode 100644 index 0000000..0f4fb1c --- /dev/null +++ b/glibc-upstream-2.39-59.patch @@ -0,0 +1,40 @@ +commit 9f2b100d6705b9bbb25206b53e80d7759644e06e +Author: H.J. Lu +Date: Sat May 25 05:13:41 2024 -0700 + + parse_fdinfo: Don't advance pointer twice [BZ #31798] + + pidfd_getpid.c has + + /* Ignore invalid large values. */ + if (INT_MULTIPLY_WRAPV (10, n, &n) + || INT_ADD_WRAPV (n, *l++ - '0', &n)) + return -1; + + For GCC older than GCC 7, INT_ADD_WRAPV(a, b, r) is defined as + + _GL_INT_OP_WRAPV (a, b, r, +, _GL_INT_ADD_RANGE_OVERFLOW) + + and *l++ - '0' is evaluated twice. Fix BZ #31798 by moving "l++" out of + the if statement. Tested with GCC 6.4 and GCC 14.1. + + Signed-off-by: H.J. Lu + Reviewed-by: Adhemerval Zanella + (cherry picked from commit f981bf6b9db87e0732b46bfe92fdad4d363225e8) + +diff --git a/sysdeps/unix/sysv/linux/pidfd_getpid.c b/sysdeps/unix/sysv/linux/pidfd_getpid.c +index 8567b413dd2c210b..30025e5863f7b956 100644 +--- a/sysdeps/unix/sysv/linux/pidfd_getpid.c ++++ b/sysdeps/unix/sysv/linux/pidfd_getpid.c +@@ -74,8 +74,10 @@ parse_fdinfo (const char *l, void *arg) + + /* Ignore invalid large values. */ + if (INT_MULTIPLY_WRAPV (10, n, &n) +- || INT_ADD_WRAPV (n, *l++ - '0', &n)) ++ || INT_ADD_WRAPV (n, *l - '0', &n)) + return -1; ++ ++ l++; + } + + /* -1 indicates that the process is terminated. */ diff --git a/glibc-upstream-2.39-60.patch b/glibc-upstream-2.39-60.patch new file mode 100644 index 0000000..8765056 --- /dev/null +++ b/glibc-upstream-2.39-60.patch @@ -0,0 +1,195 @@ +commit 26e7005728f0eea2972474e6be2905c467661237 +Author: Florian Weimer +Date: Sat May 18 09:33:19 2024 +0200 + + socket: Use may_alias on sockaddr structs (bug 19622) + + This supports common coding patterns. The GCC C front end before + version 7 rejects the may_alias attribute on a struct definition + if it was not present in a previous forward declaration, so this + attribute can only be conditionally applied. + + This implements the spirit of the change in Austin Group issue 1641. + + Suggested-by: Marek Polacek + Suggested-by: Jakub Jelinek + Reviewed-by: Sam James + Reviewed-by: Carlos O'Donell + (cherry picked from commit 8d7b6b4cb27d4dec1dd5f7960298c1699275f962) + +diff --git a/bits/socket.h b/bits/socket.h +index 13de124bac67c217..772074d52ab957df 100644 +--- a/bits/socket.h ++++ b/bits/socket.h +@@ -149,7 +149,7 @@ enum __socket_type + #include + + /* Structure describing a generic socket address. */ +-struct sockaddr ++struct __attribute_struct_may_alias__ sockaddr + { + __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ + char sa_data[14]; /* Address data. */ +@@ -166,7 +166,7 @@ struct sockaddr + #define _SS_PADSIZE \ + (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) + +-struct sockaddr_storage ++struct __attribute_struct_may_alias__ sockaddr_storage + { + __SOCKADDR_COMMON (ss_); /* Address family, etc. */ + char __ss_padding[_SS_PADSIZE]; +diff --git a/inet/netinet/in.h b/inet/netinet/in.h +index fa57b6107908590c..f684be5beb26fc62 100644 +--- a/inet/netinet/in.h ++++ b/inet/netinet/in.h +@@ -244,7 +244,7 @@ extern const struct in6_addr in6addr_loopback; /* ::1 */ + + + /* Structure describing an Internet socket address. */ +-struct sockaddr_in ++struct __attribute_struct_may_alias__ sockaddr_in + { + __SOCKADDR_COMMON (sin_); + in_port_t sin_port; /* Port number. */ +@@ -257,9 +257,11 @@ struct sockaddr_in + - sizeof (struct in_addr)]; + }; + +-#if !__USE_KERNEL_IPV6_DEFS ++#if __USE_KERNEL_IPV6_DEFS ++struct __attribute_struct_may_alias__ sockaddr_in6; ++#else + /* Ditto, for IPv6. */ +-struct sockaddr_in6 ++struct __attribute_struct_may_alias__ sockaddr_in6 + { + __SOCKADDR_COMMON (sin6_); + in_port_t sin6_port; /* Transport layer port # */ +diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h +index 520231dbea3a4e24..399ee7d24cae9446 100644 +--- a/misc/sys/cdefs.h ++++ b/misc/sys/cdefs.h +@@ -720,4 +720,13 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf + # define __attribute_returns_twice__ /* Ignore. */ + #endif + ++/* Mark struct types as aliasable. Restricted to compilers that ++ support forward declarations of structs in the presence of the ++ attribute. */ ++#if __GNUC_PREREQ (7, 1) || defined __clang__ ++# define __attribute_struct_may_alias__ __attribute__ ((__may_alias__)) ++#else ++# define __attribute_struct_may_alias__ ++#endif ++ + #endif /* sys/cdefs.h */ +diff --git a/socket/sys/un.h b/socket/sys/un.h +index bf03b7d6ce959065..ff9cbd6efa7693d5 100644 +--- a/socket/sys/un.h ++++ b/socket/sys/un.h +@@ -26,7 +26,7 @@ + __BEGIN_DECLS + + /* Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. */ +-struct sockaddr_un ++struct __attribute_struct_may_alias__ sockaddr_un + { + __SOCKADDR_COMMON (sun_); + char sun_path[108]; /* Path name. */ +diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h +index 3e72f9fa93add888..b5eeac373111e694 100644 +--- a/sysdeps/mach/hurd/bits/socket.h ++++ b/sysdeps/mach/hurd/bits/socket.h +@@ -153,7 +153,7 @@ enum __socket_type + #include + + /* Structure describing a generic socket address. */ +-struct sockaddr ++struct __attribute_struct_may_alias__ sockaddr + { + __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ + char sa_data[14]; /* Address data. */ +@@ -170,7 +170,7 @@ struct sockaddr + #define _SS_PADSIZE \ + (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) + +-struct sockaddr_storage ++struct __attribute_struct_may_alias__ sockaddr_storage + { + __SOCKADDR_COMMON (ss_); /* Address family, etc. */ + char __ss_padding[_SS_PADSIZE]; +diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h +index 0d86feb4cadc13e3..6dab283a2ebeaed1 100644 +--- a/sysdeps/unix/sysv/linux/bits/socket.h ++++ b/sysdeps/unix/sysv/linux/bits/socket.h +@@ -180,7 +180,7 @@ typedef __socklen_t socklen_t; + #include + + /* Structure describing a generic socket address. */ +-struct sockaddr ++struct __attribute_struct_may_alias__ sockaddr + { + __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ + char sa_data[14]; /* Address data. */ +@@ -193,7 +193,7 @@ struct sockaddr + #define _SS_PADSIZE \ + (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) + +-struct sockaddr_storage ++struct __attribute_struct_may_alias__ sockaddr_storage + { + __SOCKADDR_COMMON (ss_); /* Address family, etc. */ + char __ss_padding[_SS_PADSIZE]; +diff --git a/sysdeps/unix/sysv/linux/net/if_packet.h b/sysdeps/unix/sysv/linux/net/if_packet.h +index 9ffb69b508cc8ca7..c17e1c23c5cf9169 100644 +--- a/sysdeps/unix/sysv/linux/net/if_packet.h ++++ b/sysdeps/unix/sysv/linux/net/if_packet.h +@@ -26,7 +26,7 @@ + From Linux 2.1 the AF_PACKET interface is preferred and you should + consider using it in place of this one. */ + +-struct sockaddr_pkt ++struct __attribute_struct_may_alias__ sockaddr_pkt + { + __SOCKADDR_COMMON (spkt_); + unsigned char spkt_device[14]; +diff --git a/sysdeps/unix/sysv/linux/netash/ash.h b/sysdeps/unix/sysv/linux/netash/ash.h +index 7d885d17cc9ec313..7a6ff50b17b370c4 100644 +--- a/sysdeps/unix/sysv/linux/netash/ash.h ++++ b/sysdeps/unix/sysv/linux/netash/ash.h +@@ -22,7 +22,7 @@ + #include + #include + +-struct sockaddr_ash ++struct __attribute_struct_may_alias__ sockaddr_ash + { + __SOCKADDR_COMMON (sash_); /* Common data: address family etc. */ + int sash_ifindex; /* Interface to use. */ +diff --git a/sysdeps/unix/sysv/linux/neteconet/ec.h b/sysdeps/unix/sysv/linux/neteconet/ec.h +index b07a10796196e28e..f3132f06ff9f8dee 100644 +--- a/sysdeps/unix/sysv/linux/neteconet/ec.h ++++ b/sysdeps/unix/sysv/linux/neteconet/ec.h +@@ -28,7 +28,7 @@ struct ec_addr + unsigned char net; /* Network number. */ + }; + +-struct sockaddr_ec ++struct __attribute_struct_may_alias__ sockaddr_ec + { + __SOCKADDR_COMMON (sec_); + unsigned char port; /* Port number. */ +diff --git a/sysdeps/unix/sysv/linux/netiucv/iucv.h b/sysdeps/unix/sysv/linux/netiucv/iucv.h +index f5fad817513f3c46..27151e8bbe1e7fa2 100644 +--- a/sysdeps/unix/sysv/linux/netiucv/iucv.h ++++ b/sysdeps/unix/sysv/linux/netiucv/iucv.h +@@ -23,7 +23,7 @@ + + __BEGIN_DECLS + +-struct sockaddr_iucv ++struct __attribute_struct_may_alias__ sockaddr_iucv + { + __SOCKADDR_COMMON (siucv_); + unsigned short siucv_port; /* Reserved */ diff --git a/glibc-upstream-2.39-61.patch b/glibc-upstream-2.39-61.patch new file mode 100644 index 0000000..8c4aa98 --- /dev/null +++ b/glibc-upstream-2.39-61.patch @@ -0,0 +1,1824 @@ +commit dd535f4f19ef2b5c367a362af445ecadcf45401e +Author: Adhemerval Zanella +Date: Thu Jan 18 10:18:01 2024 -0300 + + Always define __USE_TIME_BITS64 when 64 bit time_t is used + + It was raised on libc-help [1] that some Linux kernel interfaces expect + the libc to define __USE_TIME_BITS64 to indicate the time_t size for the + kABI. Different than defined by the initial y2038 design document [2], + the __USE_TIME_BITS64 is only defined for ABIs that support more than + one time_t size (by defining the _TIME_BITS for each module). + + The 64 bit time_t redirects are now enabled using a different internal + define (__USE_TIME64_REDIRECTS). There is no expected change in semantic + or code generation. + + Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu, and + arm-linux-gnueabi + + [1] https://sourceware.org/pipermail/libc-help/2024-January/006557.html + [2] https://sourceware.org/glibc/wiki/Y2038ProofnessDesign + + Reviewed-by: DJ Delorie + (cherry picked from commit a4ed0471d71739928a0d0fa3258b3ff3b158e9b9) + +diff --git a/io/bits/poll2.h b/io/bits/poll2.h +index 6152a8c5e4536d68..efc8b85403e91ba2 100644 +--- a/io/bits/poll2.h ++++ b/io/bits/poll2.h +@@ -43,7 +43,7 @@ poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) + + + #ifdef __USE_GNU +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + extern int __REDIRECT (__ppoll64_alias, (struct pollfd *__fds, nfds_t __nfds, + const struct timespec *__timeout, + const __sigset_t *__ss), __ppoll64); +diff --git a/io/fcntl.h b/io/fcntl.h +index 9cee0b5900cb4f7c..666b7e5eb616b950 100644 +--- a/io/fcntl.h ++++ b/io/fcntl.h +@@ -172,7 +172,7 @@ typedef __pid_t pid_t; + + This function is a cancellation point and therefore not marked with + __THROW. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + # ifndef __USE_FILE_OFFSET64 + extern int fcntl (int __fd, int __cmd, ...); + # else +@@ -185,7 +185,7 @@ extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64); + # ifdef __USE_LARGEFILE64 + extern int fcntl64 (int __fd, int __cmd, ...); + # endif +-#else /* __USE_TIME_BITS64 */ ++#else /* __USE_TIME64_REDIRECTS */ + # ifdef __REDIRECT + extern int __REDIRECT_NTH (fcntl, (int __fd, int __request, ...), + __fcntl_time64); +diff --git a/io/fts.h b/io/fts.h +index 61f95bb4415f77e2..97a031ebbd040080 100644 +--- a/io/fts.h ++++ b/io/fts.h +@@ -187,7 +187,7 @@ FTSENT *fts_read (FTS *); + int fts_set (FTS *, FTSENT *, int) __THROW; + #else + # ifdef __REDIRECT +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + FTSENT *__REDIRECT (fts_children, (FTS *, int), fts64_children); + int __REDIRECT (fts_close, (FTS *), fts64_close); + FTS *__REDIRECT (fts_open, (char * const *, int, +@@ -206,7 +206,7 @@ int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), + __fts64_set_time64); + # endif + # else +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + # define fts_children fts64_children + # define fts_close fts64_close + # define fts_open fts64_open +@@ -217,7 +217,7 @@ int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), + # endif + #endif + #ifdef __USE_LARGEFILE64 +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + FTSENT64 *fts64_children (FTS64 *, int); + int fts64_close (FTS64 *); + FTS64 *fts64_open (char * const *, int, +diff --git a/io/ftw.h b/io/ftw.h +index e4d1b84d53550d26..39cf595b277a0049 100644 +--- a/io/ftw.h ++++ b/io/ftw.h +@@ -137,7 +137,7 @@ extern int ftw (const char *__dir, __ftw_func_t __func, int __descriptors) + __nonnull ((1, 2)); + #else + # ifdef __REDIRECT +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func, + int __descriptors), ftw64) __nonnull ((1, 2)); + # else +@@ -146,7 +146,7 @@ extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func, + __nonnull ((1, 2)); + # endif + # else +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + # define ftw ftw64 + # else + # define ftw __ftw64_time64 +@@ -154,7 +154,7 @@ extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func, + # endif + #endif + #ifdef __USE_LARGEFILE64 +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int ftw64 (const char *__dir, __ftw64_func_t __func, + int __descriptors) __nonnull ((1, 2)); + # else +@@ -180,7 +180,7 @@ extern int nftw (const char *__dir, __nftw_func_t __func, int __descriptors, + int __flag) __nonnull ((1, 2)); + # else + # ifdef __REDIRECT +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func, + int __descriptors, int __flag), nftw64) + __nonnull ((1, 2)); +@@ -190,7 +190,7 @@ extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func, + __nonnull ((1, 2)); + # endif + # else +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + # define nftw nftw64 + # else + # define nftw __nftw64_time64 +@@ -198,7 +198,7 @@ extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func, + # endif + # endif + # ifdef __USE_LARGEFILE64 +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int nftw64 (const char *__dir, __nftw64_func_t __func, + int __descriptors, int __flag) __nonnull ((1, 2)); + # else +diff --git a/io/sys/poll.h b/io/sys/poll.h +index 7858fad6b9b53725..c324ff5dad0d5a81 100644 +--- a/io/sys/poll.h ++++ b/io/sys/poll.h +@@ -66,7 +66,7 @@ extern int ppoll (struct pollfd *__fds, nfds_t __nfds, + const __sigset_t *__ss) + __fortified_attr_access (__write_only__, 1, 2); + +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # ifdef __REDIRECT + extern int __REDIRECT (ppoll, (struct pollfd *__fds, nfds_t __nfds, + const struct timespec *__timeout, +diff --git a/io/sys/stat.h b/io/sys/stat.h +index 1fa6d6e62ecb2e4b..3b4ba80132d0b703 100644 +--- a/io/sys/stat.h ++++ b/io/sys/stat.h +@@ -209,7 +209,7 @@ extern int stat (const char *__restrict __file, + that file descriptor FD is open on and put them in BUF. */ + extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2)); + #else +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # ifdef __REDIRECT_NTH + extern int __REDIRECT_NTH (stat, (const char *__restrict __file, + struct stat *__restrict __buf), +@@ -236,7 +236,7 @@ extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64) + # endif + #endif + #ifdef __USE_LARGEFILE64 +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int stat64 (const char *__restrict __file, + struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); + extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); +@@ -265,7 +265,7 @@ extern int fstatat (int __fd, const char *__restrict __file, + struct stat *__restrict __buf, int __flag) + __THROW __nonnull ((2, 3)); + # else +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # ifdef __REDIRECT_NTH + extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file, + struct stat *__restrict __buf, +@@ -287,7 +287,7 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file, + # endif + + # ifdef __USE_LARGEFILE64 +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int fstatat64 (int __fd, const char *__restrict __file, + struct stat64 *__restrict __buf, int __flag) + __THROW __nonnull ((2, 3)); +@@ -313,7 +313,7 @@ extern int __REDIRECT_NTH (fstatat64, (int __fd, + extern int lstat (const char *__restrict __file, + struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); + # else +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # ifdef __REDIRECT_NTH + extern int __REDIRECT_NTH (lstat, + (const char *__restrict __file, +@@ -334,7 +334,7 @@ extern int __REDIRECT_NTH (lstat, + # endif + # endif + # ifdef __USE_LARGEFILE64 +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int lstat64 (const char *__restrict __file, + struct stat64 *__restrict __buf) + __THROW __nonnull ((1, 2)); +@@ -427,7 +427,7 @@ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode) + #endif + + #ifdef __USE_ATFILE +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + /* Set file access and modification times relative to directory file + descriptor. */ + extern int utimensat (int __fd, const char *__path, +@@ -447,7 +447,7 @@ extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path, + #endif + + #ifdef __USE_XOPEN2K8 +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + /* Set file access and modification times of the file associated with FD. */ + extern int futimens (int __fd, const struct timespec __times[2]) __THROW; + +diff --git a/io/utime.h b/io/utime.h +index c5eacedd6a7c9925..1c7587d9c1475348 100644 +--- a/io/utime.h ++++ b/io/utime.h +@@ -35,7 +35,7 @@ __BEGIN_DECLS + /* Structure describing file times. */ + struct utimbuf + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + __time64_t actime; /* Access time. */ + __time64_t modtime; /* Modification time. */ + #else +@@ -46,7 +46,7 @@ struct utimbuf + + /* Set the access and modification times of FILE to those given in + *FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int utime (const char *__file, + const struct utimbuf *__file_times) + __THROW __nonnull ((1)); +diff --git a/manual/creature.texi b/manual/creature.texi +index fa5dd9d6ad9081f6..8d19e9dd73560607 100644 +--- a/manual/creature.texi ++++ b/manual/creature.texi +@@ -192,6 +192,12 @@ Linux kernel version on which the system is running. For Linux kernel + version above @b{5.1} syscalls supporting 64-bit time are used. Otherwise, + a fallback code is used with legacy (i.e. 32-bit) syscalls. + ++On such platforms, @theglibc{} will also define @code{__USE_TIME64_REDIRECTS} ++to indicate whether the declarations are expanded to different ones ++(either by redefiniding the symbol name or using symbol aliais). ++For instance, if the symbol @code{clock_gettime} expands to ++@code{__glock_gettime64}. ++ + @item + If @code{_TIME_BITS} is defined to be 32, @code{time_t} is defined to + be a 32-bit integer where that is supported. This is not recommended, +diff --git a/manual/maint.texi b/manual/maint.texi +index 89da704f45912ecb..04faa222e2bd2fc4 100644 +--- a/manual/maint.texi ++++ b/manual/maint.texi +@@ -491,6 +491,10 @@ derived as in the dual-time configuration case, and which expands to + the symbol's name. For instance, the macro @code{__clock_gettime64} + expands to @code{clock_gettime}. + ++When @code{__TIMESIZE} is set to 64, @theglibc{} will also define ++the@code{__USE_TIME_BITS64} macro. It is used by the Linux kernel ABI ++to set the expected @code{time_t} size used on some syscalls. ++ + These macros are purely internal to @theglibc{} and exist only so that + a single definition of the 64-bit time functions can be used on both + single-time and dual-time configurations, and so that glibc code can +diff --git a/misc/sys/ioctl.h b/misc/sys/ioctl.h +index 3f2338ddd32ee2c5..ea6583e12251266d 100644 +--- a/misc/sys/ioctl.h ++++ b/misc/sys/ioctl.h +@@ -38,7 +38,7 @@ __BEGIN_DECLS + /* Perform the I/O control operation specified by REQUEST on FD. + One argument may follow; its presence and type depend on REQUEST. + Return value depends on REQUEST. Usually -1 indicates error. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int ioctl (int __fd, unsigned long int __request, ...) __THROW; + #else + # ifdef __REDIRECT +diff --git a/misc/sys/select.h b/misc/sys/select.h +index e6a0c1b8b278ec22..2e45e94bc19b932e 100644 +--- a/misc/sys/select.h ++++ b/misc/sys/select.h +@@ -98,7 +98,7 @@ __BEGIN_DECLS + + This function is a cancellation point and therefore not marked with + __THROW. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, +@@ -123,7 +123,7 @@ extern int __REDIRECT (select, + + This function is a cancellation point and therefore not marked with + __THROW. */ +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, +diff --git a/posix/glob.h b/posix/glob.h +index 3406662840997c68..b6bba0fbcd0ecce8 100644 +--- a/posix/glob.h ++++ b/posix/glob.h +@@ -150,7 +150,7 @@ extern int glob (const char *__restrict __pattern, int __flags, + /* Free storage allocated in PGLOB by a previous `glob' call. */ + extern void globfree (glob_t *__pglob) __THROW; + #else +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + extern int __REDIRECT_NTHNL (glob, (const char *__restrict __pattern, + int __flags, + int (*__errfunc) (const char *, int), +@@ -170,7 +170,7 @@ extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64); + #endif + + #ifdef __USE_LARGEFILE64 +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + extern int __REDIRECT_NTHNL (glob64, (const char *__restrict __pattern, + int __flags, + int (*__errfunc) (const char *, int), +diff --git a/posix/sched.h b/posix/sched.h +index 3eac206f359090e9..49f504a488a08727 100644 +--- a/posix/sched.h ++++ b/posix/sched.h +@@ -74,7 +74,7 @@ extern int sched_get_priority_max (int __algorithm) __THROW; + extern int sched_get_priority_min (int __algorithm) __THROW; + + /* Get the SCHED_RR interval for the named process. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW; + #else + # ifdef __REDIRECT_NTH +diff --git a/posix/sys/wait.h b/posix/sys/wait.h +index edbb7b43920dffe7..1f44ee114566b9c9 100644 +--- a/posix/sys/wait.h ++++ b/posix/sys/wait.h +@@ -139,7 +139,7 @@ struct rusage; + nil, store information about the child's resource usage there. If the + WUNTRACED bit is set in OPTIONS, return status for stopped children; + otherwise don't. */ +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern __pid_t wait3 (int *__stat_loc, int __options, + struct rusage * __usage) __THROWNL; + # else +@@ -154,7 +154,7 @@ extern __pid_t __REDIRECT_NTHNL (wait3, (int *__stat_loc, int __options, + #endif + + #ifdef __USE_MISC +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + /* PID is like waitpid. Other args are like wait3. */ + extern __pid_t wait4 (__pid_t __pid, int *__stat_loc, int __options, + struct rusage *__usage) __THROWNL; +diff --git a/resolv/netdb.h b/resolv/netdb.h +index 14228b0d952664ea..b7f473fafe801b02 100644 +--- a/resolv/netdb.h ++++ b/resolv/netdb.h +@@ -701,7 +701,7 @@ extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr], + extern int gai_suspend (const struct gaicb *const __list[], int __ent, + const struct timespec *__timeout); + +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # if defined(__REDIRECT) + extern int __REDIRECT (gai_suspend, (const struct gaicb *const __list[], + int __ent, +diff --git a/resource/sys/resource.h b/resource/sys/resource.h +index a5634ba7153c069c..b0bf751e929af810 100644 +--- a/resource/sys/resource.h ++++ b/resource/sys/resource.h +@@ -88,7 +88,7 @@ extern int setrlimit64 (__rlimit_resource_t __resource, + and put it in *USAGE. Returns 0 for success, -1 for failure. */ + extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW; + +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # if defined(__REDIRECT_NTH) + extern int __REDIRECT_NTH (getrusage, (__rusage_who_t __who, + struct rusage *__usage), +diff --git a/rt/aio.h b/rt/aio.h +index 37d19abf16ee98e3..e71435733f988f85 100644 +--- a/rt/aio.h ++++ b/rt/aio.h +@@ -193,7 +193,7 @@ extern __ssize_t __REDIRECT_NTH (aio_return, (struct aiocb *__aiocbp), + extern int __REDIRECT_NTH (aio_cancel, + (int __fildes, struct aiocb *__aiocbp), + aio_cancel64); +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + extern int __REDIRECT_NTH (aio_suspend, + (const struct aiocb *const __list[], int __nent, + const struct timespec *__restrict __timeout), +@@ -215,7 +215,7 @@ extern int __REDIRECT_NTH (aio_fsync, + # define aio_error aio_error64 + # define aio_return aio_return64 + # define aio_cancel aio_cancel64 +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # define aio_suspend __aio_suspend_time64 + # else + # define aio_suspend aio_suspend64 +diff --git a/rt/mqueue.h b/rt/mqueue.h +index 787cc36df2eaf9e8..fd6fff4bb2326717 100644 +--- a/rt/mqueue.h ++++ b/rt/mqueue.h +@@ -71,7 +71,7 @@ extern int mq_send (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len, + unsigned int __msg_prio) __nonnull ((2)); + + #ifdef __USE_XOPEN2K +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + /* Receive the oldest from highest priority messages in message queue + MQDES, stop waiting if ABS_TIMEOUT expires. */ + extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr, +diff --git a/signal/signal.h b/signal/signal.h +index f37499ce607b998a..8e07b041b1c07fa9 100644 +--- a/signal/signal.h ++++ b/signal/signal.h +@@ -269,7 +269,7 @@ extern int sigwaitinfo (const sigset_t *__restrict __set, + + This function is a cancellation point and therefore not marked with + __THROW. */ +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int sigtimedwait (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout) +diff --git a/socket/sys/socket.h b/socket/sys/socket.h +index 366eaab845a6f326..463cf3291b714427 100644 +--- a/socket/sys/socket.h ++++ b/socket/sys/socket.h +@@ -170,7 +170,7 @@ extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, + + This function is a cancellation point and therefore not marked with + __THROW. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern ssize_t sendmsg (int __fd, const struct msghdr *__message, + int __flags); + #else +@@ -191,7 +191,7 @@ extern ssize_t __sendmsg64 (int __fd, const struct msghdr *__message, + + This function is a cancellation point and therefore not marked with + __THROW. */ +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int sendmmsg (int __fd, struct mmsghdr *__vmessages, + unsigned int __vlen, int __flags); + # else +@@ -204,7 +204,7 @@ extern int __sendmmsg64 (int __fd, struct mmsghdr *__vmessages, + unsigned int __vlen, int __flags); + # define sendmmsg __sendmmsg64 + # endif +-# endif /* __USE_TIME_BITS64 */ ++# endif /* __USE_TIME64_REDIRECTS */ + #endif /* __USE_GNU */ + + /* Receive a message as described by MESSAGE from socket FD. +@@ -212,7 +212,7 @@ extern int __sendmmsg64 (int __fd, struct mmsghdr *__vmessages, + + This function is a cancellation point and therefore not marked with + __THROW. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags); + #else + # ifdef __REDIRECT +@@ -231,7 +231,7 @@ extern ssize_t __recvmsg64 (int __fd, struct msghdr *__message, int __flags); + + This function is a cancellation point and therefore not marked with + __THROW. */ +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int recvmmsg (int __fd, struct mmsghdr *__vmessages, + unsigned int __vlen, int __flags, + struct timespec *__tmo); +@@ -251,7 +251,7 @@ extern int __REDIRECT (recvmmsg, (int __fd, struct mmsghdr *__vmessages, + /* Put the current value for socket FD's option OPTNAME at protocol level LEVEL + into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's + actual length. Returns 0 on success, -1 for errors. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int getsockopt (int __fd, int __level, int __optname, + void *__restrict __optval, + socklen_t *__restrict __optlen) __THROW; +@@ -273,7 +273,7 @@ extern int __getsockopt64 (int __fd, int __level, int __optname, + /* Set socket FD's option OPTNAME at protocol level LEVEL + to *OPTVAL (which is OPTLEN bytes long). + Returns 0 on success, -1 for errors. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int setsockopt (int __fd, int __level, int __optname, + const void *__optval, socklen_t __optlen) __THROW; + #else +diff --git a/support/timespec.h b/support/timespec.h +index 42f32bcc2c30eaac..5ccc7163a50198a5 100644 +--- a/support/timespec.h ++++ b/support/timespec.h +@@ -35,7 +35,7 @@ make_timespec (time_t s, long int ns) + + enum { TIMESPEC_HZ = 1000000000 }; + +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + struct timespec timespec_add (struct timespec, struct timespec) + __attribute__((const)); + struct timespec timespec_sub (struct timespec, struct timespec) +diff --git a/support/xtime.h b/support/xtime.h +index 5200eef2e017d380..9961899634e47a1b 100644 +--- a/support/xtime.h ++++ b/support/xtime.h +@@ -30,7 +30,7 @@ __BEGIN_DECLS + /* The following functions call the corresponding libc functions and + terminate the process on error. */ + +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + void xclock_gettime (clockid_t clock, struct timespec *ts); + void xclock_settime (clockid_t clock, const struct timespec *ts); + #else +diff --git a/support/xunistd.h b/support/xunistd.h +index b5e8c2f420021c42..13be9a46a3e6b07b 100644 +--- a/support/xunistd.h ++++ b/support/xunistd.h +@@ -36,7 +36,7 @@ pid_t xwaitpid (pid_t, int *status, int flags); + void xpipe (int[2]); + void xdup2 (int, int); + int xopen (const char *path, int flags, mode_t); +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + # ifdef __USE_FILE_OFFSET64 + void xstat (const char *path, struct stat *); + void xlstat (const char *path, struct stat *); +diff --git a/sysdeps/generic/features-time64.h b/sysdeps/generic/features-time64.h +deleted file mode 100644 +index 4d38b8ba766b34f5..0000000000000000 +--- a/sysdeps/generic/features-time64.h ++++ /dev/null +@@ -1,19 +0,0 @@ +-/* Features part to handle 64-bit time_t support. Generic version. +- Copyright (C) 2021-2024 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 +- . */ +- +-/* The generic configuration only support _TIME_BITS=32. */ +diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h +index 1607fdf29a5ed964..3d4f4a756c66750d 100644 +--- a/sysdeps/nptl/pthread.h ++++ b/sysdeps/nptl/pthread.h +@@ -223,7 +223,7 @@ extern int pthread_join (pthread_t __th, void **__thread_return); + the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */ + extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; + +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + /* Make calling thread wait for termination of the thread TH, but only + until TIMEOUT. The exit status of the thread is stored in + *THREAD_RETURN, if THREAD_RETURN is not NULL. +@@ -796,7 +796,7 @@ extern int pthread_mutex_lock (pthread_mutex_t *__mutex) + + #ifdef __USE_XOPEN2K + /* Wait until lock becomes available, or specified time passes. */ +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, + const struct timespec *__restrict + __abstime) __THROWNL __nonnull ((1, 2)); +@@ -813,7 +813,7 @@ extern int __REDIRECT_NTHNL (pthread_mutex_timedlock, + #endif + + #ifdef __USE_GNU +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex, + clockid_t __clockid, + const struct timespec *__restrict +@@ -982,7 +982,7 @@ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) + + # ifdef __USE_XOPEN2K + /* Try to acquire read lock for RWLOCK or return after specified time. */ +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, + const struct timespec *__restrict + __abstime) __THROWNL __nonnull ((1, 2)); +@@ -1000,7 +1000,7 @@ extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock, + # endif + + # ifdef __USE_GNU +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock, + clockid_t __clockid, + const struct timespec *__restrict +@@ -1029,7 +1029,7 @@ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) + + # ifdef __USE_XOPEN2K + /* Try to acquire write lock for RWLOCK or return after specified time. */ +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, + const struct timespec *__restrict + __abstime) __THROWNL __nonnull ((1, 2)); +@@ -1047,7 +1047,7 @@ extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock, + # endif + + # ifdef __USE_GNU +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock, + clockid_t __clockid, + const struct timespec *__restrict +@@ -1141,7 +1141,7 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, + + This function is a cancellation point and therefore not marked with + __THROW. */ +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex, + const struct timespec *__restrict __abstime) +@@ -1167,7 +1167,7 @@ extern int __REDIRECT (pthread_cond_timedwait, + + This function is a cancellation point and therefore not marked with + __THROW. */ +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex, + __clockid_t __clock_id, +diff --git a/sysdeps/pthread/semaphore.h b/sysdeps/pthread/semaphore.h +index c75ca4ce6d12e081..8a096336991730a8 100644 +--- a/sysdeps/pthread/semaphore.h ++++ b/sysdeps/pthread/semaphore.h +@@ -59,7 +59,7 @@ extern int sem_wait (sem_t *__sem) __nonnull ((1)); + + This function is a cancellation point and therefore not marked with + __THROW. */ +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int sem_timedwait (sem_t *__restrict __sem, + const struct timespec *__restrict __abstime) + __nonnull ((1, 2)); +@@ -77,7 +77,7 @@ extern int __REDIRECT (sem_timedwait, + #endif + + #ifdef __USE_GNU +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int sem_clockwait (sem_t *__restrict __sem, + clockid_t clock, + const struct timespec *__restrict __abstime) +diff --git a/sysdeps/pthread/threads.h b/sysdeps/pthread/threads.h +index c5410b5c3af84883..7cade24e1f4b9e7a 100644 +--- a/sysdeps/pthread/threads.h ++++ b/sysdeps/pthread/threads.h +@@ -90,7 +90,7 @@ extern thrd_t thrd_current (void); + __TIME_POINT. The current thread may resume if receives a signal. In + that case, if __REMAINING is not NULL, the remaining time is stored in + the object pointed by it. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int thrd_sleep (const struct timespec *__time_point, + struct timespec *__remaining); + #else +@@ -143,7 +143,7 @@ extern int mtx_lock (mtx_t *__mutex); + /* Block the current thread until the mutex pointed by __MUTEX is unlocked + or time pointed by __TIME_POINT is reached. In case the mutex is unlock, + the current thread will not be blocked. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int mtx_timedlock (mtx_t *__restrict __mutex, + const struct timespec *__restrict __time_point); + #else +@@ -194,7 +194,7 @@ extern int cnd_wait (cnd_t *__cond, mtx_t *__mutex); + /* Block current thread on the condition variable until condition variable + pointed by __COND is signaled or time pointed by __TIME_POINT is + reached. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int cnd_timedwait (cnd_t *__restrict __cond, + mtx_t *__restrict __mutex, + const struct timespec *__restrict __time_point); +diff --git a/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h b/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h +index 255feaa8cbf048b5..89534fea85100202 100644 +--- a/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h ++++ b/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h +@@ -28,7 +28,7 @@ + + struct stat + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + __dev_t st_dev; /* Device. */ +@@ -83,13 +83,13 @@ struct stat + # else + __ino64_t st_ino; /* File serial number. */ + # endif +-#endif /* __USE_TIME_BITS64 */ ++#endif /* __USE_TIME64_REDIRECTS */ + }; + + #ifdef __USE_LARGEFILE64 + struct stat64 + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + __dev_t st_dev; /* Device. */ +@@ -125,7 +125,7 @@ struct stat64 + unsigned long int st_ctimensec; /* Nsecs of last status change. */ + # endif + __ino64_t st_ino; /* File serial number. */ +-# endif /* __USE_TIME_BITS64 */ ++# endif /* __USE_TIME64_REDIRECTS */ + }; + #endif + +diff --git a/sysdeps/unix/sysv/linux/bits/socket-constants.h b/sysdeps/unix/sysv/linux/bits/socket-constants.h +index d997dbf5943aa90f..b2102d3abfe5a386 100644 +--- a/sysdeps/unix/sysv/linux/bits/socket-constants.h ++++ b/sysdeps/unix/sysv/linux/bits/socket-constants.h +@@ -64,7 +64,7 @@ + # define SO_TIMESTAMPNS_NEW 64 + # define SO_TIMESTAMPING_NEW 65 + +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # define SO_RCVTIMEO SO_RCVTIMEO_NEW + # define SO_SNDTIMEO SO_SNDTIMEO_NEW + # define SO_TIMESTAMP SO_TIMESTAMP_NEW +diff --git a/sysdeps/unix/sysv/linux/bits/time.h b/sysdeps/unix/sysv/linux/bits/time.h +index b70ba58a7dd58f72..cab405797130387d 100644 +--- a/sysdeps/unix/sysv/linux/bits/time.h ++++ b/sysdeps/unix/sysv/linux/bits/time.h +@@ -77,7 +77,7 @@ __BEGIN_DECLS + /* Tune a POSIX clock. */ + extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW __nonnull((2)); + +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # if defined(__REDIRECT_NTH) + extern int __REDIRECT_NTH (clock_adjtime, (__clockid_t __clock_id, + struct timex *__utx), +diff --git a/sysdeps/unix/sysv/linux/bits/timex.h b/sysdeps/unix/sysv/linux/bits/timex.h +index 398d8094f23f0b5d..03ccde6d0a0d086c 100644 +--- a/sysdeps/unix/sysv/linux/bits/timex.h ++++ b/sysdeps/unix/sysv/linux/bits/timex.h +@@ -25,7 +25,7 @@ + + struct timex + { +-# if defined __USE_TIME_BITS64 || (__TIMESIZE == 64 && __WORDSIZE == 32) ++# if defined __USE_TIME64_REDIRECTS || (__TIMESIZE == 64 && __WORDSIZE == 32) + unsigned int modes; /* mode selector */ + int :32; /* pad */ + long long offset; /* time offset (usec) */ +diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h b/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h +index fae50281c7fccdfc..86296ca92299c114 100644 +--- a/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h ++++ b/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h +@@ -26,7 +26,7 @@ + The type `struct msg' is opaque. */ + struct msqid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm msg_perm; /* structure describing operation permission */ +diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h +index 3c277ed1d8a3a956..2ac89b3ce456fd39 100644 +--- a/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h ++++ b/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h +@@ -23,7 +23,7 @@ + /* Data structure describing a set of semaphores. */ + struct semid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm sem_perm; /* operation permission struct */ +diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_shmid_ds.h b/sysdeps/unix/sysv/linux/bits/types/struct_shmid_ds.h +index 09de0b4e3a587c52..1012ed031702df04 100644 +--- a/sysdeps/unix/sysv/linux/bits/types/struct_shmid_ds.h ++++ b/sysdeps/unix/sysv/linux/bits/types/struct_shmid_ds.h +@@ -23,7 +23,7 @@ + /* Data structure describing a shared memory segment. */ + struct shmid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm shm_perm; /* operation permission struct */ +diff --git a/sysdeps/unix/sysv/linux/csky/bits/struct_stat.h b/sysdeps/unix/sysv/linux/csky/bits/struct_stat.h +index 4b4822d6d0c00081..47a9f0aaff8fce00 100644 +--- a/sysdeps/unix/sysv/linux/csky/bits/struct_stat.h ++++ b/sysdeps/unix/sysv/linux/csky/bits/struct_stat.h +@@ -43,7 +43,7 @@ + + struct stat + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + __dev_t st_dev; /* Device. */ +@@ -88,7 +88,7 @@ struct stat + #ifdef __USE_LARGEFILE64 + struct stat64 + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + __dev_t st_dev; /* Device. */ +diff --git a/sysdeps/unix/sysv/linux/features-time64.h b/sysdeps/unix/sysv/linux/features-time64.h +index dd3442c2eab58cbe..8d573cd23e48c0f7 100644 +--- a/sysdeps/unix/sysv/linux/features-time64.h ++++ b/sysdeps/unix/sysv/linux/features-time64.h +@@ -24,9 +24,8 @@ + # if _TIME_BITS == 64 + # if ! defined (_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64 + # error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64" +-# elif __TIMESIZE == 32 +-# define __USE_TIME_BITS64 1 + # endif ++# define __USE_TIME_BITS64 1 + # elif _TIME_BITS == 32 + # if __TIMESIZE > 32 + # error "_TIME_BITS=32 is not compatible with __TIMESIZE > 32" +@@ -34,4 +33,10 @@ + # else + # error Invalid _TIME_BITS value (can only be 32 or 64-bit) + # endif ++#elif __TIMESIZE == 64 ++# define __USE_TIME_BITS64 1 ++#endif ++ ++#if defined __USE_TIME_BITS64 && __TIMESIZE == 32 ++# define __USE_TIME64_REDIRECTS 1 + #endif +diff --git a/sysdeps/unix/sysv/linux/hppa/bits/socket-constants.h b/sysdeps/unix/sysv/linux/hppa/bits/socket-constants.h +index 58b523d03a234a76..80a76a17dc0d75c9 100644 +--- a/sysdeps/unix/sysv/linux/hppa/bits/socket-constants.h ++++ b/sysdeps/unix/sysv/linux/hppa/bits/socket-constants.h +@@ -54,7 +54,7 @@ + # define SO_TIMESTAMPNS_NEW 0x4039 + # define SO_TIMESTAMPING_NEW 0x403A + +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # define SO_RCVTIMEO SO_RCVTIMEO_NEW + # define SO_SNDTIMEO SO_SNDTIMEO_NEW + # define SO_TIMESTAMP SO_TIMESTAMP_NEW +diff --git a/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h b/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h +index 069efdbc5579bfde..09ea40054bcd12da 100644 +--- a/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h ++++ b/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h +@@ -28,7 +28,7 @@ + + struct stat + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + __dev_t st_dev; /* Device. */ +@@ -83,13 +83,13 @@ struct stat + # else + __ino64_t st_ino; /* File serial number. */ + # endif +-#endif /* __USE_TIME_BITS64 */ ++#endif /* __USE_TIME64_REDIRECTS */ + }; + + #ifdef __USE_LARGEFILE64 + struct stat64 + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + __dev_t st_dev; /* Device. */ +@@ -125,7 +125,7 @@ struct stat64 + unsigned long int st_ctimensec; /* Nsecs of last status change. */ + # endif + __ino64_t st_ino; /* File serial number. */ +-# endif /* __USE_TIME_BITS64 */ ++# endif /* __USE_TIME64_REDIRECTS */ + }; + #endif + +diff --git a/sysdeps/unix/sysv/linux/hppa/bits/types/struct_msqid_ds.h b/sysdeps/unix/sysv/linux/hppa/bits/types/struct_msqid_ds.h +index 2bc7cac06da36e27..4995e0a4a5017f1a 100644 +--- a/sysdeps/unix/sysv/linux/hppa/bits/types/struct_msqid_ds.h ++++ b/sysdeps/unix/sysv/linux/hppa/bits/types/struct_msqid_ds.h +@@ -26,7 +26,7 @@ + The type `struct msg' is opaque. */ + struct msqid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm msg_perm; /* structure describing operation permission */ +diff --git a/sysdeps/unix/sysv/linux/hppa/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/hppa/bits/types/struct_semid_ds.h +index dd8fbebcf48891f9..df88949dc20c9821 100644 +--- a/sysdeps/unix/sysv/linux/hppa/bits/types/struct_semid_ds.h ++++ b/sysdeps/unix/sysv/linux/hppa/bits/types/struct_semid_ds.h +@@ -23,7 +23,7 @@ + /* Data structure describing a set of semaphores. */ + struct semid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm sem_perm; /* operation permission struct */ +diff --git a/sysdeps/unix/sysv/linux/hppa/bits/types/struct_shmid_ds.h b/sysdeps/unix/sysv/linux/hppa/bits/types/struct_shmid_ds.h +index 58ac572b6e9b13f9..cb3b0303aa28d192 100644 +--- a/sysdeps/unix/sysv/linux/hppa/bits/types/struct_shmid_ds.h ++++ b/sysdeps/unix/sysv/linux/hppa/bits/types/struct_shmid_ds.h +@@ -23,7 +23,7 @@ + /* Data structure describing a shared memory segment. */ + struct shmid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm shm_perm; /* operation permission struct */ +diff --git a/sysdeps/unix/sysv/linux/m68k/bits/struct_stat.h b/sysdeps/unix/sysv/linux/m68k/bits/struct_stat.h +index 3b1db157bc0a76a7..b7f20189b1600585 100644 +--- a/sysdeps/unix/sysv/linux/m68k/bits/struct_stat.h ++++ b/sysdeps/unix/sysv/linux/m68k/bits/struct_stat.h +@@ -25,7 +25,7 @@ + + struct stat + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + __dev_t st_dev; /* Device. */ +@@ -80,13 +80,13 @@ struct stat + # else + __ino64_t st_ino; /* File serial number. */ + # endif +-#endif /* __USE_TIME_BITS64 */ ++#endif /* __USE_TIME64_REDIRECTS */ + }; + + #ifdef __USE_LARGEFILE64 + struct stat64 + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + __dev_t st_dev; /* Device. */ +@@ -122,7 +122,7 @@ struct stat64 + unsigned long int st_ctimensec; /* Nsecs of last status change. */ + # endif + __ino64_t st_ino; /* File serial number. */ +-# endif /* __USE_TIME_BITS64 */ ++# endif /* __USE_TIME64_REDIRECTS */ + }; + #endif + +diff --git a/sysdeps/unix/sysv/linux/microblaze/bits/struct_stat.h b/sysdeps/unix/sysv/linux/microblaze/bits/struct_stat.h +index 0f4693fb1fa6750e..ff1e269f1461a50e 100644 +--- a/sysdeps/unix/sysv/linux/microblaze/bits/struct_stat.h ++++ b/sysdeps/unix/sysv/linux/microblaze/bits/struct_stat.h +@@ -26,7 +26,7 @@ + #ifndef __USE_FILE_OFFSET64 + struct stat + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + __dev_t st_dev; /* Device. */ +@@ -64,7 +64,7 @@ struct stat + # endif + unsigned int __glibc_reserved4; + unsigned int __glibc_reserved5; +-#endif /* __USE_TIME_BITS64 */ ++#endif /* __USE_TIME64_REDIRECTS */ + }; + #else /* __USE_FILE_OFFSET64 */ + /* MS: If __USE_FILE_OFFSET64 is setup then struct stat should match stat64 +@@ -74,7 +74,7 @@ struct stat + * create one ifdef to separate stats structures. */ + struct stat + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + unsigned long long st_dev; /* Device. */ +@@ -112,14 +112,14 @@ struct stat + # endif + unsigned int __glibc_reserved4; + unsigned int __glibc_reserved5; +-# endif /* __USE_TIME_BITS64 */ ++# endif /* __USE_TIME64_REDIRECTS */ + }; + #endif /* __USE_FILE_OFFSET64 */ + + #ifdef __USE_LARGEFILE64 + struct stat64 + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + unsigned long long st_dev; /* Device. */ +@@ -157,7 +157,7 @@ struct stat64 + # endif + unsigned int __glibc_reserved4; + unsigned int __glibc_reserved5; +-# endif /* __USE_TIME_BITS64 */ ++# endif /* __USE_TIME64_REDIRECTS */ + }; + #endif + +diff --git a/sysdeps/unix/sysv/linux/mips/bits/socket-constants.h b/sysdeps/unix/sysv/linux/mips/bits/socket-constants.h +index c6908a2793db1e6f..77ffc8b890311c23 100644 +--- a/sysdeps/unix/sysv/linux/mips/bits/socket-constants.h ++++ b/sysdeps/unix/sysv/linux/mips/bits/socket-constants.h +@@ -54,7 +54,7 @@ + # define SO_TIMESTAMPNS_NEW 64 + # define SO_TIMESTAMPING_NEW 65 + +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # define SO_RCVTIMEO SO_RCVTIMEO_NEW + # define SO_SNDTIMEO SO_SNDTIMEO_NEW + # define SO_TIMESTAMP SO_TIMESTAMP_NEW +diff --git a/sysdeps/unix/sysv/linux/mips/bits/struct_stat.h b/sysdeps/unix/sysv/linux/mips/bits/struct_stat.h +index 277ebad9b6e66e42..50a4b367f6d8d8da 100644 +--- a/sysdeps/unix/sysv/linux/mips/bits/struct_stat.h ++++ b/sysdeps/unix/sysv/linux/mips/bits/struct_stat.h +@@ -29,7 +29,7 @@ + /* Structure describing file characteristics. */ + struct stat + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + unsigned long int st_dev; +@@ -82,13 +82,13 @@ struct stat + __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ + # endif + long int st_pad5[14]; +-# endif /* __USE_TIME_BITS64 */ ++# endif /* __USE_TIME64_REDIRECTS */ + }; + + # ifdef __USE_LARGEFILE64 + struct stat64 + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + unsigned long int st_dev; +@@ -123,7 +123,7 @@ struct stat64 + long int st_pad3; + __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ + long int st_pad4[14]; +-# endif /* __USE_TIME_BITS64 */ ++# endif /* __USE_TIME64_REDIRECTS */ + }; + # endif /* __USE_LARGEFILE64 */ + +@@ -131,7 +131,7 @@ struct stat64 + + struct stat + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + __dev_t st_dev; +@@ -189,7 +189,7 @@ struct stat + #ifdef __USE_LARGEFILE64 + struct stat64 + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + __dev_t st_dev; +@@ -224,7 +224,7 @@ struct stat64 + unsigned int st_pad3; + __blkcnt64_t st_blocks; + int st_pad4[14]; +-# endif /* __USE_TIME_BITS64 */ ++# endif /* __USE_TIME64_REDIRECTS */ + }; + #endif + +diff --git a/sysdeps/unix/sysv/linux/mips/bits/types/struct_msqid_ds.h b/sysdeps/unix/sysv/linux/mips/bits/types/struct_msqid_ds.h +index 4e8bd51b0aa59929..09c53648b7451ac4 100644 +--- a/sysdeps/unix/sysv/linux/mips/bits/types/struct_msqid_ds.h ++++ b/sysdeps/unix/sysv/linux/mips/bits/types/struct_msqid_ds.h +@@ -26,7 +26,7 @@ + The type `struct msg' is opaque. */ + struct msqid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm msg_perm; /* structure describing operation permission */ +diff --git a/sysdeps/unix/sysv/linux/mips/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/mips/bits/types/struct_semid_ds.h +index d1a30e31645ee2a4..0746684a7d4c0dc4 100644 +--- a/sysdeps/unix/sysv/linux/mips/bits/types/struct_semid_ds.h ++++ b/sysdeps/unix/sysv/linux/mips/bits/types/struct_semid_ds.h +@@ -23,7 +23,7 @@ + /* Data structure describing a set of semaphores. */ + struct semid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm sem_perm; /* operation permission struct */ +diff --git a/sysdeps/unix/sysv/linux/mips/bits/types/struct_shmid_ds.h b/sysdeps/unix/sysv/linux/mips/bits/types/struct_shmid_ds.h +index 8771164b5762c48f..c665af187489c675 100644 +--- a/sysdeps/unix/sysv/linux/mips/bits/types/struct_shmid_ds.h ++++ b/sysdeps/unix/sysv/linux/mips/bits/types/struct_shmid_ds.h +@@ -23,7 +23,7 @@ + /* Data structure describing a shared memory segment. */ + struct shmid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm shm_perm; /* operation permission struct */ +diff --git a/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h b/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h +index 672c7c6bb8f20314..dab466d881c94b61 100644 +--- a/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h ++++ b/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h +@@ -43,7 +43,7 @@ + + struct stat + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + __dev_t st_dev; /* Device. */ +@@ -88,7 +88,7 @@ struct stat + #ifdef __USE_LARGEFILE64 + struct stat64 + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + __dev_t st_dev; /* Device. */ +diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/socket-constants.h b/sysdeps/unix/sysv/linux/powerpc/bits/socket-constants.h +index 6be5055e65ab0b88..0d3e095c5d4bb94c 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/bits/socket-constants.h ++++ b/sysdeps/unix/sysv/linux/powerpc/bits/socket-constants.h +@@ -54,7 +54,7 @@ + # define SO_TIMESTAMPNS_NEW 64 + # define SO_TIMESTAMPING_NEW 65 + +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # define SO_RCVTIMEO SO_RCVTIMEO_NEW + # define SO_SNDTIMEO SO_SNDTIMEO_NEW + # define SO_TIMESTAMP SO_TIMESTAMP_NEW +diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/struct_stat.h b/sysdeps/unix/sysv/linux/powerpc/bits/struct_stat.h +index f6328399cd1f2985..2cf331544a805f06 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/bits/struct_stat.h ++++ b/sysdeps/unix/sysv/linux/powerpc/bits/struct_stat.h +@@ -28,7 +28,7 @@ + #if __WORDSIZE == 32 + struct stat + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + __dev_t st_dev; /* Device. */ +@@ -79,13 +79,13 @@ struct stat + # endif + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; +-# endif /* __USE_TIME_BITS64 */ ++# endif /* __USE_TIME64_REDIRECTS */ + }; + + # ifdef __USE_LARGEFILE64 + struct stat64 + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + __dev_t st_dev; /* Device. */ +@@ -122,7 +122,7 @@ struct stat64 + # endif + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; +-# endif /* __USE_TIME_BITS64 */ ++# endif /* __USE_TIME64_REDIRECTS */ + }; + # endif /* __USE_LARGEFILE64 */ + +diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_msqid_ds.h b/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_msqid_ds.h +index 830629cd37e4fccf..44ae08265d41502c 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_msqid_ds.h ++++ b/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_msqid_ds.h +@@ -26,7 +26,7 @@ + The type `struct msg' is opaque. */ + struct msqid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm msg_perm; /* structure describing operation permission */ +diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_semid_ds.h +index 43702575570a7d54..ccee57c28bf70729 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_semid_ds.h ++++ b/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_semid_ds.h +@@ -23,7 +23,7 @@ + /* Data structure describing a set of semaphores. */ + struct semid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm sem_perm; /* operation permission struct */ +diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_shmid_ds.h b/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_shmid_ds.h +index da1b4b3c56383000..58145d0a5d2e8203 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_shmid_ds.h ++++ b/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_shmid_ds.h +@@ -23,7 +23,7 @@ + /* Data structure describing a shared memory segment. */ + struct shmid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm shm_perm; /* operation permission struct */ +diff --git a/sysdeps/unix/sysv/linux/s390/bits/struct_stat.h b/sysdeps/unix/sysv/linux/s390/bits/struct_stat.h +index 9911c47bb268e207..e5c9024fb241fad9 100644 +--- a/sysdeps/unix/sysv/linux/s390/bits/struct_stat.h ++++ b/sysdeps/unix/sysv/linux/s390/bits/struct_stat.h +@@ -65,7 +65,7 @@ struct stat + #else + struct stat + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + __dev_t st_dev; /* Device. */ +@@ -166,7 +166,7 @@ struct stat64 + # else + struct stat64 + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + __dev_t st_dev; /* Device. */ +diff --git a/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h b/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h +index cbd4bc0f31ac0c97..d47cd7be1eeb9f17 100644 +--- a/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h ++++ b/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h +@@ -28,7 +28,7 @@ + + struct stat + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + __dev_t st_dev; /* Device. */ +@@ -83,13 +83,13 @@ struct stat + # else + __ino64_t st_ino; /* File serial number. */ + # endif +-#endif /* __USE_TIME_BITS64 */ ++#endif /* __USE_TIME64_REDIRECTS */ + }; + + #ifdef __USE_LARGEFILE64 + struct stat64 + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + __dev_t st_dev; /* Device. */ +@@ -125,7 +125,7 @@ struct stat64 + unsigned long int st_ctimensec; /* Nsecs of last status change. */ + # endif + __ino64_t st_ino; /* File serial number. */ +-# endif /* __USE_TIME_BITS64 */ ++# endif /* __USE_TIME64_REDIRECTS */ + }; + #endif + +diff --git a/sysdeps/unix/sysv/linux/sparc/bits/socket-constants.h b/sysdeps/unix/sysv/linux/sparc/bits/socket-constants.h +index 59958611c42ed1f6..e7a6b684ccc51a1e 100644 +--- a/sysdeps/unix/sysv/linux/sparc/bits/socket-constants.h ++++ b/sysdeps/unix/sysv/linux/sparc/bits/socket-constants.h +@@ -54,7 +54,7 @@ + # define SO_TIMESTAMPNS_NEW 0x0042 + # define SO_TIMESTAMPING_NEW 0x0043 + +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # define SO_RCVTIMEO SO_RCVTIMEO_NEW + # define SO_SNDTIMEO SO_SNDTIMEO_NEW + # define SO_TIMESTAMP SO_TIMESTAMP_NEW +diff --git a/sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h b/sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h +index 4e48634edc7f16f6..fcab5f480478768b 100644 +--- a/sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h ++++ b/sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h +@@ -28,7 +28,7 @@ + + struct stat + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + __dev_t st_dev; /* Device. */ +@@ -79,13 +79,13 @@ struct stat + # endif + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; +-#endif /* __USE_TIME_BITS64 */ ++#endif /* __USE_TIME64_REDIRECTS */ + }; + + #ifdef __USE_LARGEFILE64 + struct stat64 + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + __dev_t st_dev; /* Device. */ +@@ -126,7 +126,7 @@ struct stat64 + # endif + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; +-# endif /* __USE_TIME_BITS64 */ ++# endif /* __USE_TIME64_REDIRECTS */ + }; + #endif + +diff --git a/sysdeps/unix/sysv/linux/sparc/bits/types/struct_msqid_ds.h b/sysdeps/unix/sysv/linux/sparc/bits/types/struct_msqid_ds.h +index db783c28d414000f..ed8d47c9b61f182b 100644 +--- a/sysdeps/unix/sysv/linux/sparc/bits/types/struct_msqid_ds.h ++++ b/sysdeps/unix/sysv/linux/sparc/bits/types/struct_msqid_ds.h +@@ -26,7 +26,7 @@ + The type `struct msg' is opaque. */ + struct msqid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm msg_perm; /* structure describing operation permission */ +diff --git a/sysdeps/unix/sysv/linux/sparc/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/sparc/bits/types/struct_semid_ds.h +index 1c8a3693dbd6977f..b9e729b8b46a232e 100644 +--- a/sysdeps/unix/sysv/linux/sparc/bits/types/struct_semid_ds.h ++++ b/sysdeps/unix/sysv/linux/sparc/bits/types/struct_semid_ds.h +@@ -23,7 +23,7 @@ + /* Data structure describing a set of semaphores. */ + struct semid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm sem_perm; /* operation permission struct */ +diff --git a/sysdeps/unix/sysv/linux/sparc/bits/types/struct_shmid_ds.h b/sysdeps/unix/sysv/linux/sparc/bits/types/struct_shmid_ds.h +index 35a0cc36ab764e52..7885d2ab25d9c679 100644 +--- a/sysdeps/unix/sysv/linux/sparc/bits/types/struct_shmid_ds.h ++++ b/sysdeps/unix/sysv/linux/sparc/bits/types/struct_shmid_ds.h +@@ -23,7 +23,7 @@ + /* Data structure describing a shared memory segment. */ + struct shmid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm shm_perm; /* operation permission struct */ +diff --git a/sysdeps/unix/sysv/linux/sys/epoll.h b/sysdeps/unix/sysv/linux/sys/epoll.h +index 9b51e3bd1471c25c..fc8dce45c8947a03 100644 +--- a/sysdeps/unix/sysv/linux/sys/epoll.h ++++ b/sysdeps/unix/sysv/linux/sys/epoll.h +@@ -140,7 +140,7 @@ extern int epoll_pwait (int __epfd, struct epoll_event *__events, + + This function is a cancellation point and therefore not marked with + __THROW. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int epoll_pwait2 (int __epfd, struct epoll_event *__events, + int __maxevents, const struct timespec *__timeout, + const __sigset_t *__ss) +diff --git a/sysdeps/unix/sysv/linux/sys/prctl.h b/sysdeps/unix/sysv/linux/sys/prctl.h +index b13b84626149450e..79a9b31273b33bca 100644 +--- a/sysdeps/unix/sysv/linux/sys/prctl.h ++++ b/sysdeps/unix/sysv/linux/sys/prctl.h +@@ -38,7 +38,7 @@ + __BEGIN_DECLS + + /* Control process execution. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int prctl (int __option, ...) __THROW; + #else + # ifdef __REDIRECT +diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h b/sysdeps/unix/sysv/linux/sys/timerfd.h +index 19d0cbfae020d7a6..f66ece306ade51dd 100644 +--- a/sysdeps/unix/sysv/linux/sys/timerfd.h ++++ b/sysdeps/unix/sysv/linux/sys/timerfd.h +@@ -47,7 +47,7 @@ extern int timerfd_settime (int __ufd, int __flags, + const struct itimerspec *__utmr, + struct itimerspec *__otmr) __THROW; + +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # if defined(__REDIRECT_NTH) + extern int __REDIRECT_NTH (timerfd_settime, + (int __ufd, int __flags, +@@ -62,7 +62,7 @@ extern int __REDIRECT_NTH (timerfd_settime, + /* Return the next expiration time of UFD. */ + extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW; + +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # if defined(__REDIRECT_NTH) + extern int __REDIRECT_NTH (timerfd_gettime, (int __ufd, + struct itimerspec *__otmr), +diff --git a/sysdeps/unix/sysv/linux/sys/timex.h b/sysdeps/unix/sysv/linux/sys/timex.h +index 28ce022253e057ce..568748d7679211fd 100644 +--- a/sysdeps/unix/sysv/linux/sys/timex.h ++++ b/sysdeps/unix/sysv/linux/sys/timex.h +@@ -54,7 +54,7 @@ struct ntptimeval + + __BEGIN_DECLS + +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int adjtimex (struct timex *__ntx) __THROW __nonnull ((1)); + extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW __nonnull ((1)); + +diff --git a/sysdeps/unix/sysv/linux/x86/bits/struct_stat.h b/sysdeps/unix/sysv/linux/x86/bits/struct_stat.h +index 21aa315d8dc15681..810d6566f05683f3 100644 +--- a/sysdeps/unix/sysv/linux/x86/bits/struct_stat.h ++++ b/sysdeps/unix/sysv/linux/x86/bits/struct_stat.h +@@ -25,7 +25,7 @@ + + struct stat + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + __dev_t st_dev; /* Device. */ +@@ -95,14 +95,14 @@ struct stat + __ino64_t st_ino; /* File serial number. */ + # endif + # endif +-#endif /* __USE_TIME_BITS64 */ ++#endif /* __USE_TIME64_REDIRECTS */ + }; + + #ifdef __USE_LARGEFILE64 + /* Note stat64 has the same shape as stat for x86-64. */ + struct stat64 + { +-# ifdef __USE_TIME_BITS64 ++# ifdef __USE_TIME64_REDIRECTS + # include + # else + __dev_t st_dev; /* Device. */ +@@ -152,7 +152,7 @@ struct stat64 + # else + __ino64_t st_ino; /* File serial number. */ + # endif +-# endif /* __USE_TIME_BITS64 */ ++# endif /* __USE_TIME64_REDIRECTS */ + }; + #endif + +diff --git a/sysdeps/unix/sysv/linux/x86/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/x86/bits/types/struct_semid_ds.h +index 9f3d170b65269927..81867c0316080913 100644 +--- a/sysdeps/unix/sysv/linux/x86/bits/types/struct_semid_ds.h ++++ b/sysdeps/unix/sysv/linux/x86/bits/types/struct_semid_ds.h +@@ -23,7 +23,7 @@ + /* Data structure describing a set of semaphores. */ + struct semid_ds + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + # include + #else + struct ipc_perm sem_perm; /* operation permission struct */ +diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h +index d0388b0522fb4183..4178ad99550e8b12 100644 +--- a/sysvipc/sys/msg.h ++++ b/sysvipc/sys/msg.h +@@ -58,7 +58,7 @@ struct msgbuf + __BEGIN_DECLS + + /* Message queue control operation. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW; + #else + # ifdef __REDIRECT_NTH +diff --git a/sysvipc/sys/sem.h b/sysvipc/sys/sem.h +index 5d9ec39296af6db9..812f1303b3d93360 100644 +--- a/sysvipc/sys/sem.h ++++ b/sysvipc/sys/sem.h +@@ -48,7 +48,7 @@ struct sembuf + __BEGIN_DECLS + + /* Semaphore control operation. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int semctl (int __semid, int __semnum, int __cmd, ...) __THROW; + #else + # ifdef __REDIRECT_NTH +@@ -68,7 +68,7 @@ extern int semop (int __semid, struct sembuf *__sops, size_t __nsops) __THROW; + + #ifdef __USE_GNU + /* Operate on semaphore with timeout. */ +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int semtimedop (int __semid, struct sembuf *__sops, size_t __nsops, + const struct timespec *__timeout) __THROW; + # else +diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h +index 04191656d54d3c89..496e57ef4528af2e 100644 +--- a/sysvipc/sys/shm.h ++++ b/sysvipc/sys/shm.h +@@ -46,7 +46,7 @@ __BEGIN_DECLS + facility. The definition is found in XPG4.2. */ + + /* Shared memory control operation. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf) __THROW; + #else + # ifdef __REDIRECT_NTH +diff --git a/time/bits/types/struct_timespec.h b/time/bits/types/struct_timespec.h +index 489e81136d7f4ad5..1141015f276cb330 100644 +--- a/time/bits/types/struct_timespec.h ++++ b/time/bits/types/struct_timespec.h +@@ -10,14 +10,14 @@ + has nanoseconds instead of microseconds. */ + struct timespec + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + __time64_t tv_sec; /* Seconds. */ + #else + __time_t tv_sec; /* Seconds. */ + #endif + #if __WORDSIZE == 64 \ + || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \ +- || (__TIMESIZE == 32 && !defined __USE_TIME_BITS64) ++ || (__TIMESIZE == 32 && !defined __USE_TIME64_REDIRECTS) + __syscall_slong_t tv_nsec; /* Nanoseconds. */ + #else + # if __BYTE_ORDER == __BIG_ENDIAN +diff --git a/time/bits/types/struct_timeval.h b/time/bits/types/struct_timeval.h +index 3466137c35fb5d0e..0c8e88c82c400d68 100644 +--- a/time/bits/types/struct_timeval.h ++++ b/time/bits/types/struct_timeval.h +@@ -7,7 +7,7 @@ + microsecond but also has a range of years. */ + struct timeval + { +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + __time64_t tv_sec; /* Seconds. */ + __suseconds64_t tv_usec; /* Microseconds. */ + #else +diff --git a/time/bits/types/time_t.h b/time/bits/types/time_t.h +index 84d67f6ac346e249..00cde92c623375f3 100644 +--- a/time/bits/types/time_t.h ++++ b/time/bits/types/time_t.h +@@ -4,7 +4,7 @@ + #include + + /* Returned by `time'. */ +-#ifdef __USE_TIME_BITS64 ++#ifdef __USE_TIME64_REDIRECTS + typedef __time64_t time_t; + #else + typedef __time_t time_t; +diff --git a/time/sys/time.h b/time/sys/time.h +index c8708198a5fa2e58..8c3d0c30222d15d1 100644 +--- a/time/sys/time.h ++++ b/time/sys/time.h +@@ -63,7 +63,7 @@ struct timezone + use localtime etc. instead. + This function itself is semi-obsolete; + most callers should use time or clock_gettime instead. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern int gettimeofday (struct timeval *__restrict __tv, + void *__restrict __tz) __THROW __nonnull ((1)); + #else +@@ -77,7 +77,7 @@ extern int __REDIRECT_NTH (gettimeofday, (struct timeval *__restrict __tv, + #endif + + #ifdef __USE_MISC +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + /* Set the current time of day and timezone information. + This call is restricted to the super-user. + Setting the timezone in this way is obsolete, but we don't yet +@@ -143,7 +143,7 @@ typedef enum __itimer_which __itimer_which_t; + typedef int __itimer_which_t; + #endif + +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + /* Set *VALUE to the current setting of timer WHICH. + Return 0 on success, -1 on errors. */ + extern int getitimer (__itimer_which_t __which, +@@ -184,7 +184,7 @@ extern int __REDIRECT_NTH (utimes, (const char *__file, + #endif + + #ifdef __USE_MISC +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + /* Same as `utimes', but does not follow symbolic links. */ + extern int lutimes (const char *__file, const struct timeval __tvp[2]) + __THROW __nonnull ((1)); +@@ -207,7 +207,7 @@ extern int __REDIRECT_NTH (futimes, (int __fd, const struct timeval __tvp[2]), + #endif + + #ifdef __USE_GNU +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + /* Change the access time of FILE relative to FD to TVP[0] and the + modification time of FILE to TVP[1]. If TVP is a null pointer, use + the current time instead. Returns 0 on success, -1 on errors. */ +diff --git a/time/time.h b/time/time.h +index 1609aaeffaac5713..3785dc608f6c6ed6 100644 +--- a/time/time.h ++++ b/time/time.h +@@ -71,7 +71,7 @@ __BEGIN_DECLS + The result / CLOCKS_PER_SEC is program time in seconds. */ + extern clock_t clock (void) __THROW; + +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + /* Return the current time and put it in *TIMER if TIMER is not NULL. */ + extern time_t time (time_t *__timer) __THROW; + +@@ -127,7 +127,7 @@ extern char *strptime_l (const char *__restrict __s, + #endif + + +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + /* Return the `struct tm' representation of *TIMER + in Universal Coordinated Time (aka Greenwich Mean Time). */ + extern struct tm *gmtime (const time_t *__timer) __THROW; +@@ -149,7 +149,7 @@ extern struct tm *__REDIRECT_NTH (localtime, (const time_t *__timer), + + + #if defined __USE_POSIX || __GLIBC_USE (ISOC2X) +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + /* Return the `struct tm' representation of *TIMER in UTC, + using *TP to store the result. */ + extern struct tm *gmtime_r (const time_t *__restrict __timer, +@@ -180,7 +180,7 @@ extern struct tm*__REDIRECT_NTH (localtime_r, (const time_t *__restrict __t, + extern char *asctime (const struct tm *__tp) __THROW; + + /* Equivalent to `asctime (localtime (timer))'. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern char *ctime (const time_t *__timer) __THROW; + #else + # ifdef __REDIRECT_NTH +@@ -199,7 +199,7 @@ extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __THROW; + + /* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'. */ +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __THROW; + #else +@@ -242,7 +242,7 @@ extern long int timezone; + + + #if defined __USE_MISC || __GLIBC_USE (ISOC2X) +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + /* Like `mktime', but for TP represents Universal Time, not local time. */ + extern time_t timegm (struct tm *__tp) __THROW; + # else +@@ -259,7 +259,7 @@ extern time_t __REDIRECT_NTH (timegm, (struct tm *__tp), __timegm64); + /* Miscellaneous functions many Unices inherited from the public domain + localtime package. These are included only for compatibility. */ + +-#ifndef __USE_TIME_BITS64 ++#ifndef __USE_TIME64_REDIRECTS + /* Another name for `mktime'. */ + extern time_t timelocal (struct tm *__tp) __THROW; + #else +@@ -274,7 +274,7 @@ extern int dysize (int __year) __THROW __attribute__ ((__const__)); + + + #ifdef __USE_POSIX199309 +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + /* Pause execution for a number of nanoseconds. + + This function is a cancellation point and therefore not marked with +@@ -320,7 +320,7 @@ extern int __REDIRECT_NTH (clock_settime, (clockid_t __clock_id, const struct + + This function is a cancellation point and therefore not marked with + __THROW. */ +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); +@@ -349,7 +349,7 @@ extern int timer_create (clockid_t __clock_id, + extern int timer_delete (timer_t __timerid) __THROW; + + /* Set timer TIMERID to VALUE, returning old value in OVALUE. */ +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __THROW; +@@ -379,7 +379,7 @@ extern int timer_getoverrun (timer_t __timerid) __THROW; + + + #ifdef __USE_ISOC11 +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + /* Set TS to calendar time based in time base BASE. */ + extern int timespec_get (struct timespec *__ts, int __base) + __THROW __nonnull ((1)); +@@ -395,7 +395,7 @@ extern int __REDIRECT_NTH (timespec_get, (struct timespec *__ts, int __base), + + + #if __GLIBC_USE (ISOC2X) +-# ifndef __USE_TIME_BITS64 ++# ifndef __USE_TIME64_REDIRECTS + /* Set TS to resolution of time base BASE. */ + extern int timespec_getres (struct timespec *__ts, int __base) + __THROW; diff --git a/glibc-upstream-2.39-62.patch b/glibc-upstream-2.39-62.patch new file mode 100644 index 0000000..e928935 --- /dev/null +++ b/glibc-upstream-2.39-62.patch @@ -0,0 +1,38 @@ +commit aee37de299af95007a1f00f2cdf6c1452f39e682 +Author: Adhemerval Zanella +Date: Fri Apr 5 09:02:36 2024 -0300 + + Reinstate generic features-time64.h + + The a4ed0471d7 removed the generic version which is included by + features.h and used by Hurd. + + Checked by building i686-gnu and x86_64-gnu with build-many-glibc.py. + + (cherry picked from commit c27f8763cffbb7db9b3f1f5e09ef24d26cbb63f4) + +diff --git a/sysdeps/generic/features-time64.h b/sysdeps/generic/features-time64.h +new file mode 100644 +index 0000000000000000..4d38b8ba766b34f5 +--- /dev/null ++++ b/sysdeps/generic/features-time64.h +@@ -0,0 +1,19 @@ ++/* Features part to handle 64-bit time_t support. Generic version. ++ Copyright (C) 2021-2024 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 ++ . */ ++ ++/* The generic configuration only support _TIME_BITS=32. */ diff --git a/glibc-upstream-2.39-63.patch b/glibc-upstream-2.39-63.patch new file mode 100644 index 0000000..4db9709 --- /dev/null +++ b/glibc-upstream-2.39-63.patch @@ -0,0 +1,62 @@ +commit c9d8534406ab69b9bc1fd3fdfb9e88c9580d3f24 +Author: Sunil K Pandey +Date: Mon May 27 10:08:18 2024 -0700 + + i386: Disable Intel Xeon Phi tests for GCC 15 and above (BZ 31782) + + This patch disables Intel Xeon Phi tests for GCC 15 and above. + + GCC 15 removed Intel Xeon Phi ISA support. + commit e1a7e2c54d52d0ba374735e285b617af44841ace + Author: Haochen Jiang + Date: Mon May 20 10:43:44 2024 +0800 + + i386: Remove Xeon Phi ISA support + + Fixes BZ 31782. + + Reviewed-by: H.J. Lu + (cherry picked from commit 1b713c9a5349ef3cd1a8ccf9de017c7865713c67) + +diff --git a/sysdeps/x86/tst-cpu-features-supports.c b/sysdeps/x86/tst-cpu-features-supports.c +index 93008dac703e762f..0f43ef2b2da0d3db 100644 +--- a/sysdeps/x86/tst-cpu-features-supports.c ++++ b/sysdeps/x86/tst-cpu-features-supports.c +@@ -65,7 +65,7 @@ do_test (int argc, char **argv) + #endif + fails += CHECK_FEATURE_ACTIVE (avx, AVX); + fails += CHECK_FEATURE_ACTIVE (avx2, AVX2); +-#if __GNUC_PREREQ (7, 0) ++#if __GNUC_PREREQ (7, 0) && !__GNUC_PREREQ (15, 0) + fails += CHECK_FEATURE_ACTIVE (avx5124fmaps, AVX512_4FMAPS); + fails += CHECK_FEATURE_ACTIVE (avx5124vnniw, AVX512_4VNNIW); + #endif +@@ -92,14 +92,18 @@ do_test (int argc, char **argv) + #if __GNUC_PREREQ (6, 0) + fails += CHECK_FEATURE_ACTIVE (avx512bw, AVX512BW); + fails += CHECK_FEATURE_ACTIVE (avx512cd, AVX512CD); ++# if !__GNUC_PREREQ (15, 0) + fails += CHECK_FEATURE_ACTIVE (avx512er, AVX512ER); ++# endif + fails += CHECK_FEATURE_ACTIVE (avx512dq, AVX512DQ); + #endif + #if __GNUC_PREREQ (5, 0) + fails += CHECK_FEATURE_ACTIVE (avx512f, AVX512F); + #endif + #if __GNUC_PREREQ (6, 0) ++# if !__GNUC_PREREQ (15, 0) + fails += CHECK_FEATURE_ACTIVE (avx512pf, AVX512PF); ++# endif + fails += CHECK_FEATURE_ACTIVE (avx512vl, AVX512VL); + #endif + #if __GNUC_PREREQ (5, 0) +@@ -148,7 +152,9 @@ do_test (int argc, char **argv) + #endif + fails += CHECK_FEATURE_ACTIVE (popcnt, POPCNT); + #if __GNUC_PREREQ (11, 0) ++# if !__GNUC_PREREQ (15, 0) + fails += CHECK_FEATURE_ACTIVE (prefetchwt1, PREFETCHWT1); ++# endif + fails += CHECK_FEATURE_ACTIVE (ptwrite, PTWRITE); + fails += CHECK_FEATURE_ACTIVE (rdpid, RDPID); + fails += CHECK_FEATURE_ACTIVE (rdrnd, RDRAND); diff --git a/glibc-upstream-2.39-64.patch b/glibc-upstream-2.39-64.patch new file mode 100644 index 0000000..bbba766 --- /dev/null +++ b/glibc-upstream-2.39-64.patch @@ -0,0 +1,68 @@ +commit 70f560fc22212f733647c9121c26bbb2307f2e10 +Author: Stafford Horne +Date: Wed Apr 3 06:40:37 2024 +0100 + + misc: Add support for Linux uio.h RWF_NOAPPEND flag + + In Linux 6.9 a new flag is added to allow for Per-io operations to + disable append mode even if a file was opened with the flag O_APPEND. + This is done with the new RWF_NOAPPEND flag. + + This caused two test failures as these tests expected the flag 0x00000020 + to be unused. Adding the flag definition now fixes these tests on Linux + 6.9 (v6.9-rc1). + + FAIL: misc/tst-preadvwritev2 + FAIL: misc/tst-preadvwritev64v2 + + This patch adds the flag, adjusts the test and adds details to + documentation. + + Link: https://lore.kernel.org/all/20200831153207.GO3265@brightrain.aerifal.cx/ + Reviewed-by: Adhemerval Zanella + (cherry picked from commit 3db9d208dd5f30b12900989c6d2214782b8e2011) + +diff --git a/manual/llio.texi b/manual/llio.texi +index 0b61d491f50b763a..fae49d14332db675 100644 +--- a/manual/llio.texi ++++ b/manual/llio.texi +@@ -1339,6 +1339,10 @@ will fail and set @code{errno} to @code{EAGAIN} if the operation would block. + + @item RWF_APPEND + Per-IO synchronization as if the file was opened with @code{O_APPEND} flag. ++ ++@item RWF_NOAPPEND ++This flag allows an offset to be honored, even if the file was opened with ++@code{O_APPEND} flag. + @end vtable + + When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the +diff --git a/misc/tst-preadvwritev2-common.c b/misc/tst-preadvwritev2-common.c +index b5f19f002cd1653e..8e04ff7282e727b6 100644 +--- a/misc/tst-preadvwritev2-common.c ++++ b/misc/tst-preadvwritev2-common.c +@@ -34,8 +34,11 @@ + #ifndef RWF_APPEND + # define RWF_APPEND 0 + #endif ++#ifndef RWF_NOAPPEND ++# define RWF_NOAPPEND 0 ++#endif + #define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT \ +- | RWF_APPEND) ++ | RWF_APPEND | RWF_NOAPPEND) + + /* Generic uio_lim.h does not define IOV_MAX. */ + #ifndef IOV_MAX +diff --git a/sysdeps/unix/sysv/linux/bits/uio-ext.h b/sysdeps/unix/sysv/linux/bits/uio-ext.h +index 7854cccef3e0a618..ead7a091566aa295 100644 +--- a/sysdeps/unix/sysv/linux/bits/uio-ext.h ++++ b/sysdeps/unix/sysv/linux/bits/uio-ext.h +@@ -47,6 +47,7 @@ extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec, + #define RWF_SYNC 0x00000004 /* per-IO O_SYNC. */ + #define RWF_NOWAIT 0x00000008 /* per-IO nonblocking mode. */ + #define RWF_APPEND 0x00000010 /* per-IO O_APPEND. */ ++#define RWF_NOAPPEND 0x00000020 /* per-IO negation of O_APPEND */ + + __END_DECLS + diff --git a/glibc-upstream-2.39-65.patch b/glibc-upstream-2.39-65.patch new file mode 100644 index 0000000..60b9efb --- /dev/null +++ b/glibc-upstream-2.39-65.patch @@ -0,0 +1,44 @@ +commit 6ade91c21140d8c803c289932dbfc74537f65a1f +Author: Florian Weimer +Date: Mon Jun 3 10:49:40 2024 +0200 + + elf: Avoid some free (NULL) calls in _dl_update_slotinfo + + This has been confirmed to work around some interposed mallocs. Here + is a discussion of the impact test ust/libc-wrapper/test_libc-wrapper + in lttng-tools: + + New TLS usage in libgcc_s.so.1, compatibility impact + + + Reportedly, this patch also papers over a similar issue when tcmalloc + 2.9.1 is not compiled with -ftls-model=initial-exec. Of course the + goal really should be to compile mallocs with the initial-exec TLS + model, but this commit appears to be a useful interim workaround. + + Fixes commit d2123d68275acc0f061e73d5f86ca504e0d5a344 ("elf: Fix slow + tls access after dlopen [BZ #19924]"). + + Reviewed-by: Carlos O'Donell + (cherry picked from commit afe42e935b3ee97bac9a7064157587777259c60e) + +diff --git a/elf/dl-tls.c b/elf/dl-tls.c +index 7b3dd9ab60e89ae9..670dbc42fc2e3334 100644 +--- a/elf/dl-tls.c ++++ b/elf/dl-tls.c +@@ -819,7 +819,14 @@ _dl_update_slotinfo (unsigned long int req_modid, size_t new_gen) + dtv entry free it. Note: this is not AS-safe. */ + /* XXX Ideally we will at some point create a memory + pool. */ +- free (dtv[modid].pointer.to_free); ++ /* Avoid calling free on a null pointer. Some mallocs ++ incorrectly use dynamic TLS, and depending on how the ++ free function was compiled, it could call ++ __tls_get_addr before the null pointer check in the ++ free implementation. Checking here papers over at ++ least some dynamic TLS usage by interposed mallocs. */ ++ if (dtv[modid].pointer.to_free != NULL) ++ free (dtv[modid].pointer.to_free); + dtv[modid].pointer.val = TLS_DTV_UNALLOCATED; + dtv[modid].pointer.to_free = NULL; + diff --git a/glibc.spec b/glibc.spec index a20b9e5..13a57df 100644 --- a/glibc.spec +++ b/glibc.spec @@ -170,7 +170,7 @@ Version: %{glibcversion} # - It allows using the Release number without the %%dist tag in the dependency # generator to make the generated requires interchangeable between Rawhide # and ELN (.elnYY < .fcXX). -%global baserelease 14 +%global baserelease 15 Release: %{baserelease}%{?dist} # Licenses: @@ -386,6 +386,17 @@ Patch75: glibc-upstream-2.39-52.patch Patch76: glibc-upstream-2.39-53.patch Patch77: glibc-upstream-2.39-54.patch Patch78: glibc-RHEL-22226.patch +Patch79: glibc-upstream-2.39-55.patch +Patch80: glibc-upstream-2.39-56.patch +Patch81: glibc-upstream-2.39-57.patch +Patch82: glibc-upstream-2.39-58.patch +Patch83: glibc-upstream-2.39-59.patch +Patch84: glibc-upstream-2.39-60.patch +Patch85: glibc-upstream-2.39-61.patch +Patch86: glibc-upstream-2.39-62.patch +Patch87: glibc-upstream-2.39-63.patch +Patch88: glibc-upstream-2.39-64.patch +Patch89: glibc-upstream-2.39-65.patch ############################################################################## # Continued list of core "glibc" package information: @@ -2611,6 +2622,21 @@ update_gconv_modules_cache () %endif %changelog +* Wed Jun 05 2024 Arjun Shankar - 2.39-15 +- Sync with upstream branch release/2.39/master, + commit 6ade91c21140d8c803c289932dbfc74537f65a1f: +- elf: Avoid some free (NULL) calls in _dl_update_slotinfo +- misc: Add support for Linux uio.h RWF_NOAPPEND flag +- i386: Disable Intel Xeon Phi tests for GCC 15 and above (BZ 31782) +- Reinstate generic features-time64.h +- Always define __USE_TIME_BITS64 when 64 bit time_t is used +- socket: Use may_alias on sockaddr structs (bug 19622) +- parse_fdinfo: Don't advance pointer twice [BZ #31798] +- LoongArch: Fix undefined `__memset_aligned` reference in ld.so linking. +- socket: Add new test for connect +- libsupport: Add xgetpeername +- x86_64: Fix missing wcsncat function definition without multiarch (x86-64-v4) + * Fri May 31 2024 Florian Weimer - 2.39-14 - Enable CPU compatibility diagnostics in ld.so (#2276631, RHEL-31738)