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

Add a run-make test that LLD is not being used by default on the x64 beta/stable channel #127081

Merged
merged 1 commit into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions tests/run-make/rust-lld-by-default-beta-stable/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn main() {}
29 changes: 29 additions & 0 deletions tests/run-make/rust-lld-by-default-beta-stable/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Ensure that rust-lld is *not* used as the default linker on `x86_64-unknown-linux-gnu` on stable
// or beta.

//@ ignore-nightly
//@ only-x86_64-unknown-linux-gnu

use run_make_support::regex::Regex;
use run_make_support::rustc;
use std::process::Output;

fn main() {
// A regular compilation should not use rust-lld by default. 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")
.link_arg("-Wl,-v")
.input("main.rs")
.run();
assert!(
!find_lld_version_in_logs(output.stderr_utf8()),
"the LLD version string should not be present in the output logs:\n{}",
output.stderr_utf8()
);
}

fn find_lld_version_in_logs(stderr: String) -> bool {
let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
stderr.lines().any(|line| lld_version_re.is_match(line.trim()))
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Ensure that rust-lld is used as the default linker on `x86_64-unknown-linux-gnu`, and that it can
// also be turned off with a CLI flag.
// Ensure that rust-lld is used as the default linker on `x86_64-unknown-linux-gnu` on the nightly
// channel, and that it can also be turned off with a CLI flag.

//@ needs-rust-lld
//@ ignore-beta
Expand Down
Loading