diff mbox

PATCH [1/n] X32: Add initial -x32 support

Message ID CAMe9rOpQ3uqJoT6dq-z9EHi_LDOsfzLNtEQB2Zb_0SB8PW05fQ@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu July 6, 2011, 4:22 p.m. UTC
On Wed, Jul 6, 2011 at 8:02 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Wed, Jul 6, 2011 at 4:48 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> Hi Paolo, DJ, Nathanael, Alexandre, Ralf,
>>
>> Is the change
>> .
>>        * configure.ac: Support --enable-x32.
>>        * configure: Regenerated.
>>
>> diff --git a/gcc/configure.ac b/gcc/configure.ac
>> index 5f3641b..bddabeb 100644
>> --- a/gcc/configure.ac
>> +++ b/gcc/configure.ac
>> @@ -611,6 +611,11 @@ AC_ARG_ENABLE(multilib,
>>  [], [enable_multilib=yes])
>>  AC_SUBST(enable_multilib)
>>
>> +# With x32 support
>> +AC_ARG_ENABLE(x32,
>> +[  --enable-x32            enable x32 library support for multiple ABIs],
>
> Looks like a very very generic switch for a global configury ... we already
> have --with-multilib-list (SH only), why not extend that to also work
> for x86_64?
>
> Richard.
>
>> +[], [enable_x32=no])
>> +
>>  # Enable __cxa_atexit for C++.
>>  AC_ARG_ENABLE(__cxa_atexit,
>>  [AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],
>>
>> OK?
>>
>> Thanks.
>>

Here is the updated patch to use --with-multilib-list=x32.

Paolo, DJ, Nathanael, Alexandre, Ralf, Is the configure.ac change

---
	* configure.ac: Mention x86-64 for --with-multilib-list.
	* configure: Regenerated.

	* doc/install.texi: Document --with-multilib-list=x32.

---

OK?

Thanks.

Comments

H.J. Lu July 7, 2011, 12:59 p.m. UTC | #1
On Wed, Jul 6, 2011 at 9:22 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Jul 6, 2011 at 8:02 AM, Richard Guenther
> <richard.guenther@gmail.com> wrote:
>> On Wed, Jul 6, 2011 at 4:48 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> Hi Paolo, DJ, Nathanael, Alexandre, Ralf,
>>>
>>> Is the change
>>> .
>>>        * configure.ac: Support --enable-x32.
>>>        * configure: Regenerated.
>>>
>>> diff --git a/gcc/configure.ac b/gcc/configure.ac
>>> index 5f3641b..bddabeb 100644
>>> --- a/gcc/configure.ac
>>> +++ b/gcc/configure.ac
>>> @@ -611,6 +611,11 @@ AC_ARG_ENABLE(multilib,
>>>  [], [enable_multilib=yes])
>>>  AC_SUBST(enable_multilib)
>>>
>>> +# With x32 support
>>> +AC_ARG_ENABLE(x32,
>>> +[  --enable-x32            enable x32 library support for multiple ABIs],
>>
>> Looks like a very very generic switch for a global configury ... we already
>> have --with-multilib-list (SH only), why not extend that to also work
>> for x86_64?
>>
>> Richard.
>>
>>> +[], [enable_x32=no])
>>> +
>>>  # Enable __cxa_atexit for C++.
>>>  AC_ARG_ENABLE(__cxa_atexit,
>>>  [AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],
>>>
>>> OK?
>>>
>>> Thanks.
>>>
>
> Here is the updated patch to use --with-multilib-list=x32.
>
> Paolo, DJ, Nathanael, Alexandre, Ralf, Is the configure.ac change
>
> ---
>        * configure.ac: Mention x86-64 for --with-multilib-list.
>        * configure: Regenerated.
>
>        * doc/install.texi: Document --with-multilib-list=x32.
>
> diff --git a/gcc/configure.ac b/gcc/configure.ac
> index 5f3641b..a73f758 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -795,7 +795,7 @@ esac],
>  [enable_languages=c])
>
>  AC_ARG_WITH(multilib-list,
> -[AS_HELP_STRING([--with-multilib-list], [select multilibs (SH only)])],
> +[AS_HELP_STRING([--with-multilib-list], [select multilibs (SH and
> x86-64 only)])],
>  :,
>  with_multilib_list=default)
>
> diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
> index 49aac95..a5d266c 100644
> --- a/gcc/doc/install.texi
> +++ b/gcc/doc/install.texi
> @@ -1049,8 +1049,10 @@ sysv, aix.
>  @item --with-multilib-list=@var{list}
>  @itemx --without-multilib-list
>  Specify what multilibs to build.
> -Currently only implemented for sh*-*-*.
> +Currently only implemented for sh*-*-* and x86-64-*-linux*.
>
> +@table @code
> +@item sh*-*-*
>  @var{list} is a comma separated list of CPU names.  These must be of the
>  form @code{sh*} or @code{m*} (in which case they match the compiler option
>  for that processor).  The list should not contain any endian options -
> @@ -1082,6 +1084,12 @@ only little endian SH4AL:
>  --with-multilib-list=sh4al,!mb/m4al
>  @end smallexample
>
> +@item x86-64-*-linux*
> +If @var{list} is @code{x32}, x32 run-time library will be enabled.  By
> +default, x32 run-time library is disabled.
> +
> +@end table
> +
>  @item --with-endian=@var{endians}
>  Specify what endians to use.
>  Currently only implemented for sh*-*-*.
> ---
>
> OK?
>
> Thanks.
>
> --
> H.J.
> ---
> 2011-07-06  H.J. Lu  <hongjiu.lu@intel.com>
>
>        * config.gcc: Support --with-multilib-list=x32 for x86 Linux
>        targets.
>
>        * configure.ac: Mention x86-64 for --with-multilib-list.
>        * configure: Regenerated.
>
>        * config/i386/gnu-user64.h (SPEC_64): Support x32.
>        (SPEC_32): Likewise.
>        (ASM_SPEC): Likewise.
>        (LINK_SPEC): Likewise.
>        (TARGET_THREAD_SSP_OFFSET): Likewise.
>        (TARGET_THREAD_SPLIT_STACK_OFFSET): Likewise.
>        (SPEC_X32): New.
>
>        * config/i386/i386.h (TARGET_X32): New.
>        (TARGET_LP64): New.
>        (LONG_TYPE_SIZE): Likewise.
>        (POINTER_SIZE): Likewise.
>        (POINTERS_EXTEND_UNSIGNED): Likewise.
>        (OPT_ARCH64): Support x32.
>        (OPT_ARCH32): Likewise.
>
>        * config/i386/i386.opt (mx32): New.
>
>        * config/i386/kfreebsd-gnu64.h (GNU_USER_LINK_EMULATIONX32): New.
>        (GLIBC_DYNAMIC_LINKERX32): Likewise.
>        * config/i386/linux64.h (GNU_USER_LINK_EMULATIONX32): Likewise.
>        (GLIBC_DYNAMIC_LINKERX32): Likewise.
>
>        * config/i386/t-linux-x32: New.
>
>        * config/linux.h (UCLIBC_DYNAMIC_LINKERX32): New.
>        (BIONIC_DYNAMIC_LINKERX32): Likewise.
>        (GNU_USER_DYNAMIC_LINKERX32): Likewise.
>
>        * doc/install.texi: Document --with-multilib-list=x32.
>
>        * doc/invoke.texi: Document -mx32.
>

