Revision: 1256
http://www.exim.org/viewvc/pcre2?view=rev&revision=1256
Author: ph10
Date: 2020-05-25 17:03:24 +0100 (Mon, 25 May 2020)
Log Message:
-----------
Apply H.J. Lu's patch to pass -mshstk to the compiler when Intel CET is
enabled. CMake version invented by PH, but only tested on non-CET system.
Modified Paths:
--------------
code/trunk/CMakeLists.txt
code/trunk/ChangeLog
code/trunk/Makefile.am
code/trunk/configure.ac
Modified: code/trunk/CMakeLists.txt
===================================================================
--- code/trunk/CMakeLists.txt 2020-05-09 15:48:36 UTC (rev 1255)
+++ code/trunk/CMakeLists.txt 2020-05-25 16:03:24 UTC (rev 1256)
@@ -92,6 +92,7 @@
# library versioning.
# 2020-04-25 Carlo added function check for mkostemp used in ProtExecAllocator
# 2020-04-28 PH added function check for memfd_create based on Carlo's patch
+# 2020-05-25 PH added a check for Intel CET
PROJECT(PCRE2 C)
@@ -146,6 +147,24 @@
)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
+# Check whether Intel CET is enabled, and if so, adjust compiler flags. This
+# code was written by PH, trying to imitate the logic from the autotools
+# configuration.
+
+CHECK_C_SOURCE_COMPILES(
+ "#ifndef __CET__
+ #error CET is not enabled
+ #endif
+ int main() { return 0; }"
+ INTEL_CET_ENABLED
+)
+
+IF (INTEL_CET_ENABLED)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mshstk")
+ENDIF(INTEL_CET_ENABLED)
+
+
+
# User-configurable options
#
# Note: CMakeSetup displays these in alphabetical order, regardless of
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2020-05-09 15:48:36 UTC (rev 1255)
+++ code/trunk/ChangeLog 2020-05-25 16:03:24 UTC (rev 1256)
@@ -1,6 +1,15 @@
Change Log for PCRE2
--------------------
+Version 10.36-RC1 25-May-2020
+-----------------------------
+
+1. Add CET_CFLAGS so that when Intel CET is enabled, pass -mshstk to
+compiler. This fixes
https://bugs.exim.org/show_bug.cgi?id=2578. Patch for
+Makefile.am and configure.ac by H.J. Lu. Equivalent patch for CMakeLists.txt
+invented by PH.
+
+
Version 10.35 09-May-2020
---------------------------
Modified: code/trunk/Makefile.am
===================================================================
--- code/trunk/Makefile.am 2020-05-09 15:48:36 UTC (rev 1255)
+++ code/trunk/Makefile.am 2020-05-25 16:03:24 UTC (rev 1256)
@@ -391,6 +391,7 @@
libpcre2_8_la_CFLAGS = \
-DPCRE2_CODE_UNIT_WIDTH=8 \
$(VISIBILITY_CFLAGS) \
+ $(CET_CFLAGS) \
$(AM_CFLAGS)
libpcre2_8_la_LIBADD =
endif # WITH_PCRE2_8
Modified: code/trunk/configure.ac
===================================================================
--- code/trunk/configure.ac 2020-05-09 15:48:36 UTC (rev 1255)
+++ code/trunk/configure.ac 2020-05-25 16:03:24 UTC (rev 1256)
@@ -1006,6 +1006,21 @@
AM_CONDITIONAL([WITH_GCOV],[test "x$enable_coverage" = "xyes"])
+AC_MSG_CHECKING([whether Intel CET is enabled])
+AC_LANG_PUSH([C])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,
+ [[#ifndef __CET__
+# error CET is not enabled
+#endif]])],
+ [pcre2_cc_cv_intel_cet_enabled=yes],
+ [pcre2_cc_cv_intel_cet_enabled=no])
+AC_MSG_RESULT([$pcre2_cc_cv_intel_cet_enabled])
+if test "$pcre2_cc_cv_intel_cet_enabled" = yes; then
+ CET_CFLAGS="-mshstk"
+ AC_SUBST([CET_CFLAGS])
+fi
+AC_LANG_POP([C])
+
# Produce these files, in addition to config.h.
AC_CONFIG_FILES(
Makefile