Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,43 +74,6 @@ jobs:
command: test
args: --target=${{ matrix.extra_target }} --manifest-path=${{ matrix.manifest }} ${{ matrix.mode }} --examples -- --nocapture

clang-cl-test:
name: Test ${{ matrix.manifest }} on ${{ matrix.rust_target }} with ${{ matrix.clang_cl }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
manifest: ["psm/Cargo.toml", "Cargo.toml"]
rust_target:
- x86_64-pc-windows-msvc
- i686-pc-windows-msvc
include:
- rust_target: x86_64-pc-windows-msvc
clang_cl: C:/msys64/mingw64/bin/clang-cl.exe
package: mingw-w64-x86_64-clang
- rust_target: i686-pc-windows-msvc
clang_cl: C:/msys64/mingw32/bin/clang-cl.exe
package: mingw-w64-i686-clang
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
release: false
install: ${{ matrix.package }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
target: ${{ matrix.rust_target }}
- uses: actions-rs/cargo@v1
with:
command: test
args: --target=${{ matrix.rust_target }} --manifest-path=${{ matrix.manifest }} -- --nocapture
env:
CC: ${{ matrix.clang_cl }}
CFLAGS: "-Werror -Wundef"

windows-gnu-test:
name: Test ${{ matrix.manifest }} on ${{ matrix.rust_target }} with ${{ matrix.rust_toolchain }}
runs-on: windows-latest
Expand Down
45 changes: 9 additions & 36 deletions psm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,16 @@ fn find_assembly(
endian: &str,
os: &str,
env: &str,
masm: bool,
) -> Option<(&'static str, bool)> {
match (arch, endian, os, env) {
// The implementations for stack switching exist, but, officially, doing so without Fibers
// is not supported in Windows. For x86_64 the implementation actually works locally,
// but failed tests in CI (???). Might want to have a feature for experimental support
// here.
("x86", _, "windows", _) => {
if masm {
Some(("src/arch/x86_msvc.asm", false))
} else {
Some(("src/arch/x86_windows_gnu.s", false))
}
}
("x86_64", _, "windows", _) => {
if masm {
Some(("src/arch/x86_64_msvc.asm", false))
} else {
Some(("src/arch/x86_64_windows_gnu.s", false))
}
}
// Windows: inline asm in src/asm/windows/. Stack switching (canswitch)
// is disabled — officially requires Fibers.
("x86", _, "windows", _) => None,
("x86_64", _, "windows", _) => None,
("aarch64", _, "windows", _) => None,
("x86_64", _, "cygwin", _) => Some(("src/arch/x86_64_windows_gnu.s", false)),
("arm", _, "windows", "msvc") => Some(("src/arch/arm_armasm.asm", false)),
("arm64ec", _, "windows", "msvc") => Some(("src/arch/arm64ec_armasm.asm", false)),
("aarch64", _, "windows", _) => {
if masm {
Some(("src/arch/aarch64_armasm.asm", false))
} else {
Some(("src/arch/aarch_aapcs64.s", false))
}
}
("x86", _, _, _) => Some(("src/arch/x86.s", true)),
("x86_64", _, _, _) => Some(("src/arch/x86_64.s", true)),
("arm", _, _, _) => Some(("src/arch/arm_aapcs.s", true)),
Expand Down Expand Up @@ -74,22 +53,16 @@ fn main() {
let mut cfg = cc::Build::new();

let msvc = cfg.get_compiler().is_like_msvc();
// If we're targeting msvc, either via regular MS toolchain or clang-cl, we
// will _usually_ want to use the regular Microsoft assembler if it exists,
// which is done for us within cc, however it _probably_ won't exist if
// we're in a cross-compilation context pm a platform that can't natively
// run Windows executables, so in that case we instead use the the equivalent
// GAS assembly file instead. This logic can be removed once LLVM natively
// supports compiling MASM, but that is not stable yet
let masm = msvc && var("HOST").expect("HOST env not set").contains("windows");

let asm = if let Some((asm, canswitch)) = find_assembly(&arch, &endian, &os, &env, masm) {
let asm = if let Some((asm, canswitch)) = find_assembly(&arch, &endian, &os, &env) {
println!("cargo:rustc-cfg=asm");
println!("cargo:rustc-cfg=link_asm");
if canswitch {
println!("cargo:rustc-cfg=switchable_stack")
}
asm
} else if (arch == "aarch64" || arch == "x86_64" || arch == "x86") && os == "windows" {
println!("cargo:rustc-cfg=asm");
return;
} else {
println!(
"cargo:warning=Target {}-{}-{} has no assembly files!",
Expand Down
38 changes: 0 additions & 38 deletions psm/src/arch/aarch64_armasm.asm

This file was deleted.

61 changes: 0 additions & 61 deletions psm/src/arch/x86_64_msvc.asm

This file was deleted.

70 changes: 0 additions & 70 deletions psm/src/arch/x86_msvc.asm

This file was deleted.

94 changes: 0 additions & 94 deletions psm/src/arch/x86_windows_gnu.s

This file was deleted.

6 changes: 6 additions & 0 deletions psm/src/asm/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#[cfg(target_os = "windows")]
mod windows;
#[cfg(target_os = "windows")]
pub(crate) use windows::{rust_psm_stack_direction, rust_psm_stack_pointer};
#[cfg(all(target_os = "windows", switchable_stack))]
pub(crate) use windows::{rust_psm_on_stack, rust_psm_replace_stack};
Loading
Loading