Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable msvc for run-make/rust-lld #128656

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions tests/run-make/rust-lld/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@
// see https://github.com/rust-lang/compiler-team/issues/510 for more info

//@ needs-rust-lld
//@ ignore-msvc
//@ ignore-s390x lld does not yet support s390x as target

use std::process::Output;

use run_make_support::regex::Regex;
use run_make_support::rustc;
use run_make_support::{is_msvc, rustc};

fn main() {
// lld-link is used if msvc, otherwise a gnu-compatible lld is used.
let linker_version_flag = if is_msvc() { "--version" } else { "-Wl,-v" };

// Opt-in to lld and the self-contained linker, to link with rust-lld. We'll check that by
// asking the linker to display its version number with a link-arg.
let output = rustc()
.env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
.arg("-Zlinker-features=+lld")
.arg("-Clink-self-contained=+linker")
.arg("-Zunstable-options")
.link_arg("-Wl,-v")
.link_arg(linker_version_flag)
.input("main.rs")
.run();
assert!(
Expand All @@ -27,10 +29,10 @@ fn main() {
output.stderr_utf8()
);

// It should not be used when we explictly opt-out of lld.
// It should not be used when we explicitly opt-out of lld.
let output = rustc()
.env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
.link_arg("-Wl,-v")
.link_arg(linker_version_flag)
.arg("-Zlinker-features=-lld")
.input("main.rs")
.run();
Expand All @@ -44,7 +46,7 @@ fn main() {
// times to rustc.
let output = rustc()
.env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
.link_arg("-Wl,-v")
.link_arg(linker_version_flag)
.arg("-Clink-self-contained=+linker")
.arg("-Zunstable-options")
.arg("-Zlinker-features=-lld")
Expand Down
Loading