public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: Define TRY_EMPTY_VM_SPACE for Linux/x32
@ 2012-04-04  1:05 H.J. Lu
  0 siblings, 0 replies; 11+ messages in thread
From: H.J. Lu @ 2012-04-04  1:05 UTC (permalink / raw)
  To: gcc-patches

Hi,

This patch defines TRY_EMPTY_VM_SPACE for Linux/x32.  Tested on Linux/x32.
OK for trunk?

Thanks.


H.J.
---
2012-04-03  H.J. Lu  <hongjiu.lu@intel.com>

	* config/host-linux.c (TRY_EMPTY_VM_SPACE): Defined to
	0x60000000 for x32.

diff --git a/gcc/config/host-linux.c b/gcc/config/host-linux.c
index 94b7a0b..b89df46 100644
--- a/gcc/config/host-linux.c
+++ b/gcc/config/host-linux.c
@@ -68,8 +68,14 @@
 # define TRY_EMPTY_VM_SPACE	0x10000000000
 #elif defined(__ia64)
 # define TRY_EMPTY_VM_SPACE	0x2000000100000000
-#elif defined(__x86_64)
+/* __LP64__ is defined for LP64 after GCC 3.3.  If __LP64__ isn't
+   defined for GCC 4.0 or newer, it must be x32.  */
+#elif defined(__x86_64) && (defined(__LP64__) \
+			    || !defined(__GNUC__) \
+			    || __GNUC__ < 4)
 # define TRY_EMPTY_VM_SPACE	0x1000000000
+#elif defined(__x86_64)
+# define TRY_EMPTY_VM_SPACE	0x60000000
 #elif defined(__i386)
 # define TRY_EMPTY_VM_SPACE	0x60000000
 #elif defined(__powerpc__)

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

* Re: PATCH: Define TRY_EMPTY_VM_SPACE for Linux/x32
  2012-04-10 14:41               ` H.J. Lu
@ 2012-04-11 19:40                 ` H.J. Lu
  0 siblings, 0 replies; 11+ messages in thread
From: H.J. Lu @ 2012-04-11 19:40 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 1364 bytes --]

On Tue, Apr 10, 2012 at 7:41 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Apr 5, 2012 at 8:57 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Thu, Apr 5, 2012 at 8:36 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>> On Thu, Apr 5, 2012 at 3:28 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>
>>>>>>> Looking at how other targets implement this check, I don't think that
>>>>>>> this is a problem at all. This issue only shows on a non-bootstrapped
>>>>>>> build. A full bootstrap will use correct address.
>>>>>>
>>>>>> The other place where it shows up is cross compilers but who is going
>>>>>> to use a 3.2 compiler with GCC 4.8 anyways?
>>>>>>
>>>>>
>>>>> FWIW, I have no problem with checking __LP64__ only. I just want to
>>>>> mention this potential issue.
>>>>>
>>>>
>>>> Here is a different patch.  It checks sizeof (void *) for those hosts
>>>> where it is appropriate.  Does it look OK?
>>>
>>> Looks OK to me, but you need a GWP reviewer to OK this change now...
>>>
>>
>> Here is the patch with ChangeLog.  Tested on Linux/x32.  Jakub,
>> is this OK for trunk?
>>
>
> Hi Richard,
>
> Is this patch:
>
> http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00303.html
>
> OK for trunk?
>

I checked in this patch to check __x86_64 and __LP64__.
I will submit a followup patch to simplify it later.

Thanks.

-- 
H.J.

