Skip to content

Commit 8751eb3

Browse files
committed
Auto merge of #8141 - ehuss:uwp_support, r=ehuss
Uplift windows gnu DLL import libraries. This is a repost of #6875, rebased with tests fixed.
2 parents 97d39ae + b19d6ac commit 8751eb3

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

src/cargo/core/compiler/build_context/target_info.rs

+11
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,17 @@ impl TargetInfo {
257257
flavor: FileFlavor::Normal,
258258
should_replace_hyphens: false,
259259
})
260+
} else if target_triple.ends_with("windows-gnu")
261+
&& crate_type.ends_with("dylib")
262+
&& suffix == ".dll"
263+
{
264+
// LD can link DLL directly, but LLD requires the import library.
265+
ret.push(FileType {
266+
suffix: ".dll.a".to_string(),
267+
prefix: "lib".to_string(),
268+
flavor: FileFlavor::Normal,
269+
should_replace_hyphens: false,
270+
})
260271
}
261272

262273
// See rust-lang/cargo#4535.

tests/testsuite/build.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3810,8 +3810,7 @@ fn cdylib_final_outputs() {
38103810
if cfg!(target_env = "msvc") {
38113811
vec!["foo_bar.dll.lib", "foo_bar.dll"]
38123812
} else {
3813-
// FIXME https://github.com/rust-lang/cargo/pull/6875
3814-
vec!["foo_bar.dll"]
3813+
vec!["foo_bar.dll", "libfoo_bar.dll.a"]
38153814
}
38163815
} else if cfg!(target_os = "macos") {
38173816
vec!["libfoo_bar.dylib"]

tests/testsuite/build_script.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,6 @@ fn build_script_with_dynamic_native_dependency() {
16631663
let src = root.join(&file);
16641664
let dst = out_dir.join(&file);
16651665
fs::copy(src, dst).unwrap();
1666-
// FIXME https://github.com/rust-lang/cargo/pull/6875
16671666
if cfg!(target_env = "msvc") {
16681667
fs::copy(root.join("builder.dll.lib"),
16691668
out_dir.join("builder.dll.lib")).unwrap();

tests/testsuite/out_dir.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ fn dynamic_library_with_debug() {
9292
&["libfoo.so"],
9393
&["libfoo.dylib"],
9494
&["foo.dll", "foo.dll.lib"],
95-
// FIXME https://github.com/rust-lang/cargo/pull/6875
96-
&["foo.dll"],
95+
&["foo.dll", "libfoo.dll.a"],
9796
);
9897
}
9998

tests/testsuite/plugins.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ fn plugin_with_dynamic_native_dependency() {
180180
let src = root.join(&file);
181181
let dst = out_dir.join(&file);
182182
fs::copy(src, dst).unwrap();
183-
// FIXME https://github.com/rust-lang/cargo/pull/6875
184-
if cfg!(target_env = "msvc") {
183+
if cfg!(target_env = "msvc") {
185184
fs::copy(root.join("builder.dll.lib"),
186185
out_dir.join("builder.dll.lib")).unwrap();
187186
}

0 commit comments

Comments
 (0)