-
Notifications
You must be signed in to change notification settings - Fork 14k
Fix tests to use static linking #148064
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
base: master
Are you sure you want to change the base?
Fix tests to use static linking #148064
Conversation
| @@ -1 +1,5 @@ | |||
| //@ no-prefer-dynamic | |||
|
|
|||
| #![crate_type = "lib"] | |||
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 surprised that --crate-type dylib overrides #![crate_type = "lib"].
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 it's documented to behave this way: https://doc.rust-lang.org/reference/linkage.html#r-link.repetition
|
@bors r+ |
|
@bors r- |
| static Z: u8 = (&ARRAY)[0]; | ||
|
|
||
| pub fn main() {} | ||
| pub fn main() { |
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.
Why does the auxiliary for this test need to change? This doesn't use extern "C" {} like the other test does.
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.
Not sure if the presence of extern "C" makes a material difference. If the auxiliary for this test is not changed, the test fails just like the other one, the symbol name is just mangled:
a.static_array_across_crate.fff1a89e6847c716-cgu.0.rcgu.o : error LNK2001: unresolved external symbol _ZN16pub_static_array5ARRAY17h4c54e0b13136769dE
Per discussion in #142742, this PR makes a couple of tests link in their helper crates statically. The
compiletest's default is to prefer dynamic linking, which in these cases would exercise a problematic (unsupported?) scenario.r? @bjorn3