Skip to content

Commit 9a8f1f6

Browse files
committed
start: Only issue fninit for x86(_64)-windows
Closes #24263.
1 parent 9ef4bdf commit 9a8f1f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/std/start.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ fn _start() callconv(.naked) noreturn {
486486

487487
fn WinStartup() callconv(.withStackAlign(.c, 1)) noreturn {
488488
// Switch from the x87 fpu state set by windows to the state expected by the gnu abi.
489-
if (builtin.abi == .gnu) asm volatile ("fninit");
489+
if (builtin.cpu.arch.isX86() and builtin.abi == .gnu) asm volatile ("fninit");
490490

491491
if (!builtin.single_threaded and !builtin.link_libc) {
492492
_ = @import("os/windows/tls.zig");
@@ -499,7 +499,7 @@ fn WinStartup() callconv(.withStackAlign(.c, 1)) noreturn {
499499

500500
fn wWinMainCRTStartup() callconv(.withStackAlign(.c, 1)) noreturn {
501501
// Switch from the x87 fpu state set by windows to the state expected by the gnu abi.
502-
if (builtin.abi == .gnu) asm volatile ("fninit");
502+
if (builtin.cpu.arch.isX86() and builtin.abi == .gnu) asm volatile ("fninit");
503503

504504
if (!builtin.single_threaded and !builtin.link_libc) {
505505
_ = @import("os/windows/tls.zig");

0 commit comments

Comments
 (0)