2016-05-26 20:55:05 +00:00
|
|
|
set(LIBFUZZER_FLAGS_BASE "${CMAKE_CXX_FLAGS}")
|
2015-03-30 22:09:51 +00:00
|
|
|
# Disable the coverage and sanitizer instrumentation for the fuzzer itself.
|
2016-05-26 20:55:05 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${LIBFUZZER_FLAGS_BASE} -fno-sanitize=all -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters -Werror")
|
2015-04-06 16:09:13 +00:00
|
|
|
if( LLVM_USE_SANITIZE_COVERAGE )
|
2016-05-26 20:55:09 +00:00
|
|
|
if(NOT "${LLVM_USE_SANITIZER}" STREQUAL "Address")
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"LibFuzzer and its tests require LLVM_USE_SANITIZER=Address and "
|
|
|
|
"LLVM_USE_SANITIZE_COVERAGE=YES to be set."
|
|
|
|
)
|
|
|
|
endif()
|
2015-05-22 22:35:31 +00:00
|
|
|
add_library(LLVMFuzzerNoMainObjects OBJECT
|
2015-01-29 16:58:29 +00:00
|
|
|
FuzzerCrossOver.cpp
|
2015-05-11 21:16:27 +00:00
|
|
|
FuzzerTraceState.cpp
|
2015-02-19 18:45:37 +00:00
|
|
|
FuzzerDriver.cpp
|
2016-06-02 05:48:02 +00:00
|
|
|
FuzzerExtFunctionsDlsym.cpp
|
|
|
|
FuzzerExtFunctionsWeak.cpp
|
2015-01-29 16:58:29 +00:00
|
|
|
FuzzerIO.cpp
|
|
|
|
FuzzerLoop.cpp
|
|
|
|
FuzzerMutate.cpp
|
2015-05-14 22:41:49 +00:00
|
|
|
FuzzerSHA1.cpp
|
2016-02-26 21:33:56 +00:00
|
|
|
FuzzerTracePC.cpp
|
2015-01-29 16:58:29 +00:00
|
|
|
FuzzerUtil.cpp
|
|
|
|
)
|
2015-05-22 22:35:31 +00:00
|
|
|
add_library(LLVMFuzzerNoMain STATIC
|
|
|
|
$<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
|
|
|
|
)
|
2016-03-01 15:54:40 +00:00
|
|
|
target_link_libraries(LLVMFuzzerNoMain ${PTHREAD_LIB})
|
2015-01-30 23:26:57 +00:00
|
|
|
add_library(LLVMFuzzer STATIC
|
|
|
|
FuzzerMain.cpp
|
2015-05-22 22:35:31 +00:00
|
|
|
$<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
|
2015-01-30 23:26:57 +00:00
|
|
|
)
|
2016-03-01 15:54:40 +00:00
|
|
|
target_link_libraries(LLVMFuzzer ${PTHREAD_LIB})
|
2015-01-29 16:58:29 +00:00
|
|
|
|
|
|
|
if( LLVM_INCLUDE_TESTS )
|
|
|
|
add_subdirectory(test)
|
|
|
|
endif()
|
|
|
|
endif()
|