[cfe-dev] ILP32, -arch i386 and x86_64 Apple systems
Jeffrey Walton via cfe-dev
cfe-dev at lists.llvm.org
Tue Dec 1 11:16:42 PST 2015
On Tue, Dec 1, 2015 at 1:57 PM, Jeffrey Walton <noloader at gmail.com> wrote:
> 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.
My bad... I forgot the "-i" in my grep. It appears the issue is
limited to Clang. GCC and Intel compilers do not define it:
fedora-22 $ clang++ -x c++ -m32 -dM -E - < /dev/null | egrep -i "(ilp)"
#define _ILP32 1
#define __ILP32__ 1
fedora-22 $ g++ -x c++ -m32 -dM -E - < /dev/null | egrep -i "(ilp)"
ubuntu-14 $ /opt/intel/bin/icpc -x c++ -m32 -dM -E - < /dev/null |
egrep -i "(ilp)"
I'm not sure about Comeau's compiler because I do not have access to it.
More information about the cfe-dev