aboutsummaryrefslogtreecommitdiff
path: root/unicorn_mode/samples/persistent
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2022-01-26 11:00:55 +0100
committerGitHub <noreply@github.com>2022-01-26 11:00:55 +0100
commit143c9d175e9357ba548413ee7dcee6a8de23f733 (patch)
treea82736c060150480df81d19b50dfb7939cda7524 /unicorn_mode/samples/persistent
parenta790bf6cc2bb63f0659d8c96b46f5f4db2f9d4bc (diff)
parentb0758ac8db0a2ec833b5ef7a60ab2d04cc7f6a9a (diff)
downloadafl++-143c9d175e9357ba548413ee7dcee6a8de23f733.tar.gz
Merge pull request #1301 from AFLplusplus/dev4.00c
v4.00c release
Diffstat (limited to 'unicorn_mode/samples/persistent')
-rw-r--r--unicorn_mode/samples/persistent/Makefile38
-rw-r--r--unicorn_mode/samples/persistent/harness.c1
2 files changed, 21 insertions, 18 deletions
diff --git a/unicorn_mode/samples/persistent/Makefile b/unicorn_mode/samples/persistent/Makefile
index 80a47550..35584416 100644
--- a/unicorn_mode/samples/persistent/Makefile
+++ b/unicorn_mode/samples/persistent/Makefile
@@ -4,29 +4,28 @@
.POSIX:
UNAME_S =$(shell uname -s)# GNU make
UNAME_S:sh=uname -s # BSD make
-_UNIQ=_QINU_
-LIBDIR = ../../unicornafl
+UNICORNAFL_LIB = ../../unicornafl/build
+UNICORN_LIB = ../../unicornafl/unicorn/build
BIN_EXT =
AR_EXT = a
# Verbose output?
V ?= 0
-CFLAGS += -Wall -Werror -I../../unicornafl/include
+CFLAGS += -Wall -Werror -I../../unicornafl/unicorn/include -I../../unicornafl/include
-LDFLAGS += -L$(LIBDIR) -lpthread -lm
+LDFLAGS += -L$(UNICORNAFL_LIB) -L$(UNICORN_LIB) -lpthread -lm -lunicornafl -lunicorn -lc++
-_LRT = $(_UNIQ)$(UNAME_S)
-__LRT = $(_LRT:$(_UNIQ)Linux=-lrt)
-LRT = $(__LRT:$(_UNIQ)$(UNAME_S)=)
+ifeq ($(UNAME), Linux)
+# do something Linux-y
+LRT = -lrt
+else
+LRT =
+endif
LDFLAGS += $(LRT)
-_CC = $(_UNIQ)$(CROSS)
-__CC = $(_CC:$(_UNIQ)=$(CC))
-MYCC = $(__CC:$(_UNIQ)$(CROSS)=$(CROSS)gcc)
-
.PHONY: all clean
all: harness
@@ -34,20 +33,23 @@ all: harness
clean:
rm -rf *.o harness harness-debug
-harness.o: harness.c ../../unicornafl/include/unicorn/*.h
- ${MYCC} ${CFLAGS} -O3 -c harness.c
+harness.o: harness.c ../../unicornafl/unicorn/include/unicorn/*.h
+ ${CC} ${CFLAGS} -O3 -c harness.c
-harness-debug.o: harness.c ../../unicornafl/include/unicorn/*.h
- ${MYCC} ${CFLAGS} -DAFL_DEBUG=1 -g -c harness.c -o $@
+harness-debug.o: harness.c ../../unicornafl/unicorn/include/unicorn/*.h
+ ${CC} ${CFLAGS} -DAFL_DEBUG=1 -g -c harness.c -o $@
harness: harness.o
- ${MYCC} -L${LIBDIR} harness.o ../../unicornafl/libunicornafl.a $(LDFLAGS) -o $@
+ ${CC} harness.o ../../unicornafl/build/libunicornafl.a $(LDFLAGS) -o $@
debug: harness-debug.o
- ${MYCC} -L${LIBDIR} harness-debug.o ../../unicornafl/libunicornafl.a $(LDFLAGS) -o harness-debug
+ ${CC} harness-debug.o ../../unicornafl/build/libunicornafl.a $(LDFLAGS) -o harness-debug
+
+../../unicornafl/build/libunicornafl.a:
+ cd ../.. && ./build_unicorn_support.sh
fuzz: harness
- ../../../afl-fuzz -m none -i sample_inputs -o out -- ./harness @@
+ DYLD_FALLBACK_LIBRARY_PATH="../../unicornafl/unicorn/build" LD_LIBRARY_PATH="../../unicornafl/unicorn/build" ../../../afl-fuzz -m none -i sample_inputs -o out -- ./harness @@
debugmake:
@echo UNAME_S=$(UNAME_S), _LRT=$(_LRT), __LRT=$(__LRT), LRT=$(LRT)
diff --git a/unicorn_mode/samples/persistent/harness.c b/unicorn_mode/samples/persistent/harness.c
index eae3f1fc..37b652e0 100644
--- a/unicorn_mode/samples/persistent/harness.c
+++ b/unicorn_mode/samples/persistent/harness.c
@@ -30,6 +30,7 @@
#include <sys/mman.h>
#include <unicorn/unicorn.h>
+#include <unicornafl/unicornafl.h>
// Path to the file containing the binary to emulate
#define BINARY_FILE ("persistent_target_x86_64")