[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fix distinction of 32-bit/64-bit mode with xlc 13.1.3 on AIX
From: |
Bruno Haible |
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 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-201-generic; KDE/5.18.0; x86_64; ; ) |
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
- Fix distinction of 32-bit/64-bit mode with xlc 13.1.3 on AIX,
Bruno Haible <=