about summary refs log tree commit diff
path: root/llvm_mode
diff options
context:
space:
mode:
Diffstat (limited to 'llvm_mode')
-rw-r--r--llvm_mode/Makefile9
-rw-r--r--llvm_mode/afl-clang-fast.c6
2 files changed, 11 insertions, 4 deletions
diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile
index 6fa04e2c..cdd89f27 100644
--- a/llvm_mode/Makefile
+++ b/llvm_mode/Makefile
@@ -197,8 +197,11 @@ endif
 	@test -f ../afl-showmap || ( echo "[-] Oops, can't find '../afl-showmap'. Be sure to compile AFL first."; exit 1 )
 	@echo "[+] All set and ready to build."
 
-../afl-clang-fast: afl-clang-fast.c | test_deps
-	$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
+afl-common.o: ../src/afl-common.c
+	$(CC) $(CFLAGS) -c $< -o $@ $(LDFLAGS)
+
+../afl-clang-fast: afl-clang-fast.c afl-common.o | test_deps
+	$(CC) $(CFLAGS) $< afl-common.o -o $@ $(LDFLAGS)
 	ln -sf afl-clang-fast ../afl-clang-fast++
 
 ../libLLVMInsTrim.so: LLVMInsTrim.so.cc MarkNodes.cc | test_deps
@@ -275,4 +278,4 @@ vpath  % ..
 
 clean:
 	rm -f *.o *.so *~ a.out core core.[1-9][0-9]* .test2 test-instr .test-instr0 .test-instr1 afl-llvm-pass.dwo
-	rm -f $(PROGS) ../afl-clang-fast++ ../afl-clang-fast*.8
+	rm -f $(PROGS) afl-common.o ../afl-clang-fast++ ../afl-clang-fast*.8
diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c
index a9a86957..a760959f 100644
--- a/llvm_mode/afl-clang-fast.c
+++ b/llvm_mode/afl-clang-fast.c
@@ -24,6 +24,7 @@
 
 #define AFL_MAIN
 
+#include "common.h"
 #include "config.h"
 #include "types.h"
 #include "debug.h"
@@ -41,6 +42,7 @@ static u8** cc_params;                 /* Parameters passed to the real CC  */
 static u32  cc_par_cnt = 1;            /* Param count, including argv0      */
 static u8   llvm_fullpath[PATH_MAX];
 static u8   cmplog_mode;
+u8          use_stdin = 0;                                         /* dummy */
 
 /* Try to find the runtime libraries. If that fails, abort. */
 
@@ -454,7 +456,7 @@ static void edit_params(u32 argc, char** argv) {
 
 /* Main entry point */
 
-int main(int argc, char** argv) {
+int main(int argc, char** argv, char** envp) {
 
   if (argc < 2 || strcmp(argv[1], "-h") == 0) {
 
@@ -509,6 +511,8 @@ int main(int argc, char** argv) {
 
   }
 
+  check_environment_vars(envp);
+
   cmplog_mode = getenv("AFL_CMPLOG") || getenv("AFL_LLVM_CMPLOG");
   if (cmplog_mode) printf("CmpLog mode by <andreafioraldi@gmail.com>\n");