9
9
10
10
use run_make_support:: { clang, env_var, llvm_ar, llvm_objdump, rustc, static_lib_name} ;
11
11
12
+ #[ cfg( any( target_arch = "aarch64" , target_arch = "arm" ) ) ]
13
+ static RUST_ALWAYS_INLINED_PATTERN : & ' static str = "bl.*<rust_always_inlined>" ;
14
+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
15
+ static RUST_ALWAYS_INLINED_PATTERN : & ' static str = "call.*rust_always_inlined" ;
16
+ #[ cfg( any( target_arch = "aarch64" , target_arch = "arm" ) ) ]
17
+ static C_ALWAYS_INLINED_PATTERN : & ' static str = "bl.*<c_always_inlined>" ;
18
+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
19
+ static C_ALWAYS_INLINED_PATTERN : & ' static str = "call.*c_always_inlined" ;
20
+
21
+ #[ cfg( any( target_arch = "aarch64" , target_arch = "arm" ) ) ]
22
+ static RUST_NEVER_INLINED_PATTERN : & ' static str = "bl.*<rust_never_inlined>" ;
23
+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
24
+ static RUST_NEVER_INLINED_PATTERN : & ' static str = "call.*rust_never_inlined" ;
25
+ #[ cfg( any( target_arch = "aarch64" , target_arch = "arm" ) ) ]
26
+ static C_NEVER_INLINED_PATTERN : & ' static str = "bl.*<c_never_inlined>" ;
27
+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
28
+ static C_NEVER_INLINED_PATTERN : & ' static str = "call.*c_never_inlined" ;
29
+
12
30
fn main ( ) {
13
31
rustc ( )
14
32
. linker_plugin_lto ( "on" )
@@ -31,14 +49,14 @@ fn main() {
31
49
. disassemble ( )
32
50
. input ( "cmain" )
33
51
. run ( )
34
- . assert_stdout_not_contains_regex ( "call.*rust_always_inlined" ) ;
52
+ . assert_stdout_not_contains_regex ( RUST_ALWAYS_INLINED_PATTERN ) ;
35
53
// As a sanity check, make sure we do find a call instruction to a
36
54
// non-inlined function
37
55
llvm_objdump ( )
38
56
. disassemble ( )
39
57
. input ( "cmain" )
40
58
. run ( )
41
- . assert_stdout_contains_regex ( "call.*rust_never_inlined" ) ;
59
+ . assert_stdout_contains_regex ( RUST_NEVER_INLINED_PATTERN ) ;
42
60
clang ( ) . input ( "clib.c" ) . lto ( "thin" ) . arg ( "-c" ) . out_exe ( "clib.o" ) . arg ( "-O2" ) . run ( ) ;
43
61
llvm_ar ( ) . obj_to_ar ( ) . output_input ( static_lib_name ( "xyz" ) , "clib.o" ) . run ( ) ;
44
62
rustc ( )
@@ -53,10 +71,10 @@ fn main() {
53
71
. disassemble ( )
54
72
. input ( "rsmain" )
55
73
. run ( )
56
- . assert_stdout_not_contains_regex ( "call.*c_always_inlined" ) ;
74
+ . assert_stdout_not_contains_regex ( C_ALWAYS_INLINED_PATTERN ) ;
57
75
llvm_objdump ( )
58
76
. disassemble ( )
59
77
. input ( "rsmain" )
60
78
. run ( )
61
- . assert_stdout_contains_regex ( "call.*c_never_inlined" ) ;
79
+ . assert_stdout_contains_regex ( C_NEVER_INLINED_PATTERN ) ;
62
80
}
0 commit comments