Skip to content

Commit abbc170

Browse files
authored
Merge pull request ElementsProject#1432 from tomt1664/merged-master_23.x-pick
merged-master vs. elements-23.x cherry pick
2 parents 0eb2ea5 + 9483c0a commit abbc170

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+826
-343
lines changed

.cirrus.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ task:
9494
CI_VCPKG_TAG: '2021.05.12'
9595
VCPKG_DOWNLOADS: 'C:\Users\ContainerAdministrator\AppData\Local\vcpkg\downloads'
9696
VCPKG_DEFAULT_BINARY_CACHE: 'C:\Users\ContainerAdministrator\AppData\Local\vcpkg\archives'
97-
QT_DOWNLOAD_URL: 'https://download.qt.io/official_releases/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.zip'
98-
QT_LOCAL_PATH: 'C:\qt-everywhere-src-5.15.2.zip'
99-
QT_SOURCE_DIR: 'C:\qt-everywhere-src-5.15.2'
97+
QT_DOWNLOAD_URL: 'https://download.qt.io/official_releases/qt/5.15/5.15.3/single/qt-everywhere-opensource-src-5.15.3.zip'
98+
QT_LOCAL_PATH: 'C:\qt-everywhere-opensource-src-5.15.3.zip'
99+
QT_SOURCE_DIR: 'C:\qt-everywhere-src-5.15.3'
100100
QTBASEDIR: 'C:\Qt_static'
101101
x64_NATIVE_TOOLS: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"'
102102
IgnoreWarnIntDirInTempDetected: 'true'

build_msvc/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Qt
2828
---------------------
2929
To build Bitcoin Core with the GUI, a static build of Qt is required.
3030

31-
1. Download a single ZIP archive of Qt source code from https://download.qt.io/official_releases/qt/ (e.g., [`qt-everywhere-src-5.15.2.zip`](https://download.qt.io/official_releases/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.zip)), and expand it into a dedicated folder. The following instructions assume that this folder is `C:\dev\qt-source`.
31+
1. Download a single ZIP archive of Qt source code from https://download.qt.io/official_releases/qt/ (e.g., [`qt-everywhere-opensource-src-5.15.3.zip`](https://download.qt.io/official_releases/qt/5.15/5.15.3/single/qt-everywhere-opensource-src-5.15.3.zip)), and expand it into a dedicated folder. The following instructions assume that this folder is `C:\dev\qt-source`.
3232

