diff mbox

PATCH: PR target/53539: Different __WCHAR_TYPE__/wchar_t for gcc -m32 on Linux/i386 and Linux/x86-64

Message ID CAMe9rOrHG_AOrXGbouO=pe3gp_pO=QasDTeyZ=rRjv+UOoqfbw@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu May 31, 2012, 2:10 p.m. UTC
On Thu, May 31, 2012 at 6:50 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, May 31, 2012 at 06:35:19AM -0700, H.J. Lu wrote:
>> This patch makes __WCHAR_TYPE__/wchar_t the same for gcc -m32 on
>> Linux/i386 and Linux/x86-64.  OK for trunk?
>
> That looks wrong.  For Linux/i386, the 32-bit only compiler should be
> the standard, rather than x86_64 -m32 if they differ.
> So, IMHO you should keep gnu-user.h as is, and just use
> #define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
> in gcc/config/i386/x86-64.h.
>

You are right on Linux/i386.  But we should change config/i386/gnu-user64.h,
not x86-64.h since most of other i386 OSes use int for wchar.  Also we should
check TARGET_LP64 to keep x32 as close to i386 as possible.  OK for
trunk and 4.7?

Thanks.

Comments

H.J. Lu June 4, 2012, 12:54 p.m. UTC | #1
On Thu, May 31, 2012 at 7:10 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, May 31, 2012 at 6:50 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Thu, May 31, 2012 at 06:35:19AM -0700, H.J. Lu wrote:
>>> This patch makes __WCHAR_TYPE__/wchar_t the same for gcc -m32 on
>>> Linux/i386 and Linux/x86-64.  OK for trunk?
>>
>> That looks wrong.  For Linux/i386, the 32-bit only compiler should be
>> the standard, rather than x86_64 -m32 if they differ.
>> So, IMHO you should keep gnu-user.h as is, and just use
>> #define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
>> in gcc/config/i386/x86-64.h.
>>
>
> You are right on Linux/i386.  But we should change config/i386/gnu-user64.h,
> not x86-64.h since most of other i386 OSes use int for wchar.  Also we should
> check TARGET_LP64 to keep x32 as close to i386 as possible.  OK for
> trunk and 4.7?
>
> Thanks.

Hi  Richard, Honza, Uros,

Is this patch OK for trunk and 4.7?

H.J.
--
>
> --
> H.J.
> ----
> 2012-05-31  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR target/53539
>        * config/i386/gnu-user64.h (WCHAR_TYPE): Use "int" only for
>        TARGET_LP64.
>
> diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
> index 0e66d26..2941332 100644
> --- a/gcc/config/i386/gnu-user64.h
> +++ b/gcc/config/i386/gnu-user64.h
> @@ -91,3 +91,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If n
> ot, see
>  #define TARGET_THREAD_SPLIT_STACK_OFFSET \
>   (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x30)
>  #endif
> +
> +#undef WCHAR_TYPE
> +#define WCHAR_TYPE (TARGET_LP64 ? "int" : "long int")
H.J. Lu June 29, 2012, 6:10 p.m. UTC | #2
On Thu, May 31, 2012 at 7:10 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, May 31, 2012 at 6:50 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Thu, May 31, 2012 at 06:35:19AM -0700, H.J. Lu wrote:
>>> This patch makes __WCHAR_TYPE__/wchar_t the same for gcc -m32 on
>>> Linux/i386 and Linux/x86-64.  OK for trunk?
>>
>> That looks wrong.  For Linux/i386, the 32-bit only compiler should be
>> the standard, rather than x86_64 -m32 if they differ.
>> So, IMHO you should keep gnu-user.h as is, and just use
>> #define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
>> in gcc/config/i386/x86-64.h.
>>
>
> You are right on Linux/i386.  But we should change config/i386/gnu-user64.h,
> not x86-64.h since most of other i386 OSes use int for wchar.  Also we should
> check TARGET_LP64 to keep x32 as close to i386 as possible.  OK for
> trunk?
>
> Thanks.
>
>
> --
> H.J.
> ----
> 2012-05-31  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR target/53539
>        * config/i386/gnu-user64.h (WCHAR_TYPE): Use "int" only for
>        TARGET_LP64.
>
> diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
> index 0e66d26..2941332 100644
> --- a/gcc/config/i386/gnu-user64.h
> +++ b/gcc/config/i386/gnu-user64.h
> @@ -91,3 +91,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If n
> ot, see
>  #define TARGET_THREAD_SPLIT_STACK_OFFSET \
>   (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x30)
>  #endif
> +
> +#undef WCHAR_TYPE
> +#define WCHAR_TYPE (TARGET_LP64 ? "int" : "long int")

