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/, app-forensics/aflplusplus/files/
Date: Mon, 04 Jul 2022 23:24:22
Message-Id: 1656977040.4c38bde47bbac4eaf8654581b9806a11780b298f.sam@gentoo
1 commit: 4c38bde47bbac4eaf8654581b9806a11780b298f
2 Author: Alexander Miller <alex.miller <AT> gmx <DOT> de>
3 AuthorDate: Mon Jul 4 16:10:19 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 4 23:24:00 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c38bde4
7
8 app-forensics/aflplusplus: add 4.01c
9
10 Closes: https://bugs.gentoo.org/856337
11 Signed-off-by: Alexander Miller <alex.miller <AT> gmx.de>
12 Signed-off-by: Sam James <sam <AT> gentoo.org>
13
14 app-forensics/aflplusplus/Manifest | 1 +
15 app-forensics/aflplusplus/aflplusplus-4.01c.ebuild | 88 ++++++++++++
16 ...lplusplus-4.01c-no-ignore-errors-makefile.patch | 154 +++++++++++++++++++++
17 .../files/aflplusplus-4.01c-respect-flags.patch | 123 ++++++++++++++++
18 4 files changed, 366 insertions(+)
19
20 diff --git a/app-forensics/aflplusplus/Manifest b/app-forensics/aflplusplus/Manifest
21 index a99f8f055073..3e2e5b638831 100644
22 --- a/app-forensics/aflplusplus/Manifest
23 +++ b/app-forensics/aflplusplus/Manifest
24 @@ -1 +1,2 @@
25 DIST aflplusplus-4.00c.tar.gz 2805041 BLAKE2B c1ce15aa9860fc02a7d6f608cae9dd8987b72253b465ea734c721d1b6927e482c31b907aeafe82c00618465227e2e140bfc595151ea5d73037638c3ee630872c SHA512 23a7a4260e581f7c212393e1e14704464bbbc3ff5465b3472db31c6c7f2cd25a9ecc5ad81fad8958c775fcd01b22269085e6c69419a07fbbdb9ec317a3e39beb
26 +DIST aflplusplus-4.01c.tar.gz 2818445 BLAKE2B f3699c4b2fabec0ab238277c3b2c7b19b35af7a0b82b14a57c34b8579121cfa0644ef432132cf4a3382547db3faf799d2ab601512ddfb469e4a2246cdb61aa7f SHA512 d2b03ab4ff9538fe0b52aa3ed4778a6e5657d64d6f0e5f75a99305bad69c5179d6b1c882650f19a884a740577acb73dab7cee3d5c9c7b06ff2326ffeba37d1fe
27
28 diff --git a/app-forensics/aflplusplus/aflplusplus-4.01c.ebuild b/app-forensics/aflplusplus/aflplusplus-4.01c.ebuild
29 new file mode 100644
30 index 000000000000..b304644ff905
31 --- /dev/null
32 +++ b/app-forensics/aflplusplus/aflplusplus-4.01c.ebuild
33 @@ -0,0 +1,88 @@
34 +# Copyright 1999-2022 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=8
38 +
39 +PYTHON_COMPAT=( python3_{8,9,10} )
40 +LLVM_MAX_SLOT=14
41 +inherit toolchain-funcs llvm optfeature python-single-r1
42 +
43 +DESCRIPTION="A fork of AFL, the popular compile-time instrumentation fuzzer"
44 +HOMEPAGE="https://github.com/AFLplusplus/AFLplusplus"
45 +SRC_URI="https://github.com/AFLplusplus/AFLplusplus/archive/${PV}.tar.gz -> ${P}.tar.gz"
46 +S="${WORKDIR}/AFLplusplus-${PV}"
47 +
48 +LICENSE="Apache-2.0"
49 +SLOT="0"
50 +KEYWORDS="~amd64 ~arm64"
51 +IUSE="test"
52 +
53 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
54 +
55 +# Tests involve heavy use of LD_PRELOAD in some cases
56 +# This isn't compatible with sandbox
57 +RESTRICT="test"
58 +
59 +# It turns out we need Clang too
60 +RDEPEND="${PYTHON_DEPS}
61 + >=sys-devel/llvm-12:=
62 + || (
63 + sys-devel/clang:12
64 + sys-devel/clang:13
65 + sys-devel/clang:${LLVM_MAX_SLOT}
66 + )
67 + !app-forensics/afl"
68 +DEPEND="${RDEPEND}
69 + test? ( dev-util/cmocka )"
70 +
71 +QA_PREBUILT="usr/share/afl/testcases/others/elf/small_exec.elf"
72 +
73 +PATCHES=(
74 + "${FILESDIR}"/${PN}-4.01c-respect-flags.patch
75 + "${FILESDIR}"/${PN}-4.01c-no-ignore-errors-makefile.patch
76 +)
77 +
78 +llvm_check_deps() {
79 + has_version -b "sys-devel/clang:${LLVM_SLOT}" && \
80 + has_version -b "sys-devel/llvm:${LLVM_SLOT}"
81 +}
82 +
83 +pkg_setup() {
84 + llvm_pkg_setup
85 + python-single-r1_pkg_setup
86 +}
87 +
88 +src_compile() {
89 + emake \
90 + CC="$(tc-getCC)" \
91 + CXX="$(tc-getCXX)" \
92 + CFLAGS_FLTO="" \
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_test() {
100 + emake \
101 + CC="$(tc-getCC)" \
102 + CXX="$(tc-getCXX)"
103 +}
104 +
105 +src_install() {
106 + emake \
107 + CC="$(tc-getCC)" \
108 + CXX="$(tc-getCXX)" \
109 + DESTDIR="${D}" \
110 + PREFIX="${EPREFIX}/usr" \
111 + HELPER_PATH="${EPREFIX}/usr/$(get_libdir)/afl" \
112 + DOC_PATH="${EPREFIX}/usr/share/doc/${PF}" \
113 + MAN_PATH="${EPREFIX}/usr/share/man/man8" \
114 + install
115 +}
116 +
117 +pkg_postinst() {
118 + # TODO: Any others?
119 + optfeature "fuzzing with AFL_USE_ASAN" sys-libs/compiler-rt-sanitizers[asan]
120 + optfeature "fuzzing with AFL_USE_MSAN" sys-libs/compiler-rt-sanitizers[msan]
121 +}
122
123 diff --git a/app-forensics/aflplusplus/files/aflplusplus-4.01c-no-ignore-errors-makefile.patch b/app-forensics/aflplusplus/files/aflplusplus-4.01c-no-ignore-errors-makefile.patch
124 new file mode 100644
125 index 000000000000..95718bb3a32d
126 --- /dev/null
127 +++ b/app-forensics/aflplusplus/files/aflplusplus-4.01c-no-ignore-errors-makefile.patch
128 @@ -0,0 +1,154 @@
129 +https://bugs.gentoo.org/800941
130 +
131 +--- a/GNUmakefile
132 ++++ b/GNUmakefile
133 +@@ -308,17 +308,17 @@ endif
134 +
135 + .PHONY: all
136 + all: test_x86 test_shm test_python ready $(PROGS) afl-as llvm gcc_plugin test_build all_done
137 +- -$(MAKE) -C utils/aflpp_driver
138 ++ $(MAKE) -C utils/aflpp_driver
139 +
140 + .PHONY: llvm
141 + llvm:
142 +- -$(MAKE) -j4 -f GNUmakefile.llvm
143 ++ $(MAKE) -j4 -f GNUmakefile.llvm
144 + @test -e afl-cc || { echo "[-] Compiling afl-cc failed. You seem not to have a working compiler." ; exit 1; }
145 +
146 + .PHONY: gcc_plugin
147 + gcc_plugin:
148 + ifneq "$(SYS)" "Darwin"
149 +- -$(MAKE) -f GNUmakefile.gcc_plugin
150 ++ $(MAKE) -f GNUmakefile.gcc_plugin
151 + endif
152 +
153 + .PHONY: man
154 +@@ -568,19 +568,19 @@ all_done: test_build
155 + .PHONY: clean
156 + clean:
157 + 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
158 +- -$(MAKE) -f GNUmakefile.llvm clean
159 +- -$(MAKE) -f GNUmakefile.gcc_plugin clean
160 +- -$(MAKE) -C utils/libdislocator clean
161 +- -$(MAKE) -C utils/libtokencap clean
162 ++ $(MAKE) -f GNUmakefile.llvm clean
163 ++ $(MAKE) -f GNUmakefile.gcc_plugin clean
164 ++ $(MAKE) -C utils/libdislocator clean
165 ++ $(MAKE) -C utils/libtokencap clean
166 + $(MAKE) -C utils/aflpp_driver clean
167 +- -$(MAKE) -C utils/afl_network_proxy clean
168 +- -$(MAKE) -C utils/socket_fuzzing clean
169 +- -$(MAKE) -C utils/argv_fuzzing clean
170 +- -$(MAKE) -C utils/plot_ui clean
171 +- -$(MAKE) -C qemu_mode/unsigaction clean
172 +- -$(MAKE) -C qemu_mode/libcompcov clean
173 +- -$(MAKE) -C qemu_mode/libqasan clean
174 +- -$(MAKE) -C frida_mode clean
175 ++ $(MAKE) -C utils/afl_network_proxy clean
176 ++ $(MAKE) -C utils/socket_fuzzing clean
177 ++ $(MAKE) -C utils/argv_fuzzing clean
178 ++ $(MAKE) -C utils/plot_ui clean
179 ++ $(MAKE) -C qemu_mode/unsigaction clean
180 ++ $(MAKE) -C qemu_mode/libcompcov clean
181 ++ $(MAKE) -C qemu_mode/libqasan clean
182 ++ $(MAKE) -C frida_mode clean
183 + 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
184 + ifeq "$(IN_REPO)" "1"
185 + -test -e coresight_mode/coresight-trace/Makefile && $(MAKE) -C coresight_mode/coresight-trace clean || true
186 +@@ -610,20 +610,20 @@ endif
187 +
188 + .PHONY: distrib
189 + distrib: all
190 +- -$(MAKE) -j4 -f GNUmakefile.llvm
191 ++ $(MAKE) -j4 -f GNUmakefile.llvm
192 + ifneq "$(SYS)" "Darwin"
193 +- -$(MAKE) -f GNUmakefile.gcc_plugin
194 ++ $(MAKE) -f GNUmakefile.gcc_plugin
195 + endif
196 +- -$(MAKE) -C utils/libdislocator
197 +- -$(MAKE) -C utils/libtokencap
198 +- -$(MAKE) -C utils/afl_network_proxy
199 +- -$(MAKE) -C utils/socket_fuzzing
200 +- -$(MAKE) -C utils/argv_fuzzing
201 +- # -$(MAKE) -C utils/plot_ui
202 +- -$(MAKE) -C frida_mode
203 ++ $(MAKE) -C utils/libdislocator
204 ++ $(MAKE) -C utils/libtokencap
205 ++ $(MAKE) -C utils/afl_network_proxy
206 ++ $(MAKE) -C utils/socket_fuzzing
207 ++ $(MAKE) -C utils/argv_fuzzing
208 ++ # $(MAKE) -C utils/plot_ui
209 ++ $(MAKE) -C frida_mode
210 + ifneq "$(SYS)" "Darwin"
211 + ifeq "$(ARCH)" "aarch64"
212 +- -$(MAKE) -C coresight_mode
213 ++ $(MAKE) -C coresight_mode
214 + endif
215 + ifeq "$(SYS)" "Linux"
216 + ifndef NO_NYX
217 +@@ -636,16 +636,16 @@ endif
218 +
219 + .PHONY: binary-only
220 + binary-only: test_shm test_python ready $(PROGS)
221 +- -$(MAKE) -C utils/libdislocator
222 +- -$(MAKE) -C utils/libtokencap
223 +- -$(MAKE) -C utils/afl_network_proxy
224 +- -$(MAKE) -C utils/socket_fuzzing
225 +- -$(MAKE) -C utils/argv_fuzzing
226 +- # -$(MAKE) -C utils/plot_ui
227 +- -$(MAKE) -C frida_mode
228 ++ $(MAKE) -C utils/libdislocator
229 ++ $(MAKE) -C utils/libtokencap
230 ++ $(MAKE) -C utils/afl_network_proxy
231 ++ $(MAKE) -C utils/socket_fuzzing
232 ++ $(MAKE) -C utils/argv_fuzzing
233 ++ # $(MAKE) -C utils/plot_ui
234 ++ $(MAKE) -C frida_mode
235 + ifneq "$(SYS)" "Darwin"
236 + ifeq "$(ARCH)" "aarch64"
237 +- -$(MAKE) -C coresight_mode
238 ++ $(MAKE) -C coresight_mode
239 + endif
240 + ifeq "$(SYS)" "Linux"
241 + ifndef NO_NYX
242 +@@ -658,13 +658,13 @@ endif
243 +
244 + .PHONY: source-only
245 + source-only: all
246 +- -$(MAKE) -j4 -f GNUmakefile.llvm
247 ++ $(MAKE) -j4 -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 +@@ -712,9 +712,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 +--- a/GNUmakefile.llvm
274 ++++ b/GNUmakefile.llvm
275 +@@ -463,6 +463,7 @@ document:
276 + test_build: $(PROGS)
277 + @echo "[*] Testing the CC wrapper and instrumentation output..."
278 + 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)
279 ++ @test -e test-instr || { echo "[-] Testing CC wrapper failed. You seem not to have a working compiler." ; exit 1; }
280 + ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null
281 + echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr
282 + @rm -f test-instr
283
284 diff --git a/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch b/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch
285 new file mode 100644
286 index 000000000000..d22d582ecaa9
287 --- /dev/null
288 +++ b/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch
289 @@ -0,0 +1,123 @@
290 +--- a/GNUmakefile
291 ++++ b/GNUmakefile
292 +@@ -423,7 +423,7 @@ afl-as: src/afl-as.c include/afl-as.h $(COMM_HDR) | test_x86
293 + @ln -sf afl-as as
294 +
295 + src/afl-performance.o : $(COMM_HDR) src/afl-performance.c include/hash.h
296 +- $(CC) $(CFLAGS) $(CFLAGS_OPT) -Iinclude -c src/afl-performance.c -o src/afl-performance.o
297 ++ $(CC) $(CFLAGS) -Iinclude -c src/afl-performance.c -o src/afl-performance.o
298 +
299 + src/afl-common.o : $(COMM_HDR) src/afl-common.c include/common.h
300 + $(CC) $(CFLAGS) $(CFLAGS_FLTO) -c src/afl-common.c -o src/afl-common.o
301 +--- a/GNUmakefile.gcc_plugin
302 ++++ b/GNUmakefile.gcc_plugin
303 +@@ -131,18 +131,18 @@ afl-common.o: ./src/afl-common.c
304 + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ $(LDFLAGS)
305 +
306 + ./afl-compiler-rt.o: instrumentation/afl-compiler-rt.o.c
307 +- $(CC) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -fPIC -c $< -o $@
308 ++ $(CC) $(CFLAGS) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -fPIC -c $< -o $@
309 +
310 + ./afl-compiler-rt-32.o: instrumentation/afl-compiler-rt.o.c
311 + @printf "[*] Building 32-bit variant of the runtime (-m32)... "
312 +- @$(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
313 ++ @$(CC) $(CFLAGS) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m32 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
314 +
315 + ./afl-compiler-rt-64.o: instrumentation/afl-compiler-rt.o.c
316 + @printf "[*] Building 64-bit variant of the runtime (-m64)... "
317 +- @$(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
318 ++ @$(CC) $(CFLAGS) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m64 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
319 +
320 + ./afl-gcc-pass.so: instrumentation/afl-gcc-pass.so.cc | test_deps
321 +- $(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@
322 ++ $(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@ $(LDFLAGS)
323 + ln -sf afl-cc afl-gcc-fast
324 + ln -sf afl-cc afl-g++-fast
325 + ln -sf afl-cc.8 afl-gcc-fast.8
326 +--- a/GNUmakefile.llvm
327 ++++ b/GNUmakefile.llvm
328 +@@ -444,20 +444,20 @@ afl-llvm-dict2file.so: instrumentation/afl-llvm-dict2file.so.cc instrumentation/
329 +
330 + .PHONY: document
331 + document:
332 +- $(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
333 +- @$(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
334 +- @$(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
335 ++ $(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
336 ++ @$(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
337 ++ @$(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
338 +
339 + ./afl-compiler-rt.o: instrumentation/afl-compiler-rt.o.c
340 +- $(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -fPIC -c $< -o $@
341 ++ $(CC) $(CFLAGS) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -fPIC -c $< -o $@
342 +
343 + ./afl-compiler-rt-32.o: instrumentation/afl-compiler-rt.o.c
344 + @printf "[*] Building 32-bit variant of the runtime (-m32)... "
345 +- @$(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
346 ++ @$(CC) $(CFLAGS) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m32 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
347 +
348 + ./afl-compiler-rt-64.o: instrumentation/afl-compiler-rt.o.c
349 + @printf "[*] Building 64-bit variant of the runtime (-m64)... "
350 +- @$(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
351 ++ @$(CC) $(CFLAGS) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m64 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
352 +
353 + .PHONY: test_build
354 + test_build: $(PROGS)
355 +--- a/custom_mutators/honggfuzz/Makefile
356 ++++ b/custom_mutators/honggfuzz/Makefile
357 +@@ -1,5 +1,6 @@
358 +
359 +-CFLAGS = -O3 -funroll-loops -fPIC -Wl,-Bsymbolic
360 ++CFLAGS ?= -O3
361 ++CFLAGS += -funroll-loops -fPIC -Wl,-Bsymbolic
362 +
363 + all: honggfuzz-mutator.so
364 +
365 +--- a/custom_mutators/libfuzzer/Makefile
366 ++++ b/custom_mutators/libfuzzer/Makefile
367 +@@ -1,5 +1,5 @@
368 +
369 +-CFLAGS = -g -O3 -funroll-loops -fPIC -fpermissive -std=c++11
370 +-#CFLAGS = -g -O0 -fPIC -fpermissive -std=c++11
371 ++CFLAGS ?= -g -O3
372 ++CFLAGS += -funroll-loops -fpermissive -std=c++11 -fPIC
373 + CXX ?= clang++
374 +
375 +--- a/frida_mode/GNUmakefile
376 ++++ b/frida_mode/GNUmakefile
377 +@@ -17,7 +17,6 @@ CFLAGS+=-fPIC \
378 + -D_GNU_SOURCE \
379 + -D_FORTIFY_SOURCE=2 \
380 + -g \
381 +- -O3 \
382 + -funroll-loops \
383 + -ffunction-sections \
384 +
385 +--- a/frida_mode/test/png/persistent/hook/GNUmakefile
386 ++++ b/frida_mode/test/png/persistent/hook/GNUmakefile
387 +@@ -5,11 +5,9 @@ BUILD_DIR:=$(PWD)build/
388 + AFLPP_FRIDA_DRIVER_HOOK_OBJ=$(ROOT)frida_mode/build/frida_hook.so
389 + AFLPP_QEMU_DRIVER_HOOK_OBJ=$(ROOT)frida_mode/build/qemu_hook.so
390 +
391 +-CFLAGS+=-O3 \
392 +- -funroll-loops \
393 ++CFLAGS+= -funroll-loops \
394 + -g \
395 +- -fPIC \
396 +- -funroll-loops \
397 ++ -fPIC
398 +
399 + LDFLAGS+=-shared \
400 +
401 +--- a/utils/aflpp_driver/GNUmakefile
402 ++++ b/utils/aflpp_driver/GNUmakefile
403 +@@ -13,7 +13,8 @@ ifneq "" "$(LLVM_BINDIR)"
404 + LLVM_BINDIR := $(LLVM_BINDIR)/
405 + endif
406 +
407 +-CFLAGS := -O3 -funroll-loops -g -fPIC
408 ++CFLAGS ?= -O3 -funroll-loops -g
409 ++CFLAGS += -fPIC
410 +
411 + all: libAFLDriver.a libAFLQemuDriver.a aflpp_qemu_driver_hook.so
412 +