Skip to content

Commit abe0d0e

Browse files
Tropix126max-niederman
authored andcommitted
update PAL and add check-cfg override for target_os
1 parent c126df8 commit abe0d0e

File tree

5 files changed

+69
-7
lines changed

5 files changed

+69
-7
lines changed

Cargo.lock

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4955,6 +4955,47 @@ version = "1.1.0"
49554955
source = "registry+https://github.com/rust-lang/crates.io-index"
49564956
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
49574957

4958+
[[package]]
4959+
name = "std"
4960+
version = "0.0.0"
4961+
dependencies = [
4962+
"addr2line 0.22.0",
4963+
"alloc",
4964+
"cfg-if",
4965+
"compiler_builtins",
4966+
"core",
4967+
"dlmalloc",
4968+
"fortanix-sgx-abi",
4969+
"hashbrown",
4970+
"hermit-abi 0.4.0",
4971+
"libc",
4972+
"miniz_oxide",
4973+
"object 0.36.0",
4974+
"panic_abort",
4975+
"panic_unwind",
4976+
"profiler_builtins",
4977+
"r-efi",
4978+
"r-efi-alloc",
4979+
"rand",
4980+
"rand_xorshift",
4981+
"rustc-demangle",
4982+
"std_detect",
4983+
"unwind",
4984+
"vex-sdk",
4985+
"wasi",
4986+
]
4987+
4988+
[[package]]
4989+
name = "std_detect"
4990+
version = "0.1.5"
4991+
dependencies = [
4992+
"cfg-if",
4993+
"compiler_builtins",
4994+
"libc",
4995+
"rustc-std-workspace-alloc",
4996+
"rustc-std-workspace-core",
4997+
]
4998+
49584999
[[package]]
49595000
name = "string_cache"
49605001
version = "0.8.7"
@@ -5691,7 +5732,26 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
56915732
name = "version_check"
56925733
version = "0.9.5"
56935734
source = "registry+https://github.com/rust-lang/crates.io-index"
5694-
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
5735+
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
5736+
5737+
[[package]]
5738+
name = "vex-sdk"
5739+
version = "0.17.0"
5740+
source = "registry+https://github.com/rust-lang/crates.io-index"
5741+
checksum = "f285bbc2b96fc4c7fae42ebe365dd2e9121e7002a58b1a9e0e4b1d14dba4d6d0"
5742+
dependencies = [
5743+
"compiler_builtins",
5744+
"rustc-std-workspace-core",
5745+
]
5746+
5747+
[[package]]
5748+
name = "wait-timeout"
5749+
version = "0.2.0"
5750+
source = "registry+https://github.com/rust-lang/crates.io-index"
5751+
checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
5752+
dependencies = [
5753+
"libc",
5754+
]
56955755

56965756
[[package]]
56975757
name = "walkdir"

library/panic_abort/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ compiler_builtins = "0.1.0"
1919

2020
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
2121
libc = { version = "0.2", default-features = false }
22+
23+
[lints.rust]
24+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("vexos"))'] }

library/std/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,5 @@ check-cfg = [
155155
'cfg(feature, values(any()))',
156156
# #[cfg(bootstrap)] rtems
157157
'cfg(target_os, values("rtems"))',
158+
'cfg(target_os, values("vexos"))',
158159
]

library/std/src/sys/pal/vexos/fs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ impl File {
340340
map_fresult(vex_sdk::vexFileSeek(self.fd.0, try_convert_offset(offset)?, SEEK_SET))?
341341
},
342342

343-
// vexOS does not allow seeking with negative offsets.
343+
// VEXos does not allow seeking with negative offsets.
344344
// That means we need to calculate the offset from the start for both of these.
345345
SeekFrom::End(offset) => unsafe {
346346
// If our offset is positive, everything is easy
@@ -430,7 +430,7 @@ impl Drop for File {
430430
pub fn readdir(_p: &Path) -> io::Result<ReadDir> {
431431
// While there *is* a userspace function for reading file directories,
432432
// the necessary implementation cannot currently be done cleanly, as
433-
// vexOS does not expose directory length to user programs.
433+
// VEXos does not expose directory length to user programs.
434434
//
435435
// This means that we would need to create a large fixed-length buffer
436436
// and hope that the folder's contents didn't exceed that buffer's length,
@@ -458,7 +458,7 @@ pub fn remove_dir_all(_path: &Path) -> io::Result<()> {
458458
unsupported()
459459
}
460460

461-
pub fn try_exists(path: &Path) -> io::Result<bool> {
461+
pub fn exists(path: &Path) -> io::Result<bool> {
462462
let path = CString::new(path.as_os_str().as_encoded_bytes())
463463
.map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Path contained a null byte"))?;
464464

library/std/src/sys/pal/vexos/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ pub mod process;
1616
pub mod stdio;
1717
#[path = "../unsupported/thread.rs"]
1818
pub mod thread;
19-
#[path = "../unsupported/thread_local_key.rs"]
20-
pub mod thread_local_key;
2119
pub mod time;
2220

2321
use crate::{arch::asm, ptr::{self, addr_of_mut}};
@@ -37,7 +35,7 @@ pub unsafe extern "C" fn _start() -> ! {
3735
// Setup the stack
3836
asm!("ldr sp, =__stack_top", options(nostack));
3937

40-
// vexOS doesn't explicitly clean out .bss, so as a sanity
38+
// VEXos doesn't explicitly clean out .bss, so as a sanity
4139
// check we'll fill it with zeroes.
4240
ptr::slice_from_raw_parts_mut(
4341
addr_of_mut!(__bss_start),

0 commit comments

Comments
 (0)