Hi Richard,

Is this patch OK for trunk?

Thanks.
Richard Henderson June 29, 2012, 9:43 p.m. UTC | #3
On 06/29/2012 11:10 AM, H.J. Lu wrote:
>> 2012-05-31  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>        PR target/53539
>>        * config/i386/gnu-user64.h (WCHAR_TYPE): Use "int" only for
>>        TARGET_LP64.
>>
>> diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
>> index 0e66d26..2941332 100644
>> --- a/gcc/config/i386/gnu-user64.h
>> +++ b/gcc/config/i386/gnu-user64.h
>> @@ -91,3 +91,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If n
>> ot, see
>>  #define TARGET_THREAD_SPLIT_STACK_OFFSET \
>>   (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x30)
>>  #endif
>> +
>> +#undef WCHAR_TYPE
>> +#define WCHAR_TYPE (TARGET_LP64 ? "int" : "long int")
> 
> Hi Richard,
> 
> Is this patch OK for trunk?
> 
> Thanks.

Yes, this is fine.


r~
H.J. Lu July 6, 2012, 6:27 p.m. UTC | #4
On Fri, Jun 29, 2012 at 2:43 PM, Richard Henderson <rth@redhat.com> wrote:
> On 06/29/2012 11:10 AM, H.J. Lu wrote:
>>> 2012-05-31  H.J. Lu  <hongjiu.lu@intel.com>
>>>
>>>        PR target/53539
>>>        * config/i386/gnu-user64.h (WCHAR_TYPE): Use "int" only for
>>>        TARGET_LP64.
>>>
>>> diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
>>> index 0e66d26..2941332 100644
>>> --- a/gcc/config/i386/gnu-user64.h
>>> +++ b/gcc/config/i386/gnu-user64.h
>>> @@ -91,3 +91,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If n
>>> ot, see
>>>  #define TARGET_THREAD_SPLIT_STACK_OFFSET \
>>>   (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x30)
>>>  #endif
>>> +
>>> +#undef WCHAR_TYPE
>>> +#define WCHAR_TYPE (TARGET_LP64 ? "int" : "long int")
>>
>> Hi Richard,
>>
>> Is this patch OK for trunk?
>>
>> Thanks.
>
> Yes, this is fine.
>

I'd like to backport it to 4.6/4.7 branches.  Is that OK?

Thanks.
Richard Henderson July 16, 2012, 4:54 p.m. UTC | #5
On 07/06/2012 11:27 AM, H.J. Lu wrote:
>>>> >>> +#undef WCHAR_TYPE
>>>> >>> +#define WCHAR_TYPE (TARGET_LP64 ? "int" : "long int")
>>> >>
>>> >> Hi Richard,
>>> >>
>>> >> Is this patch OK for trunk?
>>> >>
>>> >> Thanks.
>> >
>> > Yes, this is fine.
>> >
> I'd like to backport it to 4.6/4.7 branches.  Is that OK?

Meh... is there a real reason for it?  Certainly you don't have
"official" x32 support on those branches.

As far as I'm concerned this can stay private to whatever branch
also includes your x32 work.



r~
diff mbox

Patch

diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
index 0e66d26..2941332 100644
--- a/gcc/config/i386/gnu-user64.h
+++ b/gcc/config/i386/gnu-user64.h
@@ -91,3 +91,6 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If n
ot, see
 #define TARGET_THREAD_SPLIT_STACK_OFFSET \
   (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x30)
 #endif
+
+#undef WCHAR_TYPE