mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
Couple of changes to make it easier to compile rustc for wasm
This is a subset of the patches I have on my rust fork to compile rustc for wasm32-wasip1.
This commit is contained in:
parent
4428a05167
commit
6414d9f52d
@ -76,10 +76,14 @@ pub fn link_or_copy<P: AsRef<Path>, Q: AsRef<Path>>(p: P, q: Q) -> io::Result<Li
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(any(unix, all(target_os = "wasi", target_env = "p1")))]
|
||||||
pub fn path_to_c_string(p: &Path) -> CString {
|
pub fn path_to_c_string(p: &Path) -> CString {
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
|
#[cfg(unix)]
|
||||||
use std::os::unix::ffi::OsStrExt;
|
use std::os::unix::ffi::OsStrExt;
|
||||||
|
#[cfg(all(target_os = "wasi", target_env = "p1"))]
|
||||||
|
use std::os::wasi::ffi::OsStrExt;
|
||||||
|
|
||||||
let p: &OsStr = p.as_ref();
|
let p: &OsStr = p.as_ref();
|
||||||
CString::new(p.as_bytes()).unwrap()
|
CString::new(p.as_bytes()).unwrap()
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,8 @@ pub fn exe(name: &str, target: &str) -> String {
|
|||||||
format!("{name}.exe")
|
format!("{name}.exe")
|
||||||
} else if target.contains("uefi") {
|
} else if target.contains("uefi") {
|
||||||
format!("{name}.efi")
|
format!("{name}.efi")
|
||||||
|
} else if target.contains("wasm") {
|
||||||
|
format!("{name}.wasm")
|
||||||
} else {
|
} else {
|
||||||
name.to_string()
|
name.to_string()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user