Skip to content
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

Uplift windows gnu DLL import libraries. #8141

Merged
merged 2 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/cargo/core/compiler/build_context/target_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,17 @@ impl TargetInfo {
flavor: FileFlavor::Normal,
should_replace_hyphens: false,
})
} else if target_triple.ends_with("windows-gnu")
&& crate_type.ends_with("dylib")
&& suffix == ".dll"
{
// LD can link DLL directly, but LLD requires the import library.
ret.push(FileType {
suffix: ".dll.a".to_string(),
prefix: "lib".to_string(),
flavor: FileFlavor::Normal,
should_replace_hyphens: false,
})
}

// See rust-lang/cargo#4535.
Expand Down
3 changes: 1 addition & 2 deletions tests/testsuite/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3810,8 +3810,7 @@ fn cdylib_final_outputs() {
if cfg!(target_env = "msvc") {
vec!["foo_bar.dll.lib", "foo_bar.dll"]
} else {
// FIXME https://github.com/rust-lang/cargo/pull/6875
vec!["foo_bar.dll"]
vec!["foo_bar.dll", "libfoo_bar.dll.a"]
}
} else if cfg!(target_os = "macos") {
vec!["libfoo_bar.dylib"]
Expand Down
1 change: 0 additions & 1 deletion tests/testsuite/build_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,6 @@ fn build_script_with_dynamic_native_dependency() {
let src = root.join(&file);
let dst = out_dir.join(&file);
fs::copy(src, dst).unwrap();
// FIXME https://github.com/rust-lang/cargo/pull/6875
if cfg!(target_env = "msvc") {
fs::copy(root.join("builder.dll.lib"),
out_dir.join("builder.dll.lib")).unwrap();
Expand Down
3 changes: 1 addition & 2 deletions tests/testsuite/out_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ fn dynamic_library_with_debug() {
&["libfoo.so"],
&["libfoo.dylib"],
&["foo.dll", "foo.dll.lib"],
// FIXME https://github.com/rust-lang/cargo/pull/6875
&["foo.dll"],
&["foo.dll", "libfoo.dll.a"],
);
}

Expand Down
3 changes: 1 addition & 2 deletions tests/testsuite/plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ fn plugin_with_dynamic_native_dependency() {
let src = root.join(&file);
let dst = out_dir.join(&file);
fs::copy(src, dst).unwrap();
// FIXME https://github.com/rust-lang/cargo/pull/6875
if cfg!(target_env = "msvc") {
if cfg!(target_env = "msvc") {
fs::copy(root.join("builder.dll.lib"),
out_dir.join("builder.dll.lib")).unwrap();
}
Expand Down