Skip to content

Commit fc7ef8d

Browse files
authored
Add aarch64-apple-ios to platform-check matrix (bytecodealliance#9888)
* Add aarch64-apple-ios to platform-check matrix This commit is somewhat of a rebase of bytecodealliance#7506 to port most of it to `main`. I've left out any test-related changes since we're not testing anything just yet. I've also found that rustc now has `target_vendor = "apple"` to cover both macOS and iOS targets (and presumably other targets like tvOS as well if they get added) Closes bytecodealliance#7506 * Set env var to target iOS during checks
1 parent 5092fe2 commit fc7ef8d

File tree

7 files changed

+19
-13
lines changed

7 files changed

+19
-13
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,12 @@ jobs:
553553
- target: wasm32-wasip1
554554
os: ubuntu-latest
555555
test: cargo build --no-default-features --features compile,cranelift,all-arch
556+
- target: aarch64-apple-ios
557+
os: macos-latest
558+
test: cargo build
559+
env:
560+
IPHONEOS_DEPLOYMENT_TARGET: 13.0
561+
env: ${{ matrix.env || fromJSON('{}') }}
556562
steps:
557563
- uses: actions/checkout@v4
558564
with:

crates/asm-macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#![no_std]
1010

1111
cfg_if::cfg_if! {
12-
if #[cfg(target_os = "macos")] {
12+
if #[cfg(target_vendor = "apple")] {
1313
#[macro_export]
1414
macro_rules! asm_func {
1515
($name:expr, $body:expr $(, $($args:tt)*)?) => {

crates/fiber/src/stackswitch/aarch64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use super::wasmtime_fiber_start;
2222
use wasmtime_asm_macros::asm_func;
2323

2424
cfg_if::cfg_if! {
25-
if #[cfg(target_os = "macos")] {
25+
if #[cfg(target_vendor = "apple")] {
2626
macro_rules! paci1716 { () => ("pacib1716\n"); }
2727
macro_rules! pacisp { () => ("pacibsp\n"); }
2828
macro_rules! autisp { () => ("autibsp\n"); }

crates/jit-icache-coherence/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ features = [
2424
"Win32_System_Diagnostics_Debug",
2525
]
2626

27-
[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "android"))'.dependencies]
27+
[target.'cfg(any(target_os = "linux", target_vendor = "apple", target_os = "freebsd", target_os = "android"))'.dependencies]
2828
libc = { workspace = true }
2929

3030
[features]

crates/wasmtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ ittapi = { workspace = true, optional = true }
8989
[target.'cfg(target_os = "linux")'.dependencies]
9090
memfd = { workspace = true, optional = true }
9191

92-
[target.'cfg(target_os = "macos")'.dependencies]
92+
[target.'cfg(target_vendor = "apple")'.dependencies]
9393
mach2 = { workspace = true, optional = true }
9494

9595
[target.'cfg(unix)'.dependencies]

crates/wasmtime/src/runtime/vm/sys/unix/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub mod unwind;
1212
#[cfg(feature = "signals-based-traps")]
1313
pub mod vm;
1414

15-
#[cfg(all(feature = "signals-based-traps", target_os = "macos"))]
15+
#[cfg(all(feature = "signals-based-traps", target_vendor = "apple"))]
1616
pub mod machports;
1717
#[cfg(feature = "signals-based-traps")]
1818
pub mod signals;

crates/wasmtime/src/runtime/vm/sys/unix/signals.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl TrapHandler {
3131
pub unsafe fn new(macos_use_mach_ports: bool) -> TrapHandler {
3232
// Either mach ports shouldn't be in use or we shouldn't be on macOS,
3333
// otherwise the `machports.rs` module should be used instead.
34-
assert!(!macos_use_mach_ports || !cfg!(target_os = "macos"));
34+
assert!(!macos_use_mach_ports || !cfg!(target_vendor = "apple"));
3535

3636
foreach_handler(|slot, signal| {
3737
let mut handler: libc::sigaction = mem::zeroed();
@@ -63,7 +63,7 @@ impl TrapHandler {
6363
}
6464

6565
pub fn validate_config(&self, macos_use_mach_ports: bool) {
66-
assert!(!macos_use_mach_ports || !cfg!(target_os = "macos"));
66+
assert!(!macos_use_mach_ports || !cfg!(target_vendor = "apple"));
6767
}
6868
}
6969

@@ -81,7 +81,7 @@ unsafe fn foreach_handler(mut f: impl FnMut(*mut libc::sigaction, i32)) {
8181

8282
// Sometimes we need to handle SIGBUS too:
8383
// - On Darwin, guard page accesses are raised as SIGBUS.
84-
if cfg!(target_os = "macos") || cfg!(target_os = "freebsd") {
84+
if cfg!(target_vendor = "apple") || cfg!(target_os = "freebsd") {
8585
f(addr_of_mut!(PREV_SIGBUS), libc::SIGBUS);
8686
}
8787

@@ -209,7 +209,7 @@ unsafe extern "C" fn trap_handler(
209209
// done running" which will clear the sigaltstack flag and allow
210210
// reusing it for the next signal. Then upon resuming in our custom
211211
// code we blow away the stack anyway with a longjmp.
212-
if cfg!(target_os = "macos") {
212+
if cfg!(target_vendor = "apple") {
213213
unsafe extern "C" fn wasmtime_longjmp_shim(jmp_buf: *const u8) {
214214
wasmtime_longjmp(jmp_buf)
215215
}
@@ -303,13 +303,13 @@ unsafe fn get_trap_registers(cx: *mut libc::c_void, _signum: libc::c_int) -> Tra
303303
pc: (cx.uc_mcontext.psw.addr - trap_offset) as usize,
304304
fp: *(cx.uc_mcontext.gregs[15] as *const usize),
305305
}
306-
} else if #[cfg(all(target_os = "macos", target_arch = "x86_64"))] {
306+
} else if #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] {
307307
let cx = &*(cx as *const libc::ucontext_t);
308308
TrapRegisters {
309309
pc: (*cx.uc_mcontext).__ss.__rip as usize,
310310
fp: (*cx.uc_mcontext).__ss.__rbp as usize,
311311
}
312-
} else if #[cfg(all(target_os = "macos", target_arch = "aarch64"))] {
312+
} else if #[cfg(all(target_vendor = "apple", target_arch = "aarch64"))] {
313313
let cx = &*(cx as *const libc::ucontext_t);
314314
TrapRegisters {
315315
pc: (*cx.uc_mcontext).__ss.__pc as usize,
@@ -358,7 +358,7 @@ unsafe fn get_trap_registers(cx: *mut libc::c_void, _signum: libc::c_int) -> Tra
358358
// See more comments above where this is called for what it's doing.
359359
unsafe fn set_pc(cx: *mut libc::c_void, pc: usize, arg1: usize) {
360360
cfg_if::cfg_if! {
361-
if #[cfg(not(target_os = "macos"))] {
361+
if #[cfg(not(target_vendor = "apple"))] {
362362
let _ = (cx, pc, arg1);
363363
unreachable!(); // not used on these platforms
364364
} else if #[cfg(target_arch = "x86_64")] {
@@ -382,7 +382,7 @@ unsafe fn set_pc(cx: *mut libc::c_void, pc: usize, arg1: usize) {
382382
(*cx.uc_mcontext).__ss.__pc = pc as u64;
383383
(*cx.uc_mcontext).__ss.__x[0] = arg1 as u64;
384384
} else {
385-
compile_error!("unsupported macos target architecture");
385+
compile_error!("unsupported apple target architecture");
386386
}
387387
}
388388
}

0 commit comments

Comments
 (0)