Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: third_party/afl/BUILD.gn

Issue 2095843002: Build afl-tools with fuzzers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change //third_party/afl:afl to //third_party/afl. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/config/sanitizers/BUILD.gn ('k') | third_party/afl/README.chromium » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 group("afl") {
6 deps = [
7 ":afl-cmin",
8 ":afl-fuzz",
9 ":afl-showmap",
10 ":afl-tmin",
11 ":afl_docs",
12 ":afl_runtime",
13 ]
14 }
15
5 source_set("afl_runtime") { 16 source_set("afl_runtime") {
6 # AFL needs this flag to be built with -Werror. This is because it uses u8* 17 # AFL needs this flag to be built with -Werror. This is because it uses u8*
7 # and char* types interchangeably in its source code. The AFL Makefiles use 18 # and char* types interchangeably in its source code. The AFL Makefiles use
8 # this flag. 19 # this flag.
9 cflags = [ "-Wno-pointer-sign" ] 20 cflags = [ "-Wno-pointer-sign" ]
10 21
11 configs -= [ 22 configs -= [
12 # These functions should not be compiled with sanitizers since they 23 # These functions should not be compiled with sanitizers since they
13 # are used by the sanitizers. 24 # are used by the sanitizers.
14 "//build/config/sanitizers:default_sanitizer_flags", 25 "//build/config/sanitizers:default_sanitizer_flags",
15 26
16 # Every function in this library should have "default" visibility. 27 # Every function in this library should have "default" visibility.
17 # Thus we turn off flags which make visibility "hidden" for functions 28 # Thus we turn off flags which make visibility "hidden" for functions
18 # that do not specify visibility. 29 # that do not specify visibility.
19 # The functions in this library will not conflict with others elsewhere 30 # The functions in this library will not conflict with others elsewhere
20 # because they begin with a double underscore and/or are static. 31 # because they begin with a double underscore and/or are static.
21 "//build/config/gcc:symbol_visibility_hidden", 32 "//build/config/gcc:symbol_visibility_hidden",
22 ] 33 ]
23 34
24 sources = [ 35 sources = [
25 "src/llvm_mode/afl-llvm-rt.o.c", 36 "src/llvm_mode/afl-llvm-rt.o.c",
26 ] 37 ]
27 } 38 }
39
40 afl_headers = [
41 "src/alloc-inl.h",
42 "src/config.h",
43 "src/debug.h",
44 "src/types.h",
45 "src/hash.h",
46 ]
47
48 config("afl-tool") {
49 cflags = [
50 # Include flags from afl's Makefile.
51 "-O3",
52 "-funroll-loops",
53 "-D_FORTIFY_SOURCE=2",
54
55 # These flags are necessary to build with -Werror.
56 "-Wno-sign-compare",
57 "-Wno-pointer-sign",
58
59 # TODO: Patch afl so the version is defined in source code and not the
60 # Makefile.
61 "-DVERSION=\"2.14b\"",
62
63 # afl_docs copies docs/ to this location.
64 "-DDOC_PATH=\"$root_build_dir/afl/docs/\"",
65
66 # This flag is needed for compilation but is only used for QEMU mode which
67 # we do not use. Therefore its value is unimportant.
68 "-DBIN_PATH=\"$root_build_dir\"",
69 ]
70 }
71
72 copy("afl-cmin") {
73 # afl-cmin is a bash script used to minimize the corpus, therefore we can just
74 # copy it over.
75 sources = [
76 "src/afl-cmin",
77 ]
78 outputs = [
79 "$root_build_dir/{{source_file_part}}",
80 ]
81 deps = [
82 ":afl-showmap",
83 ]
84 }
85
86 copy("afl_docs") {
87 # Copy the docs folder. This is so that we can use a real value for for
88 # -DDOC_PATH when compiling.
89 sources = [
90 "src/docs",
91 ]
92 outputs = [
93 "$root_build_dir/afl/{{source_file_part}}",
94 ]
95 }
96
97 executable("afl-fuzz") {
98 # Used to fuzz programs.
99 configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
100 configs += [ ":afl-tool" ]
101
102 sources = [
103 "src/afl-fuzz.c",
104 ]
105 sources += afl_headers
106 }
107
108 executable("afl-tmin") {
109 configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
110 configs += [ ":afl-tool" ]
111
112 sources = [
113 "src/afl-tmin.c",
114 ]
115 sources += afl_headers
116 }
117
118 executable("afl-showmap") {
119 configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
120 configs += [ ":afl-tool" ]
121
122 sources = [
123 "src/afl-showmap.c",
124 ]
125 sources += afl_headers
126 }
OLDNEW
« no previous file with comments | « build/config/sanitizers/BUILD.gn ('k') | third_party/afl/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698