Skip to content

Commit 4a4883b

Browse files
authored
Rollup merge of #124772 - madsmtm:apple-platform-support-docs, r=oli-obk
Refactor documentation for Apple targets Refactor the documentation for Apple targets in `rustc`'s platform support page to make it clear what the supported OS version is and which environment variables are being read (`*_DEPLOYMENT_TARGET` and `SDKROOT`). This fixes #124215. Note that I've expanded the `aarch64-apple-ios-sim` maintainers `@badboy` and `@deg4uss3r` to include being maintainer of all `*-apple-ios-*` targets. If you do not wish to be so, please state that, then I'll explicitly note that in the docs. Additionally, I've added myself as co-maintainer of most of these targets. r? `@thomcc` I think the documentation you've previously written on tvOS is great, have mostly modified it to have a more consistent formatting with the rest of the Apple target. I recognize that there's quite a few changes here, feel free to ask about any of them! --- CC `@simlay` `@Nilstrieb` `@rustbot` label O-apple
2 parents df59800 + 0eb782d commit 4a4883b

14 files changed

+376
-177
lines changed

compiler/rustc_target/src/spec/base/apple/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ fn macos_default_deployment_target(arch: Arch) -> (u32, u32) {
272272

273273
fn macos_deployment_target(arch: Arch) -> (u32, u32) {
274274
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
275+
// Note: If bumping this version, remember to update it in the rustc/platform-support docs.
275276
from_set_deployment_target("MACOSX_DEPLOYMENT_TARGET")
276277
.unwrap_or_else(|| macos_default_deployment_target(arch))
277278
}
@@ -320,6 +321,7 @@ fn link_env_remove(os: &'static str) -> StaticCow<[StaticCow<str>]> {
320321

321322
fn ios_deployment_target(arch: Arch, abi: &str) -> (u32, u32) {
322323
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
324+
// Note: If bumping this version, remember to update it in the rustc/platform-support docs.
323325
let (major, minor) = match (arch, abi) {
324326
(Arm64e, _) => (14, 0),
325327
// Mac Catalyst defaults to 13.1 in Clang.
@@ -352,6 +354,7 @@ pub fn ios_sim_llvm_target(arch: Arch) -> String {
352354

353355
fn tvos_deployment_target() -> (u32, u32) {
354356
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
357+
// Note: If bumping this version, remember to update it in the rustc platform-support docs.
355358
from_set_deployment_target("TVOS_DEPLOYMENT_TARGET").unwrap_or((10, 0))
356359
}
357360

@@ -367,6 +370,7 @@ pub fn tvos_sim_llvm_target(arch: Arch) -> String {
367370

368371
fn watchos_deployment_target() -> (u32, u32) {
369372
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
373+
// Note: If bumping this version, remember to update it in the rustc platform-support docs.
370374
from_set_deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0))
371375
}
372376

@@ -382,6 +386,7 @@ pub fn watchos_sim_llvm_target(arch: Arch) -> String {
382386

383387
fn visionos_deployment_target() -> (u32, u32) {
384388
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
389+
// Note: If bumping this version, remember to update it in the rustc platform-support docs.
385390
from_set_deployment_target("XROS_DEPLOYMENT_TARGET").unwrap_or((1, 0))
386391
}
387392

src/doc/rustc/src/SUMMARY.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@
1616
- [Platform Support](platform-support.md)
1717
- [Target Tier Policy](target-tier-policy.md)
1818
- [Template for Target-specific Documentation](platform-support/TEMPLATE.md)
19-
- [arm64e-apple-ios.md](platform-support/arm64e-apple-ios.md)
20-
- [arm64e-apple-darwin.md](platform-support/arm64e-apple-darwin.md)
21-
- [aarch64-apple-ios-sim](platform-support/aarch64-apple-ios-sim.md)
2219
- [arm64ec-pc-windows-msvc](platform-support/arm64ec-pc-windows-msvc.md)
20+
- [\*-apple-darwin](platform-support/apple-darwin.md)
21+
- [i686-apple-darwin](platform-support/i686-apple-darwin.md)
22+
- [x86_64h-apple-darwin](platform-support/x86_64h-apple-darwin.md)
23+
- [arm64e-apple-darwin.md](platform-support/arm64e-apple-darwin.md)
24+
- [\*-apple-ios](platform-support/apple-ios.md)
25+
- [\*-apple-ios-macabi](platform-support/apple-ios-macabi.md)
26+
- [arm64e-apple-ios.md](platform-support/arm64e-apple-ios.md)
2327
- [\*-apple-tvos](platform-support/apple-tvos.md)
24-
- [\*-apple-watchos\*](platform-support/apple-watchos.md)
25-
- [aarch64-apple-visionos\*](platform-support/apple-visionos.md)
28+
- [\*-apple-watchos](platform-support/apple-watchos.md)
29+
- [\*-apple-visionos](platform-support/apple-visionos.md)
2630
- [aarch64-nintendo-switch-freestanding](platform-support/aarch64-nintendo-switch-freestanding.md)
2731
- [armeb-unknown-linux-gnueabi](platform-support/armeb-unknown-linux-gnueabi.md)
2832
- [arm-none-eabi](platform-support/arm-none-eabi.md)
@@ -76,7 +80,6 @@
7680
- [x86_64-fortanix-unknown-sgx](platform-support/x86_64-fortanix-unknown-sgx.md)
7781
- [x86_64-unknown-linux-none.md](platform-support/x86_64-unknown-linux-none.md)
7882
- [x86_64-unknown-none](platform-support/x86_64-unknown-none.md)
79-
- [x86_64h-apple-darwin](platform-support/x86_64h-apple-darwin.md)
8083
- [Targets](targets/index.md)
8184
- [Built-in Targets](targets/built-in.md)
8285
- [Custom Targets](targets/custom.md)

src/doc/rustc/src/platform-support.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ target | notes
3636
`i686-pc-windows-gnu` | 32-bit MinGW (Windows 10+) [^x86_32-floats-return-ABI]
3737
`i686-pc-windows-msvc` | 32-bit MSVC (Windows 10+) [^x86_32-floats-return-ABI]
3838
`i686-unknown-linux-gnu` | 32-bit Linux (kernel 3.2+, glibc 2.17+) [^x86_32-floats-return-ABI]
39-
`x86_64-apple-darwin` | 64-bit macOS (10.12+, Sierra+)
39+
[`x86_64-apple-darwin`](platform-support/apple-darwin.md) | 64-bit macOS (10.12+, Sierra+)
4040
`x86_64-pc-windows-gnu` | 64-bit MinGW (Windows 10+)
4141
`x86_64-pc-windows-msvc` | 64-bit MSVC (Windows 10+)
4242
`x86_64-unknown-linux-gnu` | 64-bit Linux (kernel 3.2+, glibc 2.17+)
@@ -86,7 +86,7 @@ so Rustup may install the documentation for a similar tier 1 target instead.
8686

8787
target | notes
8888
-------|-------
89-
`aarch64-apple-darwin` | ARM64 macOS (11.0+, Big Sur+)
89+
[`aarch64-apple-darwin`](platform-support/apple-darwin.md) | ARM64 macOS (11.0+, Big Sur+)
9090
`aarch64-pc-windows-msvc` | ARM64 Windows MSVC
9191
`aarch64-unknown-linux-musl` | ARM64 Linux with musl 1.2.3
9292
`arm-unknown-linux-gnueabi` | Armv6 Linux (kernel 3.2, glibc 2.17)
@@ -133,8 +133,8 @@ so Rustup may install the documentation for a similar tier 1 target instead.
133133

134134
target | std | notes
135135
-------|:---:|-------
136-
`aarch64-apple-ios` | ✓ | ARM64 iOS
137-
[`aarch64-apple-ios-sim`](platform-support/aarch64-apple-ios-sim.md) | ✓ | Apple iOS Simulator on ARM64
136+
[`aarch64-apple-ios`](platform-support/apple-ios.md) | ✓ | ARM64 iOS
137+
[`aarch64-apple-ios-sim`](platform-support/apple-ios.md) | ✓ | Apple iOS Simulator on ARM64
138138
`aarch64-fuchsia` | ✓ | Alias for `aarch64-unknown-fuchsia`
139139
[`aarch64-unknown-fuchsia`](platform-support/fuchsia.md) | ✓ | ARM64 Fuchsia
140140
[`aarch64-linux-android`](platform-support/android.md) | ✓ | ARM64 Android
@@ -192,7 +192,7 @@ target | std | notes
192192
`wasm32-wasi` | ✓ | WebAssembly with WASI (undergoing a [rename to `wasm32-wasip1`][wasi-rename])
193193
[`wasm32-wasip1`](platform-support/wasm32-wasip1.md) | ✓ | WebAssembly with WASI
194194
[`wasm32-wasip1-threads`](platform-support/wasm32-wasip1-threads.md) | ✓ | | WebAssembly with WASI Preview 1 and threads
195-
`x86_64-apple-ios` | ✓ | 64-bit x86 iOS
195+
[`x86_64-apple-ios`](platform-support/apple-ios.md) | ✓ | 64-bit x86 iOS
196196
[`x86_64-fortanix-unknown-sgx`](platform-support/x86_64-fortanix-unknown-sgx.md) | ✓ | [Fortanix ABI] for 64-bit Intel SGX
197197
`x86_64-fuchsia` | ✓ | Alias for `x86_64-unknown-fuchsia`
198198
[`x86_64-unknown-fuchsia`](platform-support/fuchsia.md) | ✓ | 64-bit x86 Fuchsia
@@ -241,9 +241,9 @@ target | std | host | notes
241241
[`arm64e-apple-ios`](platform-support/arm64e-apple-ios.md) | ✓ | | ARM64e Apple iOS
242242
[`arm64e-apple-darwin`](platform-support/arm64e-apple-darwin.md) | ✓ | ✓ | ARM64e Apple Darwin
243243
[`arm64ec-pc-windows-msvc`](platform-support/arm64ec-pc-windows-msvc.md) | ? | | Arm64EC Windows MSVC
244-
`aarch64-apple-ios-macabi` | ? | | Apple Catalyst on ARM64
245-
[`aarch64-apple-tvos`](platform-support/apple-tvos.md) | ? | | ARM64 tvOS
246-
[`aarch64-apple-tvos-sim`](platform-support/apple-tvos.md) | ? | | ARM64 tvOS Simulator
244+
[`aarch64-apple-ios-macabi`](platform-support/apple-ios-macabi.md) | | | Apple Catalyst on ARM64
245+
[`aarch64-apple-tvos`](platform-support/apple-tvos.md) | | | ARM64 tvOS
246+
[`aarch64-apple-tvos-sim`](platform-support/apple-tvos.md) | | | ARM64 tvOS Simulator
247247
[`aarch64-apple-watchos`](platform-support/apple-watchos.md) | ✓ | | ARM64 Apple WatchOS
248248
[`aarch64-apple-watchos-sim`](platform-support/apple-watchos.md) | ✓ | | ARM64 Apple WatchOS Simulator
249249
[`aarch64-apple-visionos`](platform-support/apple-visionos.md) | ✓ | | ARM64 Apple visionOS
@@ -283,7 +283,7 @@ target | std | host | notes
283283
[`armv7a-kmc-solid_asp3-eabihf`](platform-support/kmc-solid.md) | ✓ | | ARM SOLID with TOPPERS/ASP3, hardfloat
284284
[`armv7a-none-eabihf`](platform-support/arm-none-eabi.md) | * | | Bare Armv7-A, hardfloat
285285
[`armv7k-apple-watchos`](platform-support/apple-watchos.md) | ✓ | | Armv7-A Apple WatchOS
286-
`armv7s-apple-ios` | ✓ | | Armv7-A Apple-A6 Apple iOS
286+
[`armv7s-apple-ios`](platform-support/apple-ios.md) | ✓ | | Armv7-A Apple-A6 Apple iOS
287287
[`armv8r-none-eabihf`](platform-support/armv8r-none-eabihf.md) | * | | Bare Armv8-R, hardfloat
288288
`avr-unknown-gnu-atmega328` | * | | AVR. Requires `-Z build-std=core`
289289
`bpfeb-unknown-none` | * | | BPF (big endian)
@@ -292,10 +292,10 @@ target | std | host | notes
292292
`csky-unknown-linux-gnuabiv2hf` | ✓ | | C-SKY abiv2 Linux, hardfloat (little endian)
293293
[`hexagon-unknown-none-elf`](platform-support/hexagon-unknown-none-elf.md)| * | | Bare Hexagon (v60+, HVX)
294294
[`hexagon-unknown-linux-musl`](platform-support/hexagon-unknown-linux-musl.md) | ✓ | | Hexagon Linux with musl 1.2.3
295-
`i386-apple-ios` | ✓ | | 32-bit x86 iOS [^x86_32-floats-return-ABI]
295+
[`i386-apple-ios`](platform-support/apple-ios.md) | ✓ | | 32-bit x86 iOS [^x86_32-floats-return-ABI]
296296
[`i586-pc-nto-qnx700`](platform-support/nto-qnx.md) | * | | 32-bit x86 QNX Neutrino 7.0 RTOS [^x86_32-floats-return-ABI]
297297
[`i586-unknown-netbsd`](platform-support/netbsd.md) | ✓ | | 32-bit x86, restricted to Pentium
298-
`i686-apple-darwin` | ✓ | ✓ | 32-bit macOS (10.12+, Sierra+) [^x86_32-floats-return-ABI]
298+
[`i686-apple-darwin`](platform-support/apple-darwin.md) | ✓ | ✓ | 32-bit macOS (10.12+, Sierra+) [^x86_32-floats-return-ABI]
299299
`i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku [^x86_32-floats-return-ABI]
300300
[`i686-unknown-hurd-gnu`](platform-support/hurd.md) | ✓ | ✓ | 32-bit GNU/Hurd [^x86_32-floats-return-ABI]
301301
[`i686-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD/i386 with SSE2 [^x86_32-floats-return-ABI]
@@ -367,8 +367,8 @@ target | std | host | notes
367367
`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.3
368368
[`wasm32-wasip2`](platform-support/wasm32-wasip2.md) | ✓ | | WebAssembly
369369
[`wasm64-unknown-unknown`](platform-support/wasm64-unknown-unknown.md) | ? | | WebAssembly
370-
`x86_64-apple-ios-macabi` | ✓ | | Apple Catalyst on x86_64
371-
[`x86_64-apple-tvos`](platform-support/apple-tvos.md) | ? | | x86 64-bit tvOS
370+
[`x86_64-apple-ios-macabi`](platform-support/apple-ios-macabi.md) | ✓ | | Apple Catalyst on x86_64
371+
[`x86_64-apple-tvos`](platform-support/apple-tvos.md) | | | x86 64-bit tvOS
372372
[`x86_64-apple-watchos-sim`](platform-support/apple-watchos.md) | ✓ | | x86 64-bit Apple WatchOS simulator
373373
[`x86_64-pc-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX Neutrino 7.1 RTOS |
374374
[`x86_64-unikraft-linux-musl`](platform-support/unikraft-linux-musl.md) | ✓ | | 64-bit Unikraft with musl 1.2.3

src/doc/rustc/src/platform-support/aarch64-apple-ios-sim.md

-55
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# `*-apple-darwin`
2+
3+
Apple macOS targets.
4+
5+
**Tier: 1**
6+
7+
- `x86_64-apple-darwin`: macOS on 64-bit x86.
8+
9+
**Tier: 2 (with Host Tools)**
10+
11+
- `aarch64-apple-darwin`: macOS on ARM64 (M1-family or later Apple Silicon CPUs).
12+
13+
## Target maintainers
14+
15+
- [@thomcc](https://github.com/thomcc)
16+
- [@madsmtm](https://github.com/madsmtm)
17+
18+
## Requirements
19+
20+
### OS version
21+
22+
The minimum supported version is macOS 10.12 Sierra on x86, and macOS 11.0 Big
23+
Sur on ARM64.
24+
25+
This version can be raised per-binary by changing the [deployment target],
26+
which might yield more performance optimizations. `rustc` respects the common
27+
environment variables used by Xcode to do so, in this case
28+
`MACOSX_DEPLOYMENT_TARGET`.
29+
30+
The current default deployment target for `rustc` can be retrieved with
31+
[`rustc --print=deployment-target`][rustc-print].
32+
33+
[deployment target]: https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html
34+
[rustc-print]: ../command-line-arguments.md#option-print
35+
36+
### Binary format
37+
38+
The default binary format is Mach-O, the executable format used on Apple's
39+
platforms.
40+
41+
## Building
42+
43+
These targets are distributed through `rustup`, and otherwise require no
44+
special configuration.
45+
46+
## Testing
47+
48+
There are no special requirements for testing and running this target.
49+
50+
x86 binaries can be run on Apple Silicon by using Rosetta.
51+
52+
## Cross-compilation toolchains and C code
53+
54+
Cross-compilation of these targets are supported using Clang, but may require
55+
Xcode or the macOS SDK (`MacOSX.sdk`) to be available to compile C code and
56+
to link.
57+
58+
The path to the SDK can be passed to `rustc` using the common `SDKROOT`
59+
environment variable.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# `*-apple-ios-macabi`
2+
3+
Apple Mac Catalyst targets.
4+
5+
**Tier: 3**
6+
7+
- `aarch64-apple-ios-macabi`: Mac Catalyst on ARM64.
8+
- `x86_64-apple-ios-macabi`: Mac Catalyst on 64-bit x86.
9+
10+
## Target maintainers
11+
12+
- [@madsmtm](https://github.com/madsmtm)
13+
14+
## Requirements
15+
16+
These targets are cross-compiled, and require the corresponding macOS SDK
17+
(`MacOSX.sdk`) which contain `./System/iOSSupport` headers to allow linking to
18+
iOS-specific headers, as provided by Xcode 11 or higher.
19+
20+
The path to the SDK can be passed to `rustc` using the common `SDKROOT`
21+
environment variable.
22+
23+
### OS version
24+
25+
The minimum supported version is iOS 13.1.
26+
27+
This can be raised per-binary by changing the deployment target. `rustc`
28+
respects the common environment variables used by Xcode to do so, in this
29+
case `IPHONEOS_DEPLOYMENT_TARGET`.
30+
31+
## Building the target
32+
33+
The targets can be built by enabling them for a `rustc` build in
34+
`config.toml`, by adding, for example:
35+
36+
```toml
37+
[build]
38+
target = ["aarch64-apple-ios-macabi", "x86_64-apple-ios-macabi"]
39+
```
40+
41+
Using the unstable `-Zbuild-std` with a nightly Cargo may also work.
42+
43+
## Building Rust programs
44+
45+
Rust programs can be built for these targets by specifying `--target`, if
46+
`rustc` has been built with support for them. For example:
47+
48+
```console
49+
$ rustc --target aarch64-apple-ios-macabi your-code.rs
50+
```
51+
52+
## Testing
53+
54+
Mac Catalyst binaries can be run directly on macOS 10.15 Catalina or newer.
55+
56+
x86 binaries can be run on Apple Silicon by using Rosetta.
57+
58+
Note that using certain UIKit functionality requires the binary to be bundled.

0 commit comments

Comments
 (0)