diff --git a/src/tools/run-make-support/src/rustc.rs b/src/tools/run-make-support/src/rustc.rs index 1c83b630861cd..a617c189fb423 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`][::std::process::Output] of the finished process. #[track_caller] pub fn command_output(&mut self) -> ::std::process::Output { diff --git a/tests/run-make/windows-safeseh/rmake.rs b/tests/run-make/windows-safeseh/rmake.rs index 56d3ff4ea0d81..10e6b38aa8df1 100644 --- a/tests/run-make/windows-safeseh/rmake.rs +++ b/tests/run-make/windows-safeseh/rmake.rs @@ -6,10 +6,10 @@ 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").arg("-Clinker=rust-lld").run(); + 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").arg("-Clinker=rust-lld").link_arg("/WHOLEARCHIVE:libbaz.rlib").run(); + rustc().input("bar.rs").linker("rust-lld").link_arg("/WHOLEARCHIVE:libbaz.rlib").run(); }