summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-09-17 16:16:44 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2020-09-17 16:21:01 +0200
commitf3ea88bff7022bb3574578fcffe1ed334e17d8d3 (patch)
treee3752a6cd5e3afab9ca1d3ac77c38d57366cbff7
parent33069575d57965b3456cf1b21b81d3c9db7e456f (diff)
downloadphp-git-f3ea88bff7022bb3574578fcffe1ed334e17d8d3.tar.gz
Fix bundled libpcre2 build regarding the `-fcf-protection` gcc flag
Cf. <https://bugs.exim.org/show_bug.cgi?id=2578>.
-rw-r--r--ext/pcre/config0.m424
1 files changed, 21 insertions, 3 deletions
diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4
index 714a8d57e8..7e57201954 100644
--- a/ext/pcre/config0.m4
+++ b/ext/pcre/config0.m4
@@ -68,9 +68,6 @@ else
pcre2lib/pcre2_tables.c pcre2lib/pcre2_ucd.c pcre2lib/pcre2_valid_utf.c pcre2lib/pcre2_xclass.c \
pcre2lib/pcre2_find_bracket.c pcre2lib/pcre2_convert.c pcre2lib/pcre2_extuni.c pcre2lib/pcre2_script_run.c"
PHP_PCRE_CFLAGS="-DHAVE_CONFIG_H -I@ext_srcdir@/pcre2lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
- PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, no,,$PHP_PCRE_CFLAGS)
- PHP_ADD_BUILD_DIR($ext_builddir/pcre2lib)
- PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcre2lib/])
AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ])
@@ -78,10 +75,31 @@ else
if test "$PHP_PCRE_JIT" != "no"; then
AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [ ])
AC_MSG_RESULT([yes])
+
+ AC_CACHE_CHECK([whether Intel CET is enabled], ac_cv_have_pcre2_intel_cet, [
+ AC_COMPILE_IFELSE([
+ AC_LANG_SOURCE([[
+ #ifndef __CET__
+ # error CET is not enabled
+ #endif
+ ]])], [
+ ac_cv_have_pcre2_intel_cet=yes
+ ], [
+ ac_cv_have_pcre2_intel_cet=no
+ ])
+ if test "$ac_cv_have_pcre2_intel_cet" = yes; then
+ PHP_PCRE_CFLAGS="-mshstk $PHP_PCRE_CFLAGS"
+ fi
+ ])
+
else
AC_MSG_RESULT([no])
fi
+ PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, no,,$PHP_PCRE_CFLAGS)
+ PHP_ADD_BUILD_DIR($ext_builddir/pcre2lib)
+ PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcre2lib/])
+
if test "$PHP_VALGRIND" != "no" && test "$have_valgrind" = "yes"; then
dnl Enable pcre valgrind support only in DEBUG build (it affects performance)
if test "$ZEND_DEBUG" = "yes"; then