aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Lipstate <jon@lipstate.com>2025-09-03 22:32:33 -0700
committerJon Lipstate <jon@lipstate.com>2025-09-03 22:32:33 -0700
commite0c4c5336241cb3106910bec64369888b937132b (patch)
treeae56c6d078ae03e6bcfce7f6739cd1812efab428
parent231ce2da59cd93b4e8d8a90daca2d2111fc3ecf8 (diff)
add tls when we have crt
-rw-r--r--base/runtime/core_builtin.odin4
-rw-r--r--core/testing/signal_handler_libc.odin4
-rw-r--r--src/main.cpp5
3 files changed, 7 insertions, 6 deletions
diff --git a/base/runtime/core_builtin.odin b/base/runtime/core_builtin.odin
index 33b600c3e..7e96c6784 100644
--- a/base/runtime/core_builtin.odin
+++ b/base/runtime/core_builtin.odin
@@ -54,8 +54,8 @@ container_of :: #force_inline proc "contextless" (ptr: $P/^$Field_Type, $T: type
when !NO_DEFAULT_TEMP_ALLOCATOR {
- when ODIN_ARCH == .i386 && ODIN_OS == .Windows {
- // Thread-local storage is problematic on Windows i386
+ when ODIN_ARCH == .i386 && ODIN_OS == .Windows && ODIN_NO_CRT {
+ // Thread-local storage doesn't work on Windows i386 without CRT
global_default_temp_allocator_data: Default_Temp_Allocator
} else {
@thread_local global_default_temp_allocator_data: Default_Temp_Allocator
diff --git a/core/testing/signal_handler_libc.odin b/core/testing/signal_handler_libc.odin
index 961f5c7ce..7c50fbb09 100644
--- a/core/testing/signal_handler_libc.odin
+++ b/core/testing/signal_handler_libc.odin
@@ -24,8 +24,8 @@ import "core:terminal/ansi"
@(private="file") stop_test_passed: libc.sig_atomic_t
@(private="file") stop_test_alert: libc.sig_atomic_t
-when ODIN_ARCH == .i386 && ODIN_OS == .Windows {
- // Thread-local storage is problematic on Windows i386
+when ODIN_ARCH == .i386 && ODIN_OS == .Windows && ODIN_NO_CRT {
+ // Thread-local storage doesn't work on Windows i386 without CRT
@(private="file")
local_test_index: libc.sig_atomic_t
@(private="file")
diff --git a/src/main.cpp b/src/main.cpp
index c4646bc9f..198706de2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3619,8 +3619,9 @@ int main(int arg_count, char const **arg_ptr) {
// }
// Warn about Windows i386 thread-local storage limitations
- if (build_context.metrics.arch == TargetArch_i386 && build_context.metrics.os == TargetOs_windows) {
- gb_printf_err("Warning: Thread-local storage is disabled on Windows i386.\n");
+ if (build_context.metrics.arch == TargetArch_i386 && build_context.metrics.os == TargetOs_windows && build_context.no_crt) {
+ gb_printf_err("Warning: Thread-local storage is not supported on Windows i386 with -no-crt.\n");
+ gb_printf_err(" Multi-threaded code will not work correctly.\n");
}
// Check chosen microarchitecture. If not found or ?, print list.