From d531c4b65dc47312256f9de2786a852f6ac4c1f5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 19 Jun 2022 12:02:12 -0700 Subject: [PATCH] qsimd: don't enforce shstk (CET) feature on launch Clang with -march=tigerlake or -march=sapphirerapids pre-defines __SHSTK__, which QtCore require the feature, even if the OS does not have support for it. That's of no consequence because the compiler does not generate shadow stack operations on its own. Pick-to: 6.2 6.3 6.4 Change-Id: Id0fb9ab0089845ee8843fffd16fa1ad910f008b8 Reviewed-by: Allan Sandfeld Jensen --- src/corelib/global/qsimd.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/corelib/global/qsimd.cpp b/src/corelib/global/qsimd.cpp index 4630122adc7..cc904335673 100644 --- a/src/corelib/global/qsimd.cpp +++ b/src/corelib/global/qsimd.cpp @@ -564,6 +564,12 @@ uint64_t QT_MANGLE_NAMESPACE(qDetectCpuFeatures)() // Yocto hard-codes CRC32+AES on. Since they are unlikely to be used // automatically by compilers, we can just add runtime check. minFeatureTest &= ~(CpuFeatureAES|CpuFeatureCRC32); +#endif +#if defined(Q_PROCESSOR_X86_64) && defined(cpu_feature_shstk) + // Controlflow Enforcement Technology (CET) is an OS-assisted + // hardware-feature, meaning the CPUID bit may be disabled if the OS + // doesn't support it, but that's ok. + minFeatureTest &= ~CpuFeatureSHSTK; #endif QCpuFeatureType f = detectProcessorFeatures();