From 1fcc245edae4159e686a39e3a19d1d87f6aa5378 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 10 Apr 2024 14:17:17 +0200 Subject: [PATCH] native_simulator: Get latest from upstream Align with native_simulator's upstream main 6f6b359c4fe26ddeed8a65ad55f5bc402d3b7f91 Which includes: * 6f6b359 Avoid issue with llvm address sanitizer Signed-off-by: Alberto Escolar Piedras --- .../common/src/include/nsi_hws_models_if.h | 2 +- .../native_simulator/common/src/include/nsi_utils.h | 10 ++++++++++ scripts/native_simulator/common/src/nsi_tasks.h | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) 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 */ \