Skip to content

Commit 730449d

Browse files
authored
Rollup merge of #75758 - bpangWR:master, r=Mark-Simulacrum
Fixes for VxWorks r? @alexcrichton
2 parents 2eec2ec + 079baaf commit 730449d

File tree

5 files changed

+11
-15
lines changed

5 files changed

+11
-15
lines changed

library/std/src/sys/vxworks/fd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl FileDesc {
5353
}
5454

5555
#[inline]
56-
fn is_read_vectored(&self) -> bool {
56+
pub fn is_read_vectored(&self) -> bool {
5757
true
5858
}
5959

library/std/src/sys/vxworks/process/process_common.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -351,28 +351,19 @@ impl ExitStatus {
351351
}
352352

353353
fn exited(&self) -> bool {
354-
/*unsafe*/
355-
{ libc::WIFEXITED(self.0) }
354+
libc::WIFEXITED(self.0)
356355
}
357356

358357
pub fn success(&self) -> bool {
359358
self.code() == Some(0)
360359
}
361360

362361
pub fn code(&self) -> Option<i32> {
363-
if self.exited() {
364-
Some(/*unsafe*/ { libc::WEXITSTATUS(self.0) })
365-
} else {
366-
None
367-
}
362+
if self.exited() { Some(libc::WEXITSTATUS(self.0)) } else { None }
368363
}
369364

370365
pub fn signal(&self) -> Option<i32> {
371-
if !self.exited() {
372-
Some(/*unsafe*/ { libc::WTERMSIG(self.0) })
373-
} else {
374-
None
375-
}
366+
if !self.exited() { Some(libc::WTERMSIG(self.0)) } else { None }
376367
}
377368
}
378369

library/std/src/sys/vxworks/thread_local_dtor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
#![unstable(feature = "thread_local_internals", issue = "none")]
33

44
pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
5-
use crate::sys_common::thread_local::register_dtor_fallback;
5+
use crate::sys_common::thread_local_dtor::register_dtor_fallback;
66
register_dtor_fallback(t, dtor);
77
}

src/bootstrap/cc_detect.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ pub fn find(build: &mut Build) {
132132
false
133133
};
134134

135-
if cxx_configured {
135+
// for VxWorks, record CXX compiler which will be used in lib.rs:linker()
136+
if cxx_configured || target.contains("vxworks") {
136137
let compiler = cfg.get_compiler();
137138
build.cxx.insert(target, compiler);
138139
}

src/bootstrap/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,10 @@ impl Build {
854854
if let Some(linker) = self.config.target_config.get(&target).and_then(|c| c.linker.as_ref())
855855
{
856856
Some(linker)
857+
} else if target.contains("vxworks") {
858+
// need to use CXX compiler as linker to resolve the exception functions
859+
// that are only existed in CXX libraries
860+
Some(self.cxx[&target].path())
857861
} else if target != self.config.build
858862
&& util::use_host_linker(target)
859863
&& !target.contains("msvc")

0 commit comments

Comments
 (0)