[cfe-dev] ILP32, -arch i386 and x86_64 Apple systems

Jeffrey Walton via cfe-dev cfe-dev at lists.llvm.org
Tue Dec 1 13:04:44 PST 2015


On Tue, Dec 1, 2015 at 2:26 PM, Reid Kleckner <rnk at google.com> wrote:
> Right. Clang's logic for defining the ILP macros is very simple:
>
>   if (TI.getPointerWidth(0) == 64 && TI.getLongWidth() == 64
>       && TI.getIntWidth() == 32) {
>     Builder.defineMacro("_LP64");
>     Builder.defineMacro("__LP64__");
>   }
>
>   if (TI.getPointerWidth(0) == 32 && TI.getLongWidth() == 32
>       && TI.getIntWidth() == 32) {
>     Builder.defineMacro("_ILP32");
>     Builder.defineMacro("__ILP32__");
>   }
>
> It happens on all platforms, not just x86. I think this is reasonable
> behavior and we should keep it, even if x86 gcc -m32 doesn't define this
> macro. As David said, don't use ILP32 to detect x32. You'll have a bad time
> on arm32.

Thanks. I also saw H.J. Lu's discussion related to ILP32 and
ARM64/AARCH64 on LKML

If you don't mind helping with a strategy, how should I check for X32?
The System V ABI only provides ILP32.

Thanks in advance.

Jeff



More information about the cfe-dev mailing list