diff mbox

Ada/x32: PR ada/80626: Correct Memory_Size

Message ID CAMe9rOo2YHzPcENBotV+XYVBcBK+JL-gN2x78eKmsiUV+O+jbQ@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu May 10, 2017, 2:38 p.m. UTC
On Tue, May 9, 2017 at 7:32 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Apr 4, 2017 at 4:46 AM, Andreas Krebbel
> <krebbel@linux.vnet.ibm.com> wrote:
>> On 04/03/2017 06:18 PM, Eric Botcazou wrote:
>>>> On S/390 UNITS_PER_WORD is:
>>>> 8 with -m64
>>>> 4 with -m31
>>>> 8 with -m31 -mzarch
>>>>
>>>> This has been chosen to support use of 64 bit registers also in 32 bit
>>>> code.  Code compiled with -m31 -mzarch is supposed to adhere to the 32
>>>> bit ABI.  In order to make that work it was required to prevent
>>>> UNITS_PER_WORD from being used in ABI-relevant contexts.  That's why
>>>> Ulrich added the TARGET_UNWIND_WORD_MODE in 2008 (for SPU).
>>>
>>> We do that for 32-bit SPARC on Solaris (-mv8plus) but UNITS_PER_WORD is 4.
>>>
>>>> Now I could either fix this by reverting that change for S/390
>>>> (similiar to what Andreas Schwab did to fix the BZ) or I could just
>>>> use the size of the long data type (as we do in the ABI-relevant parts
>>>> of the backend as well).  Which one do you prefer?
>>>
>>> Having System.Word_Size != Standard'Word_Size is a bit disturbing.  Does it
>>> work to change only Memory_Size to 2 ** Long_Integer'Size?  This will also
>>> correct the definition of Address below.
>>
>> This worked as well. I've committed the following patch:
>>
>> gcc/ada/ChangeLog:
>>
>> 2017-04-04  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
>>
>>         * system-linux-s390.ads: Use Long_Integer'Size to define
>>         Memory_Size.
>> ---
>>  gcc/ada/system-linux-s390.ads | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gcc/ada/system-linux-s390.ads b/gcc/ada/system-linux-s390.ads
>> index 485a8de..9bf8375 100644
>> --- a/gcc/ada/system-linux-s390.ads
>> +++ b/gcc/ada/system-linux-s390.ads
>> @@ -70,7 +70,7 @@ package System is
>>
>>     Storage_Unit : constant := 8;
>>     Word_Size    : constant := Standard'Word_Size;
>> -   Memory_Size  : constant := 2 ** Word_Size;
>> +   Memory_Size  : constant := 2 ** Long_Integer'Size;
>>
>>     --  Address comparison
>>
>
> X32 needs something similar:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80626
>

Here is the patch:

X32 uses 64 as word size instead of 32.  This must not affect the
Address type definition which is based on Memory_Size.

PR ada/80626
* system-linux-x86.ads (Memory_Size): Use Long_Integer'Size
instead of Word_Size.

Tested on x86-64 with -m64/-m32/-mx32.   OK for trunk and
gcc-7-branch?

Thanks.

Comments

Arnaud Charlet May 10, 2017, 5:20 p.m. UTC | #1
> Here is the patch:
> 
> X32 uses 64 as word size instead of 32.  This must not affect the
> Address type definition which is based on Memory_Size.
> 
> PR ada/80626
> * system-linux-x86.ads (Memory_Size): Use Long_Integer'Size
> instead of Word_Size.
> 
> Tested on x86-64 with -m64/-m32/-mx32.   OK for trunk and
> gcc-7-branch?

That's OK.
diff mbox

Patch

From 813f0651e7c2a506903d0dfd0daff8895c339800 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 10 May 2017 07:31:21 -0700
Subject: [PATCH] Ada/x32: PR ada/80626: Correct Memory_Size

X32 uses 64 as word size instead of 32.  This must not affect the
Address type definition which is based on Memory_Size.

	PR ada/80626
	* system-linux-x86.ads (Memory_Size): Use Long_Integer'Size
	instead of Word_Size.
---
 gcc/ada/system-linux-x86.ads | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ada/system-linux-x86.ads b/gcc/ada/system-linux-x86.ads
index 22a212e..533d94e 100644
--- a/gcc/ada/system-linux-x86.ads
+++ b/gcc/ada/system-linux-x86.ads
@@ -70,7 +70,7 @@  package System is
 
    Storage_Unit : constant := 8;
    Word_Size    : constant := Standard'Word_Size;
-   Memory_Size  : constant := 2 ** Word_Size;
+   Memory_Size  : constant := 2 ** Long_Integer'Size;
 
    --  Address comparison
 
-- 
2.9.3