Skip to content

Commit

Permalink
macOs various updates.
Browse files Browse the repository at this point in the history
- CI only for macOs arm64.
- Fixing build issues for macOs arm64.
- Adding macos cpu to arch api.
  • Loading branch information
devnexen committed Feb 17, 2024
1 parent f5c4427 commit 51100ae
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 15 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/full_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ jobs:
contents: read # to fetch code (actions/checkout)

name: macOS
runs-on: macos-13
runs-on: macos-14
strategy:
fail-fast: true
matrix:
target: [
x86_64-apple-darwin,
aarch64-apple-darwin,
]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -218,10 +218,10 @@ jobs:
max-parallel: 4
matrix:
target:
- { toolchain: stable, os: macos-13 }
- { toolchain: beta, os: macos-13 }
- { toolchain: nightly, os: macos-13 }
- { toolchain: 1.71.0, os: macos-13 }
- { toolchain: stable, os: macos-14 }
- { toolchain: beta, os: macos-14 }
- { toolchain: nightly, os: macos-14 }
- { toolchain: 1.71.0, os: macos-14 }
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 0 additions & 2 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ x86_64-unknown-redox \

RUST_APPLE_TARGETS="\
aarch64-apple-ios \
x86_64-apple-darwin \
x86_64-apple-ios \
"

RUST_NIGHTLY_APPLE_TARGETS="\
Expand Down
1 change: 1 addition & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ fn test_apple(target: &str) {
"limits.h",
"locale.h",
"malloc/malloc.h",
"mach-o/utils.h",
"net/bpf.h",
"net/dlil.h",
"net/if.h",
Expand Down
2 changes: 2 additions & 0 deletions libc-test/semver/apple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1892,6 +1892,8 @@ lockf
log2phys
login_tty
lutimes
macho_arch_name_for_cpu_type
macho_cpu_type_for_arch_name
madvise
malloc_default_zone
malloc_good_size
Expand Down
7 changes: 6 additions & 1 deletion src/fixed_width_ints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub type uint32_t = u32;
pub type uint64_t = u64;

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

// static_assert_eq!(core::mem::size_of::<__uint128_t>(), _SIZE_128);
// static_assert_eq!(core::mem::align_of::<__uint128_t>(), _ALIGN_128);
} else if #[cfg(all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos")))] {
/// C __int128_t (alternate name for [__int128][])
pub type __int128_t = i128;
/// C __uint128_t (alternate name for [__uint128][])
pub type __uint128_t = u128;
}
}
16 changes: 10 additions & 6 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,7 @@ s! {
pub rmx_rtt: u32,
pub rmx_rttvar: u32,
pub rmx_pksent: u32,
pub rmx_state: u32,
pub rmx_filler: [u32; 3],
pub rmx_filler: [u32; 4],
}

pub struct rt_msghdr {
Expand Down Expand Up @@ -6113,7 +6112,6 @@ extern "C" {
out_processor_infoCnt: *mut mach_msg_type_number_t,
) -> ::kern_return_t;

pub static mut mach_task_self_: ::mach_port_t;
pub fn task_for_pid(
host: ::mach_port_t,
pid: ::pid_t,
Expand Down Expand Up @@ -6228,10 +6226,16 @@ extern "C" {
search_path: *const ::c_char,
argv: *const *mut ::c_char,
) -> ::c_int;
}

pub unsafe fn mach_task_self() -> ::mach_port_t {
mach_task_self_
pub fn macho_cpu_type_for_arch_name(
archName: *const ::c_char,
tpe: *mut ::cpu_type_t,
subtpe: *mut ::cpu_subtype_t,
) -> bool;
pub fn macho_arch_name_for_cpu_type(
tpe: ::cpu_type_t,
subtpe: ::cpu_subtype_t,
) -> *const ::c_char;
}

cfg_if! {
Expand Down

0 comments on commit 51100ae

Please sign in to comment.