Can 64 bit GCC compiler use LLP64 data model?

Grant, Steve steven.grant@philips.com
Fri Dec 11 19:29:10 GMT 2020


Thanks for the response.  I just wanted to make sure I was not missing a useful compiler setting before launching into updating the source code. I'm not inclined to take on modifying the compiler so source code it is.

Steve

-----Original Message-----
From: Jonathan Wakely <jwakely.gcc@gmail.com>
Sent: Friday, December 11, 2020 1:58 AM
To: Grant, Steve <steven.grant@philips.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Can 64 bit GCC compiler use LLP64 data model?

On Thu, 10 Dec 2020 at 23:13, Grant, Steve via Gcc-help <gcc-help@gcc.gnu.org> wrote:
>
> Is it possible to configure the current (9.3 or 10.2) GNU GCC bare-metal compiler to use the LLP64 data model for targeting the 64-bit ARM Cortex-A53?
>
> My current project involves porting legacy embedded C++ code that is running on a 32-bit Cortex-A9 processor to a 64-bit Cortex-A53 processor.
>
> Since this is an embedded system, many of the data structures are mapped to hardware memory-mapped registers.  These registers were defined as 'unsigned long' which the previous GCC 32-bit compiler defines as 32 bits in size that matches the register hardware in the legacy system.
>
> I see that the GCC 64 bit compiler uses the LP64 data model where 'unsigned long' is 64 bits in size. Having unsigned longs go from 32 bits to 64 would break the register memory mapping.   The data model LLP64 used by Win64 defines 'unsigned long' as 32 bits.  I understand that this is to support the legacy data structures in the Windows world.  I could redefine all of the memory mapped registers to 'unsigned int' in the source code but there are a lot of them and I'm concerned about destabilizing the code.
>
> So is it possible to configure the GCC compiler to use the LLP64 data model?

GCC does support LLP64 for at least one target: the mingw port for Windows.

So in theory you could modify GCC to use LLP64 for ARM, and then test it very, very thoroughly to make sure you didn't miss anything, then compile with that.

But it would probably be a lot easier and safer to just fix your code, rather than modify GCC and then be dependent on a custom GCC you have to maintain yourself, and verify its correctness yourself.

________________________________
The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.


More information about the Gcc-help mailing list