This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: ILP64 ? ILP32, LP64
- From: "John (Eljay) Love-Jensen" <eljay at adobe dot com>
- To: "Brian O'Mahoney" <omb at teraflex-bp dot dyndns dot org>, GCC-help <gcc-help at gcc dot gnu dot org>
- Date: Wed, 4 Feb 2009 05:59:11 -0800
- Subject: Re: ILP64 ? ILP32, LP64
Hi Brian,
> Much legacy code has problems with the LP64 model, with I 32 due to truncated
> pointers and pointer -> int -> pointer conversions which through away 32 bits
> of the pointer.
>
> Is there anyway to force ILP64 ie 64 bit ints? Clearly for code going forward
> one needs to __fic_it|__ but it is a real pain for legacy code of a tool you
> only see running once.
>
> I know that you can force ILP32 on 86_64 but something like -mi64 would be
> neat, anyone know an easy way?
The C99 <stdint.h> has intptr_t which is big enough to hold a pointer in an
int. Change all your int/pointer conflations to use intptr_t for the
integer data type.
Not quite what you are looking for.
What you are asking for is to have a ILP64 on a 64-bit platform. An
entirely reasonable request. Especially on a platform where the natural
data word size is 64-bit, since C (and hence C++) use Oint¹ to refer to the
platform¹s natural data word size.
Alas...
The most popular 64-bit platforms seem to have gone with a IL32/LLP64 or
I32/LP64 as their data type sizes. :-(
Changing your compiler to be ILP64 is not a simple matter, since now your
code will generate incorrect ABI when interoping with the operating system
APIs, the Standard C and C++ libraries, and all DLLs (.so, .dylib, .dll ...
whatever your platform uses). You¹d have to fix all the header files. Not
fun. Not really feasible, even for the meticulous, pedantic OCD curious --
therein lies the path to madness.
Sorry.
If you are determined to go down this course, there may be a viable
solution. You can build your own operating system (for example, one that is
Linux based), which has an ILP64 ABI. (There may be a Linux distro which
has already done this.)
Sincerely,
--Eljay