Add sanitize_address attribute to all normal packages

This commit is contained in:
gingerBill
2023-09-21 11:13:26 +01:00
parent 735bb147e2
commit 38d2a0ddb9
4 changed files with 10 additions and 6 deletions
+6 -1
View File
@@ -152,7 +152,6 @@ gb_internal lbProcedure *lb_create_procedure(lbModule *m, Entity *entity, bool i
lb_add_attribute_to_proc(m, p->value, "noredzone");
}
switch (p->inlining) {
case ProcInlining_inline:
lb_add_attribute_to_proc(m, p->value, "alwaysinline");
@@ -318,6 +317,12 @@ gb_internal lbProcedure *lb_create_procedure(lbModule *m, Entity *entity, bool i
}
}
if (p->body && entity->pkg && (entity->pkg->kind == Package_Normal) || (entity->pkg->kind == Package_Init)) {
if (build_context.sanitizer_flags & SanitizerFlag_Address) {
lb_add_attribute_to_proc(m, p->value, "sanitize_address");
}
}
lbValue proc_value = {p->value, p->type};
lb_add_entity(m, entity, proc_value);
lb_add_member(m, p->name, proc_value);