Commit 9a91a6f8 authored by Jeremy Soller's avatar Jeremy Soller

Add support for Redox throughout rustc depends

parent 8177764b
......@@ -251,6 +251,11 @@ pub fn record_time<T, F>(accu: &Lock<Duration>, f: F) -> T where
}
// Memory reporting
#[cfg(not(any(unix, windows)))]
fn get_resident() -> Option<usize> {
None
}
#[cfg(unix)]
fn get_resident() -> Option<usize> {
use std::fs;
......
......@@ -762,7 +762,7 @@ fn exec_linker(sess: &Session, cmd: &mut Command, out_filename: &Path, tmpdir: &
flush_linked_file(&output, out_filename)?;
return output;
#[cfg(unix)]
#[cfg(any(unix, target_os = "redox"))]
fn flush_linked_file(_: &io::Result<Output>, _: &Path) -> io::Result<()> {
Ok(())
}
......@@ -790,6 +790,12 @@ fn exec_linker(sess: &Session, cmd: &mut Command, out_filename: &Path, tmpdir: &
Ok(())
}
#[cfg(target_os = "redox")]
fn command_line_too_big(err: &io::Error) -> bool {
// I don't have time for imports
err.raw_os_error() == Some(7)
}
#[cfg(unix)]
fn command_line_too_big(err: &io::Error) -> bool {
err.raw_os_error() == Some(::libc::E2BIG)
......
......@@ -382,7 +382,7 @@ pub fn set_sigpipe_handler() {
}
}
#[cfg(windows)]
#[cfg(any(not(unix), windows))]
pub fn set_sigpipe_handler() {}
// Extract output directory and file from matches.
......@@ -457,6 +457,11 @@ impl Compilation {
#[derive(Copy, Clone)]
pub struct RustcDefaultCalls;
#[cfg(not(any(unix, windows)))]
fn stdout_isatty() -> bool {
false
}
// FIXME remove these and use winapi 0.3 instead
// Duplicates: bootstrap/compile.rs, librustc_errors/emitter.rs
#[cfg(unix)]
......
......@@ -107,7 +107,7 @@ pub fn rename_or_copy_remove<P: AsRef<Path>, Q: AsRef<Path>>(p: P,
}
}
#[cfg(unix)]
#[cfg(any(unix, target_os = "redox"))]
pub fn path_to_c_string(p: &Path) -> CString {
use std::os::unix::ffi::OsStrExt;
use std::ffi::OsStr;
......
......@@ -386,6 +386,11 @@ pub fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box<dyn CodegenBackend
}
}
#[cfg(not(any(unix, windows)))]
fn current_dll_path() -> Option<PathBuf> {
None
}
#[cfg(unix)]
fn current_dll_path() -> Option<PathBuf> {
use std::ffi::{OsStr, CStr};
......
......@@ -124,6 +124,30 @@ mod tests {
}
}
#[cfg(not(any(unix, windows)))]
mod dl {
use libc;
use std::ffi::OsStr;
pub fn open(_filename: Option<&OsStr>) -> Result<*mut u8, String> {
Err("dl::open: dynamic libraries are not supported on this platform".to_string())
}
pub fn open_global_now(_filename: &OsStr) -> Result<*mut u8, String> {
Err("dl::open_global_now: dynamic libraries are not supported on this platform".to_string())
}
pub unsafe fn symbol(_handle: *mut u8,
_symbol: *const libc::c_char)
-> Result<*mut u8, String> {
Err("dl::symbol: dynamic libraries are not supported on this platform".to_string())
}
pub unsafe fn close(_handle: *mut u8) {
}
}
#[cfg(unix)]
mod dl {
use std::ffi::{CStr, OsStr, CString};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment