Skip to content

Commit a8a75ad

Browse files
committed
Auto merge of rust-lang#134918 - ChrisDenton:issue-70093, r=<try>
Windows: Enable issue 70093 link tests `-Zlink-native-libraries=no` and `-Zlink-directives=no` *should* work on Windows, at least for msvc. The fly in ointment is that `default-linker-libraries` doesn't. On unixy platforms rustc calls another compiler which in turn calls the linker along with the default libraries. On MSVC rustc calls the linker directly therefore it would need to be the one to implement `default-linker-libraries`. Except it doesn't so we workaround that in the test by using `-C link-arg` to talk to the linker. Marking as draft while I test if it actually *does* work, try-job: i686-mingw try-job: x86_64-mingw-1
2 parents c156614 + 8ff5758 commit a8a75ad

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

src/tools/tidy/src/issues.txt

-2
Original file line numberDiff line numberDiff line change
@@ -2710,8 +2710,6 @@ ui/limits/issue-75158-64.rs
27102710
ui/link-native-libs/issue-109144.rs
27112711
ui/link-native-libs/issue-43925.rs
27122712
ui/link-native-libs/issue-43926.rs
2713-
ui/link-native-libs/issue-70093/issue-70093-link-directives.rs
2714-
ui/link-native-libs/issue-70093/issue-70093.rs
27152713
ui/linkage-attr/auxiliary/issue-12133-dylib.rs
27162714
ui/linkage-attr/auxiliary/issue-12133-dylib2.rs
27172715
ui/linkage-attr/auxiliary/issue-12133-rlib.rs

tests/ui/link-native-libs/issue-70093/issue-70093-link-directives.rs renamed to tests/ui/link-native-libs/issue-70093/link-directives.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ run-pass
22
//@ compile-flags: -Zlink-directives=no
3-
//@ ignore-windows - this will probably only work on unixish systems
43
//@ ignore-fuchsia - missing __libc_start_main for some reason (#84733)
54
//@ ignore-cross-compile - default-linker-libraries=yes doesn't play well with cross compiling
65

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// On Windows MSVC, default-linker-libraries=yes doesn't work because
2+
// rustc drives the linker directly instead of going through another compiler.
3+
// Therefore rustc would need to implement default-linker-libraries itself but doesn't.
4+
// So instead we use -Clink-arg to directly set the required msvcrt.lib as a link arg.
5+
6+
//@ run-pass
7+
//@ compile-flags: -Zlink-native-libraries=no -Clink-arg=msvcrt.lib
8+
//@ only-msvc
9+
//@ ignore-cross-compile
10+
11+
#[link(name = "some-random-non-existent-library", kind = "static")]
12+
extern "C" {}
13+
14+
fn main() {}

0 commit comments

Comments
 (0)