diff --git a/src/corelib/global/qsimd.cpp b/src/corelib/global/qsimd.cpp index a8e99b0df8..8bc5381591 100644 --- a/src/corelib/global/qsimd.cpp +++ b/src/corelib/global/qsimd.cpp @@ -561,11 +561,6 @@ QT_FUNCTION_TARGET_BASELINE uint64_t QT_MANGLE_NAMESPACE(qDetectCpuFeatures)() { auto minFeatureTest = minFeature; -#if defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM_64) - // 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 diff --git a/src/corelib/global/qsimd_p.h b/src/corelib/global/qsimd_p.h index 3b74ff6d3c..012eb6cf4f 100644 --- a/src/corelib/global/qsimd_p.h +++ b/src/corelib/global/qsimd_p.h @@ -325,12 +325,19 @@ static const uint64_t qCompilerCpuFeatures = 0 #if defined __ARM_NEON__ | CpuFeatureNEON #endif +#if !(defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM_64)) + // Yocto Project recipes enable Crypto extension for all ARMv8 configs, + // even for targets without the Crypto extension. That's wrong, but as + // the compiler never generates the code for them on their own, most + // code never notices the problem. But we would. By not setting the + // bits here, we force a runtime detection. #if defined __ARM_FEATURE_CRC32 | CpuFeatureCRC32 #endif #if defined __ARM_FEATURE_CRYPTO | CpuFeatureAES #endif +#endif // Q_OS_LINUX && Q_PROCESSOR_ARM64 #if defined __mips_dsp | CpuFeatureDSP #endif diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 1a0d281284..56de45fd32 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -937,13 +937,7 @@ size_t qHashBits(const void *p, size_t size, size_t seed) noexcept if (seed && qCpuHasFeature(AES) && qCpuHasFeature(SSE4_2)) return aeshash(reinterpret_cast(p), size, seed, seed2); #elif defined(Q_PROCESSOR_ARM) && QT_COMPILER_SUPPORTS_HERE(AES) && !defined(QHASH_AES_SANITIZER_BUILD) && !defined(QT_BOOTSTRAPPED) -# if defined(Q_OS_LINUX) - // Do specific runtime-only check as Yocto hard enables Crypto extension for - // all armv8 configs - if (seed && (qCpuFeatures() & CpuFeatureAES)) -# else if (seed && qCpuHasFeature(AES)) -# endif return aeshash(reinterpret_cast(p), size, seed, seed2); #endif