Skip to content

Commit c65cfdb

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

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
@@ -4987,6 +4987,47 @@ version = "1.1.0"
49874987
source = "registry+https://github.com/rust-lang/crates.io-index"
49884988
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
49894989

4990+
[[package]]
4991+
name = "std"
4992+
version = "0.0.0"
4993+
dependencies = [
4994+
"addr2line 0.22.0",
4995+
"alloc",
4996+
"cfg-if",
4997+
"compiler_builtins",
4998+
"core",
4999+
"dlmalloc",
5000+
"fortanix-sgx-abi",
5001+
"hashbrown",
5002+
"hermit-abi 0.4.0",
5003+
"libc",
5004+
"miniz_oxide",
5005+
"object 0.36.0",
5006+
"panic_abort",
5007+
"panic_unwind",
5008+
"profiler_builtins",
5009+
"r-efi",
5010+
"r-efi-alloc",
5011+
"rand",
5012+
"rand_xorshift",
5013+
"rustc-demangle",
5014+
"std_detect",
5015+
"unwind",
5016+
"vex-sdk",
5017+
"wasi",
5018+
]
5019+
5020+
[[package]]
5021+
name = "std_detect"
5022+
version = "0.1.5"
5023+
dependencies = [
5024+
"cfg-if",
5025+
"compiler_builtins",
5026+
"libc",
5027+
"rustc-std-workspace-alloc",
5028+
"rustc-std-workspace-core",
5029+
]
5030+
49905031
[[package]]
49915032
name = "string_cache"
49925033
version = "0.8.7"
@@ -5723,7 +5764,26 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
57235764
name = "version_check"
57245765
version = "0.9.5"
57255766
source = "registry+https://github.com/rust-lang/crates.io-index"
5726-
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
5767+
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
5768+
5769+
[[package]]
5770+
name = "vex-sdk"
5771+
version = "0.17.0"
5772+
source = "registry+https://github.com/rust-lang/crates.io-index"
5773+
checksum = "f285bbc2b96fc4c7fae42ebe365dd2e9121e7002a58b1a9e0e4b1d14dba4d6d0"
5774+
dependencies = [
5775+
"compiler_builtins",
5776+
"rustc-std-workspace-core",
5777+
]
5778+
5779+
[[package]]
5780+
name = "wait-timeout"
5781+
version = "0.2.0"
5782+
source = "registry+https://github.com/rust-lang/crates.io-index"
5783+
checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
5784+
dependencies = [
5785+
"libc",
5786+
]
57275787

57285788
[[package]]
57295789
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)