Skip to content

Commit 4f1d230

Browse files
committed
Use LLVM objdump on Macos ARM64 because it is not possible to enable TME support with otool
1 parent 2edc74d commit 4f1d230

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

crates/stdarch-test/src/disassembly.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@ pub(crate) fn disassemble_myself() -> HashSet<Function> {
6767
String::from_utf8_lossy(Vec::leak(output.stdout))
6868
} else if cfg!(target_os = "windows") {
6969
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))
7088
} else if cfg!(target_os = "macos") {
7189
let output = Command::new("otool")
7290
.arg("-vt")

0 commit comments

Comments
 (0)