This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]