15
15
//@ ignore-cross-compile
16
16
17
17
use run_make_support:: { llvm_profdata, rustc, rustdoc, stdin_command, target, tmp_dir} ;
18
- use std:: io:: { self , Write } ;
19
- use std:: process:: Command ;
20
18
21
19
fn main ( ) {
22
20
// For some very small programs GNU ld seems to not properly handle
23
21
// instrumentation sections correctly. Neither Gold nor LLD have that
24
22
// problem.
25
- let link_args = ( cfg ! ( target_os = "linux" ) && target ( ) . contains ( "x86" ) ) . then_some ( "-Clink-args=-fuse-ld=gold" ) ;
23
+ let link_args = ( cfg ! ( target_os = "linux" ) && target ( ) . contains ( "x86" ) )
24
+ . then_some ( "-Clink-args=-fuse-ld=gold" ) ;
26
25
27
26
let path_prof_data_dir = tmp_dir ( ) . join ( "prof_data_dir" ) ;
28
27
let path_merged_profdata = path_prof_data_dir. join ( "merged.profdata" ) ;
@@ -32,24 +31,28 @@ fn main() {
32
31
}
33
32
invoc. run ( ) ;
34
33
fs:: create_dir_all ( & path_prof_data_dir) ;
35
- let invoc = rustc ( ) . input ( "interesting.rs" )
34
+ let invoc = rustc ( )
35
+ . input ( "interesting.rs" )
36
36
. profile_generate ( & path_prof_data_dir)
37
37
. opt ( )
38
38
. codegen_units ( 1 ) ;
39
39
if let Some ( link_args) = link_args {
40
40
invoc. arg ( link_args) ;
41
41
}
42
42
invoc. run ( ) ;
43
- let invoc = rustc ( ) . input ( "main.rs" )
44
- . profile_generate ( & path_prof_data_dir)
45
- . opt ( ) ;
43
+ let invoc = rustc ( ) . input ( "main.rs" ) . profile_generate ( & path_prof_data_dir) . opt ( ) ;
46
44
if let Some ( link_args) = link_args {
47
45
invoc. arg ( link_args) ;
48
46
}
49
47
invoc. run ( ) ;
50
48
run ( "main" ) ;
51
- llvm_profdata ( ) . merge ( ) . output ( & path_merged_profdata) . input ( path_prof_data_dir) . command_output ( ) ;
52
- let invoc = rustc ( ) . input ( "interesting.rs" )
49
+ llvm_profdata ( )
50
+ . merge ( )
51
+ . output ( & path_merged_profdata)
52
+ . input ( path_prof_data_dir)
53
+ . command_output ( ) ;
54
+ let invoc = rustc ( )
55
+ . input ( "interesting.rs" )
53
56
. profile_use ( path_merged_profdata)
54
57
. opt ( )
55
58
. codegen_units ( 1 )
0 commit comments