about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Denton <chris@chrisdenton.dev>2024-05-29 13:14:19 +0000
committerChris Denton <chris@chrisdenton.dev>2024-05-29 13:14:19 +0000
commite03f9cb52debfbbc3d995584b572f219b31dad7f (patch)
tree97b0f970df826ea78da0fbb5bc706d0fac4c5502
parente463f6fd0bbd7d22bb81cd1ab769eeeb21d9e91d (diff)
downloadrust-e03f9cb52debfbbc3d995584b572f219b31dad7f.tar.gz
rust-e03f9cb52debfbbc3d995584b572f219b31dad7f.zip
Convert run-make/windows-safeseh to rmake
-rw-r--r--src/tools/run-make-support/src/rustc.rs6
-rw-r--r--tests/run-make/windows-safeseh/Makefile19
-rw-r--r--tests/run-make/windows-safeseh/rmake.rs15
3 files changed, 21 insertions, 19 deletions
diff --git a/src/tools/run-make-support/src/rustc.rs b/src/tools/run-make-support/src/rustc.rs
index b424ae3f421..5dde0f91fea 100644
--- a/src/tools/run-make-support/src/rustc.rs
+++ b/src/tools/run-make-support/src/rustc.rs
@@ -203,6 +203,12 @@ impl Rustc {
         self
     }
 
+    /// Specify the linker
+    pub fn linker(&mut self, linker: &str) -> &mut Self {
+        self.cmd.arg(format!("-Clinker={linker}"));
+        self
+    }
+
     /// Get the [`Output`] of the finished process.
     #[track_caller]
     pub fn command_output(&mut self) -> ::std::process::Output {
diff --git a/tests/run-make/windows-safeseh/Makefile b/tests/run-make/windows-safeseh/Makefile
deleted file mode 100644
index d6a403961d7..00000000000
--- a/tests/run-make/windows-safeseh/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# only-windows
-# needs-rust-lld
-
-include ../tools.mk
-
-all: foo bar
-
-# Ensure that LLD can link when an .rlib contains a synthetic object
-# file referencing exported or used symbols.
-foo:
-	$(RUSTC) -C linker=rust-lld foo.rs
-
-# Ensure that LLD can link when /WHOLEARCHIVE: is used with an .rlib.
-# Previously, lib.rmeta was not marked as (trivially) SAFESEH-aware.
-bar: baz
-	$(RUSTC) -C linker=rust-lld -C link-arg=/WHOLEARCHIVE:libbaz.rlib bar.rs
-
-baz:
-	$(RUSTC) baz.rs
diff --git a/tests/run-make/windows-safeseh/rmake.rs b/tests/run-make/windows-safeseh/rmake.rs
new file mode 100644
index 00000000000..10e6b38aa8d
--- /dev/null
+++ b/tests/run-make/windows-safeseh/rmake.rs
@@ -0,0 +1,15 @@
+//@ only-windows
+//@ needs-rust-lld
+
+use run_make_support::rustc;
+
+fn main() {
+    // Ensure that LLD can link when an .rlib contains a synthetic object
+    // file referencing exported or used symbols.
+    rustc().input("foo.rs").linker("rust-lld").run();
+
+    // Ensure that LLD can link when /WHOLEARCHIVE: is used with an .rlib.
+    // Previously, lib.rmeta was not marked as (trivially) SAFESEH-aware.
+    rustc().input("baz.rs").run();
+    rustc().input("bar.rs").linker("rust-lld").link_arg("/WHOLEARCHIVE:libbaz.rlib").run();
+}