commit: 6c36e7b2994f088b837e6c6bbafba573ecd9ff50
Author: Alexander Miller <alex.miller <AT> gmx <DOT> de>
AuthorDate: Mon Jul 4 16:56:28 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul 4 23:24:01 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6c36e7b2
app-forensics/aflplusplus: Disable LTO for runtime
Runtime files get installed as object files or static archives and
shouldn't contain IR. Otherwise, gcc/clang mismatches can cause failures.
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 | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 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 e4d56c25095e..ebe638f1a86c 100644
--- a/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch
+++ b/app-forensics/aflplusplus/files/aflplusplus-4.01c-respect-flags.patch
@@ -1,6 +1,7 @@
* Respect CFLAGS 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
@@ -29,17 +30,17 @@
./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 -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 -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 -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
./afl-gcc-pass.so: instrumentation/afl-gcc-pass.so.cc | test_deps
- $(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@
@@ -62,17 +63,17 @@
./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 -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 -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 -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)
@@ -136,7 +137,7 @@
-CFLAGS := -O3 -funroll-loops -g -fPIC
+CFLAGS ?= -O3 -funroll-loops -g
-+CFLAGS += -fPIC
++CFLAGS += -fPIC -fno-lto
all: libAFLDriver.a libAFLQemuDriver.a aflpp_qemu_driver_hook.so