From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x942.google.com (mail-ua1-x942.google.com [IPv6:2607:f8b0:4864:20::942]) by sourceware.org (Postfix) with ESMTPS id 6BCF2385BF92 for ; Wed, 1 Apr 2020 17:57:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6BCF2385BF92 Received: by mail-ua1-x942.google.com with SMTP id o15so139556ual.3 for ; Wed, 01 Apr 2020 10:57:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=udVoFHVUybP4PsX3iDnskCOD7qSKbDHzaEyN8X7sMqU=; b=E8zBM0gYCw/yJ4utJVPy6FTsC8qJCd6tDevZFw890Fv03zHnsf226nzZKSw+vC0coI LXoQSy8jVEhCYEA2zv++QU3UPh4qppVWnwVW3XqqsjUlcjoj8OaHrFh6cZsFuGQyMd5a T4Xv9cx5pMvGK3tYq3PSmUf7hyd0nlqtIQxDxn+GWmQl1nb7DRV3S0YAX5nJw9woRhKP L7J2wYYsRm6XGex6EMt08WvTgcRpGmIit2vlmD2/DrBCkupjKeGStxG9WcVei2FuzO0e /Ey8l0A8Yv9plKW0f2Z2ylRVsnJHhQGjFhe1PvTAT2rmYe5epwC+3tK86LCUR2dnYHgC L6Hw== X-Gm-Message-State: AGi0PuaFXBBucgQM93eIDnfa8reCIFnZig5B9Os/GwamEeMFkhUFyNuY BNwxD2lYl2GVnjGXy8RGYLIW9BfyF762Tbj+l8Ilgham X-Google-Smtp-Source: APiQypJ4/f4flLZwvvAutjtL0AkLZ30OsucDWeLVb2PwFdncrnl1rhoeOU7t/ZsXHER/YQBCJWGKUUN9Kjb9sCsLTys= X-Received: by 2002:a9f:384f:: with SMTP id q15mr14698124uad.133.1585763829909; Wed, 01 Apr 2020 10:57:09 -0700 (PDT) MIME-Version: 1.0 References: <20200401165459.2016997-1-alistair.francis@wdc.com> <7ab9ded3-5fd8-1267-ebae-e096e90fe9ad@synopsys.com> In-Reply-To: <7ab9ded3-5fd8-1267-ebae-e096e90fe9ad@synopsys.com> From: Alistair Francis Date: Wed, 1 Apr 2020 10:48:58 -0700 Message-ID: Subject: Re: [PATCH] generic/typesizes.h: Add support for 32-bit arches with 64-bit types To: Vineet Gupta Cc: Alistair Francis , "libc-alpha@sourceware.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-19.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Apr 2020 17:57:11 -0000 On Wed, Apr 1, 2020 at 10:55 AM Vineet Gupta via Libc-alpha wrote: > > On 4/1/20 9:54 AM, Alistair Francis via Libc-alpha wrote: > > 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. > > --- > > .../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 for the meaning of these macros. This file exists so > > - that need not vary across different GNU platforms. */ > > +/* See for the meaning of these macros. This file exists so > > + that need not vary across different GNU platforms. */ > > +#if __TIMESIZE == 64 && __WORDSIZE == 32 > > Is this x32 safe as discussed in several other threads ? Yep, x86 has it's own override so it won't use this file. Alistair > > > +/* 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 > > > > >