about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/raw-dylib-cross-compilation/Makefile20
-rw-r--r--tests/run-make/raw-dylib-cross-compilation/rmake.rs41
3 files changed, 41 insertions, 21 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index dfbd3773d46..336d894ac75 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -136,7 +136,6 @@ run-make/profile/Makefile
 run-make/prune-link-args/Makefile
 run-make/raw-dylib-alt-calling-convention/Makefile
 run-make/raw-dylib-c/Makefile
-run-make/raw-dylib-cross-compilation/Makefile
 run-make/raw-dylib-custom-dlltool/Makefile
 run-make/raw-dylib-import-name-type/Makefile
 run-make/raw-dylib-inline-cross-dylib/Makefile
diff --git a/tests/run-make/raw-dylib-cross-compilation/Makefile b/tests/run-make/raw-dylib-cross-compilation/Makefile
deleted file mode 100644
index 2524f8500e1..00000000000
--- a/tests/run-make/raw-dylib-cross-compilation/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Tests that raw-dylib cross compilation works correctly
-
-# needs-dlltool
-
-# i686 dlltool.exe can't product x64 binaries.
-# ignore-i686-pc-windows-gnu
-
-include ../tools.mk
-
-all:
-	# Build as x86 and make sure that we have x86 objects only.
-	$(RUSTC) --crate-type lib --crate-name i686_raw_dylib_test --target i686-pc-windows-gnu lib.rs
-	"$(LLVM_BIN_DIR)"/llvm-objdump -a $(TMPDIR)/libi686_raw_dylib_test.rlib > $(TMPDIR)/i686.objdump.txt
-	$(CGREP) "file format coff-i386" < $(TMPDIR)/i686.objdump.txt
-	$(CGREP) -v "file format coff-x86-64" < $(TMPDIR)/i686.objdump.txt
-	# Build as x64 and make sure that we have x64 objects only.
-	$(RUSTC) --crate-type lib --crate-name x64_raw_dylib_test --target x86_64-pc-windows-gnu lib.rs
-	"$(LLVM_BIN_DIR)"/llvm-objdump -a $(TMPDIR)/libx64_raw_dylib_test.rlib > $(TMPDIR)/x64.objdump.txt
-	$(CGREP) "file format coff-x86-64" < $(TMPDIR)/x64.objdump.txt
-	$(CGREP) -v "file format coff-i386" < $(TMPDIR)/x64.objdump.txt
diff --git a/tests/run-make/raw-dylib-cross-compilation/rmake.rs b/tests/run-make/raw-dylib-cross-compilation/rmake.rs
new file mode 100644
index 00000000000..994345a197c
--- /dev/null
+++ b/tests/run-make/raw-dylib-cross-compilation/rmake.rs
@@ -0,0 +1,41 @@
+// When cross-compiling using `raw-dylib`, rustc would try to fetch some
+// very specific `dlltool` to complete the cross-compilation (such as `i686-w64-mingw32-dlltool`)
+// when Windows only calls it `dlltool`. This test performs some cross-compilation in a
+// way that previously failed due to this bug, and checks that it succeeds.
+// See https://github.com/rust-lang/rust/pull/108355
+
+//@ ignore-i686-pc-windows-msvc
+// Reason: dlltool on this distribution is unable to produce x64 binaries
+//@ needs-dlltool
+// Reason: this is the utility being checked by this test
+
+use run_make_support::{llvm_objdump, rust_lib_name, rustc};
+
+fn main() {
+    // Build as x86 and make sure that we have x86 objects only.
+    rustc()
+        .crate_type("lib")
+        .crate_name("i686_raw_dylib_test")
+        .target("i686-pc-windows-gnu")
+        .input("lib.rs")
+        .run();
+    llvm_objdump()
+        .arg("-a")
+        .input(rust_lib_name("i686_raw_dylib_test"))
+        .run()
+        .assert_stdout_contains("file format coff-i386")
+        .assert_stdout_not_contains("file format coff-x86-64");
+    // Build as x64 and make sure that we have x64 objects only.
+    rustc()
+        .crate_type("lib")
+        .crate_name("x64_raw_dylib_test")
+        .target("x86-64-pc-windows-gnu")
+        .input("lib.rs")
+        .run();
+    llvm_objdump()
+        .arg("-a")
+        .input(rust_lib_name("i686_raw_dylib_test"))
+        .run()
+        .assert_stdout_not_contains("file format coff-i386")
+        .assert_stdout_contains("file format coff-x86-64");
+}