Skip to content

Commit 58e428d

Browse files
committed
Add linker option to run-make-support
1 parent dabfbe9 commit 58e428d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/tools/run-make-support/src/rustc.rs

+6
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,12 @@ impl Rustc {
203203
self
204204
}
205205

206+
/// Specify the linker
207+
pub fn linker(&mut self, linker: &str) -> &mut Self {
208+
self.cmd.arg(format!("-Clinker={linker}"));
209+
self
210+
}
211+
206212
/// Get the [`Output`][::std::process::Output] of the finished process.
207213
#[track_caller]
208214
pub fn command_output(&mut self) -> ::std::process::Output {

tests/run-make/windows-safeseh/rmake.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ use run_make_support::rustc;
66
fn main() {
77
// Ensure that LLD can link when an .rlib contains a synthetic object
88
// file referencing exported or used symbols.
9-
rustc().input("foo.rs").arg("-Clinker=rust-lld").run();
9+
rustc().input("foo.rs").linker("rust-lld").run();
1010

1111
// Ensure that LLD can link when /WHOLEARCHIVE: is used with an .rlib.
1212
// Previously, lib.rmeta was not marked as (trivially) SAFESEH-aware.
1313
rustc().input("baz.rs").run();
14-
rustc().input("bar.rs").arg("-Clinker=rust-lld").link_arg("/WHOLEARCHIVE:libbaz.rlib").run();
14+
rustc().input("bar.rs").linker("rust-lld").link_arg("/WHOLEARCHIVE:libbaz.rlib").run();
1515
}

0 commit comments

Comments
 (0)