aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-12-22 10:27:40 +0000
committerfanquake <fanquake@gmail.com>2023-12-22 10:35:06 +0000
commit4b1196a9855dcd188a24f393aa2fa21e2d61f061 (patch)
tree0104136817726b1821ae3c8d2334a7d5684cd933
parentdca0f231fa8b9af0260fd29340141a1d7cf5609e (diff)
parentb335710782c2545e6eeed67b5e1763c07eab26b0 (diff)
Merge bitcoin/bitcoin#28880: build: switch to using LLVM 17.x for macOS builds
b335710782c2545e6eeed67b5e1763c07eab26b0 depends: patch around non-determinism in qt (fanquake) e8ecec45756d7121edfaa1321c597d88ce7ec6db build: rename native_clang to native_llvm (fanquake) b0c290340c1e1398dc9eb51b3e48a040de3f47d6 Revert "build: Patch Qt to handle minimum macOS version properly" (fanquake) 558250dec15e43b66c7b5a96543dd184925b6209 guix: use clang-toolchain-17 for macOS build (fanquake) 5ddd7c65b415629d4b57fb238d5fd39b049ccf79 build: Bump `native_clang` up to 17.0.6 (Hennadii Stepanov) Pull request description: This is the last step before #21778. We need LLVM 17.x so that lld has `-fixup_chains`. ACKs for top commit: theuni: ACK b335710782c2545e6eeed67b5e1763c07eab26b0. TheCharlatan: ACK b335710782c2545e6eeed67b5e1763c07eab26b0 Tree-SHA512: 8142956196a481178f360258c2e4d924178d552966b713323f29f2deba7e5ec73a3da1c9d79d97c9e7f6aa18ed7429cd6660826aa633e6dde1ac56000b9ad57f
-rwxr-xr-xci/test/00_setup_env_mac.sh5
-rw-r--r--contrib/guix/manifest.scm2
-rw-r--r--depends/packages/native_libtapi.mk2
-rw-r--r--depends/packages/native_llvm.mk (renamed from depends/packages/native_clang.mk)15
-rw-r--r--depends/packages/packages.mk2
-rw-r--r--depends/packages/qt.mk4
-rw-r--r--depends/patches/qt/fix-minimum-macos.patch18
-rw-r--r--depends/patches/qt/utc_from_string_no_optimize.patch84
8 files changed, 98 insertions, 34 deletions
diff --git a/ci/test/00_setup_env_mac.sh b/ci/test/00_setup_env_mac.sh
index 1651c5ec26..9e71da7b82 100755
--- a/ci/test/00_setup_env_mac.sh
+++ b/ci/test/00_setup_env_mac.sh
@@ -17,7 +17,4 @@ export XCODE_BUILD_ID=15A240d
export RUN_UNIT_TESTS=false
export RUN_FUNCTIONAL_TESTS=false
export GOAL="deploy"
-
-# False-positive warning is fixed with clang 17, remove this when that version
-# can be used.
-export BITCOIN_CONFIG="--with-gui --enable-reduce-exports LDFLAGS=-Wno-error=unused-command-line-argument"
+export BITCOIN_CONFIG="--with-gui --enable-reduce-exports"
diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm
index 9206973953..7335596107 100644
--- a/contrib/guix/manifest.scm
+++ b/contrib/guix/manifest.scm
@@ -525,5 +525,5 @@ inspecting signatures in Mach-O binaries.")
((string-contains target "-linux-")
(list (make-bitcoin-cross-toolchain target)))
((string-contains target "darwin")
- (list clang-toolchain-15 binutils cmake-minimal python-signapple zip))
+ (list clang-toolchain-17 binutils cmake-minimal python-signapple zip))
(else '())))))
diff --git a/depends/packages/native_libtapi.mk b/depends/packages/native_libtapi.mk
index a855c393c6..fb5ab0b4dc 100644
--- a/depends/packages/native_libtapi.mk
+++ b/depends/packages/native_libtapi.mk
@@ -6,7 +6,7 @@ $(package)_sha256_hash=d4d46c64622f13d6938cecf989046d9561011bb59e8ee835f8f39825d
$(package)_patches=disable_zlib.patch
ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
-$(package)_dependencies=native_clang
+$(package)_dependencies=native_llvm
endif
define $(package)_preprocess_cmds
diff --git a/depends/packages/native_clang.mk b/depends/packages/native_llvm.mk
index 661b9c2c1c..09994eb012 100644
--- a/depends/packages/native_clang.mk
+++ b/depends/packages/native_llvm.mk
@@ -1,16 +1,17 @@
-package=native_clang
-$(package)_version=15.0.6
+package=native_llvm
+$(package)_version=17.0.6
+$(package)_major_version=$(firstword $(subst ., ,$($(package)_version)))
$(package)_download_path=https://github.com/llvm/llvm-project/releases/download/llvmorg-$($(package)_version)
ifneq (,$(findstring aarch64,$(BUILD)))
$(package)_file_name=clang+llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
-$(package)_sha256_hash=8ca4d68cf103da8331ca3f35fe23d940c1b78fb7f0d4763c1c059e352f5d1bec
+$(package)_sha256_hash=6dd62762285326f223f40b8e4f2864b5c372de3f7de0731cb7cd55ca5287b75a
else
-$(package)_file_name=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-18.04.tar.xz
-$(package)_sha256_hash=38bc7f5563642e73e69ac5626724e206d6d539fbef653541b34cae0ba9c3f036
+$(package)_file_name=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-22.04.tar.xz
+$(package)_sha256_hash=884ee67d647d77e58740c1e645649e29ae9e8a6fe87c1376be0f3a30f3cc9ab3
endif
define $(package)_stage_cmds
- mkdir -p $($(package)_staging_prefix_dir)/lib/clang/$($(package)_version)/include && \
+ mkdir -p $($(package)_staging_prefix_dir)/lib/clang/$($(package)_major_version)/include && \
mkdir -p $($(package)_staging_prefix_dir)/bin && \
mkdir -p $($(package)_staging_prefix_dir)/include/llvm-c && \
cp bin/clang $($(package)_staging_prefix_dir)/bin/ && \
@@ -20,5 +21,5 @@ define $(package)_stage_cmds
cp include/llvm-c/ExternC.h $($(package)_staging_prefix_dir)/include/llvm-c && \
cp include/llvm-c/lto.h $($(package)_staging_prefix_dir)/include/llvm-c && \
cp lib/libLTO.so $($(package)_staging_prefix_dir)/lib/ && \
- cp -r lib/clang/$($(package)_version)/include/* $($(package)_staging_prefix_dir)/lib/clang/$($(package)_version)/include/
+ cp -r lib/clang/$($(package)_major_version)/include/* $($(package)_staging_prefix_dir)/lib/clang/$($(package)_major_version)/include/
endef
diff --git a/depends/packages/packages.mk b/depends/packages/packages.mk
index dd55c939cb..fb52fd4499 100644
--- a/depends/packages/packages.mk
+++ b/depends/packages/packages.mk
@@ -33,7 +33,7 @@ ifneq ($(build_os),darwin)
darwin_native_packages += native_cctools native_libtapi
ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
-darwin_native_packages+= native_clang
+darwin_native_packages+= native_llvm
endif
endif
diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk
index ecf3334aa5..5608e5f073 100644
--- a/depends/packages/qt.mk
+++ b/depends/packages/qt.mk
@@ -22,8 +22,8 @@ $(package)_patches += fast_fixed_dtoa_no_optimize.patch
$(package)_patches += guix_cross_lib_path.patch
$(package)_patches += fix-macos-linker.patch
$(package)_patches += memory_resource.patch
+$(package)_patches += utc_from_string_no_optimize.patch
$(package)_patches += windows_lto.patch
-$(package)_patches += fix-minimum-macos.patch
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
$(package)_qttranslations_sha256_hash=a31785948c640b7c66d9fe2db4993728ca07f64e41c560b3625ad191b276ff20
@@ -240,7 +240,6 @@ endef
define $(package)_preprocess_cmds
cp $($(package)_patch_dir)/qt.pro qt.pro && \
cp $($(package)_patch_dir)/qttools_src.pro qttools/src/src.pro && \
- patch -p1 -i $($(package)_patch_dir)/fix-minimum-macos.patch && \
patch -p1 -i $($(package)_patch_dir)/fix-macos-linker.patch && \
patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \
patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch && \
@@ -251,6 +250,7 @@ define $(package)_preprocess_cmds
patch -p1 -i $($(package)_patch_dir)/memory_resource.patch && \
patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \
patch -p1 -i $($(package)_patch_dir)/duplicate_lcqpafonts.patch && \
+ patch -p1 -i $($(package)_patch_dir)/utc_from_string_no_optimize.patch && \
patch -p1 -i $($(package)_patch_dir)/fast_fixed_dtoa_no_optimize.patch && \
patch -p1 -i $($(package)_patch_dir)/guix_cross_lib_path.patch && \
patch -p1 -i $($(package)_patch_dir)/windows_lto.patch && \
diff --git a/depends/patches/qt/fix-minimum-macos.patch b/depends/patches/qt/fix-minimum-macos.patch
deleted file mode 100644
index ecaa2ca308..0000000000
--- a/depends/patches/qt/fix-minimum-macos.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Ensure that Qt handles the minimum macOS version properly
-
-This patch can be dropped for LLVM Clang 17+, after commit
-https://github.com/llvm/llvm-project/commit/c8e2dd8c6f490b68e41fe663b44535a8a21dfeab
-
-
---- a/qtbase/src/corelib/global/qsystemdetection.h
-+++ b/qtbase/src/corelib/global/qsystemdetection.h
-@@ -220,6 +220,9 @@
- # include <Availability.h>
- # include <AvailabilityMacros.h>
- #
-+# undef __MAC_OS_X_VERSION_MIN_REQUIRED
-+# define __MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_MIN_REQUIRED
-+#
- # ifdef Q_OS_MACOS
- # if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
- # undef __MAC_OS_X_VERSION_MIN_REQUIRED
diff --git a/depends/patches/qt/utc_from_string_no_optimize.patch b/depends/patches/qt/utc_from_string_no_optimize.patch
new file mode 100644
index 0000000000..533ef59b37
--- /dev/null
+++ b/depends/patches/qt/utc_from_string_no_optimize.patch
@@ -0,0 +1,84 @@
+Modify optimisation flags for various functions.
+This fixes non-determinism issues in the asm produced for
+these function when cross-compiling on x86_64 and aarch64 for
+the arm64-apple-darwin HOST.
+
+--- a/qtbase/src/corelib/itemmodels/qitemselectionmodel.cpp
++++ b/qtbase/src/corelib/itemmodels/qitemselectionmodel.cpp
+@@ -1078,9 +1078,9 @@ void QItemSelectionModelPrivate::_q_layoutChanged(const QList<QPersistentModelIn
+
+ if (hint != QAbstractItemModel::VerticalSortHint) {
+ // sort the "new" selection, as preparation for merging
+- std::stable_sort(savedPersistentIndexes.begin(), savedPersistentIndexes.end(),
++ std::sort(savedPersistentIndexes.begin(), savedPersistentIndexes.end(),
+ qt_PersistentModelIndexLessThan);
+- std::stable_sort(savedPersistentCurrentIndexes.begin(), savedPersistentCurrentIndexes.end(),
++ std::sort(savedPersistentCurrentIndexes.begin(), savedPersistentCurrentIndexes.end(),
+ qt_PersistentModelIndexLessThan);
+
+ // update the selection by merging the individual indexes
+@@ -1092,8 +1092,8 @@ void QItemSelectionModelPrivate::_q_layoutChanged(const QList<QPersistentModelIn
+ savedPersistentCurrentIndexes.clear();
+ } else {
+ // sort the "new" selection, as preparation for merging
+- std::stable_sort(savedPersistentRowLengths.begin(), savedPersistentRowLengths.end());
+- std::stable_sort(savedPersistentCurrentRowLengths.begin(), savedPersistentCurrentRowLengths.end());
++ std::sort(savedPersistentRowLengths.begin(), savedPersistentRowLengths.end());
++ std::sort(savedPersistentCurrentRowLengths.begin(), savedPersistentCurrentRowLengths.end());
+
+ // update the selection by merging the individual indexes
+ ranges = mergeRowLengths(savedPersistentRowLengths);
+
+--- a/qtbase/src/corelib/itemmodels/qitemselectionmodel_p.h
++++ b/qtbase/src/corelib/itemmodels/qitemselectionmodel_p.h
+@@ -76,7 +76,7 @@ public:
+ void _q_rowsAboutToBeInserted(const QModelIndex &parent, int start, int end);
+ void _q_columnsAboutToBeInserted(const QModelIndex &parent, int start, int end);
+ void _q_layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint);
+- void _q_layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint);
++ __attribute__ ((optnone)) void _q_layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint);
+
+ inline void remove(QList<QItemSelectionRange> &r)
+ {
+
+--- a/qtbase/src/corelib/time/qdatetimeparser_p.h
++++ b/qtbase/src/corelib/time/qdatetimeparser_p.h
+@@ -215,7 +215,7 @@ private:
+ : value(ok == Invalid ? -1 : val), used(read), zeroes(zs), state(ok)
+ {}
+ };
+- ParsedSection parseSection(const QDateTime &currentValue, int sectionIndex,
++ __attribute__ ((optnone)) ParsedSection parseSection(const QDateTime &currentValue, int sectionIndex,
+ int offset, QString *text) const;
+ int findMonth(const QString &str1, int monthstart, int sectionIndex,
+ int year, QString *monthName = nullptr, int *used = nullptr) const;
+
+--- a/qtbase/src/corelib/time/qtimezoneprivate_p.h
++++ b/qtbase/src/corelib/time/qtimezoneprivate_p.h
+@@ -191,7 +191,7 @@ public:
+ virtual ~QUtcTimeZonePrivate();
+
+ // Fall-back for UTC[+-]\d+(:\d+){,2} IDs.
+- static qint64 offsetFromUtcString(const QByteArray &id);
++ static __attribute__ ((optnone)) qint64 offsetFromUtcString(const QByteArray &id);
+
+ QUtcTimeZonePrivate *clone() const override;
+
+--- a/qtbase/src/widgets/widgets/qcalendarwidget.cpp
++++ b/qtbase/src/widgets/widgets/qcalendarwidget.cpp
+@@ -329,13 +329,13 @@ class QCalendarYearValidator : public QCalendarDateSectionValidator
+
+ public:
+ QCalendarYearValidator();
+- virtual Section handleKey(int key) override;
++ __attribute__ ((optnone)) virtual Section handleKey(int key) override;
+ virtual QDate applyToDate(QDate date, QCalendar cal) const override;
+ virtual void setDate(QDate date, QCalendar cal) override;
+ virtual QString text() const override;
+ virtual QString text(QDate date, QCalendar cal, int repeat) const override;
+ private:
+- int pow10(int n);
++ __attribute__ ((optnone)) int pow10(int n);
+ int m_pos;
+ int m_year;
+ int m_oldYear;