diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2023-09-28 16:01:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-28 16:01:26 +0100 |
| commit | 77227c2ff552a81741130ae17d58847c3cfe3ba3 (patch) | |
| tree | e690e5feae8aad170ce4d18bc11c279ec23cce45 /src/build_settings.cpp | |
| parent | 2370884722c9638cf0ba3916a8a54247096bb4f6 (diff) | |
| parent | 2afccd7fbdb3a7c440597356fa4c9d635a06a8d2 (diff) | |
Merge pull request #2805 from odin-lang/llvm-17
Support LLVM 17.0.1
Diffstat (limited to 'src/build_settings.cpp')
| -rw-r--r-- | src/build_settings.cpp | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp index 79f6e8a2c..42ea538af 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -264,6 +264,14 @@ u64 get_vet_flag_from_name(String const &name) { } +enum SanitizerFlags : u32 { + SanitizerFlag_NONE = 0, + SanitizerFlag_Address = 1u<<0, + SanitizerFlag_Memory = 1u<<1, + SanitizerFlag_Thread = 1u<<2, +}; + + // This stores the information for the specify architecture of this build struct BuildContext { @@ -305,6 +313,7 @@ struct BuildContext { String pdb_filepath; u64 vet_flags; + u32 sanitizer_flags; bool has_resource; String link_flags; @@ -1381,7 +1390,7 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta bc->optimization_level = -1; // -o:none } - bc->optimization_level = gb_clamp(bc->optimization_level, -1, 2); + bc->optimization_level = gb_clamp(bc->optimization_level, -1, 3); // ENFORCE DYNAMIC MAP CALLS bc->dynamic_map_calls = true; @@ -1738,6 +1747,42 @@ gb_internal bool init_build_paths(String init_filename) { return false; } + if (build_context.sanitizer_flags & SanitizerFlag_Address) { + switch (build_context.metrics.os) { + case TargetOs_windows: + case TargetOs_linux: + case TargetOs_darwin: + break; + default: + gb_printf_err("-sanitize:address is only supported on windows, linux, and darwin\n"); + return false; + } + } + + if (build_context.sanitizer_flags & SanitizerFlag_Memory) { + switch (build_context.metrics.os) { + case TargetOs_linux: + break; + default: + gb_printf_err("-sanitize:memory is only supported on linux\n"); + return false; + } + if (build_context.metrics.os != TargetOs_linux) { + return false; + } + } + + if (build_context.sanitizer_flags & SanitizerFlag_Thread) { + switch (build_context.metrics.os) { + case TargetOs_linux: + case TargetOs_darwin: + break; + default: + gb_printf_err("-sanitize:thread is only supported on linux and darwin\n"); + return false; + } + } + if (bc->target_features_string.len != 0) { enable_target_feature({}, bc->target_features_string); |