Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/test/00_setup_env_native_tsan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ export DEP_OPTS="CC=clang-19 CXX='clang++-19 -stdlib=libc++'"
export TEST_RUNNER_EXTRA="--extended --exclude feature_pruning,feature_dbcrash,wallet_multiwallet.py" # Temporarily suppress ASan heap-use-after-free (see issue #14163)
export TEST_RUNNER_EXTRA="${TEST_RUNNER_EXTRA} --timeout-factor=4" # Increase timeout because sanitizers slow down
export GOAL="install"
export BITCOIN_CONFIG="--enable-zmq --with-sanitizers=thread CC=clang-19 CXX=clang++-19 CXXFLAGS='-g'"
export BITCOIN_CONFIG="--enable-zmq --with-sanitizers=thread CC=clang-19 CXX=clang++-19"
export CPPFLAGS="-DARENA_DEBUG -DDEBUG_LOCKORDER -DDEBUG_LOCKCONTENTION"
export PYZMQ=true
18 changes: 6 additions & 12 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1228,16 +1228,10 @@ if test "$enable_stacktraces" != "no"; then
])
fi
BACKTRACE_LIBS="$BACKTRACE_LIBS -lbacktrace"
dnl More modern compilers may emit DWARF 5 binaries by default, use DWARF 4 out of precaution
if test "$TARGET_OS" != "windows"; then
AX_CHECK_COMPILE_FLAG([-gdwarf-4], [BACKTRACE_FLAGS="$BACKTRACE_FLAGS -gdwarf-4"], [
if test "$enable_stacktraces" = "yes"; then
AC_MSG_ERROR([--enable-stacktraces was specified but cannot set -gdwarf-4])
fi
AC_MSG_WARN([cannot set -gdwarf-4, stacktraces will be disabled])
enable_stacktraces=no
], [$CXXFLAG_WERROR])
fi
dnl The libbacktrace pinned in depends understands DWARF 5, so the
dnl compiler's default debug format is used as-is. A -gdwarf-4 pin
dnl previously lived here and, being a -g-family flag, also forced
dnl debug level 2 onto every build.
if test "$TARGET_OS" = "darwin"; then
AX_CHECK_COMPILE_FLAG([-fno-standalone-debug], [BACKTRACE_FLAGS="$BACKTRACE_FLAGS -fno-standalone-debug"], [
if test "$enable_stacktraces" = "yes"; then
Expand Down Expand Up @@ -2139,10 +2133,10 @@ echo " target os = $host_os"
echo " build os = $build_os"
echo
echo " CC = $CC"
echo " CFLAGS = $DEBUG_CFLAGS $PTHREAD_CFLAGS $BACKTRACE_FLAGS $CFLAGS"
echo " CFLAGS = $BACKTRACE_FLAGS $DEBUG_CFLAGS $PTHREAD_CFLAGS $CFLAGS"
echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CORE_CPPFLAGS $CPPFLAGS"
echo " CXX = $CXX"
echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $CORE_CXXFLAGS $BACKTRACE_FLAGS $CXXFLAGS"
echo " CXXFLAGS = $BACKTRACE_FLAGS $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $CORE_CXXFLAGS $CXXFLAGS"
echo " LDFLAGS = $PTHREAD_LIBS $HARDENED_LDFLAGS $CORE_LDFLAGS $BACKTRACE_LDFLAGS $LDFLAGS"
echo " AR = $AR"
echo " ARFLAGS = $ARFLAGS"
Expand Down
8 changes: 7 additions & 1 deletion contrib/guix/libexec/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,13 @@ HOST_CFLAGS+=$(find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -
case "$HOST" in
*linux*) HOST_CFLAGS+=" -ffile-prefix-map=${PWD}=." ;;
*mingw*) HOST_CFLAGS+=" -fno-ident" ;;
*darwin*) unset HOST_CFLAGS ;;
*darwin*)
# Optimization and target flags come from depends' config.site; only
# the debug level is requested here. The shipped dSYM debug artifacts
# previously carried full -g2 DWARF via the since-removed -gdwarf-4
# backtrace flag escalating configure's -g1 floor, so keep requesting
# it explicitly.
HOST_CFLAGS="-g" ;;
esac

