Skip to content

Commit 59424bb

Browse files
committed
Fixed bug #71006 (symbol referencing errors on Sparc/Solaris)
1 parent 2fabcbf commit 59424bb

File tree

5 files changed

+67
-6
lines changed

5 files changed

+67
-6
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ PHP NEWS
33
?? ??? 2015, PHP 7.0.1
44

55
- Core:
6+
. Fixed bug #71006 (symbol referencing errors on Sparc/Solaris). (Dmitry)
67
. Fixed bug #70997 (When using parentClass:: instead of parent::, static
78
context changed). (Dmitry)
89
. Fixed bug #70970 (Segfault when combining error handler with output

Zend/zend_alloc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,9 @@ static void zend_mm_munmap(void *addr, size_t size)
506506
/* number of trailing set (1) bits */
507507
static zend_always_inline int zend_mm_bitset_nts(zend_mm_bitset bitset)
508508
{
509-
#if (defined(__GNUC__) || __has_builtin(__builtin_ctzl)) && SIZEOF_ZEND_LONG == SIZEOF_LONG
509+
#if (defined(__GNUC__) || __has_builtin(__builtin_ctzl)) && SIZEOF_ZEND_LONG == SIZEOF_LONG && defined(PHP_HAVE_BUILTIN_CTZL)
510510
return __builtin_ctzl(~bitset);
511-
#elif defined(__GNUC__) || __has_builtin(__builtin_ctzll)
511+
#elif (defined(__GNUC__) || __has_builtin(__builtin_ctzll)) && defined(PHP_HAVE_BUILTIN_CTZLL)
512512
return __builtin_ctzll(~bitset);
513513
#elif defined(_WIN32)
514514
unsigned long index;
@@ -545,9 +545,9 @@ static zend_always_inline int zend_mm_bitset_nts(zend_mm_bitset bitset)
545545
/* number of trailing zero bits (0x01 -> 1; 0x40 -> 6; 0x00 -> LEN) */
546546
static zend_always_inline int zend_mm_bitset_ntz(zend_mm_bitset bitset)
547547
{
548-
#if (defined(__GNUC__) || __has_builtin(__builtin_ctzl)) && SIZEOF_ZEND_LONG == SIZEOF_LONG
548+
#if (defined(__GNUC__) || __has_builtin(__builtin_ctzl)) && SIZEOF_ZEND_LONG == SIZEOF_LONG && defined(PHP_HAVE_BUILTIN_CTZL)
549549
return __builtin_ctzl(bitset);
550-
#elif defined(__GNUC__) || __has_builtin(__builtin_ctzll)
550+
#elif (defined(__GNUC__) || __has_builtin(__builtin_ctzll)) && defined(PHP_HAVE_BUILTIN_CTZLL)
551551
return __builtin_ctzll(bitset);
552552
#elif defined(_WIN32)
553553
unsigned long index;
@@ -1161,7 +1161,7 @@ static zend_always_inline void zend_mm_free_large(zend_mm_heap *heap, zend_mm_ch
11611161
/* higher set bit number (0->N/A, 1->1, 2->2, 4->3, 8->4, 127->7, 128->8 etc) */
11621162
static zend_always_inline int zend_mm_small_size_to_bit(int size)
11631163
{
1164-
#if defined(__GNUC__) || __has_builtin(__builtin_clz)
1164+
#if (defined(__GNUC__) || __has_builtin(__builtin_clz)) && defined(PHP_HAVE_BUILTIN_CLZ)
11651165
return (__builtin_clz(size) ^ 0x1f) + 1;
11661166
#elif defined(_WIN32)
11671167
unsigned long index;

Zend/zend_hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static uint32_t zend_always_inline zend_hash_check_size(uint32_t nSize)
112112
rather than using an undefined bis scan result. */
113113
return nSize;
114114
}
115-
#elif defined(__GNUC__) || __has_builtin(__builtin_clz)
115+
#elif (defined(__GNUC__) || __has_builtin(__builtin_clz)) && defined(PHP_HAVE_BUILTIN_CLZ)
116116
return 0x2 << (__builtin_clz(nSize - 1) ^ 0x1f);
117117
#else
118118
nSize -= 1;

acinclude.m4

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3050,3 +3050,57 @@ AC_DEFUN([PHP_CHECK_BUILTIN_EXPECT], [
30503050
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_EXPECT], [$have_builtin_expect], [Whether the compiler supports __builtin_expect])
30513051
30523052
])
3053+
3054+
dnl PHP_CHECK_BUILTIN_CLZ
3055+
AC_DEFUN([PHP_CHECK_BUILTIN_CLZ], [
3056+
AC_MSG_CHECKING([for __builtin_clz])
3057+
3058+
AC_TRY_LINK(, [
3059+
return __builtin_clz(1) ? 1 : 0;
3060+
], [
3061+
have_builtin_clz=1
3062+
AC_MSG_RESULT([yes])
3063+
], [
3064+
have_builtin_clz=0
3065+
AC_MSG_RESULT([no])
3066+
])
3067+
3068+
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CLZ], [$have_builtin_clz], [Whether the compiler supports __builtin_clz])
3069+
3070+
])
3071+
3072+
dnl PHP_CHECK_BUILTIN_CTZL
3073+
AC_DEFUN([PHP_CHECK_BUILTIN_CTZL], [
3074+
AC_MSG_CHECKING([for __builtin_ctzl])
3075+
3076+
AC_TRY_LINK(, [
3077+
return __builtin_ctzl(2L) ? 1 : 0;
3078+
], [
3079+
have_builtin_ctzl=1
3080+
AC_MSG_RESULT([yes])
3081+
], [
3082+
have_builtin_ctzl=0
3083+
AC_MSG_RESULT([no])
3084+
])
3085+
3086+
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CTZL], [$have_builtin_ctzl], [Whether the compiler supports __builtin_ctzl])
3087+
3088+
])
3089+
3090+
dnl PHP_CHECK_BUILTIN_CTZLL
3091+
AC_DEFUN([PHP_CHECK_BUILTIN_CTZLL], [
3092+
AC_MSG_CHECKING([for __builtin_ctzll])
3093+
3094+
AC_TRY_LINK(, [
3095+
return __builtin_ctzll(2LL) ? 1 : 0;
3096+
], [
3097+
have_builtin_ctzll=1
3098+
AC_MSG_RESULT([yes])
3099+
], [
3100+
have_builtin_ctzll=0
3101+
AC_MSG_RESULT([no])
3102+
])
3103+
3104+
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CTZLL], [$have_builtin_ctzll], [Whether the compiler supports __builtin_ctzll])
3105+
3106+
])

configure.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,12 @@ PHP_CHECK_STDINT_TYPES
577577

578578
dnl Check __builtin_expect
579579
PHP_CHECK_BUILTIN_EXPECT
580+
dnl Check __builtin_clz
581+
PHP_CHECK_BUILTIN_CLZ
582+
dnl Check __builtin_ctzl
583+
PHP_CHECK_BUILTIN_CTZL
584+
dnl Check __builtin_ctzll
585+
PHP_CHECK_BUILTIN_CTZLL
580586

581587
dnl Check for members of the stat structure
582588
AC_STRUCT_ST_BLKSIZE

0 commit comments

Comments
 (0)