-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Support both static and dynamic linking mode in testing for vxWorks #63789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
0c8a14c
45d5f22
b37d107
f5b1b1c
76f1721
cae6d66
043c19c
964c37c
e316ba3
20b9ea8
3a6f7b4
bdc6cfc
109e16e
414d104
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1725,6 +1725,28 @@ impl<'test> TestCx<'test> { | |
} | ||
} | ||
|
||
fn is_vxworks_pure_static(&self) -> bool { | ||
if self.config.target.contains("vxworks") { | ||
match env::var("RUST_TEST_DYLINK") { | ||
Ok(s) => s != "1", | ||
_ => true | ||
} | ||
} else { | ||
false | ||
} | ||
} | ||
|
||
fn is_vxworks_pure_dynamic(&self) -> bool { | ||
if self.config.target.contains("vxworks") { | ||
match env::var("RUST_TEST_DYLINK") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this branch perhaps just be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For !self.is_vxworks_pure_static(), it would be true for all non-vxworks targets which is not what we want. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Er sorry I meant just in this branch, so only if the target is vxworks do we delegate to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. I have uploaded the code that simply the function is_vxworks_pure_dynamic(). |
||
Ok(s) => s == "1", | ||
_ => false | ||
} | ||
} else { | ||
false | ||
} | ||
} | ||
|
||
fn compose_and_run_compiler(&self, mut rustc: Command, input: Option<String>) -> ProcRes { | ||
let aux_dir = self.aux_output_dir_name(); | ||
|
||
|
@@ -1768,6 +1790,7 @@ impl<'test> TestCx<'test> { | |
&& !self.config.host.contains("musl")) | ||
|| self.config.target.contains("wasm32") | ||
|| self.config.target.contains("nvptx") | ||
|| self.is_vxworks_pure_static() | ||
{ | ||
// We primarily compile all auxiliary libraries as dynamic libraries | ||
// to avoid code size bloat and large binaries as much as possible | ||
|
@@ -1999,7 +2022,8 @@ impl<'test> TestCx<'test> { | |
} | ||
|
||
if !is_rustdoc { | ||
if self.config.target == "wasm32-unknown-unknown" { | ||
if self.config.target == "wasm32-unknown-unknown" | ||
|| self.is_vxworks_pure_static() { | ||
// rustc.arg("-g"); // get any backtrace at all on errors | ||
} else if !self.props.no_prefer_dynamic { | ||
rustc.args(&["-C", "prefer-dynamic"]); | ||
|
@@ -2044,7 +2068,8 @@ impl<'test> TestCx<'test> { | |
} | ||
|
||
// Use dynamic musl for tests because static doesn't allow creating dylibs | ||
if self.config.host.contains("musl") { | ||
if self.config.host.contains("musl") | ||
|| self.is_vxworks_pure_dynamic() { | ||
rustc.arg("-Ctarget-feature=-crt-static"); | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.