@@ -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
@@ -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
+ <<a rel="nofollow" href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>>. */
+
+#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
@@ -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)
@@ -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
{
@@ -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
{
@@ -17,7 +17,13 @@
#include <sgidefs.h>
-#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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -16,6 +16,10 @@
<http://www.gnu.org/licenses/>. */
#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
@@ -21,8 +21,7 @@
#include <bits/types.h> /* 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
@@ -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'.
@@ -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
@@ -15,4 +15,8 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#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
@@ -15,4 +15,8 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#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
@@ -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