Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ src/dash-chainstate
src/dash-wallet
src/test/fuzz/fuzz
src/test/test_dash
src/dashbls/runtest
src/qt/test/test_dash-qt
src/qt/res/css/colors/*
src/bench/bench_dash
Expand Down
10 changes: 6 additions & 4 deletions ci/test/00_setup_env_native_msan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ LIBCXX_FLAGS="-nostdinc++ -nostdlib++ -isystem ${LIBCXX_DIR}include/c++/v1 -L${L
export MSAN_AND_LIBCXX_FLAGS="${MSAN_FLAGS} ${LIBCXX_FLAGS}"

# BDB generates false-positives and will be removed in future
export DEP_OPTS="DEBUG=1 NO_BDB=1 NO_QT=1 NO_UPNP=1 NO_NATPMP=1 CC=clang-19 CXX=clang++-19 CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'"
# __BLST_NO_ASM__ makes blst use its C implementation instead of hand-written
# assembly, which MSan cannot see through.
export DEP_OPTS="DEBUG=1 NO_BDB=1 NO_QT=1 NO_UPNP=1 NO_NATPMP=1 CC=clang-19 CXX=clang++-19 CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' CPPFLAGS='-D__BLST_NO_ASM__'"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
export GOAL="install"
# CC/CXX/CFLAGS/CXXFLAGS are repeated here rather than left to depends'
# config.site. Upstream dropped them in bitcoin#29800 because its
Expand All @@ -26,12 +28,12 @@ export GOAL="install"
# target whose compiler differs from the system default, so nothing else in
# Dash's CI exercises that hand-off.
# _FORTIFY_SOURCE is not compatible with MSAN.
# --with-asm=no and --with-backend=easy keep secp256k1 and relic off
# hand-written assembly, which MSan cannot see through.
# --with-asm=no keeps secp256k1 off hand-written assembly, which MSan cannot
# see through.
# --disable-mimalloc selects the plain malloc secure allocator; mimalloc seeds
# itself with a raw getrandom syscall before main(), which MSan cannot track.
export BITCOIN_CONFIG="--with-sanitizers=memory --with-gui=no --without-bdb --with-sqlite \
--with-asm=no --with-backend=easy --disable-mimalloc \
--with-asm=no --disable-mimalloc \
CC=clang-19 CXX=clang++-19 CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' \
CPPFLAGS='-U_FORTIFY_SOURCE'"
Comment on lines +31 to 38

@thepastaclaw thepastaclaw Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

✅ Resolved at 1d8b87d4; see the replies below.

🟡 Suggestion: Restore MSan coverage of BLS arithmetic

Removing the old backend restriction leaves the replacement BLS arithmetic using hand-written assembly in this job. depends/packages/blst.mk defines BLST_PORTABLE, but blst 0.3.17's build.sh still compiles assembly.S on x86_64, and that file selects assembly implementations under BLST_PORTABLE; the flag enables CPU portability, not sanitizer instrumentation. This is separate from mimalloc's startup problem: after allocator initialization is fixed, the BLS arithmetic boundary remains uninstrumented and can hide uninitialized reads or produce false positives on assembly-written outputs. Establish a supported MSan-compatible blst build configuration. Do not blindly add BLST_NO_ASM: assembly.S's x86_64 branch is not disabled by that macro alone.

source: muse-spark-1.3-contributor (phase1-reviewer: general)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed at the dependency layer: depends/patches/blst/no_asm_limbs.patch makes an explicit BLST_NO_ASM skip the x86_64/aarch64 64-bit-limb branch in vect.h, so it falls through to blst's existing 32-bit C configuration, the one build.sh already uses on targets without assembly. Builds that don't define the macro are unchanged.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Resolved (re-reviewed at 1d8b87d4): Your dependency-layer fix addresses the issue: the patched vect.h selects 32-bit limbs under BLST_NO_ASM, and the recipe passes that define into server.c, whose vect.c includes the C replacements. This is static confirmation of the configuration, not a completed MSan test run.

export USE_MEMORY_SANITIZER="true"
Expand Down
18 changes: 17 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ AC_ARG_WITH([natpmp],
[use_natpmp=$withval],
[use_natpmp=auto])

AC_ARG_ENABLE([mimalloc],
[AS_HELP_STRING([--disable-mimalloc],
[use malloc instead of mimalloc for BLS secret memory until BLSInit() installs the locked pool (default is mimalloc)])],
[use_mimalloc=$enableval],
[use_mimalloc=yes])

AC_ARG_ENABLE(tests,
AS_HELP_STRING([--disable-tests],[do not compile tests (default is to compile)]),
[use_tests=$enableval],
Expand Down Expand Up @@ -1572,6 +1578,13 @@ if test "$use_natpmp" != "no"; then
CPPFLAGS="$TEMP_CPPFLAGS"
fi

dnl Check for blst (required by src/dashbls)
TEMP_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BLST_CPPFLAGS"
AC_CHECK_HEADERS([blst.h], [], [AC_MSG_ERROR([blst headers missing])])
AC_CHECK_LIB([blst], [blst_p1_compress], [BLST_LIBS="$BLST_LIBS -lblst"], [AC_MSG_ERROR([libblst missing])], [$BLST_LIBS])
CPPFLAGS="$TEMP_CPPFLAGS"

if test "$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoin_util$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench$enable_fuzz_binary" = "nonononononononono"; then
use_boost=no
else
Expand Down Expand Up @@ -1954,6 +1967,7 @@ AM_CONDITIONAL([ENABLE_ARM_CRC], [test "$enable_arm_crc" = "yes"])
AM_CONDITIONAL([ENABLE_ARM_NEON], [test "$enable_arm_neon" = "yes"])
AM_CONDITIONAL([ENABLE_ARM_SHANI], [test "$enable_arm_shani" = "yes"])
AM_CONDITIONAL([WORDS_BIGENDIAN], [test "$ac_cv_c_bigendian" = "yes"])
AM_CONDITIONAL([USE_MIMALLOC], [test "$use_mimalloc" = "yes"])
AM_CONDITIONAL([USE_NATPMP], [test "$use_natpmp" = "yes"])
AM_CONDITIONAL([USE_UPNP], [test "$use_upnp" = "yes"])

Expand Down Expand Up @@ -2030,6 +2044,8 @@ AC_SUBST(BACKTRACE_FLAGS)
AC_SUBST(BACKTRACE_LDFLAGS)
AC_SUBST(BACKTRACE_LIBS)
AC_SUBST(GMP_LIBS)
AC_SUBST(BLST_CPPFLAGS)
AC_SUBST(BLST_LIBS)
AC_SUBST(NATPMP_CPPFLAGS)
AC_SUBST(NATPMP_LIBS)
AC_SUBST(DSYMUTIL_FLAT)
Expand Down Expand Up @@ -2066,7 +2082,7 @@ CPPFLAGS="$CPPFLAGS_TEMP"
dnl The ECDH module is required by the wallet's Platform key provider
dnl (DashPay contact request encryption, wallet/platformkeys.cpp).
ac_configure_args="${ac_configure_args} --disable-shared --with-pic --enable-benchmark=no --enable-module-recovery --enable-module-ecdh --disable-openssl-tests"
AC_CONFIG_SUBDIRS([src/dashbls src/secp256k1])
AC_CONFIG_SUBDIRS([src/secp256k1])

AC_OUTPUT

Expand Down
2 changes: 1 addition & 1 deletion contrib/guix/libexec/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ mkdir -p "$DISTSRC"
${HOST_CXXFLAGS:+CXXFLAGS="${HOST_CXXFLAGS}"} \
${HOST_LDFLAGS:+LDFLAGS="${HOST_LDFLAGS}"}

sed -i.old 's/-lstdc++ //g' {./,src/dashbls/,src/secp256k1/}{config.status,libtool}
sed -i.old 's/-lstdc++ //g' {./,src/secp256k1/}{config.status,libtool}


# Build Dash Core
Expand Down
29 changes: 29 additions & 0 deletions depends/packages/blst.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package=blst
$(package)_version=0.3.17
$(package)_download_path=https://github.com/supranational/blst/archive/refs/tags
$(package)_download_file=v$($(package)_version).tar.gz
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=c3fef37b566b67419703b2bbb648e15176276af9a880c22aa8f5f2e8cecc2e4d
$(package)_patches=no_asm_limbs.patch

# build.sh takes CC/AR/RANLIB/CFLAGS from the environment. __BLST_PORTABLE__
# selects runtime CPU dispatch instead of letting build.sh probe the builder's
# /proc/cpuinfo for ADX, which keeps the build reproducible; build.sh itself
# adds -D__BLST_NO_ASM__ on hosts other than x86_64/aarch64.
define $(package)_set_vars
$(package)_build_env=CC="$($(package)_cc)" AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CFLAGS="$($(package)_cflags) $($(package)_cppflags) -fno-builtin -fPIC -D__BLST_PORTABLE__"
endef

define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/no_asm_limbs.patch
endef

define $(package)_build_cmds
./build.sh
endef

define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/include $($(package)_staging_prefix_dir)/lib && \
install -m 644 bindings/blst.h bindings/blst_aux.h $($(package)_staging_prefix_dir)/include && \
install -m 644 libblst.a $($(package)_staging_prefix_dir)/lib
endef
2 changes: 1 addition & 1 deletion depends/packages/packages.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
packages:=gmp backtrace
packages:=gmp backtrace blst

boost_packages = boost

Expand Down
7 changes: 7 additions & 0 deletions depends/patches/blst/no_asm_limbs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
--- a/src/vect.h
+++ b/src/vect.h
@@ -10,3 +10,3 @@

-#if defined(__x86_64__) || defined(__aarch64__)
+#if (defined(__x86_64__) || defined(__aarch64__)) && !defined(__BLST_NO_ASM__)
/* These are available even in ILP32 flavours, but even then they are
1 change: 1 addition & 0 deletions doc/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ You can find installation instructions in the `build-*.md` file for your platfor
| --- | --- | --- | --- | --- |
| [Boost](../depends/packages/boost.mk) | [link](https://www.boost.org/users/download/) | 1.81.0 | [1.73.0](https://github.com/bitcoin/bitcoin/pull/29066) | No |
| [libevent](../depends/packages/libevent.mk) | [link](https://github.com/libevent/libevent/releases) | [2.1.12-stable](https://github.com/bitcoin/bitcoin/pull/21991) | [2.1.8](https://github.com/bitcoin/bitcoin/pull/24681) | No |
| [blst](../depends/packages/blst.mk) | [link](https://github.com/supranational/blst/releases) | 0.3.17 | | No |
| glibc | [link](https://www.gnu.org/software/libc/) | N/A | [2.31](https://github.com/bitcoin/bitcoin/pull/29987) | Yes |
| Linux Kernel | [link](https://www.kernel.org/) | N/A | [3.17.0](https://github.com/bitcoin/bitcoin/pull/27699) | Yes |

Expand Down
21 changes: 5 additions & 16 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ check_PROGRAMS =
TESTS =
BENCHMARKS =

# The first make in dashbls after configure reruns its config.status, which
# replaces relic_conf.h. Let that finish before compiling anything that
# includes it.
BUILT_SOURCES = dashbls/depends/relic/include/relic_conf.h

dashbls/depends/relic/include/relic_conf.h: FORCE
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C dashbls depends/relic/include/relic_conf.h

if ENABLE_STACKTRACES
if ENABLE_CRASH_HOOKS
if CRASH_HOOKS_WRAPPED_CXX_ABI
Expand All @@ -54,7 +46,7 @@ endif # ENABLE_CRASH_HOOKS
endif # ENABLE_STACKTRACES

BITCOIN_INCLUDES=-I$(builddir) -I$(srcdir)/$(MINISKETCH_INCLUDE_DIR_INT) -I$(srcdir)/secp256k1/include -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)
BITCOIN_INCLUDES+=-isystem$(srcdir)/dashbls/include -isystem$(srcdir)/dashbls/depends/relic/include -isystem$(srcdir)/dashbls/depends/minialloc/include
BITCOIN_INCLUDES+=$(DASHBLS_CPPFLAGS)
BITCOIN_INCLUDES+=-isystem$(srcdir)/immer

LIBBITCOIN_NODE=libbitcoin_node.a
Expand All @@ -64,7 +56,6 @@ LIBBITCOIN_CLI=libbitcoin_cli.a
LIBBITCOIN_UTIL=libbitcoin_util.a
LIBBITCOIN_CRYPTO_BASE=crypto/libbitcoin_crypto_base.la
LIBBITCOINQT=qt/libbitcoinqt.a
LIBDASHBLS=dashbls/libdashbls.la
LIBSECP256K1=secp256k1/libsecp256k1.la

if ENABLE_ZMQ
Expand Down Expand Up @@ -118,9 +109,6 @@ LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_ARM_SHANI)
endif
noinst_LTLIBRARIES += $(LIBBITCOIN_CRYPTO)

$(LIBDASHBLS):
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D)

$(LIBSECP256K1): $(wildcard secp256k1/src/*.h) $(wildcard secp256k1/src/*.c) $(wildcard secp256k1/include/*)
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)

Expand Down Expand Up @@ -1254,7 +1242,7 @@ lib_LTLIBRARIES += $(LIBBITCOINKERNEL)

libdashkernel_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS) $(PTHREAD_FLAGS)
libdashkernel_la_LIBADD = $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) $(LIBSECP256K1) $(LIBDASHBLS) $(GMP_LIBS)
libdashkernel_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL -isystem$(srcdir)/dashbls/include -isystem$(srcdir)/dashbls/depends/relic/include -isystem$(srcdir)/dashbls/depends/minialloc/include -isystem$(srcdir)/immer $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)
libdashkernel_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL $(DASHBLS_CPPFLAGS) -isystem$(srcdir)/immer $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)

# libdashkernel requires default symbol visibility, explicitly specify that
# here so that things still work even when user configures with
Expand Down Expand Up @@ -1423,7 +1411,7 @@ libdashconsensus_la_SOURCES = support/cleanse.cpp $(crypto_libbitcoin_crypto_bas
libdashconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
libdashconsensus_la_LIBADD = $(LIBDASHBLS) $(LIBSECP256K1) $(GMP_LIBS)
libdashconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL -DDISABLE_OPTIMIZED_SHA256
libdashconsensus_la_CPPFLAGS += -isystem$(srcdir)/dashbls/include -isystem$(srcdir)/dashbls/depends/relic/include -isystem$(srcdir)/dashbls/depends/minialloc/include
libdashconsensus_la_CPPFLAGS += $(DASHBLS_CPPFLAGS)
libdashconsensus_la_CPPFLAGS += -isystem$(srcdir)/immer
libdashconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)

Expand Down Expand Up @@ -1456,6 +1444,7 @@ CLEANFILES += util/*.gcda util/*.gcno
CLEANFILES += wallet/*.gcda wallet/*.gcno
CLEANFILES += wallet/test/*.gcda wallet/test/*.gcno
CLEANFILES += zmq/*.gcda zmq/*.gcno
CLEANFILES += dashbls/src/*.gcda dashbls/src/*.gcno dashbls/depends/mimalloc/src/*.gcda dashbls/depends/mimalloc/src/*.gcno
CLEANFILES += obj/build.h

IMMER_DIST = immer/immer
Expand All @@ -1475,7 +1464,6 @@ $(top_srcdir)/$(subdir)/config/bitcoin-config.h.in: $(am__configure_deps)


clean-local:
-$(MAKE) -C dashbls clean
-$(MAKE) -C secp256k1 clean
-rm -f leveldb/*/*.gcda leveldb/*/*.gcno leveldb/helpers/memenv/*.gcda leveldb/helpers/memenv/*.gcno
-rm -f config.h
Expand Down Expand Up @@ -1556,6 +1544,7 @@ include Makefile.minisketch.include

include Makefile.crc32c.include
include Makefile.leveldb.include
include Makefile.dashbls.include

include Makefile.test_util.include
include Makefile.test_fuzz.include
Expand Down
115 changes: 115 additions & 0 deletions src/Makefile.dashbls.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Copyright (c) 2026 The Dash Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

LIBDASHBLS_INT = dashbls/libdashbls.la

noinst_LTLIBRARIES += $(LIBDASHBLS_INT)
if USE_MIMALLOC
LIBMIMALLOC_INT = dashbls/libmimalloc-secure.la
noinst_LTLIBRARIES += $(LIBMIMALLOC_INT)
endif

# What consumers link, dependents first: dashbls -> mimalloc -> blst (from depends)
LIBDASHBLS = $(LIBDASHBLS_INT) $(LIBMIMALLOC_INT) $(BLST_LIBS)

# Flags for consumers of the library
DASHBLS_CPPFLAGS = -isystem$(srcdir)/dashbls/include $(BLST_CPPFLAGS)

# Flags used only when building the library itself. Its headers are treated
# as system headers, as they are for consumers, so that Dash's warning set
# (-Werror in CI) does not apply to the vendored code.
DASHBLS_CPPFLAGS_INT = $(BLST_CPPFLAGS)
DASHBLS_CPPFLAGS_INT += -isystem$(srcdir)/dashbls/include/dashbls
DASHBLS_CPPFLAGS_INT += -isystem$(srcdir)/dashbls/depends/mimalloc/include
if USE_MIMALLOC
DASHBLS_CPPFLAGS_INT += -DBLSALLOC_MIMALLOC=1
endif

MIMALLOC_CPPFLAGS_INT =
MIMALLOC_CPPFLAGS_INT += -I$(srcdir)/dashbls/depends/mimalloc/include
MIMALLOC_CPPFLAGS_INT += -I$(srcdir)/dashbls/depends/mimalloc/src
MIMALLOC_CPPFLAGS_INT += -DMI_SECURE=4
MIMALLOC_CPPFLAGS_INT += -DNDEBUG
Comment on lines +22 to +33

@thepastaclaw thepastaclaw Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

✅ Resolved at 33aabdaa; see the replies below.

🔴 Blocking: Preserve an MSan-compatible allocator configuration

The integrated build always defines BLSALLOC_MIMALLOC and links mimalloc, while the MSan configuration removes --disable-mimalloc. On Linux, mimalloc's constructor invokes _mi_auto_process_init(), which initializes the main heap's random context using a stack key filled by syscall(SYS_getrandom, ...). That write has no MSan unpoisoning boundary before random.c consumes the key. This is the same startup failure explicitly documented by the base's c4cecb6 allocator configuration, and the relevant mimalloc path remains present. It executes before Core can install its secure allocator callbacks, so those callbacks do not solve it. Retain allocator selection for MSan or repair the randomness instrumentation boundary rather than unconditionally restoring the previously excluded startup path.

source: gpt-6.1-sol (phase2-reviewer: general)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Resolved (re-reviewed at 33aabdaa): Your --disable-mimalloc option now controls both the allocator define and inclusion of the mimalloc archive, and the MSan setup selects it. This resolves the allocator-configuration issue independently of the remaining blst backend failure.


DASHBLS_H = \
dashbls/include/dashbls/bls.hpp \
dashbls/include/dashbls/chaincode.hpp \
dashbls/include/dashbls/elements.hpp \
dashbls/include/dashbls/extendedprivatekey.hpp \
dashbls/include/dashbls/extendedpublickey.hpp \
dashbls/include/dashbls/hdkeys.hpp \
dashbls/include/dashbls/hkdf.hpp \
dashbls/include/dashbls/legacy.hpp \
dashbls/include/dashbls/privatekey.hpp \
dashbls/include/dashbls/schemes.hpp \
dashbls/include/dashbls/test-utils.hpp \
dashbls/include/dashbls/threshold.hpp \
dashbls/include/dashbls/util.hpp

dashbls_libdashbls_la_SOURCES = \
$(DASHBLS_H) \
dashbls/src/bls.cpp \
dashbls/src/chaincode.cpp \
dashbls/src/elements.cpp \
dashbls/src/extendedprivatekey.cpp \
dashbls/src/extendedpublickey.cpp \
dashbls/src/legacy.cpp \
dashbls/src/privatekey.cpp \
dashbls/src/schemes.cpp \
dashbls/src/threshold.cpp

dashbls_libdashbls_la_CPPFLAGS = $(AM_CPPFLAGS) $(DASHBLS_CPPFLAGS_INT)

# Specify -static in both CXXFLAGS and LDFLAGS so libtool will only build a
# static version of this library (same as crc32c and leveldb).
dashbls_libdashbls_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -static
dashbls_libdashbls_la_LDFLAGS = $(AM_LDFLAGS) -static

MIMALLOC_H = \
dashbls/depends/mimalloc/include/mimalloc-new-delete.h \
dashbls/depends/mimalloc/include/mimalloc-override.h \
dashbls/depends/mimalloc/include/mimalloc-stats.h \
dashbls/depends/mimalloc/include/mimalloc.h \
dashbls/depends/mimalloc/src/bitmap.h

dashbls_libmimalloc_secure_la_SOURCES = \
$(MIMALLOC_H) \
dashbls/depends/mimalloc/src/alloc-aligned.c \
dashbls/depends/mimalloc/src/alloc-posix.c \
dashbls/depends/mimalloc/src/alloc.c \
dashbls/depends/mimalloc/src/arena-meta.c \
dashbls/depends/mimalloc/src/arena.c \
dashbls/depends/mimalloc/src/bitmap.c \
dashbls/depends/mimalloc/src/heap.c \
dashbls/depends/mimalloc/src/init.c \
dashbls/depends/mimalloc/src/libc.c \
dashbls/depends/mimalloc/src/options.c \
dashbls/depends/mimalloc/src/os.c \
dashbls/depends/mimalloc/src/page-map.c \
dashbls/depends/mimalloc/src/page.c \
dashbls/depends/mimalloc/src/random.c \
dashbls/depends/mimalloc/src/stats.c \
dashbls/depends/mimalloc/src/prim/prim.c

dashbls_libmimalloc_secure_la_CPPFLAGS = $(AM_CPPFLAGS) $(MIMALLOC_CPPFLAGS_INT)
dashbls_libmimalloc_secure_la_CFLAGS = $(AM_CFLAGS) $(PIE_FLAGS) -static
dashbls_libmimalloc_secure_la_LDFLAGS = $(AM_LDFLAGS) -static

if ENABLE_TESTS
if !ENABLE_FUZZ
DASHBLS_RUNTEST = dashbls/runtest
TESTS += $(DASHBLS_RUNTEST)
check_PROGRAMS += $(DASHBLS_RUNTEST)

dashbls_runtest_SOURCES = \
dashbls/src/test.cpp \
dashbls/src/test-vectors.hpp \
dashbls/depends/catch2/include/catch2/catch.hpp
dashbls_runtest_CPPFLAGS = $(AM_CPPFLAGS) $(DASHBLS_CPPFLAGS_INT) -isystem$(srcdir)/dashbls/depends/catch2/include
dashbls_runtest_CPPFLAGS += -DDASHBLS_REFERENCE_VECTORS=\"$(abs_srcdir)/dashbls/test-vectors/reference.txt\"
dashbls_runtest_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
dashbls_runtest_LDADD = $(LIBDASHBLS)
dashbls_runtest_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) -static
endif
endif
2 changes: 1 addition & 1 deletion src/bls/bls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ static void create_secure_allocator()

// static variable in function scope ensures it's initialized when first accessed
// and destroyed before LockedPoolManager
static mt_pooled_secure_allocator<uint8_t> a(sizeof(bn_t) + sizeof(size_t));
static mt_pooled_secure_allocator<uint8_t> a(sizeof(blst_p2) + sizeof(size_t));
secure_allocator_instance = &a;
}

Expand Down
Loading
Loading