Rollup merge of #134996 - bdbai:uwp-support, r=jieyouxu,ChrisDenton

Add UWP (msvc) target support page

- Added Platform Support page for `x86_64-uwp-windows-msvc`, `i686-uwp-windows-msvc`, `thumbv7a-uwp-windows-msvc` and `aarch64-uwp-windows-msvc`
  - Adding myself as a maintainer
  - Removing the ticks for `thumbv7a-pc-windows-msvc` and `thumbv7a-uwp-windows-msvc` as they do not currently build due to #134565 and https://github.com/rust-lang/backtrace-rs/pull/685
- Fixed a few minor issues to let most of the UWP targets compile
- Happy new year to all!

r? jieyouxu
This commit is contained in:
Jubilee 2025-01-04 17:23:16 -08:00 committed by GitHub
commit dcb8be8934
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 61 additions and 7 deletions

View File

@ -5,8 +5,9 @@
#[cfg(test)]
mod tests;
use super::api::{self, WinError};
use super::to_u16s;
#[cfg(not(target_vendor = "uwp"))]
use super::api::WinError;
use super::{api, to_u16s};
use crate::error::Error as StdError;
use crate::ffi::{OsStr, OsString};
use crate::os::windows::ffi::EncodeWide;

View File

@ -87,6 +87,7 @@
- [*-unknown-openbsd](platform-support/openbsd.md)
- [*-unknown-redox](platform-support/redox.md)
- [\*-unknown-uefi](platform-support/unknown-uefi.md)
- [\*-uwp-windows-msvc](platform-support/uwp-windows-msvc.md)
- [\*-wrs-vxworks](platform-support/vxworks.md)
- [wasm32-wasip1](platform-support/wasm32-wasip1.md)
- [wasm32-wasip1-threads](platform-support/wasm32-wasip1-threads.md)

View File

@ -264,7 +264,7 @@ target | std | host | notes
[`aarch64-unknown-redox`](platform-support/redox.md) | ✓ | | ARM64 Redox OS
[`aarch64-unknown-teeos`](platform-support/aarch64-unknown-teeos.md) | ? | | ARM64 TEEOS |
[`aarch64-unknown-trusty`](platform-support/trusty.md) | ? | |
`aarch64-uwp-windows-msvc` | ✓ | |
[`aarch64-uwp-windows-msvc`](platform-support/uwp-windows-msvc.md) | ✓ | |
[`aarch64-wrs-vxworks`](platform-support/vxworks.md) | ✓ | | ARM64 VxWorks OS
`aarch64_be-unknown-linux-gnu` | ✓ | ✓ | ARM64 Linux (big-endian)
`aarch64_be-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (big-endian, ILP32 ABI)
@ -312,7 +312,7 @@ target | std | host | notes
[`i686-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 32-bit OpenBSD [^x86_32-floats-return-ABI]
[`i686-unknown-redox`](platform-support/redox.md) | ✓ | | i686 Redox OS
`i686-uwp-windows-gnu` | ✓ | | [^x86_32-floats-return-ABI]
`i686-uwp-windows-msvc` | ✓ | | [^x86_32-floats-return-ABI]
[`i686-uwp-windows-msvc`](platform-support/uwp-windows-msvc.md) | ✓ | | [^x86_32-floats-return-ABI]
[`i686-win7-windows-msvc`](platform-support/win7-windows-msvc.md) | ✓ | | 32-bit Windows 7 support [^x86_32-floats-return-ABI]
[`i686-wrs-vxworks`](platform-support/vxworks.md) | ✓ | | [^x86_32-floats-return-ABI]
[`loongarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | LoongArch64 OpenHarmony
@ -383,8 +383,8 @@ target | std | host | notes
[`thumbv4t-none-eabi`](platform-support/armv4t-none-eabi.md) | * | | Thumb-mode Bare Armv4T
[`thumbv5te-none-eabi`](platform-support/armv5te-none-eabi.md) | * | | Thumb-mode Bare Armv5TE
[`thumbv6m-nuttx-eabi`](platform-support/nuttx.md) | * | | ARMv6M with NuttX
`thumbv7a-pc-windows-msvc` | | |
`thumbv7a-uwp-windows-msvc` | ✓ | |
`thumbv7a-pc-windows-msvc` | | |
[`thumbv7a-uwp-windows-msvc`](platform-support/uwp-windows-msvc.md) | | |
[`thumbv7em-nuttx-eabi`](platform-support/nuttx.md) | * | | ARMv7EM with NuttX
[`thumbv7em-nuttx-eabihf`](platform-support/nuttx.md) | * | | ARMv7EM with NuttX, hardfloat
[`thumbv7m-nuttx-eabi`](platform-support/nuttx.md) | * | | ARMv7M with NuttX
@ -406,7 +406,7 @@ target | std | host | notes
[`x86_64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 64-bit OpenBSD
[`x86_64-unknown-trusty`](platform-support/trusty.md) | ? | |
`x86_64-uwp-windows-gnu` | ✓ | |
`x86_64-uwp-windows-msvc` | ✓ | |
[`x86_64-uwp-windows-msvc`](platform-support/uwp-windows-msvc.md) | ✓ | |
[`x86_64-win7-windows-msvc`](platform-support/win7-windows-msvc.md) | ✓ | | 64-bit Windows 7 support
[`x86_64-wrs-vxworks`](platform-support/vxworks.md) | ✓ | |
[`x86_64h-apple-darwin`](platform-support/x86_64h-apple-darwin.md) | ✓ | ✓ | macOS with late-gen Intel (at least Haswell)

View File

@ -0,0 +1,52 @@
# `x86_64-uwp-windows-msvc`, `i686-uwp-windows-msvc`, `thumbv7a-uwp-windows-msvc` and `aarch64-uwp-windows-msvc`
**Tier: 3**
Windows targets for Universal Windows Platform (UWP) applications, using MSVC toolchain.
## Target maintainers
- [@bdbai](https://github.com/bdbai)
## Requirements
These targets are cross-compiled with std support. The host requirement and
binary format are the same as the corresponding non-UWP targets (i.e.
`x86_64-pc-windows-msvc`, `i686-pc-windows-msvc`, `thumbv7a-pc-windows-msvc`
and `aarch64-pc-windows-msvc`).
## Building the targets
The targets can be built by enabling them for a `rustc` build, for example:
```toml
[build]
build-stage = 1
target = ["x86_64-uwp-windows-msvc", "aarch64-uwp-windows-msvc"]
```
## Building Rust programs
Rust does not yet ship pre-compiled artifacts for these targets. To compile for
these targets, you will either need to build Rust with the targets enabled (see
"Building the targets" above), or build your own copy of `std` by using
`build-std` or similar.
Example of building a Rust project for x64 UWP using `build-std`:
```pwsh
cargo build -Z build-std=std,panic_abort --target x86_64-uwp-windows-msvc
```
## Testing
Currently there is no support to run the rustc test suite for this target.
## Cross-compilation toolchains and C code
In general, the toolchain target should match the corresponding non-UWP
targets. Beware that not all Win32 APIs behave the same way in UWP, and some
are restricted in [AppContainer](https://learn.microsoft.com/en-us/windows/win32/secauthz/appcontainer-for-legacy-applications-)
or even not available at all. If the C code being compiled happens to use any
of restricted or unavailable APIs, consider using allowed alternatives or
disable certain feature sets to avoid using them.