1 |
commit: 6c36e7b2994f088b837e6c6bbafba573ecd9ff50 |
2 |
Author: Alexander Miller <alex.miller <AT> gmx <DOT> de> |
3 |
AuthorDate: Mon Jul 4 16:56:28 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jul 4 23:24:01 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6c36e7b2 |
7 |
|
8 |
app-forensics/aflplusplus: Disable LTO for runtime |
9 |
|
10 |
Runtime files get installed as object files or static archives and |
11 |
shouldn't contain IR. Otherwise, gcc/clang mismatches can cause failures. |
12 |
|
13 |
Signed-off-by: Alexander Miller <alex.miller <AT> gmx.de> |
14 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
15 |
|
16 |
.../files/aflplusplus-4.01c-respect-flags.patch | 15 ++++++++------- |
17 |
1 file changed, 8 insertions(+), 7 deletions(-) |
18 |
|
19 |
diff --git a/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch b/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch |
20 |
index e4d56c25095e..ebe638f1a86c 100644 |
21 |
--- a/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch |
22 |
+++ b/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch |
23 |
@@ -1,6 +1,7 @@ |
24 |
* Respect CFLAGS 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 |
|
29 |
--- a/GNUmakefile |
30 |
+++ b/GNUmakefile |
31 |
@@ -29,17 +30,17 @@ |
32 |
|
33 |
./afl-compiler-rt.o: instrumentation/afl-compiler-rt.o.c |
34 |
- $(CC) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -fPIC -c $< -o $@ |
35 |
-+ $(CC) $(CFLAGS) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -fPIC -c $< -o $@ |
36 |
++ $(CC) $(CFLAGS) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -fPIC -fno-lto -c $< -o $@ |
37 |
|
38 |
./afl-compiler-rt-32.o: instrumentation/afl-compiler-rt.o.c |
39 |
@printf "[*] Building 32-bit variant of the runtime (-m32)... " |
40 |
- @$(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 |
41 |
-+ @$(CC) $(CFLAGS) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m32 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi |
42 |
++ @$(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 |
43 |
|
44 |
./afl-compiler-rt-64.o: instrumentation/afl-compiler-rt.o.c |
45 |
@printf "[*] Building 64-bit variant of the runtime (-m64)... " |
46 |
- @$(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 |
47 |
-+ @$(CC) $(CFLAGS) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m64 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi |
48 |
++ @$(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 |
49 |
|
50 |
./afl-gcc-pass.so: instrumentation/afl-gcc-pass.so.cc | test_deps |
51 |
- $(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@ |
52 |
@@ -62,17 +63,17 @@ |
53 |
|
54 |
./afl-compiler-rt.o: instrumentation/afl-compiler-rt.o.c |
55 |
- $(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -fPIC -c $< -o $@ |
56 |
-+ $(CC) $(CFLAGS) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -fPIC -c $< -o $@ |
57 |
++ $(CC) $(CFLAGS) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -fPIC -fno-lto -c $< -o $@ |
58 |
|
59 |
./afl-compiler-rt-32.o: instrumentation/afl-compiler-rt.o.c |
60 |
@printf "[*] Building 32-bit variant of the runtime (-m32)... " |
61 |
- @$(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 |
62 |
-+ @$(CC) $(CFLAGS) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m32 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi |
63 |
++ @$(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 |
64 |
|
65 |
./afl-compiler-rt-64.o: instrumentation/afl-compiler-rt.o.c |
66 |
@printf "[*] Building 64-bit variant of the runtime (-m64)... " |
67 |
- @$(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 |
68 |
-+ @$(CC) $(CFLAGS) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m64 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi |
69 |
++ @$(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 |
70 |
|
71 |
.PHONY: test_build |
72 |
test_build: $(PROGS) |
73 |
@@ -136,7 +137,7 @@ |
74 |
|
75 |
-CFLAGS := -O3 -funroll-loops -g -fPIC |
76 |
+CFLAGS ?= -O3 -funroll-loops -g |
77 |
-+CFLAGS += -fPIC |
78 |
++CFLAGS += -fPIC -fno-lto |
79 |
|
80 |
all: libAFLDriver.a libAFLQemuDriver.a aflpp_qemu_driver_hook.so |