Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <26cd3ebc-5d14-2403-e06b-c8ad3b31d65a@canonical.com>
Date: Tue, 11 Jan 2022 01:43:34 +0100
From: Heinrich Schuchardt <heinrich.schuchardt@...onical.com>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com, Milan P. Stanić
 <mps@...anta.net>
Subject: Re: [PATCH 1/1] honor __WCHAR_TYPE__ on x86_64, arm, arm64,
 riscv64

On 1/11/22 01:36, Rich Felker wrote:
> On Tue, Jan 11, 2022 at 01:25:18AM +0100, Heinrich Schuchardt wrote:
>> Some programs like U-Boot are compiled with GCC option -fshort-wchar.
>> In this case wchar_t must be a 16 bit type.
> 
> This is not something you can just change with an option. The wchar_t
> type is an ABI contract with the library functions that take (or take
> pointers to) wchar_t.
> 
> Can you explain how this actually comes up in the applications so we
> can look into getting them fixed?

See https://gitlab.alpinelinux.org/alpine/aports/-/issues/13411

Best regards

Heinrich

> 
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@...onical.com>
>> ---
>>   arch/aarch64/bits/alltypes.h.in | 5 +++++
>>   arch/arm/bits/alltypes.h.in     | 4 ++++
>>   arch/riscv64/bits/alltypes.h.in | 4 ++++
>>   arch/x86_64/bits/alltypes.h.in  | 4 ++++
>>   4 files changed, 17 insertions(+)
>>
>> diff --git a/arch/aarch64/bits/alltypes.h.in b/arch/aarch64/bits/alltypes.h.in
>> index c547ca0b..c0263348 100644
>> --- a/arch/aarch64/bits/alltypes.h.in
>> +++ b/arch/aarch64/bits/alltypes.h.in
>> @@ -11,8 +11,13 @@
>>   #define __LONG_MAX 0x7fffffffffffffffL
>>   
>>   #ifndef __cplusplus
>> +#ifdef __WCHAR_TYPE__
>> +TYPEDEF __WCHAR_TYPE__ wchar_t;
>> +#else
>>   TYPEDEF unsigned wchar_t;
>>   #endif
>> +#endif
>> +
>>   TYPEDEF unsigned wint_t;
>>   
>>   TYPEDEF int blksize_t;
>> diff --git a/arch/arm/bits/alltypes.h.in b/arch/arm/bits/alltypes.h.in
>> index d62bd7bd..9596466b 100644
>> --- a/arch/arm/bits/alltypes.h.in
>> +++ b/arch/arm/bits/alltypes.h.in
>> @@ -12,8 +12,12 @@
>>   #define __LONG_MAX 0x7fffffffL
>>   
>>   #ifndef __cplusplus
>> +#ifdef __WCHAR_TYPE__
>> +TYPEDEF __WCHAR_TYPE__ wchar_t;
>> +#else
>>   TYPEDEF unsigned wchar_t;
>>   #endif
>> +#endif
>>   
>>   TYPEDEF float float_t;
>>   TYPEDEF double double_t;
>> diff --git a/arch/riscv64/bits/alltypes.h.in b/arch/riscv64/bits/alltypes.h.in
>> index 4579d174..f8f8b7e5 100644
>> --- a/arch/riscv64/bits/alltypes.h.in
>> +++ b/arch/riscv64/bits/alltypes.h.in
>> @@ -6,8 +6,12 @@
>>   #define __LONG_MAX 0x7fffffffffffffffL
>>   
>>   #ifndef __cplusplus
>> +#ifdef __WCHAR_TYPE__
>> +TYPEDEF __WCHAR_TYPE__ wchar_t;
>> +#else
>>   TYPEDEF int wchar_t;
>>   #endif
>> +#endif
>>   
>>   TYPEDEF int blksize_t;
>>   TYPEDEF unsigned int nlink_t;
>> diff --git a/arch/x86_64/bits/alltypes.h.in b/arch/x86_64/bits/alltypes.h.in
>> index 5cd8a299..748ff632 100644
>> --- a/arch/x86_64/bits/alltypes.h.in
>> +++ b/arch/x86_64/bits/alltypes.h.in
>> @@ -6,8 +6,12 @@
>>   #define __LONG_MAX 0x7fffffffffffffffL
>>   
>>   #ifndef __cplusplus
>> +#ifdef __WCHAR_TYPE__
>> +TYPEDEF __WCHAR_TYPE__ wchar_t;
>> +#else
>>   TYPEDEF int wchar_t;
>>   #endif
>> +#endif
>>   
>>   #if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 2
>>   TYPEDEF long double float_t;
>> -- 
>> 2.33.1

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.