diff options
| author | gingerBill <bill@gingerbill.org> | 2023-09-21 09:40:33 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-09-21 09:40:33 +0100 |
| commit | 2160484b62ebde52ba6f486ad652f1a72cfe9143 (patch) | |
| tree | 07faa7a8ece3962d504853c70400717dd04130d7 /src/build_settings.cpp | |
| parent | f0ab58dfbb4be6103fb7340ec570d218e2137a4b (diff) | |
Support `-sanitize:<string>` for `address`, `memory`, `thread` for LLVM 17
Diffstat (limited to 'src/build_settings.cpp')
| -rw-r--r-- | src/build_settings.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp index 79f6e8a2c..57dac0ca3 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; @@ -1738,6 +1747,13 @@ gb_internal bool init_build_paths(String init_filename) { return false; } + if (build_context.sanitizer_flags & SanitizerFlag_Memory) { + if (build_context.metrics.os != TargetOs_linux) { + gb_printf_err("-sanitize:memory is only supported on linux\n"); + return false; + } + } + if (bc->target_features_string.len != 0) { enable_target_feature({}, bc->target_features_string); |