Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-forensics/aflplusplus/files/, app-forensics/aflplusplus/
Date: Wed, 31 Aug 2022 04:30:28
Message-Id: 1661919984.15de30edfddde262dcef800ad30ac8f6ecd7fbfd.sam@gentoo
1 commit: 15de30edfddde262dcef800ad30ac8f6ecd7fbfd
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Wed Aug 31 04:26:24 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 31 04:26:24 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15de30ed
7
8 app-forensics/aflplusplus: add 4.02c
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 app-forensics/aflplusplus/Manifest | 1 +
13 app-forensics/aflplusplus/aflplusplus-4.02c.ebuild | 84 +++++++++
14 ...lplusplus-4.02c-no-ignore-errors-makefile.patch | 149 +++++++++++++++
15 .../files/aflplusplus-4.02c-respect-flags.patch | 200 +++++++++++++++++++++
16 4 files changed, 434 insertions(+)
17
18 diff --git a/app-forensics/aflplusplus/Manifest b/app-forensics/aflplusplus/Manifest
19 index 3e2e5b638831..f5ef08b725dc 100644
20 --- a/app-forensics/aflplusplus/Manifest
21 +++ b/app-forensics/aflplusplus/Manifest
22 @@ -1,2 +1,3 @@
23 DIST aflplusplus-4.00c.tar.gz 2805041 BLAKE2B c1ce15aa9860fc02a7d6f608cae9dd8987b72253b465ea734c721d1b6927e482c31b907aeafe82c00618465227e2e140bfc595151ea5d73037638c3ee630872c SHA512 23a7a4260e581f7c212393e1e14704464bbbc3ff5465b3472db31c6c7f2cd25a9ecc5ad81fad8958c775fcd01b22269085e6c69419a07fbbdb9ec317a3e39beb
24 DIST aflplusplus-4.01c.tar.gz 2818445 BLAKE2B f3699c4b2fabec0ab238277c3b2c7b19b35af7a0b82b14a57c34b8579121cfa0644ef432132cf4a3382547db3faf799d2ab601512ddfb469e4a2246cdb61aa7f SHA512 d2b03ab4ff9538fe0b52aa3ed4778a6e5657d64d6f0e5f75a99305bad69c5179d6b1c882650f19a884a740577acb73dab7cee3d5c9c7b06ff2326ffeba37d1fe
25 +DIST aflplusplus-4.02c.tar.gz 2828429 BLAKE2B 0c4d7937626a699bb6768e2f67f369508f7ec131d1170cd48f8650d8081135b466733de34e52f2ac2213c4bd13ab8936b17d3b0f8debf28e8a32ad87d9dcb55d SHA512 f5159a84e0ecd2c260d2d8ce7df33fe4704c664bdf06f193a7fef377d48646e4d921ee90d0b66c7dac02d16e6b1607c6569351aaeea9b2ee3968d22b3f583763
26
27 diff --git a/app-forensics/aflplusplus/aflplusplus-4.02c.ebuild b/app-forensics/aflplusplus/aflplusplus-4.02c.ebuild
28 new file mode 100644
29 index 000000000000..45d84376a414
30 --- /dev/null
31 +++ b/app-forensics/aflplusplus/aflplusplus-4.02c.ebuild
32 @@ -0,0 +1,84 @@
33 +# Copyright 1999-2022 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=8
37 +
38 +PYTHON_COMPAT=( python3_{8..10} )
39 +LLVM_MAX_SLOT=14
40 +inherit toolchain-funcs llvm optfeature python-single-r1
41 +
42 +DESCRIPTION="A fork of AFL, the popular compile-time instrumentation fuzzer"
43 +HOMEPAGE="https://github.com/AFLplusplus/AFLplusplus"
44 +SRC_URI="https://github.com/AFLplusplus/AFLplusplus/archive/${PV}.tar.gz -> ${P}.tar.gz"
45 +S="${WORKDIR}/AFLplusplus-${PV}"
46 +
47 +LICENSE="Apache-2.0"
48 +SLOT="0"
49 +KEYWORDS="~amd64 ~arm64"
50 +IUSE="test"
51 +
52 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
53 +
54 +# Tests involve heavy use of LD_PRELOAD in some cases
55 +# This isn't compatible with sandbox
56 +RESTRICT="test"
57 +
58 +# It turns out we need Clang too
59 +RDEPEND="${PYTHON_DEPS}
60 + >=sys-devel/llvm-13:=
61 + || (
62 + sys-devel/clang:13
63 + sys-devel/clang:${LLVM_MAX_SLOT}
64 + )
65 + !app-forensics/afl"
66 +DEPEND="${RDEPEND}
67 + test? ( dev-util/cmocka )"
68 +
69 +QA_PREBUILT="usr/share/afl/testcases/others/elf/small_exec.elf"
70 +
71 +PATCHES=(
72 + "${FILESDIR}"/${PN}-4.02c-respect-flags.patch
73 + "${FILESDIR}"/${PN}-4.02c-no-ignore-errors-makefile.patch
74 + "${FILESDIR}"/${PN}-4.01c-lld-detect.patch
75 +)
76 +
77 +llvm_check_deps() {
78 + has_version -b "sys-devel/clang:${LLVM_SLOT}" && \
79 + has_version -b "sys-devel/llvm:${LLVM_SLOT}"
80 +}
81 +
82 +pkg_setup() {
83 + llvm_pkg_setup
84 + python-single-r1_pkg_setup
85 +}
86 +
87 +mymake() {
88 + emake \
89 + CC="$(tc-getCC)" \
90 + CXX="$(tc-getCXX)" \
91 + CFLAGS_FLTO="" \
92 + LLVM_CONFIG="$(get_llvm_prefix ${LLVM_MAX_SLOT})"/bin/llvm-config \
93 + PREFIX="${EPREFIX}/usr" \
94 + HELPER_PATH="${EPREFIX}/usr/$(get_libdir)/afl" \
95 + DOC_PATH="${EPREFIX}/usr/share/doc/${PF}" \
96 + MAN_PATH="${EPREFIX}/usr/share/man/man8"
97 +}
98 +
99 +src_compile() {
100 + mymake
101 +}
102 +
103 +src_test() {
104 + mymake test
105 +}
106 +
107 +src_install() {
108 + mymake DESTDIR="${D}" install
109 + dostrip -x /usr/share/afl/testcases/
110 +}
111 +
112 +pkg_postinst() {
113 + # TODO: Any others?
114 + optfeature "fuzzing with AFL_USE_ASAN" sys-libs/compiler-rt-sanitizers[asan]
115 + optfeature "fuzzing with AFL_USE_MSAN" sys-libs/compiler-rt-sanitizers[msan]
116 +}
117
118 diff --git a/app-forensics/aflplusplus/files/aflplusplus-4.02c-no-ignore-errors-makefile.patch b/app-forensics/aflplusplus/files/aflplusplus-4.02c-no-ignore-errors-makefile.patch
119 new file mode 100644
120 index 000000000000..8a2cccbcff8f
121 --- /dev/null
122 +++ b/app-forensics/aflplusplus/files/aflplusplus-4.02c-no-ignore-errors-makefile.patch
123 @@ -0,0 +1,149 @@
124 +https://bugs.gentoo.org/800941
125 +(also don't override jobs for sub-makes)
126 +
127 +--- a/GNUmakefile
128 ++++ b/GNUmakefile
129 +@@ -308,17 +308,17 @@ endif
130 +
131 + .PHONY: all
132 + all: test_x86 test_shm test_python ready $(PROGS) afl-as llvm gcc_plugin test_build all_done
133 +- -$(MAKE) -C utils/aflpp_driver
134 ++ $(MAKE) -C utils/aflpp_driver
135 +
136 + .PHONY: llvm
137 + llvm:
138 +- -$(MAKE) -j$(nproc) -f GNUmakefile.llvm
139 ++ $(MAKE) -f GNUmakefile.llvm
140 + @test -e afl-cc || { echo "[-] Compiling afl-cc failed. You seem not to have a working compiler." ; exit 1; }
141 +
142 + .PHONY: gcc_plugin
143 + gcc_plugin:
144 + ifneq "$(SYS)" "Darwin"
145 +- -$(MAKE) -f GNUmakefile.gcc_plugin
146 ++ $(MAKE) -f GNUmakefile.gcc_plugin
147 + endif
148 +
149 + .PHONY: man
150 +@@ -571,19 +571,19 @@ all_done: test_build
151 + .PHONY: clean
152 + clean:
153 + rm -rf $(PROGS) afl-fuzz-document afl-as as afl-g++ afl-clang afl-clang++ *.o src/*.o *~ a.out core core.[1-9][0-9]* *.stackdump .test .test1 .test2 test-instr .test-instr0 .test-instr1 afl-cs-proxy afl-qemu-trace afl-gcc-fast afl-g++-fast ld *.so *.8 test/unittests/*.o test/unittests/unit_maybe_alloc test/unittests/preallocable .afl-* afl-gcc afl-g++ afl-clang afl-clang++ test/unittests/unit_hash test/unittests/unit_rand *.dSYM lib*.a
154 +- -$(MAKE) -f GNUmakefile.llvm clean
155 +- -$(MAKE) -f GNUmakefile.gcc_plugin clean
156 +- -$(MAKE) -C utils/libdislocator clean
157 +- -$(MAKE) -C utils/libtokencap clean
158 +- -$(MAKE) -C utils/aflpp_driver clean
159 +- -$(MAKE) -C utils/afl_network_proxy clean
160 +- -$(MAKE) -C utils/socket_fuzzing clean
161 +- -$(MAKE) -C utils/argv_fuzzing clean
162 +- -$(MAKE) -C utils/plot_ui clean
163 +- -$(MAKE) -C qemu_mode/unsigaction clean
164 +- -$(MAKE) -C qemu_mode/libcompcov clean
165 +- -$(MAKE) -C qemu_mode/libqasan clean
166 +- -$(MAKE) -C frida_mode clean
167 ++ $(MAKE) -f GNUmakefile.llvm clean
168 ++ $(MAKE) -f GNUmakefile.gcc_plugin clean
169 ++ $(MAKE) -C utils/libdislocator clean
170 ++ $(MAKE) -C utils/libtokencap clean
171 ++ $(MAKE) -C utils/aflpp_driver clean
172 ++ $(MAKE) -C utils/afl_network_proxy clean
173 ++ $(MAKE) -C utils/socket_fuzzing clean
174 ++ $(MAKE) -C utils/argv_fuzzing clean
175 ++ $(MAKE) -C utils/plot_ui clean
176 ++ $(MAKE) -C qemu_mode/unsigaction clean
177 ++ $(MAKE) -C qemu_mode/libcompcov clean
178 ++ $(MAKE) -C qemu_mode/libqasan clean
179 ++ $(MAKE) -C frida_mode clean
180 + rm -rf nyx_mode/packer/linux_initramfs/init.cpio.gz nyx_mode/libnyx/libnyx/target/release/* nyx_mode/QEMU-Nyx/x86_64-softmmu/qemu-system-x86_64
181 + ifeq "$(IN_REPO)" "1"
182 + -test -e coresight_mode/coresight-trace/Makefile && $(MAKE) -C coresight_mode/coresight-trace clean || true
183 +@@ -613,21 +613,21 @@ endif
184 +
185 + .PHONY: distrib
186 + distrib: all
187 +- -$(MAKE) -j$(nproc) -f GNUmakefile.llvm
188 ++ $(MAKE) -f GNUmakefile.llvm
189 + ifneq "$(SYS)" "Darwin"
190 +- -$(MAKE) -f GNUmakefile.gcc_plugin
191 +-endif
192 +- -$(MAKE) -C utils/libdislocator
193 +- -$(MAKE) -C utils/libtokencap
194 +- -$(MAKE) -C utils/afl_network_proxy
195 +- -$(MAKE) -C utils/socket_fuzzing
196 +- -$(MAKE) -C utils/argv_fuzzing
197 +- # -$(MAKE) -C utils/plot_ui
198 +- -$(MAKE) -C frida_mode
199 ++ $(MAKE) -f GNUmakefile.gcc_plugin
200 ++endif
201 ++ $(MAKE) -C utils/libdislocator
202 ++ $(MAKE) -C utils/libtokencap
203 ++ $(MAKE) -C utils/afl_network_proxy
204 ++ $(MAKE) -C utils/socket_fuzzing
205 ++ $(MAKE) -C utils/argv_fuzzing
206 ++ # $(MAKE) -C utils/plot_ui
207 ++ $(MAKE) -C frida_mode
208 + ifneq "$(SYS)" "Darwin"
209 + ifeq "$(ARCH)" "aarch64"
210 + ifndef NO_CORESIGHT
211 +- -$(MAKE) -C coresight_mode
212 ++ $(MAKE) -C coresight_mode
213 + endif
214 + endif
215 + ifeq "$(SYS)" "Linux"
216 +@@ -647,17 +647,17 @@ endif
217 +
218 + .PHONY: binary-only
219 + binary-only: test_shm test_python ready $(PROGS)
220 +- -$(MAKE) -C utils/libdislocator
221 +- -$(MAKE) -C utils/libtokencap
222 +- -$(MAKE) -C utils/afl_network_proxy
223 +- -$(MAKE) -C utils/socket_fuzzing
224 +- -$(MAKE) -C utils/argv_fuzzing
225 +- # -$(MAKE) -C utils/plot_ui
226 +- -$(MAKE) -C frida_mode
227 ++ $(MAKE) -C utils/libdislocator
228 ++ $(MAKE) -C utils/libtokencap
229 ++ $(MAKE) -C utils/afl_network_proxy
230 ++ $(MAKE) -C utils/socket_fuzzing
231 ++ $(MAKE) -C utils/argv_fuzzing
232 ++ # $(MAKE) -C utils/plot_ui
233 ++ $(MAKE) -C frida_mode
234 + ifneq "$(SYS)" "Darwin"
235 + ifeq "$(ARCH)" "aarch64"
236 + ifndef NO_CORESIGHT
237 +- -$(MAKE) -C coresight_mode
238 ++ $(MAKE) -C coresight_mode
239 + endif
240 + endif
241 + ifeq "$(SYS)" "Linux"
242 +@@ -677,13 +677,13 @@ endif
243 +
244 + .PHONY: source-only
245 + source-only: all
246 +- -$(MAKE) -j$(nproc) -f GNUmakefile.llvm
247 ++ $(MAKE) -f GNUmakefile.llvm
248 + ifneq "$(SYS)" "Darwin"
249 +- -$(MAKE) -f GNUmakefile.gcc_plugin
250 ++ $(MAKE) -f GNUmakefile.gcc_plugin
251 + endif
252 +- -$(MAKE) -C utils/libdislocator
253 +- -$(MAKE) -C utils/libtokencap
254 +- # -$(MAKE) -C utils/plot_ui
255 ++ $(MAKE) -C utils/libdislocator
256 ++ $(MAKE) -C utils/libtokencap
257 ++ # $(MAKE) -C utils/plot_ui
258 + ifeq "$(SYS)" "Linux"
259 + ifndef NO_NYX
260 + -cd nyx_mode && ./build_nyx_support.sh
261 +@@ -731,9 +731,9 @@ install: all $(MANPAGES)
262 + @if [ -f utils/afl_network_proxy/afl-network-server ]; then $(MAKE) -C utils/afl_network_proxy install; fi
263 + @if [ -f utils/aflpp_driver/libAFLDriver.a ]; then set -e; install -m 644 utils/aflpp_driver/libAFLDriver.a $${DESTDIR}$(HELPER_PATH); fi
264 + @if [ -f utils/aflpp_driver/libAFLQemuDriver.a ]; then set -e; install -m 644 utils/aflpp_driver/libAFLQemuDriver.a $${DESTDIR}$(HELPER_PATH); fi
265 +- -$(MAKE) -f GNUmakefile.llvm install
266 ++ $(MAKE) -f GNUmakefile.llvm install
267 + ifneq "$(SYS)" "Darwin"
268 +- -$(MAKE) -f GNUmakefile.gcc_plugin install
269 ++ $(MAKE) -f GNUmakefile.gcc_plugin install
270 + endif
271 + ln -sf afl-cc $${DESTDIR}$(BIN_PATH)/afl-gcc
272 + ln -sf afl-cc $${DESTDIR}$(BIN_PATH)/afl-g++
273
274 diff --git a/app-forensics/aflplusplus/files/aflplusplus-4.02c-respect-flags.patch b/app-forensics/aflplusplus/files/aflplusplus-4.02c-respect-flags.patch
275 new file mode 100644
276 index 000000000000..65748a51c723
277 --- /dev/null
278 +++ b/app-forensics/aflplusplus/files/aflplusplus-4.02c-respect-flags.patch
279 @@ -0,0 +1,200 @@
280 +* Respect AR, CC, CFLAGS, CPPFLAGS, LDFLAGS everywhere when building.
281 +* Ignore build flags then when testing the CC wrappers (could contain
282 + incompatible flags).
283 +* Disable LTO for runtime objects, these shouldn't contain IR.
284 +
285 +--- a/GNUmakefile
286 ++++ b/GNUmakefile
287 +@@ -426,7 +426,7 @@ afl-as: src/afl-as.c include/afl-as.h $(COMM_HDR) | test_x86
288 + @ln -sf afl-as as
289 +
290 + src/afl-performance.o : $(COMM_HDR) src/afl-performance.c include/hash.h
291 +- $(CC) $(CFLAGS) $(CFLAGS_OPT) -Iinclude -c src/afl-performance.c -o src/afl-performance.o
292 ++ $(CC) $(CFLAGS) -Iinclude -c src/afl-performance.c -o src/afl-performance.o
293 +
294 + src/afl-common.o : $(COMM_HDR) src/afl-common.c include/common.h
295 + $(CC) $(CFLAGS) $(CFLAGS_FLTO) -c src/afl-common.c -o src/afl-common.o
296 +@@ -534,7 +534,7 @@ code-format:
297 + ifndef AFL_NO_X86
298 + test_build: afl-cc afl-gcc afl-as afl-showmap
299 + @echo "[*] Testing the CC wrapper afl-cc and its instrumentation output..."
300 +- @unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_LSAN AFL_USE_ASAN AFL_USE_MSAN; ASAN_OPTIONS=detect_leaks=0 AFL_INST_RATIO=100 AFL_PATH=. ./afl-cc test-instr.c $(LDFLAGS) -o test-instr 2>&1 || (echo "Oops, afl-cc failed"; exit 1 )
301 ++ @unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_LSAN AFL_USE_ASAN AFL_USE_MSAN; ASAN_OPTIONS=detect_leaks=0 AFL_INST_RATIO=100 AFL_PATH=. ./afl-cc test-instr.c -o test-instr 2>&1 || (echo "Oops, afl-cc failed"; exit 1 )
302 + ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null
303 + echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr
304 + @rm -f test-instr
305 +--- a/GNUmakefile.gcc_plugin
306 ++++ b/GNUmakefile.gcc_plugin
307 +@@ -133,20 +133,20 @@ afl-common.o: ./src/afl-common.c
308 + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ $(LDFLAGS)
309 +
310 + ./afl-compiler-rt.o: instrumentation/afl-compiler-rt.o.c
311 +- $(CC) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -fPIC -c $< -o $@
312 ++ $(CC) $(CFLAGS) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -fPIC -fno-lto -c $< -o $@
313 +
314 + ./afl-compiler-rt-32.o: instrumentation/afl-compiler-rt.o.c
315 + @printf "[*] Building 32-bit variant of the runtime (-m32)... "
316 +- @$(CC) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -m32 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
317 ++ @$(CC) $(CFLAGS) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m32 -fPIC -fno-lto -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
318 +
319 + ./afl-compiler-rt-64.o: instrumentation/afl-compiler-rt.o.c
320 + @printf "[*] Building 64-bit variant of the runtime (-m64)... "
321 +- @$(CC) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -m64 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
322 ++ @$(CC) $(CFLAGS) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m64 -fPIC -fno-lto -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
323 +
324 + $(PASSES): instrumentation/afl-gcc-common.h
325 +
326 + ./afl-gcc-pass.so: instrumentation/afl-gcc-pass.so.cc | test_deps
327 +- $(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@
328 ++ $(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@ $(LDFLAGS)
329 + ln -sf afl-cc afl-gcc-fast
330 + ln -sf afl-cc afl-g++-fast
331 + ln -sf afl-cc.8 afl-gcc-fast.8
332 +--- a/GNUmakefile.llvm
333 ++++ b/GNUmakefile.llvm
334 +@@ -410,7 +410,7 @@ endif
335 +
336 + ./afl-ld-lto: src/afl-ld-lto.c
337 + ifeq "$(LLVM_LTO)" "1"
338 +- $(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@
339 ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< -o $@
340 + endif
341 +
342 + ./SanitizerCoverageLTO.so: instrumentation/SanitizerCoverageLTO.so.cc instrumentation/afl-llvm-common.o
343 +@@ -444,25 +444,25 @@ afl-llvm-dict2file.so: instrumentation/afl-llvm-dict2file.so.cc instrumentation/
344 +
345 + .PHONY: document
346 + document:
347 +- $(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS_SAFE) $(CPPFLAGS) $(CLANG_CFL) -O3 -Wno-unused-result -fPIC -c instrumentation/afl-compiler-rt.o.c -o ./afl-compiler-rt.o
348 +- @$(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS_SAFE) $(CPPFLAGS) $(CLANG_CFL) -O3 -Wno-unused-result -m32 -fPIC -c instrumentation/afl-compiler-rt.o.c -o ./afl-compiler-rt-32.o 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
349 +- @$(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS_SAFE) $(CPPFLAGS) $(CLANG_CFL) -O3 -Wno-unused-result -m64 -fPIC -c instrumentation/afl-compiler-rt.o.c -o ./afl-compiler-rt-64.o 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
350 ++ $(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS) $(CFLAGS_SAFE) $(CPPFLAGS) $(CLANG_CFL) -Wno-unused-result -fPIC -c instrumentation/afl-compiler-rt.o.c -o ./afl-compiler-rt.o
351 ++ @$(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS) $(CFLAGS_SAFE) $(CPPFLAGS) $(CLANG_CFL) -Wno-unused-result -m32 -fPIC -c instrumentation/afl-compiler-rt.o.c -o ./afl-compiler-rt-32.o 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
352 ++ @$(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS) $(CFLAGS_SAFE) $(CPPFLAGS) $(CLANG_CFL) -Wno-unused-result -m64 -fPIC -c instrumentation/afl-compiler-rt.o.c -o ./afl-compiler-rt-64.o 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
353 +
354 + ./afl-compiler-rt.o: instrumentation/afl-compiler-rt.o.c
355 +- $(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -fPIC -c $< -o $@
356 ++ $(CC) $(CFLAGS) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -fPIC -fno-lto -c $< -o $@
357 +
358 + ./afl-compiler-rt-32.o: instrumentation/afl-compiler-rt.o.c
359 + @printf "[*] Building 32-bit variant of the runtime (-m32)... "
360 +- @$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -m32 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
361 ++ @$(CC) $(CFLAGS) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m32 -fPIC -fno-lto -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
362 +
363 + ./afl-compiler-rt-64.o: instrumentation/afl-compiler-rt.o.c
364 + @printf "[*] Building 64-bit variant of the runtime (-m64)... "
365 +- @$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -m64 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
366 ++ @$(CC) $(CFLAGS) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m64 -fPIC -fno-lto -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
367 +
368 + .PHONY: test_build
369 + test_build: $(PROGS)
370 + @echo "[*] Testing the CC wrapper and instrumentation output..."
371 +- unset AFL_USE_ASAN AFL_USE_MSAN AFL_INST_RATIO; ASAN_OPTIONS=detect_leaks=0 AFL_QUIET=1 AFL_PATH=. AFL_LLVM_LAF_ALL=1 ./afl-cc $(CFLAGS) $(CPPFLAGS) ./test-instr.c -o test-instr $(LDFLAGS)
372 ++ unset AFL_USE_ASAN AFL_USE_MSAN AFL_INST_RATIO; ASAN_OPTIONS=detect_leaks=0 AFL_QUIET=1 AFL_PATH=. AFL_LLVM_LAF_ALL=1 ./afl-cc ./test-instr.c -o test-instr
373 + ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null
374 + echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr
375 + @rm -f test-instr
376 +--- a/custom_mutators/honggfuzz/Makefile
377 ++++ b/custom_mutators/honggfuzz/Makefile
378 +@@ -1,5 +1,6 @@
379 +
380 +-CFLAGS = -O3 -funroll-loops -fPIC -Wl,-Bsymbolic
381 ++CFLAGS ?= -O3
382 ++CFLAGS += -funroll-loops -fPIC -Wl,-Bsymbolic
383 +
384 + all: honggfuzz-mutator.so
385 +
386 +--- a/custom_mutators/libfuzzer/Makefile
387 ++++ b/custom_mutators/libfuzzer/Makefile
388 +@@ -1,6 +1,6 @@
389 +
390 +-CFLAGS = -g -O3 -funroll-loops -fPIC -fpermissive -std=c++11
391 +-#CFLAGS = -g -O0 -fPIC -fpermissive -std=c++11
392 ++CFLAGS ?= -g -O3
393 ++CFLAGS += -funroll-loops -fpermissive -std=c++11 -fPIC
394 + CXX ?= clang++
395 +
396 + ifdef INTROSPECTION
397 +--- a/frida_mode/GNUmakefile
398 ++++ b/frida_mode/GNUmakefile
399 +@@ -27,7 +27,6 @@ CFLAGS+=-fPIC \
400 + -D_GNU_SOURCE \
401 + -D_FORTIFY_SOURCE=2 \
402 + -g \
403 +- -O3 \
404 + -funroll-loops \
405 + -ffunction-sections \
406 +
407 +--- a/frida_mode/test/png/persistent/hook/GNUmakefile
408 ++++ b/frida_mode/test/png/persistent/hook/GNUmakefile
409 +@@ -5,11 +5,9 @@ BUILD_DIR:=$(PWD)build/
410 + AFLPP_FRIDA_DRIVER_HOOK_OBJ=$(ROOT)frida_mode/build/frida_hook.so
411 + AFLPP_QEMU_DRIVER_HOOK_OBJ=$(ROOT)frida_mode/build/qemu_hook.so
412 +
413 +-CFLAGS+=-O3 \
414 +- -funroll-loops \
415 ++CFLAGS+= -funroll-loops \
416 + -g \
417 +- -fPIC \
418 +- -funroll-loops \
419 ++ -fPIC
420 +
421 + LDFLAGS+=-shared \
422 +
423 +--- a/utils/aflpp_driver/GNUmakefile
424 ++++ b/utils/aflpp_driver/GNUmakefile
425 +@@ -13,40 +13,42 @@ ifneq "" "$(LLVM_BINDIR)"
426 + LLVM_BINDIR := $(LLVM_BINDIR)/
427 + endif
428 +
429 +-CFLAGS := -O3 -funroll-loops -g -fPIC
430 ++AR ?= ar
431 ++CFLAGS ?= -O3 -funroll-loops -g
432 ++CFLAGS += -fPIC -fno-lto
433 +
434 + all: libAFLDriver.a libAFLQemuDriver.a aflpp_qemu_driver_hook.so
435 +
436 + aflpp_driver.o: aflpp_driver.c
437 +- -$(LLVM_BINDIR)clang -I. -I../../include $(CFLAGS) -c aflpp_driver.c
438 ++ $(CC) $(CPPFLAGS) -I. -I../../include $(CFLAGS) -c aflpp_driver.c
439 +
440 + libAFLDriver.a: aflpp_driver.o
441 +- @ar rc libAFLDriver.a aflpp_driver.o
442 ++ $(AR) rc libAFLDriver.a aflpp_driver.o
443 + @cp -vf libAFLDriver.a ../../
444 +
445 + debug:
446 +- $(LLVM_BINDIR)clang -Wno-deprecated -I../../include $(CFLAGS) -D_DEBUG=\"1\" -c -o afl-performance.o ../../src/afl-performance.c
447 +- $(LLVM_BINDIR)clang -I../../include -D_DEBUG=\"1\" -g -funroll-loops -c aflpp_driver.c
448 ++ $(CC) $(CPPFLAGS) -Wno-deprecated -I../../include $(CFLAGS) -D_DEBUG=\"1\" -c -o afl-performance.o ../../src/afl-performance.c
449 ++ $(CC) $(CPPFLAGS) -I../../include -D_DEBUG=\"1\" $(CFLAGS) -g -funroll-loops -c aflpp_driver.c
450 + #$(LLVM_BINDIR)clang -S -emit-llvm -Wno-deprecated -I../../include $(CFLAGS) -D_DEBUG=\"1\" -c -o afl-performance.ll ../../src/afl-performance.c
451 + #$(LLVM_BINDIR)clang -S -emit-llvm -I../../include -D_DEBUG=\"1\" -g -funroll-loops -c aflpp_driver.c
452 +- ar rc libAFLDriver.a afl-performance.o aflpp_driver.o
453 ++ $(AR) rc libAFLDriver.a afl-performance.o aflpp_driver.o
454 +
455 + aflpp_qemu_driver.o: aflpp_qemu_driver.c
456 +- -$(LLVM_BINDIR)clang $(CFLAGS) -O0 -funroll-loops -c aflpp_qemu_driver.c
457 ++ $(CC) $(CPPFLAGS) $(CFLAGS) -O0 -funroll-loops -c aflpp_qemu_driver.c
458 +
459 + libAFLQemuDriver.a: aflpp_qemu_driver.o
460 +- @-ar rc libAFLQemuDriver.a aflpp_qemu_driver.o
461 +- @-cp -vf libAFLQemuDriver.a ../../
462 ++ $(AR) rc libAFLQemuDriver.a aflpp_qemu_driver.o
463 ++ @cp -vf libAFLQemuDriver.a ../../
464 +
465 + aflpp_qemu_driver_hook.so: aflpp_qemu_driver_hook.o
466 +- @-test -e aflpp_qemu_driver_hook.o && $(LLVM_BINDIR)clang $(LDFLAGS) -shared aflpp_qemu_driver_hook.o -o aflpp_qemu_driver_hook.so || echo "Note: Optional aflpp_qemu_driver_hook.so not built."
467 ++ @test -e aflpp_qemu_driver_hook.o && $(CC) $(LDFLAGS) -shared aflpp_qemu_driver_hook.o -o aflpp_qemu_driver_hook.so || echo "Note: Optional aflpp_qemu_driver_hook.so not built."
468 +
469 + aflpp_qemu_driver_hook.o: aflpp_qemu_driver_hook.c
470 +- @-test -e ../../qemu_mode/qemuafl/qemuafl/api.h && $(LLVM_BINDIR)clang $(CFLAGS) -funroll-loops -c aflpp_qemu_driver_hook.c || echo "Note: Optional aflpp_qemu_driver_hook.o not built."
471 ++ @test -e ../../qemu_mode/qemuafl/qemuafl/api.h && $(CC) $(CPPFLAGS) $(CFLAGS) -funroll-loops -c aflpp_qemu_driver_hook.c || echo "Note: Optional aflpp_qemu_driver_hook.o not built."
472 +
473 + test: debug
474 + #clang -S -emit-llvm -D_DEBUG=\"1\" -I../../include -Wl,--allow-multiple-definition -funroll-loops -o aflpp_driver_test.ll aflpp_driver_test.c
475 +- afl-clang-fast -D_DEBUG=\"1\" -I../../include -Wl,--allow-multiple-definition -funroll-loops -o aflpp_driver_test aflpp_driver_test.c libAFLDriver.a afl-performance.o
476 ++ ../../afl-clang-fast -D_DEBUG=\"1\" -I../../include -Wl,--allow-multiple-definition -funroll-loops -o aflpp_driver_test aflpp_driver_test.c libAFLDriver.a afl-performance.o
477 +
478 + clean:
479 + rm -f *.o libAFLDriver*.a libAFLQemuDriver.a aflpp_qemu_driver_hook.so *~ core aflpp_driver_test