2016-05-27 04:55:05 +08:00
|
|
|
set(LIBFUZZER_FLAGS_BASE "${CMAKE_CXX_FLAGS}")
|
2015-03-31 06:09:51 +08:00
|
|
|
# Disable the coverage and sanitizer instrumentation for the fuzzer itself.
|
2016-12-13 04:58:10 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${LIBFUZZER_FLAGS_BASE} -fno-sanitize-coverage=trace-pc-guard,edge,trace-cmp,indirect-calls,8bit-counters -Werror")
|
2015-04-07 00:09:13 +08:00
|
|
|
if( LLVM_USE_SANITIZE_COVERAGE )
|
2016-05-27 04:55:09 +08: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-23 06:35:31 +08:00
|
|
|
add_library(LLVMFuzzerNoMainObjects OBJECT
|
2015-01-30 00:58:29 +08:00
|
|
|
FuzzerCrossOver.cpp
|
2015-02-20 02:45:37 +08:00
|
|
|
FuzzerDriver.cpp
|
2016-06-02 13:48:02 +08:00
|
|
|
FuzzerExtFunctionsDlsym.cpp
|
2017-02-10 09:35:46 +08:00
|
|
|
FuzzerExtFunctionsDlsymWin.cpp
|
2016-06-02 13:48:02 +08:00
|
|
|
FuzzerExtFunctionsWeak.cpp
|
2015-01-30 00:58:29 +08:00
|
|
|
FuzzerIO.cpp
|
2016-12-01 05:44:26 +08:00
|
|
|
FuzzerIOPosix.cpp
|
|
|
|
FuzzerIOWindows.cpp
|
2015-01-30 00:58:29 +08:00
|
|
|
FuzzerLoop.cpp
|
2016-12-09 09:17:24 +08:00
|
|
|
FuzzerMerge.cpp
|
2015-01-30 00:58:29 +08:00
|
|
|
FuzzerMutate.cpp
|
2015-05-15 06:41:49 +08:00
|
|
|
FuzzerSHA1.cpp
|
2017-01-21 04:57:07 +08:00
|
|
|
FuzzerShmemPosix.cpp
|
2017-02-08 08:02:12 +08:00
|
|
|
FuzzerShmemWindows.cpp
|
2016-02-27 05:33:56 +08:00
|
|
|
FuzzerTracePC.cpp
|
2016-12-01 05:44:26 +08:00
|
|
|
FuzzerTraceState.cpp
|
2015-01-30 00:58:29 +08:00
|
|
|
FuzzerUtil.cpp
|
2016-08-13 02:29:36 +08:00
|
|
|
FuzzerUtilDarwin.cpp
|
|
|
|
FuzzerUtilLinux.cpp
|
2016-12-03 07:02:01 +08:00
|
|
|
FuzzerUtilPosix.cpp
|
|
|
|
FuzzerUtilWindows.cpp
|
2015-01-30 00:58:29 +08:00
|
|
|
)
|
2015-05-23 06:35:31 +08:00
|
|
|
add_library(LLVMFuzzerNoMain STATIC
|
|
|
|
$<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
|
|
|
|
)
|
2016-03-01 23:54:40 +08:00
|
|
|
target_link_libraries(LLVMFuzzerNoMain ${PTHREAD_LIB})
|
2015-01-31 07:26:57 +08:00
|
|
|
add_library(LLVMFuzzer STATIC
|
|
|
|
FuzzerMain.cpp
|
2015-05-23 06:35:31 +08:00
|
|
|
$<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
|
2015-01-31 07:26:57 +08:00
|
|
|
)
|
2016-03-01 23:54:40 +08:00
|
|
|
target_link_libraries(LLVMFuzzer ${PTHREAD_LIB})
|
2015-01-30 00:58:29 +08:00
|
|
|
|
|
|
|
if( LLVM_INCLUDE_TESTS )
|
|
|
|
add_subdirectory(test)
|
|
|
|
endif()
|
|
|
|
endif()
|