-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add arm64ec-pc-windows-msvc target #119199
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
21 changes: 21 additions & 0 deletions
21
compiler/rustc_target/src/spec/targets/arm64ec_pc_windows_msvc.rs
This file contains hidden or 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,21 @@ | ||
use crate::spec::{add_link_args, base, LinkerFlavor, Lld, Target}; | ||
|
||
pub fn target() -> Target { | ||
let mut base = base::windows_msvc::opts(); | ||
base.max_atomic_width = Some(128); | ||
base.features = "+v8a,+neon,+fp-armv8".into(); | ||
add_link_args( | ||
&mut base.late_link_args, | ||
LinkerFlavor::Msvc(Lld::No), | ||
&["/machine:arm64ec", "softintrin.lib"], | ||
); | ||
|
||
Target { | ||
llvm_target: "arm64ec-pc-windows-msvc".into(), | ||
description: None, | ||
pointer_width: 64, | ||
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".into(), | ||
arch: "arm64ec".into(), | ||
options: base, | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
69 changes: 69 additions & 0 deletions
69
src/doc/rustc/src/platform-support/arm64ec-pc-windows-msvc.md
This file contains hidden or 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,69 @@ | ||
# `arm64ec-pc-windows-msvc` | ||
|
||
**Tier: 3** | ||
|
||
Arm64EC ("Emulation Compatible") for mixed architecture (AArch64 and x86_64) | ||
applications on AArch64 Windows 11. See <https://learn.microsoft.com/en-us/windows/arm/arm64ec>. | ||
|
||
## Target maintainers | ||
|
||
- [@dpaoliello](https://github.com/dpaoliello) | ||
|
||
## Requirements | ||
|
||
Target only supports cross-compilation, `core` and `alloc` are supported but | ||
`std` is not. | ||
|
||
Builds Arm64EC static and dynamic libraries and executables which can be run on | ||
AArch64 Windows 11 devices. Arm64EC static libraries can also be linked into | ||
Arm64X dynamic libraries and executables. | ||
|
||
Uses `arm64ec` as its `target_arch` - code built for Arm64EC must be compatible | ||
with x86_64 code (e.g., same structure layouts, function signatures, etc.) but | ||
use AArch64 intrinsics. | ||
|
||
Only supported backend is LLVM 18 (or above). | ||
|
||
## Building the target | ||
|
||
You can build Rust with support for the targets by adding it to the `target` | ||
list in `config.toml` and disabling `std`: | ||
|
||
```toml | ||
[build] | ||
target = [ "arm64ec-pc-windows-msvc" ] | ||
|
||
[target.arm64ec-pc-windows-msvc] | ||
no-std = true | ||
``` | ||
|
||
## 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 | ||
|
||
Tests can be run on AArch64 Windows 11 devices. | ||
|
||
Since this is a `no_std` target, the Rust test suite is not supported. | ||
|
||
## Cross-compilation toolchains and C code | ||
|
||
C code can be built using the Arm64-targetting MSVC toolchain. | ||
|
||
To compile: | ||
|
||
```bash | ||
cl /arm64EC /c ... | ||
``` | ||
|
||
To link: | ||
|
||
```bash | ||
link /MACHINE:ARM64EC ... | ||
``` | ||
|
||
Further reading: <https://learn.microsoft.com/en-us/windows/arm/arm64ec-build> |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.