Convert run-make/windows-safeseh to rmake

This commit is contained in:
Chris Denton 2024-05-29 13:14:19 +00:00
parent e463f6fd0b
commit e03f9cb52d
No known key found for this signature in database
GPG Key ID: 713472F2F45627DE
3 changed files with 21 additions and 19 deletions

View File

@ -203,6 +203,12 @@ pub fn crate_name<S: AsRef<OsStr>>(&mut self, name: S) -> &mut Self {
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 {

View File

@ -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

View File

@ -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();
}