summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-02-05 14:22:57 -0800
committerThiago Macieira <thiago.macieira@intel.com>2024-02-10 21:39:45 -0800
commitb911bb0d42622147c687a4856e29a34c22643bba (patch)
tree653fbf54ddfe232ecb46c7feb671997c8ebc08f8 /src/corelib/global
parent6ab4623cad39bec935f76e366f3f262922bde94a (diff)
qsimd_p.h: move the ARM Crypto (AES) disabling on Linux
Commit 8179d7edf6cb2b06666634d0cafddbca974931e1 added the check in two places. Move to a central one, disabling the bits in qCompilerCpuFeatures. Change-Id: I50e2158aeade4256ad1dfffd17b117afcb93c126 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qsimd.cpp5
-rw-r--r--src/corelib/global/qsimd_p.h7
2 files changed, 7 insertions, 5 deletions
diff --git a/src/corelib/global/qsimd.cpp b/src/corelib/global/qsimd.cpp
index a8e99b0df8e..8bc53815916 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 3b74ff6d3c0..012eb6cf4f4 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