From 5c3a43b53f1c4188f9dd597599633bc1a315bf44 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Mon, 23 Oct 2023 20:34:47 +0900 Subject: [PATCH] aarch64: Recognize target-cpu=apple-* in build script https://github.com/taiki-e/portable-atomic/pull/89#discussion_r1368046932 --- build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 4eee0fa5..b766752e 100644 --- a/build.rs +++ b/build.rs @@ -217,7 +217,7 @@ fn main() { // As of Apple M1/M1 Pro, on Apple hardware, CAS loop-based RMW is much slower than LL/SC // loop-based RMW: https://github.com/taiki-e/portable-atomic/pull/89 - if is_apple { + if is_apple || target_cpu().map_or(false, |cpu| cpu.starts_with("apple-")) { println!("cargo:rustc-cfg=portable_atomic_ll_sc_rmw"); } } @@ -283,7 +283,7 @@ fn main() { // See also https://github.com/rust-lang/rust/issues/59932 let mut has_pwr8_features = target_endian == "little"; // https://github.com/llvm/llvm-project/commit/549e118e93c666914a1045fde38a2cac33e1e445 - if let Some(cpu) = target_cpu().as_ref() { + if let Some(cpu) = &target_cpu() { if let Some(mut cpu_version) = strip_prefix(cpu, "pwr") { cpu_version = strip_suffix(cpu_version, "x").unwrap_or(cpu_version); // for pwr5x and pwr6x if let Ok(cpu_version) = cpu_version.parse::() {