2020-04-22 11:04:19 +02:00
|
|
|
if(ANALYZE_MEMORY)
|
|
|
|
add_compile_options(-fsanitize=memory)
|
|
|
|
add_compile_options(-fsanitize-memory-track-origins=2)
|
|
|
|
add_compile_options(-fno-omit-frame-pointer)
|
2020-04-24 21:17:06 +02:00
|
|
|
add_compile_options(-fno-optimize-sibling-calls)
|
2015-02-13 19:00:14 +01:00
|
|
|
|
2020-04-22 11:04:19 +02:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=memory")
|
|
|
|
elseif(ANALYZE_ADDRESS)
|
|
|
|
add_compile_options(-fsanitize=address)
|
|
|
|
add_compile_options(-fno-omit-frame-pointer)
|
2020-04-24 21:17:06 +02:00
|
|
|
add_compile_options(-fno-optimize-sibling-calls)
|
2015-02-13 19:00:14 +01:00
|
|
|
|
2020-04-22 11:04:19 +02:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
|
|
|
elseif(ANALYZE_THREAD)
|
|
|
|
add_compile_options(-fsanitize=thread)
|
2015-02-13 19:00:14 +01:00
|
|
|
|
2020-04-22 11:04:19 +02:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
|
|
|
|
endif()
|
2015-02-13 19:00:14 +01:00
|
|
|
|
2020-04-22 11:04:19 +02:00
|
|
|
if(ANALYZE_UNDEFINED)
|
2020-04-24 21:17:06 +02:00
|
|
|
add_compile_options(-fsanitize=undefined)
|
|
|
|
add_compile_options(-fno-sanitize-recover=all)
|
|
|
|
add_compile_options(-fno-omit-frame-pointer)
|
2015-02-13 19:00:14 +01:00
|
|
|
|
2020-04-22 11:04:19 +02:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
|
|
|
|
endif()
|
2015-02-13 19:00:14 +01:00
|
|
|
|
2020-04-22 11:04:19 +02:00
|
|
|
if(ANALYZE_DATAFLOW)
|
|
|
|
add_compile_options(-fsanitize=dataflow)
|
2015-02-13 19:00:14 +01:00
|
|
|
|
2020-04-22 11:04:19 +02:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=dataflow")
|
|
|
|
endif()
|