Skip to content

Commit b37d107

Browse files
authored
Merge pull request #2 from Wind-River/bpang-runtest
Support static and dynamic linking mode for vxWorks in running test suite
2 parents 0c8a14c + 45d5f22 commit b37d107

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/tools/compiletest/src/runtest.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,17 @@ impl<'test> TestCx<'test> {
17251725
}
17261726
}
17271727

1728+
fn use_dynamic_linking(&self) -> bool {
1729+
if self.config.target.contains("vxworks") {
1730+
match env::var("RUST_TEST_DYLINK") {
1731+
Ok(s) => s == "1",
1732+
_ => false
1733+
}
1734+
} else {
1735+
true
1736+
}
1737+
}
1738+
17281739
fn compose_and_run_compiler(&self, mut rustc: Command, input: Option<String>) -> ProcRes {
17291740
let aux_dir = self.aux_output_dir_name();
17301741

@@ -1768,6 +1779,7 @@ impl<'test> TestCx<'test> {
17681779
&& !self.config.host.contains("musl"))
17691780
|| self.config.target.contains("wasm32")
17701781
|| self.config.target.contains("nvptx")
1782+
|| !self.use_dynamic_linking()
17711783
{
17721784
// We primarily compile all auxiliary libraries as dynamic libraries
17731785
// to avoid code size bloat and large binaries as much as possible
@@ -1999,10 +2011,14 @@ impl<'test> TestCx<'test> {
19992011
}
20002012

20012013
if !is_rustdoc {
2002-
if self.config.target == "wasm32-unknown-unknown" {
2014+
if self.config.target == "wasm32-unknown-unknown"
2015+
|| !self.use_dynamic_linking() {
20032016
// rustc.arg("-g"); // get any backtrace at all on errors
20042017
} else if !self.props.no_prefer_dynamic {
20052018
rustc.args(&["-C", "prefer-dynamic"]);
2019+
if self.config.target.contains("vxworks") {
2020+
rustc.args(&["-C", "target-feature=-crt-static"]);
2021+
}
20062022
}
20072023
}
20082024

0 commit comments

Comments
 (0)