-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c845946
commit dc5c610
Showing
16 changed files
with
231 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
compiler/rustc_target/src/spec/aarch64_apple_watchos_sim.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# *-apple-watchos | ||
- arm64_32-apple-watchos | ||
- armv7k-apple-watchos | ||
- aarch64-apple-watchos-sim | ||
- x86_64-apple-watchos-sim | ||
|
||
**Tier: 3** | ||
|
||
Apple WatchOS targets: | ||
- Apple WatchOS on Arm 64_32 | ||
- Apple WatchOS on Arm v7k | ||
- Apple WatchOS Simulator on arm64 | ||
- Apple WatchOS Simulator on x86_64 | ||
|
||
## Target maintainers | ||
|
||
* [@deg4uss3r](https://github.com/deg4uss3r) | ||
* [@vladimir-ea](https://github.com/vladimir-ea) | ||
|
||
## Requirements | ||
|
||
These targets are cross-compiled. | ||
To build these targets Xcode 12 or higher on macOS is required. | ||
|
||
## Building the target | ||
|
||
The targets can be built by enabling them for a `rustc` build, for example: | ||
|
||
```toml | ||
[build] | ||
build-stage = 1 | ||
target = ["aarch64-apple-watchos-sim"] | ||
``` | ||
|
||
## Building Rust programs | ||
|
||
*Note: Building for this target requires the corresponding WatchOS SDK, as provided by Xcode 12+.* | ||
|
||
Rust programs can be built for these targets, if `rustc` has been built with support for them, for example: | ||
|
||
```text | ||
rustc --target aarch64-apple-watchos-sim your-code.rs | ||
``` | ||
|
||
## Testing | ||
|
||
There is no support for running the Rust testsuite on WatchOS or the simulators. | ||
|
||
There is no easy way to run simple programs on WatchOS or the WatchOS simulators. Static library builds can be embedded into WatchOS applications. | ||
|
||
## Cross-compilation toolchains and C code | ||
|
||
This target can be cross-compiled from x86_64 or aarch64 macOS hosts. | ||
|
||
Other hosts are not supported for cross-compilation, but might work when also providing the required Xcode SDK. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters