Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add arm64e-apple-tvos target #130614

Merged
merged 1 commit into from
Sep 20, 2024
Merged
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
2 changes: 2 additions & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
24 changes: 24 additions & 0 deletions compiler/rustc_target/src/spec/targets/arm64e_apple_tvos.rs
Original file line number Diff line number Diff line change
@@ -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()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The aarch64-apple-tvos target spec omits "Apple" from the description, as does the aarch64-apple-ios target spec.

Copy link
Contributor Author

@arttet arttet Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the same description for arm64e_apple_darwin & arm64e_apple_ios.
I can remove it if it needs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If other targets are already inconsistent, I don't think you need to make them consistent in this PR.

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
},
}
}
1 change: 1 addition & 0 deletions src/doc/rustc/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- [\*-apple-ios-macabi](platform-support/apple-ios-macabi.md)
- [arm64e-apple-ios](platform-support/arm64e-apple-ios.md)
- [\*-apple-tvos](platform-support/apple-tvos.md)
- [arm64e-apple-tvos](platform-support/arm64e-apple-tvos.md)
- [\*-apple-watchos](platform-support/apple-watchos.md)
- [\*-apple-visionos](platform-support/apple-visionos.md)
- [aarch64-nintendo-switch-freestanding](platform-support/aarch64-nintendo-switch-freestanding.md)
Expand Down
3 changes: 2 additions & 1 deletion src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 37 additions & 0 deletions src/doc/rustc/src/platform-support/arm64e-apple-tvos.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 3 additions & 2 deletions src/tools/build-manifest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions tests/assembly/targets/targets-macho.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading