Skip to content

Commit 7bc162f

Browse files
committed
Work around compiler flag dependent ABI
1 parent a899483 commit 7bc162f

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Zend/zend_portability.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
577577
# define ZEND_INTRIN_SSSE3_FUNC_DECL(func)
578578
#endif
579579

580-
#ifdef __SSE4_2__
580+
#if defined(HAVE_SSE4_2_DEF) || (defined(ZEND_WIN32) && defined(__SSE4_2__))
581581
/* Instructions compiled directly. */
582582
# define ZEND_INTRIN_SSE4_2_NATIVE 1
583583
#elif (defined(HAVE_FUNC_ATTRIBUTE_TARGET) && defined(PHP_HAVE_SSE4_2)) || defined(ZEND_WIN32)

configure.ac

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,24 @@ PHP_CHECK_CPU_SUPPORTS([sse4.2])
565565
PHP_CHECK_CPU_SUPPORTS([avx])
566566
PHP_CHECK_CPU_SUPPORTS([avx2])
567567

568+
dnl The ABI of php_addslashes in PHP 7.3 is dependent on __SSE4_2__,
569+
dnl which depends on target attributes. Use this check to make sure that
570+
dnl SSE 4.2 availability during the PHP compilation is used, independently
571+
dnl of whether extensions are compiled with SSE 4.2 support.
572+
AC_MSG_CHECKING([whether __SSE4_2__ is defined])
573+
AC_RUN_IFELSE([AC_LANG_SOURCE([[
574+
int main() {
575+
#if defined(__SSE4_2__)
576+
return 0;
577+
#else
578+
return 1;
579+
#endif
580+
}
581+
]])], [
582+
AC_MSG_RESULT([yes])
583+
AC_DEFINE(HAVE_SSE4_2_DEF, 1, [Define if __SSE4_2__ has been defined])
584+
], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([no])])
585+
568586
dnl Check for members of the stat structure
569587
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
570588
dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exist

0 commit comments

Comments
 (0)