diff mbox

[RFC] : Fix Ada boostrap failure on S/390 with -mzarch

Message ID 488cbb73-5d39-dfd3-c1bb-2f109e6ed9d7@linux.vnet.ibm.com
State New
Headers show

Commit Message

Andreas Krebbel April 4, 2017, 11:46 a.m. UTC
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(-)

Comments

Eric Botcazou April 4, 2017, 5:42 p.m. UTC | #1
> 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.

Thanks!
H.J. Lu May 10, 2017, 2:32 a.m. UTC | #2
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
diff mbox

Patch

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