mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Add attributes for sanitize_memory and sanitize_thread
This commit is contained in:
+30
-1
@@ -1747,11 +1747,40 @@ gb_internal bool init_build_paths(String init_filename) {
|
|||||||
return false;
|
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:memory is only supported on windows, linux, and darwin\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (build_context.sanitizer_flags & SanitizerFlag_Memory) {
|
if (build_context.sanitizer_flags & SanitizerFlag_Memory) {
|
||||||
if (build_context.metrics.os != TargetOs_linux) {
|
switch (build_context.metrics.os) {
|
||||||
|
case TargetOs_linux:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
gb_printf_err("-sanitize:memory is only supported on linux\n");
|
gb_printf_err("-sanitize:memory is only supported on linux\n");
|
||||||
return false;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -321,6 +321,12 @@ gb_internal lbProcedure *lb_create_procedure(lbModule *m, Entity *entity, bool i
|
|||||||
if (build_context.sanitizer_flags & SanitizerFlag_Address) {
|
if (build_context.sanitizer_flags & SanitizerFlag_Address) {
|
||||||
lb_add_attribute_to_proc(m, p->value, "sanitize_address");
|
lb_add_attribute_to_proc(m, p->value, "sanitize_address");
|
||||||
}
|
}
|
||||||
|
if (build_context.sanitizer_flags & SanitizerFlag_Memory) {
|
||||||
|
lb_add_attribute_to_proc(m, p->value, "sanitize_memory");
|
||||||
|
}
|
||||||
|
if (build_context.sanitizer_flags & SanitizerFlag_Thread) {
|
||||||
|
lb_add_attribute_to_proc(m, p->value, "sanitize_thread");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lbValue proc_value = {p->value, p->type};
|
lbValue proc_value = {p->value, p->type};
|
||||||
|
|||||||
Reference in New Issue
Block a user