Skip to content

Commit ac83524

Browse files
MarcoFalkeportlandhodl
authored andcommitted
parent 10f629e
author MarcoFalke <falke.marco@gmail.com> 1649237525 +0200 committer russeree <reese.russell@ymail.com> 1650013843 -0700 parent 10f629e author MarcoFalke <falke.marco@gmail.com> 1649237525 +0200 committer russeree <reese.russell@ymail.com> 1650013815 -0700 parent 10f629e author MarcoFalke <falke.marco@gmail.com> 1649237525 +0200 committer russeree <reese.russell@ymail.com> 1650013794 -0700 ci: Build all optional tools in tidy task lint: remove boost::bind linter I don't think we need to maintain a linter for reintroducing boost::bind at this point. doc: Convert remaining comments to clang-tidy format [docs] package feerate [packages/policy] use package feerate in package validation This allows CPFP within a package prior to submission to mempool. [validation] try individual validation before package validation This avoids "parents pay for children" and "siblings pay for siblings" behavior, since package feerate is calculated with totals and is topology-unaware. It also ensures that package validation never causes us to reject a transaction that we would have otherwise accepted in single-tx validation. [unit test] package feerate and package cpfp [validation] don't package validate if not policy or missing inputs Package validation policy only differs from individual policy in its evaluation of feerate. Minimize DoS surface; don't validate all over again if we know the result will be the same. lint: remove qt SIGNAL/SLOT lint I think we are past the point where we need to lint for this, the CPU can probably be better utilized. refactor: Remove deduplication of data in rollingbloom bench lint: codespell 2.1.0 lint: flake8 4.0.1 lint: mypy 0.942 refactor: fixup named args in txpackage tests Regression in bitcoin#24152. Put lock logging behind DEBUG_LOCKCONTENTION preprocessor directive Add DEBUG_LOCKCONTENTION documentation to the developer notes Squash Squashed All Previous Commits RPC: Switch getblockfrompeer back to standard param name blockhash This commit partially reverts 923312f. Update RPC argument and field naming guideline in developer notes Co-authored-by: laanwj <126646+laanwj@users.noreply.github.com> build: fix MSVC build after subtree update Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Co-authored-by: Aaron Clauson <aaron@sipsorcery.com> build: remove --enable-experimental from libsecp256k1 configure build: remove some no-longer-needed var unexporting from configure key: use secp256k1_schnorrsig_sign32 over deprecated secp256k1_schnorrsig_sign The renaming occured in bitcoin-core/secp256k1#1089. Squased lint changes - added features Squashed to reduce spam - added features Loading ASN directory from a .tsv file. Added the use of a GZIP compressed ip -> ASN file. LINT Fixes - 7 words Fixed comparison to none using 'is' instead of '==' Fixed unintended changes to readme.md whitespace correction restored generate-seeds.py restored makeseeds.py Fixed a missing return type within exception Removed unused variable and if __main__ Updated to fetch and included legacy failover LINT fixes LINT fixes Squash - Too many commits Python include dns.resolver Failover implementation complete Removed DNS resolver Revert changes refactor: Remove deduplication of data in rollingbloom bench lint: mypy 0.942 refactor: fixup named args in txpackage tests Regression in bitcoin#24152. Put lock logging behind DEBUG_LOCKCONTENTION preprocessor directive Add DEBUG_LOCKCONTENTION documentation to the developer notes Squash Squashed All Previous Commits RPC: Switch getblockfrompeer back to standard param name blockhash This commit partially reverts 923312f. Update RPC argument and field naming guideline in developer notes Co-authored-by: laanwj <126646+laanwj@users.noreply.github.com> build: fix MSVC build after subtree update Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Co-authored-by: Aaron Clauson <aaron@sipsorcery.com> build: remove --enable-experimental from libsecp256k1 configure build: remove some no-longer-needed var unexporting from configure key: use secp256k1_schnorrsig_sign32 over deprecated secp256k1_schnorrsig_sign The renaming occured in bitcoin-core/secp256k1#1089. Squased lint changes - added features Squashed to reduce spam - added features Loading ASN directory from a .tsv file. Added the use of a GZIP compressed ip -> ASN file. LINT Fixes - 7 words Fixed comparison to none using 'is' instead of '==' Fixed unintended changes to readme.md whitespace correction restored generate-seeds.py restored makeseeds.py Fixed a missing return type within exception Removed unused variable and if __main__ Updated to fetch and included legacy failover LINT fixes LINT fixes Squash - Too many commits Python include dns.resolver Failover implementation complete Removed DNS resolver Revert changes Put lock logging behind DEBUG_LOCKCONTENTION preprocessor directive Add DEBUG_LOCKCONTENTION documentation to the developer notes Squash Squashed All Previous Commits RPC: Switch getblockfrompeer back to standard param name blockhash This commit partially reverts 923312f. Update RPC argument and field naming guideline in developer notes Co-authored-by: laanwj <126646+laanwj@users.noreply.github.com> build: fix MSVC build after subtree update Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Co-authored-by: Aaron Clauson <aaron@sipsorcery.com> build: remove --enable-experimental from libsecp256k1 configure build: remove some no-longer-needed var unexporting from configure key: use secp256k1_schnorrsig_sign32 over deprecated secp256k1_schnorrsig_sign The renaming occured in bitcoin-core/secp256k1#1089. Squased lint changes - added features Squashed to reduce spam - added features Loading ASN directory from a .tsv file. Added the use of a GZIP compressed ip -> ASN file. LINT Fixes - 7 words Fixed comparison to none using 'is' instead of '==' Fixed unintended changes to readme.md whitespace correction restored generate-seeds.py restored makeseeds.py Fixed a missing return type within exception Removed unused variable and if __main__ Updated to fetch and included legacy failover LINT fixes LINT fixes Squash - Too many commits Python include dns.resolver Failover implementation complete Removed DNS resolver Revert changes RPC: Switch getblockfrompeer back to standard param name blockhash This commit partially reverts 923312f. Update RPC argument and field naming guideline in developer notes Co-authored-by: laanwj <126646+laanwj@users.noreply.github.com> build: fix MSVC build after subtree update Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Co-authored-by: Aaron Clauson <aaron@sipsorcery.com> build: remove --enable-experimental from libsecp256k1 configure build: remove some no-longer-needed var unexporting from configure key: use secp256k1_schnorrsig_sign32 over deprecated secp256k1_schnorrsig_sign The renaming occured in bitcoin-core/secp256k1#1089. test: compare `/chaininfo` response with `getblockchaininfo` RPC test: use MiniWallet for feature_fee_estimation.py This test can now be run even with the Bitcoin Core wallet disabled. Converted lint-python-mutable-default-parameters.sh to python Change permission Change argument so that it's compatiable with python 3.6 Change comment to docstring Remove .split, .append, .extend calls. Remove 'output' variable assignment build: Do not define `PROVIDE_FUZZ_MAIN_FUNCTION` macro unconditionally builder-keys: Add will8clark gui: add FormatPeerAge() utility helper Co-authored-by: randymcmillan <randy.lee.mcmillan@gmail.com> gui: add Age column to peers tab Co-authored-by: Jon Atack <jon@atack.com> gui: peersWidget - ResizeToContents Age and IP/Netmask columns Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> gui: add test runner summary gui: count test failures in test runner summary gui, refactor: rename fInvalid to num_test_failures in test_main.cpp qt: Fix headers This change is preparation for Qt 6, and it fixes an experimental build with Qt 6.2.4. qt: Use `|` instead of `+` for key modifiers This change is preparation for Qt 6 where `+` has been deprecated, and it fixes an experimental build with Qt 6.2.4. qt: Update deprecated enum value This change is preparation for Qt 6, and it fixes an experimental build with Qt 6.2.4. The `Qt::ItemIsTristate` value has been deprecated since 5.6.0 (see ae8406d82f541f6d9112bdac192e5e4e114d56aa upstream commit). print `(none)` if no warnings in -getinfo build, refactor: Drop useless `call` Make function util, refactor: Add UNIQUE_NAME helper macro This change replaces repetitive code with a helper macro. Replace uint256 specific implementations of base_uint::GetHex() and base_uint::SetHex() with proper ones that don't depend on uint256 and replace template methods instantiations of base_uint with template class instantiation guix: fix GCC 10.3.0 + mingw-w64 setjmp/longjmp issues This commit backports a patch to the GCC 10.3.0 we build for Windows cross-compilation in Guix. The commit has been backported to the GCC releases/gcc-10 branch, but hasn't yet made it into a release. The patch corrects a regression from an earlier GCC commit, see: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=357c4350680bf29f0c7a115424e3da11c53b5582 and https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=074226d5aa86cd3de517014acfe34c7f69a2ccc7, related to the way newer versions of mingw-w64 implement setjmp/longjmp. Ultimately this was causing a crash for us when Windows users were viewing the network traffic tab inside the GUI. After some period, long enough that a buffer would need reallocating, a call into FreeTypes gray_record_cell() would result in a call to ft_longjmp (longjmp), which would then trigger a crash. Fixes: bitcoin-core/gui#582. See also: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=e8d1ca7d2c344a411779892616c423e157f4aea8. https://bugreports.qt.io/browse/QTBUG-93476. doc: Remove fee delta TODO from txmempool.cpp net: remove non-blocking bool from interface lint: Convert lint-logs.sh to Python test: determine path to `bitcoin-util` in test framework The path is stored in `self.options.bitcoinutil`, points to `src/bitcoin-util` by default and can be overrided with the `BITCOINUTIL` environment variable. test: add `is_bitcoin_util_compiled` helper test: add test for signet miner script depends: Add file-based logging for individual packages ci: Make log verbose in error case only This change silences depends build using LOG=1. doc: Add pre-splitoff translation update to release-process.md
1 parent 10f629e commit ac83524

