mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 01:42:37 +08:00
Build fixes/improvements for sanitizers (#7657)
* Don't build fdb c shim with ubsan This avoids duplicate symbols when linking. It doesn't really make sense to assemble files with -fsanitize=undefined anyway, since it won't insert instrumentation. * Consolidate boost_asan with boost_target
This commit is contained in:
parent
9d63a859b0
commit
45c8a4e09d
@ -194,11 +194,7 @@ if(NOT WIN32)
|
||||
target_link_libraries(fdb_c_client_memory_test PRIVATE fdb_c Threads::Threads)
|
||||
|
||||
target_include_directories(fdb_c_api_tester_impl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/foundationdb/ ${CMAKE_SOURCE_DIR}/flow/include ${CMAKE_BINARY_DIR}/flow/include)
|
||||
if(USE_SANITIZER)
|
||||
target_link_libraries(fdb_c_api_tester_impl PRIVATE fdb_cpp toml11_target Threads::Threads fmt::fmt boost_asan)
|
||||
else()
|
||||
target_link_libraries(fdb_c_api_tester_impl PRIVATE fdb_cpp toml11_target Threads::Threads fmt::fmt boost_target)
|
||||
endif()
|
||||
target_link_libraries(fdb_c_api_tester_impl PRIVATE fdb_cpp toml11_target Threads::Threads fmt::fmt boost_target)
|
||||
target_link_libraries(fdb_c_api_tester_impl PRIVATE SimpleOpt)
|
||||
|
||||
target_include_directories(fdb_c_unit_tests_impl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/foundationdb/)
|
||||
@ -211,11 +207,7 @@ if(NOT WIN32)
|
||||
|
||||
# do not set RPATH for mako
|
||||
set_property(TARGET mako PROPERTY SKIP_BUILD_RPATH TRUE)
|
||||
if (USE_SANITIZER)
|
||||
target_link_libraries(mako PRIVATE fdb_c fdbclient fmt::fmt Threads::Threads fdb_cpp boost_asan rapidjson)
|
||||
else()
|
||||
target_link_libraries(mako PRIVATE fdb_c fdbclient fmt::fmt Threads::Threads fdb_cpp boost_target rapidjson)
|
||||
endif()
|
||||
target_link_libraries(mako PRIVATE fdb_c fdbclient fmt::fmt Threads::Threads fdb_cpp boost_target rapidjson)
|
||||
|
||||
if(NOT OPEN_FOR_IDE)
|
||||
# Make sure that fdb_c.h is compatible with c90
|
||||
@ -439,7 +431,7 @@ if (OPEN_FOR_IDE)
|
||||
add_library(fdb_c_shim OBJECT fdb_c_shim.cpp)
|
||||
target_link_libraries(fdb_c_shim PUBLIC dl)
|
||||
|
||||
elseif(NOT WIN32 AND NOT APPLE AND NOT OPEN_FOR_IDE) # Linux Only
|
||||
elseif(NOT WIN32 AND NOT APPLE AND NOT OPEN_FOR_IDE AND NOT USE_UBSAN) # Linux, non-ubsan only
|
||||
|
||||
set(SHIM_LIB_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
@ -472,7 +464,7 @@ elseif(NOT WIN32 AND NOT APPLE AND NOT OPEN_FOR_IDE) # Linux Only
|
||||
--api-test-dir ${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/tests
|
||||
)
|
||||
|
||||
endif() # End Linux only
|
||||
endif() # End Linux, non-ubsan only
|
||||
|
||||
# TODO: re-enable once the old vcxproj-based build system is removed.
|
||||
#generate_export_header(fdb_c EXPORT_MACRO_NAME "DLLEXPORT"
|
||||
|
@ -95,10 +95,10 @@ if(USE_SANITIZER)
|
||||
endif()
|
||||
message(STATUS "A sanitizer is enabled, need to build boost from source")
|
||||
if (USE_VALGRIND)
|
||||
compile_boost(TARGET boost_asan BUILD_ARGS valgrind=on
|
||||
compile_boost(TARGET boost_target BUILD_ARGS valgrind=on
|
||||
CXXFLAGS ${SANITIZER_COMPILE_OPTIONS} LDFLAGS ${SANITIZER_LINK_OPTIONS})
|
||||
else()
|
||||
compile_boost(TARGET boost_asan BUILD_ARGS context-impl=ucontext
|
||||
compile_boost(TARGET boost_target BUILD_ARGS context-impl=ucontext
|
||||
CXXFLAGS ${SANITIZER_COMPILE_OPTIONS} LDFLAGS ${SANITIZER_LINK_OPTIONS})
|
||||
endif()
|
||||
return()
|
||||
|
@ -66,11 +66,7 @@ foreach(ft flow flow_sampling flowlinktest)
|
||||
target_include_directories(${ft} SYSTEM BEFORE PUBLIC ${WOLFSSL_INCLUDE_DIR}/wolfssl)
|
||||
endif()
|
||||
target_link_libraries(${ft} PUBLIC Threads::Threads ${CMAKE_DL_LIBS})
|
||||
if(USE_SANITIZER)
|
||||
target_link_libraries(${ft} PUBLIC boost_asan)
|
||||
else()
|
||||
target_link_libraries(${ft} PUBLIC boost_target)
|
||||
endif()
|
||||
target_link_libraries(${ft} PUBLIC boost_target)
|
||||
if(USE_VALGRIND)
|
||||
target_link_libraries(${ft} PUBLIC Valgrind)
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user