| Index: third_party/afl/BUILD.gn
|
| diff --git a/third_party/afl/BUILD.gn b/third_party/afl/BUILD.gn
|
| index c4627c3699468a75d30e9f8fd3af8e9c7f4bd61f..713293db786e1f86dc7c011097425fabb969bbd6 100644
|
| --- a/third_party/afl/BUILD.gn
|
| +++ b/third_party/afl/BUILD.gn
|
| @@ -2,6 +2,17 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| +group("afl") {
|
| + deps = [
|
| + ":afl-cmin",
|
| + ":afl-fuzz",
|
| + ":afl-showmap",
|
| + ":afl-tmin",
|
| + ":afl_docs",
|
| + ":afl_runtime",
|
| + ]
|
| +}
|
| +
|
| source_set("afl_runtime") {
|
| # AFL needs this flag to be built with -Werror. This is because it uses u8*
|
| # and char* types interchangeably in its source code. The AFL Makefiles use
|
| @@ -25,3 +36,91 @@ source_set("afl_runtime") {
|
| "src/llvm_mode/afl-llvm-rt.o.c",
|
| ]
|
| }
|
| +
|
| +afl_headers = [
|
| + "src/alloc-inl.h",
|
| + "src/config.h",
|
| + "src/debug.h",
|
| + "src/types.h",
|
| + "src/hash.h",
|
| +]
|
| +
|
| +config("afl-tool") {
|
| + cflags = [
|
| + # Include flags from afl's Makefile.
|
| + "-O3",
|
| + "-funroll-loops",
|
| + "-D_FORTIFY_SOURCE=2",
|
| +
|
| + # These flags are necessary to build with -Werror.
|
| + "-Wno-sign-compare",
|
| + "-Wno-pointer-sign",
|
| +
|
| + # TODO: Patch afl so the version is defined in source code and not the
|
| + # Makefile.
|
| + "-DVERSION=\"2.14b\"",
|
| +
|
| + # afl_docs copies docs/ to this location.
|
| + "-DDOC_PATH=\"$root_build_dir/afl/docs/\"",
|
| +
|
| + # This flag is needed for compilation but is only used for QEMU mode which
|
| + # we do not use. Therefore its value is unimportant.
|
| + "-DBIN_PATH=\"$root_build_dir\"",
|
| + ]
|
| +}
|
| +
|
| +copy("afl-cmin") {
|
| + # afl-cmin is a bash script used to minimize the corpus, therefore we can just
|
| + # copy it over.
|
| + sources = [
|
| + "src/afl-cmin",
|
| + ]
|
| + outputs = [
|
| + "$root_build_dir/{{source_file_part}}",
|
| + ]
|
| + deps = [
|
| + ":afl-showmap",
|
| + ]
|
| +}
|
| +
|
| +copy("afl_docs") {
|
| + # Copy the docs folder. This is so that we can use a real value for for
|
| + # -DDOC_PATH when compiling.
|
| + sources = [
|
| + "src/docs",
|
| + ]
|
| + outputs = [
|
| + "$root_build_dir/afl/{{source_file_part}}",
|
| + ]
|
| +}
|
| +
|
| +executable("afl-fuzz") {
|
| + # Used to fuzz programs.
|
| + configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
|
| + configs += [ ":afl-tool" ]
|
| +
|
| + sources = [
|
| + "src/afl-fuzz.c",
|
| + ]
|
| + sources += afl_headers
|
| +}
|
| +
|
| +executable("afl-tmin") {
|
| + configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
|
| + configs += [ ":afl-tool" ]
|
| +
|
| + sources = [
|
| + "src/afl-tmin.c",
|
| + ]
|
| + sources += afl_headers
|
| +}
|
| +
|
| +executable("afl-showmap") {
|
| + configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
|
| + configs += [ ":afl-tool" ]
|
| +
|
| + sources = [
|
| + "src/afl-showmap.c",
|
| + ]
|
| + sources += afl_headers
|
| +}
|
|
|