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/files/
Date: Mon, 04 Jul 2022 23:24:21
Message-Id: 1656977042.55dbef339a5303eea0c707b2c1b5fa9f523276ae.sam@gentoo
1 commit: 55dbef339a5303eea0c707b2c1b5fa9f523276ae
2 Author: Alexander Miller <alex.miller <AT> gmx <DOT> de>
3 AuthorDate: Mon Jul 4 17:15:04 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 4 23:24:02 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=55dbef33
7
8 app-forensics/aflplusplus: Respect CC and CPPFLAGS when building aflpp_driver
9
10 Note that using user's CFLAGS with hard-coded clang can cause trouble.
11
12 Signed-off-by: Alexander Miller <alex.miller <AT> gmx.de>
13 Signed-off-by: Sam James <sam <AT> gentoo.org>
14
15 .../files/aflplusplus-4.01c-respect-flags.patch | 47 +++++++++++++++++++++-
16 1 file changed, 45 insertions(+), 2 deletions(-)
17
18 diff --git a/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch b/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch
19 index ebe638f1a86c..1cfc03d5f42b 100644
20 --- a/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch
21 +++ b/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch
22 @@ -1,4 +1,4 @@
23 -* Respect CFLAGS everywhere when building.
24 +* Respect CC, CFLAGS, CPPFLAGS, LDFLAGS everywhere when building.
25 * Ignore build flags then when testing the CC wrappers (could contain
26 incompatible flags).
27 * Disable LTO for runtime objects, these shouldn't contain IR.
28 @@ -131,7 +131,7 @@
29
30 --- a/utils/aflpp_driver/GNUmakefile
31 +++ b/utils/aflpp_driver/GNUmakefile
32 -@@ -13,7 +13,8 @@ ifneq "" "$(LLVM_BINDIR)"
33 +@@ -13,40 +13,41 @@ ifneq "" "$(LLVM_BINDIR)"
34 LLVM_BINDIR := $(LLVM_BINDIR)/
35 endif
36
37 @@ -141,3 +141,46 @@
38
39 all: libAFLDriver.a libAFLQemuDriver.a aflpp_qemu_driver_hook.so
40
41 + aflpp_driver.o: aflpp_driver.c
42 +- -$(LLVM_BINDIR)clang -I. -I../../include $(CFLAGS) -c aflpp_driver.c
43 ++ $(CC) $(CPPFLAGS) -I. -I../../include $(CFLAGS) -c aflpp_driver.c
44 +
45 + libAFLDriver.a: aflpp_driver.o
46 +- @ar rc libAFLDriver.a aflpp_driver.o
47 ++ ar rc libAFLDriver.a aflpp_driver.o
48 + @cp -vf libAFLDriver.a ../../
49 +
50 + debug:
51 +- $(LLVM_BINDIR)clang -Wno-deprecated -I../../include $(CFLAGS) -D_DEBUG=\"1\" -c -o afl-performance.o ../../src/afl-performance.c
52 +- $(LLVM_BINDIR)clang -I../../include -D_DEBUG=\"1\" -g -funroll-loops -c aflpp_driver.c
53 ++ $(CC) $(CPPFLAGS) -Wno-deprecated -I../../include $(CFLAGS) -D_DEBUG=\"1\" -c -o afl-performance.o ../../src/afl-performance.c
54 ++ $(CC) $(CPPFLAGS) -I../../include -D_DEBUG=\"1\" $(CFLAGS) -g -funroll-loops -c aflpp_driver.c
55 + #$(LLVM_BINDIR)clang -S -emit-llvm -Wno-deprecated -I../../include $(CFLAGS) -D_DEBUG=\"1\" -c -o afl-performance.ll ../../src/afl-performance.c
56 + #$(LLVM_BINDIR)clang -S -emit-llvm -I../../include -D_DEBUG=\"1\" -g -funroll-loops -c aflpp_driver.c
57 + ar rc libAFLDriver.a afl-performance.o aflpp_driver.o
58 +
59 + aflpp_qemu_driver.o: aflpp_qemu_driver.c
60 +- -$(LLVM_BINDIR)clang $(CFLAGS) -O0 -funroll-loops -c aflpp_qemu_driver.c
61 ++ $(CC) $(CPPFLAGS) $(CFLAGS) -O0 -funroll-loops -c aflpp_qemu_driver.c
62 +
63 + libAFLQemuDriver.a: aflpp_qemu_driver.o
64 +- @-ar rc libAFLQemuDriver.a aflpp_qemu_driver.o
65 +- @-cp -vf libAFLQemuDriver.a ../../
66 ++ ar rc libAFLQemuDriver.a aflpp_qemu_driver.o
67 ++ @cp -vf libAFLQemuDriver.a ../../
68 +
69 + aflpp_qemu_driver_hook.so: aflpp_qemu_driver_hook.o
70 +- @-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."
71 ++ @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."
72 +
73 + aflpp_qemu_driver_hook.o: aflpp_qemu_driver_hook.c
74 +- @-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."
75 ++ @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."
76 +
77 + test: debug
78 + #clang -S -emit-llvm -D_DEBUG=\"1\" -I../../include -Wl,--allow-multiple-definition -funroll-loops -o aflpp_driver_test.ll aflpp_driver_test.c
79 +- 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
80 ++ ../../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
81 +
82 + clean:
83 + rm -f *.o libAFLDriver*.a libAFLQemuDriver.a aflpp_qemu_driver_hook.so *~ core aflpp_driver_test