diff options
Diffstat (limited to 'library/stdarch/crates/stdarch-test/src')
-rw-r--r-- | library/stdarch/crates/stdarch-test/src/disassembly.rs | 58 | ||||
-rw-r--r-- | library/stdarch/crates/stdarch-test/src/lib.rs | 15 |
2 files changed, 42 insertions, 31 deletions
diff --git a/library/stdarch/crates/stdarch-test/src/disassembly.rs b/library/stdarch/crates/stdarch-test/src/disassembly.rs index 5d7a27e8a..54df7261e 100644 --- a/library/stdarch/crates/stdarch-test/src/disassembly.rs +++ b/library/stdarch/crates/stdarch-test/src/disassembly.rs @@ -1,7 +1,7 @@ //! Disassembly calling function for most targets. use crate::Function; -use std::{collections::HashSet, env, process::Command, str}; +use std::{collections::HashSet, env, str}; // Extracts the "shim" name from the `symbol`. fn normalize(mut symbol: &str) -> String { @@ -39,10 +39,11 @@ fn normalize(mut symbol: &str) -> String { symbol } +#[cfg(windows)] pub(crate) fn disassemble_myself() -> HashSet<Function> { let me = env::current_exe().expect("failed to get current exe"); - let disassembly = if cfg!(target_os = "windows") && cfg!(target_env = "msvc") { + let disassembly = if cfg!(target_env = "msvc") { let target = if cfg!(target_arch = "x86_64") { "x86_64-pc-windows-msvc" } else if cfg!(target_arch = "x86") { @@ -65,32 +66,39 @@ pub(crate) fn disassemble_myself() -> HashSet<Function> { assert!(output.status.success()); // Windows does not return valid UTF-8 output: String::from_utf8_lossy(Vec::leak(output.stdout)) - } else if cfg!(target_os = "windows") { - panic!("disassembly unimplemented") } else { - let objdump = env::var("OBJDUMP").unwrap_or_else(|_| "objdump".to_string()); - let add_args = if cfg!(target_os = "macos") && cfg!(target_arch = "aarch64") { - // Target features need to be enabled for LLVM objdump on Macos ARM64 - vec!["--mattr=+v8.6a,+crypto,+tme"] - } else { - vec![] - }; - let output = Command::new(objdump.clone()) - .arg("--disassemble") - .arg("--no-show-raw-insn") - .args(add_args) - .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()); + panic!("disassembly unimplemented") + }; - String::from_utf8_lossy(Vec::leak(output.stdout)) + parse(&disassembly) +} + +#[cfg(not(windows))] +pub(crate) fn disassemble_myself() -> HashSet<Function> { + let me = env::current_exe().expect("failed to get current exe"); + + let objdump = env::var("OBJDUMP").unwrap_or_else(|_| "objdump".to_string()); + let add_args = if cfg!(target_os = "macos") && cfg!(target_arch = "aarch64") { + // Target features need to be enabled for LLVM objdump on Macos ARM64 + vec!["--mattr=+v8.6a,+crypto,+tme"] + } else { + vec![] }; + let output = std::process::Command::new(objdump.clone()) + .arg("--disassemble") + .arg("--no-show-raw-insn") + .args(add_args) + .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()); + + let disassembly = String::from_utf8_lossy(Vec::leak(output.stdout)); parse(&disassembly) } diff --git a/library/stdarch/crates/stdarch-test/src/lib.rs b/library/stdarch/crates/stdarch-test/src/lib.rs index 232e47ec1..7ea189ff5 100644 --- a/library/stdarch/crates/stdarch-test/src/lib.rs +++ b/library/stdarch/crates/stdarch-test/src/lib.rs @@ -129,17 +129,20 @@ pub fn assert(shim_addr: usize, fnname: &str, expected: &str) { "usad8" | "vfma" | "vfms" => 27, "qadd8" | "qsub8" | "sadd8" | "sel" | "shadd8" | "shsub8" | "usub8" | "ssub8" => 29, // core_arch/src/arm_shared/simd32 - // vst1q_s64_x4_vst1 : #instructions = 22 >= 22 (limit) - "vld3" => 23, + // vst1q_s64_x4_vst1 : #instructions = 27 >= 22 (limit) + "vld3" => 28, // core_arch/src/arm_shared/simd32 - // vld4q_lane_u32_vld4 : #instructions = 31 >= 22 (limit) - "vld4" => 32, + // vld4q_lane_u32_vld4 : #instructions = 36 >= 22 (limit) + "vld4" => 37, // core_arch/src/arm_shared/simd32 // vst1q_s64_x4_vst1 : #instructions = 40 >= 22 (limit) "vst1" => 41, // core_arch/src/arm_shared/simd32 - // vst4q_u32_vst4 : #instructions = 26 >= 22 (limit) - "vst4" => 27, + // vst3q_u32_vst3 : #instructions = 25 >= 22 (limit) + "vst3" => 26, + // core_arch/src/arm_shared/simd32 + // vst4q_u32_vst4 : #instructions = 33 >= 22 (limit) + "vst4" => 34, // core_arch/src/arm_shared/simd32 // vst1q_p64_x4_nop : #instructions = 33 >= 22 (limit) |