about summary refs log tree commit diff
path: root/llvm_mode
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2020-01-06 11:46:23 +0100
committerAndrea Fioraldi <andreafioraldi@gmail.com>2020-01-06 11:46:23 +0100
commitb95cd8968d765bf71fffb13e3cdc8d13e24949d1 (patch)
treecfcd46a3395dd091b8aa48ec665e0df57ccf8b62 /llvm_mode
parent67cbeeb395c7e0aa8820e79c92f5e8e1322f8be0 (diff)
parente7fc1ef49e8c9d8fa563f321f5e5906ce8fad69d (diff)
downloadafl++-b95cd8968d765bf71fffb13e3cdc8d13e24949d1.tar.gz
Merge branch 'master' of github.com:vanhauser-thc/AFLplusplus
Diffstat (limited to 'llvm_mode')
-rw-r--r--llvm_mode/Makefile4
-rw-r--r--llvm_mode/afl-clang-fast.c18
2 files changed, 18 insertions, 4 deletions
diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile
index ce0faf9b..0e290ffc 100644
--- a/llvm_mode/Makefile
+++ b/llvm_mode/Makefile
@@ -115,7 +115,7 @@ endif
 CLANGVER = $(shell $(CC) --version | sed -E -ne '/^.*version\ ([0-9]\.[0-9]\.[0-9]).*/s//\1/p')
 
 
-ifeq "$(shell echo '\#include <sys/ipc.h>@\#include <sys/shm.h>@int main() { int _id = shmget(IPC_PRIVATE, 65536, IPC_CREAT | IPC_EXCL | 0600); shmctl(_id, IPC_RMID, 0); return 0;}' | tr @ '\n' | $(CC) -x c - -o .test2 2>/dev/null && echo 1 || echo 0 )" "1"
+ifeq "$(shell echo '\#include <sys/ipc.h>@\#include <sys/shm.h>@int main() { int _id = shmget(IPC_PRIVATE, 65536, IPC_CREAT | IPC_EXCL | 0600); shmctl(_id, IPC_RMID, 0); return 0;}' | tr @ '\n' | $(CC) -x c - -o .test2 2>/dev/null && echo 1 || echo 0 ; rm -f .test2 )" "1"
         SHMAT_OK=1
 else
         SHMAT_OK=0
@@ -261,5 +261,5 @@ vpath  % ..
 	ln -sf afl-clang-fast.8 ../afl-clang-fast++.8
 
 clean:
-	rm -f *.o *.so *~ a.out core core.[1-9][0-9]* .test2 test-instr .test-instr0 .test-instr1 
+	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
diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c
index ef98bf25..724ae1a9 100644
--- a/llvm_mode/afl-clang-fast.c
+++ b/llvm_mode/afl-clang-fast.c
@@ -50,7 +50,11 @@ static void find_obj(u8* argv0) {
 
   if (afl_path) {
 
+#ifdef __ANDROID__
+    tmp = alloc_printf("%s/afl-llvm-rt.so", afl_path);
+#else
     tmp = alloc_printf("%s/afl-llvm-rt.o", afl_path);
+#endif
 
     if (!access(tmp, R_OK)) {
 
@@ -74,7 +78,11 @@ static void find_obj(u8* argv0) {
     dir = ck_strdup(argv0);
     *slash = '/';
 
+#ifdef __ANDROID__
+    tmp = alloc_printf("%s/afl-llvm-rt.so", afl_path);
+#else
     tmp = alloc_printf("%s/afl-llvm-rt.o", dir);
+#endif
 
     if (!access(tmp, R_OK)) {
 
@@ -89,8 +97,14 @@ static void find_obj(u8* argv0) {
 
   }
 
+#ifdef __ANDROID__
+  if (!access(AFL_PATH "/afl-llvm-rt.so", R_OK)) {
+
+#else
   if (!access(AFL_PATH "/afl-llvm-rt.o", R_OK)) {
 
+#endif
+
     obj_path = AFL_PATH;
     return;
 
@@ -359,7 +373,7 @@ static void edit_params(u32 argc, char** argv) {
 
     }
 
-    //#ifndef __ANDROID__ // not sure, we might need these ifdefs for Android
+#ifndef __ANDROID__
     switch (bit_mode) {
 
       case 0:
@@ -384,7 +398,7 @@ static void edit_params(u32 argc, char** argv) {
 
     }
 
-    //#endif
+#endif
 
   }