ITADN

Use inline asm for Windows instead of external assembly

#144Pull Requestmmastrac 创建于 2026-04-10
M
mmastraccommented
The external assembly files for aarch64 Windows (aarch64_armasm.asm and the GAS fallback aarch_aapcs64.s) are problematic when cross-compiling from non-Windows hosts: MASM isn't available, and the GAS fallback doesn't receive the necessary preprocessor defines when cc-rs detects an MSVC compiler. To simplify Windows support, we can just move to inline asm for all the supported platforms - they don't actually support stack switching anyways. x86_64 and aarch64 are ported, but i686's switching code is left as a placeholder (32-bit windows might die off before someone has a chance to get it working...). There were a few `clang-cl` matrix jobs that were failing because of deprecated i686 support in msys. They are no longer an issue because we're just using `asm!` for that platform and could be removed. Ideally we'd use `naked` on the SP functions but the MSRV is too high for that. Instead we make them `inline(always)`. I don't believe that the _exact_ SP is required, regardless of this. I added `nostack` on the `sp`-reader function because that seems to be correct: > nostack: The assembly code does not push data to the stack, or write to the stack red-zone (if supported by the target). If this option is not used then the stack pointer is guaranteed by the compiler at the start of the assembly code to be suitably aligned (according to the target ABI) for a function call. Fixes #143
合并状态:未合并 2 条评论