From 89eb2157cd6b0049e7c20aba3ab5032a4b2a0db4 Mon Sep 17 00:00:00 2001 From: Quentin Perez Date: Mon, 27 May 2024 05:15:02 +0200 Subject: [PATCH] Add Apple visionOS support (rust-lang/backtrace-rs#613) --- crates/macos_frames_test/tests/main.rs | 2 +- src/symbolize/gimli.rs | 19 +++++-------------- tests/accuracy/main.rs | 2 +- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/crates/macos_frames_test/tests/main.rs b/crates/macos_frames_test/tests/main.rs index 5d74bdcc3..1eace1a23 100644 --- a/crates/macos_frames_test/tests/main.rs +++ b/crates/macos_frames_test/tests/main.rs @@ -6,7 +6,7 @@ // so that it gets its own 'target' directory. We manually invoke this test // in .github/workflows/main.yml by passing `--manifest-path` to Cargo #[test] -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn backtrace_no_dsym() { use std::{env, fs}; diff --git a/src/symbolize/gimli.rs b/src/symbolize/gimli.rs index 51f1c8034..7465f755c 100644 --- a/src/symbolize/gimli.rs +++ b/src/symbolize/gimli.rs @@ -30,15 +30,16 @@ cfg_if::cfg_if! { if #[cfg(windows)] { #[path = "gimli/mmap_windows.rs"] mod mmap; + } else if #[cfg(target_vendor = "apple")] { + #[path = "gimli/mmap_unix.rs"] + mod mmap; } else if #[cfg(any( target_os = "android", target_os = "freebsd", target_os = "fuchsia", target_os = "haiku", target_os = "hurd", - target_os = "ios", target_os = "linux", - target_os = "macos", target_os = "openbsd", target_os = "solaris", target_os = "illumos", @@ -195,12 +196,7 @@ cfg_if::cfg_if! { if #[cfg(windows)] { mod coff; use self::coff::{handle_split_dwarf, Object}; - } else if #[cfg(any( - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", - ))] { + } else if #[cfg(any(target_vendor = "apple"))] { mod macho; use self::macho::{handle_split_dwarf, Object}; } else if #[cfg(target_os = "aix")] { @@ -216,12 +212,7 @@ cfg_if::cfg_if! { if #[cfg(windows)] { mod libs_windows; use libs_windows::native_libraries; - } else if #[cfg(any( - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", - ))] { + } else if #[cfg(target_vendor = "apple")] { mod libs_macos; use libs_macos::native_libraries; } else if #[cfg(target_os = "illumos")] { diff --git a/tests/accuracy/main.rs b/tests/accuracy/main.rs index ada842d28..b50e4451f 100644 --- a/tests/accuracy/main.rs +++ b/tests/accuracy/main.rs @@ -31,7 +31,7 @@ fn doit() { dir.pop(); if cfg!(windows) { dir.push("dylib_dep.dll"); - } else if cfg!(target_os = "macos") { + } else if cfg!(target_vendor = "apple") { dir.push("libdylib_dep.dylib"); } else if cfg!(target_os = "aix") { dir.push("libdylib_dep.a");