about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-07-29 13:58:19 +0000
committerbors <bors@rust-lang.org>2020-07-29 13:58:19 +0000
commit584e83dd5ae7a75b8214560c22eafbcfe153caa6 (patch)
treeeb24aacddc69ffba99306c244094deaaee69aef6 /src/test
parent06e7b93f6a2a3eeaf80fd6a9a3ef7b180bb5d778 (diff)
parent87abd656dabdb97758413b7f4be5bda9be71e26e (diff)
Auto merge of #72049 - mati865:mingw-lld, r=petrochenkov
MinGW: enable dllexport/dllimport

Fixes (only when using LLD) https://github.com/rust-lang/rust/issues/50176
Fixes https://github.com/rust-lang/rust/issues/72319

This makes `windows-gnu` on pair with `windows-msvc` when it comes to symbol exporting.
For MinGW it means both good things like correctly working dllimport/dllexport, ability to link with LLD and bad things like https://github.com/rust-lang/rust/issues/27438.

Not sure but maybe this should land behind unstable compiler option (`-Z`) or environment variable?
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-make-fulldeps/mingw-export-call-convention/Makefile9
-rw-r--r--src/test/run-make-fulldeps/mingw-export-call-convention/foo.rs4
-rw-r--r--src/test/run-make-fulldeps/tools.mk1
3 files changed, 14 insertions, 0 deletions
diff --git a/src/test/run-make-fulldeps/mingw-export-call-convention/Makefile b/src/test/run-make-fulldeps/mingw-export-call-convention/Makefile
new file mode 100644
index 00000000000..4a60059cc54
--- /dev/null
+++ b/src/test/run-make-fulldeps/mingw-export-call-convention/Makefile
@@ -0,0 +1,9 @@
+include ../tools.mk
+
+# only-windows-gnu
+
+all:
+	$(RUSTC) foo.rs
+	# FIXME: we should make sure __stdcall calling convention is used here
+	# but that only works with LLD right now
+	nm -g "$(call IMPLIB,foo)" | $(CGREP) bar
diff --git a/src/test/run-make-fulldeps/mingw-export-call-convention/foo.rs b/src/test/run-make-fulldeps/mingw-export-call-convention/foo.rs
new file mode 100644
index 00000000000..1fec00311ef
--- /dev/null
+++ b/src/test/run-make-fulldeps/mingw-export-call-convention/foo.rs
@@ -0,0 +1,4 @@
+#![crate_type = "cdylib"]
+
+#[no_mangle]
+pub extern "system" fn bar() {}
diff --git a/src/test/run-make-fulldeps/tools.mk b/src/test/run-make-fulldeps/tools.mk
index 8b885f1dc6d..f9b6d342295 100644
--- a/src/test/run-make-fulldeps/tools.mk
+++ b/src/test/run-make-fulldeps/tools.mk
@@ -51,6 +51,7 @@ ifdef IS_MSVC
 STATICLIB = $(TMPDIR)/$(1).lib
 STATICLIB_GLOB = $(1)*.lib
 else
+IMPLIB = $(TMPDIR)/lib$(1).dll.a
 STATICLIB = $(TMPDIR)/lib$(1).a
 STATICLIB_GLOB = lib$(1)*.a
 endif