forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#110612 - matthiaskrgr:rollup-y2hbjws, r=matth…
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#108795 (Add support for the x86_64h-apple-darwin target) - rust-lang#110558 (Add Call terminator to SMIR) - rust-lang#110565 (linkchecker: running from a directory separate from the book) - rust-lang#110599 (Remove an unused `&[Ty]` <-> `&[GenericArg]`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
11 changed files
with
177 additions
and
29 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
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,44 @@ | ||
use super::apple_base::{macos_llvm_target, opts, Arch}; | ||
use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet}; | ||
use crate::spec::{StackProbeType, Target, TargetOptions}; | ||
|
||
pub fn target() -> Target { | ||
let arch = Arch::X86_64h; | ||
let mut base = opts("macos", arch); | ||
base.max_atomic_width = Some(128); | ||
base.frame_pointer = FramePointer::Always; | ||
base.add_pre_link_args(LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-m64"]); | ||
base.stack_probes = StackProbeType::X86; | ||
base.supported_sanitizers = | ||
SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::THREAD; | ||
|
||
// x86_64h is core2-avx without a few of the features which would otherwise | ||
// be guaranteed, so we need to disable those. This imitates clang's logic: | ||
// - https://github.com/llvm/llvm-project/blob/bd1f7c417/clang/lib/Driver/ToolChains/Arch/X86.cpp#L77-L78 | ||
// - https://github.com/llvm/llvm-project/blob/bd1f7c417/clang/lib/Driver/ToolChains/Arch/X86.cpp#L133-L141 | ||
// | ||
// FIXME: Sadly, turning these off here disables them in such a way that they | ||
// aren't re-enabled by `-Ctarget-cpu=native` (on a machine that has them). | ||
// It would be nice if this were not the case, but fixing it seems tricky | ||
// (and given that the main use-case for this target is for use in universal | ||
// binaries, probably not that important). | ||
base.features = "-rdrnd,-aes,-pclmul,-rtm,-fsgsbase".into(); | ||
// Double-check that the `cpu` is what we expect (if it's not the list above | ||
// may need updating). | ||
assert_eq!( | ||
base.cpu, "core-avx2", | ||
"you need to adjust the feature list in x86_64h-apple-darwin if you change this", | ||
); | ||
|
||
Target { | ||
// Clang automatically chooses a more specific target based on | ||
// MACOSX_DEPLOYMENT_TARGET. To enable cross-language LTO to work | ||
// correctly, we do too. | ||
llvm_target: macos_llvm_target(arch).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: arch.target_arch(), | ||
options: TargetOptions { mcount: "\u{1}mcount".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
57 changes: 57 additions & 0 deletions
57
src/doc/rustc/src/platform-support/x86_64h-apple-darwin.md
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,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 `[email protected]` <https://github.com/thomcc> | ||
|
||
## 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. |
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