Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use LLVM objdump on Macos instead of otool for CI tests #1208

Merged
merged 6 commits into from
Sep 8, 2021
18 changes: 18 additions & 0 deletions crates/stdarch-test/src/disassembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,24 @@ pub(crate) fn disassemble_myself() -> HashSet<Function> {
String::from_utf8_lossy(Vec::leak(output.stdout))
} else if cfg!(target_os = "windows") {
panic!("disassembly unimplemented")
} else if cfg!(target_os = "macos") && cfg!(target_arch = "aarch64") {
// use LLVM objdump because it is not possible to enable TME support with otool
let objdump = env::var("OBJDUMP").unwrap_or_else(|_| "objdump".to_string());
let output = Command::new(objdump.clone())
.arg("--disassemble")
.arg("--no-show-raw-insn")
.arg("--mattr=+crc,+crypto,+tme")
.arg(&me)
.output()
.unwrap_or_else(|_| panic!("failed to execute objdump. OBJDUMP={}", objdump));
println!(
"{}\n{}",
output.status,
String::from_utf8_lossy(&output.stderr)
);
assert!(output.status.success());

String::from_utf8_lossy(Vec::leak(output.stdout))
} else if cfg!(target_os = "macos") {
let output = Command::new("otool")
.arg("-vt")
Expand Down