From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: Fix distinction of 32-bit/64-bit mode with xlc 13.1.3 on AIX
Date: Mon, 15 Feb 2021 03:50:12 +0100 [thread overview]
Message-ID: <6456685.5lUXKWfzpP@omega> (raw)
Starting with xlc version 13, this compiler defines the preprocessor macro
_ARCH_PPC64 also in 32-bit builds. See:
$ xlc -qversion
IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72)
Version: 12.01.0000.0000
$ echo > empty.c ; xlc -qshowmacros=pre -E empty.c | grep ARCH_PPC
#define _ARCH_PPC 1
$ xlc -qversion
IBM XL C/C++ for AIX, V13.1.3 (5725-C72, 5765-J07)
Version: 13.01.0003.0006
$ echo > empty.c ; xlc -qshowmacros=pre -E empty.c | grep ARCH_PPC
#define _ARCH_PPCGR 1
#define _ARCH_PPC64GRSQ 1
#define _ARCH_PPC 1
#define _ARCH_PPC64GR 1
#define _ARCH_PPC64 1
So, in order to distinguish a 32-bit mode from a 64-bit mode, only the
following macros can be used:
- defined in 32-bit mode only: _ILP32 __ILP32__
- defined in 64-bit mode only: _LP64 __LP64__ __64BIT__
This patch fixes it.
2021-02-14 Bruno Haible <bruno@clisp.org>
Fix distinction of 32-bit/64-bit mode with xlc 13.1.3 on AIX.
* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI, gl_HOST_CPU_C_ABI_32BIT):
Test __LP64__ instead of _ARCH_PPC64.
* m4/lib-ld.m4 (AC_LIB_PROG_LD): Likewise.
* lib/stddef.in.h: Likewise.
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
index 6385892..ba6f903 100644
--- a/lib/stddef.in.h
+++ b/lib/stddef.in.h
@@ -51,7 +51,7 @@
/* On AIX 7.2, with xlc in 64-bit mode, <stddef.h> defines max_align_t to a
type with alignment 4, but 'long' has alignment 8. */
-# if defined _AIX && defined _ARCH_PPC64
+# if defined _AIX && defined __LP64__
# if !GNULIB_defined_max_align_t
# ifdef _MAX_ALIGN_T
/* /usr/include/stddef.h has already defined max_align_t. Override it. */
diff --git a/m4/host-cpu-c-abi.m4 b/m4/host-cpu-c-abi.m4
index 7dc830e..64e28b1 100644
--- a/m4/host-cpu-c-abi.m4
+++ b/m4/host-cpu-c-abi.m4
@@ -1,4 +1,4 @@
-# host-cpu-c-abi.m4 serial 13
+# host-cpu-c-abi.m4 serial 14
dnl Copyright (C) 2002-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -211,7 +211,7 @@ changequote([,])dnl
# be generating 64-bit code.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
- [[#if defined __powerpc64__ || defined _ARCH_PPC64
+ [[#if defined __powerpc64__ || defined __LP64__
int ok;
#else
error fail
@@ -605,7 +605,7 @@ changequote([,])dnl
# be generating 64-bit code.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
- [[#if defined __powerpc64__ || defined _ARCH_PPC64
+ [[#if defined __powerpc64__ || defined __LP64__
int ok;
#else
error fail
diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4
index aa07cb4..076358d 100644
--- a/m4/lib-ld.m4
+++ b/m4/lib-ld.m4
@@ -1,4 +1,4 @@
-# lib-ld.m4 serial 9
+# lib-ld.m4 serial 10
dnl Copyright (C) 1996-2003, 2009-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -122,7 +122,7 @@ else
*-*-aix*)
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
- [[#if defined __powerpc64__ || defined _ARCH_PPC64
+ [[#if defined __powerpc64__ || defined __LP64__
int ok;
#else
error fail
next reply other threads:[~2021-02-15 2:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-15 2:50 Bruno Haible [this message]
2021-02-15 3:29 ` Fix distinction of 32-bit/64-bit mode with xlc 13.1.3 on AIX Jeffrey Walton
2021-02-15 11:08 ` Bruno Haible
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6456685.5lUXKWfzpP@omega \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).