Skip to content

Commit cba5173

Browse files
committed
macOs various updates.
- CI only for macOs arm64. - Fixing build issues for macOs arm64. - Adding macos cpu to arch api.
1 parent 7d19eed commit cba5173

File tree

7 files changed

+31
-14
lines changed

7 files changed

+31
-14
lines changed

.github/workflows/full_ci.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ jobs:
3131
contents: read # to fetch code (actions/checkout)
3232

3333
name: macOS
34-
runs-on: macos-13
34+
runs-on: macos-14
3535
strategy:
3636
fail-fast: true
3737
matrix:
3838
target: [
39-
x86_64-apple-darwin,
39+
aarch64-apple-darwin,
4040
]
4141
steps:
4242
- uses: actions/checkout@v4
@@ -217,10 +217,10 @@ jobs:
217217
max-parallel: 4
218218
matrix:
219219
target:
220-
- { toolchain: stable, os: macos-13 }
221-
- { toolchain: beta, os: macos-13 }
222-
- { toolchain: nightly, os: macos-13 }
223-
- { toolchain: 1.71.0, os: macos-13 }
220+
- { toolchain: stable, os: macos-14 }
221+
- { toolchain: beta, os: macos-14 }
222+
- { toolchain: nightly, os: macos-14 }
223+
- { toolchain: 1.71.0, os: macos-14 }
224224
runs-on: ${{ matrix.target.os }}
225225
steps:
226226
- uses: actions/checkout@v4

Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ targets = [
106106
"wasm32-unknown-emscripten",
107107
"wasm32-unknown-unknown",
108108
"wasm32-wasi",
109-
"x86_64-apple-darwin",
110-
"x86_64-apple-ios",
111109
"x86_64-fortanix-unknown-sgx",
112110
"x86_64-linux-android",
113111
"x86_64-pc-solaris",

ci/build.sh

-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ x86_64-unknown-redox \
147147

148148
RUST_APPLE_TARGETS="\
149149
aarch64-apple-ios \
150-
x86_64-apple-darwin \
151-
x86_64-apple-ios \
152150
"
153151

154152
RUST_NIGHTLY_APPLE_TARGETS="\

libc-test/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ fn test_apple(target: &str) {
203203
"limits.h",
204204
"locale.h",
205205
"malloc/malloc.h",
206+
"mach-o/utils.h",
206207
"net/bpf.h",
207208
"net/dlil.h",
208209
"net/if.h",

libc-test/semver/apple.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1892,6 +1892,8 @@ lockf
18921892
log2phys
18931893
login_tty
18941894
lutimes
1895+
macho_arch_name_for_cpu_type
1896+
macho_cpu_type_for_arch_name
18951897
madvise
18961898
malloc_default_zone
18971899
malloc_good_size

src/fixed_width_ints.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub type uint32_t = u32;
2020
pub type uint64_t = u64;
2121

2222
cfg_if! {
23-
if #[cfg(all(target_arch = "aarch64", not(target_os = "windows")))] {
23+
if #[cfg(all(target_arch = "aarch64", not(any(target_os = "windows", target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))))] {
2424
// This introduces partial support for FFI with __int128 and
2525
// equivalent types on platforms where Rust's definition is validated
2626
// to match the standard C ABI of that platform.
@@ -92,5 +92,10 @@ cfg_if! {
9292

9393
// static_assert_eq!(core::mem::size_of::<__uint128_t>(), _SIZE_128);
9494
// static_assert_eq!(core::mem::align_of::<__uint128_t>(), _ALIGN_128);
95+
} else if #[cfg(all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos")))] {
96+
/// C __int128_t (alternate name for [__int128][])
97+
pub type __int128_t = i128;
98+
/// C __uint128_t (alternate name for [__uint128][])
99+
pub type __uint128_t = u128;
95100
}
96101
}

src/unix/bsd/apple/mod.rs

+16-3
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,7 @@ s! {
491491
pub rmx_rtt: u32,
492492
pub rmx_rttvar: u32,
493493
pub rmx_pksent: u32,
494-
pub rmx_state: u32,
495-
pub rmx_filler: [u32; 3],
494+
pub rmx_filler: [u32; 4],
496495
}
497496

498497
pub struct rt_msghdr {
@@ -6113,7 +6112,8 @@ extern "C" {
61136112
out_processor_infoCnt: *mut mach_msg_type_number_t,
61146113
) -> ::kern_return_t;
61156114

6116-
pub static mut mach_task_self_: ::mach_port_t;
6115+
// FIXME: 2024 edition forbids static mut, no easy fix for both nightly/stable neither
6116+
//pub static mut mach_task_self_: ::mach_port_t;
61176117
pub fn task_for_pid(
61186118
host: ::mach_port_t,
61196119
pid: ::pid_t,
@@ -6228,11 +6228,24 @@ extern "C" {
62286228
search_path: *const ::c_char,
62296229
argv: *const *mut ::c_char,
62306230
) -> ::c_int;
6231+
6232+
pub fn macho_cpu_type_for_arch_name(
6233+
archName: *const ::c_char,
6234+
tpe: *mut ::cpu_type_t,
6235+
subtpe: *mut ::cpu_subtype_t,
6236+
) -> bool;
6237+
pub fn macho_arch_name_for_cpu_type(
6238+
tpe: ::cpu_type_t,
6239+
subtpe: ::cpu_subtype_t,
6240+
) -> *const ::c_char;
62316241
}
62326242

6243+
// FIXME: 2024 edition forbids static mut, no easy fix for both nightly/stable neither
6244+
/*
62336245
pub unsafe fn mach_task_self() -> ::mach_port_t {
62346246
mach_task_self_
62356247
}
6248+
*/
62366249

62376250
cfg_if! {
62386251
if #[cfg(target_os = "macos")] {

0 commit comments

Comments
 (0)