summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-05-25 18:53:31 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-06-02 01:32:36 +0200
commit61fb2274ff67515c803f4586a490370db17aa017 (patch)
treec9518f9b0ccbc5132e0d136b7d5d5c04ca3d9a9c
parent4de8dd50d54f0cd5d83105a048d06d16fd89a878 (diff)
Fix compilation of PCRE2 under Intel CET
Ubuntu 20.04 enables -fcf-protection by default. PCRE2 10.35 sees this but complains that -mshstk is also necessary to build its JIT. Detect whether the compiler is enabling Intel CET automatically, and if so, build PCRE2 with the right options. Change-Id: I3440e689b81f4f07055f211a4fa7331a43eb410d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 7c8c8272b49372b2a9fd4f95b7a7f31347c06497) (cherry picked from commit fa98adbd04de9d44ce921436b92589a41f285dcd)
-rw-r--r--configure.json16
-rw-r--r--mkspecs/common/gcc-base.conf2
-rw-r--r--src/3rdparty/pcre2/pcre2.pro5
3 files changed, 23 insertions, 0 deletions
diff --git a/configure.json b/configure.json
index d1eb1d8102..50d69b740d 100644
--- a/configure.json
+++ b/configure.json
@@ -646,6 +646,17 @@
"label": "ccache",
"type": "files",
"files": [ "ccache" ]
+ },
+ "intelcet": {
+ "label": "Support for Intel Control-flow Enforcement Technology",
+ "type": "compile",
+ "test": {
+ "main": [
+ "#if !defined(__CET__)",
+ "# error Intel CET not available",
+ "#endif"
+ ]
+ }
}
},
@@ -1412,6 +1423,11 @@
"autoDetect": "features.shared",
"condition": "features.dlopen || config.win32 || !features.shared",
"output": [ "privateFeature" ]
+ },
+ "intelcet": {
+ "label": "Using Intel CET",
+ "condition": "tests.intelcet",
+ "output": [ "privateFeature" ]
}
},
diff --git a/mkspecs/common/gcc-base.conf b/mkspecs/common/gcc-base.conf
index 1f919d270a..3c2d5fdd53 100644
--- a/mkspecs/common/gcc-base.conf
+++ b/mkspecs/common/gcc-base.conf
@@ -54,6 +54,7 @@ QMAKE_CFLAGS_SPLIT_SECTIONS += -ffunction-sections -fdata-sections
QMAKE_CFLAGS_LTCG = -flto -fno-fat-lto-objects
QMAKE_CFLAGS_LTCG_FATOBJECTS = -ffat-lto-objects
QMAKE_CFLAGS_DISABLE_LTCG = -fno-lto
+QMAKE_CFLAGS_SHSTK = -mshstk
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS
QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS
@@ -74,6 +75,7 @@ QMAKE_CXXFLAGS_SPLIT_SECTIONS += $$QMAKE_CFLAGS_SPLIT_SECTIONS
QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
QMAKE_CXXFLAGS_LTCG_FATOBJECTS = $$QMAKE_CFLAGS_LTCG_FATOBJECTS
QMAKE_CXXFLAGS_DISABLE_LTCG = $$QMAKE_CFLAGS_DISABLE_LTCG
+QMAKE_CXXFLAGS_SHSTK = $$QMAKE_CFLAGS_SHSTK
QMAKE_LFLAGS +=
QMAKE_LFLAGS_DEBUG +=
diff --git a/src/3rdparty/pcre2/pcre2.pro b/src/3rdparty/pcre2/pcre2.pro
index 56790f34c5..adfcb95408 100644
--- a/src/3rdparty/pcre2/pcre2.pro
+++ b/src/3rdparty/pcre2/pcre2.pro
@@ -14,6 +14,11 @@ load(qt_helper_lib)
DEFINES += HAVE_CONFIG_H
+qtConfig(intelcet) {
+ QMAKE_CFLAGS += $$QMAKE_CFLAGS_SHSTK
+ QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_SHSTK
+}
+
# platform/compiler specific definitions
uikit|qnx|winrt: DEFINES += PCRE2_DISABLE_JIT
win32:contains(QT_ARCH, "arm"): DEFINES += PCRE2_DISABLE_JIT