From 0d21a0b0fa78dfa3eb516f394f6cd86b4707e645 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Mon, 25 Jan 2021 10:13:29 -0600 Subject: [PATCH] Update PCRE2 to 10.36 (#39310) --- deps/Versions.make | 2 +- deps/checksums/pcre | 64 ++--- deps/patches/pcre2-cet-flags.patch | 229 ---------------- .../pcre2-sljit-apple-silicon-support.patch | 244 ++++++++++++++++++ deps/pcre.mk | 12 +- stdlib/PCRE2_jll/Project.toml | 2 +- stdlib/PCRE2_jll/test/runtests.jl | 2 +- 7 files changed, 284 insertions(+), 271 deletions(-) delete mode 100644 deps/patches/pcre2-cet-flags.patch create mode 100644 deps/patches/pcre2-sljit-apple-silicon-support.patch diff --git a/deps/Versions.make b/deps/Versions.make index b0b2e72f63f2e..75a22deff11df 100644 --- a/deps/Versions.make +++ b/deps/Versions.make @@ -91,7 +91,7 @@ P7ZIP_VER := 16.2.0 P7ZIP_JLL_NAME := p7zip # PCRE -PCRE_VER := 10.35 +PCRE_VER := 10.36 PCRE_JLL_NAME := PCRE2 # SuiteSparse diff --git a/deps/checksums/pcre b/deps/checksums/pcre index f89546fb71df4..421426e3d2389 100644 --- a/deps/checksums/pcre +++ b/deps/checksums/pcre @@ -1,32 +1,32 @@ -PCRE2.v10.35.0+0.aarch64-apple-darwin.tar.gz/md5/4c604a93fd5a1343ba0cd907655c2f7b -PCRE2.v10.35.0+0.aarch64-apple-darwin.tar.gz/sha512/9aeadea7c685cafe226d9e0059a1443e7ba408ced7689723d63851a05796da2bffaf2e8b469da16f569229d70515c75daa0e70eaca4b98368fb692c909545265 -PCRE2.v10.35.0+0.aarch64-linux-gnu.tar.gz/md5/be872ef012d842ec67307b38c70ee652 -PCRE2.v10.35.0+0.aarch64-linux-gnu.tar.gz/sha512/742334411e9d7251d863363a1df71b49fec6dec60d594825821bcca5beeac4681fec97da114dd2e7698b8012f521f282acfc076f367f2959c0c7ab3775e8a3a9 -PCRE2.v10.35.0+0.aarch64-linux-musl.tar.gz/md5/7fcfa6fd4263a601559e395c7ac5c1fa -PCRE2.v10.35.0+0.aarch64-linux-musl.tar.gz/sha512/66d291e2c2cfaefe575122c54b5b9d7ed62b0a1bd8db626bb7581d6981735a95ca42995b665023eba2704d04f38320518acfcbecf9fb9db71cae0c6ff4b4c96d -PCRE2.v10.35.0+0.armv6l-linux-gnueabihf.tar.gz/md5/1ce32c9911f40734463a5c44a127098b -PCRE2.v10.35.0+0.armv6l-linux-gnueabihf.tar.gz/sha512/94c0df8dda0fb658407a4f90b8e7e938938698a29dd2a0ee799572101f3093d308f1f99a92b7ef33302a1b0dd9954be2b6e84391d331ff047a178e908431bcf9 -PCRE2.v10.35.0+0.armv6l-linux-musleabihf.tar.gz/md5/ab61045ca69a27b6f13db3b26dbf1ee6 -PCRE2.v10.35.0+0.armv6l-linux-musleabihf.tar.gz/sha512/a1c46c49b42b5ff3e1d736bc6748c7a69c53b1dca18aa4a4e1c5076a894bfc51af152b71b9075ba46583737aa78f9324f94fb3036327adc95f28fc29145c3504 -PCRE2.v10.35.0+0.armv7l-linux-gnueabihf.tar.gz/md5/8e55ae4239c682b611fdb7b3e64f2fad -PCRE2.v10.35.0+0.armv7l-linux-gnueabihf.tar.gz/sha512/f63bb3b278b5f0e52fa30a5f8a0f67ad37a983a43d04fbcc9e5972978adcbc7d76dcc72d1bb7c8555cc1cbb3bd5907c4fdc23f5f24f962530c7313170228f9df -PCRE2.v10.35.0+0.armv7l-linux-musleabihf.tar.gz/md5/0e5da7ba4bb7930afd28e3b1f20db026 -PCRE2.v10.35.0+0.armv7l-linux-musleabihf.tar.gz/sha512/6b3c5b14ff799243121a056b4d79af762fd9fd6ea3e1b55e5146af25e98aad963d7a5b5b3ece07c8a2ceb934eee02edc238704e103a7cd5b7ce00a2776082adc -PCRE2.v10.35.0+0.i686-linux-gnu.tar.gz/md5/753232dcaa7cd3bf41cc65f5d10e9fac -PCRE2.v10.35.0+0.i686-linux-gnu.tar.gz/sha512/1377449341367c8546ddc010a38db9094c0e8f18626f8b010f020ef5f14077e0fca50945e1a9f6e4e18c3ea8c7ebd3f28954bb13c9ad8fcee8a8548bb0258925 -PCRE2.v10.35.0+0.i686-linux-musl.tar.gz/md5/ac3d8656f82251a925ba2c842938bc62 -PCRE2.v10.35.0+0.i686-linux-musl.tar.gz/sha512/736bca0879c4820bf2196244fd664d35d281e2f0a5ac969210de470e2d03182401294926753f67438fe8d0831366386e3a263c6e19a0cdea5ea2b87eedb901bd -PCRE2.v10.35.0+0.i686-w64-mingw32.tar.gz/md5/e80c503eb4ffa74ab486c18f2809c72c -PCRE2.v10.35.0+0.i686-w64-mingw32.tar.gz/sha512/ce252bb835bcdbae997825d9e7ee877509551a3d2063ac17bde8beb417bfdbe0461e9980d623608d5699804e5bf61e38c7a505d5083f6fc6964786928ed45165 -PCRE2.v10.35.0+0.powerpc64le-linux-gnu.tar.gz/md5/6c1cfcbe2e47d16bb345e68cf9a7d62a -PCRE2.v10.35.0+0.powerpc64le-linux-gnu.tar.gz/sha512/9977f3695bb8d4c065ed29acc56148017bb40ebfb2b08344e37cd7874e8934fa4e6ad8dfa552d45a65e8dbb6dc257b6663f8299ae1a1b49fa2217775e547cd8b -PCRE2.v10.35.0+0.x86_64-apple-darwin.tar.gz/md5/a41cd11abaf88d6331f382ff142d5631 -PCRE2.v10.35.0+0.x86_64-apple-darwin.tar.gz/sha512/37666cc9dbe686d6a614c99092eb8b636dc3f626c0619e832dd072c8fc2f9d5bae1435045471b87a4737218b107e3c265b65074bacf5762a813eff75b725bb39 -PCRE2.v10.35.0+0.x86_64-linux-gnu.tar.gz/md5/59785e82e8964eff86df5b3a4b6e4cce -PCRE2.v10.35.0+0.x86_64-linux-gnu.tar.gz/sha512/f09eff9864e944cc27f737329f466be32b7dc21ec68a425881f6a16bad358d999f203dc36c055e1ac4b613980878c51afd2fd7e379e61cc7a2812f775c323b71 -PCRE2.v10.35.0+0.x86_64-linux-musl.tar.gz/md5/043179f5a3622123e95128219571fa35 -PCRE2.v10.35.0+0.x86_64-linux-musl.tar.gz/sha512/7a689300101560f1053374089f33c6554a0b9b28f6a9022eadf1599747e419a9fbc98b70638640e065c0dc9d32e9e0bc05c87e46321b6b5aacfd61c04141fca7 -PCRE2.v10.35.0+0.x86_64-unknown-freebsd.tar.gz/md5/a18cb245ca057846802ccdcf0673d772 -PCRE2.v10.35.0+0.x86_64-unknown-freebsd.tar.gz/sha512/ff2ce9fea948561e87c1e68e29852ac917a690b807e43509b9184fd9233e5bb9d8ca98490d8936d2be43b31081e3e9829006cbb8b7cc160469e7d3df5215e820 -PCRE2.v10.35.0+0.x86_64-w64-mingw32.tar.gz/md5/04e7ecd60b039ba60fdbcb82a83e2e68 -PCRE2.v10.35.0+0.x86_64-w64-mingw32.tar.gz/sha512/a0cb69b73fb86de2f37c6e98633c4aeab83c6be871819baddec8cd483db65815043090ff0736e85aa2117f58dacf73e2b49cba9536e109b53840c5b45c3e3fb1 +PCRE2.v10.36.0+0.aarch64-apple-darwin.tar.gz/md5/34157dd76b931907009ec32aad7c6e5e +PCRE2.v10.36.0+0.aarch64-apple-darwin.tar.gz/sha512/f2c4a676fb4fad42bdcffcde4876b82d40e2e3aeb7668e3077aea4e98be022cb627110bb6c13a71db941d6135db64a455c969c0cc4b914a898dc8556a9d88e67 +PCRE2.v10.36.0+0.aarch64-linux-gnu.tar.gz/md5/4fb6705dfdd7889fc8f52616527a0956 +PCRE2.v10.36.0+0.aarch64-linux-gnu.tar.gz/sha512/7af0d79aa55c969fe434f89702e328ca04d236e78accced26d5038cd08fbf83c3b4feb7e02bb88fbf0338f94f8e13b099b454eaa3c59e5274d7b572dd2e3d687 +PCRE2.v10.36.0+0.aarch64-linux-musl.tar.gz/md5/968317b2a6fa8d71a82d5f9f1a7a7923 +PCRE2.v10.36.0+0.aarch64-linux-musl.tar.gz/sha512/ba7f89932447c1c3ca007c766c8987789f0792afba924d52b149d966010792b8182ab77d50911ec4fe6553d1794617d6c70ca74b5c3e8b8779fa69c61eb2f456 +PCRE2.v10.36.0+0.armv6l-linux-gnueabihf.tar.gz/md5/d760e518585dd9bfd9e3d3688417b8ef +PCRE2.v10.36.0+0.armv6l-linux-gnueabihf.tar.gz/sha512/d0da6bbbd01e67e5a0ec448ca7bf218d90d4fbee17fd71981221816b5d00d05722347899aa960d88ee8e609b700e7b33d5c9b802b2e5eeccd1710f5b5deda839 +PCRE2.v10.36.0+0.armv6l-linux-musleabihf.tar.gz/md5/b746d89f79fbd5ba5bda60848eac517b +PCRE2.v10.36.0+0.armv6l-linux-musleabihf.tar.gz/sha512/8d025fc4e7f58ba89b7f763ff6250738ef76eb58dbd82baf8257cb5f9fdf0a59730c7854747ab3bda754294f2e2ceb2fc769a51e0e504fdadd68da73b5fc8684 +PCRE2.v10.36.0+0.armv7l-linux-gnueabihf.tar.gz/md5/f4529eccf64a257b5df354f084807eb5 +PCRE2.v10.36.0+0.armv7l-linux-gnueabihf.tar.gz/sha512/46a4e6efa1a6ecbccecbeddeb0a66475917172350702b0c6eed077e2de1d25c266182999f9d0a48074e9124dcca812815d964fb0cce0033f117246e9d1933198 +PCRE2.v10.36.0+0.armv7l-linux-musleabihf.tar.gz/md5/896bdae6d898c2c71751341b5a10e344 +PCRE2.v10.36.0+0.armv7l-linux-musleabihf.tar.gz/sha512/c16c2291b2802037fec3ae5aec2b01ed072a712b7ef48bb2a02cdaae6715dd6dd9e6c4905134047a06ad435684856d7f400dc655ec8c42a9a5ec9a3eebc9a22a +PCRE2.v10.36.0+0.i686-linux-gnu.tar.gz/md5/c545dd71a854c328536d258d1defdf60 +PCRE2.v10.36.0+0.i686-linux-gnu.tar.gz/sha512/c9aa0d188f55ce3cd19b608832bfb5a22bed34fe23b58489e8716e3af2338728fb5bd9f281f29b203b0de00e885cc8bc35e046524d328e09b7371c353ba9fb2b +PCRE2.v10.36.0+0.i686-linux-musl.tar.gz/md5/927e70b0b164e7225019677c1ca8b1a7 +PCRE2.v10.36.0+0.i686-linux-musl.tar.gz/sha512/2d6e46a8cbe322950c905e6e845a5ad7426485e547d51ed5aae9a048a1fb284f2e7998f4dafe719cc512c22ce8ad8622b70d46e2140c4e01a85d1a053bc90190 +PCRE2.v10.36.0+0.i686-w64-mingw32.tar.gz/md5/3c5129a428239ef9bd6220ed6abc3a59 +PCRE2.v10.36.0+0.i686-w64-mingw32.tar.gz/sha512/e342d8fd180b4f663eddb93ac3893d45ab1757b4fefc4c81a42768cbf03d9ec6b27af42ffe5568b8cad42fbcce2ee3d01bb272eeecb2ebd75e236f8a22efb3fd +PCRE2.v10.36.0+0.powerpc64le-linux-gnu.tar.gz/md5/d4158e4c05a45b2a5e8fdf89de1d2d24 +PCRE2.v10.36.0+0.powerpc64le-linux-gnu.tar.gz/sha512/cd652a8acefcab959826239176585c003465e9d0220b712731ad83b0c24b24a6a6875f44a458f208872c3c50cdff205e3e178feed3984c6dbde1e1792a4a7da9 +PCRE2.v10.36.0+0.x86_64-apple-darwin.tar.gz/md5/efa1c7f36aa76f3c9278ea409e99cc4d +PCRE2.v10.36.0+0.x86_64-apple-darwin.tar.gz/sha512/5b3f37a5f99690937adc7346b0f7205b8f8743ee81acad72a8d605a896cd9e9b23a81b26a0dd18b7fac0434ab6a45fd9eed5cc12a97f48d8069d55f537228621 +PCRE2.v10.36.0+0.x86_64-linux-gnu.tar.gz/md5/41c18464e519fc53cc4d496a683b0088 +PCRE2.v10.36.0+0.x86_64-linux-gnu.tar.gz/sha512/afab98dd9cf808a094a7402e532d7adf0b7b562bf1858a3e036e3ad400fa704129c13a2c4d0b32cde6a9786b09d220b72f77e1af6ab2883bcc3ffc6fd7fa80b4 +PCRE2.v10.36.0+0.x86_64-linux-musl.tar.gz/md5/9a24b4e7dcb145c113f9b93f2fc82bef +PCRE2.v10.36.0+0.x86_64-linux-musl.tar.gz/sha512/329c86994da95725b04af4db340765ecf8620bbb255583a74932d9076b78da757e426ca79c0fe0002f9c4be4854fae861ea716c9c0c7b3d0962082c0506e90a7 +PCRE2.v10.36.0+0.x86_64-unknown-freebsd.tar.gz/md5/fb71d0f5c07f23c50dd9b9c5f26cf511 +PCRE2.v10.36.0+0.x86_64-unknown-freebsd.tar.gz/sha512/32f330d2492f9325c28d514343e6eb63e3958df769712814ef4c0975e2918d753a8898a30f49ea9ed5f9ff14fce8ec99cd5758e93c8964fb85ba1982c4c5a792 +PCRE2.v10.36.0+0.x86_64-w64-mingw32.tar.gz/md5/67991b37b9dd96541ba83999fb657ad5 +PCRE2.v10.36.0+0.x86_64-w64-mingw32.tar.gz/sha512/0978ead7b84db12fbeb9ca87b043982fc29350bf4a5342ebbf90746c6471c146b977b9c86cc5a090b013b919b2834745b18af10ace00db992bf82bc791124637 diff --git a/deps/patches/pcre2-cet-flags.patch b/deps/patches/pcre2-cet-flags.patch deleted file mode 100644 index 7c455175cdfe3..0000000000000 --- a/deps/patches/pcre2-cet-flags.patch +++ /dev/null @@ -1,229 +0,0 @@ -commit 6823a639a4a2d3e2b4a44bab6da78e1659431063 -Author: Elliot Saba -Date: Tue Nov 17 19:29:06 2020 +0000 - - Backport SVN revisions r1256 and r1257 to fix compilations errors - - Without this patch, compilation errors such as `"-mshstk is needed to compile with -fcf-protection"` - occur on newer Ubuntu distros. This is a backport of upstreams patch, along with a partial-update - of `configure` so that users do not have to run `aclocal` on their machines when building from source. - - X-ref: https://bugs.exim.org/show_bug.cgi?id=2578 - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 86b8896..a368523 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,23 @@ 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..f238cce 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..6a771a5 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 -@@ -404,6 +405,7 @@ nodist_libpcre2_16_la_SOURCES = \ - libpcre2_16_la_CFLAGS = \ - -DPCRE2_CODE_UNIT_WIDTH=16 \ - $(VISIBILITY_CFLAGS) \ -+ $(CET_CFLAGS) \ - $(AM_CFLAGS) - libpcre2_16_la_LIBADD = - endif # WITH_PCRE2_16 -@@ -417,6 +419,7 @@ nodist_libpcre2_32_la_SOURCES = \ - libpcre2_32_la_CFLAGS = \ - -DPCRE2_CODE_UNIT_WIDTH=32 \ - $(VISIBILITY_CFLAGS) \ -+ $(CET_CFLAGS) \ - $(AM_CFLAGS) - libpcre2_32_la_LIBADD = - endif # WITH_PCRE2_32 -diff --git a/Makefile.in b/Makefile.in -index 2873912..0ce7004 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -806,6 +806,7 @@ AUTOMAKE = @AUTOMAKE@ - AWK = @AWK@ - CC = @CC@ - CCDEPMODE = @CCDEPMODE@ -+CET_CFLAGS = @CET_CFLAGS@ - CFLAGS = @CFLAGS@ - CPP = @CPP@ - CPPFLAGS = @CPPFLAGS@ -@@ -1310,8 +1311,9 @@ COMMON_SOURCES = \ - @WITH_PCRE2_8_TRUE@ $(NODIST_SOURCES) - - @WITH_PCRE2_8_TRUE@libpcre2_8_la_CFLAGS = -DPCRE2_CODE_UNIT_WIDTH=8 \ --@WITH_PCRE2_8_TRUE@ $(VISIBILITY_CFLAGS) $(AM_CFLAGS) \ --@WITH_PCRE2_8_TRUE@ $(am__append_5) $(am__append_8) -+@WITH_PCRE2_8_TRUE@ $(VISIBILITY_CFLAGS) $(CET_CFLAGS) \ -+@WITH_PCRE2_8_TRUE@ $(AM_CFLAGS) $(am__append_5) \ -+@WITH_PCRE2_8_TRUE@ $(am__append_8) - @WITH_PCRE2_8_TRUE@libpcre2_8_la_LIBADD = - @WITH_PCRE2_16_TRUE@libpcre2_16_la_SOURCES = \ - @WITH_PCRE2_16_TRUE@ $(COMMON_SOURCES) -@@ -1321,8 +1323,9 @@ COMMON_SOURCES = \ - - @WITH_PCRE2_16_TRUE@libpcre2_16_la_CFLAGS = \ - @WITH_PCRE2_16_TRUE@ -DPCRE2_CODE_UNIT_WIDTH=16 \ --@WITH_PCRE2_16_TRUE@ $(VISIBILITY_CFLAGS) $(AM_CFLAGS) \ --@WITH_PCRE2_16_TRUE@ $(am__append_6) $(am__append_9) -+@WITH_PCRE2_16_TRUE@ $(VISIBILITY_CFLAGS) $(CET_CFLAGS) \ -+@WITH_PCRE2_16_TRUE@ $(AM_CFLAGS) $(am__append_6) \ -+@WITH_PCRE2_16_TRUE@ $(am__append_9) - @WITH_PCRE2_16_TRUE@libpcre2_16_la_LIBADD = - @WITH_PCRE2_32_TRUE@libpcre2_32_la_SOURCES = \ - @WITH_PCRE2_32_TRUE@ $(COMMON_SOURCES) -@@ -1332,8 +1335,9 @@ COMMON_SOURCES = \ - - @WITH_PCRE2_32_TRUE@libpcre2_32_la_CFLAGS = \ - @WITH_PCRE2_32_TRUE@ -DPCRE2_CODE_UNIT_WIDTH=32 \ --@WITH_PCRE2_32_TRUE@ $(VISIBILITY_CFLAGS) $(AM_CFLAGS) \ --@WITH_PCRE2_32_TRUE@ $(am__append_7) $(am__append_10) -+@WITH_PCRE2_32_TRUE@ $(VISIBILITY_CFLAGS) $(CET_CFLAGS) \ -+@WITH_PCRE2_32_TRUE@ $(AM_CFLAGS) $(am__append_7) \ -+@WITH_PCRE2_32_TRUE@ $(am__append_10) - @WITH_PCRE2_32_TRUE@libpcre2_32_la_LIBADD = - @WITH_PCRE2_8_TRUE@libpcre2_8_la_LDFLAGS = $(EXTRA_LIBPCRE2_8_LDFLAGS) - @WITH_PCRE2_16_TRUE@libpcre2_16_la_LDFLAGS = $(EXTRA_LIBPCRE2_16_LDFLAGS) -diff --git a/configure b/configure -index 615f638..322a3a4 100755 ---- a/configure -+++ b/configure -@@ -633,6 +633,7 @@ ac_subst_vars='am__EXEEXT_FALSE - am__EXEEXT_TRUE - LTLIBOBJS - LIBOBJS -+CET_CFLAGS - WITH_GCOV_FALSE - WITH_GCOV_TRUE - GCOV_LIBS -@@ -15493,6 +15494,46 @@ else - fi - - -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Intel CET is enabled" >&5 -+$as_echo_n "checking whether Intel CET is enabled... " >&6; } -+ac_ext=c -+ac_cpp='$CPP $CPPFLAGS' -+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_c_compiler_gnu -+ -+cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ -+int -+main () -+{ -+#ifndef __CET__ -+# error CET is not enabled -+#endif -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_c_try_compile "$LINENO"; then : -+ pcre2_cc_cv_intel_cet_enabled=yes -+else -+ pcre2_cc_cv_intel_cet_enabled=no -+fi -+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pcre2_cc_cv_intel_cet_enabled" >&5 -+$as_echo "$pcre2_cc_cv_intel_cet_enabled" >&6; } -+if test "$pcre2_cc_cv_intel_cet_enabled" = yes; then -+ CET_CFLAGS="-mshstk" -+ -+fi -+ac_ext=c -+ac_cpp='$CPP $CPPFLAGS' -+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_c_compiler_gnu -+ -+ - # Produce these files, in addition to config.h. - ac_config_files="$ac_config_files Makefile libpcre2-8.pc libpcre2-16.pc libpcre2-32.pc libpcre2-posix.pc pcre2-config src/pcre2.h" - -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 diff --git a/deps/patches/pcre2-sljit-apple-silicon-support.patch b/deps/patches/pcre2-sljit-apple-silicon-support.patch new file mode 100644 index 0000000000000..3aff832ca08fd --- /dev/null +++ b/deps/patches/pcre2-sljit-apple-silicon-support.patch @@ -0,0 +1,244 @@ +From e87e1ccf93768238db3d6e28d0272980dba707fa Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= +Date: Mon, 30 Nov 2020 01:35:13 -0800 +Subject: [PATCH] macos: add BigSur support to execalloc (#90) + +Apple Silicon requires that pages that will hold JIT code are +marked with MAP_JIT (even if not using the hardened runtime) +and that a call be made to a pthread function before writing +to them, so a special exception could be made to the current +thread[1]; add support for both. + +since the allocator keeps the metadata about chunk/block in the +executable pages, all functions that modify that metadata will +also need to be updated. + +note that since there is no need for an accurate pointer range +with the apple implementation, NULL is passed for the pointers. + +historically, adding MAP_JIT was only recommended when the hardened +runtime was being used as it adds several undocumented restrictions +(like not being able to use JIT pages accross fork()) so the +new codepath won't be used if running in Intel. + +Tested-by: @Keno +Fixes: #51 + +[1] https://developer.apple.com/documentation/apple_silicon/porting_just-in-time_compilers_to_apple_silicon?language=objc +--- + sljit_src/sljitExecAllocator.c | 113 ++++++++++++++++++--------------- + 1 file changed, 63 insertions(+), 50 deletions(-) + +diff --git a/sljit_src/sljitExecAllocator.c b/sljit_src/sljitExecAllocator.c +index 61a32f2..2e1c138 100644 +--- a/sljit_src/sljitExecAllocator.c ++++ b/sljit_src/sljitExecAllocator.c +@@ -79,6 +79,7 @@ + */ + + #ifdef _WIN32 ++#define SLJIT_UPDATE_WX_FLAGS(from, to, enable_exec) + + static SLJIT_INLINE void* alloc_chunk(sljit_uw size) + { +@@ -91,65 +92,76 @@ static SLJIT_INLINE void free_chunk(void *chunk, sljit_uw size) + VirtualFree(chunk, 0, MEM_RELEASE); + } + +-#else +- +-#ifdef __APPLE__ +-#ifdef MAP_ANON +-/* Configures TARGET_OS_OSX when appropriate */ +-#include +- +-#if TARGET_OS_OSX && defined(MAP_JIT) +-#include +-#endif /* TARGET_OS_OSX && MAP_JIT */ +- +-#ifdef MAP_JIT ++#else /* POSIX */ + ++#if defined(__APPLE__) && defined(MAP_JIT) + /* + On macOS systems, returns MAP_JIT if it is defined _and_ we're running on a +- version where it's OK to have more than one JIT block. ++ version where it's OK to have more than one JIT block or where MAP_JIT is ++ required. + On non-macOS systems, returns MAP_JIT if it is defined. + */ ++#include ++#if TARGET_OS_OSX ++#if defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86 ++#ifdef MAP_ANON ++#include ++#include ++ ++#define SLJIT_MAP_JIT (get_map_jit_flag()) ++ + static SLJIT_INLINE int get_map_jit_flag() + { +-#if TARGET_OS_OSX +- sljit_sw page_size = get_page_alignment() + 1; ++ sljit_sw page_size; + void *ptr; ++ struct utsname name; + static int map_jit_flag = -1; + +- /* +- The following code is thread safe because multiple initialization +- sets map_jit_flag to the same value and the code has no side-effects. +- Changing the kernel version witout system restart is (very) unlikely. +- */ +- if (map_jit_flag == -1) { +- struct utsname name; +- ++ if (map_jit_flag < 0) { + map_jit_flag = 0; + uname(&name); + +- /* Kernel version for 10.14.0 (Mojave) */ ++ /* Kernel version for 10.14.0 (Mojave) or later */ + if (atoi(name.release) >= 18) { ++ page_size = get_page_alignment() + 1; + /* Only use MAP_JIT if a hardened runtime is used */ ++ ptr = mmap(NULL, page_size, PROT_WRITE | PROT_EXEC, ++ MAP_PRIVATE | MAP_ANON, -1, 0); + +- ptr = mmap(NULL, page_size, PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, -1, 0); +- +- if (ptr == MAP_FAILED) { +- map_jit_flag = MAP_JIT; +- } else { ++ if (ptr != MAP_FAILED) + munmap(ptr, page_size); +- } ++ else ++ map_jit_flag = MAP_JIT; + } + } +- + return map_jit_flag; +-#else /* !TARGET_OS_OSX */ +- return MAP_JIT; +-#endif /* TARGET_OS_OSX */ + } +- +-#endif /* MAP_JIT */ + #endif /* MAP_ANON */ +-#endif /* __APPLE__ */ ++#else /* !SLJIT_CONFIG_X86 */ ++#if !(defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM) ++#error Unsupported architecture ++#endif /* SLJIT_CONFIG_ARM */ ++#include ++ ++#define SLJIT_MAP_JIT (MAP_JIT) ++#define SLJIT_UPDATE_WX_FLAGS(from, to, enable_exec) \ ++ apple_update_wx_flags(enable_exec) ++ ++static SLJIT_INLINE void apple_update_wx_flags(sljit_s32 enable_exec) ++{ ++ pthread_jit_write_protect_np(enable_exec); ++} ++#endif /* SLJIT_CONFIG_X86 */ ++#else /* !TARGET_OS_OSX */ ++#define SLJIT_MAP_JIT (MAP_JIT) ++#endif /* TARGET_OS_OSX */ ++#endif /* __APPLE__ && MAP_JIT */ ++#ifndef SLJIT_UPDATE_WX_FLAGS ++#define SLJIT_UPDATE_WX_FLAGS(from, to, enable_exec) ++#endif /* !SLJIT_UPDATE_WX_FLAGS */ ++#ifndef SLJIT_MAP_JIT ++#define SLJIT_MAP_JIT (0) ++#endif /* !SLJIT_MAP_JIT */ + + static SLJIT_INLINE void* alloc_chunk(sljit_uw size) + { +@@ -157,12 +169,7 @@ static SLJIT_INLINE void* alloc_chunk(sljit_uw size) + const int prot = PROT_READ | PROT_WRITE | PROT_EXEC; + + #ifdef MAP_ANON +- +- int flags = MAP_PRIVATE | MAP_ANON; +- +-#ifdef MAP_JIT +- flags |= get_map_jit_flag(); +-#endif ++ int flags = MAP_PRIVATE | MAP_ANON | SLJIT_MAP_JIT; + + retval = mmap(NULL, size, prot, flags, -1, 0); + #else /* !MAP_ANON */ +@@ -173,14 +180,15 @@ static SLJIT_INLINE void* alloc_chunk(sljit_uw size) + #endif /* MAP_ANON */ + + if (retval == MAP_FAILED) +- retval = NULL; +- else { +- if (mprotect(retval, size, prot) < 0) { +- munmap(retval, size); +- retval = NULL; +- } ++ return NULL; ++ ++ if (mprotect(retval, size, prot) < 0) { ++ munmap(retval, size); ++ return NULL; + } + ++ SLJIT_UPDATE_WX_FLAGS(retval, (uint8_t *)retval + size, 0); ++ + return retval; + } + +@@ -189,7 +197,7 @@ static SLJIT_INLINE void free_chunk(void *chunk, sljit_uw size) + munmap(chunk, size); + } + +-#endif ++#endif /* windows */ + + /* --------------------------------------------------------------------- */ + /* Common functions */ +@@ -261,6 +269,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_malloc_exec(sljit_uw size) + while (free_block) { + if (free_block->size >= size) { + chunk_size = free_block->size; ++ SLJIT_UPDATE_WX_FLAGS(NULL, NULL, 0); + if (chunk_size > size + 64) { + /* We just cut a block from the end of the free block. */ + chunk_size -= size; +@@ -326,6 +335,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free_exec(void* ptr) + allocated_size -= header->size; + + /* Connecting free blocks together if possible. */ ++ SLJIT_UPDATE_WX_FLAGS(NULL, NULL, 0); + + /* If header->prev_size == 0, free_block will equal to header. + In this case, free_block->header.size will be > 0. */ +@@ -358,6 +368,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free_exec(void* ptr) + } + } + ++ SLJIT_UPDATE_WX_FLAGS(NULL, NULL, 1); + SLJIT_ALLOCATOR_UNLOCK(); + } + +@@ -367,6 +378,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free_unused_memory_exec(void) + struct free_block* next_free_block; + + SLJIT_ALLOCATOR_LOCK(); ++ SLJIT_UPDATE_WX_FLAGS(NULL, NULL, 0); + + free_block = free_blocks; + while (free_block) { +@@ -381,5 +393,6 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free_unused_memory_exec(void) + } + + SLJIT_ASSERT((total_size && free_blocks) || (!total_size && !free_blocks)); ++ SLJIT_UPDATE_WX_FLAGS(NULL, NULL, 1); + SLJIT_ALLOCATOR_UNLOCK(); + } +-- +2.30.0 + diff --git a/deps/pcre.mk b/deps/pcre.mk index 70b9e9f96ff02..f92357d7d9f54 100644 --- a/deps/pcre.mk +++ b/deps/pcre.mk @@ -12,18 +12,16 @@ $(SRCCACHE)/pcre2-$(PCRE_VER)/source-extracted: $(SRCCACHE)/pcre2-$(PCRE_VER).ta $(JLCHECKSUM) $< cd $(dir $<) && $(TAR) jxf $(notdir $<) cp $(SRCDIR)/patches/config.sub $(SRCCACHE)/pcre2-$(PCRE_VER)/config.sub - cd $(SRCCACHE)/pcre2-$(PCRE_VER) && patch -p1 -f < $(SRCDIR)/patches/pcre2-cet-flags.patch - # Fix some old targets modified by the patching - touch -c $(SRCCACHE)/pcre2-$(PCRE_VER)/Makefile.am - touch -c $(SRCCACHE)/pcre2-$(PCRE_VER)/Makefile.in - touch -c $(SRCCACHE)/pcre2-$(PCRE_VER)/aclocal.m4 - touch -c $(SRCCACHE)/pcre2-$(PCRE_VER)/configure echo $1 > $@ checksum-pcre2: $(SRCCACHE)/pcre2-$(PCRE_VER).tar.bz2 $(JLCHECKSUM) $< -$(BUILDDIR)/pcre2-$(PCRE_VER)/build-configured: $(SRCCACHE)/pcre2-$(PCRE_VER)/source-extracted +$(SRCCACHE)/pcre2-$(PCRE_VER)/pcre2-sljit-apple-silicon-support.patch-applied: $(SRCCACHE)/pcre2-$(PCRE_VER)/source-extracted + cd $(SRCCACHE)/pcre2-$(PCRE_VER) && patch -d src/sljit -p2 -f < $(SRCDIR)/patches/pcre2-sljit-apple-silicon-support.patch + echo 1 > $@ + +$(BUILDDIR)/pcre2-$(PCRE_VER)/build-configured: $(SRCCACHE)/pcre2-$(PCRE_VER)/source-extracted $(SRCCACHE)/pcre2-$(PCRE_VER)/pcre2-sljit-apple-silicon-support.patch-applied mkdir -p $(dir $@) cd $(dir $@) && \ $(dir $<)/configure $(CONFIGURE_COMMON) --enable-jit --includedir=$(build_includedir) CFLAGS="$(CFLAGS) $(PCRE_CFLAGS)" LDFLAGS="$(LDFLAGS) $(PCRE_LDFLAGS)" diff --git a/stdlib/PCRE2_jll/Project.toml b/stdlib/PCRE2_jll/Project.toml index 4b57093d649b4..7f364d3fefd88 100644 --- a/stdlib/PCRE2_jll/Project.toml +++ b/stdlib/PCRE2_jll/Project.toml @@ -1,6 +1,6 @@ name = "PCRE2_jll" uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15" -version = "10.35.0+0" +version = "10.36.0+0" [deps] Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" diff --git a/stdlib/PCRE2_jll/test/runtests.jl b/stdlib/PCRE2_jll/test/runtests.jl index aa1d89f02cea5..b2446e7e5caab 100644 --- a/stdlib/PCRE2_jll/test/runtests.jl +++ b/stdlib/PCRE2_jll/test/runtests.jl @@ -6,5 +6,5 @@ using Test, Libdl, PCRE2_jll vstr = zeros(UInt8, 32) @test ccall((:pcre2_config_8, libpcre2_8), Cint, (UInt32, Ref{UInt8}), 11, vstr) > 0 vn = VersionNumber(split(unsafe_string(pointer(vstr)), " ")[1]) - @test vn == v"10.35.0" + @test vn == v"10.36.0" end