From 61e59db99d29cd028336b66884b3a8e69b46cf71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Thu, 16 Feb 2017 08:57:30 +0100 Subject: Disable RTLD_DEEPBIND when compiling with AddressSanitizer (-fsanitize=address). The AddressSanitizer doesn't support RTLD_DEEPBIND resulting in erratic errors when deinitializing phar module and possibly others. Clang use __has_feature() macro to indicate compilation with AddressSanitizer while gcc uses __SANITIZE_ADDRESS__ define. Fixes bug #73677. --- Zend/zend_portability.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Zend/zend_portability.h') diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index cce55b71b2..9914621a49 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -131,6 +131,12 @@ #if defined(HAVE_LIBDL) && !defined(ZEND_WIN32) +# if defined(__has_feature) +# if __has_feature(address_sanitizer) +# define __SANITIZE_ADDRESS__ +# endif +# endif + # ifndef RTLD_LAZY # define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */ # endif @@ -141,7 +147,7 @@ # if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT) # define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT) -# elif defined(RTLD_DEEPBIND) +# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__) # define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_DEEPBIND) # else # define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL) -- cgit v1.2.1