Skip to content

Commit 43a2dc4

Browse files
committed
An attempt to fix phpGH-12596: Segmentation fault on AArch64 release build with opcache.jit=1112
1 parent d41ee53 commit 43a2dc4

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

Zend/zend_vm_execute.h

Lines changed: 8 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Zend/zend_vm_execute.skl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@ ZEND_API void {%EXECUTOR_NAME%}_ex(zend_execute_data *ex)
1313

1414
{%INTERNAL_LABELS%}
1515

16-
#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)
17-
/* Force C compiler to store preserved registers to allow JIT using them */
18-
# if defined(__GNUC__) && defined(__i386__)
19-
__asm__ __volatile__ (""::: "ebx");
20-
# elif defined(__GNUC__) && defined(__x86_64__)
21-
__asm__ __volatile__ (""::: "rbx","r12","r13");
22-
# elif defined(__GNUC__) && defined(__aarch64__)
23-
__asm__ __volatile__ (""::: "x19","x20","x21","x22","x23","x24","x25","x26");
24-
# endif
25-
#endif
2616
LOAD_OPLINE();
2717
ZEND_VM_LOOP_INTERRUPT_CHECK();
2818

Zend/zend_vm_gen.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,6 +2127,14 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
21272127
break;
21282128
case ZEND_VM_KIND_HYBRID:
21292129
out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
2130+
out($f, $m[1]."/* Force C compiler to store preserved registers to allow JIT using them */\n");
2131+
out($f,"# if defined(__GNUC__) && defined(__i386__)\n");
2132+
out($f, $m[1]."__asm__ __volatile__ (\"\"::: \"ebx\");\n");
2133+
out($f,"# elif defined(__GNUC__) && defined(__x86_64__)\n");
2134+
out($f, $m[1]."__asm__ __volatile__ (\"\"::: \"rbx\",\"r12\",\"r13\");\n");
2135+
out($f,"# elif defined(__GNUC__) && defined(__aarch64__)\n");
2136+
out($f, $m[1]."__asm__ __volatile__ (\"\"::: \"x19\",\"x20\",\"x21\",\"x22\",\"x23\",\"x24\",\"x25\",\"x26\");\n");
2137+
out($f,"# endif\n");
21302138
out($f, $m[1]."HYBRID_SWITCH()".$m[3]."\n");
21312139
out($f,"#else\n");
21322140
case ZEND_VM_KIND_CALL:

0 commit comments

Comments
 (0)