diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index f12e3e595adf6..1d478f84c43bb 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1714,8 +1714,10 @@ supported_targets! { ("x86_64-apple-ios-macabi", x86_64_apple_ios_macabi), ("aarch64-apple-ios-macabi", aarch64_apple_ios_macabi), ("aarch64-apple-ios-sim", aarch64_apple_ios_sim), + ("aarch64-apple-tvos", aarch64_apple_tvos), ("aarch64-apple-tvos-sim", aarch64_apple_tvos_sim), + ("arm64e-apple-tvos", arm64e_apple_tvos), ("x86_64-apple-tvos", x86_64_apple_tvos), ("armv7k-apple-watchos", armv7k_apple_watchos), diff --git a/compiler/rustc_target/src/spec/targets/arm64e_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/arm64e_apple_tvos.rs new file mode 100644 index 0000000000000..d4d66c92857a3 --- /dev/null +++ b/compiler/rustc_target/src/spec/targets/arm64e_apple_tvos.rs @@ -0,0 +1,24 @@ +use crate::spec::base::apple::{base, Arch, TargetAbi}; +use crate::spec::{FramePointer, Target, TargetOptions}; + +pub(crate) fn target() -> Target { + let (opts, llvm_target, arch) = base("tvos", Arch::Arm64e, TargetAbi::Normal); + Target { + llvm_target, + metadata: crate::spec::TargetMetadata { + description: Some("ARM64e Apple tvOS".into()), + tier: Some(3), + host_tools: Some(false), + std: Some(true), + }, + pointer_width: 64, + data_layout: "e-m:o-i64:64-i128:128-n32:64-S128-Fn32".into(), + arch, + options: TargetOptions { + features: "+neon,+fp-armv8,+apple-a12,+v8.3a,+pauth".into(), + max_atomic_width: Some(128), + frame_pointer: FramePointer::NonLeaf, + ..opts + }, + } +} diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index 9a35b35af713b..827a7065f3e07 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -245,8 +245,9 @@ host tools. target | std | host | notes -------|:---:|:----:|------- -[`arm64e-apple-ios`](platform-support/arm64e-apple-ios.md) | ✓ | | ARM64e Apple iOS [`arm64e-apple-darwin`](platform-support/arm64e-apple-darwin.md) | ✓ | ✓ | ARM64e Apple Darwin +[`arm64e-apple-ios`](platform-support/arm64e-apple-ios.md) | ✓ | | ARM64e Apple iOS +[`arm64e-apple-tvos`](platform-support/arm64e-apple-tvos.md) | ✓ | | ARM64e Apple tvOS [`aarch64-apple-tvos`](platform-support/apple-tvos.md) | ✓ | | ARM64 tvOS [`aarch64-apple-tvos-sim`](platform-support/apple-tvos.md) | ✓ | | ARM64 tvOS Simulator [`aarch64-apple-watchos`](platform-support/apple-watchos.md) | ✓ | | ARM64 Apple WatchOS diff --git a/src/doc/rustc/src/platform-support/arm64e-apple-tvos.md b/src/doc/rustc/src/platform-support/arm64e-apple-tvos.md new file mode 100644 index 0000000000000..d49383fb853ea --- /dev/null +++ b/src/doc/rustc/src/platform-support/arm64e-apple-tvos.md @@ -0,0 +1,37 @@ +# `arm64e-apple-tvos` + +**Tier: 3** + +ARM64e tvOS (10.0+) + +## Target maintainers + +- Artyom Tetyukhin ([@arttet](https://github.com/https://github.com/arttet)) + +## Requirements + +This target is cross-compiled and supports `std`. +To build this target Xcode 12 or higher on macOS is required. + +## Building the target + +You can build Rust with support for the targets by adding it to the `target` list in `config.toml`: + +```toml +[build] +target = [ "arm64e-apple-tvos" ] +``` + +## Building Rust programs + +Rust does not yet ship pre-compiled artifacts for this target. +To compile for this target, you will need to build Rust with the target enabled (see [Building the target](#building-the-target) above). + +## Testing + +The target does support running binaries on tvOS platforms with `arm64e` architecture. + +## Cross-compilation toolchains and C code + +The targets do support `C` code. +To build compatible `C` code, you have to use XCode with the same compiler and flags. diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 92b21f7dbaa6f..eb5faeeaf9afb 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -51,9 +51,7 @@ static HOSTS: &[&str] = &[ static TARGETS: &[&str] = &[ "aarch64-apple-darwin", - "arm64e-apple-darwin", "aarch64-apple-ios", - "arm64e-apple-ios", "aarch64-apple-ios-macabi", "aarch64-apple-ios-sim", "aarch64-unknown-fuchsia", @@ -68,6 +66,9 @@ static TARGETS: &[&str] = &[ "aarch64-unknown-none-softfloat", "aarch64-unknown-redox", "aarch64-unknown-uefi", + "arm64e-apple-darwin", + "arm64e-apple-ios", + "arm64e-apple-tvos", "arm-linux-androideabi", "arm-unknown-linux-gnueabi", "arm-unknown-linux-gnueabihf", diff --git a/tests/assembly/targets/targets-macho.rs b/tests/assembly/targets/targets-macho.rs index 36145a82bda72..8095ae9029b75 100644 --- a/tests/assembly/targets/targets-macho.rs +++ b/tests/assembly/targets/targets-macho.rs @@ -18,6 +18,9 @@ //@ revisions: aarch64_apple_tvos_sim //@ [aarch64_apple_tvos_sim] compile-flags: --target aarch64-apple-tvos-sim //@ [aarch64_apple_tvos_sim] needs-llvm-components: aarch64 +//@ revisions: arm64e_apple_tvos +//@ [arm64e_apple_tvos] compile-flags: --target arm64e-apple-tvos +//@ [arm64e_apple_tvos] needs-llvm-components: aarch64 //@ revisions: aarch64_apple_watchos //@ [aarch64_apple_watchos] compile-flags: --target aarch64-apple-watchos //@ [aarch64_apple_watchos] needs-llvm-components: aarch64