commit: 55dbef339a5303eea0c707b2c1b5fa9f523276ae
Author: Alexander Miller <alex.miller <AT> gmx <DOT> de>
AuthorDate: Mon Jul 4 17:15:04 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul 4 23:24:02 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=55dbef33
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 <AT> gmx.de>
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../files/aflplusplus-4.01c-respect-flags.patch | 47 +++++++++++++++++++++-
1 file 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