From: Rich Felker <dalias@libc.org>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: musl@lists.openwall.com, "Milan P . Stanić" <mps@arvanta.net>
Subject: Re: [musl] [PATCH 1/1] honor __WCHAR_TYPE__ on x86_64, arm, arm64, riscv64
Date: Mon, 10 Jan 2022 19:36:04 -0500 [thread overview]
Message-ID: <20220111003600.GU7074@brightrain.aerifal.cx> (raw)
In-Reply-To: <20220111002518.178068-1-heinrich.schuchardt@canonical.com>
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
next prev parent reply other threads:[~2022-01-11 0:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-11 0:25 Heinrich Schuchardt
2022-01-11 0:36 ` Rich Felker [this message]
2022-01-11 0:43 ` Heinrich Schuchardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220111003600.GU7074@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=heinrich.schuchardt@canonical.com \
--cc=mps@arvanta.net \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).