Skip to content

Commit

Permalink
fix watchos (arm64_32)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Dec 29, 2024
1 parent 7bc6c3a commit 5d8fd20
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions cidre/src/objc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#[cfg(all(target_arch = "aarch64", not(feature = "classic-objc-retain-release")))]
#[cfg(all(
target_arch = "aarch64",
not(target_pointer_width = "32"),
not(feature = "classic-objc-retain-release")
))]
use std::arch::asm;
use std::{borrow::Cow, ffi::c_void, intrinsics::transmute, marker::PhantomData, ptr::NonNull};

Expand Down Expand Up @@ -103,7 +107,11 @@ pub trait Obj: Sized + arc::Retain {

#[inline]
unsafe fn release(id: &mut Self) {
#[cfg(all(target_arch = "aarch64", not(feature = "classic-objc-retain-release")))]
#[cfg(all(
target_arch = "aarch64",
target_pointer_width = "64",
not(feature = "classic-objc-retain-release")
))]
{
asm!(
"bl _objc_release_{x}",
Expand All @@ -114,7 +122,11 @@ pub trait Obj: Sized + arc::Retain {
);
}

#[cfg(any(target_arch = "x86_64", feature = "classic-objc-retain-release"))]
#[cfg(any(
target_arch = "x86_64",
target_pointer_width = "32",
feature = "classic-objc-retain-release"
))]
{
objc_release(transmute(id));
}
Expand Down Expand Up @@ -225,7 +237,11 @@ pub unsafe fn sel_reg_name(str: *const i8) -> &'static Sel {
extern "C-unwind" {
#[cfg(any(target_arch = "x86_64", feature = "classic-objc-retain-release"))]
pub fn objc_retain<'a>(obj: &Id) -> &'a Id;
#[cfg(any(target_arch = "x86_64", feature = "classic-objc-retain-release"))]
#[cfg(any(
target_arch = "x86_64",
target_pointer_width = "32",
feature = "classic-objc-retain-release"
))]
fn objc_release(obj: &mut Id);

// fn objc_msgSend();
Expand Down

0 comments on commit 5d8fd20

Please # to comment.