# CXXFLAGS
Expand Down
8 changes: 6 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ print-%: FORCE
DIST_SUBDIRS = secp256k1

AM_LDFLAGS = $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS) $(SANITIZER_LDFLAGS) $(CORE_LDFLAGS) $(BACKTRACE_LDFLAGS)
AM_CFLAGS = $(DEBUG_CFLAGS) $(BACKTRACE_FLAGS)
AM_CXXFLAGS = $(DEBUG_CXXFLAGS) $(HARDENED_CXXFLAGS) $(WARN_CXXFLAGS) $(NOWARN_CXXFLAGS) $(ERROR_CXXFLAGS) $(SANITIZER_CXXFLAGS) $(CORE_CXXFLAGS) $(BACKTRACE_FLAGS)
# BACKTRACE_FLAGS must precede the debug-level flags: -g-family members placed
# there (e.g. a -gdwarf-N version pin) imply -g2, so the intended level
# (DEBUG_*FLAGS' -g1 floor, --enable-debug's -g3, or the user's CXXFLAGS) must
# come later to take effect.
AM_CFLAGS = $(BACKTRACE_FLAGS) $(DEBUG_CFLAGS)
AM_CXXFLAGS = $(BACKTRACE_FLAGS) $(DEBUG_CXXFLAGS) $(HARDENED_CXXFLAGS) $(WARN_CXXFLAGS) $(NOWARN_CXXFLAGS) $(ERROR_CXXFLAGS) $(SANITIZER_CXXFLAGS) $(CORE_CXXFLAGS)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Set -g1 on the remaining targeted CI builds

Checked .github/workflows/build.yml through ci/dash/matrix.sh: Automake appends user CXXFLAGS after AM_CXXFLAGS, so this reordering cannot override Autoconf's default -g -O2. The aarch64, fuzz, nowallet, sqlite, and UBSan environment scripts still set neither CFLAGS nor CXXFLAGS, leaving those source jobs with full -g2 DWARF; TSan's C objects also remain at -g2 because its config only overrides CXXFLAGS. Add explicit -g1 flags to these target configurations, apart from the intentionally unchanged linux64 canary.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The premise is incorrect for CI builds: autoconf's -g -O2 default only fires when CXXFLAGS is unset, and depends' config.site unconditionally sets CXXFLAGS (prepending the host -O2) for every CI job. With no -g in user flags, the floor's -g1 is the last debug-level flag on the line and wins — verified empirically in fork run 30873992664's per-target ccache stats. The TSan C-objects point is moot on the current branch: tsan's explicit CXXFLAGS was removed entirely, so both C and C++ objects take the floor.


🤖 Posted autonomously by Claude on behalf of pasta.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve full debug info in macOS release builds

For Guix macOS releases, contrib/guix/libexec/build.sh:225 explicitly unsets HOST_CFLAGS before deriving HOST_CXXFLAGS, while depends/hosts/darwin.mk:83-84 contributes only -O2. Previously the later -gdwarf-4 implicitly selected debug level 2, but after this change the final debug-level flag is DEBUG_CXXFLAGS's -g1. Consequently, make osx_debug packages dSYMs without the variable and type information expected from release debug artifacts; explicitly retain -g/-g2 for the Darwin Guix release path while allowing CI builds to use -g1.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid catch — fixed in 74fcc11. The guix darwin case now requests -g explicitly instead of relying on the removed -gdwarf-4 escalation, so make osx_debug dSYMs keep full variable/type DWARF, matching the linux/mingw releases' explicit -O2 -g.


🤖 Posted autonomously by Claude on behalf of pasta.

AM_OBJCXXFLAGS = $(AM_CXXFLAGS)
AM_CPPFLAGS = $(DEBUG_CPPFLAGS) $(HARDENED_CPPFLAGS) $(CORE_CPPFLAGS)
AM_LIBTOOLFLAGS = --preserve-dup-deps
Expand Down
Loading