diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-01-17 13:22:47 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-17 13:22:47 +0000 |
| commit | fcd3cf7fa815a605e89dac40dd01a9a70e257110 (patch) | |
| tree | 6079ba5427dedf384107d691c63a7a881f9c3cc2 /src/build_settings.cpp | |
| parent | 16eca1ded12373cd5a106d20796458a374940771 (diff) | |
| parent | 3f20b6324353cfb9e3ad27fe9ee5f8d07148911b (diff) | |
Merge pull request #4704 from flysand7/4614-thread-locals
Error if `-no-crt` is used without `-no-thread-locals`
Diffstat (limited to 'src/build_settings.cpp')
| -rw-r--r-- | src/build_settings.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp index 93168cf77..a8d06d56d 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -2124,6 +2124,7 @@ gb_internal bool init_build_paths(String init_filename) { } } + bool no_crt_checks_failed = false; if (build_context.no_crt && !build_context.ODIN_DEFAULT_TO_NIL_ALLOCATOR && !build_context.ODIN_DEFAULT_TO_PANIC_ALLOCATOR) { switch (build_context.metrics.os) { case TargetOs_linux: @@ -2133,11 +2134,29 @@ gb_internal bool init_build_paths(String init_filename) { case TargetOs_openbsd: case TargetOs_netbsd: case TargetOs_haiku: - gb_printf_err("-no-crt on unix systems requires either -default-to-nil-allocator or -default-to-panic-allocator to also be present because the default allocator requires crt\n"); - return false; + gb_printf_err("-no-crt on Unix systems requires either -default-to-nil-allocator or -default-to-panic-allocator to also be present, because the default allocator requires CRT\n"); + no_crt_checks_failed = true; } } + if (build_context.no_crt && !build_context.no_thread_local) { + switch (build_context.metrics.os) { + case TargetOs_linux: + case TargetOs_darwin: + case TargetOs_essence: + case TargetOs_freebsd: + case TargetOs_openbsd: + case TargetOs_netbsd: + case TargetOs_haiku: + gb_printf_err("-no-crt on Unix systems requires the -no-thread-local flag to also be present, because the TLS is inaccessible without CRT\n"); + no_crt_checks_failed = true; + } + } + + if (no_crt_checks_failed) { + return false; + } + return true; } |