Hi Uros,

This new version only adds a comment to configure.ac.  OK to install?

Thanks.
Uros Bizjak July 7, 2011, 1:05 p.m. UTC | #2
On Thu, Jul 7, 2011 at 2:59 PM, H.J. Lu <hjl.tools@gmail.com> wrote:

>>>> Hi Paolo, DJ, Nathanael, Alexandre, Ralf,
>>>>
>>>> Is the change
>>>> .
>>>>        * configure.ac: Support --enable-x32.
>>>>        * configure: Regenerated.
>>>>
>>>> diff --git a/gcc/configure.ac b/gcc/configure.ac
>>>> index 5f3641b..bddabeb 100644
>>>> --- a/gcc/configure.ac
>>>> +++ b/gcc/configure.ac
>>>> @@ -611,6 +611,11 @@ AC_ARG_ENABLE(multilib,
>>>>  [], [enable_multilib=yes])
>>>>  AC_SUBST(enable_multilib)
>>>>
>>>> +# With x32 support
>>>> +AC_ARG_ENABLE(x32,
>>>> +[  --enable-x32            enable x32 library support for multiple ABIs],
>>>
>>> Looks like a very very generic switch for a global configury ... we already
>>> have --with-multilib-list (SH only), why not extend that to also work
>>> for x86_64?
>>>
>>> Richard.
>>>
>>>> +[], [enable_x32=no])
>>>> +
>>>>  # Enable __cxa_atexit for C++.
>>>>  AC_ARG_ENABLE(__cxa_atexit,
>>>>  [AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],
>>>>
>>>> OK?
>>>>
>>>> Thanks.
>>>>
>>
>> Here is the updated patch to use --with-multilib-list=x32.
>>
>> Paolo, DJ, Nathanael, Alexandre, Ralf, Is the configure.ac change
>>
>> ---
>>        * configure.ac: Mention x86-64 for --with-multilib-list.
>>        * configure: Regenerated.
>>
>>        * doc/install.texi: Document --with-multilib-list=x32.
>>
>> diff --git a/gcc/configure.ac b/gcc/configure.ac
>> index 5f3641b..a73f758 100644
>> --- a/gcc/configure.ac
>> +++ b/gcc/configure.ac
>> @@ -795,7 +795,7 @@ esac],
>>  [enable_languages=c])
>>
>>  AC_ARG_WITH(multilib-list,
>> -[AS_HELP_STRING([--with-multilib-list], [select multilibs (SH only)])],
>> +[AS_HELP_STRING([--with-multilib-list], [select multilibs (SH and
>> x86-64 only)])],
>>  :,
>>  with_multilib_list=default)
>>
>> diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
>> index 49aac95..a5d266c 100644
>> --- a/gcc/doc/install.texi
>> +++ b/gcc/doc/install.texi
>> @@ -1049,8 +1049,10 @@ sysv, aix.
>>  @item --with-multilib-list=@var{list}
>>  @itemx --without-multilib-list
>>  Specify what multilibs to build.
>> -Currently only implemented for sh*-*-*.
>> +Currently only implemented for sh*-*-* and x86-64-*-linux*.
>>
>> +@table @code
>> +@item sh*-*-*
>>  @var{list} is a comma separated list of CPU names.  These must be of the
>>  form @code{sh*} or @code{m*} (in which case they match the compiler option
>>  for that processor).  The list should not contain any endian options -
>> @@ -1082,6 +1084,12 @@ only little endian SH4AL:
>>  --with-multilib-list=sh4al,!mb/m4al
>>  @end smallexample
>>
>> +@item x86-64-*-linux*
>> +If @var{list} is @code{x32}, x32 run-time library will be enabled.  By
>> +default, x32 run-time library is disabled.
>> +
>> +@end table
>> +
>>  @item --with-endian=@var{endians}
>>  Specify what endians to use.
>>  Currently only implemented for sh*-*-*.
>> ---
>>
>> OK?
>>
>> Thanks.
>>
>> --
>> H.J.
>> ---
>> 2011-07-06  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>        * config.gcc: Support --with-multilib-list=x32 for x86 Linux
>>        targets.
>>
>>        * configure.ac: Mention x86-64 for --with-multilib-list.
>>        * configure: Regenerated.
>>
>>        * config/i386/gnu-user64.h (SPEC_64): Support x32.
>>        (SPEC_32): Likewise.
>>        (ASM_SPEC): Likewise.
>>        (LINK_SPEC): Likewise.
>>        (TARGET_THREAD_SSP_OFFSET): Likewise.
>>        (TARGET_THREAD_SPLIT_STACK_OFFSET): Likewise.
>>        (SPEC_X32): New.
>>
>>        * config/i386/i386.h (TARGET_X32): New.
>>        (TARGET_LP64): New.
>>        (LONG_TYPE_SIZE): Likewise.
>>        (POINTER_SIZE): Likewise.
>>        (POINTERS_EXTEND_UNSIGNED): Likewise.
>>        (OPT_ARCH64): Support x32.
>>        (OPT_ARCH32): Likewise.
>>
>>        * config/i386/i386.opt (mx32): New.
>>
>>        * config/i386/kfreebsd-gnu64.h (GNU_USER_LINK_EMULATIONX32): New.
>>        (GLIBC_DYNAMIC_LINKERX32): Likewise.
>>        * config/i386/linux64.h (GNU_USER_LINK_EMULATIONX32): Likewise.
>>        (GLIBC_DYNAMIC_LINKERX32): Likewise.
>>
>>        * config/i386/t-linux-x32: New.
>>
>>        * config/linux.h (UCLIBC_DYNAMIC_LINKERX32): New.
>>        (BIONIC_DYNAMIC_LINKERX32): Likewise.
>>        (GNU_USER_DYNAMIC_LINKERX32): Likewise.
>>
>>        * doc/install.texi: Document --with-multilib-list=x32.
>>
>>        * doc/invoke.texi: Document -mx32.
>>
>
> Hi Uros,
>
> This new version only adds a comment to configure.ac.  OK to install?

