zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 9a8f1f675b5c1dd8cd58ebfb828d54fb29385b32 (tree)
parent 9ef4bdf234ed6b58d46452f2286469925f062c39
Author: Alex Rønne Petersen <alex@alexrp.com>
Date:   Fri,  4 Jul 2025 13:19:32 +0200

start: Only issue fninit for x86(_64)-windows

Closes #24263.

Diffstat:
Mlib/std/start.zig | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/std/start.zig b/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");