summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2020-05-25 16:03:24 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2020-05-25 16:03:24 +0000
commit4f0b3ea9771e49fb0d5e5c323e7966ceff2c7ec2 (patch)
tree430345aa9778691ab7c92ff2d66d1d500b22b68c
parent858e5ac388c3d623f2ab0c62a881b98a0ecd40a7 (diff)
downloadpcre2-4f0b3ea9771e49fb0d5e5c323e7966ceff2c7ec2.tar.gz
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. git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1256 6239d852-aaf2-0410-a92c-79f79f948069
-rw-r--r--CMakeLists.txt19
-rw-r--r--ChangeLog9
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac15
4 files changed, 44 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 86b8896..5e8a763 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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 @@ CHECK_C_SOURCE_COMPILES(
)
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
diff --git a/ChangeLog b/ChangeLog
index 310eb60..3cb3895 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
---------------------------
diff --git a/Makefile.am b/Makefile.am
index bb888f2..af6b92b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -391,6 +391,7 @@ nodist_libpcre2_8_la_SOURCES = \
libpcre2_8_la_CFLAGS = \
-DPCRE2_CODE_UNIT_WIDTH=8 \
$(VISIBILITY_CFLAGS) \
+ $(CET_CFLAGS) \
$(AM_CFLAGS)
libpcre2_8_la_LIBADD =
endif # WITH_PCRE2_8
diff --git a/configure.ac b/configure.ac
index 180d3dc..61b93ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1006,6 +1006,21 @@ fi # enable_coverage
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