diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index 4906c2947cc5..1c600e3c91d5 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -586,8 +586,8 @@ extern "C++" { /* Memory sanitizer is incompatible with ifunc resolvers. Even if the resolver * is marked as no_sanitize("memory") it will still be instrumented and crash. */ -#if __has_feature(memory_sanitizer) || __has_feature(thread_sanitizer) || \ - __has_feature(dataflow_sanitizer) +#if defined(PHP_DISABLE_IFUNC) || __has_feature(memory_sanitizer) || \ + __has_feature(thread_sanitizer) || __has_feature(dataflow_sanitizer) # undef HAVE_FUNC_ATTRIBUTE_IFUNC #endif diff --git a/configure.ac b/configure.ac index b5dcf0da17f8..5f9334f0b5a5 100644 --- a/configure.ac +++ b/configure.ac @@ -296,6 +296,10 @@ AS_VAR_IF([PHP_BINARIES],, dnl Exit early. AS_VAR_IF([PHP_INSTALLED_SAPIS],, [AC_MSG_ERROR([Nothing to build.])]) +AS_VAR_IF([php_tsrm_dlopened_sapi], [yes], [ + AC_DEFINE([PHP_DISABLE_IFUNC], [1], [Define to disable IFUNC resolvers.]) +]) + dnl Add POSIX threads compilation and linker flags when thread safety is enabled dnl with either the '--enable-zts' configure option or automatically enabled by dnl PHP SAPIs. For example, Apache SAPI.