[-- Attachment #2: gcc-x32-pch-3.patch --]
[-- Type: application/octet-stream, Size: 720 bytes --]

2012-04-11  H.J. Lu  <hongjiu.lu@intel.com>

	* config/host-linux.c (TRY_EMPTY_VM_SPACE): Defined to
	0x60000000 if __x86_64 is defined and __LP64__ isn't defined.

diff --git a/gcc/config/host-linux.c b/gcc/config/host-linux.c
index 94b7a0b..b535758 100644
--- a/gcc/config/host-linux.c
+++ b/gcc/config/host-linux.c
@@ -68,8 +68,10 @@
 # define TRY_EMPTY_VM_SPACE	0x10000000000
 #elif defined(__ia64)
 # define TRY_EMPTY_VM_SPACE	0x2000000100000000
-#elif defined(__x86_64)
+#elif defined(__x86_64) && defined(__LP64__)
 # define TRY_EMPTY_VM_SPACE	0x1000000000
+#elif defined(__x86_64)
+# define TRY_EMPTY_VM_SPACE	0x60000000
 #elif defined(__i386)
 # define TRY_EMPTY_VM_SPACE	0x60000000
 #elif defined(__powerpc__)

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

* Re: PATCH: Define TRY_EMPTY_VM_SPACE for Linux/x32
  2012-04-05 15:58             ` H.J. Lu
@ 2012-04-10 14:41               ` H.J. Lu
  2012-04-11 19:40                 ` H.J. Lu
  0 siblings, 1 reply; 11+ messages in thread
From: H.J. Lu @ 2012-04-10 14:41 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Andrew Pinski, gcc-patches

On Thu, Apr 5, 2012 at 8:57 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Apr 5, 2012 at 8:36 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>> On Thu, Apr 5, 2012 at 3:28 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>
>>>>>> Looking at how other targets implement this check, I don't think that
>>>>>> this is a problem at all. This issue only shows on a non-bootstrapped
>>>>>> build. A full bootstrap will use correct address.
>>>>>
>>>>> The other place where it shows up is cross compilers but who is going
>>>>> to use a 3.2 compiler with GCC 4.8 anyways?
>>>>>
>>>>
>>>> FWIW, I have no problem with checking __LP64__ only. I just want to
>>>> mention this potential issue.
>>>>
>>>
>>> Here is a different patch.  It checks sizeof (void *) for those hosts
>>> where it is appropriate.  Does it look OK?
>>
>> Looks OK to me, but you need a GWP reviewer to OK this change now...
>>
>
> Here is the patch with ChangeLog.  Tested on Linux/x32.  Jakub,
> is this OK for trunk?
>

Hi Richard,

Is this patch:

http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00303.html

OK for trunk?

Thanks.


-- 
H.J.

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

* Re: PATCH: Define TRY_EMPTY_VM_SPACE for Linux/x32
  2012-04-05 15:36           ` Uros Bizjak
@ 2012-04-05 15:58             ` H.J. Lu
  2012-04-10 14:41               ` H.J. Lu
  0 siblings, 1 reply; 11+ messages in thread
From: H.J. Lu @ 2012-04-05 15:58 UTC (permalink / raw)
  To: Uros Bizjak, Jakub Jelinek; +Cc: Andrew Pinski, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 933 bytes --]

On Thu, Apr 5, 2012 at 8:36 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Thu, Apr 5, 2012 at 3:28 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>
>>>>> Looking at how other targets implement this check, I don't think that
>>>>> this is a problem at all. This issue only shows on a non-bootstrapped
>>>>> build. A full bootstrap will use correct address.
>>>>
>>>> The other place where it shows up is cross compilers but who is going
>>>> to use a 3.2 compiler with GCC 4.8 anyways?
>>>>
>>>
>>> FWIW, I have no problem with checking __LP64__ only. I just want to
>>> mention this potential issue.
>>>
>>
>> Here is a different patch.  It checks sizeof (void *) for those hosts
>> where it is appropriate.  Does it look OK?
>
> Looks OK to me, but you need a GWP reviewer to OK this change now...
>

Here is the patch with ChangeLog.  Tested on Linux/x32.  Jakub,
is this OK for trunk?

Thanks.


-- 
H.J.

