public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alistair Francis <alistair23@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/alistair/rv32.next] generic/typesizes.h: Add support for 32-bit arches with 64-bit types
Date: Wed, 22 Apr 2020 22:15:14 +0000 (GMT)	[thread overview]
Message-ID: <20200422221514.18E883954C6C@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5e574792e950c6ebd9c8919ae55e65c6b4da984d

commit 5e574792e950c6ebd9c8919ae55e65c6b4da984d
Author: Alistair Francis <alistair.francis@wdc.com>
Date:   Fri Feb 14 11:02:29 2020 -0800

    generic/typesizes.h: Add support for 32-bit arches with 64-bit types
    
    Update the default typesizes.h to match the new kernel sizes for 32-bit
    architectures with a 64-bit time_t and friends. This follows the sizes
    used for RV32 which is a y2038 safe architecture added after Linux 5.1.
    
    Reviewed-by: Vineet Gupta <vgupta@synopsys.com>
    Tested-by: Vineet Gupta <vgupta@synopsys.com>

Diff:
---
 sysdeps/unix/sysv/linux/generic/bits/typesizes.h | 37 ++++++++++++++++--------
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
index 4fb246ac74..05a6f6d1e5 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
@@ -24,33 +24,46 @@
 #ifndef	_BITS_TYPESIZES_H
 #define	_BITS_TYPESIZES_H	1
 
-/* See <bits/types.h> for the meaning of these macros.  This file exists so
-   that <bits/types.h> need not vary across different GNU platforms.  */
+/* See <bits/types.h> for the meaning of these macros.	This file exists so
+	 that <bits/types.h> need not vary across different GNU platforms.	*/
+#if __TIMESIZE == 64 && __WORDSIZE == 32
+/* This is the "new" y2038 types defined for architectures added after
+ * the 5.1 kernel	*/
+# define __INO_T_TYPE		__UQUAD_TYPE
+# define __OFF_T_TYPE		__SQUAD_TYPE
+# define __RLIM_T_TYPE		__UQUAD_TYPE
+# define __BLKCNT_T_TYPE	__SQUAD_TYPE
+# define __FSBLKCNT_T_TYPE	__UQUAD_TYPE
+# define __FSFILCNT_T_TYPE	__UQUAD_TYPE
+# define __TIME_T_TYPE		__SQUAD_TYPE
+# define __SUSECONDS_T_TYPE	__SQUAD_TYPE
+#else
+# define __INO_T_TYPE		__ULONGWORD_TYPE
+# define __OFF_T_TYPE		__SLONGWORD_TYPE
+# define __RLIM_T_TYPE		__ULONGWORD_TYPE
+# define __BLKCNT_T_TYPE	__SLONGWORD_TYPE
+# define __FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
+# define __FSFILCNT_T_TYPE	__ULONGWORD_TYPE
+# define __TIME_T_TYPE		__SLONGWORD_TYPE
+# define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
+#endif
 
 #define __DEV_T_TYPE		__UQUAD_TYPE
 #define __UID_T_TYPE		__U32_TYPE
 #define __GID_T_TYPE		__U32_TYPE
-#define __INO_T_TYPE		__ULONGWORD_TYPE
 #define __INO64_T_TYPE		__UQUAD_TYPE
 #define __MODE_T_TYPE		__U32_TYPE
 #define __NLINK_T_TYPE		__U32_TYPE
-#define __OFF_T_TYPE		__SLONGWORD_TYPE
 #define __OFF64_T_TYPE		__SQUAD_TYPE
 #define __PID_T_TYPE		__S32_TYPE
-#define __RLIM_T_TYPE		__ULONGWORD_TYPE
 #define __RLIM64_T_TYPE		__UQUAD_TYPE
-#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
 #define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
-#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
 #define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
-#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
 #define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
 #define	__FSWORD_T_TYPE		__SWORD_TYPE
 #define	__ID_T_TYPE		__U32_TYPE
 #define __CLOCK_T_TYPE		__SLONGWORD_TYPE
-#define __TIME_T_TYPE		__SLONGWORD_TYPE
 #define __USECONDS_T_TYPE	__U32_TYPE
-#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
 #define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
 #define __DADDR_T_TYPE		__S32_TYPE
 #define __KEY_T_TYPE		__S32_TYPE
@@ -63,7 +76,7 @@
 #define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 #define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
 
-#ifdef __LP64__
+#if defined(__LP64__) || (__TIMESIZE == 64 && __WORDSIZE == 32)
 /* Tell the libc code that off_t and off64_t are actually the same type
    for all ABI purposes, even if possibly expressed as different base types
    for C type-checking purposes.  */
@@ -79,7 +92,7 @@
 # define __STATFS_MATCHES_STATFS64  1
 
 /* And for getitimer, setitimer and rusage  */
-# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 (__WORDSIZE == 64)
 #else
 # define __RLIM_T_MATCHES_RLIM64_T	0


             reply	other threads:[~2020-04-22 22:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22 22:15 Alistair Francis [this message]
2020-04-26  2:25 Alistair Francis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200422221514.18E883954C6C@sourceware.org \
    --to=alistair23@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).