From 80a83a8f6aebd4c5f0d2a21bfbfe5d7cffd1fc9b Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 25 Jan 2024 01:51:49 -0500 Subject: [PATCH] sanitizer: fix feature tests under clang While gcc defines __SANITIZE_ADDRESS__, clang requires more verbose tests. Add them to make the cleanup/security logic work correctly. Signed-off-by: Mike Frysinger --- porting.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/porting.h b/porting.h index 103d268..6c0da01 100644 --- a/porting.h +++ b/porting.h @@ -74,6 +74,13 @@ #endif #undef PAX_UTILS_CLEANUP +#ifndef __SANITIZE_ADDRESS__ +# ifdef __has_feature +# if __has_feature (address_sanitizer) +# define __SANITIZE_ADDRESS__ 1 +# endif +# endif +#endif /* LSAN (Leak Sanitizer) will complain about things we leak. */ #ifdef __SANITIZE_ADDRESS__ # define PAX_UTILS_CLEANUP 1