Add Apple WatchOS compile targets
This commit is contained in:
parent
c84594661c
commit
dc5c61028a
16 changed files with 231 additions and 9 deletions
38
compiler/rustc_target/src/spec/aarch64_apple_watchos_sim.rs
Normal file
38
compiler/rustc_target/src/spec/aarch64_apple_watchos_sim.rs
Normal file
|
@ -0,0 +1,38 @@
|
|||
use super::apple_sdk_base::{opts, Arch};
|
||||
use crate::spec::{FramePointer, Target, TargetOptions};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let base = opts("watchos", Arch::Arm64_sim);
|
||||
|
||||
// Clang automatically chooses a more specific target based on
|
||||
// WATCHOS_DEPLOYMENT_TARGET.
|
||||
// This is required for the simulator target to pick the right
|
||||
// MACH-O commands, so we do too.
|
||||
let arch = "arm64";
|
||||
let llvm_target = super::apple_base::watchos_sim_llvm_target(arch);
|
||||
|
||||
Target {
|
||||
llvm_target: llvm_target.into(),
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
features: "+neon,+fp-armv8,+apple-a7".into(),
|
||||
max_atomic_width: Some(128),
|
||||
forces_embed_bitcode: true,
|
||||
frame_pointer: FramePointer::NonLeaf,
|
||||
// Taken from a clang build on Xcode 11.4.1.
|
||||
// These arguments are not actually invoked - they just have
|
||||
// to look right to pass App Store validation.
|
||||
bitcode_llvm_cmdline: "-triple\0\
|
||||
arm64-apple-watchos5.0-simulator\0\
|
||||
-emit-obj\0\
|
||||
-disable-llvm-passes\0\
|
||||
-target-abi\0\
|
||||
darwinpcs\0\
|
||||
-Os\0"
|
||||
.into(),
|
||||
..base
|
||||
},
|
||||
}
|
||||
}
|
|
@ -114,3 +114,12 @@ pub fn ios_sim_llvm_target(arch: &str) -> String {
|
|||
let (major, minor) = ios_deployment_target();
|
||||
format!("{}-apple-ios{}.{}.0-simulator", arch, major, minor)
|
||||
}
|
||||
|
||||
fn watchos_deployment_target() -> (u32, u32) {
|
||||
deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0))
|
||||
}
|
||||
|
||||
pub fn watchos_sim_llvm_target(arch: &str) -> String {
|
||||
let (major, minor) = watchos_deployment_target();
|
||||
format!("{}-apple-watchos{}.{}.0-simulator", arch, major, minor)
|
||||
}
|
||||
|
|
|
@ -6,8 +6,10 @@ use Arch::*;
|
|||
#[derive(Copy, Clone)]
|
||||
pub enum Arch {
|
||||
Armv7,
|
||||
Armv7k,
|
||||
Armv7s,
|
||||
Arm64,
|
||||
Arm64_32,
|
||||
I386,
|
||||
X86_64,
|
||||
X86_64_macabi,
|
||||
|
@ -17,7 +19,7 @@ pub enum Arch {
|
|||
|
||||
fn target_abi(arch: Arch) -> &'static str {
|
||||
match arch {
|
||||
Armv7 | Armv7s | Arm64 | I386 | X86_64 => "",
|
||||
Armv7 | Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | X86_64 => "",
|
||||
X86_64_macabi | Arm64_macabi => "macabi",
|
||||
Arm64_sim => "sim",
|
||||
}
|
||||
|
@ -26,8 +28,10 @@ fn target_abi(arch: Arch) -> &'static str {
|
|||
fn target_cpu(arch: Arch) -> &'static str {
|
||||
match arch {
|
||||
Armv7 => "cortex-a8", // iOS7 is supported on iPhone 4 and higher
|
||||
Armv7k => "cortex-a8",
|
||||
Armv7s => "cortex-a9",
|
||||
Arm64 => "apple-a7",
|
||||
Arm64_32 => "apple-s4",
|
||||
I386 => "yonah",
|
||||
X86_64 => "core2",
|
||||
X86_64_macabi => "core2",
|
||||
|
@ -38,7 +42,7 @@ fn target_cpu(arch: Arch) -> &'static str {
|
|||
|
||||
fn link_env_remove(arch: Arch) -> Cow<'static, [Cow<'static, str>]> {
|
||||
match arch {
|
||||
Armv7 | Armv7s | Arm64 | I386 | X86_64 | Arm64_sim => {
|
||||
Armv7 | Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | X86_64 | Arm64_sim => {
|
||||
cvs!["MACOSX_DEPLOYMENT_TARGET"]
|
||||
}
|
||||
X86_64_macabi | Arm64_macabi => cvs!["IPHONEOS_DEPLOYMENT_TARGET"],
|
||||
|
|
28
compiler/rustc_target/src/spec/arm64_32_apple_watchos.rs
Normal file
28
compiler/rustc_target/src/spec/arm64_32_apple_watchos.rs
Normal file
|
@ -0,0 +1,28 @@
|
|||
use super::apple_sdk_base::{opts, Arch};
|
||||
use crate::spec::{Target, TargetOptions};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let base = opts("watchos", Arch::Arm64_32);
|
||||
Target {
|
||||
llvm_target: "arm64_32-apple-watchos".into(),
|
||||
pointer_width: 32,
|
||||
data_layout: "e-m:o-p:32:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
features: "+neon,+fp-armv8,+apple-a7".into(),
|
||||
max_atomic_width: Some(64),
|
||||
forces_embed_bitcode: true,
|
||||
// These arguments are not actually invoked - they just have
|
||||
// to look right to pass App Store validation.
|
||||
bitcode_llvm_cmdline: "-triple\0\
|
||||
arm64_32-apple-watchos5.0.0\0\
|
||||
-emit-obj\0\
|
||||
-disable-llvm-passes\0\
|
||||
-target-abi\0\
|
||||
darwinpcs\0\
|
||||
-Os\0"
|
||||
.into(),
|
||||
..base
|
||||
},
|
||||
}
|
||||
}
|
28
compiler/rustc_target/src/spec/armv7k_apple_watchos.rs
Normal file
28
compiler/rustc_target/src/spec/armv7k_apple_watchos.rs
Normal file
|
@ -0,0 +1,28 @@
|
|||
use super::apple_sdk_base::{opts, Arch};
|
||||
use crate::spec::{Target, TargetOptions};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let base = opts("watchos", Arch::Armv7k);
|
||||
Target {
|
||||
llvm_target: "armv7k-apple-watchos".into(),
|
||||
pointer_width: 32,
|
||||
data_layout: "e-m:o-p:32:32-Fi8-i64:64-a:0:32-n32-S128".into(),
|
||||
arch: "arm".into(),
|
||||
options: TargetOptions {
|
||||
features: "+v7,+vfp4,+neon".into(),
|
||||
max_atomic_width: Some(64),
|
||||
forces_embed_bitcode: true,
|
||||
// These arguments are not actually invoked - they just have
|
||||
// to look right to pass App Store validation.
|
||||
bitcode_llvm_cmdline: "-triple\0\
|
||||
armv7k-apple-watchos3.0.0\0\
|
||||
-emit-obj\0\
|
||||
-disable-llvm-passes\0\
|
||||
-target-abi\0\
|
||||
darwinpcs\0\
|
||||
-Os\0"
|
||||
.into(),
|
||||
..base
|
||||
},
|
||||
}
|
||||
}
|
|
@ -928,6 +928,11 @@ supported_targets! {
|
|||
("aarch64-apple-tvos", aarch64_apple_tvos),
|
||||
("x86_64-apple-tvos", x86_64_apple_tvos),
|
||||
|
||||
("armv7k-apple-watchos", armv7k_apple_watchos),
|
||||
("arm64_32-apple-watchos", arm64_32_apple_watchos),
|
||||
("x86_64-apple-watchos-sim", x86_64_apple_watchos_sim),
|
||||
("aarch64-apple-watchos-sim", aarch64_apple_watchos_sim),
|
||||
|
||||
("armebv7r-none-eabi", armebv7r_none_eabi),
|
||||
("armebv7r-none-eabihf", armebv7r_none_eabihf),
|
||||
("armv7r-none-eabi", armv7r_none_eabi),
|
||||
|
|
35
compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs
Normal file
35
compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs
Normal file
|
@ -0,0 +1,35 @@
|
|||
use super::apple_sdk_base::{opts, Arch};
|
||||
use crate::spec::{StackProbeType, Target, TargetOptions};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let base = opts("watchos", Arch::X86_64);
|
||||
|
||||
let arch = "x86_64";
|
||||
let llvm_target = super::apple_base::watchos_sim_llvm_target(arch);
|
||||
|
||||
Target {
|
||||
llvm_target: llvm_target.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(),
|
||||
arch: "x86_64".into(),
|
||||
options: TargetOptions {
|
||||
max_atomic_width: Some(64),
|
||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
||||
stack_probes: StackProbeType::Call,
|
||||
forces_embed_bitcode: true,
|
||||
// Taken from a clang build on Xcode 11.4.1.
|
||||
// These arguments are not actually invoked - they just have
|
||||
// to look right to pass App Store validation.
|
||||
bitcode_llvm_cmdline: "-triple\0\
|
||||
x86_64-apple-watchos5.0-simulator\0\
|
||||
-emit-obj\0\
|
||||
-disable-llvm-passes\0\
|
||||
-target-abi\0\
|
||||
darwinpcs\0\
|
||||
-Os\0"
|
||||
.into(),
|
||||
..base
|
||||
},
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue