Rollup merge of #75758 - bpangWR:master, r=Mark-Simulacrum

Fixes for VxWorks

r? @alexcrichton
This commit is contained in:
Dylan DPC 2020-08-27 01:14:04 +02:00 committed by GitHub
commit 730449d22a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 15 deletions

View File

@ -53,7 +53,7 @@ impl FileDesc {
} }
#[inline] #[inline]
fn is_read_vectored(&self) -> bool { pub fn is_read_vectored(&self) -> bool {
true true
} }

View File

@ -351,8 +351,7 @@ impl ExitStatus {
} }
fn exited(&self) -> bool { fn exited(&self) -> bool {
/*unsafe*/ libc::WIFEXITED(self.0)
{ libc::WIFEXITED(self.0) }
} }
pub fn success(&self) -> bool { pub fn success(&self) -> bool {
@ -360,19 +359,11 @@ impl ExitStatus {
} }
pub fn code(&self) -> Option<i32> { pub fn code(&self) -> Option<i32> {
if self.exited() { if self.exited() { Some(libc::WEXITSTATUS(self.0)) } else { None }
Some(/*unsafe*/ { libc::WEXITSTATUS(self.0) })
} else {
None
}
} }
pub fn signal(&self) -> Option<i32> { pub fn signal(&self) -> Option<i32> {
if !self.exited() { if !self.exited() { Some(libc::WTERMSIG(self.0)) } else { None }
Some(/*unsafe*/ { libc::WTERMSIG(self.0) })
} else {
None
}
} }
} }

View File

@ -2,6 +2,6 @@
#![unstable(feature = "thread_local_internals", issue = "none")] #![unstable(feature = "thread_local_internals", issue = "none")]
pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) { pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
use crate::sys_common::thread_local::register_dtor_fallback; use crate::sys_common::thread_local_dtor::register_dtor_fallback;
register_dtor_fallback(t, dtor); register_dtor_fallback(t, dtor);
} }

View File

@ -132,7 +132,8 @@ pub fn find(build: &mut Build) {
false false
}; };
if cxx_configured { // for VxWorks, record CXX compiler which will be used in lib.rs:linker()
if cxx_configured || target.contains("vxworks") {
let compiler = cfg.get_compiler(); let compiler = cfg.get_compiler();
build.cxx.insert(target, compiler); build.cxx.insert(target, compiler);
} }

View File

@ -854,6 +854,10 @@ impl Build {
if let Some(linker) = self.config.target_config.get(&target).and_then(|c| c.linker.as_ref()) if let Some(linker) = self.config.target_config.get(&target).and_then(|c| c.linker.as_ref())
{ {
Some(linker) Some(linker)
} else if target.contains("vxworks") {
// need to use CXX compiler as linker to resolve the exception functions
// that are only existed in CXX libraries
Some(self.cxx[&target].path())
} else if target != self.config.build } else if target != self.config.build
&& util::use_host_linker(target) && util::use_host_linker(target)
&& !target.contains("msvc") && !target.contains("msvc")