build: Support ASAN for boost coroutine2 using ucontext (#6531)

This commit is contained in:
Teddy Reed 2020-07-01 15:45:57 -04:00 committed by GitHub
parent 8636dca164
commit c250dac2e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -205,6 +205,13 @@ function(setupBuildFlags)
-fsanitize-coverage=edge,indirect-calls
)
# Support ASAN within coroutines2.
# Note that __ucontext__ is orders of magnitude slower than __fcontext__.
target_compile_definitions(cxx_settings INTERFACE
BOOST_USE_UCONTEXT
BOOST_USE_ASAN
)
# Require at least address (may be refactored out)
target_link_options(cxx_settings INTERFACE
-fsanitize=address

View File

@ -676,6 +676,10 @@ endfunction()
function(generateBoostContext)
set(library_root "${BOOST_ROOT}/libs/context")
set(source_files
"${library_root}/src/execution_context.cpp"
)
if(DEFINED PLATFORM_LINUX)
set(asm_source_file_list
"${library_root}/src/asm/jump_x86_64_sysv_elf_gas.S"
@ -710,8 +714,14 @@ function(generateBoostContext)
endif()
endforeach()
if(OSQUERY_ENABLE_ADDRESS_SANITIZER)
list(APPEND source_files
"${library_root}/src/fiber.cpp"
)
endif()
add_library(thirdparty_boost_context STATIC
"${library_root}/src/execution_context.cpp"
${source_files}
${asm_source_file_list}
)