Commit 9a8f1f675b

Alex Rønne Petersen <alex@alexrp.com>
2025-07-04 13:19:32
start: Only issue fninit for x86(_64)-windows
Closes #24263.
1 parent 9ef4bdf
Changed files (1)
lib
lib/std/start.zig
@@ -486,7 +486,7 @@ fn _start() callconv(.naked) noreturn {
 
 fn WinStartup() callconv(.withStackAlign(.c, 1)) noreturn {
     // Switch from the x87 fpu state set by windows to the state expected by the gnu abi.
-    if (builtin.abi == .gnu) asm volatile ("fninit");
+    if (builtin.cpu.arch.isX86() and builtin.abi == .gnu) asm volatile ("fninit");
 
     if (!builtin.single_threaded and !builtin.link_libc) {
         _ = @import("os/windows/tls.zig");
@@ -499,7 +499,7 @@ fn WinStartup() callconv(.withStackAlign(.c, 1)) noreturn {
 
 fn wWinMainCRTStartup() callconv(.withStackAlign(.c, 1)) noreturn {
     // Switch from the x87 fpu state set by windows to the state expected by the gnu abi.
-    if (builtin.abi == .gnu) asm volatile ("fninit");
+    if (builtin.cpu.arch.isX86() and builtin.abi == .gnu) asm volatile ("fninit");
 
     if (!builtin.single_threaded and !builtin.link_libc) {
         _ = @import("os/windows/tls.zig");