Skip to content

Commit

Permalink
Add linker option to run-make-support
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed May 27, 2024
1 parent dabfbe9 commit 58e428d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/tools/run-make-support/src/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions tests/run-make/windows-safeseh/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit 58e428d

Please sign in to comment.