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

Jeffrey Walton via cfe-dev cfe-dev at lists.llvm.org
Tue Dec 1 10:57:42 PST 2015

On Tue, Dec 1, 2015 at 1:47 PM, David Chisnall
<David.Chisnall at cl.cam.ac.uk> wrote:
> On 1 Dec 2015, at 18:36, Jeffrey Walton <noloader at gmail.com> wrote:
>> When the i386 code is run on an x86_64 system (i.e., "arch i386
>> myprog.exe"), then we must interact with the stack using 64-bit values
>> and registers. Its an ABI requirement.
> When i386 code is run on an x86-64 system, it is using a different system call layer, but is otherwise a normal 386 extended mode environment.  Without an explicit switch to long mode, it can not use any of the long mode registers.  There is most definitely not an ABI requirement that i386 code use non-i386 instructions.
Thanks David.

I just checked a 64-bit Fedora system using the -m32 option (which I
believe is equivalent to -arch i386; corrections please). Neither GCC
nor Clang define ILP32 and friends. So this appears to be limited to
Apple systems.

As for the lack of an ABI requirement, I'm not sure... I've read the
relevant docs, and I don't see the exception you are discussing (i.e.,
not an ABI requirement). I think part of the problem is its under
specified by Apple, and deferring to the System V ABI docs is not the
best strategy since they are not following the docs they are deferring


More information about the cfe-dev mailing list