[PATCH] D38858: [cmake] Allow building fuzzers with OSS-Fuzz flags.

Justin Bogner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 13:12:08 PDT 2017


bogner added inline comments.


================
Comment at: llvm/cmake/modules/AddLLVM.cmake:897
   cmake_parse_arguments(ARG "" "DUMMY_MAIN" "" ${ARGN})
-  if( LLVM_USE_SANITIZE_COVERAGE )
+  if( LIB_FUZZING_ENGINE )
+    set(LLVM_OPTIONAL_SOURCES ${ARG_DUMMY_MAIN})
----------------
morehouse wrote:
> bogner wrote:
> > How / where does this get set?
> In the CMake configure command.  See https://github.com/google/oss-fuzz/pull/885.
Okay, if we're going to use a cmake variable for this we should do it right and define a cache variable with documentation in the top level CMakeLists.txt file. I'd probably add it next to where we add LLVM_USE_SANITIZER.

Also, we should namespace this appropriately. Something like LLVM_LIB_FUZZING_ENGINE or LLVM_FUZZING_ENGINE.

Optionally, we could also set it up so that we default that to libFuzzer in the LLVM_USE_SANITIZE_COVERAGE case so that we don't even need two cases here.


https://reviews.llvm.org/D38858





More information about the llvm-commits mailing list