add link_arg
helper to run_make_support
and use it in the `rust-lld` tests
This commit is contained in:
parent
8fa6984e8e
commit
8acfe9a138
@ -149,6 +149,12 @@ impl Rustc {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add an extra argument to the linker invocation, via `-Clink-arg`.
|
||||||
|
pub fn link_arg(&mut self, link_arg: &str) -> &mut Self {
|
||||||
|
self.cmd.arg(format!("-Clink-arg={link_arg}"));
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn run_fail_assert_exit_code(&mut self, code: i32) -> Output {
|
pub fn run_fail_assert_exit_code(&mut self, code: i32) -> Output {
|
||||||
let caller_location = std::panic::Location::caller();
|
let caller_location = std::panic::Location::caller();
|
||||||
|
@ -21,7 +21,7 @@ fn main() {
|
|||||||
.env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
|
.env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
|
||||||
.crate_type("cdylib")
|
.crate_type("cdylib")
|
||||||
.target("custom-target.json")
|
.target("custom-target.json")
|
||||||
.arg("-Clink-args=-Wl,-v")
|
.link_arg("-Wl,-v")
|
||||||
.input("lib.rs")
|
.input("lib.rs")
|
||||||
.run();
|
.run();
|
||||||
assert!(
|
assert!(
|
||||||
@ -35,7 +35,7 @@ fn main() {
|
|||||||
.crate_type("cdylib")
|
.crate_type("cdylib")
|
||||||
.target("custom-target.json")
|
.target("custom-target.json")
|
||||||
.arg("-Zlinker-features=-lld")
|
.arg("-Zlinker-features=-lld")
|
||||||
.arg("-Clink-args=-Wl,-v")
|
.link_arg("-Wl,-v")
|
||||||
.input("lib.rs")
|
.input("lib.rs")
|
||||||
.run();
|
.run();
|
||||||
assert!(
|
assert!(
|
||||||
|
@ -19,7 +19,7 @@ fn main() {
|
|||||||
.arg("-Zlinker-features=+lld")
|
.arg("-Zlinker-features=+lld")
|
||||||
.arg("-Clink-self-contained=+linker")
|
.arg("-Clink-self-contained=+linker")
|
||||||
.arg("-Zunstable-options")
|
.arg("-Zunstable-options")
|
||||||
.arg("-Clink-args=-Wl,-v")
|
.link_arg("-Wl,-v")
|
||||||
.input("main.rs")
|
.input("main.rs")
|
||||||
.run();
|
.run();
|
||||||
assert!(
|
assert!(
|
||||||
@ -30,7 +30,7 @@ fn main() {
|
|||||||
// It should not be used when we explictly opt-out of lld.
|
// It should not be used when we explictly opt-out of lld.
|
||||||
let output = rustc()
|
let output = rustc()
|
||||||
.env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
|
.env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
|
||||||
.arg("-Clink-args=-Wl,-v")
|
.link_arg("-Wl,-v")
|
||||||
.arg("-Zlinker-features=-lld")
|
.arg("-Zlinker-features=-lld")
|
||||||
.input("main.rs")
|
.input("main.rs")
|
||||||
.run();
|
.run();
|
||||||
@ -43,7 +43,7 @@ fn main() {
|
|||||||
// times to rustc.
|
// times to rustc.
|
||||||
let output = rustc()
|
let output = rustc()
|
||||||
.env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
|
.env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
|
||||||
.arg("-Clink-args=-Wl,-v")
|
.link_arg("-Wl,-v")
|
||||||
.arg("-Clink-self-contained=+linker")
|
.arg("-Clink-self-contained=+linker")
|
||||||
.arg("-Zunstable-options")
|
.arg("-Zunstable-options")
|
||||||
.arg("-Zlinker-features=-lld")
|
.arg("-Zlinker-features=-lld")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user