forked from OSchip/llvm-project
[clang-fuzzer] Allow linking with any fuzzing engine.
Summary: Makes clang-[proto-]fuzzer compatible with flags specified by OSS-Fuzz. https://llvm.org/pr34314 Reviewers: vitalybuka, kcc Reviewed By: kcc Subscribers: cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D38812 llvm-svn: 315486
This commit is contained in:
parent
6c0aef77aa
commit
6c108b363e
|
@ -1,7 +1,9 @@
|
||||||
set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} FuzzMutate)
|
set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} FuzzMutate)
|
||||||
set(CXX_FLAGS_NOFUZZ ${CMAKE_CXX_FLAGS})
|
set(CXX_FLAGS_NOFUZZ ${CMAKE_CXX_FLAGS})
|
||||||
set(DUMMY_MAIN DummyClangFuzzer.cpp)
|
set(DUMMY_MAIN DummyClangFuzzer.cpp)
|
||||||
if(LLVM_USE_SANITIZE_COVERAGE)
|
if(DEFINED LIB_FUZZING_ENGINE)
|
||||||
|
unset(DUMMY_MAIN)
|
||||||
|
elseif(LLVM_USE_SANITIZE_COVERAGE)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
|
||||||
set(CXX_FLAGS_NOFUZZ "${CXX_FLAGS_NOFUZZ} -fsanitize=fuzzer-no-link")
|
set(CXX_FLAGS_NOFUZZ "${CXX_FLAGS_NOFUZZ} -fsanitize=fuzzer-no-link")
|
||||||
unset(DUMMY_MAIN)
|
unset(DUMMY_MAIN)
|
||||||
|
@ -48,6 +50,7 @@ if(CLANG_ENABLE_PROTO_FUZZER)
|
||||||
target_link_libraries(clang-proto-fuzzer
|
target_link_libraries(clang-proto-fuzzer
|
||||||
${ProtobufMutator_LIBRARIES}
|
${ProtobufMutator_LIBRARIES}
|
||||||
${PROTOBUF_LIBRARIES}
|
${PROTOBUF_LIBRARIES}
|
||||||
|
${LIB_FUZZING_ENGINE}
|
||||||
clangCXXProto
|
clangCXXProto
|
||||||
clangHandleCXX
|
clangHandleCXX
|
||||||
clangProtoToCXX
|
clangProtoToCXX
|
||||||
|
@ -63,5 +66,6 @@ add_clang_executable(clang-fuzzer
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(clang-fuzzer
|
target_link_libraries(clang-fuzzer
|
||||||
|
${LIB_FUZZING_ENGINE}
|
||||||
clangHandleCXX
|
clangHandleCXX
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue