about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--llvm_mode/GNUmakefile3
-rw-r--r--llvm_mode/afl-clang-fast.c15
2 files changed, 11 insertions, 7 deletions
diff --git a/llvm_mode/GNUmakefile b/llvm_mode/GNUmakefile
index 2bbc92c8..57da03f8 100644
--- a/llvm_mode/GNUmakefile
+++ b/llvm_mode/GNUmakefile
@@ -273,7 +273,8 @@ endif
 ../afl-llvm-lto-instrumentation.so: afl-llvm-lto-instrumentation.so.cc
 ifeq "$(LLVM_LTO)" "1"
 	$(CXX) $(CLANG_CFL) -Wno-writable-strings -fno-rtti -fPIC -std=$(LLVM_STDCXX) -shared $< -o $@ $(CLANG_LFL)
-	$(CC) $(CFLAGS) -O0 $(AFL_CLANG_FLTO) -fPIC -c afl-llvm-rt-lto.o.c -o ../afl-llvm-rt-lto.o
+	$(CC) $(CFLAGS) -Wno-unused-result -O0 $(AFL_CLANG_FLTO) -fPIC -c afl-llvm-rt-lto.o.c -o ../afl-llvm-rt-lto.o
+	@$(CC) $(CFLAGS) -Wno-unused-result -O0 $(AFL_CLANG_FLTO) -m64 -fPIC -c afl-llvm-rt-lto.o.c -o ../afl-llvm-rt-lto-64.o 2>/dev/null; if [ "$$?" = "0" ]; then : ; fi
 endif
 
 # laf
diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c
index fa76a11e..2114ccf3 100644
--- a/llvm_mode/afl-clang-fast.c
+++ b/llvm_mode/afl-clang-fast.c
@@ -479,18 +479,19 @@ static void edit_params(u32 argc, char **argv, char **envp) {
 
   }
 
-  if (instrument_mode == INSTRUMENT_LTO)
-    cc_params[cc_par_cnt++] = alloc_printf("%s/afl-llvm-rt-lto.o", obj_path);
-
 #ifndef __ANDROID__
   switch (bit_mode) {
 
     case 0:
-      cc_params[cc_par_cnt++] = alloc_printf("%s/afl-llvm-rt.o", obj_path);
+      cc_params[cc_par_cnt++] =
+          alloc_printf("%s/afl-llvm-rt%s.o", obj_path,
+                       instrument_mode == INSTRUMENT_LTO ? "-lto" : "");
       break;
 
     case 32:
-      cc_params[cc_par_cnt++] = alloc_printf("%s/afl-llvm-rt-32.o", obj_path);
+      cc_params[cc_par_cnt++] =
+          alloc_printf("%s/afl-llvm-rt%s-32.o", obj_path,
+                       instrument_mode == INSTRUMENT_LTO ? "-lto" : "");
 
       if (access(cc_params[cc_par_cnt - 1], R_OK))
         FATAL("-m32 is not supported by your compiler");
@@ -498,7 +499,9 @@ static void edit_params(u32 argc, char **argv, char **envp) {
       break;
 
     case 64:
-      cc_params[cc_par_cnt++] = alloc_printf("%s/afl-llvm-rt-64.o", obj_path);
+      cc_params[cc_par_cnt++] =
+          alloc_printf("%s/afl-llvm-rt%s-64.o", obj_path,
+                       instrument_mode == INSTRUMENT_LTO ? "-lto" : "");
 
       if (access(cc_params[cc_par_cnt - 1], R_OK))
         FATAL("-m64 is not supported by your compiler");