Skip to content

Commit 0b151c6

Browse files
authored
Rollup merge of rust-lang#136667 - vita-rust:revert-vita-c-char, r=cuviper
Revert vita's c_char back to i8 # Description Hi! rust-lang#132975 changed the definition of `c_char` from i8 to u8 for most ARM targets. While that would usually be correct, [VITASDK uses signed chars by default](https://github.com/vitasdk/buildscripts/blob/master/patches/gcc/0001-gcc-10.patch#L33-L34). The Clang definitions are incorrect because Clang is not (yet?) supported by the vita commmunity / `VITADSK`, On the Rust side, the pre-compiled libraries the user can link to are all compiled using vita's `gcc` and [we set `TARGET_CC` and `TARGET_CXX`](https://github.com/vita-rust/cargo-vita/blob/d564a132cbd43947118c0d6d0ebfbea7d1dd7fa7/src/commands/build.rs#L230) in `cargo vita` for build scripts using `cc`. I'm creating it as a draft PR so that we can discuss it and possibly get it approved here, but wait to merge the [libc side](rust-lang/libc#4258) and get a libc version first, as having the definitions out of sync breaks std. As a nightly-only target it can be confusing/frustrating for new users when the latest nightly, which is the default, is broken.
2 parents 91a0e16 + 93ef808 commit 0b151c6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

library/core/src/ffi/primitives.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ mod c_char_definition {
3939
// These are the targets on which c_char is unsigned. Usually the
4040
// signedness is the same for all target_os values on a given architecture
4141
// but there are some exceptions (see isSignedCharDefault() in clang).
42-
//
4342
// aarch64:
4443
// Section 10 "Arm C and C++ language mappings" in Procedure Call Standard for the Arm®
4544
// 64-bit Architecture (AArch64) says C/C++ char is unsigned byte.
@@ -97,14 +96,19 @@ mod c_char_definition {
9796
// are promoted to int as if from type signed char by default, unless the /J compilation
9897
// option is used."
9998
// https://learn.microsoft.com/en-us/cpp/cpp/fundamental-types-cpp?view=msvc-170#character-types
99+
// Vita:
100+
// Chars are signed by default on the Vita, and VITASDK follows that convention.
101+
// https://github.com/vitasdk/buildscripts/blob/09c533b771591ecde88864b6acad28ffb688dbd4/patches/gcc/0001-gcc-10.patch#L33-L34
102+
//
100103
// L4Re:
101-
// The kernel builds with -funsigned-char on all targets (but useserspace follows the
104+
// The kernel builds with -funsigned-char on all targets (but userspace follows the
102105
// architecture defaults). As we only have a target for userspace apps so there are no
103106
// special cases for L4Re below.
104107
// https://github.com/rust-lang/rust/pull/132975#issuecomment-2484645240
105108
if #[cfg(all(
106109
not(windows),
107110
not(target_vendor = "apple"),
111+
not(target_os = "vita"),
108112
any(
109113
target_arch = "aarch64",
110114
target_arch = "arm",

0 commit comments

Comments
 (0)