aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-09-18 22:01:14 +0100
committerGitHub <noreply@github.com>2025-09-18 22:01:14 +0100
commit4d2854f5618c8e6a09bc2ec7bf969eccb01f93c2 (patch)
treeece1e00dd4e8f7bbb1098f4cffbed5b232e7f6e2 /base
parent9cf69576ab8cb220af5802a04a0aa53dc92046a5 (diff)
parent57bc45ae30736a891e4b65c7047a091e53cf60e3 (diff)
Merge pull request #5632 from kalsprite/x386
windows i386 support
Diffstat (limited to 'base')
-rw-r--r--base/runtime/core_builtin.odin7
-rw-r--r--base/runtime/entry_windows.odin14
2 files changed, 19 insertions, 2 deletions
diff --git a/base/runtime/core_builtin.odin b/base/runtime/core_builtin.odin
index 903ea7ed7..c0a0204f9 100644
--- a/base/runtime/core_builtin.odin
+++ b/base/runtime/core_builtin.odin
@@ -54,7 +54,12 @@ container_of :: #force_inline proc "contextless" (ptr: $P/^$Field_Type, $T: type
when !NO_DEFAULT_TEMP_ALLOCATOR {
- @thread_local global_default_temp_allocator_data: Default_Temp_Allocator
+ when ODIN_ARCH == .i386 && ODIN_OS == .Windows {
+ // Thread-local storage is problematic on Windows i386
+ global_default_temp_allocator_data: Default_Temp_Allocator
+ } else {
+ @thread_local global_default_temp_allocator_data: Default_Temp_Allocator
+ }
}
@(builtin, disabled=NO_DEFAULT_TEMP_ALLOCATOR)
diff --git a/base/runtime/entry_windows.odin b/base/runtime/entry_windows.odin
index 8eb4cc7d1..dc8e9b82c 100644
--- a/base/runtime/entry_windows.odin
+++ b/base/runtime/entry_windows.odin
@@ -28,7 +28,19 @@ when ODIN_BUILD_MODE == .Dynamic {
return true
}
} else when !ODIN_TEST && !ODIN_NO_ENTRY_POINT {
- when ODIN_ARCH == .i386 || ODIN_NO_CRT {
+ when ODIN_ARCH == .i386 && !ODIN_NO_CRT {
+ // Windows i386 with CRT: libcmt provides mainCRTStartup which calls _main
+ // Note: "c" calling convention adds underscore prefix automatically on i386
+ @(link_name="main", linkage="strong", require)
+ main :: proc "c" (argc: i32, argv: [^]cstring) -> i32 {
+ args__ = argv[:argc]
+ context = default_context()
+ #force_no_inline _startup_runtime()
+ intrinsics.__entry_point()
+ #force_no_inline _cleanup_runtime()
+ return 0
+ }
+ } else when ODIN_NO_CRT {
@(link_name="mainCRTStartup", linkage="strong", require)
mainCRTStartup :: proc "system" () -> i32 {
context = default_context()