public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-forensics/aflplusplus/files/, app-forensics/aflplusplus/
@ 2021-03-31 23:38 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2021-03-31 23:38 UTC (permalink / raw
  To: gentoo-commits

commit:     06382b00ebd78da1c4968fd78a9bafb82aabff3e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 31 18:32:12 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 31 23:38:43 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06382b00

app-forensics/aflplusplus: initial import

Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-forensics/aflplusplus/Manifest                 |   1 +
 app-forensics/aflplusplus/aflplusplus-3.12c.ebuild |  75 ++++++++++++++
 .../files/aflplusplus-3.0c-CFLAGS.patch            | 110 +++++++++++++++++++++
 .../files/aflplusplus-3.0c-LDFLAGS.patch           |  11 +++
 app-forensics/aflplusplus/metadata.xml             |  11 +++
 5 files changed, 208 insertions(+)

diff --git a/app-forensics/aflplusplus/Manifest b/app-forensics/aflplusplus/Manifest
new file mode 100644
index 00000000000..81c2a1618a1
--- /dev/null
+++ b/app-forensics/aflplusplus/Manifest
@@ -0,0 +1 @@
+DIST aflplusplus-3.12c.tar.gz 2065569 BLAKE2B ff7a87eb02f7731b5ce8e1a3016239c6fd1cd1bfeb0b9c0fb69f72bdbf079e7700cdb32abe64f64853e5ff82f1c0ecd86d2cadb892e7c40be6bb2a7b089f7387 SHA512 a814d61298b60d99388289e742dbedf2ed1ab454a5e1ea20d48bb2f18b36c01553ab1f097a06f733439d67e804d48cb823a82ff249c404fb0b83a281564f3040

diff --git a/app-forensics/aflplusplus/aflplusplus-3.12c.ebuild b/app-forensics/aflplusplus/aflplusplus-3.12c.ebuild
new file mode 100644
index 00000000000..8f54edd03d1
--- /dev/null
+++ b/app-forensics/aflplusplus/aflplusplus-3.12c.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7,8,9} )
+LLVM_MAX_SLOT=11
+inherit toolchain-funcs llvm python-single-r1
+
+DESCRIPTION="A fork of AFL, the popular compile-time instrumentation fuzzer"
+HOMEPAGE="https://github.com/AFLplusplus/AFLplusplus"
+SRC_URI="https://github.com/AFLplusplus/AFLplusplus/archive/${PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/AFLplusplus-${PV}"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+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}
+	|| (
+		sys-devel/llvm:10
+		sys-devel/llvm:11
+		sys-devel/llvm:12
+	)
+"
+DEPEND="
+	${RDEPEND}
+	test? ( dev-util/cmocka )
+"
+
+QA_PREBUILT="/usr/share/afl/testcases/others/elf/small_exec.elf"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-3.0c-LDFLAGS.patch"
+	"${FILESDIR}/${PN}-3.0c-CFLAGS.patch"
+)
+
+pkg_setup() {
+	llvm_pkg_setup
+	python-single-r1_pkg_setup
+}
+
+src_prepare() {
+	default
+
+	sed -i -e 's/-O3 -fno-unroll-loops//' GNUmakefile || die
+}
+
+src_compile() {
+	emake \
+		CC="$(tc-getCC)" \
+		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_install() {
+	emake \
+		DESTDIR="${D}"
+		PREFIX="${EPREFIX}/usr" \
+		HELPER_PATH="${EPREFIX}/usr/$(get_libdir)/afl" \
+		DOC_PATH="${EPREFIX}/usr/share/doc/${PF}" \
+		MAN_PATH="${EPREFIX}/usr/share/man/man8" \
+		install
+}

diff --git a/app-forensics/aflplusplus/files/aflplusplus-3.0c-CFLAGS.patch b/app-forensics/aflplusplus/files/aflplusplus-3.0c-CFLAGS.patch
new file mode 100644
index 00000000000..a3477fd7559
--- /dev/null
+++ b/app-forensics/aflplusplus/files/aflplusplus-3.0c-CFLAGS.patch
@@ -0,0 +1,110 @@
+--- a/GNUmakefile.gcc_plugin
++++ b/GNUmakefile.gcc_plugin
+@@ -28,14 +28,14 @@ MAN_PATH    ?= $(PREFIX)/share/man/man8
+ 
+ VERSION     = $(shell grep '^$(HASH)define VERSION ' ./config.h | cut -d '"' -f2)
+ 
+-CFLAGS          ?= -O3 -g -funroll-loops -D_FORTIFY_SOURCE=2
++CFLAGS          ?= -D_FORTIFY_SOURCE=2
+ CFLAGS_SAFE     := -Wall -Iinclude -Wno-pointer-sign \
+                    -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
+                    -DGCC_VERSION=\"$(GCCVER)\" -DGCC_BINDIR=\"$(GCCBINDIR)\" \
+                    -Wno-unused-function
+ override CFLAGS += $(CFLAGS_SAFE)
+ 
+-CXXFLAGS    ?= -O3 -g -funroll-loops -D_FORTIFY_SOURCE=2
++CXXFLAGS    ?= -D_FORTIFY_SOURCE=2
+ CXXEFLAGS   := $(CXXFLAGS) -Wall -std=c++11
+ 
+ CC          ?= gcc
+--- a/GNUmakefile.llvm
++++ b/GNUmakefile.llvm
+@@ -237,7 +237,7 @@ else
+         AFL_CLANG_DEBUG_PREFIX =
+ endif
+ 
+-CFLAGS          ?= -O3 -funroll-loops -fPIC -D_FORTIFY_SOURCE=2
++CFLAGS          ?= -fPIC -D_FORTIFY_SOURCE=2
+ CFLAGS_SAFE     := -Wall -g -Wno-cast-qual -Wno-variadic-macros -Wno-pointer-sign -I ./include/ -I ./instrumentation/ \
+                    -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
+                    -DLLVM_BINDIR=\"$(LLVM_BINDIR)\" -DVERSION=\"$(VERSION)\" \
+@@ -254,7 +254,7 @@ ifdef AFL_TRACE_PC
+   $(info Compile option AFL_TRACE_PC is deprecated, just set AFL_LLVM_INSTRUMENT=PCGUARD to activate when compiling targets )
+ endif
+ 
+-CXXFLAGS          ?= -O3 -funroll-loops -fPIC -D_FORTIFY_SOURCE=2
++CXXFLAGS          ?= -fPIC -D_FORTIFY_SOURCE=2
+ override CXXFLAGS += -Wall -g -I ./include/ \
+                      -DVERSION=\"$(VERSION)\" -Wno-variadic-macros \
+                      -DLLVM_MINOR=$(LLVM_MINOR) -DLLVM_MAJOR=$(LLVM_MAJOR)
+@@ -434,20 +434,20 @@ afl-llvm-dict2file.so:	instrumentation/afl-llvm-dict2file.so.cc instrumentation/
+ 
+ .PHONY: document
+ document:
+-	$(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
+-	@$(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
+-	@$(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
++	$(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS_SAFE) $(CPPFLAGS) $(CLANG_CFL) -Wno-unused-result -fPIC -c instrumentation/afl-compiler-rt.o.c -o ./afl-compiler-rt.o
++	@$(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(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
++	@$(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(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
+ 
+ ./afl-compiler-rt.o: instrumentation/afl-compiler-rt.o.c
+-	$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -fPIC -c $< -o $@
++	$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -fPIC -c $< -o $@
+ 
+ ./afl-compiler-rt-32.o: instrumentation/afl-compiler-rt.o.c
+ 	@printf "[*] Building 32-bit variant of the runtime (-m32)... "
+-	@$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -m32 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; ln -sf afl-compiler-rt-32.o afl-llvm-rt-32.o; else echo "failed (that's fine)"; fi
++	@$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m32 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; ln -sf afl-compiler-rt-32.o afl-llvm-rt-32.o; else echo "failed (that's fine)"; fi
+ 
+ ./afl-compiler-rt-64.o: instrumentation/afl-compiler-rt.o.c
+ 	@printf "[*] Building 64-bit variant of the runtime (-m64)... "
+-	@$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -m64 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; ln -sf afl-compiler-rt-64.o afl-llvm-rt-64.o; else echo "failed (that's fine)"; fi
++	@$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m64 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; ln -sf afl-compiler-rt-64.o afl-llvm-rt-64.o; else echo "failed (that's fine)"; fi
+ 
+ .PHONY: test_build
+ test_build: $(PROGS)
+--- a/unicorn_mode/samples/c/Makefile
++++ b/unicorn_mode/samples/c/Makefile
+@@ -35,7 +35,7 @@ clean:
+ 	rm -rf *.o harness harness-debug
+ 
+ harness.o: harness.c ../../unicornafl/include/unicorn/*.h
+-	${MYCC} ${CFLAGS} -O3 -c harness.c
++	${MYCC} ${CFLAGS} -c harness.c
+ 
+ harness-debug.o: harness.c ../../unicornafl/include/unicorn/*.h
+ 	${MYCC} ${CFLAGS} -g -c harness.c -o $@
+--- a/unicorn_mode/samples/persistent/Makefile
++++ b/unicorn_mode/samples/persistent/Makefile
+@@ -35,7 +35,7 @@ clean:
+ 	rm -rf *.o harness harness-debug
+ 
+ harness.o: harness.c ../../unicornafl/include/unicorn/*.h
+-	${MYCC} ${CFLAGS} -O3 -c harness.c
++	${MYCC} ${CFLAGS} -c harness.c
+ 
+ harness-debug.o: harness.c ../../unicornafl/include/unicorn/*.h
+ 	${MYCC} ${CFLAGS} -DAFL_DEBUG=1 -g -c harness.c -o $@
+--- a/utils/afl_untracer/Makefile
++++ b/utils/afl_untracer/Makefile
+@@ -1,7 +1,7 @@
+ ifdef DEBUG
+   OPT=-O0
+ else
+-  OPT=-O3
++  OPT?=-O2
+ endif
+ 
+ all:	afl-untracer libtestinstr.so
+--- a/utils/custom_mutators/Makefile
++++ b/utils/custom_mutators/Makefile
+@@ -1,7 +1,7 @@
+ all: libexamplemutator.so
+ 
+ libexamplemutator.so:
+-	$(CC) $(CFLAGS) -D_FORTIFY_SOURCE=2 -O3 -fPIC -shared -g -I ../../include example.c -o libexamplemutator.so
++	$(CC) $(CFLAGS) -D_FORTIFY_SOURCE=2 -fPIC -shared -g -I ../../include example.c -o libexamplemutator.so
+ 
+ clean:
+ 	rm -rf libexamplemutator.so

diff --git a/app-forensics/aflplusplus/files/aflplusplus-3.0c-LDFLAGS.patch b/app-forensics/aflplusplus/files/aflplusplus-3.0c-LDFLAGS.patch
new file mode 100644
index 00000000000..3e8f4dd92d1
--- /dev/null
+++ b/app-forensics/aflplusplus/files/aflplusplus-3.0c-LDFLAGS.patch
@@ -0,0 +1,11 @@
+--- a/GNUmakefile.gcc_plugin
++++ b/GNUmakefile.gcc_plugin
+@@ -129,7 +129,7 @@ afl-common.o: ./src/afl-common.c
+ 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ $(LDFLAGS)
+ 
+ ./afl-gcc-pass.so: instrumentation/afl-gcc-pass.so.cc | test_deps
+-	$(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@
++	$(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@ $(LDFLAGS)
+ 	ln -sf afl-cc afl-gcc-fast
+ 	ln -sf afl-cc afl-g++-fast
+ 	ln -sf afl-cc.8 afl-gcc-fast.8

diff --git a/app-forensics/aflplusplus/metadata.xml b/app-forensics/aflplusplus/metadata.xml
new file mode 100644
index 00000000000..2c9221b04d2
--- /dev/null
+++ b/app-forensics/aflplusplus/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="person">
+		<email>sam@gentoo.org</email>
+		<name>Sam James</name>
+	</maintainer>
+	<upstream>
+		<remote-id type="github">AFLplusplus/AFLplusplus</remote-id>
+	</upstream>
+</pkgmetadata>


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: app-forensics/aflplusplus/files/, app-forensics/aflplusplus/
@ 2021-09-19  7:28 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2021-09-19  7:28 UTC (permalink / raw
  To: gentoo-commits

commit:     6e00fd395a9b52480e6d0162f953249811620ad9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 19 07:28:03 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Sep 19 07:28:32 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e00fd39

app-forensics/aflplusplus: detect failure in makefiles

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

 ...3.14c-r1.ebuild => aflplusplus-3.14c-r2.ebuild} |  2 +-
 ...lplusplus-3.14c-no-ignore-errors-makefile.patch | 62 ++++++++++++++++++++++
 2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/app-forensics/aflplusplus/aflplusplus-3.14c-r1.ebuild b/app-forensics/aflplusplus/aflplusplus-3.14c-r2.ebuild
similarity index 97%
rename from app-forensics/aflplusplus/aflplusplus-3.14c-r1.ebuild
rename to app-forensics/aflplusplus/aflplusplus-3.14c-r2.ebuild
index 74e2f4d3a72..0bae6dec57a 100644
--- a/app-forensics/aflplusplus/aflplusplus-3.14c-r1.ebuild
+++ b/app-forensics/aflplusplus/aflplusplus-3.14c-r2.ebuild
@@ -45,6 +45,7 @@ QA_PREBUILT="/usr/share/afl/testcases/others/elf/small_exec.elf"
 PATCHES=(
 	"${FILESDIR}/${PN}-3.0c-LDFLAGS.patch"
 	"${FILESDIR}/${PN}-3.13c-CFLAGS.patch"
+	"${FILESDIR}/${PN}-3.14c-no-ignore-errors-makefile.patch"
 )
 
 llvm_check_deps() {
@@ -59,7 +60,6 @@ pkg_setup() {
 
 src_prepare() {
 	default
-
 	sed -i -e 's/-O3 -fno-unroll-loops//' GNUmakefile || die
 }
 

diff --git a/app-forensics/aflplusplus/files/aflplusplus-3.14c-no-ignore-errors-makefile.patch b/app-forensics/aflplusplus/files/aflplusplus-3.14c-no-ignore-errors-makefile.patch
new file mode 100644
index 00000000000..0b029396390
--- /dev/null
+++ b/app-forensics/aflplusplus/files/aflplusplus-3.14c-no-ignore-errors-makefile.patch
@@ -0,0 +1,62 @@
+https://bugs.gentoo.org/800941
+
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -310,12 +310,12 @@ all:	test_x86 test_shm test_python ready $(PROGS) afl-as llvm gcc_plugin test_bu
+ 
+ .PHONY: llvm
+ llvm:
+-	-$(MAKE) -j -f GNUmakefile.llvm
++	$(MAKE) -j -f GNUmakefile.llvm
+ 	@test -e afl-cc || { echo "[-] Compiling afl-cc failed. You seem not to have a working compiler." ; exit 1; }
+ 
+ .PHONY: gcc_plugin
+ gcc_plugin:
+-	-$(MAKE) -f GNUmakefile.gcc_plugin
++	$(MAKE) -f GNUmakefile.gcc_plugin
+ 
+ .PHONY: man
+ man:    $(MANPAGES)
+@@ -562,8 +562,8 @@ all_done: test_build
+ .PHONY: clean
+ clean:
+ 	rm -f $(PROGS) libradamsa.so 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-qemu-trace afl-gcc-fast afl-gcc-pass.so 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
+-	-$(MAKE) -f GNUmakefile.llvm clean
+-	-$(MAKE) -f GNUmakefile.gcc_plugin clean
++	$(MAKE) -f GNUmakefile.llvm clean
++	$(MAKE) -f GNUmakefile.gcc_plugin clean
+ 	$(MAKE) -C utils/libdislocator clean
+ 	$(MAKE) -C utils/libtokencap clean
+ 	$(MAKE) -C utils/aflpp_driver clean
+@@ -618,8 +618,8 @@ binary-only: test_shm test_python ready $(PROGS)
+ 
+ .PHONY: source-only
+ source-only: all
+-	-$(MAKE) -j -f GNUmakefile.llvm
+-	-$(MAKE) -f GNUmakefile.gcc_plugin
++	$(MAKE) -j -f GNUmakefile.llvm
++	$(MAKE) -f GNUmakefile.gcc_plugin
+ 	$(MAKE) -C utils/libdislocator
+ 	$(MAKE) -C utils/libtokencap
+ 
+@@ -661,8 +661,8 @@ install: all $(MANPAGES)
+ 	@if [ -f utils/afl_network_proxy/afl-network-server ]; then $(MAKE) -C utils/afl_network_proxy install; fi
+ 	@if [ -f utils/aflpp_driver/libAFLDriver.a ]; then set -e; install -m 644 utils/aflpp_driver/libAFLDriver.a $${DESTDIR}$(HELPER_PATH); fi
+ 	@if [ -f utils/aflpp_driver/libAFLQemuDriver.a ]; then set -e; install -m 644 utils/aflpp_driver/libAFLQemuDriver.a $${DESTDIR}$(HELPER_PATH); fi
+-	-$(MAKE) -f GNUmakefile.llvm install
+-	-$(MAKE) -f GNUmakefile.gcc_plugin install
++	$(MAKE) -f GNUmakefile.llvm install
++	$(MAKE) -f GNUmakefile.gcc_plugin install
+ 	ln -sf afl-cc $${DESTDIR}$(BIN_PATH)/afl-gcc
+ 	ln -sf afl-cc $${DESTDIR}$(BIN_PATH)/afl-g++
+ 	ln -sf afl-cc $${DESTDIR}$(BIN_PATH)/afl-clang
+--- a/GNUmakefile.llvm
++++ b/GNUmakefile.llvm
+@@ -460,6 +460,7 @@ document:
+ test_build: $(PROGS)
+ 	@echo "[*] Testing the CC wrapper and instrumentation output..."
+ 	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)
++	@test -e test-instr || { echo "[-] Testing CC wrapper failed. You seem not to have a working compiler." ; exit 1; }
+ 	ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null
+ 	echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr
+ 	@rm -f test-instr


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: app-forensics/aflplusplus/files/, app-forensics/aflplusplus/
@ 2021-09-19  7:28 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2021-09-19  7:28 UTC (permalink / raw
  To: gentoo-commits

commit:     7a2b47d0a95d1f26992bca1afd5a26566b9c1eef
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 19 07:28:21 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Sep 19 07:28:33 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7a2b47d0

app-forensics/aflplusplus: drop 3.12c-r3, 3.13c-r1

Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-forensics/aflplusplus/Manifest                 |   2 -
 .../aflplusplus/aflplusplus-3.12c-r3.ebuild        |  98 ------------------
 .../aflplusplus/aflplusplus-3.13c-r1.ebuild        |  98 ------------------
 .../files/aflplusplus-3.0c-CFLAGS.patch            | 110 ---------------------
 4 files changed, 308 deletions(-)

diff --git a/app-forensics/aflplusplus/Manifest b/app-forensics/aflplusplus/Manifest
index 765f9130b88..b03d0a63851 100644
--- a/app-forensics/aflplusplus/Manifest
+++ b/app-forensics/aflplusplus/Manifest
@@ -1,3 +1 @@
-DIST aflplusplus-3.12c.tar.gz 2065569 BLAKE2B ff7a87eb02f7731b5ce8e1a3016239c6fd1cd1bfeb0b9c0fb69f72bdbf079e7700cdb32abe64f64853e5ff82f1c0ecd86d2cadb892e7c40be6bb2a7b089f7387 SHA512 a814d61298b60d99388289e742dbedf2ed1ab454a5e1ea20d48bb2f18b36c01553ab1f097a06f733439d67e804d48cb823a82ff249c404fb0b83a281564f3040
-DIST aflplusplus-3.13c.tar.gz 2128787 BLAKE2B 40fa65654468dc1de7f6e1b63d2266915a40d145b7cb91b8b95488bc975804f70887bc1c3718fbd12c76872a0126f3bcc36134eb55ef729060b5efcf93dad424 SHA512 916a714deaf67969c9ac6e90bd2d8015a1e5188c8a8122f4d5d64ce4b841822de65458e469a47d4244358fab5e31ef4e52b8ec1432dcbd60d29aedf15e4c36fe
 DIST aflplusplus-3.14c.tar.gz 2162934 BLAKE2B 0830b320cea65b9bdd048a08a388c7145164f6b7f4dc140a2f4268a3aa22dc608a771169c830e2196e7a0d543e6f3da49f39736f3b2514c559b986ce929d43c4 SHA512 318607cff40b5f2fc94938747e2ac6b8f400767138eb39edf4daf320afbdab417d0d97a80a1c9db8bb557ad4b7b62f887ae6e692c376f5d5673a493bd23bb811

diff --git a/app-forensics/aflplusplus/aflplusplus-3.12c-r3.ebuild b/app-forensics/aflplusplus/aflplusplus-3.12c-r3.ebuild
deleted file mode 100644
index 2e0c7d30195..00000000000
--- a/app-forensics/aflplusplus/aflplusplus-3.12c-r3.ebuild
+++ /dev/null
@@ -1,98 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9} )
-LLVM_MAX_SLOT=12
-inherit toolchain-funcs llvm optfeature python-single-r1
-
-DESCRIPTION="A fork of AFL, the popular compile-time instrumentation fuzzer"
-HOMEPAGE="https://github.com/AFLplusplus/AFLplusplus"
-SRC_URI="https://github.com/AFLplusplus/AFLplusplus/archive/${PV}.tar.gz -> ${P}.tar.gz"
-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"
-
-# It turns out we need Clang too
-RDEPEND="
-	${PYTHON_DEPS}
-	>=sys-devel/llvm-10:=
-	|| (
-		sys-devel/clang:10
-		sys-devel/clang:11
-		sys-devel/clang:12
-	)
-	!app-forensics/afl
-"
-DEPEND="
-	${RDEPEND}
-	test? ( dev-util/cmocka )
-"
-
-QA_PREBUILT="/usr/share/afl/testcases/others/elf/small_exec.elf"
-
-PATCHES=(
-	"${FILESDIR}/${PN}-3.0c-LDFLAGS.patch"
-	"${FILESDIR}/${PN}-3.0c-CFLAGS.patch"
-)
-
-llvm_check_deps() {
-	has_version -b "sys-devel/clang:${LLVM_SLOT}" && \
-		has_version -b "sys-devel/llvm:${LLVM_SLOT}"
-}
-
-pkg_setup() {
-	llvm_pkg_setup
-	python-single-r1_pkg_setup
-}
-
-src_prepare() {
-	default
-
-	sed -i -e 's/-O3 -fno-unroll-loops//' GNUmakefile || die
-}
-
-src_compile() {
-	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_test() {
-	emake \
-		CC="$(tc-getCC)" \
-		CXX="$(tc-getCXX)"
-}
-
-src_install() {
-	emake \
-		CC="$(tc-getCC)" \
-		CXX="$(tc-getCXX)" \
-		DESTDIR="${D}" \
-		PREFIX="${EPREFIX}/usr" \
-		HELPER_PATH="${EPREFIX}/usr/$(get_libdir)/afl" \
-		DOC_PATH="${EPREFIX}/usr/share/doc/${PF}" \
-		MAN_PATH="${EPREFIX}/usr/share/man/man8" \
-		install
-}
-
-pkg_postinst() {
-	# TODO: Any others?
-	optfeature "fuzzing with AFL_USE_ASAN" sys-libs/compiler-rt-sanitizers[asan]
-	optfeature "fuzzing with AFL_USE_MSAN" sys-libs/compiler-rt-sanitizers[msan]
-}

diff --git a/app-forensics/aflplusplus/aflplusplus-3.13c-r1.ebuild b/app-forensics/aflplusplus/aflplusplus-3.13c-r1.ebuild
deleted file mode 100644
index 3ea62e6bb74..00000000000
--- a/app-forensics/aflplusplus/aflplusplus-3.13c-r1.ebuild
+++ /dev/null
@@ -1,98 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9} )
-LLVM_MAX_SLOT=12
-inherit toolchain-funcs llvm optfeature python-single-r1
-
-DESCRIPTION="A fork of AFL, the popular compile-time instrumentation fuzzer"
-HOMEPAGE="https://github.com/AFLplusplus/AFLplusplus"
-SRC_URI="https://github.com/AFLplusplus/AFLplusplus/archive/${PV}.tar.gz -> ${P}.tar.gz"
-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"
-
-# It turns out we need Clang too
-RDEPEND="
-	${PYTHON_DEPS}
-	>=sys-devel/llvm-10:=
-	|| (
-		sys-devel/clang:10
-		sys-devel/clang:11
-		sys-devel/clang:12
-	)
-	!app-forensics/afl
-"
-DEPEND="
-	${RDEPEND}
-	test? ( dev-util/cmocka )
-"
-
-QA_PREBUILT="/usr/share/afl/testcases/others/elf/small_exec.elf"
-
-PATCHES=(
-	"${FILESDIR}/${PN}-3.0c-LDFLAGS.patch"
-	"${FILESDIR}/${PN}-3.13c-CFLAGS.patch"
-)
-
-llvm_check_deps() {
-	has_version -b "sys-devel/clang:${LLVM_SLOT}" && \
-		has_version -b "sys-devel/llvm:${LLVM_SLOT}"
-}
-
-pkg_setup() {
-	llvm_pkg_setup
-	python-single-r1_pkg_setup
-}
-
-src_prepare() {
-	default
-
-	sed -i -e 's/-O3 -fno-unroll-loops//' GNUmakefile || die
-}
-
-src_compile() {
-	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_test() {
-	emake \
-		CC="$(tc-getCC)" \
-		CXX="$(tc-getCXX)"
-}
-
-src_install() {
-	emake \
-		CC="$(tc-getCC)" \
-		CXX="$(tc-getCXX)" \
-		DESTDIR="${D}" \
-		PREFIX="${EPREFIX}/usr" \
-		HELPER_PATH="${EPREFIX}/usr/$(get_libdir)/afl" \
-		DOC_PATH="${EPREFIX}/usr/share/doc/${PF}" \
-		MAN_PATH="${EPREFIX}/usr/share/man/man8" \
-		install
-}
-
-pkg_postinst() {
-	# TODO: Any others?
-	optfeature "fuzzing with AFL_USE_ASAN" sys-libs/compiler-rt-sanitizers[asan]
-	optfeature "fuzzing with AFL_USE_MSAN" sys-libs/compiler-rt-sanitizers[msan]
-}

diff --git a/app-forensics/aflplusplus/files/aflplusplus-3.0c-CFLAGS.patch b/app-forensics/aflplusplus/files/aflplusplus-3.0c-CFLAGS.patch
deleted file mode 100644
index a3477fd7559..00000000000
--- a/app-forensics/aflplusplus/files/aflplusplus-3.0c-CFLAGS.patch
+++ /dev/null
@@ -1,110 +0,0 @@
---- a/GNUmakefile.gcc_plugin
-+++ b/GNUmakefile.gcc_plugin
-@@ -28,14 +28,14 @@ MAN_PATH    ?= $(PREFIX)/share/man/man8
- 
- VERSION     = $(shell grep '^$(HASH)define VERSION ' ./config.h | cut -d '"' -f2)
- 
--CFLAGS          ?= -O3 -g -funroll-loops -D_FORTIFY_SOURCE=2
-+CFLAGS          ?= -D_FORTIFY_SOURCE=2
- CFLAGS_SAFE     := -Wall -Iinclude -Wno-pointer-sign \
-                    -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
-                    -DGCC_VERSION=\"$(GCCVER)\" -DGCC_BINDIR=\"$(GCCBINDIR)\" \
-                    -Wno-unused-function
- override CFLAGS += $(CFLAGS_SAFE)
- 
--CXXFLAGS    ?= -O3 -g -funroll-loops -D_FORTIFY_SOURCE=2
-+CXXFLAGS    ?= -D_FORTIFY_SOURCE=2
- CXXEFLAGS   := $(CXXFLAGS) -Wall -std=c++11
- 
- CC          ?= gcc
---- a/GNUmakefile.llvm
-+++ b/GNUmakefile.llvm
-@@ -237,7 +237,7 @@ else
-         AFL_CLANG_DEBUG_PREFIX =
- endif
- 
--CFLAGS          ?= -O3 -funroll-loops -fPIC -D_FORTIFY_SOURCE=2
-+CFLAGS          ?= -fPIC -D_FORTIFY_SOURCE=2
- CFLAGS_SAFE     := -Wall -g -Wno-cast-qual -Wno-variadic-macros -Wno-pointer-sign -I ./include/ -I ./instrumentation/ \
-                    -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
-                    -DLLVM_BINDIR=\"$(LLVM_BINDIR)\" -DVERSION=\"$(VERSION)\" \
-@@ -254,7 +254,7 @@ ifdef AFL_TRACE_PC
-   $(info Compile option AFL_TRACE_PC is deprecated, just set AFL_LLVM_INSTRUMENT=PCGUARD to activate when compiling targets )
- endif
- 
--CXXFLAGS          ?= -O3 -funroll-loops -fPIC -D_FORTIFY_SOURCE=2
-+CXXFLAGS          ?= -fPIC -D_FORTIFY_SOURCE=2
- override CXXFLAGS += -Wall -g -I ./include/ \
-                      -DVERSION=\"$(VERSION)\" -Wno-variadic-macros \
-                      -DLLVM_MINOR=$(LLVM_MINOR) -DLLVM_MAJOR=$(LLVM_MAJOR)
-@@ -434,20 +434,20 @@ afl-llvm-dict2file.so:	instrumentation/afl-llvm-dict2file.so.cc instrumentation/
- 
- .PHONY: document
- document:
--	$(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
--	@$(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
--	@$(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
-+	$(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS_SAFE) $(CPPFLAGS) $(CLANG_CFL) -Wno-unused-result -fPIC -c instrumentation/afl-compiler-rt.o.c -o ./afl-compiler-rt.o
-+	@$(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(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
-+	@$(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(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
- 
- ./afl-compiler-rt.o: instrumentation/afl-compiler-rt.o.c
--	$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -fPIC -c $< -o $@
-+	$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -fPIC -c $< -o $@
- 
- ./afl-compiler-rt-32.o: instrumentation/afl-compiler-rt.o.c
- 	@printf "[*] Building 32-bit variant of the runtime (-m32)... "
--	@$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -m32 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; ln -sf afl-compiler-rt-32.o afl-llvm-rt-32.o; else echo "failed (that's fine)"; fi
-+	@$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m32 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; ln -sf afl-compiler-rt-32.o afl-llvm-rt-32.o; else echo "failed (that's fine)"; fi
- 
- ./afl-compiler-rt-64.o: instrumentation/afl-compiler-rt.o.c
- 	@printf "[*] Building 64-bit variant of the runtime (-m64)... "
--	@$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -m64 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; ln -sf afl-compiler-rt-64.o afl-llvm-rt-64.o; else echo "failed (that's fine)"; fi
-+	@$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m64 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; ln -sf afl-compiler-rt-64.o afl-llvm-rt-64.o; else echo "failed (that's fine)"; fi
- 
- .PHONY: test_build
- test_build: $(PROGS)
---- a/unicorn_mode/samples/c/Makefile
-+++ b/unicorn_mode/samples/c/Makefile
-@@ -35,7 +35,7 @@ clean:
- 	rm -rf *.o harness harness-debug
- 
- harness.o: harness.c ../../unicornafl/include/unicorn/*.h
--	${MYCC} ${CFLAGS} -O3 -c harness.c
-+	${MYCC} ${CFLAGS} -c harness.c
- 
- harness-debug.o: harness.c ../../unicornafl/include/unicorn/*.h
- 	${MYCC} ${CFLAGS} -g -c harness.c -o $@
---- a/unicorn_mode/samples/persistent/Makefile
-+++ b/unicorn_mode/samples/persistent/Makefile
-@@ -35,7 +35,7 @@ clean:
- 	rm -rf *.o harness harness-debug
- 
- harness.o: harness.c ../../unicornafl/include/unicorn/*.h
--	${MYCC} ${CFLAGS} -O3 -c harness.c
-+	${MYCC} ${CFLAGS} -c harness.c
- 
- harness-debug.o: harness.c ../../unicornafl/include/unicorn/*.h
- 	${MYCC} ${CFLAGS} -DAFL_DEBUG=1 -g -c harness.c -o $@
---- a/utils/afl_untracer/Makefile
-+++ b/utils/afl_untracer/Makefile
-@@ -1,7 +1,7 @@
- ifdef DEBUG
-   OPT=-O0
- else
--  OPT=-O3
-+  OPT?=-O2
- endif
- 
- all:	afl-untracer libtestinstr.so
---- a/utils/custom_mutators/Makefile
-+++ b/utils/custom_mutators/Makefile
-@@ -1,7 +1,7 @@
- all: libexamplemutator.so
- 
- libexamplemutator.so:
--	$(CC) $(CFLAGS) -D_FORTIFY_SOURCE=2 -O3 -fPIC -shared -g -I ../../include example.c -o libexamplemutator.so
-+	$(CC) $(CFLAGS) -D_FORTIFY_SOURCE=2 -fPIC -shared -g -I ../../include example.c -o libexamplemutator.so
- 
- clean:
- 	rm -rf libexamplemutator.so


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: app-forensics/aflplusplus/files/, app-forensics/aflplusplus/
@ 2022-07-07  3:13 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2022-07-07  3:13 UTC (permalink / raw
  To: gentoo-commits

commit:     1898df7eb336d42b908246c95ac241077534b996
Author:     Alexander Miller <alex.miller <AT> gmx <DOT> de>
AuthorDate: Thu Jul  7 00:30:33 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jul  7 03:13:14 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1898df7e

app-forensics/aflplusplus: Respect AR, add missing LDFLAGS instance

Closes: https://bugs.gentoo.org/856487
Closes: https://bugs.gentoo.org/856490
Signed-off-by: Alexander Miller <alex.miller <AT> gmx.de>
Closes: https://github.com/gentoo/gentoo/pull/26252
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...lus-4.01c.ebuild => aflplusplus-4.01c-r1.ebuild} |  0
 .../files/aflplusplus-4.01c-respect-flags.patch     | 21 ++++++++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/app-forensics/aflplusplus/aflplusplus-4.01c.ebuild b/app-forensics/aflplusplus/aflplusplus-4.01c-r1.ebuild
similarity index 100%
rename from app-forensics/aflplusplus/aflplusplus-4.01c.ebuild
rename to app-forensics/aflplusplus/aflplusplus-4.01c-r1.ebuild

diff --git a/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch b/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch
index 1cfc03d5f42b..0fe62c0b41ae 100644
--- a/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch
+++ b/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch
@@ -1,4 +1,4 @@
-* Respect CC, CFLAGS, CPPFLAGS, LDFLAGS everywhere when building.
+* Respect AR, CC, CFLAGS, CPPFLAGS, LDFLAGS everywhere when building.
 * Ignore build flags then when testing the CC wrappers (could contain
   incompatible flags).
 * Disable LTO for runtime objects, these shouldn't contain IR.
@@ -50,6 +50,15 @@
  	ln -sf afl-cc.8 afl-gcc-fast.8
 --- a/GNUmakefile.llvm
 +++ b/GNUmakefile.llvm
+@@ -410,7 +410,7 @@ endif
+ 
+ ./afl-ld-lto: src/afl-ld-lto.c
+ ifeq "$(LLVM_LTO)" "1"
+-	$(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@
++	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< -o $@
+ endif
+ 
+ ./SanitizerCoverageLTO.so: instrumentation/SanitizerCoverageLTO.so.cc instrumentation/afl-llvm-common.o
 @@ -444,25 +444,25 @@ afl-llvm-dict2file.so:	instrumentation/afl-llvm-dict2file.so.cc instrumentation/
  
  .PHONY: document
@@ -131,11 +140,12 @@
  
 --- a/utils/aflpp_driver/GNUmakefile
 +++ b/utils/aflpp_driver/GNUmakefile
-@@ -13,40 +13,41 @@ ifneq "" "$(LLVM_BINDIR)"
+@@ -13,40 +13,42 @@ ifneq "" "$(LLVM_BINDIR)"
    LLVM_BINDIR := $(LLVM_BINDIR)/
  endif
  
 -CFLAGS := -O3 -funroll-loops -g -fPIC
++AR ?= ar
 +CFLAGS ?= -O3 -funroll-loops -g
 +CFLAGS += -fPIC -fno-lto
  
@@ -147,7 +157,7 @@
  
  libAFLDriver.a:	aflpp_driver.o
 -	@ar rc libAFLDriver.a aflpp_driver.o
-+	ar rc libAFLDriver.a aflpp_driver.o
++	$(AR) rc libAFLDriver.a aflpp_driver.o
  	@cp -vf libAFLDriver.a ../../
  
  debug:
@@ -157,7 +167,8 @@
 +	$(CC) $(CPPFLAGS) -I../../include -D_DEBUG=\"1\" $(CFLAGS) -g -funroll-loops -c aflpp_driver.c
  	#$(LLVM_BINDIR)clang -S -emit-llvm -Wno-deprecated -I../../include $(CFLAGS) -D_DEBUG=\"1\" -c -o afl-performance.ll ../../src/afl-performance.c
  	#$(LLVM_BINDIR)clang -S -emit-llvm -I../../include -D_DEBUG=\"1\" -g -funroll-loops -c aflpp_driver.c
- 	ar rc libAFLDriver.a afl-performance.o aflpp_driver.o
+-	ar rc libAFLDriver.a afl-performance.o aflpp_driver.o
++	$(AR) rc libAFLDriver.a afl-performance.o aflpp_driver.o
  
  aflpp_qemu_driver.o:	aflpp_qemu_driver.c
 -	-$(LLVM_BINDIR)clang $(CFLAGS) -O0 -funroll-loops -c aflpp_qemu_driver.c
@@ -166,7 +177,7 @@
  libAFLQemuDriver.a:	aflpp_qemu_driver.o
 -	@-ar rc libAFLQemuDriver.a aflpp_qemu_driver.o
 -	@-cp -vf libAFLQemuDriver.a ../../
-+	ar rc libAFLQemuDriver.a aflpp_qemu_driver.o
++	$(AR) rc libAFLQemuDriver.a aflpp_qemu_driver.o
 +	@cp -vf libAFLQemuDriver.a ../../
  
  aflpp_qemu_driver_hook.so:	aflpp_qemu_driver_hook.o


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: app-forensics/aflplusplus/files/, app-forensics/aflplusplus/
@ 2022-08-31  4:30 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2022-08-31  4:30 UTC (permalink / raw
  To: gentoo-commits

commit:     15de30edfddde262dcef800ad30ac8f6ecd7fbfd
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 31 04:26:24 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Aug 31 04:26:24 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15de30ed

app-forensics/aflplusplus: add 4.02c

Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-forensics/aflplusplus/Manifest                 |   1 +
 app-forensics/aflplusplus/aflplusplus-4.02c.ebuild |  84 +++++++++
 ...lplusplus-4.02c-no-ignore-errors-makefile.patch | 149 +++++++++++++++
 .../files/aflplusplus-4.02c-respect-flags.patch    | 200 +++++++++++++++++++++
 4 files changed, 434 insertions(+)

diff --git a/app-forensics/aflplusplus/Manifest b/app-forensics/aflplusplus/Manifest
index 3e2e5b638831..f5ef08b725dc 100644
--- a/app-forensics/aflplusplus/Manifest
+++ b/app-forensics/aflplusplus/Manifest
@@ -1,2 +1,3 @@
 DIST aflplusplus-4.00c.tar.gz 2805041 BLAKE2B c1ce15aa9860fc02a7d6f608cae9dd8987b72253b465ea734c721d1b6927e482c31b907aeafe82c00618465227e2e140bfc595151ea5d73037638c3ee630872c SHA512 23a7a4260e581f7c212393e1e14704464bbbc3ff5465b3472db31c6c7f2cd25a9ecc5ad81fad8958c775fcd01b22269085e6c69419a07fbbdb9ec317a3e39beb
 DIST aflplusplus-4.01c.tar.gz 2818445 BLAKE2B f3699c4b2fabec0ab238277c3b2c7b19b35af7a0b82b14a57c34b8579121cfa0644ef432132cf4a3382547db3faf799d2ab601512ddfb469e4a2246cdb61aa7f SHA512 d2b03ab4ff9538fe0b52aa3ed4778a6e5657d64d6f0e5f75a99305bad69c5179d6b1c882650f19a884a740577acb73dab7cee3d5c9c7b06ff2326ffeba37d1fe
+DIST aflplusplus-4.02c.tar.gz 2828429 BLAKE2B 0c4d7937626a699bb6768e2f67f369508f7ec131d1170cd48f8650d8081135b466733de34e52f2ac2213c4bd13ab8936b17d3b0f8debf28e8a32ad87d9dcb55d SHA512 f5159a84e0ecd2c260d2d8ce7df33fe4704c664bdf06f193a7fef377d48646e4d921ee90d0b66c7dac02d16e6b1607c6569351aaeea9b2ee3968d22b3f583763

diff --git a/app-forensics/aflplusplus/aflplusplus-4.02c.ebuild b/app-forensics/aflplusplus/aflplusplus-4.02c.ebuild
new file mode 100644
index 000000000000..45d84376a414
--- /dev/null
+++ b/app-forensics/aflplusplus/aflplusplus-4.02c.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+LLVM_MAX_SLOT=14
+inherit toolchain-funcs llvm optfeature python-single-r1
+
+DESCRIPTION="A fork of AFL, the popular compile-time instrumentation fuzzer"
+HOMEPAGE="https://github.com/AFLplusplus/AFLplusplus"
+SRC_URI="https://github.com/AFLplusplus/AFLplusplus/archive/${PV}.tar.gz -> ${P}.tar.gz"
+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"
+
+# It turns out we need Clang too
+RDEPEND="${PYTHON_DEPS}
+	>=sys-devel/llvm-13:=
+	|| (
+		sys-devel/clang:13
+		sys-devel/clang:${LLVM_MAX_SLOT}
+	)
+	!app-forensics/afl"
+DEPEND="${RDEPEND}
+	test? ( dev-util/cmocka )"
+
+QA_PREBUILT="usr/share/afl/testcases/others/elf/small_exec.elf"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-4.02c-respect-flags.patch
+	"${FILESDIR}"/${PN}-4.02c-no-ignore-errors-makefile.patch
+	"${FILESDIR}"/${PN}-4.01c-lld-detect.patch
+)
+
+llvm_check_deps() {
+	has_version -b "sys-devel/clang:${LLVM_SLOT}" && \
+		has_version -b "sys-devel/llvm:${LLVM_SLOT}"
+}
+
+pkg_setup() {
+	llvm_pkg_setup
+	python-single-r1_pkg_setup
+}
+
+mymake() {
+	emake \
+		CC="$(tc-getCC)" \
+		CXX="$(tc-getCXX)" \
+		CFLAGS_FLTO="" \
+		LLVM_CONFIG="$(get_llvm_prefix ${LLVM_MAX_SLOT})"/bin/llvm-config \
+		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() {
+	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" sys-libs/compiler-rt-sanitizers[asan]
+	optfeature "fuzzing with AFL_USE_MSAN" sys-libs/compiler-rt-sanitizers[msan]
+}

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
new file mode 100644
index 000000000000..8a2cccbcff8f
--- /dev/null
+++ b/app-forensics/aflplusplus/files/aflplusplus-4.02c-no-ignore-errors-makefile.patch
@@ -0,0 +1,149 @@
+https://bugs.gentoo.org/800941
+(also don't override jobs for sub-makes)
+
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -308,17 +308,17 @@ endif
+ 
+ .PHONY: all
+ all:	test_x86 test_shm test_python ready $(PROGS) afl-as llvm gcc_plugin test_build all_done
+-	-$(MAKE) -C utils/aflpp_driver
++	$(MAKE) -C utils/aflpp_driver
+ 
+ .PHONY: llvm
+ llvm:
+-	-$(MAKE) -j$(nproc) -f GNUmakefile.llvm
++	$(MAKE) -f GNUmakefile.llvm
+ 	@test -e afl-cc || { echo "[-] Compiling afl-cc failed. You seem not to have a working compiler." ; exit 1; }
+ 
+ .PHONY: gcc_plugin
+ gcc_plugin:
+ ifneq "$(SYS)" "Darwin"
+-	-$(MAKE) -f GNUmakefile.gcc_plugin
++	$(MAKE) -f GNUmakefile.gcc_plugin
+ endif
+ 
+ .PHONY: man
+@@ -571,19 +571,19 @@ all_done: test_build
+ .PHONY: clean
+ clean:
+ 	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
+-	-$(MAKE) -f GNUmakefile.llvm clean
+-	-$(MAKE) -f GNUmakefile.gcc_plugin clean
+-	-$(MAKE) -C utils/libdislocator clean
+-	-$(MAKE) -C utils/libtokencap clean
+-	-$(MAKE) -C utils/aflpp_driver clean
+-	-$(MAKE) -C utils/afl_network_proxy clean
+-	-$(MAKE) -C utils/socket_fuzzing clean
+-	-$(MAKE) -C utils/argv_fuzzing clean
+-	-$(MAKE) -C utils/plot_ui clean
+-	-$(MAKE) -C qemu_mode/unsigaction clean
+-	-$(MAKE) -C qemu_mode/libcompcov clean
+-	-$(MAKE) -C qemu_mode/libqasan clean
+-	-$(MAKE) -C frida_mode clean
++	$(MAKE) -f GNUmakefile.llvm clean
++	$(MAKE) -f GNUmakefile.gcc_plugin clean
++	$(MAKE) -C utils/libdislocator clean
++	$(MAKE) -C utils/libtokencap clean
++	$(MAKE) -C utils/aflpp_driver clean
++	$(MAKE) -C utils/afl_network_proxy clean
++	$(MAKE) -C utils/socket_fuzzing clean
++	$(MAKE) -C utils/argv_fuzzing clean
++	$(MAKE) -C utils/plot_ui clean
++	$(MAKE) -C qemu_mode/unsigaction clean
++	$(MAKE) -C qemu_mode/libcompcov clean
++	$(MAKE) -C qemu_mode/libqasan clean
++	$(MAKE) -C frida_mode clean
+ 	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
+ ifeq "$(IN_REPO)" "1"
+ 	-test -e coresight_mode/coresight-trace/Makefile && $(MAKE) -C coresight_mode/coresight-trace clean || true
+@@ -613,21 +613,21 @@ endif
+ 
+ .PHONY: distrib
+ distrib: all
+-	-$(MAKE) -j$(nproc) -f GNUmakefile.llvm
++	$(MAKE) -f GNUmakefile.llvm
+ ifneq "$(SYS)" "Darwin"
+-	-$(MAKE) -f GNUmakefile.gcc_plugin
+-endif
+-	-$(MAKE) -C utils/libdislocator
+-	-$(MAKE) -C utils/libtokencap
+-	-$(MAKE) -C utils/afl_network_proxy
+-	-$(MAKE) -C utils/socket_fuzzing
+-	-$(MAKE) -C utils/argv_fuzzing
+-	# -$(MAKE) -C utils/plot_ui
+-	-$(MAKE) -C frida_mode
++	$(MAKE) -f GNUmakefile.gcc_plugin
++endif
++	$(MAKE) -C utils/libdislocator
++	$(MAKE) -C utils/libtokencap
++	$(MAKE) -C utils/afl_network_proxy
++	$(MAKE) -C utils/socket_fuzzing
++	$(MAKE) -C utils/argv_fuzzing
++	# $(MAKE) -C utils/plot_ui
++	$(MAKE) -C frida_mode
+ ifneq "$(SYS)" "Darwin"
+ ifeq "$(ARCH)" "aarch64"
+   ifndef NO_CORESIGHT
+-	-$(MAKE) -C coresight_mode
++	$(MAKE) -C coresight_mode
+   endif
+ endif
+ ifeq "$(SYS)" "Linux"
+@@ -647,17 +647,17 @@ endif
+ 
+ .PHONY: binary-only
+ binary-only: test_shm test_python ready $(PROGS)
+-	-$(MAKE) -C utils/libdislocator
+-	-$(MAKE) -C utils/libtokencap
+-	-$(MAKE) -C utils/afl_network_proxy
+-	-$(MAKE) -C utils/socket_fuzzing
+-	-$(MAKE) -C utils/argv_fuzzing
+-	# -$(MAKE) -C utils/plot_ui
+-	-$(MAKE) -C frida_mode
++	$(MAKE) -C utils/libdislocator
++	$(MAKE) -C utils/libtokencap
++	$(MAKE) -C utils/afl_network_proxy
++	$(MAKE) -C utils/socket_fuzzing
++	$(MAKE) -C utils/argv_fuzzing
++	# $(MAKE) -C utils/plot_ui
++	$(MAKE) -C frida_mode
+ ifneq "$(SYS)" "Darwin"
+ ifeq "$(ARCH)" "aarch64"
+   ifndef NO_CORESIGHT
+-	-$(MAKE) -C coresight_mode
++	$(MAKE) -C coresight_mode
+   endif
+ endif
+ ifeq "$(SYS)" "Linux"
+@@ -677,13 +677,13 @@ endif
+ 
+ .PHONY: source-only
+ source-only: all
+-	-$(MAKE) -j$(nproc) -f GNUmakefile.llvm
++	$(MAKE) -f GNUmakefile.llvm
+ ifneq "$(SYS)" "Darwin"
+-	-$(MAKE) -f GNUmakefile.gcc_plugin
++	$(MAKE) -f GNUmakefile.gcc_plugin
+ endif
+-	-$(MAKE) -C utils/libdislocator
+-	-$(MAKE) -C utils/libtokencap
+-	# -$(MAKE) -C utils/plot_ui
++	$(MAKE) -C utils/libdislocator
++	$(MAKE) -C utils/libtokencap
++	# $(MAKE) -C utils/plot_ui
+ ifeq "$(SYS)" "Linux"
+ ifndef NO_NYX
+ 	-cd nyx_mode && ./build_nyx_support.sh
+@@ -731,9 +731,9 @@ install: all $(MANPAGES)
+ 	@if [ -f utils/afl_network_proxy/afl-network-server ]; then $(MAKE) -C utils/afl_network_proxy install; fi
+ 	@if [ -f utils/aflpp_driver/libAFLDriver.a ]; then set -e; install -m 644 utils/aflpp_driver/libAFLDriver.a $${DESTDIR}$(HELPER_PATH); fi
+ 	@if [ -f utils/aflpp_driver/libAFLQemuDriver.a ]; then set -e; install -m 644 utils/aflpp_driver/libAFLQemuDriver.a $${DESTDIR}$(HELPER_PATH); fi
+-	-$(MAKE) -f GNUmakefile.llvm install
++	$(MAKE) -f GNUmakefile.llvm install
+ ifneq "$(SYS)" "Darwin"
+-	-$(MAKE) -f GNUmakefile.gcc_plugin install
++	$(MAKE) -f GNUmakefile.gcc_plugin install
+ endif
+ 	ln -sf afl-cc $${DESTDIR}$(BIN_PATH)/afl-gcc
+ 	ln -sf afl-cc $${DESTDIR}$(BIN_PATH)/afl-g++

diff --git a/app-forensics/aflplusplus/files/aflplusplus-4.02c-respect-flags.patch b/app-forensics/aflplusplus/files/aflplusplus-4.02c-respect-flags.patch
new file mode 100644
index 000000000000..65748a51c723
--- /dev/null
+++ b/app-forensics/aflplusplus/files/aflplusplus-4.02c-respect-flags.patch
@@ -0,0 +1,200 @@
+* Respect AR, CC, CFLAGS, CPPFLAGS, LDFLAGS everywhere when building.
+* Ignore build flags then when testing the CC wrappers (could contain
+  incompatible flags).
+* Disable LTO for runtime objects, these shouldn't contain IR.
+
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -426,7 +426,7 @@ afl-as: src/afl-as.c include/afl-as.h $(COMM_HDR) | test_x86
+ 	@ln -sf afl-as as
+ 
+ src/afl-performance.o : $(COMM_HDR) src/afl-performance.c include/hash.h
+-	$(CC) $(CFLAGS) $(CFLAGS_OPT) -Iinclude -c src/afl-performance.c -o src/afl-performance.o
++	$(CC) $(CFLAGS) -Iinclude -c src/afl-performance.c -o src/afl-performance.o
+ 
+ src/afl-common.o : $(COMM_HDR) src/afl-common.c include/common.h
+ 	$(CC) $(CFLAGS) $(CFLAGS_FLTO) -c src/afl-common.c -o src/afl-common.o
+@@ -534,7 +534,7 @@ code-format:
+ ifndef AFL_NO_X86
+ test_build: afl-cc afl-gcc afl-as afl-showmap
+ 	@echo "[*] Testing the CC wrapper afl-cc and its instrumentation output..."
+-	@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 )
++	@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 )
+ 	ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null
+ 	echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr
+ 	@rm -f test-instr
+--- a/GNUmakefile.gcc_plugin
++++ b/GNUmakefile.gcc_plugin
+@@ -133,20 +133,20 @@ afl-common.o: ./src/afl-common.c
+ 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ $(LDFLAGS)
+ 
+ ./afl-compiler-rt.o: instrumentation/afl-compiler-rt.o.c
+-	$(CC) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -fPIC -c $< -o $@
++	$(CC) $(CFLAGS) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -fPIC -fno-lto -c $< -o $@
+ 
+ ./afl-compiler-rt-32.o: instrumentation/afl-compiler-rt.o.c
+ 	@printf "[*] Building 32-bit variant of the runtime (-m32)... "
+-	@$(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
++	@$(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
+ 
+ ./afl-compiler-rt-64.o: instrumentation/afl-compiler-rt.o.c
+ 	@printf "[*] Building 64-bit variant of the runtime (-m64)... "
+-	@$(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
++	@$(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
+ 
+ $(PASSES): instrumentation/afl-gcc-common.h
+ 
+ ./afl-gcc-pass.so: instrumentation/afl-gcc-pass.so.cc | test_deps
+-	$(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@
++	$(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@ $(LDFLAGS)
+ 	ln -sf afl-cc afl-gcc-fast
+ 	ln -sf afl-cc afl-g++-fast
+ 	ln -sf afl-cc.8 afl-gcc-fast.8
+--- a/GNUmakefile.llvm
++++ b/GNUmakefile.llvm
+@@ -410,7 +410,7 @@ endif
+ 
+ ./afl-ld-lto: src/afl-ld-lto.c
+ ifeq "$(LLVM_LTO)" "1"
+-	$(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@
++	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< -o $@
+ endif
+ 
+ ./SanitizerCoverageLTO.so: instrumentation/SanitizerCoverageLTO.so.cc instrumentation/afl-llvm-common.o
+@@ -444,25 +444,25 @@ afl-llvm-dict2file.so:	instrumentation/afl-llvm-dict2file.so.cc instrumentation/
+ 
+ .PHONY: document
+ document:
+-	$(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
+-	@$(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
+-	@$(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
++	$(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
++	@$(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
++	@$(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
+ 
+ ./afl-compiler-rt.o: instrumentation/afl-compiler-rt.o.c
+-	$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -fPIC -c $< -o $@
++	$(CC) $(CFLAGS) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -fPIC -fno-lto -c $< -o $@
+ 
+ ./afl-compiler-rt-32.o: instrumentation/afl-compiler-rt.o.c
+ 	@printf "[*] Building 32-bit variant of the runtime (-m32)... "
+-	@$(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
++	@$(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
+ 
+ ./afl-compiler-rt-64.o: instrumentation/afl-compiler-rt.o.c
+ 	@printf "[*] Building 64-bit variant of the runtime (-m64)... "
+-	@$(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
++	@$(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
+ 
+ .PHONY: test_build
+ test_build: $(PROGS)
+ 	@echo "[*] Testing the CC wrapper and instrumentation output..."
+-	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)
++	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
+ 	ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null
+ 	echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr
+ 	@rm -f test-instr
+--- a/custom_mutators/honggfuzz/Makefile
++++ b/custom_mutators/honggfuzz/Makefile
+@@ -1,5 +1,6 @@
+ 
+-CFLAGS = -O3 -funroll-loops -fPIC -Wl,-Bsymbolic
++CFLAGS ?= -O3
++CFLAGS += -funroll-loops -fPIC -Wl,-Bsymbolic
+ 
+ all: honggfuzz-mutator.so
+ 
+--- a/custom_mutators/libfuzzer/Makefile
++++ b/custom_mutators/libfuzzer/Makefile
+@@ -1,6 +1,6 @@
+ 
+-CFLAGS = -g -O3 -funroll-loops -fPIC -fpermissive -std=c++11
+-#CFLAGS = -g -O0 -fPIC -fpermissive -std=c++11
++CFLAGS ?= -g -O3
++CFLAGS += -funroll-loops -fpermissive -std=c++11 -fPIC
+ CXX ?= clang++
+ 
+ ifdef INTROSPECTION
+--- a/frida_mode/GNUmakefile
++++ b/frida_mode/GNUmakefile
+@@ -27,7 +27,6 @@ CFLAGS+=-fPIC \
+ 		-D_GNU_SOURCE \
+ 		-D_FORTIFY_SOURCE=2 \
+ 		-g \
+-		-O3 \
+ 		-funroll-loops \
+ 		-ffunction-sections \
+ 
+--- a/frida_mode/test/png/persistent/hook/GNUmakefile
++++ b/frida_mode/test/png/persistent/hook/GNUmakefile
+@@ -5,11 +5,9 @@ BUILD_DIR:=$(PWD)build/
+ AFLPP_FRIDA_DRIVER_HOOK_OBJ=$(ROOT)frida_mode/build/frida_hook.so
+ AFLPP_QEMU_DRIVER_HOOK_OBJ=$(ROOT)frida_mode/build/qemu_hook.so
+ 
+-CFLAGS+=-O3 \
+-		-funroll-loops \
++CFLAGS+= -funroll-loops \
+ 		-g \
+-		-fPIC \
+-		-funroll-loops \
++		-fPIC
+ 
+ LDFLAGS+=-shared \
+ 
+--- a/utils/aflpp_driver/GNUmakefile
++++ b/utils/aflpp_driver/GNUmakefile
+@@ -13,40 +13,42 @@ ifneq "" "$(LLVM_BINDIR)"
+   LLVM_BINDIR := $(LLVM_BINDIR)/
+ endif
+ 
+-CFLAGS := -O3 -funroll-loops -g -fPIC
++AR ?= ar
++CFLAGS ?= -O3 -funroll-loops -g
++CFLAGS += -fPIC -fno-lto
+ 
+ all:	libAFLDriver.a libAFLQemuDriver.a aflpp_qemu_driver_hook.so
+ 
+ aflpp_driver.o:	aflpp_driver.c
+-	-$(LLVM_BINDIR)clang -I. -I../../include $(CFLAGS) -c aflpp_driver.c
++	$(CC) $(CPPFLAGS) -I. -I../../include $(CFLAGS) -c aflpp_driver.c
+ 
+ libAFLDriver.a:	aflpp_driver.o
+-	@ar rc libAFLDriver.a aflpp_driver.o
++	$(AR) rc libAFLDriver.a aflpp_driver.o
+ 	@cp -vf libAFLDriver.a ../../
+ 
+ debug:
+-	$(LLVM_BINDIR)clang -Wno-deprecated -I../../include $(CFLAGS) -D_DEBUG=\"1\" -c -o afl-performance.o ../../src/afl-performance.c
+-	$(LLVM_BINDIR)clang -I../../include -D_DEBUG=\"1\" -g -funroll-loops -c aflpp_driver.c
++	$(CC) $(CPPFLAGS) -Wno-deprecated -I../../include $(CFLAGS) -D_DEBUG=\"1\" -c -o afl-performance.o ../../src/afl-performance.c
++	$(CC) $(CPPFLAGS) -I../../include -D_DEBUG=\"1\" $(CFLAGS) -g -funroll-loops -c aflpp_driver.c
+ 	#$(LLVM_BINDIR)clang -S -emit-llvm -Wno-deprecated -I../../include $(CFLAGS) -D_DEBUG=\"1\" -c -o afl-performance.ll ../../src/afl-performance.c
+ 	#$(LLVM_BINDIR)clang -S -emit-llvm -I../../include -D_DEBUG=\"1\" -g -funroll-loops -c aflpp_driver.c
+-	ar rc libAFLDriver.a afl-performance.o aflpp_driver.o
++	$(AR) rc libAFLDriver.a afl-performance.o aflpp_driver.o
+ 
+ aflpp_qemu_driver.o:	aflpp_qemu_driver.c
+-	-$(LLVM_BINDIR)clang $(CFLAGS) -O0 -funroll-loops -c aflpp_qemu_driver.c
++	$(CC) $(CPPFLAGS) $(CFLAGS) -O0 -funroll-loops -c aflpp_qemu_driver.c
+ 
+ libAFLQemuDriver.a:	aflpp_qemu_driver.o
+-	@-ar rc libAFLQemuDriver.a aflpp_qemu_driver.o
+-	@-cp -vf libAFLQemuDriver.a ../../
++	$(AR) rc libAFLQemuDriver.a aflpp_qemu_driver.o
++	@cp -vf libAFLQemuDriver.a ../../
+ 
+ aflpp_qemu_driver_hook.so:	aflpp_qemu_driver_hook.o
+-	@-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."
++	@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."
+ 
+ aflpp_qemu_driver_hook.o:	aflpp_qemu_driver_hook.c
+-	@-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."
++	@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."
+ 
+ test:	debug
+ 	#clang -S -emit-llvm -D_DEBUG=\"1\" -I../../include -Wl,--allow-multiple-definition -funroll-loops -o aflpp_driver_test.ll aflpp_driver_test.c
+-	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
++	../../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
+ 
+ clean:
+ 	rm -f *.o libAFLDriver*.a libAFLQemuDriver.a aflpp_qemu_driver_hook.so *~ core aflpp_driver_test


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-31  4:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-31  4:30 [gentoo-commits] repo/gentoo:master commit in: app-forensics/aflplusplus/files/, app-forensics/aflplusplus/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2022-07-07  3:13 Sam James
2021-09-19  7:28 Sam James
2021-09-19  7:28 Sam James
2021-03-31 23:38 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox