Skip to content

Commit 3824fb5

Browse files
committed
Add Apple visionOS support
1 parent 7240849 commit 3824fb5

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

build.rs

+2
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ mod c {
311311
if target_os != "ios"
312312
&& target_os != "watchos"
313313
&& target_os != "tvos"
314+
&& target_os != "visionos"
314315
&& (target_vendor != "apple" || target_arch != "x86")
315316
{
316317
sources.extend(&[
@@ -364,6 +365,7 @@ mod c {
364365

365366
if target_arch == "arm"
366367
&& target_os != "ios"
368+
&& target_os != "visionos"
367369
&& target_os != "watchos"
368370
&& target_os != "tvos"
369371
&& target_env != "msvc"

src/arm.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
use core::intrinsics;
55

66
// iOS symbols have a leading underscore.
7-
#[cfg(target_os = "ios")]
7+
#[cfg(any(target_os = "ios", target_os = "visionos"))]
88
macro_rules! bl {
99
($func:literal) => {
1010
concat!("bl _", $func)
1111
};
1212
}
13-
#[cfg(not(target_os = "ios"))]
13+
#[cfg(not(any(target_os = "ios", target_os = "visionos")))]
1414
macro_rules! bl {
1515
($func:literal) => {
1616
concat!("bl ", $func)
@@ -89,13 +89,13 @@ intrinsics! {
8989
// FIXME: The `*4` and `*8` variants should be defined as aliases.
9090

9191
#[weak]
92-
#[cfg(not(target_os = "ios"))]
92+
#[cfg(not(any(target_os = "ios", target_os = "visionos")))]
9393
pub unsafe extern "aapcs" fn __aeabi_memcpy(dest: *mut u8, src: *const u8, n: usize) {
9494
crate::mem::memcpy(dest, src, n);
9595
}
9696

9797
#[weak]
98-
#[cfg(not(target_os = "ios"))]
98+
#[cfg(not(any(target_os = "ios", target_os = "visionos")))]
9999
pub unsafe extern "aapcs" fn __aeabi_memcpy4(dest: *mut u8, src: *const u8, n: usize) {
100100
// We are guaranteed 4-alignment, so accessing at u32 is okay.
101101
let mut dest = dest as *mut u32;
@@ -113,38 +113,38 @@ intrinsics! {
113113
}
114114

115115
#[weak]
116-
#[cfg(not(target_os = "ios"))]
116+
#[cfg(not(any(target_os = "ios", target_os = "visionos")))]
117117
pub unsafe extern "aapcs" fn __aeabi_memcpy8(dest: *mut u8, src: *const u8, n: usize) {
118118
__aeabi_memcpy4(dest, src, n);
119119
}
120120

121121
#[weak]
122-
#[cfg(not(target_os = "ios"))]
122+
#[cfg(not(any(target_os = "ios", target_os = "visionos")))]
123123
pub unsafe extern "aapcs" fn __aeabi_memmove(dest: *mut u8, src: *const u8, n: usize) {
124124
crate::mem::memmove(dest, src, n);
125125
}
126126

127127
#[weak]
128-
#[cfg(not(any(target_os = "ios", target_env = "msvc")))]
128+
#[cfg(not(any(target_os = "ios", target_os = "visionos", target_env = "msvc")))]
129129
pub unsafe extern "aapcs" fn __aeabi_memmove4(dest: *mut u8, src: *const u8, n: usize) {
130130
__aeabi_memmove(dest, src, n);
131131
}
132132

133133
#[weak]
134-
#[cfg(not(any(target_os = "ios", target_env = "msvc")))]
134+
#[cfg(not(any(target_os = "ios", target_os = "visionos", target_env = "msvc")))]
135135
pub unsafe extern "aapcs" fn __aeabi_memmove8(dest: *mut u8, src: *const u8, n: usize) {
136136
__aeabi_memmove(dest, src, n);
137137
}
138138

139139
#[weak]
140-
#[cfg(not(target_os = "ios"))]
140+
#[cfg(not(any(target_os = "ios", target_os = "visionos")))]
141141
pub unsafe extern "aapcs" fn __aeabi_memset(dest: *mut u8, n: usize, c: i32) {
142142
// Note the different argument order
143143
crate::mem::memset(dest, c, n);
144144
}
145145

146146
#[weak]
147-
#[cfg(not(target_os = "ios"))]
147+
#[cfg(not(any(target_os = "ios", target_os = "visionos")))]
148148
pub unsafe extern "aapcs" fn __aeabi_memset4(dest: *mut u8, n: usize, c: i32) {
149149
let mut dest = dest as *mut u32;
150150
let mut n = n;
@@ -162,25 +162,25 @@ intrinsics! {
162162
}
163163

164164
#[weak]
165-
#[cfg(not(target_os = "ios"))]
165+
#[cfg(not(any(target_os = "ios", target_os = "visionos")))]
166166
pub unsafe extern "aapcs" fn __aeabi_memset8(dest: *mut u8, n: usize, c: i32) {
167167
__aeabi_memset4(dest, n, c);
168168
}
169169

170170
#[weak]
171-
#[cfg(not(target_os = "ios"))]
171+
#[cfg(not(any(target_os = "ios", target_os = "visionos")))]
172172
pub unsafe extern "aapcs" fn __aeabi_memclr(dest: *mut u8, n: usize) {
173173
__aeabi_memset(dest, n, 0);
174174
}
175175

176176
#[weak]
177-
#[cfg(not(any(target_os = "ios", target_env = "msvc")))]
177+
#[cfg(not(any(target_os = "ios", target_os = "visionos", target_env = "msvc")))]
178178
pub unsafe extern "aapcs" fn __aeabi_memclr4(dest: *mut u8, n: usize) {
179179
__aeabi_memset4(dest, n, 0);
180180
}
181181

182182
#[weak]
183-
#[cfg(not(any(target_os = "ios", target_env = "msvc")))]
183+
#[cfg(not(any(target_os = "ios", target_os = "visionos", target_env = "msvc")))]
184184
pub unsafe extern "aapcs" fn __aeabi_memclr8(dest: *mut u8, n: usize) {
185185
__aeabi_memset4(dest, n, 0);
186186
}

0 commit comments

Comments
 (0)