Skip to content

Commit f35530f

Browse files
committed
Add Apple visionOS support
1 parent 30f4071 commit f35530f

File tree

2 files changed

+17
-26
lines changed

2 files changed

+17
-26
lines changed

build.rs

+2-11
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,7 @@ mod c {
377377

378378
// On iOS and 32-bit OSX these are all just empty intrinsics, no need to
379379
// include them.
380-
if target_os != "ios"
381-
&& target_os != "watchos"
382-
&& target_os != "tvos"
383-
&& (target_vendor != "apple" || target_arch != "x86")
384-
{
380+
if target_vendor != "apple" || target_arch != "x86" {
385381
sources.extend(&[
386382
("__absvti2", "absvti2.c"),
387383
("__addvti3", "addvti3.c"),
@@ -431,12 +427,7 @@ mod c {
431427
}
432428
}
433429

434-
if target_arch == "arm"
435-
&& target_os != "ios"
436-
&& target_os != "watchos"
437-
&& target_os != "tvos"
438-
&& target_env != "msvc"
439-
{
430+
if target_arch == "arm" && target_vendor != "apple" && target_env != "msvc" {
440431
sources.extend(&[
441432
("__aeabi_div0", "arm/aeabi_div0.c"),
442433
("__aeabi_drsub", "arm/aeabi_drsub.c"),

src/arm.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
use core::intrinsics;
55

6-
// iOS symbols have a leading underscore.
7-
#[cfg(target_os = "ios")]
6+
// Apple symbols have a leading underscore.
7+
#[cfg(target_vendor = "apple")]
88
macro_rules! bl {
99
($func:literal) => {
1010
concat!("bl _", $func)
1111
};
1212
}
13-
#[cfg(not(target_os = "ios"))]
13+
#[cfg(not(target_vendor = "apple"))]
1414
macro_rules! bl {
1515
($func:literal) => {
1616
concat!("bl ", $func)
@@ -82,12 +82,12 @@ intrinsics! {
8282

8383
// FIXME: The `*4` and `*8` variants should be defined as aliases.
8484

85-
#[cfg(not(target_os = "ios"))]
85+
#[cfg(not(target_vendor = "apple"))]
8686
pub unsafe extern "aapcs" fn __aeabi_memcpy(dest: *mut u8, src: *const u8, n: usize) {
8787
crate::mem::memcpy(dest, src, n);
8888
}
8989

90-
#[cfg(not(target_os = "ios"))]
90+
#[cfg(not(target_vendor = "apple"))]
9191
pub unsafe extern "aapcs" fn __aeabi_memcpy4(dest: *mut u8, src: *const u8, n: usize) {
9292
// We are guaranteed 4-alignment, so accessing at u32 is okay.
9393
let mut dest = dest as *mut u32;
@@ -104,33 +104,33 @@ intrinsics! {
104104
__aeabi_memcpy(dest as *mut u8, src as *const u8, n);
105105
}
106106

107-
#[cfg(not(target_os = "ios"))]
107+
#[cfg(not(target_vendor = "apple"))]
108108
pub unsafe extern "aapcs" fn __aeabi_memcpy8(dest: *mut u8, src: *const u8, n: usize) {
109109
__aeabi_memcpy4(dest, src, n);
110110
}
111111

112-
#[cfg(not(target_os = "ios"))]
112+
#[cfg(not(target_vendor = "apple"))]
113113
pub unsafe extern "aapcs" fn __aeabi_memmove(dest: *mut u8, src: *const u8, n: usize) {
114114
crate::mem::memmove(dest, src, n);
115115
}
116116

117-
#[cfg(not(any(target_os = "ios", target_env = "msvc")))]
117+
#[cfg(not(any(target_vendor = "apple", target_env = "msvc")))]
118118
pub unsafe extern "aapcs" fn __aeabi_memmove4(dest: *mut u8, src: *const u8, n: usize) {
119119
__aeabi_memmove(dest, src, n);
120120
}
121121

122-
#[cfg(not(any(target_os = "ios", target_env = "msvc")))]
122+
#[cfg(not(any(target_vendor = "apple", target_env = "msvc")))]
123123
pub unsafe extern "aapcs" fn __aeabi_memmove8(dest: *mut u8, src: *const u8, n: usize) {
124124
__aeabi_memmove(dest, src, n);
125125
}
126126

127-
#[cfg(not(target_os = "ios"))]
127+
#[cfg(not(target_vendor = "apple"))]
128128
pub unsafe extern "aapcs" fn __aeabi_memset(dest: *mut u8, n: usize, c: i32) {
129129
// Note the different argument order
130130
crate::mem::memset(dest, c, n);
131131
}
132132

133-
#[cfg(not(target_os = "ios"))]
133+
#[cfg(not(target_vendor = "apple"))]
134134
pub unsafe extern "aapcs" fn __aeabi_memset4(dest: *mut u8, n: usize, c: i32) {
135135
let mut dest = dest as *mut u32;
136136
let mut n = n;
@@ -147,22 +147,22 @@ intrinsics! {
147147
__aeabi_memset(dest as *mut u8, n, byte as i32);
148148
}
149149

150-
#[cfg(not(target_os = "ios"))]
150+
#[cfg(not(target_vendor = "apple"))]
151151
pub unsafe extern "aapcs" fn __aeabi_memset8(dest: *mut u8, n: usize, c: i32) {
152152
__aeabi_memset4(dest, n, c);
153153
}
154154

155-
#[cfg(not(target_os = "ios"))]
155+
#[cfg(not(target_vendor = "apple"))]
156156
pub unsafe extern "aapcs" fn __aeabi_memclr(dest: *mut u8, n: usize) {
157157
__aeabi_memset(dest, n, 0);
158158
}
159159

160-
#[cfg(not(any(target_os = "ios", target_env = "msvc")))]
160+
#[cfg(not(any(target_vendor = "apple", target_env = "msvc")))]
161161
pub unsafe extern "aapcs" fn __aeabi_memclr4(dest: *mut u8, n: usize) {
162162
__aeabi_memset4(dest, n, 0);
163163
}
164164

165-
#[cfg(not(any(target_os = "ios", target_env = "msvc")))]
165+
#[cfg(not(any(target_vendor = "apple", target_env = "msvc")))]
166166
pub unsafe extern "aapcs" fn __aeabi_memclr8(dest: *mut u8, n: usize) {
167167
__aeabi_memset4(dest, n, 0);
168168
}

0 commit comments

Comments
 (0)