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 <allan.jensen@qt.io>
(cherry picked from commit 11cc74b0661bdad122857e0405cced57d9a6bad7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2022-10-25 11:09:31 -07:00 committed by Qt Cherry-pick Bot
parent 2f7596e1bb
commit 10698b3138

View File

@ -349,12 +349,16 @@ Q_CORE_EXPORT uint64_t QT_MANGLE_NAMESPACE(qDetectCpuFeatures)();
static inline uint64_t qCpuFeatures() 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); quint64 features = atomic_load_explicit(QT_MANGLE_NAMESPACE(qt_cpu_features), memory_order_relaxed);
if (!QT_SUPPORTS_INIT_PRIORITY) { if (!QT_SUPPORTS_INIT_PRIORITY) {
if (Q_UNLIKELY(features == 0)) if (Q_UNLIKELY(features == 0))
features = QT_MANGLE_NAMESPACE(qDetectCpuFeatures)(); features = QT_MANGLE_NAMESPACE(qDetectCpuFeatures)();
} }
return features; return features;
#endif
} }
#define qCpuHasFeature(feature) (((qCompilerCpuFeatures & CpuFeature ## feature) == CpuFeature ## feature) \ #define qCpuHasFeature(feature) (((qCompilerCpuFeatures & CpuFeature ## feature) == CpuFeature ## feature) \