diff options
| author | gingerBill <bill@gingerbill.org> | 2024-01-28 22:15:28 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-01-28 22:15:28 +0000 |
| commit | 6a07effdd2cb7c369aa4c9711ff66b840abe3033 (patch) | |
| tree | 03ba64f8bbca983b61061223309ef4ed01e5ffc7 | |
| parent | 395e0fb225816ff9699e82f6d9d5887ef3b1358a (diff) | |
Freestanding - default to nil allocator; wasm - default to panic allocator
| -rw-r--r-- | src/build_settings.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp index 8204d735f..c29a012ec 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -1475,6 +1475,16 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta break; } } + + if (bc->metrics.os == TargetOs_freestanding) { + bc->ODIN_DEFAULT_TO_NIL_ALLOCATOR = !bc->ODIN_DEFAULT_TO_PANIC_ALLOCATOR; + } else if (is_arch_wasm()) { + if (bc->metrics.os == TargetOs_js || bc->metrics.os == TargetOs_wasi) { + // TODO(bill): Should these even have a default "heap-like" allocator? + } + bc->ODIN_DEFAULT_TO_PANIC_ALLOCATOR = true; + bc->ODIN_DEFAULT_TO_NIL_ALLOCATOR = !bc->ODIN_DEFAULT_TO_PANIC_ALLOCATOR; + } } #if defined(GB_SYSTEM_WINDOWS) @@ -1609,7 +1619,6 @@ gb_internal bool init_build_paths(String init_filename) { produces_output_file = true; } - if (build_context.ODIN_DEFAULT_TO_NIL_ALLOCATOR || build_context.ODIN_DEFAULT_TO_PANIC_ALLOCATOR) { bc->no_dynamic_literals = true; |