aboutsummaryrefslogtreecommitdiff
path: root/lib/std/start.zig
diff options
context:
space:
mode:
authorJacob Young <15544577+jacobly0@users.noreply.github.com>2025-06-20 00:20:56 -0400
committerGitHub <noreply@github.com>2025-06-20 00:20:56 -0400
commitcf1a7bbd44b9542552c7b5dc6532aafb5142bf7a (patch)
tree23d82265b3a4500514063f0fa13533b255f88f64 /lib/std/start.zig
parentf5a327cd366348a739a282f380acd627815183b5 (diff)
parent1f98c98fffb09bf15a9fc04ecd5f1fa38a4bd4b8 (diff)
downloadzig-cf1a7bbd44b9542552c7b5dc6532aafb5142bf7a.tar.gz
zig-cf1a7bbd44b9542552c7b5dc6532aafb5142bf7a.zip
Merge pull request #24193 from jacobly0/x86_64-spring-cleaning
x86_64: increase passing test coverage on windows
Diffstat (limited to 'lib/std/start.zig')
-rw-r--r--lib/std/start.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig
index 364844e54d..a74b83fe81 100644
--- a/lib/std/start.zig
+++ b/lib/std/start.zig
@@ -485,6 +485,9 @@ 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.single_threaded and !builtin.link_libc) {
_ = @import("os/windows/tls.zig");
}
@@ -495,6 +498,9 @@ 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.single_threaded and !builtin.link_libc) {
_ = @import("os/windows/tls.zig");
}