Some content is hidden

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

73 files changed

+1069
-408
lines changed

Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ DIST_CONTRIB = \
4747
$(top_srcdir)/test/sanitizer_suppressions/tsan \
4848
$(top_srcdir)/test/sanitizer_suppressions/ubsan \
4949
$(top_srcdir)/contrib/linearize/linearize-data.py \
50-
$(top_srcdir)/contrib/linearize/linearize-hashes.py
50+
$(top_srcdir)/contrib/linearize/linearize-hashes.py \
51+
$(top_srcdir)/contrib/signet/miner
5152

5253
DIST_SHARE = \
5354
$(top_srcdir)/share/genbuild.sh \

build_msvc/libsecp256k1/libsecp256k1.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<ConfigurationType>StaticLibrary</ConfigurationType>
99
</PropertyGroup>
1010
<ItemGroup>
11+
<ClCompile Include="..\..\src\secp256k1\src\precomputed_ecmult.c" />
12+
<ClCompile Include="..\..\src\secp256k1\src\precomputed_ecmult_gen.c" />
1113
<ClCompile Include="..\..\src\secp256k1\src\secp256k1.c" />
1214
</ItemGroup>
1315
<ItemDefinitionGroup>

ci/lint/04_install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ ${CI_RETRY_EXE} apt-get install -y clang-format-9 python3-pip curl git gawk jq
1111
update-alternatives --install /usr/bin/clang-format clang-format "$(which clang-format-9 )" 100
1212
update-alternatives --install /usr/bin/clang-format-diff clang-format-diff "$(which clang-format-diff-9)" 100
1313

