summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Miller <alex.miller@gmx.de>2022-07-04 19:15:04 +0200
committerSam James <sam@gentoo.org>2022-07-05 00:24:02 +0100
commit55dbef339a5303eea0c707b2c1b5fa9f523276ae (patch)
tree3539aa02dac7b81c1b8432d7c7b4c12feb25b562 /app-forensics
parentapp-forensics/aflplusplus: Don't override jobs parameter for sub-makes (diff)
downloadgentoo-55dbef339a5303eea0c707b2c1b5fa9f523276ae.tar.gz
gentoo-55dbef339a5303eea0c707b2c1b5fa9f523276ae.tar.bz2
gentoo-55dbef339a5303eea0c707b2c1b5fa9f523276ae.zip
app-forensics/aflplusplus: Respect CC and CPPFLAGS when building aflpp_driver
Note that using user's CFLAGS with hard-coded clang can cause trouble. Signed-off-by: Alexander Miller <alex.miller@gmx.de> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-forensics')
-rw-r--r--app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch47
1 files changed, 45 insertions, 2 deletions
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 ebe638f1a86c..1cfc03d5f42b 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 CFLAGS everywhere when building.
+* Respect 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.
@@ -131,7 +131,7 @@
--- a/utils/aflpp_driver/GNUmakefile
+++ b/utils/aflpp_driver/GNUmakefile
-@@ -13,7 +13,8 @@ ifneq "" "$(LLVM_BINDIR)"
+@@ -13,40 +13,41 @@ ifneq "" "$(LLVM_BINDIR)"
LLVM_BINDIR := $(LLVM_BINDIR)/
endif
@@ -141,3 +141,46 @@
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
+
+ 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