From 1866a07add1f3ddf877bd4ee3a1e289cb1d80966 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Tue, 24 Mar 2026 15:53:46 +0000 Subject: [PATCH] fix: Use BOOST_USE_TSAN instead of BOOST_USE_ASAN for TSAN builds The cleanup in 959c7bcae2 merged separate ASAN/TSAN if-blocks into one, but incorrectly defined BOOST_USE_ASAN for both. TSAN builds don't link ASan's runtime, so __sanitizer_start/finish_switch_fiber are unresolved. Restore the original separate blocks from d2079574c7. Co-Authored-By: Claude Opus 4.6 --- cmake/deps/Boost.cmake | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/cmake/deps/Boost.cmake b/cmake/deps/Boost.cmake index 80c652f0ac..3b4e165dcf 100644 --- a/cmake/deps/Boost.cmake +++ b/cmake/deps/Boost.cmake @@ -55,13 +55,20 @@ endif() # stack-use-after-scope errors. BOOST_USE_UCONTEXT ensures the ucontext backend # is selected (fcontext does not support ASAN annotations). # These defines must match what Boost was compiled with (see conan/profiles/sanitizers). -# TSAN also requires the ucontext backend so that Boost.Context uses -# POSIX ucontext (not fcontext assembly) for fiber switching. This -# allows TSAN to properly track context switches and avoids false positives. -# These defines must match what Boost was compiled with (see conan/profiles/sanitizers). -if(enable_asan OR enable_tsan) +if(enable_asan) target_compile_definitions( xrpl_boost INTERFACE BOOST_USE_ASAN BOOST_USE_UCONTEXT ) endif() + +# TSAN also requires the ucontext backend so that Boost.Context uses +# POSIX ucontext (not fcontext assembly) for fiber switching. This +# allows TSAN to properly track context switches and avoids false positives. +# These defines must match what Boost was compiled with (see conan/profiles/sanitizers). +if(enable_tsan) + target_compile_definitions( + xrpl_boost + INTERFACE BOOST_USE_TSAN BOOST_USE_UCONTEXT + ) +endif()