From 1c848f22f7dd5daeec9428396121906f3a9e6a85 Mon Sep 17 00:00:00 2001 From: Thom Chiovoloni Date: Sun, 5 Mar 2023 18:03:36 -0800 Subject: [PATCH] Add platform support documentation for x86_64h-apple-darwin --- src/doc/rustc/src/SUMMARY.md | 1 + src/doc/rustc/src/platform-support.md | 1 + .../platform-support/x86_64h-apple-darwin.md | 57 +++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 src/doc/rustc/src/platform-support/x86_64h-apple-darwin.md diff --git a/src/doc/rustc/src/SUMMARY.md b/src/doc/rustc/src/SUMMARY.md index 752f1cc4aba03..64197c0e27b7e 100644 --- a/src/doc/rustc/src/SUMMARY.md +++ b/src/doc/rustc/src/SUMMARY.md @@ -40,6 +40,7 @@ - [wasm64-unknown-unknown](platform-support/wasm64-unknown-unknown.md) - [x86_64-fortanix-unknown-sgx](platform-support/x86_64-fortanix-unknown-sgx.md) - [x86_64-unknown-none](platform-support/x86_64-unknown-none.md) + - [x86_64h-apple-darwin](platform-support/x86_64h-apple-darwin.md) - [Targets](targets/index.md) - [Built-in Targets](targets/built-in.md) - [Custom Targets](targets/custom.md) diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index 9eafa27e2b7c8..29df3c7f1f1a0 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -322,5 +322,6 @@ target | std | host | notes `x86_64-uwp-windows-gnu` | ✓ | | `x86_64-uwp-windows-msvc` | ✓ | | `x86_64-wrs-vxworks` | ? | | +`x86_64h-apple-darwin` | ✓ | ✓ | macOS with late-gen Intel (at least Haswell) [runs on NVIDIA GPUs]: https://github.com/japaric-archived/nvptx#targets diff --git a/src/doc/rustc/src/platform-support/x86_64h-apple-darwin.md b/src/doc/rustc/src/platform-support/x86_64h-apple-darwin.md new file mode 100644 index 0000000000000..1a6f7bb834cf5 --- /dev/null +++ b/src/doc/rustc/src/platform-support/x86_64h-apple-darwin.md @@ -0,0 +1,57 @@ +# `x86_64h-apple-darwin` + +**Tier: 3** + +Target for macOS on late-generation `x86_64` Apple chips, usable as the +`x86_64h` entry in universal binaries, and equivalent to LLVM's +`x86_64h-apple-macosx*` targets. + +## Target maintainers + +- Thom Chiovoloni `thom@shift.click` + +## Requirements + +This target is an `x86_64` target that only supports Apple's late-gen +(Haswell-compatible) Intel chips. It enables a set of target features available +on these chips (AVX2 and similar), and MachO binaries built with this target may +be used as the `x86_64h` entry in universal binaries ("fat" MachO binaries), and +will fail to load on machines that do not support this. + +It should support the full standard library (`std` and `alloc` either with +default or user-defined allocators). This target is probably most useful when +targetted via cross-compilation (including from `x86_64-apple-darwin`), but if +built manually, the host tools work. + +It is similar to `x86_64-apple-darwin` in nearly all respects, although the +minimum supported OS version is slightly higher (it requires 10.8 rather than +`x86_64-apple-darwin`'s 10.7). + +## Building the target + +Users on Apple targets can build this by adding it to the `target` list in +`config.toml`, or with `-Zbuild-std`. + +## Building Rust programs + +Rust does not yet ship pre-compiled artifacts for this target. To compile for +this target, you will either need to build Rust with the target enabled (see +"Building the target" above), or build your own copy of `core` by using +`build-std` or similar. + +## Testing + +Code built with this target can be run on the set of Intel macOS machines that +support running `x86_64h` binaries (relatively recent Intel macs). The Rust test +suite seems to work. + +## Cross-compilation toolchains and C code + +Cross-compilation to this target from Apple hosts should generally work without +much configuration, so long as XCode and the CommandLineTools are installed. +Targetting it from non-Apple hosts is difficult, but no moreso than targetting +`x86_64-apple-darwin`. + +When compiling C code for this target, either the "`x86_64h-apple-macosx*`" LLVM +targets should be used, or an argument like `-arch x86_64h` should be passed to +the C compiler.