xref: /aosp_15_r20/external/AFLplusplus/Android.bp (revision 08b48e0b10e97b33e7b60c5b6e2243bd915777f2)
1package {
2    default_applicable_licenses: ["external_AFLplusplus_license"],
3}
4
5// Added automatically by a large-scale-change that took the approach of
6// 'apply every license found to every target'. While this makes sure we respect
7// every license restriction, it may not be entirely correct.
8//
9// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10//
11// Please consider splitting the single license below into multiple licenses,
12// taking care not to lose any license_kind information, and overriding the
13// default license using the 'licenses: [...]' property on targets as needed.
14//
15// For unused files, consider creating a 'fileGroup' with "//visibility:private"
16// to attach the license to, and including a comment whether the files may be
17// used in the current project.
18// See: http://go/android-license-faq
19license {
20    name: "external_AFLplusplus_license",
21    visibility: [":__subpackages__"],
22    license_kinds: [
23        "legacy_unencumbered",
24        "SPDX-license-identifier-Apache-2.0",
25        "SPDX-license-identifier-BSD",
26        "SPDX-license-identifier-CC0-1.0",
27    ],
28    license_text: [
29        "LICENSE",
30    ],
31}
32
33cc_defaults {
34  name: "afl-defaults",
35  export_include_dirs: [
36    "include",
37    "instrumentation",
38  ],
39  local_include_dirs: [
40    "include",
41    "instrumentation",
42  ],
43  // Upstream hasn't yet adapted to () meaning (void) rather than (...) in C23.
44  c_std: "gnu17",
45  cflags: [
46    "-funroll-loops",
47    "-Wno-pointer-sign",
48    "-Wno-pointer-arith",
49    "-Wno-sign-compare",
50    "-Wno-unused-parameter",
51    "-Wno-unused-function",
52    "-Wno-format",
53    "-Wno-user-defined-warnings",
54    "-DAFL_LLVM_USE_TRACE_PC=1",
55    "-DBIN_PATH=\"out/host/linux-x86/bin\"",
56    "-DDOC_PATH=\"out/host/linux-x86/shared/doc/afl\"",
57    "-DDEBUG_BUILD",
58    "-U_FORTIFY_SOURCE",
59    "-ggdb3",
60    "-g",
61    "-O0",
62     "-fno-omit-frame-pointer",
63    "-fPIC",
64   ],
65
66  target: {
67    android_arm64: {
68      cflags: [
69        "-D__ANDROID__",
70      ],
71    },
72    android_arm: {
73      cflags: [
74        "-D__ANDROID__",
75      ],
76    },
77    android_x86_64: {
78      cflags: [
79        "-D__ANDROID__",
80      ],
81    },
82    android_x86: {
83      cflags: [
84        "-D__ANDROID__",
85      ],
86    },
87  },
88}
89
90cc_binary {
91  name: "afl-fuzz",
92  host_supported: true,
93
94  defaults: [
95    "afl-defaults",
96  ],
97
98  srcs: [
99    "src/afl-fuzz*.c",
100    "src/afl-common.c",
101    "src/afl-sharedmem.c",
102    "src/afl-forkserver.c",
103    "src/afl-performance.c",
104  ],
105}
106
107cc_binary {
108  name: "afl-showmap",
109  static_executable: true,
110  host_supported: true,
111
112  defaults: [
113    "afl-defaults",
114  ],
115
116  srcs: [
117    "src/afl-showmap.c",
118    "src/afl-common.c",
119    "src/afl-sharedmem.c",
120    "src/afl-forkserver.c",
121    "src/afl-performance.c",
122    "src/afl-fuzz-mutators.c",
123    "src/afl-fuzz-python.c",
124  ],
125}
126
127cc_binary {
128  name: "afl-gotcpu",
129  static_executable: true,
130  host_supported: true,
131
132  defaults: [
133    "afl-defaults",
134  ],
135
136  srcs: [
137    "src/afl-gotcpu.c",
138    "src/afl-common.c",
139    "src/afl-sharedmem.c",
140    "src/afl-forkserver.c",
141    "src/afl-performance.c",
142  ],
143}
144
145cc_binary {
146  name: "afl-tmin",
147  static_executable: true,
148  host_supported: true,
149
150  defaults: [
151    "afl-defaults",
152  ],
153
154  srcs: [
155    "src/afl-tmin.c",
156    "src/afl-common.c",
157    "src/afl-sharedmem.c",
158    "src/afl-forkserver.c",
159    "src/afl-performance.c",
160  ],
161}
162
163cc_object {
164  name: "aflpp_driver",
165  vendor_available: true,
166  host_supported: true,
167  srcs: [
168    "utils/aflpp_driver/aflpp_driver.c",
169  ],
170  defaults: ["afl-defaults"],
171}
172
173cc_object {
174  name: "afl-compiler-rt",
175  vendor_available: true,
176  host_supported: true,
177  cflags: [
178    "-fPIC",
179  ],
180  srcs: [
181    "instrumentation/afl-compiler-rt.o.c",
182  ],
183  defaults: ["afl-defaults"],
184}
185
186cc_library_headers {
187  name: "libafl_headers",
188  vendor_available: true,
189  host_supported: true,
190  export_include_dirs: [
191    "include",
192    "instrumentation",
193  ],
194}
195
196subdirs = [
197  "custom_mutators",
198]
199