[01/23,AARCH64] define word size for lp64 and ilp32
Commit Message
From: Andrew Pinski <apinski@cavium.com>
Additionally introduce and/or define MIN/MAX macro for size
and ptrdiff types.
Signed-off-by: Andrew Pinski <apinski@cavium.com>
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
sysdeps/aarch64/bits/wordsize.h | 25 +++++++++++++++++++++++++
sysdeps/generic/stdint.h | 9 +++++++--
2 files changed, 32 insertions(+), 2 deletions(-)
create mode 100644 sysdeps/aarch64/bits/wordsize.h
Comments
On Tue, 28 Jun 2016, Yury Norov wrote:
> diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
See what I said in
<https://sourceware.org/ml/libc-alpha/2016-06/msg00786.html> about "make
other bits/wordsize.h files define the macro to 0". This patch would
break all other architectures (and AArch64 LP64 - you should test build
and testsuite for that, as well as ILP32, and confirm that there are no
testsuite regressions for LP64).
> +/* Copyright (C) 2014 Free Software Foundation, Inc.
See what I said in
<https://sourceware.org/ml/libc-alpha/2016-06/msg00780.html> about
one-line descriptions before copyright notices. Please check every new
file in every patch in the series for this issue.
All copyright notices should have ranges of years that end in 2016.
On Tue, 28 Jun 2016, Joseph Myers wrote:
> On Tue, 28 Jun 2016, Yury Norov wrote:
>
> > diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
>
> See what I said in
> <https://sourceware.org/ml/libc-alpha/2016-06/msg00786.html> about "make
> other bits/wordsize.h files define the macro to 0". This patch would
> break all other architectures (and AArch64 LP64 - you should test build
> and testsuite for that, as well as ILP32, and confirm that there are no
> testsuite regressions for LP64).
(Actually, for LP64, if you can confirm that the installed stripped shared
libraries are byte-for-byte identical before and after the patch series,
then a testsuite run is unnecessary. But you still need to run the
testsuite for ILP32, and justify any failures there, and if the LP64
binaries aren't byte-for-byte identical, you should justify why they
aren't.)
new file mode 100644
@@ -0,0 +1,25 @@
+/* Copyright (C) 2014 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
+#else
+# define __WORDSIZE 32
+# define __WORDSIZE32_SIZE_ULONG 1
+# define __WORDSIZE32_PTRDIFF_LONG 1
+#endif
+
@@ -248,8 +248,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'. */