From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3725 invoked from network); 11 Jan 2022 00:36:19 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 11 Jan 2022 00:36:19 -0000 Received: (qmail 12232 invoked by uid 550); 11 Jan 2022 00:36:17 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 12200 invoked from network); 11 Jan 2022 00:36:16 -0000 Date: Mon, 10 Jan 2022 19:36:04 -0500 From: Rich Felker To: Heinrich Schuchardt Cc: musl@lists.openwall.com, Milan P =?utf-8?B?LiBTdGFuacSH?= Message-ID: <20220111003600.GU7074@brightrain.aerifal.cx> References: <20220111002518.178068-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220111002518.178068-1-heinrich.schuchardt@canonical.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] [PATCH 1/1] honor __WCHAR_TYPE__ on x86_64, arm, arm64, riscv64 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? > Signed-off-by: Heinrich Schuchardt > --- > 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