Skip to content

Commit

Permalink
merge bitcoin#25643: compile FastFixedDtoa with -O1 to fix cross-arch…
Browse files Browse the repository at this point in the history
… reproducibility for arm32
  • Loading branch information
kwvg committed Jun 27, 2023
1 parent fe1972c commit 8136b0b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions depends/packages/qt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ $(package)_patches+= fix_limits_header.patch
$(package)_patches+= fix_montery_include.patch
$(package)_patches += glibc_compatibility.patch
$(package)_patches+= qtbase-moc-ignore-gcc-macro.patch
$(package)_patches += fast_fixed_dtoa_no_optimize.patch

$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
$(package)_qttranslations_sha256_hash=577b0668a777eb2b451c61e8d026d79285371597ce9df06b6dee6c814164b7c3
Expand Down Expand Up @@ -241,6 +242,7 @@ define $(package)_preprocess_cmds
patch -p1 -i $($(package)_patch_dir)/fix_montery_include.patch && \
patch -p1 -i $($(package)_patch_dir)/glibc_compatibility.patch && \
patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \
patch -p1 -i $($(package)_patch_dir)/fast_fixed_dtoa_no_optimize.patch && \
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
Expand Down
20 changes: 20 additions & 0 deletions depends/patches/qt/fast_fixed_dtoa_no_optimize.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Modify the optimisation flags for FastFixedDtoa.
This fixes a non-determinism issue in the asm produced for
this function when cross-compiling on x86_64 and aarch64 for
the arm-linux-gnueabihf HOST.

--- a/qtbase/src/3rdparty/double-conversion/fixed-dtoa.h
+++ b/qtbase/src/3rdparty/double-conversion/fixed-dtoa.h
@@ -48,9 +48,12 @@ namespace double_conversion {
//
// This method only works for some parameters. If it can't handle the input it
// returns false. The output is null-terminated when the function succeeds.
+#pragma GCC push_options
+#pragma GCC optimize ("-O1")
bool FastFixedDtoa(double v, int fractional_count,
Vector<char> buffer, int* length, int* decimal_point);

+#pragma GCC pop_options
} // namespace double_conversion

#endif // DOUBLE_CONVERSION_FIXED_DTOA_H_

0 comments on commit 8136b0b

Please sign in to comment.