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

Kostya Serebryany via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 14:06:25 PDT 2017


kcc 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:
> > 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.
> Regarding switching the configuration under `LLVM_USE_SANITIZE_COVERAGE`, I don't think we want to do that.  OSS-Fuzz uses its own instrumentation which we don't want to mix with `-fsanitize=fuzzer`.  But having `-fsanitize=fuzzer` by default seems helpful for developers.
Right. 
oss-fuzz uses *different* build modes (e.g. one instrumentation for AFL, another for libFuzzer). 


https://reviews.llvm.org/D38858





More information about the llvm-commits mailing list