Fix the tvOS targets to use the right LLVM target and respect the deployment target environment variables
This commit is contained in:
parent
3785a17dd9
commit
abb1911682
@ -1,10 +1,10 @@
|
||||
use super::apple_base::{opts, Arch};
|
||||
use super::apple_base::{opts, tvos_llvm_target, Arch};
|
||||
use crate::spec::{FramePointer, Target, TargetOptions};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let arch = Arch::Arm64;
|
||||
Target {
|
||||
llvm_target: "arm64-apple-tvos".into(),
|
||||
llvm_target: tvos_llvm_target(arch).into(),
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||
arch: arch.target_arch(),
|
||||
|
@ -240,7 +240,10 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
|
||||
// Remove the `SDKROOT` environment variable if it's clearly set for the wrong platform, which
|
||||
// may occur when we're linking a custom build script while targeting iOS for example.
|
||||
if let Ok(sdkroot) = env::var("SDKROOT") {
|
||||
if sdkroot.contains("iPhoneOS.platform") || sdkroot.contains("iPhoneSimulator.platform")
|
||||
if sdkroot.contains("iPhoneOS.platform")
|
||||
|| sdkroot.contains("iPhoneSimulator.platform")
|
||||
|| sdkroot.contains("AppleTVOS.platform")
|
||||
|| sdkroot.contains("AppleTVSimulator.platform")
|
||||
{
|
||||
env_remove.push("SDKROOT".into())
|
||||
}
|
||||
@ -249,6 +252,7 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
|
||||
// "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld",
|
||||
// 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.into()
|
||||
} else {
|
||||
// Otherwise if cross-compiling for a different OS/SDK, remove any part
|
||||
@ -279,6 +283,16 @@ pub fn ios_llvm_target(arch: Arch) -> String {
|
||||
format!("{}-apple-ios{}.{}.0", arch.target_name(), major, minor)
|
||||
}
|
||||
|
||||
pub fn tvos_sim_llvm_target(arch: Arch) -> String {
|
||||
let (major, minor) = tvos_deployment_target();
|
||||
format!("{}-apple-tvos{}.{}.0-simulator", arch.target_name(), major, minor)
|
||||
}
|
||||
|
||||
pub fn tvos_llvm_target(arch: Arch) -> String {
|
||||
let (major, minor) = tvos_deployment_target();
|
||||
format!("{}-apple-tvos{}.{}.0", arch.target_name(), major, minor)
|
||||
}
|
||||
|
||||
fn ios_lld_platform_version() -> String {
|
||||
let (major, minor) = ios_deployment_target();
|
||||
format!("{major}.{minor}")
|
||||
|
@ -1,10 +1,10 @@
|
||||
use super::apple_base::{opts, Arch};
|
||||
use super::apple_base::{opts, tvos_sim_llvm_target, Arch};
|
||||
use crate::spec::{StackProbeType, Target, TargetOptions};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let arch = Arch::X86_64_sim;
|
||||
Target {
|
||||
llvm_target: "x86_64-apple-tvos".into(),
|
||||
llvm_target: tvos_sim_llvm_target(arch).into(),
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||
.into(),
|
||||
|
Loading…
Reference in New Issue
Block a user