-
Notifications
You must be signed in to change notification settings - Fork 2
Support static and dynamic linking mode for vxWorks in running test suite #2
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
Conversation
// rustc.arg("-g"); // get any backtrace at all on errors | ||
} else if !self.props.no_prefer_dynamic { | ||
rustc.args(&["-C", "prefer-dynamic"]); | ||
if self.config.target.contains("vxworks") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with the other changes, but this logic should be in the compiler, not the test code. I.e. -C prefer-dynamic
on VxWorks should imply -C target-feature=-crt-static
. Otherwise the tests may pass but "real world" use will lead to errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You wrote:
The reason that we need to change the code in test framework is that in testing the auxiliary library is built in shared library only which makes some “magic” happens inside rust,
It is not about if you are using option “-C prefer-dynamic” or not, what I noticed is if the auxiliary library is built in shared library then the shared library of “std” is linked into executable,
and if the auxiliary library is built in static library then the static library of “std” is linked into executable.
OK, then I'm ok with this change.
src/tools/compiletest/src/runtest.rs
Outdated
@@ -1725,6 +1725,17 @@ impl<'test> TestCx<'test> { | |||
} | |||
} | |||
|
|||
fn use_dynamic_linking(&self) -> bool { | |||
if self.config.target.contains("vxworks") { | |||
match env::var("DYLINK") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "RUST_TEST_DYLIB" (there are already a couple of other RUST_TEST_... environment variables).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or RUST_TEST_DYLINK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think RUST_TEST_DYLINK is better.
if environment variables 'RUST_TEST_DYLINK' is set to 1, then run test in 'pure' dynamic linking mode
439f273
to
45d5f22
Compare
Add `Instance::resolve_for_fn_ptr` (RFC 2091 #2/N) Supercedes: rust-lang#65082 Depends on: rust-lang#65037 Tracking issue: rust-lang#47809 [RFC text](https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md) steps taken: * [x] add a `ReifyShim` that is similar to `VirtualShim` in behavior (see rust-lang#54183) * [x] add `ty::Instance::resolve_for_fn_ptr` (leave `ty::Instance::resolve_vtable` alone), migrate appropriate callers * [x] `resolve_for_fn_ptr` returns the shim if calling a `#[track_caller]` function
run test for vxWorks in 'pure' static linking mode by default; if environment variables 'DYLINK' is set to 1, then run test in 'pure' dynamic linking mode.
r? @n-salim