1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-27 15:31:17 +01:00

core/xfa: disable asan on llvm

This commit is contained in:
Teufelchen1 2023-02-13 16:26:06 +01:00
parent fcf63cf5e3
commit a8c9af901c
2 changed files with 21 additions and 4 deletions

View File

@ -68,6 +68,20 @@ extern "C" {
#endif
#endif
/**
* @def NO_SANITIZE_ARRAY
* @brief Tell the compiler that this array should be ignored during sanitizing.
* @details In special cases, e.g. XFA, the address sanitizer might interfere
* in a way that breaks the application. Use this macro to disable
* address sanitizing for a given variable. Currently only utilised
* by llvm.
*/
#if defined(__llvm__) || defined(__clang__)
#define NO_SANITIZE_ARRAY __attribute__((no_sanitize("address")))
#else
#define NO_SANITIZE_ARRAY
#endif
/**
* @def UNREACHABLE()
* @brief Tell the compiler that this line of code cannot be reached.

View File

@ -26,6 +26,7 @@
#define XFA_H
#include <inttypes.h>
#include "compiler_hints.h"
/*
* Unfortunately, current gcc trips over accessing XFA's because of their
@ -42,16 +43,18 @@ _Pragma("GCC diagnostic ignored \"-Warray-bounds\"")
*
* @internal
*/
#define _XFA(name, prio) __attribute__((used, section(".xfa." #name "." #prio)))
#define _XFA(name, prio) \
NO_SANITIZE_ARRAY \
__attribute__((used, section(".xfa." #name "." #prio)))
/**
* @brief helper macro for other XFA_* macros
*
* @internal
*/
#define _XFA_CONST(name, \
prio) __attribute__((used, \
section(".roxfa." #name "." #prio)))
#define _XFA_CONST(name, prio) \
NO_SANITIZE_ARRAY \
__attribute__((used, section(".roxfa." #name "." #prio)))
/**
* @brief Define a read-only cross-file array