Skip to content

Commit f3ea88b

Browse files
committed
Fix bundled libpcre2 build regarding the -fcf-protection gcc flag
Cf. <https://bugs.exim.org/show_bug.cgi?id=2578>.
1 parent 3306957 commit f3ea88b

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

ext/pcre/config0.m4

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,38 @@ else
6868
pcre2lib/pcre2_tables.c pcre2lib/pcre2_ucd.c pcre2lib/pcre2_valid_utf.c pcre2lib/pcre2_xclass.c \
6969
pcre2lib/pcre2_find_bracket.c pcre2lib/pcre2_convert.c pcre2lib/pcre2_extuni.c pcre2lib/pcre2_script_run.c"
7070
PHP_PCRE_CFLAGS="-DHAVE_CONFIG_H -I@ext_srcdir@/pcre2lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
71-
PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, no,,$PHP_PCRE_CFLAGS)
72-
PHP_ADD_BUILD_DIR($ext_builddir/pcre2lib)
73-
PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcre2lib/])
7471
AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
7572
AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ])
7673

7774
AC_MSG_CHECKING([whether to enable PCRE JIT functionality])
7875
if test "$PHP_PCRE_JIT" != "no"; then
7976
AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [ ])
8077
AC_MSG_RESULT([yes])
78+
79+
AC_CACHE_CHECK([whether Intel CET is enabled], ac_cv_have_pcre2_intel_cet, [
80+
AC_COMPILE_IFELSE([
81+
AC_LANG_SOURCE([[
82+
#ifndef __CET__
83+
# error CET is not enabled
84+
#endif
85+
]])], [
86+
ac_cv_have_pcre2_intel_cet=yes
87+
], [
88+
ac_cv_have_pcre2_intel_cet=no
89+
])
90+
if test "$ac_cv_have_pcre2_intel_cet" = yes; then
91+
PHP_PCRE_CFLAGS="-mshstk $PHP_PCRE_CFLAGS"
92+
fi
93+
])
94+
8195
else
8296
AC_MSG_RESULT([no])
8397
fi
8498

99+
PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, no,,$PHP_PCRE_CFLAGS)
100+
PHP_ADD_BUILD_DIR($ext_builddir/pcre2lib)
101+
PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcre2lib/])
102+
85103
if test "$PHP_VALGRIND" != "no" && test "$have_valgrind" = "yes"; then
86104
dnl Enable pcre valgrind support only in DEBUG build (it affects performance)
87105
if test "$ZEND_DEBUG" = "yes"; then

0 commit comments

Comments
 (0)