about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhexcoder- <hexcoder-@github.com>2020-02-23 12:40:05 +0100
committerhexcoder- <hexcoder-@github.com>2020-02-23 12:40:05 +0100
commit32281ddcb0f1771b4f3ad6dc3599fa4c42555595 (patch)
tree59768b765c370aa9184b52efa6d7e109bb0399bb
parentd23d44a3d5c19d17707731557509181767cdb426 (diff)
downloadafl++-32281ddcb0f1771b4f3ad6dc3599fa4c42555595.tar.gz
fix -m32 on arm 32 bit (is -m32be). make 32 and 64 bit varaints optional
-rw-r--r--examples/argv_fuzzing/Makefile16
1 files changed, 13 insertions, 3 deletions
diff --git a/examples/argv_fuzzing/Makefile b/examples/argv_fuzzing/Makefile
index ab16be87..34192e39 100644
--- a/examples/argv_fuzzing/Makefile
+++ b/examples/argv_fuzzing/Makefile
@@ -24,18 +24,28 @@ ifneq "$(filter Linux GNU%,$(shell uname))" ""
   LDFLAGS  += -ldl
 endif
 
+# on gcc for arm there is no -m32, but -mbe32
+M32FLAG = -m32
+M64FLAG = -m64
+ifeq "$(findstring clang, $(shell $(CC) --version 2>/dev/null))" ""
+ ifneq (,$(findstring arm, "$(shell $(CC) -v 2>&1 >/dev/null)"))
+  M32FLAG = -mbe32
+ endif
+endif
+
+
 all: argvfuzz32.so argvfuzz64.so
 
 argvfuzz32.so: argvfuzz.c
-	-$(CC) -m32 $(CFLAGS) $^ $(LDFLAGS) -o $@ || echo "argvfuzz32 build failure (that's fine)"
+	-$(CC) $(M32FLAG) $(CFLAGS) $^ $(LDFLAGS) -o $@ || echo "argvfuzz32 build failure (that's fine)"
 
 argvfuzz64.so: argvfuzz.c
-	-$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
+	-$(CC) $(M64FLAG) $(CFLAGS) $^ $(LDFLAGS) -o $@ || echo "argvfuzz64 build failure (that's fine)"
 
 install: argvfuzz32.so argvfuzz64.so
 	install -d -m 755 $(DESTDIR)$(HELPER_PATH)/
 	if [ -f argvfuzz32.so ]; then set -e; install -m 755 argvfuzz32.so $(DESTDIR)$(HELPER_PATH)/; fi
-	install -m 755 argvfuzz64.so $(DESTDIR)$(HELPER_PATH)/
+	if [ -f argvfuzz64.so ]; then set -e; install -m 755 argvfuzz64.so $(DESTDIR)$(HELPER_PATH)/; fi
 
 clean:
 	rm -f argvfuzz32.so argvfuzz64.so