]> granicus.if.org Git - php/commitdiff
If the target attribute is available, attach it explicitly
authorAnatol Belski <ab@php.net>
Sat, 3 Feb 2018 16:15:18 +0000 (17:15 +0100)
committerAnatol Belski <ab@php.net>
Sat, 3 Feb 2018 16:18:41 +0000 (17:18 +0100)
The ifunc attribute might be not available as it is binary format
dependent.

Zend/zend_portability.h
ext/standard/string.c
win32/build/config.w32.h.in

index 89f3020a31a040c3cdef6cfaf19e641c2a5528ec..bd3e23edfe85ee89bfb212ecbb1a4cd0b90a08e0 100644 (file)
@@ -514,6 +514,8 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
 # endif
 #endif
 
+/* Intrinsics macros start. */
+
 #if defined(HAVE_FUNC_ATTRIBUTE_IFUNC) && defined(HAVE_FUNC_ATTRIBUTE_TARGET)
 # define ZEND_INTRIN_HAVE_IFUNC_TARGET 1
 #endif
@@ -532,6 +534,18 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
 # define ZEND_INTRIN_SSE4_2_FUNC_PTR 1
 #endif
 
+#if ZEND_INTRIN_SSE4_2_RESOLVER
+# if defined(HAVE_FUNC_ATTRIBUTE_TARGET)
+#  define ZEND_INTRIN_SSE4_2_FUNC_DECL(func) ZEND_API func __attribute__((target("sse4.2")))
+# else
+#  define ZEND_INTRIN_SSE4_2_FUNC_DECL(func) func
+# endif
+#else
+# define ZEND_INTRIN_SSE4_2_FUNC_DECL(func)
+#endif
+
+/* Intrinsics macros end. */
+
 #ifdef ZEND_WIN32
 # define ZEND_SET_ALIGNED(alignment, decl) __declspec(align(alignment)) decl
 #elif HAVE_ATTRIBUTE_ALIGNED
index 02f78a4f0e072b09cffa757217ce70d26e74b461..ad75a77f9324ff92d77cc905ca4f6cad3ac9c762 100644 (file)
@@ -3866,10 +3866,11 @@ PHPAPI zend_string *php_addcslashes(zend_string *str, int should_free, char *wha
 # include "Zend/zend_bitset.h"
 # include "Zend/zend_cpuinfo.h"
 
+ZEND_INTRIN_SSE4_2_FUNC_DECL(zend_string *php_addslashes_sse42(zend_string *str, int should_free));
+zend_string *php_addslashes_default(zend_string *str, int should_free);
+
 # if ZEND_INTRIN_SSE4_2_FUNC_PROTO
 PHPAPI zend_string *php_addslashes(zend_string *str, int should_free) __attribute__((ifunc("resolve_addslashes")));
-zend_string *php_addslashes_sse42(zend_string *str, int should_free) __attribute__((target("sse4.2")));
-zend_string *php_addslashes_default(zend_string *str, int should_free);
 
 static void *resolve_addslashes() {
        if (zend_cpu_supports(ZEND_CPU_FEATURE_SSE42)) {
@@ -3878,8 +3879,6 @@ static void *resolve_addslashes() {
        return  php_addslashes_default;
 }
 # else /* ZEND_INTRIN_SSE4_2_FUNC_PTR */
-zend_string *php_addslashes_sse42(zend_string *str, int should_free);
-zend_string *php_addslashes_default(zend_string *str, int should_free);
 
 PHPAPI zend_string *(*php_addslashes)(zend_string *str, int should_free) = NULL;
 
index 9572f65d82170f62b00ecf7e8055a663c193a937..ab010f4cb564253e420faa50d56fa0395ccde8a8 100644 (file)
 #define HAVE_FTOK 1
 
 #define HAVE_NICE
+
+#ifdef __clang__
+#define HAVE_FUNC_ATTRIBUTE_TARGET 1
+#endif
+