From 83bac8d01e985d0fcabc3c88babe4399ccfc5a8b Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Sat, 4 Mar 2023 21:09:20 -0500 Subject: [PATCH] cmake/boost: WITH_ASAN adds BOOST_USE_ASAN to context also adds 'context-impl=ucontext' to the b2 command line and the BOOST_USE_UCONTEXT define as described in: https://www.boost.org/doc/libs/1_79_0/libs/context/doc/html/context/stack/sanitizers.html Signed-off-by: Casey Bodley --- cmake/modules/BuildBoost.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/modules/BuildBoost.cmake b/cmake/modules/BuildBoost.cmake index 8db3de9596344..8cccecd144bc4 100644 --- a/cmake/modules/BuildBoost.cmake +++ b/cmake/modules/BuildBoost.cmake @@ -136,6 +136,9 @@ function(do_build_boost root_dir version) if(WITH_BOOST_VALGRIND) list(APPEND b2 valgrind=on) endif() + if(WITH_ASAN) + list(APPEND b2 context-impl=ucontext) + endif() set(build_command ${b2} headers stage #"--buildid=ceph" # changes lib names--can omit for static @@ -232,6 +235,10 @@ macro(build_boost version) set_target_properties(Boost::${c} PROPERTIES INTERFACE_COMPILE_DEFINITIONS "BOOST_USE_VALGRIND") endif() + if((c MATCHES "context") AND (WITH_ASAN)) + set_target_properties(Boost::${c} PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_USE_ASAN;BOOST_USE_UCONTEXT") + endif() list(APPEND Boost_LIBRARIES ${Boost_${upper_c}_LIBRARY}) endforeach() foreach(c ${Boost_BUILD_COMPONENTS}) -- 2.39.5