Patchwork PATCH: Define TRY_EMPTY_VM_SPACE for Linux/x32

login
register
mail settings
Submitter Uros Bizjak
Date April 4, 2012, 6:08 p.m.
Message ID <CAFULd4afnrbE0vzrBE6v24GJkjLv8hB13YzpFTvTPb=Coy5pZw@mail.gmail.com>
Download mbox | patch
Permalink /patch/150777/
State New
Headers show

Comments

Uros Bizjak - April 4, 2012, 6:08 p.m.
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.
H.J. Lu - April 4, 2012, 6:47 p.m.
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.
Uros Bizjak - April 4, 2012, 6:50 p.m.
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.
Andrew Pinski - April 4, 2012, 6:53 p.m.
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
H.J. Lu - April 4, 2012, 6:56 p.m.
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.

Patch

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