aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/clib.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-04-05 12:40:31 +0200
committerBeno�t Ganne <bganne@cisco.com>2022-04-05 14:46:15 +0000
commit79934e855fc58aefde498cd0564796cdd6ccbc59 (patch)
treedb3c5a33e1146915572160c33f2a0a8c9cbd18cd /src/vppinfra/clib.h
parent0c740a6d8a6c11b1af4ce704220c2c46628f0a89 (diff)
vppinfra: refactor address sanitizer
Type: refactor Change-Id: I5ca142ec1557d5b5c3806b43553ad9d3b5ea1112 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/clib.h')
-rw-r--r--src/vppinfra/clib.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vppinfra/clib.h b/src/vppinfra/clib.h
index 8d1674945dd..2db611d969b 100644
--- a/src/vppinfra/clib.h
+++ b/src/vppinfra/clib.h
@@ -95,6 +95,15 @@
/* Make a string from the macro's argument */
#define CLIB_STRING_MACRO(x) #x
+/* sanitizers */
+#ifdef __has_feature
+#if __has_feature(address_sanitizer)
+#define CLIB_SANITIZE_ADDR 1
+#endif
+#elif defined(__SANITIZE_ADDRESS__)
+#define CLIB_SANITIZE_ADDR 1
+#endif
+
#define __clib_unused __attribute__ ((unused))
#define __clib_weak __attribute__ ((weak))
#define __clib_packed __attribute__ ((packed))
@@ -117,6 +126,12 @@
__attribute__ ((optimize ("no-optimize-sibling-calls")))
#endif
+#ifdef CLIB_SANITIZE_ADDR
+#define __clib_nosanitize_addr __attribute__ ((no_sanitize_address))
+#else
+#define __clib_nosanitize_addr
+#endif
+
#define never_inline __attribute__ ((__noinline__))
#if CLIB_DEBUG > 0