diff --git a/scripts/native_simulator/common/src/include/nsi_hws_models_if.h b/scripts/native_simulator/common/src/include/nsi_hws_models_if.h index f7af34e5c5..77f28f42e6 100644 --- a/scripts/native_simulator/common/src/include/nsi_hws_models_if.h +++ b/scripts/native_simulator/common/src/include/nsi_hws_models_if.h @@ -35,7 +35,7 @@ struct nsi_hw_event_st { */ #define NSI_HW_EVENT(t, fn, prio) \ static const struct nsi_hw_event_st NSI_CONCAT(NSI_CONCAT(__nsi_hw_event_, fn), t) \ - __attribute__((__used__)) \ + __attribute__((__used__)) NSI_NOASAN \ __attribute__((__section__(".nsi_hw_event_" NSI_STRINGIFY(prio)))) \ = { \ .callback = fn, \ diff --git a/scripts/native_simulator/common/src/include/nsi_utils.h b/scripts/native_simulator/common/src/include/nsi_utils.h index 996ad63540..997eac3000 100644 --- a/scripts/native_simulator/common/src/include/nsi_utils.h +++ b/scripts/native_simulator/common/src/include/nsi_utils.h @@ -29,4 +29,14 @@ #define NSI_FUNC_NORETURN __attribute__((__noreturn__)) +#if defined(__clang__) + /* The address sanitizer in llvm adds padding (redzones) after data + * But for those we are re-grouping using the linker script + * we cannot have that extra padding as we intend to iterate over them + */ +#define NSI_NOASAN __attribute__((no_sanitize("address"))) +#else +#define NSI_NOASAN +#endif + #endif /* NSI_COMMON_SRC_INCL_NSI_UTILS_H */ diff --git a/scripts/native_simulator/common/src/nsi_tasks.h b/scripts/native_simulator/common/src/nsi_tasks.h index 5223ab08c0..584898bc5e 100644 --- a/scripts/native_simulator/common/src/nsi_tasks.h +++ b/scripts/native_simulator/common/src/nsi_tasks.h @@ -51,7 +51,7 @@ extern "C" { */ #define NSI_TASK(fn, level, prio) \ static void (* const NSI_CONCAT(__nsi_task_, fn))(void) \ - __attribute__((__used__)) \ + __attribute__((__used__)) NSI_NOASAN \ __attribute__((__section__(".nsi_" #level NSI_STRINGIFY(prio) "_task")))\ = fn; \ /* Let's cross-check the macro level is a valid one, so we don't silently drop it */ \