OLD | NEW |
---|---|
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 copy("afl-cmin") { | |
inferno
2016/06/27 04:27:39
copy blocks will look more readable after the conf
Jonathan Metzman
2016/06/27 05:36:07
Done.
| |
41 # afl-cmin is a bash script used to minimize the corpus, therefore we can just | |
42 # copy it over. | |
43 sources = [ | |
44 "src/afl-cmin", | |
45 ] | |
46 outputs = [ | |
47 "$root_build_dir/{{source_file_part}}", | |
48 ] | |
49 deps = [ | |
50 ":afl-showmap", | |
51 ] | |
52 } | |
53 | |
54 copy("afl_docs") { | |
55 # Copy the docs folder. This is so that we can use a real value for for | |
inferno
2016/06/27 04:27:39
s/for for/for
Why are docs even needed for compil
Jonathan Metzman
2016/06/27 04:33:42
When afl-fuzz prints error messages it sometimes i
| |
56 # -DDOC_PATH when compiling. | |
57 sources = [ | |
58 "src/docs", | |
59 ] | |
60 outputs = [ | |
61 "$root_build_dir/afl/{{source_file_part}}", | |
62 ] | |
63 } | |
64 | |
65 afl_headers = [ | |
66 "src/config.h", | |
inferno
2016/06/27 04:27:39
alpha order
Jonathan Metzman
2016/06/27 05:36:07
Done.
| |
67 "src/types.h", | |
68 "src/debug.h", | |
69 "src/alloc-inl.h", | |
70 "src/hash.h", | |
71 ] | |
72 | |
73 config("afl-tool") { | |
74 cflags = [ | |
75 # Include flags from afl's Makefile. -Wno-pointer-sign is necessary | |
76 # to build with -Werror. | |
77 "-O3", | |
78 "-funroll-loops", | |
79 "-Wno-pointer-sign", | |
inferno
2016/06/27 04:27:39
Move this near line 83 and remove its comment from
Jonathan Metzman
2016/06/27 05:36:07
Done.
| |
80 "-D_FORTIFY_SOURCE=2", | |
81 | |
82 # This flag is also necessary to build with -Werror. | |
83 "-Wno-sign-compare", | |
84 | |
85 # TODO: Patch afl so the version is defined in source code and not the | |
86 # Makefile. | |
87 "-DVERSION=\"2.14b\"", | |
88 | |
89 # afl_docs copies docs/ to this location. | |
90 "-DDOC_PATH=\"$root_build_dir/afl/docs/\"", | |
91 | |
92 # Since we are not running make install, don't | |
inferno
2016/06/27 04:27:39
Missing language in comment after "don't"
Jonathan Metzman
2016/06/27 05:36:07
Done.
| |
93 # important that afl builds. | |
94 "-DBIN_PATH=\"$root_build_dir\"", | |
95 "-DMISC_PATH=\"$root_build_dir\"", | |
96 ] | |
97 } | |
98 | |
99 executable("afl-fuzz") { | |
100 # Used to fuzz programs. | |
101 configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ] | |
102 configs += [ ":afl-tool" ] | |
103 | |
104 sources = [ | |
105 "src/afl-fuzz.c", | |
106 ] | |
107 sources += afl_headers | |
108 } | |
109 | |
110 executable("afl-tmin") { | |
111 configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ] | |
112 configs += [ ":afl-tool" ] | |
113 | |
114 sources = [ | |
115 "src/afl-tmin.c", | |
116 ] | |
117 sources += afl_headers | |
118 } | |
119 | |
120 executable("afl-showmap") { | |
121 configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ] | |
122 configs += [ ":afl-tool" ] | |
123 | |
124 sources = [ | |
125 "src/afl-showmap.c", | |
126 ] | |
127 sources += afl_headers | |
128 } | |
OLD | NEW |