File tree 3 files changed +11
-5
lines changed
src/tools/run-make-support/src
3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,12 @@ impl Rustc {
149
149
self
150
150
}
151
151
152
+ /// Add an extra argument to the linker invocation, via `-Clink-arg`.
153
+ pub fn link_arg ( & mut self , link_arg : & str ) -> & mut Self {
154
+ self . cmd . arg ( format ! ( "-Clink-arg={link_arg}" ) ) ;
155
+ self
156
+ }
157
+
152
158
#[ track_caller]
153
159
pub fn run_fail_assert_exit_code ( & mut self , code : i32 ) -> Output {
154
160
let caller_location = std:: panic:: Location :: caller ( ) ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ fn main() {
21
21
. env ( "RUSTC_LOG" , "rustc_codegen_ssa::back::link=info" )
22
22
. crate_type ( "cdylib" )
23
23
. target ( "custom-target.json" )
24
- . arg ( "-Clink-args= -Wl,-v")
24
+ . link_arg ( " -Wl,-v")
25
25
. input ( "lib.rs" )
26
26
. run ( ) ;
27
27
assert ! (
@@ -35,7 +35,7 @@ fn main() {
35
35
. crate_type ( "cdylib" )
36
36
. target ( "custom-target.json" )
37
37
. arg ( "-Zlinker-features=-lld" )
38
- . arg ( "-Clink-args= -Wl,-v")
38
+ . link_arg ( " -Wl,-v")
39
39
. input ( "lib.rs" )
40
40
. run ( ) ;
41
41
assert ! (
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ fn main() {
19
19
. arg ( "-Zlinker-features=+lld" )
20
20
. arg ( "-Clink-self-contained=+linker" )
21
21
. arg ( "-Zunstable-options" )
22
- . arg ( "-Clink-args= -Wl,-v")
22
+ . link_arg ( " -Wl,-v")
23
23
. input ( "main.rs" )
24
24
. run ( ) ;
25
25
assert ! (
@@ -30,7 +30,7 @@ fn main() {
30
30
// It should not be used when we explictly opt-out of lld.
31
31
let output = rustc ( )
32
32
. env ( "RUSTC_LOG" , "rustc_codegen_ssa::back::link=info" )
33
- . arg ( "-Clink-args= -Wl,-v")
33
+ . link_arg ( " -Wl,-v")
34
34
. arg ( "-Zlinker-features=-lld" )
35
35
. input ( "main.rs" )
36
36
. run ( ) ;
@@ -43,7 +43,7 @@ fn main() {
43
43
// times to rustc.
44
44
let output = rustc ( )
45
45
. env ( "RUSTC_LOG" , "rustc_codegen_ssa::back::link=info" )
46
- . arg ( "-Clink-args= -Wl,-v")
46
+ . link_arg ( " -Wl,-v")
47
47
. arg ( "-Clink-self-contained=+linker" )
48
48
. arg ( "-Zunstable-options" )
49
49
. arg ( "-Zlinker-features=-lld" )
You can’t perform that action at this time.
0 commit comments