about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-04-13 00:59:36 +0000
committerbors <bors@rust-lang.org>2020-04-13 00:59:36 +0000
commitcc072281f9ebb828449cd37b0ffab37fd56017c1 (patch)
treeee05782eba7b23d45d63491c1c61ebd5a4186097
parent9fed36055070168e5238d6bf6e58a36f519fe427 (diff)
parenta32e3408bf061787d81eac9d8bfdd5874efd56a6 (diff)
downloadrust-cc072281f9ebb828449cd37b0ffab37fd56017c1.tar.gz
rust-cc072281f9ebb828449cd37b0ffab37fd56017c1.zip
Auto merge of #71023 - mati865:mingw-unwind-linking-cleanup, r=Amanieu
[windows] Add testscase for self-contained executables and fix pthread linking

Fixes https://github.com/rust-lang/rust/issues/71061
-rw-r--r--src/librustc_target/spec/windows_base.rs4
-rw-r--r--src/test/run-make-fulldeps/windows-binary-no-external-deps/Makefile9
-rw-r--r--src/test/run-make-fulldeps/windows-binary-no-external-deps/hello.rs3
3 files changed, 14 insertions, 2 deletions
diff --git a/src/librustc_target/spec/windows_base.rs b/src/librustc_target/spec/windows_base.rs
index 39350c1618a..097ee09f1ea 100644
--- a/src/librustc_target/spec/windows_base.rs
+++ b/src/librustc_target/spec/windows_base.rs
@@ -57,9 +57,9 @@ pub fn opts() -> TargetOptions {
             // binaries to be redistributed without the libgcc_s-dw2-1.dll
             // dependency, but unfortunately break unwinding across DLL
             // boundaries when unwinding across FFI boundaries.
-            "-lgcc".to_string(),
             "-lgcc_eh".to_string(),
-            "-lpthread".to_string(),
+            "-l:libpthread.a".to_string(),
+            "-lgcc".to_string(),
             // libpthread depends on libmsvcrt, so we need to link it *again*.
             "-lmsvcrt".to_string(),
             "-lkernel32".to_string(),
diff --git a/src/test/run-make-fulldeps/windows-binary-no-external-deps/Makefile b/src/test/run-make-fulldeps/windows-binary-no-external-deps/Makefile
new file mode 100644
index 00000000000..f6adb6d7627
--- /dev/null
+++ b/src/test/run-make-fulldeps/windows-binary-no-external-deps/Makefile
@@ -0,0 +1,9 @@
+-include ../tools.mk
+
+# only-windows
+
+PATH=$(SYSTEMROOT)/system32
+
+all:
+	$(RUSTC) hello.rs
+	$(TMPDIR)/hello.exe
diff --git a/src/test/run-make-fulldeps/windows-binary-no-external-deps/hello.rs b/src/test/run-make-fulldeps/windows-binary-no-external-deps/hello.rs
new file mode 100644
index 00000000000..47ad8c63411
--- /dev/null
+++ b/src/test/run-make-fulldeps/windows-binary-no-external-deps/hello.rs
@@ -0,0 +1,3 @@
+fn main() {
+    println!("Hello World!");
+}