diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index cb2791fb45ac..6533f00ede6e 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -3724,6 +3724,16 @@ int zend_jit_check_support(void) { int i; +#ifdef ZEND_JIT_USE_APPLE_MAP_JIT + if (!pthread_jit_write_protect_supported_np()) { + zend_accel_error(ACCEL_LOG_WARNING, + "Apple Silicon ZTS JIT requires pthread_jit_write_protect_np() support. JIT disabled."); + JIT_G(enabled) = 0; + JIT_G(on) = 0; + return FAILURE; + } +#endif + if (zend_execute_ex != execute_ex) { if (zend_dtrace_enabled) { zend_error(E_WARNING, "JIT is incompatible with DTrace. JIT disabled."); @@ -3792,11 +3802,6 @@ void zend_jit_startup(void *buf, size_t size, bool reattached) "Unable to share JIT buffer across fork using minherit(): %s (%d)", strerror(error), error); } - if (!pthread_jit_write_protect_supported_np()) { - munmap(buf, size); - zend_accel_error_noreturn(ACCEL_LOG_FATAL, - "Apple Silicon ZTS JIT requires pthread_jit_write_protect_np() support"); - } #endif dasm_buf = buf; diff --git a/ext/opcache/tests/jit/gh14267_001.phpt b/ext/opcache/tests/jit/gh14267_001.phpt index 52be177b9155..2e23016f899b 100644 --- a/ext/opcache/tests/jit/gh14267_001.phpt +++ b/ext/opcache/tests/jit/gh14267_001.phpt @@ -9,7 +9,10 @@ opcache.jit_buffer_size=32M opcache --FILE-- ===DONE=== --EXPECT-- diff --git a/ext/opcache/tests/jit/gh16393.phpt b/ext/opcache/tests/jit/gh16393.phpt index c93b06fda8ce..e90fb53e21a2 100644 --- a/ext/opcache/tests/jit/gh16393.phpt +++ b/ext/opcache/tests/jit/gh16393.phpt @@ -7,7 +7,10 @@ opcache.jit=1215 opcache.jit_buffer_size=64M --FILE-- --EXPECTF-- -Warning: Undefined variable $test in %sgh16393.php on line 6 +Warning: Undefined variable $test in %sgh16393.php on line 9