* [musl] [PATCH 1/1] honor __WCHAR_TYPE__ on x86_64, arm, arm64, riscv64
@ 2022-01-11 0:25 Heinrich Schuchardt
2022-01-11 0:36 ` Rich Felker
0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2022-01-11 0:25 UTC (permalink / raw)
To: musl; +Cc: Milan P . Stanić, Heinrich Schuchardt
Some programs like U-Boot are compiled with GCC option -fshort-wchar.
In this case wchar_t must be a 16 bit type.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [musl] [PATCH 1/1] honor __WCHAR_TYPE__ on x86_64, arm, arm64, riscv64
2022-01-11 0:25 [musl] [PATCH 1/1] honor __WCHAR_TYPE__ on x86_64, arm, arm64, riscv64 Heinrich Schuchardt
@ 2022-01-11 0:36 ` Rich Felker
2022-01-11 0:43 ` Heinrich Schuchardt
0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2022-01-11 0:36 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: musl, Milan P . Stanić
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 <heinrich.schuchardt@canonical.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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [musl] [PATCH 1/1] honor __WCHAR_TYPE__ on x86_64, arm, arm64, riscv64
2022-01-11 0:36 ` Rich Felker
@ 2022-01-11 0:43 ` Heinrich Schuchardt
0 siblings, 0 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2022-01-11 0:43 UTC (permalink / raw)
To: Rich Felker; +Cc: musl, Milan P. Stanić
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@canonical.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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-11 1:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 0:25 [musl] [PATCH 1/1] honor __WCHAR_TYPE__ on x86_64, arm, arm64, riscv64 Heinrich Schuchardt
2022-01-11 0:36 ` Rich Felker
2022-01-11 0:43 ` Heinrich Schuchardt
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).