Fixed builds with modified libc

This commit is contained in:
Adam Gastineau 2024-03-23 16:42:06 -07:00
parent 572d6cd322
commit 52960d499e
11 changed files with 15 additions and 12 deletions

View File

@ -2967,7 +2967,7 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
("aarch64", "watchos") if llvm_target.ends_with("-simulator") => "watchsimulator",
("aarch64", "watchos") => "watchos",
("aarch64", "visionos") if llvm_target.ends_with("-simulator") => "xrsimulator",
("aarch64", "visionos") => "visionos",
("aarch64", "visionos") => "xros",
("arm", "watchos") => "watchos",
(_, "macos") => "macosx",
_ => {
@ -3025,10 +3025,10 @@ fn get_apple_sdk_root(sdk_name: &str) -> Result<String, errors::AppleSdkRootErro
"watchsimulator"
if sdkroot.contains("WatchOS.platform") || sdkroot.contains("MacOSX.platform") => {}
"visionos"
if sdkroot.contains("visionos.platform") || sdkroot.contains("MacOSX.platform") => {
if sdkroot.contains("XROS.platform") || sdkroot.contains("MacOSX.platform") => {
}
"visionossimulator"
if sdkroot.contains("visionos.platform") || sdkroot.contains("MacOSX.platform") => {
if sdkroot.contains("XROS.platform") || sdkroot.contains("MacOSX.platform") => {
}
// Ignore `SDKROOT` if it's not a valid path.
_ if !p.is_absolute() || p == Path::new("/") || !p.exists() => {}

View File

@ -297,7 +297,7 @@ fn link_env_remove(os: &'static str) -> StaticCow<[StaticCow<str>]> {
|| sdkroot.contains("AppleTVSimulator.platform")
|| sdkroot.contains("WatchOS.platform")
|| sdkroot.contains("WatchSimulator.platform")
|| sdkroot.contains("visionos.platform")
|| sdkroot.contains("XROS.platform")
{
env_remove.push("SDKROOT".into())
}
@ -307,7 +307,7 @@ fn link_env_remove(os: &'static str) -> StaticCow<[StaticCow<str>]> {
// although this is apparently ignored when using the linker at "/usr/bin/ld".
env_remove.push("IPHONEOS_DEPLOYMENT_TARGET".into());
env_remove.push("TVOS_DEPLOYMENT_TARGET".into());
env_remove.push("VISIONOS_DEPLOYMENT_TARGET".into());
env_remove.push("XROS_DEPLOYMENT_TARGET".into());
env_remove.into()
} else {
// Otherwise if cross-compiling for a different OS/SDK (including Mac Catalyst), remove any part
@ -375,7 +375,7 @@ pub fn watchos_sim_llvm_target(arch: Arch) -> String {
fn visionos_deployment_target() -> (u32, u32) {
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
from_set_deployment_target("VISIONOS_DEPLOYMENT_TARGET").unwrap_or((1, 0))
from_set_deployment_target("XROS_DEPLOYMENT_TARGET").unwrap_or((1, 0))
}
pub fn visionos_llvm_target(arch: Arch) -> String {

View File

@ -37,7 +37,7 @@ fn macos_link_environment_unmodified() {
crate::spec::cvs![
"IPHONEOS_DEPLOYMENT_TARGET",
"TVOS_DEPLOYMENT_TARGET",
"VISIONOS_DEPLOYMENT_TARGET"
"XROS_DEPLOYMENT_TARGET"
],
);
}

View File

@ -15,10 +15,10 @@ pub fn target() -> Target {
std: None,
},
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
arch: arch.target_arch(),
options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a12".into(),
features: "+neon,+fp-armv8,+apple-a16".into(),
max_atomic_width: Some(128),
frame_pointer: FramePointer::NonLeaf,
..base

View File

@ -15,10 +15,10 @@ pub fn target() -> Target {
std: None,
},
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
arch: arch.target_arch(),
options: TargetOptions {
features: "+neon,+fp-armv8,+apple-m1".into(),
features: "+neon,+fp-armv8,+apple-a16".into(),
max_atomic_width: Some(128),
frame_pointer: FramePointer::NonLeaf,
..base

View File

@ -20,6 +20,7 @@ mod tests;
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
@ -46,6 +47,7 @@ pub use self::stream::*;
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",

View File

@ -7,6 +7,7 @@
target_os = "tvos",
target_os = "macos",
target_os = "watchos",
target_os = "visionos",
target_os = "netbsd",
target_os = "openbsd"
))]

View File

@ -511,7 +511,7 @@ impl<'a> fmt::Display for Display<'a> {
"wasi" => "WASI",
"watchos" => "watchOS",
"windows" => "Windows",
"visionos" => "visionos",
"visionos" => "visionOS",
_ => "",
},
(sym::target_arch, Some(arch)) => match arch.as_str() {