Skip to content

Commit b335710

Browse files
committed
depends: patch around non-determinism in qt
1 parent e8ecec4 commit b335710

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

depends/packages/qt.mk

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ $(package)_patches += fast_fixed_dtoa_no_optimize.patch
2222
$(package)_patches += guix_cross_lib_path.patch
2323
$(package)_patches += fix-macos-linker.patch
2424
$(package)_patches += memory_resource.patch
25+
$(package)_patches += utc_from_string_no_optimize.patch
2526
$(package)_patches += windows_lto.patch
2627

2728
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
@@ -249,6 +250,7 @@ define $(package)_preprocess_cmds
249250
patch -p1 -i $($(package)_patch_dir)/memory_resource.patch && \
250251
patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \
251252
patch -p1 -i $($(package)_patch_dir)/duplicate_lcqpafonts.patch && \
253+
patch -p1 -i $($(package)_patch_dir)/utc_from_string_no_optimize.patch && \
252254
patch -p1 -i $($(package)_patch_dir)/fast_fixed_dtoa_no_optimize.patch && \
253255
patch -p1 -i $($(package)_patch_dir)/guix_cross_lib_path.patch && \
254256
patch -p1 -i $($(package)_patch_dir)/windows_lto.patch && \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
Modify optimisation flags for various functions.
2+
This fixes non-determinism issues in the asm produced for
3+
these function when cross-compiling on x86_64 and aarch64 for
4+
the arm64-apple-darwin HOST.
5+
6+
--- a/qtbase/src/corelib/itemmodels/qitemselectionmodel.cpp
7+
+++ b/qtbase/src/corelib/itemmodels/qitemselectionmodel.cpp
8+
@@ -1078,9 +1078,9 @@ void QItemSelectionModelPrivate::_q_layoutChanged(const QList<QPersistentModelIn
9+
10+
if (hint != QAbstractItemModel::VerticalSortHint) {
11+
// sort the "new" selection, as preparation for merging
12+
- std::stable_sort(savedPersistentIndexes.begin(), savedPersistentIndexes.end(),
13+
+ std::sort(savedPersistentIndexes.begin(), savedPersistentIndexes.end(),
14+
qt_PersistentModelIndexLessThan);
15+
- std::stable_sort(savedPersistentCurrentIndexes.begin(), savedPersistentCurrentIndexes.end(),
16+
+ std::sort(savedPersistentCurrentIndexes.begin(), savedPersistentCurrentIndexes.end(),
17+
qt_PersistentModelIndexLessThan);
18+
19+
// update the selection by merging the individual indexes
20+
@@ -1092,8 +1092,8 @@ void QItemSelectionModelPrivate::_q_layoutChanged(const QList<QPersistentModelIn
21+
savedPersistentCurrentIndexes.clear();
22+
} else {
23+
// sort the "new" selection, as preparation for merging
24+
- std::stable_sort(savedPersistentRowLengths.begin(), savedPersistentRowLengths.end());
25+
- std::stable_sort(savedPersistentCurrentRowLengths.begin(), savedPersistentCurrentRowLengths.end());
26+
+ std::sort(savedPersistentRowLengths.begin(), savedPersistentRowLengths.end());
27+
+ std::sort(savedPersistentCurrentRowLengths.begin(), savedPersistentCurrentRowLengths.end());
28+
29+
// update the selection by merging the individual indexes
30+
ranges = mergeRowLengths(savedPersistentRowLengths);
31+
32+
--- a/qtbase/src/corelib/itemmodels/qitemselectionmodel_p.h
33+
+++ b/qtbase/src/corelib/itemmodels/qitemselectionmodel_p.h
34+
@@ -76,7 +76,7 @@ public:
35+
void _q_rowsAboutToBeInserted(const QModelIndex &parent, int start, int end);
36+
void _q_columnsAboutToBeInserted(const QModelIndex &parent, int start, int end);
37+
void _q_layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint);
38+
- void _q_layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint);
39+
+ __attribute__ ((optnone)) void _q_layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint);
40+
41+
inline void remove(QList<QItemSelectionRange> &r)
42+
{
43+
44+
--- a/qtbase/src/corelib/time/qdatetimeparser_p.h
45+
+++ b/qtbase/src/corelib/time/qdatetimeparser_p.h
46+
@@ -215,7 +215,7 @@ private:
47+
: value(ok == Invalid ? -1 : val), used(read), zeroes(zs), state(ok)
48+
{}
49+
};
50+
- ParsedSection parseSection(const QDateTime &currentValue, int sectionIndex,
51+
+ __attribute__ ((optnone)) ParsedSection parseSection(const QDateTime &currentValue, int sectionIndex,
52+
int offset, QString *text) const;
53+
int findMonth(const QString &str1, int monthstart, int sectionIndex,
54+
int year, QString *monthName = nullptr, int *used = nullptr) const;
55+
56+
--- a/qtbase/src/corelib/time/qtimezoneprivate_p.h
57+
+++ b/qtbase/src/corelib/time/qtimezoneprivate_p.h
58+
@@ -191,7 +191,7 @@ public:
59+
virtual ~QUtcTimeZonePrivate();
60+
61+
// Fall-back for UTC[+-]\d+(:\d+){,2} IDs.
62+
- static qint64 offsetFromUtcString(const QByteArray &id);
63+
+ static __attribute__ ((optnone)) qint64 offsetFromUtcString(const QByteArray &id);
64+
65+
QUtcTimeZonePrivate *clone() const override;
66+
67+
--- a/qtbase/src/widgets/widgets/qcalendarwidget.cpp
68+
+++ b/qtbase/src/widgets/widgets/qcalendarwidget.cpp
69+
@@ -329,13 +329,13 @@ class QCalendarYearValidator : public QCalendarDateSectionValidator
70+
71+
public:
72+
QCalendarYearValidator();
73+
- virtual Section handleKey(int key) override;
74+
+ __attribute__ ((optnone)) virtual Section handleKey(int key) override;
75+
virtual QDate applyToDate(QDate date, QCalendar cal) const override;
76+
virtual void setDate(QDate date, QCalendar cal) override;
77+
virtual QString text() const override;
78+
virtual QString text(QDate date, QCalendar cal, int repeat) const override;
79+
private:
80+
- int pow10(int n);
81+
+ __attribute__ ((optnone)) int pow10(int n);
82+
int m_pos;
83+
int m_year;
84+
int m_oldYear;

0 commit comments

Comments
 (0)