com php-src: Add support for MemorySanitizer: Zend/zend_cpuin fo.h
| From: | Stanislav Malyshev | Date: | Thu, 07 Mar 2019 01:07:38 +0000 |
| Subject: | com php-src: Add support for MemorySanitizer: Zend/zend_cpuin fo.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105036@lists.php.net to get a copy of this message | ||
Commit: e5860474b78a113005429e9d353850e071e8e38a
Author: Stanislav Malyshev <stas@php.net> Wed, 6 Mar 2019 16:18:08 -0800
Parents: 29573269562345e1a7a11b2ef5650d1a71682a3a
Branches: PHP-7.4
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e5860474b78a113005429e9d353850e071e8e38a
Log:
Add support for MemorySanitizer
Changed paths:
M Zend/zend_cpuinfo.h
Diff:
diff --git a/Zend/zend_cpuinfo.h b/Zend/zend_cpuinfo.h
index 942f92c..87bc75c 100644
--- a/Zend/zend_cpuinfo.h
+++ b/Zend/zend_cpuinfo.h
@@ -100,11 +100,22 @@ typedef enum _zend_cpu_feature {
void zend_cpu_startup();
ZEND_API int zend_cpu_supports(zend_cpu_feature feature);
+#ifndef __has_attribute
+# define __has_attribute(x) 0
+#endif
+#ifndef __has_feature
+# define __has_feature(x) 0
+#endif
+
/* Address sanitizer is incompatible with ifunc resolvers, so exclude the
* CPU support helpers from asan.
* See also https://github.com/google/sanitizers/issues/342.
*/
#if __has_attribute(no_sanitize_address)
-# define ZEND_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
+# if __has_feature(memory_sanitizer)
+# define ZEND_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
__attribute__((no_sanitize("memory")))
+# else
+# define ZEND_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
+# endif
#else
# define ZEND_NO_SANITIZE_ADDRESS
#endif