]> granicus.if.org Git - llvm/commitdiff
Update libFuzzer documentation for -fsanitize=fuzzer-no-link flag
authorGeorge Karpenkov <ekarpenkov@apple.com>
Fri, 11 Aug 2017 17:23:45 +0000 (17:23 +0000)
committerGeorge Karpenkov <ekarpenkov@apple.com>
Fri, 11 Aug 2017 17:23:45 +0000 (17:23 +0000)
Differential Revision: https://reviews.llvm.org/D36602

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310734 91177308-0d34-0410-b5e6-96231b3b80d8

docs/LibFuzzer.rst

index e22ed388e40fca8515526ed12549d010597cf329..d9c7966a721fdfba65221d7b36d533674a2b1fc2 100644 (file)
@@ -90,12 +90,24 @@ Some important things to remember about fuzz targets:
 Fuzzer Usage
 ------------
 
-Very recent versions of Clang (> April 20 2017) include libFuzzer,
+Very recent versions of Clang (after April 20 2017) include libFuzzer,
 and no installation is necessary.
 In order to fuzz your binary, use the `-fsanitize=fuzzer` flag during the compilation::
 
    clang -fsanitize=fuzzer,address mytarget.c
 
+This will perform the necessary instrumentation, as well as linking in libFuzzer
+library.
+Note that linking in libFuzzer defines the ``main`` symbol.
+If modifying ``CFLAGS`` of a large project, which also compiles executables
+requiring their own ``main`` symbol, it may be desirable to request just the
+instrumentation without linking::
+
+   clang -fsanitize=fuzzer-no-link mytarget.c
+
+Then libFuzzer can be linked to the desired driver by passing in
+``-fsanitize=fuzzer`` during the linking stage.
+
 Otherwise, build the libFuzzer library as a static archive, without any sanitizer
 options. Note that the libFuzzer library contains the ``main()`` function: