Skip to content

Commit 7625f97

Browse files
committed
Fix #76825: Undefined symbols ___cpuid_count
Apparently, the presence of `cpuid.h` is not necessarily sufficient to guarantee the availability of `__cpuid_count()`. We therefore test for the latter explicitly.
1 parent d784797 commit 7625f97

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

NEWS

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ PHP NEWS
33
?? ??? ????, PHP 7.3.0RC5
44

55
- Core:
6+
. Fixed bug #76825 (Undefined symbols ___cpuid_count). (Laruence, cmb)
67
. Fixed bug #77110 (undefined symbol zend_string_equal_val in C++ build).
78
(Remi)
89

@@ -139,7 +140,6 @@ PHP NEWS
139140
13 Sep 2018, PHP 7.3.0RC1
140141

141142
- Core:
142-
. Fixed bug #76825 (Undefined symbols ___cpuid_count). (Laruence)
143143
. Fixed bug #76820 (Z_COPYABLE invalid definition). (mvdwerve, cmb)
144144
. Fixed bug #76510 (file_exists() stopped working for phar://). (cmb)
145145

Zend/Zend.m4

+18
Original file line numberDiff line numberDiff line change
@@ -596,3 +596,21 @@ dnl This is the most probable fallback so we assume yes in case of cross compile
596596
if test "$ac_cv_huge_val_nan" = "yes"; then
597597
AC_DEFINE([HAVE_HUGE_VAL_NAN], 1, [whether HUGE_VAL + -HUGEVAL == NAN])
598598
fi
599+
600+
dnl
601+
dnl Check whether __cpuid_count is available
602+
dnl
603+
AC_CACHE_CHECK(whether __cpuid_count is available, ac_cv_cpuid_count_available, [
604+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
605+
#include <cpuid.h>
606+
]], [[
607+
unsigned eax, ebx, ecx, edx;
608+
__cpuid_count(0, 0, eax, ebx, ecx, edx);
609+
]])], [
610+
ac_cv_cpuid_count_available=yes
611+
], [
612+
ac_cv_cpuid_count_available=no
613+
])])
614+
if test "$ac_cv_cpuid_count_available" = "yes"; then
615+
AC_DEFINE([HAVE_CPUID_COUNT], 1, [whether __cpuid_count is available])
616+
fi

Zend/zend_cpuinfo.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ typedef struct _zend_cpu_info {
2929
static zend_cpu_info cpuinfo = {0};
3030

3131
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
32-
# ifdef HAVE_CPUID_H
32+
# if defined(HAVE_CPUID_H) && defined(HAVE_CPUID_COUNT)
3333
# include <cpuid.h>
3434
static void __zend_cpuid(uint32_t func, uint32_t subfunc, zend_cpu_info *cpuinfo) {
3535
__cpuid_count(func, subfunc, cpuinfo->eax, cpuinfo->ebx, cpuinfo->ecx, cpuinfo->edx);

0 commit comments

Comments
 (0)