From 10698b31387fd76c0cbc0da34bc738766c848d23 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 25 Oct 2022 11:09:31 -0700 Subject: [PATCH] Bootstrap: fix MinGW build with -maes In bootstrap mode, we don't build qsimd.cpp and don't check for CPU features, but specifying -maes in the compiler command-line can still enable the AES hash support in qhash.cpp. This has probably been broken since Qt 6.4 with commit 4be85491e069081cbc9dc29202a25d0771b61f06. qhash.cpp:(.rdata$.refptr.qt_cpu_features[.refptr.qt_cpu_features]+0x0): undefined reference to `qt_cpu_features' Change-Id: I07ec23f3cb174fb197c3fffd17216241cfd1ab19 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 11cc74b0661bdad122857e0405cced57d9a6bad7) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/global/qsimd_p.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/global/qsimd_p.h b/src/corelib/global/qsimd_p.h index 35484c184d6..3773419835b 100644 --- a/src/corelib/global/qsimd_p.h +++ b/src/corelib/global/qsimd_p.h @@ -349,12 +349,16 @@ Q_CORE_EXPORT uint64_t QT_MANGLE_NAMESPACE(qDetectCpuFeatures)(); static inline uint64_t qCpuFeatures() { +#ifdef QT_BOOTSTRAPPED + return qCompilerCpuFeatures; // no detection +#else quint64 features = atomic_load_explicit(QT_MANGLE_NAMESPACE(qt_cpu_features), memory_order_relaxed); if (!QT_SUPPORTS_INIT_PRIORITY) { if (Q_UNLIKELY(features == 0)) features = QT_MANGLE_NAMESPACE(qDetectCpuFeatures)(); } return features; +#endif } #define qCpuHasFeature(feature) (((qCompilerCpuFeatures & CpuFeature ## feature) == CpuFeature ## feature) \