Skip to content

Commit ae9c330

Browse files
committed
Auto merge of #104101 - betrusted-io:xous-libstd-initial, r=bjorn3
Add initial libstd support for Xous This patchset adds some minimal support to the tier-3 target `riscv32imac-unknown-xous-elf`. The following features are supported: * alloc * thread creation and joining * thread sleeping * thread_local * panic_abort * mutex * condvar * stdout Additionally, internal support for the various Xous primitives surrounding IPC have been added as part of the Xous FFI. These may be exposed as part of `std::os::xous::ffi` in the future, however for now they are not public. This represents the minimum viable product. A future patchset will add support for networking and filesystem support.
2 parents af78bae + 6c32a64 commit ae9c330

32 files changed

+2484
-10
lines changed

Diff for: Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,9 @@ checksum = "55b672471b4e9f9e95499ea597ff64941a309b2cdbffcc46f2cc5e2d971fd335"
644644

645645
[[package]]
646646
name = "compiler_builtins"
647-
version = "0.1.100"
647+
version = "0.1.101"
648648
source = "registry+https://github.com/rust-lang/crates.io-index"
649-
checksum = "d6c0f24437059853f0fa64afc51f338f93647a3de4cf3358ba1bb4171a199775"
649+
checksum = "01a6d58e9c3408138099a396a98fd0d0e6cfb25d723594d2ae48b5004513fd5b"
650650
dependencies = [
651651
"cc",
652652
"rustc-std-workspace-core",

Diff for: library/panic_abort/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ pub unsafe fn __rust_start_panic(_payload: &mut dyn BoxMeUp) -> u32 {
4343
libc::abort();
4444
}
4545
} else if #[cfg(any(target_os = "hermit",
46-
all(target_vendor = "fortanix", target_env = "sgx")
46+
all(target_vendor = "fortanix", target_env = "sgx"),
47+
target_os = "xous"
4748
))] {
4849
unsafe fn abort() -> ! {
4950
// call std::sys::abort_internal

Diff for: library/std/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ object = { version = "0.32.0", default-features = false, optional = true, featur
3636
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
3737
rand_xorshift = "0.3.0"
3838

39-
[target.'cfg(any(all(target_family = "wasm", target_os = "unknown"), all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
40-
dlmalloc = { version = "0.2.3", features = ['rustc-dep-of-std'] }
39+
[target.'cfg(any(all(target_family = "wasm", target_os = "unknown"), target_os = "xous", all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
40+
dlmalloc = { version = "0.2.4", features = ['rustc-dep-of-std'] }
4141

4242
[target.x86_64-fortanix-unknown-sgx.dependencies]
4343
fortanix-sgx-abi = { version = "0.5.0", features = ['rustc-dep-of-std'], public = true }

Diff for: library/std/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ fn main() {
3737
|| target.contains("nintendo-3ds")
3838
|| target.contains("vita")
3939
|| target.contains("nto")
40+
|| target.contains("xous")
4041
// See src/bootstrap/synthetic_targets.rs
4142
|| env::var("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET").is_ok()
4243
{

Diff for: library/std/src/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#![stable(feature = "rust1", since = "1.0.0")]
99
#![deny(unsafe_op_in_unsafe_fn)]
1010

11-
#[cfg(all(test, not(any(target_os = "emscripten", target_env = "sgx"))))]
11+
#[cfg(all(test, not(any(target_os = "emscripten", target_env = "sgx", target_os = "xous"))))]
1212
mod tests;
1313

1414
use crate::ffi::OsString;

Diff for: library/std/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@
260260
feature(slice_index_methods, coerce_unsized, sgx_platform)
261261
)]
262262
#![cfg_attr(windows, feature(round_char_boundary))]
263+
#![cfg_attr(target_os = "xous", feature(slice_ptr_len))]
263264
//
264265
// Language features:
265266
// tidy-alphabetical-start

Diff for: library/std/src/net/tcp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![deny(unsafe_op_in_unsafe_fn)]
22

3-
#[cfg(all(test, not(target_os = "emscripten")))]
3+
#[cfg(all(test, not(any(target_os = "emscripten", target_os = "xous"))))]
44
mod tests;
55

66
use crate::io::prelude::*;

Diff for: library/std/src/net/udp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[cfg(all(test, not(any(target_os = "emscripten", target_env = "sgx"))))]
1+
#[cfg(all(test, not(any(target_os = "emscripten", target_env = "sgx", target_os = "xous"))))]
22
mod tests;
33

44
use crate::fmt;

Diff for: library/std/src/os/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ pub mod vita;
146146
pub mod vxworks;
147147
#[cfg(target_os = "watchos")]
148148
pub(crate) mod watchos;
149+
#[cfg(target_os = "xous")]
150+
pub mod xous;
149151

150152
#[cfg(any(unix, target_os = "wasi", doc))]
151153
pub mod fd;

0 commit comments

Comments
 (0)