aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vlib/unix/plugin.h2
-rw-r--r--src/vppinfra/sanitizer.h12
2 files changed, 13 insertions, 1 deletions
diff --git a/src/vlib/unix/plugin.h b/src/vlib/unix/plugin.h
index a52c57bef7b..c9a33ccd96a 100644
--- a/src/vlib/unix/plugin.h
+++ b/src/vlib/unix/plugin.h
@@ -122,7 +122,7 @@ u8 *vlib_get_vat_plugin_path (void);
#define VLIB_PLUGIN_REGISTER() \
vlib_plugin_registration_t vlib_plugin_registration \
- CLIB_NOSANITIZE_ADDR \
+ CLIB_NOSANITIZE_PLUGIN_REG_SECTION \
__attribute__((__section__(".vlib_plugin_registration")))
/* Call a plugin init function: used for init function dependencies. */
diff --git a/src/vppinfra/sanitizer.h b/src/vppinfra/sanitizer.h
index d099d3a941f..db4daea978d 100644
--- a/src/vppinfra/sanitizer.h
+++ b/src/vppinfra/sanitizer.h
@@ -51,6 +51,18 @@ CLIB_MEM_POISON_LEN (void *src, size_t oldlen, size_t newlen)
#endif /* CLIB_SANITIZE_ADDR */
+/*
+ * clang tends to force alignment of all sections when compiling for address
+ * sanitizer. This confuse VPP plugin infra, prevent clang to do that
+ * On the contrary, GCC does not support this kind of attribute on sections
+ * sigh.
+ */
+#ifdef __clang__
+#define CLIB_NOSANITIZE_PLUGIN_REG_SECTION CLIB_NOSANITIZE_ADDR
+#else
+#define CLIB_NOSANITIZE_PLUGIN_REG_SECTION
+#endif
+
#endif /* _included_clib_sanitizer_h */
/*