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-12-12 20:58:10 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${LIBFUZZER_FLAGS_BASE} -fno-sanitize-coverage=trace-pc-guard,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-02-19 18:45:37 +00:00
|
|
|
FuzzerDriver.cpp
|
2016-06-02 05:48:02 +00:00
|
|
|
FuzzerExtFunctionsDlsym.cpp
|
2017-02-10 01:35:46 +00:00
|
|
|
FuzzerExtFunctionsDlsymWin.cpp
|
2016-06-02 05:48:02 +00:00
|
|
|
FuzzerExtFunctionsWeak.cpp
|
2015-01-29 16:58:29 +00:00
|
|
|
FuzzerIO.cpp
|
2016-11-30 21:44:26 +00:00
|
|
|
FuzzerIOPosix.cpp
|
|
|
|
FuzzerIOWindows.cpp
|
2015-01-29 16:58:29 +00:00
|
|
|
FuzzerLoop.cpp
|
2016-12-09 01:17:24 +00:00
|
|
|
FuzzerMerge.cpp
|
2015-01-29 16:58:29 +00:00
|
|
|
FuzzerMutate.cpp
|
2015-05-14 22:41:49 +00:00
|
|
|
FuzzerSHA1.cpp
|
2017-01-20 20:57:07 +00:00
|
|
|
FuzzerShmemPosix.cpp
|
2017-02-08 00:02:12 +00:00
|
|
|
FuzzerShmemWindows.cpp
|
2016-02-26 21:33:56 +00:00
|
|
|
FuzzerTracePC.cpp
|
2016-11-30 21:44:26 +00:00
|
|
|
FuzzerTraceState.cpp
|
2015-01-29 16:58:29 +00:00
|
|
|
FuzzerUtil.cpp
|
2016-08-12 18:29:36 +00:00
|
|
|
FuzzerUtilDarwin.cpp
|
|
|
|
FuzzerUtilLinux.cpp
|
2016-12-02 23:02:01 +00:00
|
|
|
FuzzerUtilPosix.cpp
|
|
|
|
FuzzerUtilWindows.cpp
|
2015-01-29 16:58:29 +00:00
|
|
|
)
|
2015-05-22 22:35:31 +00:00
|
|
|
add_library(LLVMFuzzerNoMain STATIC
|
|
|
|
$<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
|
|
|
|
)
|
2017-02-10 01:59:20 +00:00
|
|
|
target_link_libraries(LLVMFuzzerNoMain ${LLVM_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
|
|
|
)
|
2017-02-10 01:59:20 +00:00
|
|
|
target_link_libraries(LLVMFuzzer ${LLVM_PTHREAD_LIB})
|
2015-01-29 16:58:29 +00:00
|
|
|
|
|
|
|
if( LLVM_INCLUDE_TESTS )
|
|
|
|
add_subdirectory(test)
|
|
|
|
endif()
|
|
|
|
endif()
|