bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix distinction of 32-bit/64-bit mode with xlc 13.1.3 on AIX


From: Jeffrey Walton
Subject: Re: Fix distinction of 32-bit/64-bit mode with xlc 13.1.3 on AIX
Date: Sun, 14 Feb 2021 22:29:11 -0500

Hi Bruno,

On Sun, Feb 14, 2021 at 9:50 PM Bruno Haible <bruno@clisp.org> wrote:
>
> 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__

Are you sure that is correct? It almost sounds like the default is
32-bit, and you need an option to enable 64-bit.

According to the XL C/C++ manual for AIX (p. 507) [1]:

    _ARCH_PPC - Indicates that the application is
    targeted to run on any Power processor.

    _ARCH_PPC64 - Indicates that the application
    is targeted to run on Power processors with
    64-bit support.

And from the manual (p. 28):

    Compiler mode is set according to the last-found
    instance of the -q32or -q64 compiler options. If
    neither of these compiler options is set, the
    compiler mode is set by the value of the
    OBJECT_MODE environment variable. If the
    OBJECT_MODE environment variable is also not
    set, the compiler assumes32-bit compilation mode.

So it sounds like you are getting a 32-bit binary that runs on either
a 32-bit or 64-bit machine.

Jeff

[1] 
https://www.ibm.com/support/knowledgecenter/SSGH3R_13.1.3/com.ibm.compilers.aix.doc/compiler.pdf



reply via email to

[Prev in Thread] Current Thread [Next in Thread]