Skip to content

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

Merged
merged 1 commit into from
Aug 21, 2019

Conversation

BaoshanPang
Copy link

@BaoshanPang BaoshanPang commented Aug 16, 2019

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

// 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") {
Copy link

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.

Copy link

@n-salim n-salim Aug 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BaoshanPang

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.

@@ -1725,6 +1725,17 @@ impl<'test> TestCx<'test> {
}
}

fn use_dynamic_linking(&self) -> bool {
if self.config.target.contains("vxworks") {
match env::var("DYLINK") {
Copy link

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).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or RUST_TEST_DYLINK.

Copy link
Author

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.

Unverified

This user has not yet uploaded their public signing key.
if environment variables 'RUST_TEST_DYLINK' is set to 1, then run test in 'pure' dynamic linking mode
@BaoshanPang BaoshanPang force-pushed the bpang-runtest branch 2 times, most recently from 439f273 to 45d5f22 Compare August 21, 2019 04:40
@BaoshanPang BaoshanPang merged commit b37d107 into master Aug 21, 2019
BaoshanPang pushed a commit that referenced this pull request Oct 23, 2019

Unverified

This user has not yet uploaded their public signing key.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants