99
1010use run_make_support:: { clang, env_var, llvm_ar, llvm_objdump, rustc, static_lib_name} ;
1111
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+
1230fn main ( ) {
1331 rustc ( )
1432 . linker_plugin_lto ( "on" )
@@ -31,14 +49,14 @@ fn main() {
3149 . disassemble ( )
3250 . input ( "cmain" )
3351 . run ( )
34- . assert_stdout_not_contains_regex ( "call.*rust_always_inlined" ) ;
52+ . assert_stdout_not_contains_regex ( RUST_ALWAYS_INLINED_PATTERN ) ;
3553 // As a sanity check, make sure we do find a call instruction to a
3654 // non-inlined function
3755 llvm_objdump ( )
3856 . disassemble ( )
3957 . input ( "cmain" )
4058 . run ( )
41- . assert_stdout_contains_regex ( "call.*rust_never_inlined" ) ;
59+ . assert_stdout_contains_regex ( RUST_NEVER_INLINED_PATTERN ) ;
4260 clang ( ) . input ( "clib.c" ) . lto ( "thin" ) . arg ( "-c" ) . out_exe ( "clib.o" ) . arg ( "-O2" ) . run ( ) ;
4361 llvm_ar ( ) . obj_to_ar ( ) . output_input ( static_lib_name ( "xyz" ) , "clib.o" ) . run ( ) ;
4462 rustc ( )
@@ -53,10 +71,10 @@ fn main() {
5371 . disassemble ( )
5472 . input ( "rsmain" )
5573 . run ( )
56- . assert_stdout_not_contains_regex ( "call.*c_always_inlined" ) ;
74+ . assert_stdout_not_contains_regex ( C_ALWAYS_INLINED_PATTERN ) ;
5775 llvm_objdump ( )
5876 . disassemble ( )
5977 . input ( "rsmain" )
6078 . run ( )
61- . assert_stdout_contains_regex ( "call.*c_never_inlined" ) ;
79+ . assert_stdout_contains_regex ( C_NEVER_INLINED_PATTERN ) ;
6280}
0 commit comments