Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220111002518.178068-1-heinrich.schuchardt@canonical.com>
Date: Tue, 11 Jan 2022 01:25:18 +0100
From: Heinrich Schuchardt <heinrich.schuchardt@...onical.com>
To: musl@...ts.openwall.com
Cc: Milan P . Stanić <mps@...anta.net>,
	Heinrich Schuchardt <heinrich.schuchardt@...onical.com>
Subject: [PATCH 1/1] honor __WCHAR_TYPE__ on x86_64, arm, arm64, riscv64

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@...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.