[-- Attachment #2: gcc-x32-pch-2.patch --]
[-- Type: text/x-patch, Size: 1265 bytes --]

2012-04-03  H.J. Lu  <hongjiu.lu@intel.com>

	* config/host-linux.c (TRY_EMPTY_VM_SPACE): Check pointer size
	for alpha, arm, i386 and x86-64.

diff --git a/gcc/config/host-linux.c b/gcc/config/host-linux.c
index 94b7a0b..93c513e 100644
--- a/gcc/config/host-linux.c
+++ b/gcc/config/host-linux.c
@@ -64,14 +64,12 @@
 
 /* For various ports, try to guess a fixed spot in the vm space
    that's probably free.  */
-#if defined(__alpha)
-# define TRY_EMPTY_VM_SPACE	0x10000000000
+#if defined(__alpha) || defined(__ARM_EABI__) || defined(__i386) \
+    || defined(__x86_64)
+# define TRY_EMPTY_VM_SPACE	\
+  (sizeof (void *) == 8 ? 0x1000000000 : 0x60000000)
 #elif defined(__ia64)
 # define TRY_EMPTY_VM_SPACE	0x2000000100000000
-#elif defined(__x86_64)
-# define TRY_EMPTY_VM_SPACE	0x1000000000
-#elif defined(__i386)
-# define TRY_EMPTY_VM_SPACE	0x60000000
 #elif defined(__powerpc__)
 # define TRY_EMPTY_VM_SPACE	0x60000000
 #elif defined(__s390x__)
@@ -84,8 +82,6 @@
 # define TRY_EMPTY_VM_SPACE	0x60000000
 #elif defined(__mc68000__)
 # define TRY_EMPTY_VM_SPACE	0x40000000
-#elif defined(__ARM_EABI__)
-# define TRY_EMPTY_VM_SPACE     0x60000000
 #elif defined(__mips__) && defined(__LP64__)
 # define TRY_EMPTY_VM_SPACE	0x8000000000
 #elif defined(__mips__)

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

* Re: PATCH: Define TRY_EMPTY_VM_SPACE for Linux/x32
  2012-04-05 13:28         ` H.J. Lu
@ 2012-04-05 15:36           ` Uros Bizjak
  2012-04-05 15:58             ` H.J. Lu
  0 siblings, 1 reply; 11+ messages in thread
From: Uros Bizjak @ 2012-04-05 15:36 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Andrew Pinski, gcc-patches

On Thu, Apr 5, 2012 at 3:28 PM, H.J. Lu <hjl.tools@gmail.com> wrote:

>>>> Looking at how other targets implement this check, I don't think that
>>>> this is a problem at all. This issue only shows on a non-bootstrapped
>>>> build. A full bootstrap will use correct address.
>>>
>>> The other place where it shows up is cross compilers but who is going
>>> to use a 3.2 compiler with GCC 4.8 anyways?
>>>
>>
>> FWIW, I have no problem with checking __LP64__ only. I just want to
>> mention this potential issue.
>>
>
> Here is a different patch.  It checks sizeof (void *) for those hosts
> where it is appropriate.  Does it look OK?

Looks OK to me, but you need a GWP reviewer to OK this change now...

Thanks,
Uros.

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

* Re: PATCH: Define TRY_EMPTY_VM_SPACE for Linux/x32
  2012-04-04 18:57       ` H.J. Lu
@ 2012-04-05 13:28         ` H.J. Lu
  2012-04-05 15:36           ` Uros Bizjak
  0 siblings, 1 reply; 11+ messages in thread
From: H.J. Lu @ 2012-04-05 13:28 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: Uros Bizjak, gcc-patches

On Wed, Apr 4, 2012 at 11:56 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Apr 4, 2012 at 11:53 AM, Andrew Pinski <pinskia@gmail.com> wrote:
>> On Wed, Apr 4, 2012 at 11:50 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>> Looking at how other targets implement this check, I don't think that
>>> this is a problem at all. This issue only shows on a non-bootstrapped
>>> build. A full bootstrap will use correct address.
>>
>> The other place where it shows up is cross compilers but who is going
>> to use a 3.2 compiler with GCC 4.8 anyways?
>>
>
> FWIW, I have no problem with checking __LP64__ only. I just want to
> mention this potential issue.
>

Here is a different patch.  It checks sizeof (void *) for those hosts
where it is appropriate.  Does it look OK?

Thanks.


-- 
H.J.
---
diff --git a/gcc/config/host-linux.c b/gcc/config/host-linux.c
index 94b7a0b..93c513e 100644
--- a/gcc/config/host-linux.c
+++ b/gcc/config/host-linux.c
@@ -64,14 +64,12 @@

 /* For various ports, try to guess a fixed spot in the vm space
    that's probably free.  */
-#if defined(__alpha)
-# define TRY_EMPTY_VM_SPACE	0x10000000000
+#if defined(__alpha) || defined(__ARM_EABI__) || defined(__i386) \
+    || defined(__x86_64)
+# define TRY_EMPTY_VM_SPACE	\
+  (sizeof (void *) == 8 ? 0x1000000000 : 0x60000000)
 #elif defined(__ia64)
 # define TRY_EMPTY_VM_SPACE	0x2000000100000000
-#elif defined(__x86_64)
-# define TRY_EMPTY_VM_SPACE	0x1000000000
-#elif defined(__i386)
-# define TRY_EMPTY_VM_SPACE	0x60000000
 #elif defined(__powerpc__)
 # define TRY_EMPTY_VM_SPACE	0x60000000
 #elif defined(__s390x__)
@@ -84,8 +82,6 @@
 # define TRY_EMPTY_VM_SPACE	0x60000000
 #elif defined(__mc68000__)
 # define TRY_EMPTY_VM_SPACE	0x40000000
-#elif defined(__ARM_EABI__)
-# define TRY_EMPTY_VM_SPACE     0x60000000
 #elif defined(__mips__) && defined(__LP64__)
 # define TRY_EMPTY_VM_SPACE	0x8000000000
 #elif defined(__mips__)

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

* Re: PATCH: Define TRY_EMPTY_VM_SPACE for Linux/x32
  2012-04-04 18:53     ` Andrew Pinski
@ 2012-04-04 18:57       ` H.J. Lu
  2012-04-05 13:28         ` H.J. Lu
  0 siblings, 1 reply; 11+ messages in thread
From: H.J. Lu @ 2012-04-04 18:57 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: Uros Bizjak, gcc-patches

On Wed, Apr 4, 2012 at 11:53 AM, Andrew Pinski <pinskia@gmail.com> wrote:
> On Wed, Apr 4, 2012 at 11:50 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>> Looking at how other targets implement this check, I don't think that
>> this is a problem at all. This issue only shows on a non-bootstrapped
>> build. A full bootstrap will use correct address.
>
> The other place where it shows up is cross compilers but who is going
> to use a 3.2 compiler with GCC 4.8 anyways?
>

FWIW, I have no problem with checking __LP64__ only. I just want to
mention this potential issue.

Thanks.

-- 
H.J.

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

* Re: PATCH: Define TRY_EMPTY_VM_SPACE for Linux/x32
  2012-04-04 18:51   ` Uros Bizjak
@ 2012-04-04 18:53     ` Andrew Pinski
  2012-04-04 18:57       ` H.J. Lu
  0 siblings, 1 reply; 11+ messages in thread
From: Andrew Pinski @ 2012-04-04 18:53 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: H.J. Lu, gcc-patches

On Wed, Apr 4, 2012 at 11:50 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> Looking at how other targets implement this check, I don't think that
> this is a problem at all. This issue only shows on a non-bootstrapped
> build. A full bootstrap will use correct address.

The other place where it shows up is cross compilers but who is going
to use a 3.2 compiler with GCC 4.8 anyways?

-- Pinski

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

* Re: PATCH: Define TRY_EMPTY_VM_SPACE for Linux/x32
  2012-04-04 18:47 ` H.J. Lu
@ 2012-04-04 18:51   ` Uros Bizjak
  2012-04-04 18:53     ` Andrew Pinski
  0 siblings, 1 reply; 11+ messages in thread
From: Uros Bizjak @ 2012-04-04 18:51 UTC (permalink / raw)
  To: H.J. Lu; +Cc: gcc-patches

On Wed, Apr 4, 2012 at 8:47 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Apr 4, 2012 at 11:08 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>> Hello!
>>
>>> This patch defines TRY_EMPTY_VM_SPACE for Linux/x32.  Tested on Linux/x32.
>>> OK for trunk?
>>>
>>> 2012-04-03  H.J. Lu  <hongjiu.lu@intel.com>
>>>
>>>       * config/host-linux.c (TRY_EMPTY_VM_SPACE): Defined to
>>>       0x60000000 for x32.
>>
>> I think we can simply check for __LP64__, without version check, as is
>> the case with SPARC and MIPS targets.
>
> When you compile GCC 4.8 with GCC 3.2 on Linux/x86-64,
> __LP64__ won't be defined and TRY_EMPTY_VM_SPACE
> will be 0x60000000 instead of 0x1000000000.

Looking at how other targets implement this check, I don't think that
this is a problem at all. This issue only shows on a non-bootstrapped
build. A full bootstrap will use correct address.

Uros.

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

* Re: PATCH: Define TRY_EMPTY_VM_SPACE for Linux/x32
  2012-04-04 18:08 Uros Bizjak
@ 2012-04-04 18:47 ` H.J. Lu
  2012-04-04 18:51   ` Uros Bizjak
  0 siblings, 1 reply; 11+ messages in thread
From: H.J. Lu @ 2012-04-04 18:47 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches

On Wed, Apr 4, 2012 at 11:08 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> Hello!
>
>> This patch defines TRY_EMPTY_VM_SPACE for Linux/x32.  Tested on Linux/x32.
>> OK for trunk?
>>
>> 2012-04-03  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>       * config/host-linux.c (TRY_EMPTY_VM_SPACE): Defined to
>>       0x60000000 for x32.
>
> I think we can simply check for __LP64__, without version check, as is
> the case with SPARC and MIPS targets.
>
> Uros.
>
> Index: host-linux.c
> ===================================================================
> --- host-linux.c        (revision 186141)
> +++ host-linux.c        (working copy)
> @@ -68,8 +68,10 @@
>  # define TRY_EMPTY_VM_SPACE    0x10000000000
>  #elif defined(__ia64)
>  # define TRY_EMPTY_VM_SPACE    0x2000000100000000
> +#elif defined(__x86_64) && defined(__LP64__)
> +# define TRY_EMPTY_VM_SPACE    0x1000000000
>  #elif defined(__x86_64)
> -# define TRY_EMPTY_VM_SPACE    0x1000000000
> +# define TRY_EMPTY_VM_SPACE    0x60000000
>  #elif defined(__i386)
>  # define TRY_EMPTY_VM_SPACE    0x60000000
>  #elif defined(__powerpc__)

When you compile GCC 4.8 with GCC 3.2 on Linux/x86-64,
__LP64__ won't be defined and TRY_EMPTY_VM_SPACE
will be 0x60000000 instead of 0x1000000000.


-- 
H.J.

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

* Re: PATCH: Define TRY_EMPTY_VM_SPACE for Linux/x32
@ 2012-04-04 18:08 Uros Bizjak
  2012-04-04 18:47 ` H.J. Lu
  0 siblings, 1 reply; 11+ messages in thread
From: Uros Bizjak @ 2012-04-04 18:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: H.J. Lu

Hello!

> This patch defines TRY_EMPTY_VM_SPACE for Linux/x32.  Tested on Linux/x32.
> OK for trunk?
>
> 2012-04-03  H.J. Lu  <hongjiu.lu@intel.com>
>
> 	* config/host-linux.c (TRY_EMPTY_VM_SPACE): Defined to
> 	0x60000000 for x32.

I think we can simply check for __LP64__, without version check, as is
the case with SPARC and MIPS targets.

Uros.

Index: host-linux.c
===================================================================
--- host-linux.c        (revision 186141)
+++ host-linux.c        (working copy)
@@ -68,8 +68,10 @@
 # define TRY_EMPTY_VM_SPACE    0x10000000000
 #elif defined(__ia64)
 # define TRY_EMPTY_VM_SPACE    0x2000000100000000
+#elif defined(__x86_64) && defined(__LP64__)
+# define TRY_EMPTY_VM_SPACE    0x1000000000
 #elif defined(__x86_64)
-# define TRY_EMPTY_VM_SPACE    0x1000000000
+# define TRY_EMPTY_VM_SPACE    0x60000000
 #elif defined(__i386)
 # define TRY_EMPTY_VM_SPACE    0x60000000
 #elif defined(__powerpc__)

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

end of thread, other threads:[~2012-04-11 19:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04  1:05 PATCH: Define TRY_EMPTY_VM_SPACE for Linux/x32 H.J. Lu
2012-04-04 18:08 Uros Bizjak
2012-04-04 18:47 ` H.J. Lu
2012-04-04 18:51   ` Uros Bizjak
2012-04-04 18:53     ` Andrew Pinski
2012-04-04 18:57       ` H.J. Lu
2012-04-05 13:28         ` H.J. Lu
2012-04-05 15:36           ` Uros Bizjak
2012-04-05 15:58             ` H.J. Lu
2012-04-10 14:41               ` H.J. Lu
2012-04-11 19:40                 ` 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).