From 0344a78d8ebfc3bf9c924df994541df6ac72280d Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 17 Dec 2024 20:06:16 +0900 Subject: [PATCH] Fix c_char on various targets - aarch64-kmc-solid_asp3 - armv7a-kmc-solid_asp3-eabi - armv7a-kmc-solid_asp3-eabihf - riscv64-linux-android - x86_64-unknown-l4re-uclibc - armv7-sony-vita-newlibeabihf - riscv32imac-unknown-nuttx-elf - riscv32imafc-unknown-nuttx-elf - riscv32imc-unknown-nuttx-elf - riscv64gc-unknown-nuttx-elf - riscv64imac-unknown-nuttx-elf - thumbv6m-nuttx-eabi - thumbv7em-nuttx-eabi - thumbv7em-nuttx-eabihf - thumbv7m-nuttx-eabi - thumbv8m.base-nuttx-eabi - thumbv8m.main-nuttx-eabi - thumbv8m.main-nuttx-eabihf - aarch64-unknown-redox - aarch64-unknown-illumos - riscv32-wrs-vxworks - riscv64-wrs-vxworks --- src/solid/aarch64.rs | 2 +- src/solid/arm.rs | 2 +- src/unix/linux_like/android/b64/riscv64/mod.rs | 2 +- src/unix/linux_like/linux/uclibc/x86_64/mod.rs | 2 +- src/unix/newlib/vita/mod.rs | 2 +- src/unix/nuttx/mod.rs | 12 +++++++++++- src/unix/redox/mod.rs | 8 +++++++- src/unix/solarish/mod.rs | 8 +++++++- src/vxworks/riscv32.rs | 2 +- src/vxworks/riscv64.rs | 2 +- 10 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/solid/aarch64.rs b/src/solid/aarch64.rs index ceabea397b804..4032488b6c0d5 100644 --- a/src/solid/aarch64.rs +++ b/src/solid/aarch64.rs @@ -1,4 +1,4 @@ -pub type c_char = i8; +pub type c_char = u8; pub type wchar_t = u32; pub type c_long = i64; pub type c_ulong = u64; diff --git a/src/solid/arm.rs b/src/solid/arm.rs index 04cc1542deaeb..55240068aa08e 100644 --- a/src/solid/arm.rs +++ b/src/solid/arm.rs @@ -1,4 +1,4 @@ -pub type c_char = i8; +pub type c_char = u8; pub type wchar_t = u32; pub type c_long = i32; pub type c_ulong = u32; diff --git a/src/unix/linux_like/android/b64/riscv64/mod.rs b/src/unix/linux_like/android/b64/riscv64/mod.rs index f214fe33702a4..d35c408955109 100644 --- a/src/unix/linux_like/android/b64/riscv64/mod.rs +++ b/src/unix/linux_like/android/b64/riscv64/mod.rs @@ -1,7 +1,7 @@ use crate::off64_t; use crate::prelude::*; -pub type c_char = i8; +pub type c_char = u8; pub type wchar_t = u32; pub type greg_t = i64; pub type __u64 = c_ulonglong; diff --git a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs index 07574581d77cc..b41936f94fee8 100644 --- a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs +++ b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs @@ -6,7 +6,7 @@ use crate::prelude::*; pub type blkcnt_t = i64; pub type blksize_t = i64; pub type clock_t = i64; -pub type c_char = u8; +pub type c_char = i8; pub type c_long = i64; pub type c_ulong = u64; pub type fsblkcnt_t = c_ulong; diff --git a/src/unix/newlib/vita/mod.rs b/src/unix/newlib/vita/mod.rs index 120c4d54972f5..1a8c89319fa2d 100644 --- a/src/unix/newlib/vita/mod.rs +++ b/src/unix/newlib/vita/mod.rs @@ -3,7 +3,7 @@ use crate::prelude::*; pub type clock_t = c_long; -pub type c_char = i8; +pub type c_char = u8; pub type wchar_t = u32; pub type c_long = i32; diff --git a/src/unix/nuttx/mod.rs b/src/unix/nuttx/mod.rs index 95d1156bfc48b..78ecf3f133505 100644 --- a/src/unix/nuttx/mod.rs +++ b/src/unix/nuttx/mod.rs @@ -5,7 +5,17 @@ pub type nlink_t = u16; pub type ino_t = u16; pub type blkcnt_t = u64; pub type blksize_t = i16; -pub type c_char = i8; +cfg_if! { + if #[cfg(any( + target_arch = "arm", + target_arch = "riscv32", + target_arch = "riscv64", + ))] { + pub type c_char = u8; + } else { + pub type c_char = i8; + } +} pub type c_long = isize; pub type c_ulong = usize; pub type cc_t = u8; diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index db854dd6300ea..1c8bb40e746f3 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -1,6 +1,12 @@ use crate::prelude::*; -pub type c_char = i8; +cfg_if! { + if #[cfg(target_arch = "aarch64")] { + pub type c_char = u8; + } else { + pub type c_char = i8; + } +} pub type wchar_t = i32; cfg_if! { diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 9fce13226afc9..83d94bff84373 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -2,7 +2,13 @@ use core::mem::size_of; use crate::prelude::*; -pub type c_char = i8; +cfg_if! { + if #[cfg(target_arch = "aarch64")] { + pub type c_char = u8; + } else { + pub type c_char = i8; + } +} pub type c_long = i64; pub type c_ulong = u64; pub type caddr_t = *mut c_char; diff --git a/src/vxworks/riscv32.rs b/src/vxworks/riscv32.rs index e617bb83c6ce3..40a8e338e83a2 100644 --- a/src/vxworks/riscv32.rs +++ b/src/vxworks/riscv32.rs @@ -1,4 +1,4 @@ -pub type c_char = i8; +pub type c_char = u8; pub type wchar_t = i32; pub type c_long = i32; pub type c_ulong = u32; diff --git a/src/vxworks/riscv64.rs b/src/vxworks/riscv64.rs index 5e95ea2567ddf..ccd68b0c64f82 100644 --- a/src/vxworks/riscv64.rs +++ b/src/vxworks/riscv64.rs @@ -1,4 +1,4 @@ -pub type c_char = i8; +pub type c_char = u8; pub type wchar_t = i32; pub type c_long = i64; pub type c_ulong = u64;