build: sanitizers for gcc

GCC also supports sanitizers. GCC doesn't support -fsanitize-blacklist
option though, so replace .asan-blacklist file with no_sanitize_address
function attributes instead.
This commit is contained in:
ii14
2023-03-16 18:13:58 +01:00
parent 995196c614
commit 5bad9afed2
7 changed files with 25 additions and 8 deletions

View File

@@ -99,6 +99,10 @@
# undef FUNC_ATTR_NO_SANITIZE_UNDEFINED
#endif
#ifdef FUNC_ATTR_NO_SANITIZE_ADDRESS
# undef FUNC_ATTR_NO_SANITIZE_ADDRESS
#endif
#ifdef FUNC_ATTR_PRINTF
# undef FUNC_ATTR_PRINTF
#endif
@@ -139,6 +143,11 @@
# define REAL_FATTR_NO_SANITIZE_UNDEFINED \
__attribute__((no_sanitize("undefined")))
# endif
# if NVIM_HAS_ATTRIBUTE(no_sanitize_address)
# define REAL_FATTR_NO_SANITIZE_ADDRESS \
__attribute__((no_sanitize_address))
# endif
# endif
// Define attributes that are not defined for this compiler.
@@ -199,6 +208,10 @@
# define REAL_FATTR_NO_SANITIZE_UNDEFINED
# endif
# ifndef REAL_FATTR_NO_SANITIZE_ADDRESS
# define REAL_FATTR_NO_SANITIZE_ADDRESS
# endif
# ifndef REAL_FATTR_PRINTF
# define REAL_FATTR_PRINTF(x, y)
# endif
@@ -233,6 +246,7 @@
# define FUNC_ATTR_NONNULL_RET REAL_FATTR_NONNULL_RET
# define FUNC_ATTR_NORETURN REAL_FATTR_NORETURN
# define FUNC_ATTR_NO_SANITIZE_UNDEFINED REAL_FATTR_NO_SANITIZE_UNDEFINED
# define FUNC_ATTR_NO_SANITIZE_ADDRESS REAL_FATTR_NO_SANITIZE_ADDRESS
# define FUNC_ATTR_PRINTF(x, y) REAL_FATTR_PRINTF(x, y)
#elif !defined(DO_NOT_DEFINE_EMPTY_ATTRIBUTES)
# define FUNC_ATTR_MALLOC
@@ -249,5 +263,6 @@
# define FUNC_ATTR_NONNULL_RET
# define FUNC_ATTR_NORETURN
# define FUNC_ATTR_NO_SANITIZE_UNDEFINED
# define FUNC_ATTR_NO_SANITIZE_ADDRESS
# define FUNC_ATTR_PRINTF(x, y)
#endif