commit:     4a9531c4f26211a06a74909a17d68de85179d54f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jun  8 11:56:54 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jun  8 11:58:31 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4a9531c4

app-forensics/aflplusplus: add 4.32c

Closes: https://bugs.gentoo.org/957401
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-forensics/aflplusplus/Manifest                 |  2 +
 app-forensics/aflplusplus/aflplusplus-4.32c.ebuild | 98 ++++++++++++++++++++++
 .../files/aflplusplus-4.32c-gcc16.patch            | 43 ++++++++++
 3 files changed, 143 insertions(+)

diff --git a/app-forensics/aflplusplus/Manifest 
b/app-forensics/aflplusplus/Manifest
index 21484f77a1fc..d8203c630c90 100644
--- a/app-forensics/aflplusplus/Manifest
+++ b/app-forensics/aflplusplus/Manifest
@@ -1,2 +1,4 @@
 DIST aflplusplus-4.30c-patches.tar.xz 5008 BLAKE2B 
60031d726e0d1834d0791bb88e437ac81bca1995dd424d64a0694b7e518e3ddbcf490413d830d2fe7649a1eb5c4cfa0e34e8115505a8c5df5e3fddce80b31efd
 SHA512 
6d9d6bf03f5e899b58252eb299029f1b3630f129e78dd7ec2512ae48244822e0614d915c04ba699b2b56d4f839451b0e76e3f1148eb3027e6e7f53a79111add3
 DIST aflplusplus-4.30c.tar.gz 3031558 BLAKE2B 
7f9c7d32afc5316cef460a72e7603aee36161559c2bb5c03edc408c16e8ba8bf96ced2c90e5578caa401ace37caf3ff7bba72ab58b7070c7c5b69004dc2d4da7
 SHA512 
072c9524978843eec6be5428793be43d10f3530a3f569fd4015d950cdd87696e887c3b567440afee8cb5e359b234d0c5e668cf9ab90622783fc82f68e3ec5f98
+DIST aflplusplus-4.32c-patches.tar.xz 4776 BLAKE2B 
75cbe9dfa1d3fccd358cb2f9c3d339d7854d2a690f7e32d57e65a76d7b8a34c30acd6776e2be28280a981d2b9cae7dc4685a28a8cd8b47a5e224074acaf257d1
 SHA512 
0c863c4d67fc535fdb96f27a429cc11e960820c9825667156987eb468b45d893caf3df37a6c949c47cdc95b250fa92791c3d03ffc4faa61fd728c116c25ae9db
+DIST aflplusplus-4.32c.tar.gz 3045679 BLAKE2B 
259edf3fe4405a8703a7452f99406fd390e97763d687445e0a6104f884ba304b3f6755fcdef36f7f8d9743db945ef60791402462cf4599c5a90593ecbb414daf
 SHA512 
9688f476129b45e842918b2e185c5fc82eb94aecd7ac27bfeecc74f5525aaf3754dbb4c442fec3902a93aad079178e1523a544f0808a4b6d21a11dc9508be0a0

