[RFC PATCH 4/4] linux: remove time64 redirects for __TIMESIZE=64 architectures

Arnd Bergmann arnd@kernel.org
Tue Nov 10 14:51:46 GMT 2026


From: Arnd Bergmann <arnd@arndb.de>

In theory, it would be possible to have an architecture with __TIMESIZE=64
but !__ASSUME_TIME64_SYSCALLS, but all four of the 32-bit architectures
that set __TIMESIZE=64 redirect the time32 syscall macros (__NR_futex
etc) to the time64 versions, which means that in practice they all assume
they are running on linux-5.1 or higher even if the symbol is not set.
Note that only openrisc and arc actually support time32 syscalls at all,
while riscv32 and loongarch32 require the time64 versions.

The users of the time32 syscall macros are all converted to use the time64
names explicitly when __ASSUME_TIME64_SYSCALLS is set, so simplify the four
architectures here by removing the workaround and just always setting it.

This makes the behavior more consistent between architectures, and allows
catching future mistakes more easily when a libc-internal function tries
to call a time32 syscall that is not available on riscv32 and loongarch32.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sysdeps/unix/sysv/linux/arc/sysdep.h       | 19 ------------------
 sysdeps/unix/sysv/linux/kernel-features.h  |  4 ++--
 sysdeps/unix/sysv/linux/loongarch/sysdep.h | 12 -----------
 sysdeps/unix/sysv/linux/or1k/sysdep.h      | 17 ----------------
 sysdeps/unix/sysv/linux/riscv/sysdep.h     | 23 ----------------------
 5 files changed, 2 insertions(+), 73 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/arc/sysdep.h b/sysdeps/unix/sysv/linux/arc/sysdep.h
index 90cea3f840f1..0b22bd5f08a3 100644
--- a/sysdeps/unix/sysv/linux/arc/sysdep.h
+++ b/sysdeps/unix/sysv/linux/arc/sysdep.h
@@ -24,25 +24,6 @@
 #include <sysdeps/unix/sysdep.h>
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 
-/* "workarounds" for generic code needing to handle 64-bit time_t.  */
-
-/* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c.  */
-#define __NR_clock_getres	__NR_clock_getres_time64
-/* Fix sysdeps/nptl/lowlevellock-futex.h.  */
-#define __NR_futex		__NR_futex_time64
-/* Fix sysdeps/unix/sysv/linux/pause.c.  */
-#define __NR_ppoll		__NR_ppoll_time64
-/* Fix sysdeps/unix/sysv/linux/select.c.  */
-#define __NR_pselect6		__NR_pselect6_time64
-/* Fix sysdeps/unix/sysv/linux/recvmmsg.c.  */
-#define __NR_recvmmsg		__NR_recvmmsg_time64
-/* Fix sysdeps/unix/sysv/linux/sigtimedwait.c.  */
-#define __NR_rt_sigtimedwait	__NR_rt_sigtimedwait_time64
-/* Fix sysdeps/unix/sysv/linux/semtimedop.c.  */
-#define __NR_semtimedop		__NR_semtimedop_time64
-/* Hack sysdeps/unix/sysv/linux/generic/utimes.c.  */
-#define __NR_utimensat		__NR_utimensat_time64
-
 /* For RTLD_PRIVATE_ERRNO.  */
 #include <dl-sysdep.h>
 
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 85f6e888dba5..8088066fbba0 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -205,11 +205,11 @@
      where pointers are 32 bits but time_t has always been 64 bits.
 
    __ASSUME_TIME64_SYSCALLS being set does not mean __TIMESIZE is 64,
-   and __TIMESIZE equal to 64 does not mean __ASSUME_TIME64_SYSCALLS
-   is set.  All four cases are possible.  */
+   but __TIMESIZE == 64 requires __ASSUME_TIME64_SYSCALLS. */
 
 #if __LINUX_KERNEL_VERSION >= 0x050100                          \
   || __WORDSIZE == 64                                           \
+  || __TIMESIZE == 64						\
   || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64)
 # define __ASSUME_TIME64_SYSCALLS 1
 #endif
diff --git a/sysdeps/unix/sysv/linux/loongarch/sysdep.h b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
index eaa9e52575b1..0f23b33b0b75 100644
--- a/sysdeps/unix/sysv/linux/loongarch/sysdep.h
+++ b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
@@ -116,18 +116,6 @@
 #undef SYS_ify
 #define SYS_ify(syscall_name) __NR_##syscall_name
 
