about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-08-09 05:52:15 +0200
committerGitHub <noreply@github.com>2024-08-09 05:52:15 +0200
commit408baccd0dbda23763ce9c4451d3881099fed80f (patch)
tree60ea1bf9f7404bb8a9f64429339702e9395af93e
parent7485f8b9abc23c1225d549c6f6e540850ae8c06d (diff)
parent599bcb5cf1ea524a6636949726f0724bb3537425 (diff)
downloadrust-408baccd0dbda23763ce9c4451d3881099fed80f.tar.gz
rust-408baccd0dbda23763ce9c4451d3881099fed80f.zip
Rollup merge of #128804 - ChrisDenton:redudant, r=jieyouxu
run-make: enable msvc for redundant-libs

The issue here was that `foo` was not exporting any functions therefore creating an import library was unnecessary and elided by the linker.

I fixed it by exporting the functions.

try-job: x86_64-msvc
try-job: i686-msvc
-rw-r--r--tests/run-make/redundant-libs/foo.c10
-rw-r--r--tests/run-make/redundant-libs/rmake.rs6
2 files changed, 8 insertions, 8 deletions
diff --git a/tests/run-make/redundant-libs/foo.c b/tests/run-make/redundant-libs/foo.c
index 339ee86c99e..551b85d1824 100644
--- a/tests/run-make/redundant-libs/foo.c
+++ b/tests/run-make/redundant-libs/foo.c
@@ -1,2 +1,8 @@
-void foo1() {}
-void foo2() {}
+#ifdef _MSC_VER
+#define DllExport __declspec(dllexport)
+#else
+#define DllExport
+#endif
+
+DllExport void foo1() {}
+DllExport void foo2() {}
diff --git a/tests/run-make/redundant-libs/rmake.rs b/tests/run-make/redundant-libs/rmake.rs
index fb1b3bca8ad..43bb30bde70 100644
--- a/tests/run-make/redundant-libs/rmake.rs
+++ b/tests/run-make/redundant-libs/rmake.rs
@@ -10,12 +10,6 @@
 
 //@ ignore-cross-compile
 // Reason: the compiled binary is executed
-//@ ignore-windows-msvc
-// Reason: this test links libraries via link.exe, which only accepts the import library
-// for the dynamic library, i.e. `foo.dll.lib`. However, build_native_dynamic_lib only
-// produces `foo.dll` - the dynamic library itself. To make this test work on MSVC, one
-// would need to derive the import library from the dynamic library.
-// See https://stackoverflow.com/questions/9360280/
 
 use run_make_support::{
     build_native_dynamic_lib, build_native_static_lib, cwd, is_msvc, rfs, run, rustc,