From patchwork Wed Apr 1 16:54:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38700 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by sourceware.org (Postfix) with ESMTPS id CFD5E385E000 for ; Wed, 1 Apr 2020 17:02:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CFD5E385E000 IronPort-SDR: gqiKcnBv4gMseSMZSXa8FTg9GxYrwpnFxdxglmCmpVK49MKn50KsQV8scYhC7/Xop+50mzE6QD 2u4FAROv8O0PUb5XgDnuHBRwlAW7iueHF1LUYtw2CgrYkS5EsH5rAlx+AJJagmGp1SYFww+ZNv UC2YBJ5hmpZYWGiP8RFbqLE6DUQ50H011raVXm6PRvNxRVus8jKYTF68s7a9TDCdnxXRzuE7Mn 2q05ixEKKQ1T2Ep4wAZbhhotOQrLjNWx/hT+k/c+WFMUytlbuJbBSTDmG5ENXC85ndCV0XrMBV hE4= X-IronPort-AV: E=Sophos;i="5.72,332,1580745600"; d="scan'208";a="242802320" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 02 Apr 2020 01:02:45 +0800 IronPort-SDR: RD5rjVmLgPedRELwtSTqz9aFWTXhFyqjIT2fVBu9Y9Yd52vVea3TOBck/3cFalm+j4PUL9/+KS Ix9WUqwrkdA2rjx2tHkakOIEVp/HUnV0MFHlJcC6Ax7GotEWPvz9SNAHHcwnq1W8rctOvYHIVe 5tXJr6y9BCDDZpFg7ZMTuqx/itZb5CdW15iznAQNiD5odLibDEGzZIQZoLQdDXquLcHYmEUWLE LLYGe0k5gO1C//BVjIYMXLicijuPuVlkRA4cGuH0XwKGtxjK0hKznIcJkZLxOSHOAObuaGdQEQ aOThA/SC3KUC0mpBF+04VrS3 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2020 09:54:11 -0700 IronPort-SDR: ej1XRJJhDQt+k1jboCZ4b0PoLXMYZI2vNzhwkeqPHe1MQlnsYbm4JGON6yCmrwrpXGXCF8KkBM Z8Gtf/dM88uebBIwCGj0PI5h9pztxIWsgWSXUSslfMAtvwgOvjAM5cOpCuETvnDs9dwh2O2tll JcvedxCxj/iTMncdIVAH+xxzt5iDVvEAKoAsvC+nIECLR/vjoBm53L7PAROa5pJF1Fet0sHSfA 1mLCKZRNcyu095qBgFcE1KFguySFQs/47hTKhick1jVqN4f3YB05OirXGAhLvvkM0l53PclmCu 7yc= WDCIronportException: Internal Received: from cnf006887.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.14]) by uls-op-cesaip01.wdc.com with ESMTP; 01 Apr 2020 10:02:45 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH] generic/typesizes.h: Add support for 32-bit arches with 64-bit types Date: Wed, 1 Apr 2020 09:54:59 -0700 Message-Id: <20200401165459.2016997-1-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 X-Spam-Status: No, score=-25.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, 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:02:49 -0000 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 Tested-by: Vineet Gupta --- .../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 +/* 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