diff --git a/app-forensics/aflplusplus/aflplusplus-4.32c.ebuild 
b/app-forensics/aflplusplus/aflplusplus-4.32c.ebuild
new file mode 100644
index 000000000000..89c0d44ae25c
--- /dev/null
+++ b/app-forensics/aflplusplus/aflplusplus-4.32c.ebuild
@@ -0,0 +1,98 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_COMPAT=( {15..20} )
+PYTHON_COMPAT=( python3_{11..14} )
+inherit flag-o-matic toolchain-funcs llvm-r1 optfeature python-single-r1
+
+AFL_PATCHSET="${PN}-4.32c-patches"
+DESCRIPTION="Fork of AFL, the popular compile-time instrumentation fuzzer"
+HOMEPAGE="https://github.com/AFLplusplus/AFLplusplus";
+SRC_URI="https://github.com/AFLplusplus/AFLplusplus/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+SRC_URI+=" 
https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${AFL_PATCHSET}.tar.xz";
+S="${WORKDIR}"/AFLplusplus-${PV}
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64"
+IUSE="test"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+# Tests involve heavy use of LD_PRELOAD in some cases
+# This isn't compatible with sandbox
+RESTRICT="test"
+
+RDEPEND="
+       ${PYTHON_DEPS}
+       $(llvm_gen_dep '
+               llvm-core/clang:${LLVM_SLOT}=
+               llvm-core/llvm:${LLVM_SLOT}=
+       ')
+       !app-forensics/afl
+"
+DEPEND="
+       ${RDEPEND}
+       test? ( dev-util/cmocka )
+"
+
+QA_FLAGS_IGNORED="
+       usr/lib.*/afl/afl-gcc-cmplog-pass.so
+       usr/lib.*/afl/afl-gcc-cmptrs-pass.so
+"
+QA_PREBUILT="usr/share/afl/testcases/others/elf/small_exec.elf"
+
+PATCHES=(
+       "${WORKDIR}"/${AFL_PATCHSET}
+       "${FILESDIR}"/${PN}-4.32c-gcc16.patch
+)
+
+pkg_setup() {
+       llvm-r1_pkg_setup
+       python-single-r1_pkg_setup
+}
+
+mymake() {
+       # afl-fuzz spews garbage to stdout if the environment contains any
+       # variables whose name beginning with USE_ (including the underscore),
+       # regardless of their value (even if empty!).  The ebuild environment
+       # contains several such variables and the garbage that gets printed
+       # ends up in the generated man page.
+       #
+       # We can work around the problem by unsetting all these variables when
+       # running make.
+       local badvars=("${!USE_@}")
+
+       env "${badvars[@]/#/-u}" emake \
+               CC="$(tc-getCC)" \
+               CXX="$(tc-getCXX)" \
+               CFLAGS_FLTO="" \
+               PREFIX="${EPREFIX}/usr" \
+               HELPER_PATH="${EPREFIX}/usr/$(get_libdir)/afl" \
+               DOC_PATH="${EPREFIX}/usr/share/doc/${PF}" \
+               MAN_PATH="${EPREFIX}/usr/share/man/man8" \
+               "$@"
+}
+
+src_compile() {
+       # bug #945258
+       append-cflags -std=gnu17
+
+       mymake
+}
+
+src_test() {
+       mymake test
+}
+
+src_install() {
+       mymake DESTDIR="${D}" install
+       dostrip -x /usr/share/afl/testcases/
+}
+
+pkg_postinst() {
+       # TODO: Any others?
+       optfeature "fuzzing with AFL_USE_ASAN" 
llvm-runtimes/compiler-rt-sanitizers[asan]
+       optfeature "fuzzing with AFL_USE_MSAN" 
llvm-runtimes/compiler-rt-sanitizers[msan]
+}

diff --git a/app-forensics/aflplusplus/files/aflplusplus-4.32c-gcc16.patch 
b/app-forensics/aflplusplus/files/aflplusplus-4.32c-gcc16.patch
new file mode 100644
index 000000000000..7d542fb3ae87
--- /dev/null
+++ b/app-forensics/aflplusplus/files/aflplusplus-4.32c-gcc16.patch
@@ -0,0 +1,43 @@
+--- a/instrumentation/afl-gcc-cmplog-pass.so.cc
++++ b/instrumentation/afl-gcc-cmplog-pass.so.cc
+@@ -44,8 +44,7 @@ static const struct pass_data afl_cmplog_pass_data = {
+     .properties_provided = 0,
+     .properties_destroyed = 0,
+     .todo_flags_start = 0,
+-    .todo_flags_finish = (TODO_update_ssa | TODO_cleanup_cfg | TODO_verify_il 
|
+-                          TODO_rebuild_cgraph_edges),
++    .todo_flags_finish = (TODO_update_ssa | TODO_cleanup_cfg | 
TODO_rebuild_cgraph_edges),
+ 
+ };
+ 
+--- a/instrumentation/afl-gcc-cmptrs-pass.so.cc
++++ b/instrumentation/afl-gcc-cmptrs-pass.so.cc
+@@ -44,8 +44,7 @@ static const struct pass_data afl_cmptrs_pass_data = {
+     .properties_provided = 0,
+     .properties_destroyed = 0,
+     .todo_flags_start = 0,
+-    .todo_flags_finish = (TODO_update_ssa | TODO_cleanup_cfg | TODO_verify_il 
|
+-                          TODO_rebuild_cgraph_edges),
++    .todo_flags_finish = (TODO_update_ssa | TODO_cleanup_cfg | 
TODO_rebuild_cgraph_edges),
+ 
+ };
+ 
+--- a/instrumentation/afl-gcc-pass.so.cc
++++ b/instrumentation/afl-gcc-pass.so.cc
+@@ -65,7 +65,6 @@
+    The new pass is to be a GIMPLE_PASS.  Given the sort of
+    instrumentation it's supposed to do, its todo_flags_finish will
+    certainly need TODO_update_ssa, and TODO_cleanup_cfg.
+-   TODO_verify_il is probably desirable, at least during debugging.
+    TODO_rebuild_cgraph_edges is required only in the out-of-line
+    instrumentation mode.
+ 
+@@ -148,7 +147,7 @@ static constexpr struct pass_data afl_pass_data = {
+     .properties_provided = 0,
+     .properties_destroyed = 0,
+     .todo_flags_start = 0,
+-    .todo_flags_finish = (TODO_update_ssa | TODO_cleanup_cfg | 
TODO_verify_il),
++    .todo_flags_finish = (TODO_update_ssa | TODO_cleanup_cfg),
+ 
+ };
+ 

Reply via email to