Commit ca2b09d4 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix linking of a bootstrapped qmake

parent 6bef07c0
From 34011eee4498a56db032120caad17d4a65ba8c5c Mon Sep 17 00:00:00 2001
From 46e1d5280515002f5694ddf7a9aab0930e2867c1 Mon Sep 17 00:00:00 2001
From: Dmitry Kazakov <dimula73@gmail.com>
Date: Thu, 5 Sep 2019 10:23:08 +0300
Subject: [PATCH] Fix QRandomGenerator initialization on AMD CPUs
......@@ -11,17 +11,17 @@ This code checks if hardware random generator can generate four
consecutive distinct numbers. If it fails the test, then we probably
have a failing one and should disable it completely.
Fixes: QTBUG-69423
Change-Id: I38c87920ca2e8cce4143afbff5e453ce3845d11a
Fixes: QTBUG-69423
---
src/corelib/global/qrandom.cpp | 40 +-------------------
src/corelib/global/qrandom_p.h | 8 ----
src/corelib/tools/qsimd.cpp | 67 ++++++++++++++++++++++++++++++++++
src/corelib/tools/qsimd_p.h | 11 ++++++
4 files changed, 80 insertions(+), 46 deletions(-)
src/corelib/global/qrandom.cpp | 40 ++--------------------
src/corelib/global/qrandom_p.h | 8 -----
src/corelib/tools/qsimd.cpp | 62 ++++++++++++++++++++++++++++++++++
src/corelib/tools/qsimd_p.h | 18 ++++++++++
4 files changed, 82 insertions(+), 46 deletions(-)
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp
index 90df8653..4c9ea605 100644
index bf01b7ae2a..c3ccd2d0cd 100644
--- a/src/corelib/global/qrandom.cpp
+++ b/src/corelib/global/qrandom.cpp
@@ -90,42 +90,6 @@ DECLSPEC_IMPORT BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG Rando
......@@ -79,7 +79,7 @@ index 90df8653..4c9ea605 100644
if (filled != count && (uint(qt_randomdevice_control) & SkipSystemRNG) == 0) {
qsizetype bytesFilled =
diff --git a/src/corelib/global/qrandom_p.h b/src/corelib/global/qrandom_p.h
index 917a9109..4a0adff5 100644
index 917a91098e..4a0adff51c 100644
--- a/src/corelib/global/qrandom_p.h
+++ b/src/corelib/global/qrandom_p.h
@@ -79,14 +79,6 @@ extern Q_CORE_EXPORT QBasicAtomicInteger<uint> qt_randomdevice_control;
......@@ -98,7 +98,7 @@ index 917a9109..4a0adff5 100644
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index e44307f2..0e8cb417 100644
index ddd715f745..3d051df859 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -376,6 +376,37 @@ static quint64 detectProcessorFeatures()
......@@ -139,7 +139,7 @@ index e44307f2..0e8cb417 100644
return features;
}
@@ -589,4 +620,40 @@ void qDumpCPUFeatures()
@@ -590,4 +621,35 @@ void qDumpCPUFeatures()
puts("");
}
......@@ -171,29 +171,31 @@ index e44307f2..0e8cb417 100644
+out:
+ return ptr - reinterpret_cast<unsigned *>(buffer);
+}
+#else
+static qsizetype qRandomCpu(void *, qsizetype) Q_DECL_NOTHROW
+{
+ return 0;
+}
+#endif
+
+
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 9f1321df..14220549 100644
index c36e1e484f..d603631a24 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -346,6 +346,8 @@ extern Q_CORE_EXPORT QBasicAtomicInteger<unsigned> qt_cpu_features[2];
@@ -346,6 +346,15 @@ extern Q_CORE_EXPORT QBasicAtomicInteger<unsigned> qt_cpu_features[2];
#endif
Q_CORE_EXPORT void qDetectCpuFeatures();
Q_CORE_EXPORT quint64 qDetectCpuFeatures();
+#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND)
+Q_CORE_EXPORT qsizetype qRandomCpu(void *, qsizetype) Q_DECL_NOTHROW;
+#else
+static inline qsizetype qRandomCpu(void *, qsizetype) Q_DECL_NOTHROW
+{
+ return 0;
+}
+#endif
+
static inline quint64 qCpuFeatures()
{
quint64 features = qt_cpu_features[0].load();
@@ -366,6 +368,15 @@ static inline quint64 qCpuFeatures()
@@ -362,6 +371,15 @@ static inline quint64 qCpuFeatures()
#define qCpuHasFeature(feature) (((qCompilerCpuFeatures & CpuFeature ## feature) == CpuFeature ## feature) \
|| ((qCpuFeatures() & CpuFeature ## feature) == CpuFeature ## feature))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment