@@ -67,43 +67,18 @@ pub(crate) fn disassemble_myself() -> HashSet<Function> {
67
67
String :: from_utf8_lossy ( Vec :: leak ( output. stdout ) )
68
68
} else if cfg ! ( target_os = "windows" ) {
69
69
panic ! ( "disassembly unimplemented" )
70
- } else if cfg ! ( target_os = "macos" ) && cfg ! ( target_arch = "aarch64" ) {
71
- // use LLVM objdump because it is not possible to enable TME support with otool
72
- let objdump = env:: var ( "OBJDUMP" ) . unwrap_or_else ( |_| "objdump" . to_string ( ) ) ;
73
- let output = Command :: new ( objdump. clone ( ) )
74
- . arg ( "--disassemble" )
75
- . arg ( "--no-show-raw-insn" )
76
- . arg ( "--mattr=+crc,+crypto,+tme" )
77
- . arg ( & me)
78
- . output ( )
79
- . unwrap_or_else ( |_| panic ! ( "failed to execute objdump. OBJDUMP={}" , objdump) ) ;
80
- println ! (
81
- "{}\n {}" ,
82
- output. status,
83
- String :: from_utf8_lossy( & output. stderr)
84
- ) ;
85
- assert ! ( output. status. success( ) ) ;
86
-
87
- String :: from_utf8_lossy ( Vec :: leak ( output. stdout ) )
88
- } else if cfg ! ( target_os = "macos" ) {
89
- let output = Command :: new ( "otool" )
90
- . arg ( "-vt" )
91
- . arg ( & me)
92
- . output ( )
93
- . expect ( "failed to execute otool" ) ;
94
- println ! (
95
- "{}\n {}" ,
96
- output. status,
97
- String :: from_utf8_lossy( & output. stderr)
98
- ) ;
99
- assert ! ( output. status. success( ) ) ;
100
-
101
- String :: from_utf8_lossy ( Vec :: leak ( output. stdout ) )
102
70
} else {
103
71
let objdump = env:: var ( "OBJDUMP" ) . unwrap_or_else ( |_| "objdump" . to_string ( ) ) ;
72
+ let add_args = if cfg ! ( target_os = "macos" ) && cfg ! ( target_arch = "aarch64" ) {
73
+ // Target features need to be enabled for LLVM objdump on Macos ARM64
74
+ vec ! [ "--mattr=+crc,+crypto,+tme" ]
75
+ } else {
76
+ vec ! [ ]
77
+ } ;
104
78
let output = Command :: new ( objdump. clone ( ) )
105
79
. arg ( "--disassemble" )
106
80
. arg ( "--no-show-raw-insn" )
81
+ . args ( add_args)
107
82
. arg ( & me)
108
83
. output ( )
109
84
. unwrap_or_else ( |_| panic ! ( "failed to execute objdump. OBJDUMP={}" , objdump) ) ;
0 commit comments