14-
${CI_RETRY_EXE} pip3 install codespell==2.0.0
15-
${CI_RETRY_EXE} pip3 install flake8==3.8.3
16-
${CI_RETRY_EXE} pip3 install mypy==0.910
14+
${CI_RETRY_EXE} pip3 install codespell==2.1.0
15+
${CI_RETRY_EXE} pip3 install flake8==4.0.1
16+
${CI_RETRY_EXE} pip3 install mypy==0.942
1717
${CI_RETRY_EXE} pip3 install pyzmq==22.3.0
1818
${CI_RETRY_EXE} pip3 install vulture==2.3
1919

ci/test/00_setup_env_native_tidy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ export LC_ALL=C.UTF-8
88

99
export DOCKER_NAME_TAG="ubuntu:22.04"
1010
export CONTAINER_NAME=ci_native_tidy
11-
export PACKAGES="clang llvm clang-tidy bear libevent-dev libboost-dev"
11+
export PACKAGES="clang llvm clang-tidy bear libevent-dev libboost-dev libminiupnpc-dev libnatpmp-dev libzmq3-dev systemtap-sdt-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libqrencode-dev libsqlite3-dev libdb++-dev"
1212
export NO_DEPENDS=1
1313
export RUN_UNIT_TESTS=false
1414
export RUN_FUNCTIONAL_TESTS=false
1515
export RUN_FUZZ_TESTS=false
1616
export RUN_TIDY=true
1717
export GOAL="install"
18-
export BITCOIN_CONFIG="CC=clang CXX=clang++ --disable-hardening CFLAGS='-O0 -g0' CXXFLAGS='-O0 -g0'"
18+
export BITCOIN_CONFIG="CC=clang CXX=clang++ --with-incompatible-bdb --disable-hardening CFLAGS='-O0 -g0' CXXFLAGS='-O0 -g0'"
1919
export CCACHE_SIZE=200M

