@@ -100,54 +100,70 @@ typedef enum _zend_cpu_feature {
100
100
void zend_cpu_startup ();
101
101
ZEND_API int zend_cpu_supports (zend_cpu_feature feature );
102
102
103
+ /* Address sanitizer is incompatible with ifunc resolvers, so exclude the
104
+ * CPU support helpers from asan.
105
+ * See also https://github.com/google/sanitizers/issues/342. */
106
+ #if __has_attribute (no_sanitize_address )
107
+ # define ZEND_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
108
+ #else
109
+ # define ZEND_NO_SANITIZE_ADDRESS
110
+ #endif
111
+
103
112
#if PHP_HAVE_BUILTIN_CPU_SUPPORTS
104
113
/* NOTE: you should use following inline function in
105
114
* resolver functions (ifunc), as it could be called
106
115
* before all PLT symbols are resloved. in other words,
107
116
* resolver functions should not depends any external
108
117
* functions */
118
+ ZEND_NO_SANITIZE_ADDRESS
109
119
static zend_always_inline int zend_cpu_supports_sse2 () {
110
120
#if PHP_HAVE_BUILTIN_CPU_INIT
111
121
__builtin_cpu_init ();
112
122
#endif
113
123
return __builtin_cpu_supports ("sse2" );
114
124
}
115
125
126
+ ZEND_NO_SANITIZE_ADDRESS
116
127
static zend_always_inline int zend_cpu_supports_sse3 () {
117
128
#if PHP_HAVE_BUILTIN_CPU_INIT
118
129
__builtin_cpu_init ();
119
130
#endif
120
131
return __builtin_cpu_supports ("sse3" );
121
132
}
122
133
134
+ ZEND_NO_SANITIZE_ADDRESS
123
135
static zend_always_inline int zend_cpu_supports_ssse3 () {
124
136
#if PHP_HAVE_BUILTIN_CPU_INIT
125
137
__builtin_cpu_init ();
126
138
#endif
127
139
return __builtin_cpu_supports ("ssse3" );
128
140
}
129
141
142
+ ZEND_NO_SANITIZE_ADDRESS
130
143
static zend_always_inline int zend_cpu_supports_sse41 () {
131
144
#if PHP_HAVE_BUILTIN_CPU_INIT
132
145
__builtin_cpu_init ();
133
146
#endif
134
147
return __builtin_cpu_supports ("sse4.1" );
135
148
}
136
149
150
+ ZEND_NO_SANITIZE_ADDRESS
137
151
static zend_always_inline int zend_cpu_supports_sse42 () {
138
152
#if PHP_HAVE_BUILTIN_CPU_INIT
139
153
__builtin_cpu_init ();
140
154
#endif
141
155
return __builtin_cpu_supports ("sse4.2" );
142
156
}
143
157
158
+ ZEND_NO_SANITIZE_ADDRESS
144
159
static zend_always_inline int zend_cpu_supports_avx () {
145
160
#if PHP_HAVE_BUILTIN_CPU_INIT
146
161
__builtin_cpu_init ();
147
162
#endif
148
163
return __builtin_cpu_supports ("avx" );
149
164
}
150
165
166
+ ZEND_NO_SANITIZE_ADDRESS
151
167
static zend_always_inline int zend_cpu_supports_avx2 () {
152
168
#if PHP_HAVE_BUILTIN_CPU_INIT
153
169
__builtin_cpu_init ();
0 commit comments