-#if __WORDSIZE == 32
-/* Workarounds for generic code needing to handle 64-bit time_t.  */
-#define __NR_clock_getres	__NR_clock_getres_time64
-#define __NR_futex		__NR_futex_time64
-#define __NR_ppoll		__NR_ppoll_time64
-#define __NR_pselect6		__NR_pselect6_time64
-#define __NR_recvmmsg		__NR_recvmmsg_time64
-#define __NR_rt_sigtimedwait	__NR_rt_sigtimedwait_time64
-#define __NR_semtimedop		__NR_semtimedop_time64
-#define __NR_utimensat		__NR_utimensat_time64
-#endif /* __WORDSIZE == 32 */
-
 #ifndef __ASSEMBLER__
 
 #define VDSO_NAME "LINUX_5.10"
diff --git a/sysdeps/unix/sysv/linux/or1k/sysdep.h b/sysdeps/unix/sysv/linux/or1k/sysdep.h
index e08a66161a04..02aec9b6b11c 100644
--- a/sysdeps/unix/sysv/linux/or1k/sysdep.h
+++ b/sysdeps/unix/sysv/linux/or1k/sysdep.h
@@ -35,23 +35,6 @@
 #undef __NR_semtimedop
 #undef __NR_utimensat
 
-/* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c.  */
-#define __NR_clock_getres	__NR_clock_getres_time64
-/* Fix sysdeps/nptl/lowlevellock-futex.h.  */
-#define __NR_futex		__NR_futex_time64
-/* Fix sysdeps/unix/sysv/linux/pause.c.  */
-#define __NR_ppoll		__NR_ppoll_time64
-/* Fix sysdeps/unix/sysv/linux/select.c.  */
-#define __NR_pselect6		__NR_pselect6_time64
-/* Fix sysdeps/unix/sysv/linux/recvmmsg.c.  */
-#define __NR_recvmmsg		__NR_recvmmsg_time64
-/* Fix sysdeps/unix/sysv/linux/sigtimedwait.c.  */
-#define __NR_rt_sigtimedwait	__NR_rt_sigtimedwait_time64
-/* Fix sysdeps/unix/sysv/linux/semtimedop.c.  */
-#define __NR_semtimedop		__NR_semtimedop_time64
-/* Hack sysdeps/unix/sysv/linux/generic/utimes.c.  */
-#define __NR_utimensat		__NR_utimensat_time64
-
 #undef SYS_ify
 #define SYS_ify(syscall_name)   (__NR_##syscall_name)
 
diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h
index 7f0eb070455a..227238cbac14 100644
--- a/sysdeps/unix/sysv/linux/riscv/sysdep.h
+++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h
@@ -26,29 +26,6 @@
 #undef SYS_ify
 #define SYS_ify(syscall_name)	__NR_##syscall_name
 
-#if __WORDSIZE == 32
-
-/* Workarounds for generic code needing to handle 64-bit time_t.  */
-
-/* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c.  */
-#define __NR_clock_getres	__NR_clock_getres_time64
-/* Fix sysdeps/nptl/lowlevellock-futex.h.  */
-#define __NR_futex		__NR_futex_time64
-/* Fix sysdeps/unix/sysv/linux/pause.c.  */
-#define __NR_ppoll		__NR_ppoll_time64
-/* Fix sysdeps/unix/sysv/linux/select.c.  */
-#define __NR_pselect6		__NR_pselect6_time64
-/* Fix sysdeps/unix/sysv/linux/recvmmsg.c.  */
-#define __NR_recvmmsg		__NR_recvmmsg_time64
-/* Fix sysdeps/unix/sysv/linux/sigtimedwait.c.  */
-#define __NR_rt_sigtimedwait	__NR_rt_sigtimedwait_time64
-/* Fix sysdeps/unix/sysv/linux/semtimedop.c.  */
-#define __NR_semtimedop		__NR_semtimedop_time64
-/* Hack sysdeps/unix/sysv/linux/generic/utimes.c.  */
-#define __NR_utimensat		__NR_utimensat_time64
-
-#endif /* __WORDSIZE == 32 */
-
 #ifdef __ASSEMBLER__
 
 # include <sys/asm.h>
-- 
2.53.0



More information about the Libc-alpha mailing list