Bug #76654 [ReO]: Build failure on Mac OS X on 32-bit Intel
| From: | php-bugs-2018 at ryandesign dot com | Date: | Thu, 15 Nov 2018 07:12:01 +0000 |
| Subject: | Bug #76654 [ReO]: Build failure on Mac OS X on 32-bit Intel | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-217964@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76654&edit=1
ID: 76654
User updated by: php-bugs-2018 at ryandesign dot com
Reported by: php-bugs-2018 at ryandesign dot com
Summary: Build failure on Mac OS X on 32-bit Intel
Status: Re-Opened
Type: Bug
Package: Compile Failure
Operating System: Mac OS X 10.6.8
-PHP Version: 7.3.0alpha4
+PHP Version: 7.3.0RC5
Block user comment: N
Private report: N
New Comment:
I've attached a patch that compiles for me, on 32-bit Mac OS X 10.6.
What I've learned is that gcc 4.2 (at least the Apple-modified version
shipped in old Xcode) uses position-independent code (PIC) by default,
and that on i386 this compiler uses the %ebx register to store the PIC
global offset table, but the cpuid opcode overwrites %ebx, hence the
error. So %ebx needs to be preserved before calling cpuid and restored
afterward.
I've modeled my patch on the method used by cpuid.h from Xcode 5.1.1
on OS X 10.8, which is as follows:
/* PIC on i386 uses %ebx, so preserve it. */
#if __i386__
#define __cpuid(__level, __eax, __ebx, __ecx, __edx) \
__asm(" pushl %%ebx\n" \
" cpuid\n" \
" mov %%ebx,%1\n" \
" popl %%ebx" \
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx),
"=d"(__edx) \
: "0"(__level))
#define __cpuid_count(__level, __count, __eax, __ebx, __ecx, __edx) \
__asm(" pushl %%ebx\n" \
" cpuid\n" \
" mov %%ebx,%1\n" \
" popl %%ebx" \
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx),
"=d"(__edx) \
: "0"(__level), "2"(__count))
#else
#define __cpuid(__level, __eax, __ebx, __ecx, __edx) \
__asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx),
"=d"(__edx) \
: "0"(__level))
#define __cpuid_count(__level, __count, __eax, __ebx, __ecx, __edx) \
__asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx),
"=d"(__edx) \
: "0"(__level), "2"(__count))
#endif
It seems that cpuid.h is closely tied to and belongs with a
particular compiler. The cpuid.h from Xcode 9.4.1 on macOS 10.13 does
it differently, for example, but that's for a much more recent version
of clang. And since this code in PHP is only going to be used by
compilers that don't provide a cpuid.h, maybe using this old
implementation is the correct thing to do.
With my patch it compiles, but I don't know if the result is correct.
I don't know how this command is used within PHP. Is there a PHP
command I should run, or a particular test in the test suite that I
should look at, to verify it's working right?
Previous Comments:
------------------------------------------------------------------------
[2018-09-30 04:00:08] php-bugs-2018 at ryandesign dot com
Please reopen; the problem remains with 7.3.0RC2.
Here is a full build log of the failure on 10.6.8 i386:
https://build.macports.org/builders/ports-10.6_i386_legacy-builder/builds/49799/steps/install-port/logs/stdio
For comparison, here is a build log of success on 10.6.8 x86_64:
https://build.macports.org/builders/ports-10.6_x86_64_legacy-builder/builds/77655/steps/install-port/logs/stdio
And a build log of success on 10.5.8 ppc:
https://build.macports.org/builders/ports-10.5_ppc_legacy-builder/builds/75623/steps/install-port/logs/stdio
------------------------------------------------------------------------
[2018-08-26 17:02:12] cmb@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
------------------------------------------------------------------------
[2018-07-24 09:40:56] cmb@php.net
The PR has been merged; please try with a recent Git snapshot.
------------------------------------------------------------------------
[2018-07-23 09:41:06] cmb@php.net
See <https://github.com/php/php-src/pull/3395>.
------------------------------------------------------------------------
[2018-07-22 22:32:01] php-bugs-2018 at ryandesign dot com
Description:
------------
PHP 7.3.0alpha4 fails to build on Mac OS X 10.6.8 running on a Mac with a 32-bit Intel processor.
Here is a log from the MacPorts automated build system:
https://build.macports.org/builders/ports-10.6_i386_legacy-builder/builds/45941/steps/install-port/logs/stdio
The error is:
Zend/zend_cpuinfo.c: In function âzend_cpu_startupâ:
Zend/zend_cpuinfo.c:33: error: can't find a register in class âBREGâ while reloading
âasmâ
Zend/zend_cpuinfo.c:33: error: can't find a register in class âBREGâ while reloading
âasmâ
Zend/zend_cpuinfo.c:33: error: can't find a register in class âBREGâ while reloading
âasmâ
Zend/zend_cpuinfo.c:33: error: âasmâ operand has impossible constraints
Zend/zend_cpuinfo.c:33: error: âasmâ operand has impossible constraints
Zend/zend_cpuinfo.c:33: error: âasmâ operand has impossible constraints
{standard input}:27:non-relocatable subtraction expression, "_cpuinfo" minus
"L00000000001$pb"
{standard input}:27:symbol: "_cpuinfo" can't be undefined in a subtraction expression
{standard input}:21:non-relocatable subtraction expression, "_cpuinfo" minus
"L00000000001$pb"
{standard input}:21:symbol: "_cpuinfo" can't be undefined in a subtraction expression
{standard input}:13:non-relocatable subtraction expression, "_cpuinfo" minus
"L00000000001$pb"
{standard input}:13:symbol: "_cpuinfo" can't be undefined in a subtraction expression
make: *** [Zend/zend_cpuinfo.lo] Error 1
This is a regression; PHP 7.2 and earlier built fine on Macs with 32-bit Intel processors.
PHP 7.3.0alpha4 builds fine on Mac OS X 10.6.8 and later on a Mac with a 64-bit Intel processor, and
on Mac OS X 10.5.8 on a Mac with a 32-bit PowerPC processor.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76654&edit=1