public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFC]: Fix Ada boostrap failure on S/390 with -mzarch
@ 2017-04-03 14:23 Andreas Krebbel
  2017-04-03 16:18 ` Eric Botcazou
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Krebbel @ 2017-04-03 14:23 UTC (permalink / raw)
  To: ebotcazou; +Cc: gcc-patches

Hi Eric,

I ran into a similiar problem as PR80117 on S/390 starting with your
patch merging the system*.ads files for some biarch plattforms.
Starting with that change GCC does not bootstrap on S/390 when
configured with --with-mode=zarch.

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).

More target hooks were needed for UNITS_PER_WORD uses in libgcc:
TARGET_LIBGCC_CMP_RETURN_MODE, and TARGET_LIBGCC_SHIFT_COUNT_MODE.

The use of the UNITS_PER_WORD in the system.ads files looks like
adding another ABI/API-relevant use to me.

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?

Bye,

-Andreas-



diff --git a/gcc/ada/system-linux-s390.ads b/gcc/ada/system-linux-s390.ads
index 485a8de..144c46d 100644
--- a/gcc/ada/system-linux-s390.ads
+++ b/gcc/ada/system-linux-s390.ads
@@ -69,7 +69,7 @@ package System is
    Null_Address : constant Address;
 
    Storage_Unit : constant := 8;
-   Word_Size    : constant := Standard'Word_Size;
+   Word_Size    : constant := Long_Integer'Size;
    Memory_Size  : constant := 2 ** Word_Size;
 
    --  Address comparison

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC]: Fix Ada boostrap failure on S/390 with -mzarch
  2017-04-03 14:23 [RFC]: Fix Ada boostrap failure on S/390 with -mzarch Andreas Krebbel
@ 2017-04-03 16:18 ` Eric Botcazou
  2017-04-04 11:46   ` Andreas Krebbel
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Botcazou @ 2017-04-03 16:18 UTC (permalink / raw)
  To: Andreas Krebbel; +Cc: gcc-patches

> 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.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC]: Fix Ada boostrap failure on S/390 with -mzarch
  2017-04-03 16:18 ` Eric Botcazou
@ 2017-04-04 11:46   ` Andreas Krebbel
  2017-04-04 17:42     ` Eric Botcazou
  2017-05-10  2:54     ` H.J. Lu
  0 siblings, 2 replies; 5+ messages in thread
From: Andreas Krebbel @ 2017-04-04 11:46 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC]: Fix Ada boostrap failure on S/390 with -mzarch
  2017-04-04 11:46   ` Andreas Krebbel
@ 2017-04-04 17:42     ` Eric Botcazou
  2017-05-10  2:54     ` H.J. Lu
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Botcazou @ 2017-04-04 17:42 UTC (permalink / raw)
  To: Andreas Krebbel; +Cc: gcc-patches

> 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!

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC]: Fix Ada boostrap failure on S/390 with -mzarch
  2017-04-04 11:46   ` Andreas Krebbel
  2017-04-04 17:42     ` Eric Botcazou
@ 2017-05-10  2:54     ` H.J. Lu
  1 sibling, 0 replies; 5+ messages in thread
From: H.J. Lu @ 2017-05-10  2:54 UTC (permalink / raw)
  To: Andreas Krebbel; +Cc: Eric Botcazou, GCC Patches

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

-- 
H.J.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-05-10  2:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-03 14:23 [RFC]: Fix Ada boostrap failure on S/390 with -mzarch Andreas Krebbel
2017-04-03 16:18 ` Eric Botcazou
2017-04-04 11:46   ` Andreas Krebbel
2017-04-04 17:42     ` Eric Botcazou
2017-05-10  2:54     ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).