ci/test/05_before_script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if [ -z "$NO_DEPENDS" ]; then
4545
else
4646
SHELL_OPTS="CONFIG_SHELL="
4747
fi
48-
CI_EXEC "$SHELL_OPTS" make "$MAKEJOBS" -C depends HOST="$HOST" "$DEP_OPTS"
48+
CI_EXEC "$SHELL_OPTS" make "$MAKEJOBS" -C depends HOST="$HOST" "$DEP_OPTS" LOG=1
4949
fi
5050
if [ -n "$PREVIOUS_RELEASES_TO_DOWNLOAD" ]; then
5151
CI_EXEC test/get_previous_releases.py -b -t "$PREVIOUS_RELEASES_DIR" "${PREVIOUS_RELEASES_TO_DOWNLOAD}"

configure.ac

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ case $host in
361361
esac
362362

363363
if test "$enable_debug" = "yes"; then
364-
dnl If debugging is enabled, and the user hasn't overriden CXXFLAGS, clear
364+
dnl If debugging is enabled, and the user hasn't overridden CXXFLAGS, clear
365365
dnl them, to prevent autoconfs "-g -O2" being added. Otherwise we'd end up
366366
dnl with "-O0 -g3 -g -O2".
367367
if test "$CXXFLAGS_overridden" = "no"; then
@@ -857,7 +857,7 @@ if test "$use_lcov" = "yes"; then
857857
[AC_MSG_ERROR([lcov testing requested but --coverage linker flag does not work])])
858858
AX_CHECK_COMPILE_FLAG([--coverage],[CORE_CXXFLAGS="$CORE_CXXFLAGS --coverage"],
859859
[AC_MSG_ERROR([lcov testing requested but --coverage flag does not work])])
860-
dnl If coverage is enabled, and the user hasn't overriden CXXFLAGS, clear
860+
dnl If coverage is enabled, and the user hasn't overridden CXXFLAGS, clear
861861
dnl them, to prevent autoconfs "-g -O2" being added. Otherwise we'd end up
862862
dnl with "--coverage -Og -O0 -g -O2".
863863
if test "$CXXFLAGS_overridden" = "no"; then
@@ -1300,21 +1300,6 @@ if test "$enable_fuzz" = "yes"; then
13001300
enable_fuzz_binary=yes
13011301

