From patchwork Wed Oct 26 18:33:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 16842 Received: (qmail 114458 invoked by alias); 26 Oct 2016 18:34:18 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 113217 invoked by uid 89); 26 Oct 2016 18:34:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Session, 64, tile, 216 X-HELO: NAM03-DM3-obe.outbound.protection.outlook.com Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Steve.Ellcey@cavium.com; Message-ID: <1477506839.26691.5.camel@caviumnetworks.com> Subject: [PATCH] Define wordsize.h macros everywhere From: Steve Ellcey To: CC: Date: Wed, 26 Oct 2016 11:33:59 -0700 MIME-Version: 1.0 X-ClientProxiedBy: BN6PR20CA0020.namprd20.prod.outlook.com (10.173.158.158) To CO2PR0701MB1061.namprd07.prod.outlook.com (10.160.8.140) X-MS-Office365-Filtering-Correlation-Id: 4118d122-3f09-4d76-6e69-08d3fdceaa01 X-Microsoft-Exchange-Diagnostics: 1; CO2PR0701MB1061; 2:XSHObDD7uVKjCDggX65MjeMxPyo0YLPFfYNYjGs2F9Qhh+Pjqb9pgvsqqRKRhPn5fG7F5ZXCFITt7f+x/7k6V5+SJ5O7MXrbcQlz4PQNtXvyJkb4Cimd6t0srEuE2h+gcQX118rInm8hNKBMLdaUXWfrWBzBBahEb+uU5FBFtMfoWXyG5WNU68xSa7tz1uEfSJW6NpsePPFkb3+0aLc9Ag==; 3:SDB4tsC5sFW8PDzXt368vL371xtjxLrYNisrLZVkj/yPMj4VW81E7sGTgrQ1O3ztjKY2cno24p5by3U4qhWubw87V+zyW+gqwQ9xcMaTYxonNm1X5DEYrsHqCVlfqnDhcHyJ4d8LBSvw4CNnofLhWw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO2PR0701MB1061; X-Microsoft-Exchange-Diagnostics: 1; CO2PR0701MB1061; 25:MRq9qHITplz1zmjBeFao+PmfDINscFJKK6S3Ayy5IUnaARPgGzmgkPQuDA/xDCoNY/MU+d3GZx46JYHYMuMpFF6ltl4qncu0SlQRdwI9S98CGROQg1LBBe+rd+HEv6VSPqTcgnWzQKycXDKHiLdObdFLcatcV+1kpUDNx7NVJAn5O3nVqXLaa7khQ0fN9VNn2T8aY93lLVBymHqf2x6R4VBH+q2bHiSCWBgjwHtetnU7zDVODnL737N+zZwn3AtGRlm/RrNxcV8ecIGI32UV62uZW+YSNN7PU/kdnGXMNYVruqlse23LmvDfYEUzroDScNJ7H5fRv/eqW5HcIVZUDCZtdaEmnY43OAMuUNFsfmkAOZ7XrMmceYV4zCSXU3XVrAakxpEy5IKppsI8cBjq7VaYEKCBI4dmd/w80N/mJNR6XceWcSi9fgre8hcBiYrOi4JsMMIrDfBnUfJYbGbQ380VaogfcavYM3y+couDUnMd1ynJqXFyhkz4Un5wFIVztyOXLjrR1889IQTOx4okOfbUZI7k2e7Ry7kdn7Y1SrJZ51Pl5pLyEwB7erWNoqtvbUslgcCnhD1MfTv9rH3kZzrAx0ydIzQZuQlcK6tpSdIOzeHa19U0bHlsHmfhlx1QR1L069N2IlZph7qN9dloBvFOkFhBdwyUQww/eWDc48PxdkTmFU645HhxDha9g6FcE2ZqIChEeedDWYp3KK7m/By+AO1uYMSNxS66DPnvwVB6OjvYvrtqQbyyedbwbaH6YhpC50gSy9nyLrT99HhdDF68kFUZsVQxlq2AQdUUfhoj2Fu4b3+qFAVUHMdyOrU63Yh/4AbB/+L33U2NTGMef7wFW1n1oyUvEfQRJlUvVBM= X-Microsoft-Exchange-Diagnostics: 1; CO2PR0701MB1061; 31:vDiEP9KuMaYEDlMiwX8mmJPVXWeKTn4wki38oVBVYtj/YAoCROBaheiJ6YbRNx3aBRZkFJm2mYjgzS56TAWQYcmv0in+QpeyrfLnbTzo/0YC2Q9mJwWlSJuEfVhXvhp7XeSnNuBa57YcudT4jHB8THNM0IjyjWmupplD4q5jL9nnX45888LXyQXlOmSwLqwZAOaocbSSzDgD2RhNEyzVwoJkIEdveCmiGbq6I8WswK3ErYIz7m4cjoEqC0hNJbL6; 20:9DYsrcJK4Qx9k1qMYX8uhKfYytEW3HYYsNnUgke6z1LNDzJf2i6NtSe9ejqXk7CNET68e2OPBovGFvFU6Ih5HR3jFA95yFybbUH3Sbt0RcCGvUqFMyhRi5Olb2DEWPCJ6miCavIhF9vKH1nclbrsgz3Ight0Hvz2jJHx/Hmpun79FNlsbl2OSGolSUPgMh1ENyN+NmiPK25DuVMkigmK3CkBOSeIOKRQxVdJi6syFoh2T9xUUJrf9NFxsEaX0xQpl4dMHZ15jHqkSpMxm6hI6XihvSDu5a9sWjVH2aLlOSTeM9YJBlakd2VmZCWiEXvy5dx/LvhxrvppeIuJw1MehkcMOGNxyyM2DHPs6xEoPepjODsap1z24HTfBhgPh3QbBNrxboAWsVZmWkw643ELcHra6c0Wsp6LWJgTYRTU+8LqV60MFIb6nryRExWoM65L48v5oanyDcDdc9ICjpDfHH43pB8x10ahYiXGZuEm/SLlaBQ192MMSnvxIRD6yC+qrEpmH62zYMt1CfhQoejCnAHTZzotwN1XFacBdpO4Lk5T10WTKX6bz+Ynt3r+hy9sojYFVZGG3Ngnk8AUaQVHVELWh/RJP35RlQaazP5dofs= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(22074186197030); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:CO2PR0701MB1061; BCL:0; PCL:0; RULEID:; SRVR:CO2PR0701MB1061; X-Microsoft-Exchange-Diagnostics: 1; CO2PR0701MB1061; 4:8jxJNLhAGJkBwskWDk9Lavk/RNA879npV/jT1AMdDMK9IdaEDcWL/f88rlruwS9wg7X4A13xI8pG2Rjs4XDbZL1B8V7SHGWZy0IBcueXmj1cI2URPMAGbfaeTXusC5oB45LMGUXEM6hS7xd9WYaQ8IfWfEme2McFqdVzrmbcnvPNi2qAzWSDMc2StJY60KOosXJkzNeFsiPy1m5DJCTnCsr4NXMJeUM+k2Ry0Ioq/inppv4A1icMz2BQqHHz9d4RqzNwYBL3tn1ZefZzzqIbgANCjJ6pZYoQfHA0j5q0YzizPQjx4NIGP9oxHzdJ5e7GZsO3qSTGewNWpvAteP0/azSJY3X1OnJYDrkLKGh8cyf/nKVY7BhxSccmOXy1VRouky8rMfNkS4tABzSxM2QOK4FUFdIhnForJ+O933XTYlx8M0HlVAu5qYQ1bZbfN5murM9mJ60Q7NtYO8gOhKD082ARqid4bX5r+ANoPQ2U2Oo= X-Forefront-PRVS: 0107098B6C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7916002)(189002)(377424004)(199003)(103116003)(4326007)(81166006)(305945005)(105586002)(7736002)(107886002)(110136003)(101416001)(81156014)(68736007)(6666003)(450100001)(5660300001)(97736004)(42186005)(53416004)(106356001)(92566002)(8676002)(6116002)(36756003)(3846002)(23676002)(2870700001)(19617315012)(15975445007)(33646002)(2906002)(2351001)(42882006)(50226002)(4001430100002)(6916009)(69596002)(229853001)(66066001)(575784001)(189998001)(50466002)(7846002)(5820100001)(50986999)(19580395003)(7906003)(4001150100001)(77096005)(47776003)(586003)(19580405001)(99106002)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR0701MB1061; H:sellcey-lt.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-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3gwsu7XnnBCiP8YrUyHcGiA63uYHJM9lTBIQyNGKRQ0TxS4PXCAvZ8NgDtXbi+TTytqw20TpPn8bE056ezrYwT6zG4xcjJ2kfp1LYdblT40myiPPb0hLsY2Mzo57nlm4dgj0WI8TGcAWm1Q8Pc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2016 18:34:03.9507 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR0701MB1061 This patch is based on an earlier patch Yury Norov sent out. That patch is at: https://sourceware.org/ml/libc-alpha/2016-08/msg00840.html This patch defines __WORDSIZE32_SIZE_ULONG, __WORDSIZE_TIME64_COMPAT32, and __SYSCALL_WORDSIZE in all the wordsize.h files so that the values of those macros can be checked instead of checking to see if they are defined or not.  This matches the current glibc macro usage preference as I understand it.  The patch also introduces a new macro, __WORDSIZE32_PTRDIFF_LONG, that is needed by the aarch64 ILP32 ABI that is in the works.  This macro doesn't technically have to be part of this patch since the rest of the ILP32 work is not in yet but since it touches the same wordsize.h files that the other macros touch it seems to make sense to include it in this patch.  That way we will not have to modify these files again as part of the aarch64 ILP patches.  I also updated the comments that Yury had added to bits/wordsize.h in response to earlier feedback. I have tested this patch on x86_64 in 32, x32 and 64 bit modes and on aarch64 with no regressions. OK to checkin? Steve Ellcey sellcey@caviiumnetworks.com 2016-10-24  Yury Norov       Steve Ellcey * bits/wordsize.h: Add documentation. * sysdeps/aarch64/bits/wordsize.h : New file * sysdeps/generic/stdint.h (PTRDIFF_MIN, PTRDIFF_MAX): Update definitions. (SIZE_MAX): Change ifdef to if in __WORDSIZE32_SIZE_ULONG check. * sysdeps/gnu/bits/utmp.h (__WORDSIZE_TIME64_COMPAT32): Check with #if instead of #ifdef. * sysdeps/gnu/bits/utmpx.h (__WORDSIZE_TIME64_COMPAT32): Ditto. * sysdeps/unix/sysv/linux/bits/statvfs.h (_STATVFSBUF_F_UNUSED): Change check to assume __SYSCALL_WORDSIZE is set. * sysdeps/mips/bits/wordsize.h (__SYSCALL_WORDSIZE, __WORDSIZE32_SIZE_ULONG, __WORDSIZE32_PTRDIFF_LONG, __WORDSIZE_TIME64_COMPAT32): Add or change defines. * sysdeps/powerpc/powerpc32/bits/wordsize.h: Likewise. * sysdeps/powerpc/powerpc64/bits/wordsize.h: Likewise. * sysdeps/s390/s390-32/bits/wordsize.h: Likewise. * sysdeps/s390/s390-64/bits/wordsize.h: Likewise. * sysdeps/sparc/sparc32/bits/wordsize.h: Likewise. * sysdeps/sparc/sparc64/bits/wordsize.h: Likewise. * sysdeps/tile/tilegx/bits/wordsize.h: Likewise. * sysdeps/tile/tilepro/bits/wordsize.h: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/wordsize.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/wordsize.h: Likewise. * sysdeps/wordsize-32/bits/wordsize.h: Likewise. * sysdeps/wordsize-64/bits/wordsize.h: Likewise. * sysdeps/x86/bits/wordsize.h: Likewise. diff --git a/bits/wordsize.h b/bits/wordsize.h index 9ef0e85..2ebecd6 100644 --- a/bits/wordsize.h +++ b/bits/wordsize.h @@ -1 +1,28 @@  #error "This file must be written based on the data type sizes of the target" + +/* The following entries are a template for what defines should be in the +   wordsize.h header file for a target.  */ + +/* Bits per word (size of CPU register).  */ +#define __WORDSIZE + +/* Set to the size of the f_fsid field in the statvfs and statvfs64 structs. +   In most cases this is the same as __WORDSIZE but some 32 bit hosts may set +   it to 64.  */ +#define __SYSCALL_WORDSIZE + +/* Set to 1 if ssize_t is type 'unsigned long' instead of type 'unsigned int' +   so that SIZE_MAX is defined as an unsigned long constant instead of an +   unsigned int constant.  Set to 0 if ssize_t is 'unsigned int'.  */ +#define __WORDSIZE32_SIZE_ULONG + +/* Set to 1 if ptrdiff_t is type 'long' instead of type 'int' so that +   PTRDIFF_MIN and PTRDIFF_MAX are defined as long constants instead of +   int constants.  Set to 0 if ptrdiff_t is type 'int'.  */ +#define __WORDSIZE32_PTRDIFF_LONG + +/* Set to 1 in order to force time types to be 32 bits instead of 64 bits in +   struct lastlog and struct utmp{,x} on 64-bit ports.  This may be done in +   order to make 64-bit ports compatible with 32-bit ports.  Set to 0 for +   64-bit ports where the time types are 64-bits or for any 32-bit ports.  */ +#define __WORDSIZE_TIME64_COMPAT32 diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h index e69de29..c907986 100644 --- a/sysdeps/aarch64/bits/wordsize.h +++ b/sysdeps/aarch64/bits/wordsize.h @@ -0,0 +1,31 @@ +/* Determine the wordsize from the preprocessor defines. + +   Copyright (C) 2016 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 +   <http://www.gnu.org/licenses/>.  */ + +#ifdef __LP64__ +# define __WORDSIZE 64 +# define __WORDSIZE32_SIZE_ULONG 0 +# define __WORDSIZE32_PTRDIFF_LONG 0 +#else +# define __WORDSIZE 32 +# define __WORDSIZE32_SIZE_ULONG 1 +# define __WORDSIZE32_PTRDIFF_LONG 1 +#endif + +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE_TIME64_COMPAT32 0 diff --git a/sysdeps/generic/stdint.h b/sysdeps/generic/stdint.h index 5428dbc..8e4347c 100644 --- a/sysdeps/generic/stdint.h +++ b/sysdeps/generic/stdint.h @@ -249,8 +249,13 @@ typedef unsigned long long int uintmax_t;  #  define PTRDIFF_MIN (-9223372036854775807L-1)  #  define PTRDIFF_MAX (9223372036854775807L)  # else -#  define PTRDIFF_MIN (-2147483647-1) -#  define PTRDIFF_MAX (2147483647) +#  if __WORDSIZE32_PTRDIFF_LONG +#   define PTRDIFF_MIN (-2147483647L-1) +#   define PTRDIFF_MAX (2147483647L) +#  else +#   define PTRDIFF_MIN (-2147483647-1) +#   define PTRDIFF_MAX (2147483647) +#  endif  # endif    /* Limits of `sig_atomic_t'.  */ @@ -261,7 +266,7 @@ typedef unsigned long long int uintmax_t;  # if __WORDSIZE == 64  #  define SIZE_MAX (18446744073709551615UL)  # else -#  ifdef __WORDSIZE32_SIZE_ULONG +#  if __WORDSIZE32_SIZE_ULONG  #   define SIZE_MAX (4294967295UL)  #  else  #   define SIZE_MAX (4294967295U) diff --git a/sysdeps/gnu/bits/utmp.h b/sysdeps/gnu/bits/utmp.h index 2a1ffcb..bce1a7b 100644 --- a/sysdeps/gnu/bits/utmp.h +++ b/sysdeps/gnu/bits/utmp.h @@ -35,7 +35,7 @@     previous logins.  */  struct lastlog    { -#ifdef __WORDSIZE_TIME64_COMPAT32 +#if __WORDSIZE_TIME64_COMPAT32      int32_t ll_time;  #else      __time_t ll_time; @@ -68,7 +68,7 @@ struct utmp  /* The ut_session and ut_tv fields must be the same size when compiled     32- and 64-bit.  This allows data files and shared memory to be     shared between 32- and 64-bit applications.  */ -#ifdef __WORDSIZE_TIME64_COMPAT32 +#if __WORDSIZE_TIME64_COMPAT32    int32_t ut_session; /* Session ID, used for windowing.  */    struct    { diff --git a/sysdeps/gnu/bits/utmpx.h b/sysdeps/gnu/bits/utmpx.h index b41548b..a438660 100644 --- a/sysdeps/gnu/bits/utmpx.h +++ b/sysdeps/gnu/bits/utmpx.h @@ -66,7 +66,7 @@ struct utmpx  /* The fields ut_session and ut_tv must be the same size when compiled     32- and 64-bit.  This allows files and shared memory to be shared     between 32- and 64-bit applications.  */ -#ifdef __WORDSIZE_TIME64_COMPAT32 +#if __WORDSIZE_TIME64_COMPAT32    __int32_t ut_session; /* Session ID, used for windowing.  */    struct    { diff --git a/sysdeps/mips/bits/wordsize.h b/sysdeps/mips/bits/wordsize.h index bc90435..6d476ba 100644 --- a/sysdeps/mips/bits/wordsize.h +++ b/sysdeps/mips/bits/wordsize.h @@ -17,7 +17,13 @@    #include   -#define __WORDSIZE _MIPS_SZPTR +#define __WORDSIZE _MIPS_SZPTR +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 +  #if _MIPS_SIM == _ABI64  # define __WORDSIZE_TIME64_COMPAT32 1 +#else +# define __WORDSIZE_TIME64_COMPAT32 0  #endif diff --git a/sysdeps/powerpc/powerpc32/bits/wordsize.h b/sysdeps/powerpc/powerpc32/bits/wordsize.h index f31ac9a..f08ab26 100644 --- a/sysdeps/powerpc/powerpc32/bits/wordsize.h +++ b/sysdeps/powerpc/powerpc32/bits/wordsize.h @@ -5,4 +5,9 @@  # define __WORDSIZE_TIME64_COMPAT32 1  #else  # define __WORDSIZE 32 +# define __WORDSIZE_TIME64_COMPAT32 0  #endif + +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 diff --git a/sysdeps/powerpc/powerpc64/bits/wordsize.h b/sysdeps/powerpc/powerpc64/bits/wordsize.h index f31ac9a..f08ab26 100644 --- a/sysdeps/powerpc/powerpc64/bits/wordsize.h +++ b/sysdeps/powerpc/powerpc64/bits/wordsize.h @@ -5,4 +5,9 @@  # define __WORDSIZE_TIME64_COMPAT32 1  #else  # define __WORDSIZE 32 +# define __WORDSIZE_TIME64_COMPAT32 0  #endif + +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 diff --git a/sysdeps/s390/s390-32/bits/wordsize.h b/sysdeps/s390/s390-32/bits/wordsize.h index da791fa..7ac7e6b 100644 --- a/sysdeps/s390/s390-32/bits/wordsize.h +++ b/sysdeps/s390/s390-32/bits/wordsize.h @@ -2,11 +2,16 @@    #if defined __s390x__  # define __WORDSIZE 64 +# define __WORDSIZE32_SIZE_ULONG       0  #else  # define __WORDSIZE 32  # define __WORDSIZE32_SIZE_ULONG       1  #endif   +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE32_PTRDIFF_LONG      0 +#define __WORDSIZE_TIME64_COMPAT32     0 +  #if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL    /* Signal that we didn't used to have a `long double'. The changes all diff --git a/sysdeps/s390/s390-64/bits/wordsize.h b/sysdeps/s390/s390-64/bits/wordsize.h index da791fa..7ac7e6b 100644 --- a/sysdeps/s390/s390-64/bits/wordsize.h +++ b/sysdeps/s390/s390-64/bits/wordsize.h @@ -2,11 +2,16 @@    #if defined __s390x__  # define __WORDSIZE 64 +# define __WORDSIZE32_SIZE_ULONG       0  #else  # define __WORDSIZE 32  # define __WORDSIZE32_SIZE_ULONG       1  #endif   +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE32_PTRDIFF_LONG      0 +#define __WORDSIZE_TIME64_COMPAT32     0 +  #if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL    /* Signal that we didn't used to have a `long double'. The changes all diff --git a/sysdeps/sparc/sparc32/bits/wordsize.h b/sysdeps/sparc/sparc32/bits/wordsize.h index d8fd1a5..73a3b7c 100644 --- a/sysdeps/sparc/sparc32/bits/wordsize.h +++ b/sysdeps/sparc/sparc32/bits/wordsize.h @@ -5,4 +5,9 @@  # define __WORDSIZE_TIME64_COMPAT32 1  #else  # define __WORDSIZE 32 +# define __WORDSIZE_TIME64_COMPAT32 0  #endif + +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 diff --git a/sysdeps/sparc/sparc64/bits/wordsize.h b/sysdeps/sparc/sparc64/bits/wordsize.h index d8fd1a5..73a3b7c 100644 --- a/sysdeps/sparc/sparc64/bits/wordsize.h +++ b/sysdeps/sparc/sparc64/bits/wordsize.h @@ -5,4 +5,9 @@  # define __WORDSIZE_TIME64_COMPAT32 1  #else  # define __WORDSIZE 32 +# define __WORDSIZE_TIME64_COMPAT32 0  #endif + +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 diff --git a/sysdeps/tile/tilegx/bits/wordsize.h b/sysdeps/tile/tilegx/bits/wordsize.h index 5d4e4b4..f5db53a 100644 --- a/sysdeps/tile/tilegx/bits/wordsize.h +++ b/sysdeps/tile/tilegx/bits/wordsize.h @@ -5,4 +5,9 @@  # define __WORDSIZE_TIME64_COMPAT32 1  #else  # define __WORDSIZE 32 +# define __WORDSIZE_TIME64_COMPAT32 0  #endif + +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 diff --git a/sysdeps/tile/tilepro/bits/wordsize.h b/sysdeps/tile/tilepro/bits/wordsize.h index da587a2..e1f21c9 100644 --- a/sysdeps/tile/tilepro/bits/wordsize.h +++ b/sysdeps/tile/tilepro/bits/wordsize.h @@ -1,3 +1,7 @@  /* Determine the wordsize from the preprocessor defines.  */   -#define __WORDSIZE 32 +#define __WORDSIZE 32 +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 +#define __WORDSIZE_TIME64_COMPAT32 0 diff --git a/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h b/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h index 51fc433..e1a3cdb 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h @@ -16,6 +16,10 @@     .  */    #define __WORDSIZE 64 +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 +#define __WORDSIZE_TIME64_COMPAT32 0    #if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL   diff --git a/sysdeps/unix/sysv/linux/bits/statvfs.h b/sysdeps/unix/sysv/linux/bits/statvfs.h index 9244401..fcdd2cd 100644 --- a/sysdeps/unix/sysv/linux/bits/statvfs.h +++ b/sysdeps/unix/sysv/linux/bits/statvfs.h @@ -21,8 +21,7 @@    #include   /* For __fsblkcnt_t and __fsfilcnt_t.  */   -#if (__WORDSIZE == 32 \ -     && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) +#if (__WORDSIZE == 32 && __SYSCALL_WORDSIZE == 32)  #define _STATVFSBUF_F_UNUSED  #endif   diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h index 3e8a1e0..aaec974 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h @@ -5,8 +5,13 @@  # define __WORDSIZE_TIME64_COMPAT32 1  #else  # define __WORDSIZE 32 +# define __WORDSIZE_TIME64_COMPAT32 0  #endif   +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 +  #if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL    /* Signal the glibc ABI didn't used to have a `long double'. diff --git a/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h index 2d958d2..5df97ab 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h @@ -6,6 +6,11 @@  # define __WORDSIZE 32  #endif   +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 +  #if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL    # if __WORDSIZE == 32 diff --git a/sysdeps/wordsize-32/bits/wordsize.h b/sysdeps/wordsize-32/bits/wordsize.h index 2aa16bc..3454d7f 100644 --- a/sysdeps/wordsize-32/bits/wordsize.h +++ b/sysdeps/wordsize-32/bits/wordsize.h @@ -15,4 +15,8 @@     License along with the GNU C Library; if not, see     .  */   -#define __WORDSIZE 32 +#define __WORDSIZE 32 +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 +#define __WORDSIZE_TIME64_COMPAT32 0 diff --git a/sysdeps/wordsize-64/bits/wordsize.h b/sysdeps/wordsize-64/bits/wordsize.h index 0944f9e..5a4b6c5 100644 --- a/sysdeps/wordsize-64/bits/wordsize.h +++ b/sysdeps/wordsize-64/bits/wordsize.h @@ -15,4 +15,8 @@     License along with the GNU C Library; if not, see     .  */   -#define __WORDSIZE 64 +#define __WORDSIZE 64 +#define __SYSCALL_WORDSIZE __WORDSIZE +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 +#define __WORDSIZE_TIME64_COMPAT32 0 diff --git a/sysdeps/x86/bits/wordsize.h b/sysdeps/x86/bits/wordsize.h index e25af28..0834c13 100644 --- a/sysdeps/x86/bits/wordsize.h +++ b/sysdeps/x86/bits/wordsize.h @@ -6,8 +6,14 @@  # define __WORDSIZE 32  #endif   +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 +  #ifdef __x86_64__  # define __WORDSIZE_TIME64_COMPAT32 1  /* Both x86-64 and x32 use the 64-bit system call interface.  */  # define __SYSCALL_WORDSIZE 64 +#else +# define _WORDSIZE_TIME64_COMPAT32 0 +# define __SYSCALL_WORDSIZE 32  #endif