Skip to content

Commit 4b1196a

Browse files
committed
Merge bitcoin#28880: build: switch to using LLVM 17.x for macOS builds
b335710 depends: patch around non-determinism in qt (fanquake) e8ecec4 build: rename native_clang to native_llvm (fanquake) b0c2903 Revert "build: Patch Qt to handle minimum macOS version properly" (fanquake) 558250d guix: use clang-toolchain-17 for macOS build (fanquake) 5ddd7c6 build: Bump `native_clang` up to 17.0.6 (Hennadii Stepanov) Pull request description: This is the last step before bitcoin#21778. We need LLVM 17.x so that lld has `-fixup_chains`. ACKs for top commit: theuni: ACK b335710. TheCharlatan: ACK b335710 Tree-SHA512: 8142956196a481178f360258c2e4d924178d552966b713323f29f2deba7e5ec73a3da1c9d79d97c9e7f6aa18ed7429cd6660826aa633e6dde1ac56000b9ad57f
2 parents dca0f23 + b335710 commit 4b1196a

File tree

8 files changed

+98
-34
lines changed

8 files changed

+98
-34
lines changed

ci/test/00_setup_env_mac.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,4 @@ export XCODE_BUILD_ID=15A240d
1717
export RUN_UNIT_TESTS=false
1818
export RUN_FUNCTIONAL_TESTS=false
1919
export GOAL="deploy"
20-
21-
# False-positive warning is fixed with clang 17, remove this when that version
22-
# can be used.
23-
export BITCOIN_CONFIG="--with-gui --enable-reduce-exports LDFLAGS=-Wno-error=unused-command-line-argument"
20+
export BITCOIN_CONFIG="--with-gui --enable-reduce-exports"

contrib/guix/manifest.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,5 +525,5 @@ inspecting signatures in Mach-O binaries.")
525525
((string-contains target "-linux-")
526526
(list (make-bitcoin-cross-toolchain target)))
527527
((string-contains target "darwin")
528-
(list clang-toolchain-15 binutils cmake-minimal python-signapple zip))
528+
(list clang-toolchain-17 binutils cmake-minimal python-signapple zip))
529529
(else '())))))

depends/packages/native_libtapi.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $(package)_sha256_hash=d4d46c64622f13d6938cecf989046d9561011bb59e8ee835f8f39825d
66
$(package)_patches=disable_zlib.patch
77

88
ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
9-
$(package)_dependencies=native_clang
9+
$(package)_dependencies=native_llvm
1010
endif
1111

1212
define $(package)_preprocess_cmds
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
package=native_clang
2-
$(package)_version=15.0.6
1+
package=native_llvm
2+
$(package)_version=17.0.6
3+
$(package)_major_version=$(firstword $(subst ., ,$($(package)_version)))
34
$(package)_download_path=https://github.com/llvm/llvm-project/releases/download/llvmorg-$($(package)_version)
45
ifneq (,$(findstring aarch64,$(BUILD)))
56
$(package)_file_name=clang+llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
6-
$(package)_sha256_hash=8ca4d68cf103da8331ca3f35fe23d940c1b78fb7f0d4763c1c059e352f5d1bec
7+
$(package)_sha256_hash=6dd62762285326f223f40b8e4f2864b5c372de3f7de0731cb7cd55ca5287b75a
78
else
8-
$(package)_file_name=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-18.04.tar.xz
9-
$(package)_sha256_hash=38bc7f5563642e73e69ac5626724e206d6d539fbef653541b34cae0ba9c3f036
9+
$(package)_file_name=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-22.04.tar.xz
10+
$(package)_sha256_hash=884ee67d647d77e58740c1e645649e29ae9e8a6fe87c1376be0f3a30f3cc9ab3
1011
endif
1112

1213
define $(package)_stage_cmds
13-
mkdir -p $($(package)_staging_prefix_dir)/lib/clang/$($(package)_version)/include && \
14+
mkdir -p $($(package)_staging_prefix_dir)/lib/clang/$($(package)_major_version)/include && \
1415
mkdir -p $($(package)_staging_prefix_dir)/bin && \
1516
mkdir -p $($(package)_staging_prefix_dir)/include/llvm-c && \
1617
cp bin/clang $($(package)_staging_prefix_dir)/bin/ && \
@@ -20,5 +21,5 @@ define $(package)_stage_cmds
2021
cp include/llvm-c/ExternC.h $($(package)_staging_prefix_dir)/include/llvm-c && \
2122
cp include/llvm-c/lto.h $($(package)_staging_prefix_dir)/include/llvm-c && \
2223
cp lib/libLTO.so $($(package)_staging_prefix_dir)/lib/ && \
23-
cp -r lib/clang/$($(package)_version)/include/* $($(package)_staging_prefix_dir)/lib/clang/$($(package)_version)/include/
24+
cp -r lib/clang/$($(package)_major_version)/include/* $($(package)_staging_prefix_dir)/lib/clang/$($(package)_major_version)/include/
2425
endef

depends/packages/packages.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ifneq ($(build_os),darwin)
3333
darwin_native_packages += native_cctools native_libtapi
3434

3535
ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
36-
darwin_native_packages+= native_clang
36+
darwin_native_packages+= native_llvm
3737
endif
3838

3939
endif

depends/packages/qt.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ $(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
26-
$(package)_patches += fix-minimum-macos.patch
2727

2828
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
2929
$(package)_qttranslations_sha256_hash=a31785948c640b7c66d9fe2db4993728ca07f64e41c560b3625ad191b276ff20
@@ -240,7 +240,6 @@ endef
240240
define $(package)_preprocess_cmds
241241
cp $($(package)_patch_dir)/qt.pro qt.pro && \
242242
cp $($(package)_patch_dir)/qttools_src.pro qttools/src/src.pro && \
243-
patch -p1 -i $($(package)_patch_dir)/fix-minimum-macos.patch && \
244243
patch -p1 -i $($(package)_patch_dir)/fix-macos-linker.patch && \
245244
patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \
246245
patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch && \
@@ -251,6 +250,7 @@ define $(package)_preprocess_cmds
251250
patch -p1 -i $($(package)_patch_dir)/memory_resource.patch && \
252251
patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \
253252
patch -p1 -i $($(package)_patch_dir)/duplicate_lcqpafonts.patch && \
253+
patch -p1 -i $($(package)_patch_dir)/utc_from_string_no_optimize.patch && \
254254
patch -p1 -i $($(package)_patch_dir)/fast_fixed_dtoa_no_optimize.patch && \
255255
patch -p1 -i $($(package)_patch_dir)/guix_cross_lib_path.patch && \
256256
patch -p1 -i $($(package)_patch_dir)/windows_lto.patch && \

depends/patches/qt/fix-minimum-macos.patch

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 84 additions & 0 deletions
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)