13021302
AX_CHECK_PREPROC_FLAG([-DABORT_ON_FAILED_ASSUME], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DABORT_ON_FAILED_ASSUME"], [], [$CXXFLAG_WERROR])
1303-
1304-
AC_MSG_CHECKING([whether main function is needed for fuzz binary])
1305-
AX_CHECK_LINK_FLAG(
1306-
[-fsanitize=$use_sanitizers],
1307-
[AC_MSG_RESULT([no])],
1308-
[AC_MSG_RESULT([yes]); CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"],
1309-
[],
1310-
[AC_LANG_PROGRAM([[
1311-
#include <cstdint>
1312-
#include <cstddef>
1313-
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { return 0; }
1314-
/* comment to remove the main function ...
1315-
]],[[
1316-
*/ int not_main() {
1317-
]])])
13181303
else
13191304
BITCOIN_QT_INIT
13201305

@@ -1328,8 +1313,25 @@ else
13281313
QT_DBUS_INCLUDES=SUPPRESS_WARNINGS($QT_DBUS_INCLUDES)
13291314
QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES)
13301315
fi
1316+
fi
1317+
1318+
if test "$enable_fuzz_binary" = "yes"; then
1319+
AC_MSG_CHECKING([whether main function is needed for fuzz binary])
1320+
AX_CHECK_LINK_FLAG(
1321+
[],
1322+
[AC_MSG_RESULT([no])],
1323+
[AC_MSG_RESULT([yes]); CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"],
1324+
[$SANITIZER_LDFLAGS],
1325+
[AC_LANG_PROGRAM([[
1326+
#include <cstdint>
1327+
#include <cstddef>
1328+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; }
1329+
/* comment to remove the main function ...
1330+
]],[[
1331+
*/ int not_main() {
1332+
]])])
13311333

1332-
CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"
1334+
CHECK_RUNTIME_LIB
13331335
fi
13341336

13351337
if test "$enable_wallet" != "no"; then
@@ -1819,10 +1821,6 @@ if test "$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoin_
18191821
AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-libs --with-daemon --with-gui --enable-bench or --enable-tests])
18201822
fi
18211823

1822-
if test "$enable_fuzz_binary" = "yes"; then
1823-
CHECK_RUNTIME_LIB
1824-
fi
1825-
18261824
AM_CONDITIONAL([TARGET_DARWIN], [test "$TARGET_OS" = "darwin"])
18271825
AM_CONDITIONAL([BUILD_DARWIN], [test "$BUILD_OS" = "darwin"])
18281826
AM_CONDITIONAL([TARGET_LINUX], [test "$TARGET_OS" = "linux"])
@@ -1959,15 +1957,7 @@ LIBS_TEMP="$LIBS"
19591957
unset LIBS
19601958
LIBS="$LIBS_TEMP"
19611959

1962-
PKGCONFIG_PATH_TEMP="$PKG_CONFIG_PATH"
1963-
unset PKG_CONFIG_PATH
1964-
PKG_CONFIG_PATH="$PKGCONFIG_PATH_TEMP"
1965-
1966-
PKGCONFIG_LIBDIR_TEMP="$PKG_CONFIG_LIBDIR"
1967-
unset PKG_CONFIG_LIBDIR
1968-
PKG_CONFIG_LIBDIR="$PKGCONFIG_LIBDIR_TEMP"
1969-
1970-
ac_configure_args="${ac_configure_args} --disable-shared --with-pic --enable-benchmark=no --enable-module-recovery --enable-module-schnorrsig --enable-experimental"
1960+
ac_configure_args="${ac_configure_args} --disable-shared --with-pic --enable-benchmark=no --enable-module-recovery --enable-module-schnorrsig"
19711961
AC_CONFIG_SUBDIRS([src/secp256k1])
19721962

19731963
AC_OUTPUT

contrib/builder-keys/keys.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ ED9BDF7AD6A55E232E84524257FF9BDBCC301009 Sjors Provoost (sjors)
5151
9EDAFF80E080659604F4A76B2EBB056FD847F8A7 Stephan Oeste (Emzy)
5252
6DEEF79B050C4072509B743F8C275BC595448867 Tomas Kanocz (KanoczTomas)
5353
AEC1884398647C47413C1C3FB1179EB7347DC10D Warren Togami (wtogami)
54+
74E2DEF5D77260B98BC19438099BAD163C70FBFA Will Clark (will8clark)
5455
79D00BAC68B56D422F945A8F8E3A8F3247DBCBBF Willy Ko (willyko)
5556
71A3B16735405025D447E8F274810B012346C9A6 Wladimir J. van der Laan (laanwj)

contrib/guix/manifest.scm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,18 @@ desirable for building Bitcoin Core release binaries."
162162
(define (make-gcc-with-pthreads gcc)
163163
(package-with-extra-configure-variable gcc "--enable-threads" "posix"))
164164

165-
(define (make-mingw-w64-cross-gcc-vmov-alignment cross-gcc)
165+
(define (make-mingw-w64-cross-gcc cross-gcc)
166166
(package-with-extra-patches cross-gcc
167-
(search-our-patches "vmov-alignment.patch")))
167+
(search-our-patches "vmov-alignment.patch"
168+
"gcc-broken-longjmp.patch")))
168169

169170
(define (make-mingw-pthreads-cross-toolchain target)
170171
"Create a cross-compilation toolchain package for TARGET"
171172
(let* ((xbinutils (cross-binutils target))
172173
(pthreads-xlibc mingw-w64-x86_64-winpthreads)
173174
(pthreads-xgcc (make-gcc-with-pthreads
174175
(cross-gcc target
175-
#:xgcc (make-ssp-fixed-gcc (make-mingw-w64-cross-gcc-vmov-alignment base-gcc))
176+
#:xgcc (make-ssp-fixed-gcc (make-mingw-w64-cross-gcc base-gcc))
176177
#:xbinutils xbinutils
177178
#:libc pthreads-xlibc))))
178179
;; Define a meta-package that propagates the resulting XBINUTILS, XLIBC, and
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 <ebotcazou@adacore.com>
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. */

0 commit comments

Comments
 (0)