mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
If the target attribute is available, attach it explicitly
The ifunc attribute might be not available as it is binary format dependent.
This commit is contained in:
parent
1624b0a91f
commit
a06cde8236
3 changed files with 22 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -178,3 +178,8 @@
|
|||
#define HAVE_FTOK 1
|
||||
|
||||
#define HAVE_NICE
|
||||
|
||||
#ifdef __clang__
|
||||
#define HAVE_FUNC_ATTRIBUTE_TARGET 1
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue