Skip to content

Commit

Permalink
Unrolled build for rust-lang#134996
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#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 rust-lang#134565 and rust-lang/backtrace-rs#685
- Fixed a few minor issues to let most of the UWP targets compile
- Happy new year to all!

r? jieyouxu
  • Loading branch information
rust-timer authored Jan 5, 2025
2 parents 3dc3c52 + 33b0606 commit 0cd7d73
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 7 deletions.
5 changes: 3 additions & 2 deletions library/std/src/sys/pal/windows/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/doc/rustc/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
52 changes: 52 additions & 0 deletions src/doc/rustc/src/platform-support/uwp-windows-msvc.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 0cd7d73

Please sign in to comment.