From: Anatol Belski Date: Sat, 3 Nov 2018 19:29:51 +0000 (+0100) Subject: Change the way JIT availability is checked X-Git-Tag: php-7.3.0RC5~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aea411657ee20572f8268060a4afa73bc3795497;p=php Change the way JIT availability is checked The pcre2_jit_compile_8 sysmbol is always available, even JIT might be not. If JIT is not enabled explicitly and is enabled in the PHP runtime, this will lead to a malfunction. This approach ensures JIT is indeed available on the given platform. For cross compilation this might get complicated, as it would require an explicit processor architecture and PCRE2 version check. Another solution for this case is to run pcre2_config at runtime. That however would require more condition checks that would impact architectures where JIT is available. --- diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4 index 753071340d..6b94bac3c9 100644 --- a/ext/pcre/config0.m4 +++ b/ext/pcre/config0.m4 @@ -47,20 +47,35 @@ PHP_ARG_WITH(pcre-jit,,[ --with-pcre-jit Enable PCRE JIT functionality fi fi + PHP_EVAL_INCLINE($PCRE2_INC) + PHP_EVAL_LIBLINE($PCRE2_LIB) + AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ]) + AC_DEFINE(HAVE_PCRE, 1, [ ]) + if test "$PHP_PCRE_JIT" != "no"; then - PHP_CHECK_LIBRARY(pcre2-8, pcre2_jit_compile_8, + AC_MSG_CHECKING([for JIT support in PCRE2]) + AC_RUN_IFELSE([ + AC_LANG_SOURCE([[ + #include + #include + int main(void) { + uint32_t have_jit; + pcre2_config_8(PCRE2_CONFIG_JIT, &have_jit); + return !have_jit; + } + ]])], [ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, []) + ], [ - AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [ ]) - ],[ - ],[ - $PCRE2_LIB + AC_MSG_RESULT([no]) + ], + [ + dnl cross compilation might want to rely on arch names + AC_MSG_RESULT([no]) ]) fi - PHP_EVAL_INCLINE($PCRE2_INC) - PHP_EVAL_LIBLINE($PCRE2_LIB) - AC_DEFINE(HAVE_PCRE, 1, [ ]) - AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ]) PHP_NEW_EXTENSION(pcre, php_pcre.c, no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h]) else