Support -sanitize:<string> for address, memory, thread for LLVM 17

This commit is contained in:
gingerBill
2023-09-21 09:40:33 +01:00
parent f0ab58dfbb
commit 2160484b62
3 changed files with 52 additions and 1 deletions
+16
View File
@@ -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);