mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-10 13:21:37 -07:00
Merge pull request #5286 from Feoramund/no-san-mem
Add `@(no_sanitize_memory)` with additions to `base:sanitizer`
This commit is contained in:
@@ -1370,6 +1370,7 @@ gb_internal void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
|
||||
e->Procedure.has_instrumentation = has_instrumentation;
|
||||
|
||||
e->Procedure.no_sanitize_address = ac.no_sanitize_address;
|
||||
e->Procedure.no_sanitize_memory = ac.no_sanitize_memory;
|
||||
|
||||
e->deprecated_message = ac.deprecated_message;
|
||||
e->warning_message = ac.warning_message;
|
||||
|
||||
@@ -3776,6 +3776,12 @@ gb_internal DECL_ATTRIBUTE_PROC(proc_decl_attribute) {
|
||||
}
|
||||
ac->no_sanitize_address = true;
|
||||
return true;
|
||||
} else if (name == "no_sanitize_memory") {
|
||||
if (value != nullptr) {
|
||||
error(value, "'%.*s' expects no parameter", LIT(name));
|
||||
}
|
||||
ac->no_sanitize_memory = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -140,6 +140,7 @@ struct AttributeContext {
|
||||
bool instrumentation_enter : 1;
|
||||
bool instrumentation_exit : 1;
|
||||
bool no_sanitize_address : 1;
|
||||
bool no_sanitize_memory : 1;
|
||||
bool rodata : 1;
|
||||
bool ignore_duplicates : 1;
|
||||
u32 optimization_mode; // ProcedureOptimizationMode
|
||||
|
||||
@@ -263,6 +263,7 @@ struct Entity {
|
||||
bool uses_branch_location : 1;
|
||||
bool is_anonymous : 1;
|
||||
bool no_sanitize_address : 1;
|
||||
bool no_sanitize_memory : 1;
|
||||
} Procedure;
|
||||
struct {
|
||||
Array<Entity *> entities;
|
||||
|
||||
@@ -345,7 +345,7 @@ gb_internal lbProcedure *lb_create_procedure(lbModule *m, Entity *entity, bool i
|
||||
if (build_context.sanitizer_flags & SanitizerFlag_Address && !entity->Procedure.no_sanitize_address) {
|
||||
lb_add_attribute_to_proc(m, p->value, "sanitize_address");
|
||||
}
|
||||
if (build_context.sanitizer_flags & SanitizerFlag_Memory) {
|
||||
if (build_context.sanitizer_flags & SanitizerFlag_Memory && !entity->Procedure.no_sanitize_memory) {
|
||||
lb_add_attribute_to_proc(m, p->value, "sanitize_memory");
|
||||
}
|
||||
if (build_context.sanitizer_flags & SanitizerFlag_Thread) {
|
||||
|
||||
Reference in New Issue
Block a user