OK.

Thanks,
Uros.
Paolo Bonzini July 7, 2011, 1:21 p.m. UTC | #3
Did you even _think_ of looking at the sh configury, and do something
vaguely similar for x86?

You should not duplicate t-linux64 at all.  Instead, in config.gcc set
m64/m32 as the default value for with_multilib_list on i386 biarch and
x86_64.  Pass $with_multilib_list to t-linux64 using
TM_MULTILIB_CONFIG.  Then, do something like

comma=,
MULTILIB_OPTIONS    = $(subst $(comma),/,@TM_MULTILIB_CONFIG@)
MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
MULTILIB_OSDIRNAMES  = 64=../lib64
MULTILIB_OSDIRNAMES += 32=$(if $(wildcard $(shell echo
$(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
MULTILIB_OSDIRNAMES += x32=../libx32

in config/t-linux64.  (Each on one line, apologies for any wrapping)

The option will be used as --with-multilib-list=m64,m32,mx32 (allowing
the user to omit some of the variants, too).

Paolo
diff mbox

Patch

diff --git a/gcc/configure.ac b/gcc/configure.ac
index 5f3641b..a73f758 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -795,7 +795,7 @@  esac],
 [enable_languages=c])

 AC_ARG_WITH(multilib-list,
-[AS_HELP_STRING([--with-multilib-list], [select multilibs (SH only)])],
+[AS_HELP_STRING([--with-multilib-list], [select multilibs (SH and
x86-64 only)])],
 :,
 with_multilib_list=default)

diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 49aac95..a5d266c 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1049,8 +1049,10 @@  sysv, aix.
 @item --with-multilib-list=@var{list}
 @itemx --without-multilib-list
 Specify what multilibs to build.
-Currently only implemented for sh*-*-*.
+Currently only implemented for sh*-*-* and x86-64-*-linux*.

+@table @code
+@item sh*-*-*
 @var{list} is a comma separated list of CPU names.  These must be of the
 form @code{sh*} or @code{m*} (in which case they match the compiler option
 for that processor).  The list should not contain any endian options -
@@ -1082,6 +1084,12 @@  only little endian SH4AL:
 --with-multilib-list=sh4al,!mb/m4al
 @end smallexample

+@item x86-64-*-linux*
+If @var{list} is @code{x32}, x32 run-time library will be enabled.  By
+default, x32 run-time library is disabled.
+
+@end table
+
 @item --with-endian=@var{endians}
 Specify what endians to use.
 Currently only implemented for sh*-*-*.