Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const ALLOWED_CFGS: &[&str] = &[
// Corresponds to `_REDIR_TIME64` in musl
"musl32_time64",
"vxworks_lt_25_09",
"aarch64_macos_15_5_or_newer",
];

// Extra values to allow for check-cfg.
Expand Down Expand Up @@ -65,6 +66,20 @@ fn main() {
let target_ptr_width = env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap_or_default();
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();

println!("cargo:rerun-if-env-changed=MACOSX_DEPLOYMENT_TARGET");

if target_os == "macos" && target_arch == "aarch64" {
if let Ok(deployment) = env::var("MACOSX_DEPLOYMENT_TARGET") {
let mut it = deployment.split('.');
let major = it.next().and_then(|x| x.parse::<u32>().ok()).unwrap_or(0);
let minor = it.next().and_then(|x| x.parse::<u32>().ok()).unwrap_or(0);

if (major, minor) >= (15, 5) {
set_cfg("aarch64_macos_15_5_or_newer");
}
}
}

// The ABI of libc used by std is backward compatible with FreeBSD 12.
// The ABI of libc from crates.io is backward compatible with FreeBSD 12.
//
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/unix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ dlopen
dlsym
dup
dup2
environ
execl
execle
execlp
Expand Down
5 changes: 5 additions & 0 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2429,3 +2429,8 @@ cfg_if! {
// Unknown target_os
}
}

extern "C" {
#[cfg(not(aarch64_macos_15_5_or_newer))]
pub static mut environ: *mut *mut crate::c_char;
}
Loading