3333
2. Open "x64 Native Tools Command Prompt for VS 2019", and input the following commands:
3434
```cmd
@@ -83,4 +83,4 @@ If is it enabled then in the output `Dynamic base` will be listed in the `DLL ch
8383
Terminal Server Aware
8484
```
8585

86-
This may not disable all stack randomization as versions of windows employ additional stack randomization protections. These protections must be turned off in the OS configuration.
86+
This may not disable all stack randomization as versions of windows employ additional stack randomization protections. These protections must be turned off in the OS configuration.

build_msvc/test_bitcoin-qt/test_bitcoin-qt.vcxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<ClCompile Include="..\..\src\test\util\setup_common.cpp" />
1414
<ClCompile Include="..\..\src\qt\test\addressbooktests.cpp" />
1515
<ClCompile Include="..\..\src\qt\test\apptests.cpp" />
16+
<ClCompile Include="..\..\src\qt\test\optiontests.cpp" />
1617
<ClCompile Include="..\..\src\qt\test\rpcnestedtests.cpp" />
1718
<ClCompile Include="..\..\src\qt\test\test_main.cpp" />
1819
<ClCompile Include="..\..\src\qt\test\uritests.cpp" />
@@ -21,6 +22,7 @@
2122
<ClCompile Include="..\..\src\wallet\test\wallet_test_fixture.cpp" />
2223
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_addressbooktests.cpp" />
2324
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_apptests.cpp" />
25+
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_optiontests.cpp" />
2426
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_rpcnestedtests.cpp" />
2527
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_uritests.cpp" />
2628
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_wallettests.cpp" />
@@ -90,6 +92,7 @@
9092
<ItemGroup>
9193
<MocTestFiles Include="..\..\src\qt\test\addressbooktests.h" />
9294
<MocTestFiles Include="..\..\src\qt\test\apptests.h" />
95+
<MocTestFiles Include="..\..\src\qt\test\optiontests.h" />
9396
<MocTestFiles Include="..\..\src\qt\test\rpcnestedtests.h" />
9497
<MocTestFiles Include="..\..\src\qt\test\uritests.h" />
9598
<MocTestFiles Include="..\..\src\qt\test\wallettests.h" />

ci/test/04_install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if [[ $QEMU_USER_CMD == qemu-s390* ]]; then
1111
fi
1212

1313
if [ "$CI_OS_NAME" == "macos" ]; then
14-
sudo -H pip3 install --upgrade --break-system-packages pip
14+
sudo -H pip3 install --upgrade pip
1515
# shellcheck disable=SC2086
1616
IN_GETOPT_BIN="$(brew --prefix gnu-getopt)/bin/getopt" ${CI_RETRY_EXE} pip3 install --user $PIP_PACKAGES
1717
fi

configure.ac

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,10 +738,6 @@ case $host in
738738
BDB_LIBS="-L$bdb_prefix/lib -ldb_cxx-4.8"
739739
fi
740740

741-
if test "$use_sqlite" != "no" && $BREW list --versions sqlite3 >/dev/null; then
742-
export PKG_CONFIG_PATH="$($BREW --prefix sqlite3 2>/dev/null)/lib/pkgconfig:$PKG_CONFIG_PATH"
743-
fi
744-
745741
if $BREW list --versions qt@5 >/dev/null; then
746742
export PKG_CONFIG_PATH="$($BREW --prefix qt@5 2>/dev/null)/lib/pkgconfig:$PKG_CONFIG_PATH"
747743
fi

contrib/guix/guix-codesign

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ outdir_for_host() {
152152
unsigned_tarball_for_host() {
153153
case "$1" in
154154
*mingw*)
155-
echo "$(outdir_for_host "$1")/${DISTNAME}-win-unsigned.tar.gz"
155+
echo "$(outdir_for_host "$1")/${DISTNAME}-win64-unsigned.tar.gz"
156156
;;
157157
*darwin*)
158-
echo "$(outdir_for_host "$1")/${DISTNAME}-osx-unsigned.tar.gz"
158+
echo "$(outdir_for_host "$1")/${DISTNAME}-${1}-unsigned.tar.gz"
159159
;;
160160
*)
161161
exit 1
@@ -227,7 +227,7 @@ SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(git -c log.showSignature=false log --f
227227
time-machine() {
228228
# shellcheck disable=SC2086
229229
guix time-machine --url=https://git.savannah.gnu.org/git/guix.git \
230-
--commit=aa34d4d28dfe25ba47d5800d05000fb7221788c0 \
230+
--commit=ae03f401381e956c4c41b4cf495cbde964fa43d0 \
231231
--cores="$JOBS" \
232232
--keep-failed \
233233
--fallback \

contrib/guix/libexec/build.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,10 @@ mkdir -p "$DISTSRC"
348348
find . -print0 \
349349
| sort --zero-terminated \
350350
| tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \
351-
| gzip -9n > "${OUTDIR}/${DISTNAME}-osx-unsigned.tar.gz" \
352-
|| ( rm -f "${OUTDIR}/${DISTNAME}-osx-unsigned.tar.gz" && exit 1 )
351+
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" \
352+
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" && exit 1 )
353353
)
354-
make deploy ${V:+V=1} OSX_DMG="${OUTDIR}/${DISTNAME}-osx-unsigned.dmg"
354+
make deploy ${V:+V=1} OSX_DMG="${OUTDIR}/${DISTNAME}-${HOST}-unsigned.dmg"
355355
;;
356356
esac
357357
(
@@ -423,8 +423,8 @@ mkdir -p "$DISTSRC"
423423
find "${DISTNAME}" -print0 \
424424
| sort --zero-terminated \
425425
| tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \
426-
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST//x86_64-apple-darwin/osx64}.tar.gz" \
427-
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST//x86_64-apple-darwin/osx64}.tar.gz" && exit 1 )
426+
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}.tar.gz" \
427+
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}.tar.gz" && exit 1 )
428428
;;
429429
esac
430430
) # $DISTSRC/installed
@@ -439,8 +439,8 @@ mkdir -p "$DISTSRC"
439439
find . -print0 \
440440
| sort --zero-terminated \
441441
| tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \
442-
| gzip -9n > "${OUTDIR}/${DISTNAME}-win-unsigned.tar.gz" \
443-
|| ( rm -f "${OUTDIR}/${DISTNAME}-win-unsigned.tar.gz" && exit 1 )
442+
| gzip -9n > "${OUTDIR}/${DISTNAME}-win64-unsigned.tar.gz" \
443+
|| ( rm -f "${OUTDIR}/${DISTNAME}-win64-unsigned.tar.gz" && exit 1 )
444444
)
445445
;;
446446
esac

contrib/guix/libexec/codesign.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ mkdir -p "$DISTSRC"
9191
-- -volume_date all_file_dates ="$SOURCE_DATE_EPOCH"
9292

9393
# Compress uncompressed.dmg and output to OUTDIR
94-
./dmg dmg uncompressed.dmg "${OUTDIR}/${DISTNAME}-osx-signed.dmg"
94+
./dmg dmg uncompressed.dmg "${OUTDIR}/${DISTNAME}-${HOST}.dmg"
9595
;;
9696
*)
9797
exit 1

contrib/guix/manifest.scm

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ http://www.linuxfromscratch.org/hlfs/view/development/chapter05/gcc-pass1.html"
7878
(("-rpath=") "-rpath-link="))
7979
#t))))))))
8080

81+
(define building-on (string-append (list-ref (string-split (%current-system) #\-) 0) "-guix-linux-gnu"))
82+
83+
(define (explicit-cross-configure package)
84+
(package-with-extra-configure-variable package "--build" building-on))
85+
8186
(define (make-cross-toolchain target
8287
base-gcc-for-libc
8388
base-kernel-headers
@@ -87,9 +92,9 @@ http://www.linuxfromscratch.org/hlfs/view/development/chapter05/gcc-pass1.html"
8792
(let* ((xbinutils (cross-binutils target))
8893
;; 1. Build a cross-compiling gcc without targeting any libc, derived
8994
;; from BASE-GCC-FOR-LIBC
90-
(xgcc-sans-libc (cross-gcc target
91-
#:xgcc base-gcc-for-libc
92-
#:xbinutils xbinutils))
95+
(xgcc-sans-libc (explicit-cross-configure (cross-gcc target
96+
#:xgcc base-gcc-for-libc
97+
#:xbinutils xbinutils)))
9398
;; 2. Build cross-compiled kernel headers with XGCC-SANS-LIBC, derived
9499
;; from BASE-KERNEL-HEADERS
95100
(xkernel (cross-kernel-headers target
@@ -98,17 +103,17 @@ http://www.linuxfromscratch.org/hlfs/view/development/chapter05/gcc-pass1.html"
98103
xbinutils))
99104
;; 3. Build a cross-compiled libc with XGCC-SANS-LIBC and XKERNEL,
100105
;; derived from BASE-LIBC
101-
(xlibc (cross-libc target
102-
base-libc
103-
xgcc-sans-libc
104-
xbinutils
105-
xkernel))
106+
(xlibc (explicit-cross-configure (cross-libc target
107+
base-libc
108+
xgcc-sans-libc
109+
xbinutils
110+
xkernel)))
106111
;; 4. Build a cross-compiling gcc targeting XLIBC, derived from
107112
;; BASE-GCC
108-
(xgcc (cross-gcc target
109-
#:xgcc base-gcc
110-
#:xbinutils xbinutils
111-
#:libc xlibc)))
113+
(xgcc (explicit-cross-configure (cross-gcc target
114+
#:xgcc base-gcc
115+
#:xbinutils xbinutils
116+
#:libc xlibc))))
112117
;; Define a meta-package that propagates the resulting XBINUTILS, XLIBC, and
113118
;; XGCC
114119
(package
@@ -166,13 +171,18 @@ desirable for building Bitcoin Core release binaries."
166171
(define (make-gcc-without-newlib gcc)
167172
(package-with-extra-configure-variable gcc "--with-newlib" "no"))
168173

174+
(define (make-mingw-w64-cross-gcc cross-gcc)
175+
(package-with-extra-patches cross-gcc
176+
(search-our-patches "vmov-alignment.patch"
177+
"gcc-broken-longjmp.patch")))
178+
169179
(define (make-mingw-pthreads-cross-toolchain target)
170180
"Create a cross-compilation toolchain package for TARGET"
171181
(let* ((xbinutils (cross-binutils target))
172182
(pthreads-xlibc mingw-w64-x86_64-winpthreads)
173183
(pthreads-xgcc (make-gcc-with-pthreads
174184
(cross-gcc target
175-
#:xgcc (make-gcc-without-newlib (make-ssp-fixed-gcc base-gcc))
185+
#:xgcc (make-gcc-without-newlib (make-ssp-fixed-gcc (make-mingw-w64-cross-gcc base-gcc)))
176186
#:xbinutils xbinutils
177187
#:libc pthreads-xlibc))))
178188
;; Define a meta-package that propagates the resulting XBINUTILS, XLIBC, and
@@ -196,7 +206,8 @@ chain for " target " development."))
196206

197207
(define (make-nsis-for-gcc-10 base-nsis)
198208
(package-with-extra-patches base-nsis
199-
(search-our-patches "nsis-gcc-10-memmove.patch")))
209+
(search-our-patches "nsis-gcc-10-memmove.patch"
210+
"nsis-disable-installer-reloc.patch")))
200211

201212
(define-public lief
202213
(package
@@ -490,7 +501,7 @@ and endian independent.")
490501
(license license:expat)))
491502

492503
(define-public python-signapple
493-
(let ((commit "b084cbbf44d5330448ffce0c7d118f75781b64bd"))
504+
(let ((commit "8a945a2e7583be2665cf3a6a89d665b70ecd1ab6"))
494505
(package
495506
(name "python-signapple")
496507
(version (git-version "0.1" "1" commit))
@@ -503,7 +514,7 @@ and endian independent.")
503514
(file-name (git-file-name name commit))
504515
(sha256
505516
(base32
506-
"0k7inccl2mzac3wq4asbr0kl8s4cghm8982z54kfascqg45shv01"))))
517+
"0fr1hangvfyiwflca6jg5g8zvg3jc9qr7vd2c12ff89pznf38dlg"))))
507518
(build-system python-build-system)
508519
(propagated-inputs
509520
`(("python-asn1crypto" ,python-asn1crypto)
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
commit eb5698897c52702498938592d7f76e67d126451f
2+
Author: Eric Botcazou <[email protected]>
3+
Date: Wed May 5 22:48:51 2021 +0200
4+
5+
Fix PR target/100402
6+
7+
This is a regression for 64-bit Windows present from mainline down to the 9
8+
branch and introduced by the fix for PR target/99234. Again SEH, but with
9+
a twist related to the way MinGW implements setjmp/longjmp, which turns out
10+
to be piggybacked on SEH with recent versions of MinGW, i.e. the longjmp
11+
performs a bona-fide unwinding of the stack, because it calls RtlUnwindEx
12+
with the second argument initially passed to setjmp, which is the result of
13+
__builtin_frame_address (0) in the MinGW header file:
14+
15+
define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0))
16+
17+
This means that we directly expose the frame pointer to the SEH machinery
18+
here (unlike with regular exception handling where we use an intermediate
19+
CFA) and thus that we cannot do whatever we want with it. The old code
20+
would leave it unaligned, i.e. not multiple of 16, whereas the new code
21+
aligns it, but this breaks for some reason; at least it appears that a
22+
.seh_setframe directive with 0 as second argument always works, so the
23+
fix aligns it this way.
24+
25+
gcc/
26+
PR target/100402
27+
* config/i386/i386.c (ix86_compute_frame_layout): For a SEH target,
28+
always return the establisher frame for __builtin_frame_address (0).
29+
gcc/testsuite/
30+
* gcc.c-torture/execute/20210505-1.c: New test.
31+
32+
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
33+
index 2f838840e96..06ad1b2274e 100644
34+
--- a/gcc/config/i386/i386.c
35+
+++ b/gcc/config/i386/i386.c
36+
@@ -6356,12 +6356,29 @@ ix86_compute_frame_layout (void)
37+
area, see the SEH code in config/i386/winnt.c for the rationale. */
38+
frame->hard_frame_pointer_offset = frame->sse_reg_save_offset;
39+
40+
- /* If we can leave the frame pointer where it is, do so. Also, return
41+
+ /* If we can leave the frame pointer where it is, do so; however return
42+
the establisher frame for __builtin_frame_address (0) or else if the
43+
- frame overflows the SEH maximum frame size. */
44+
+ frame overflows the SEH maximum frame size.
45+
+
46+
+ Note that the value returned by __builtin_frame_address (0) is quite
47+
+ constrained, because setjmp is piggybacked on the SEH machinery with
48+
+ recent versions of MinGW:
49+
+
50+
+ # elif defined(__SEH__)
51+
+ # if defined(__aarch64__) || defined(_ARM64_)
52+
+ # define setjmp(BUF) _setjmp((BUF), __builtin_sponentry())
53+
+ # elif (__MINGW_GCC_VERSION < 40702)
54+
+ # define setjmp(BUF) _setjmp((BUF), mingw_getsp())
55+
+ # else
56+
+ # define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0))
57+
+ # endif
58+
+
59+
+ and the second argument passed to _setjmp, if not null, is forwarded
60+
+ to the TargetFrame parameter of RtlUnwindEx by longjmp (after it has
61+
+ built an ExceptionRecord on the fly describing the setjmp buffer). */
62+
const HOST_WIDE_INT diff
63+
= frame->stack_pointer_offset - frame->hard_frame_pointer_offset;
64+
- if (diff <= 255)
65+
+ if (diff <= 255 && !crtl->accesses_prior_frames)
66+
{
67+
/* The resulting diff will be a multiple of 16 lower than 255,
68+
i.e. at most 240 as required by the unwind data structure. */
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Patch NSIS so that it's installer stubs, produced at NSIS build time,
2+
do not contain .reloc sections, which will exist by default when using
3+
binutils/ld 2.36+.
4+
5+
This ultimately fixes an issue when running the installer with the
6+
"Force randomization for images (Mandatory ASLR)" setting active.
7+
8+
This patch has not yet been sent upstream, because it's not clear if this
9+
is the best fix, for the underlying issue, which seems to be that makensis
10+
doesn't account for .reloc sections when it builds installers.
11+
12+
The existence of a reloc section shouldn't be a problem, and, if anything,
13+
is actually a requirement for working ASLR. All other Windows binaries we
14+
produce contain them, and function correctly when under the same
15+
"Force randomization for images (Mandatory ASLR)" setting.
16+
17+
See:
18+
https://github.com/bitcoin/bitcoin/issues/25726
19+
https://sourceforge.net/p/nsis/bugs/1131/
20+
21+
--- a/SCons/Config/gnu
22+
+++ b/SCons/Config/gnu
23+
@@ -102,6 +102,7 @@ stub_env.Append(LINKFLAGS = ['-mwindows']) # build windows executables
24+
stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no standard libraries
25+
stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
26+
stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
27+
+stub_env.Append(LINKFLAGS = ['-Wl,--disable-reloc-section'])
28+
29+
conf = FlagsConfigure(stub_env)
30+
conf.CheckCompileFlag('-fno-tree-loop-distribute-patterns') # GCC 10: Don't generate msvcrt!memmove calls (bug #1248)

0 commit comments

Comments
 (0)