Fixes to make things easier to build for ARM
MODIFY
frida_mode/GNUmakefile
frida_mode/GNUmakefile
@@ -191,6 +191,9 @@ all: $(FRIDA_TRACE) $(FRIDA_TRACE_LIB) $(AFLPP_FRIDA_DRIVER_HOOK_OBJ) $(AFLPP_QE
32:
CFLAGS="-m32" LDFLAGS="-m32" ARCH="x86" make all
+arm:
+ CFLAGS="-marm" LDFLAGS="-marm" ARCH="armhf" TARGET_CC=arm-linux-gnueabihf-gcc TARGET_CXX=arm-linux-gnueabihf-g++ make all
+
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)

MODIFY
frida_mode/src/instrument/instrument_arm32.c
frida_mode/src/instrument/instrument_arm32.c
@@ -273,7 +273,15 @@ void instrument_flush(GumStalkerOutput *output) {
gpointer instrument_cur(GumStalkerOutput *output) {
- return gum_arm_writer_cur(output->writer.arm);
+ gpointer curr = NULL;
+
+ if (output->encoding == GUM_INSTRUCTION_SPECIAL) {
+ curr = gum_thumb_writer_cur(output->writer.thumb);
+ } else {
+ curr = gum_arm_writer_cur(output->writer.arm);
+ }
+
+ return curr;
}

MODIFY
frida_mode/test/png/GNUmakefile
frida_mode/test/png/GNUmakefile
@@ -7,10 +7,10 @@ LIBPNG_BUILD_DIR:=$(BUILD_DIR)libpng/
HARNESS_BUILD_DIR:=$(BUILD_DIR)harness/
PNGTEST_BUILD_DIR:=$(BUILD_DIR)pngtest/
-LIBZ_FILE:=$(LIBZ_BUILD_DIR)zlib-1.2.12.tar.gz
-LIBZ_URL:=http://www.zlib.net/zlib-1.2.12.tar.gz
-LIBZ_DIR:=$(LIBZ_BUILD_DIR)zlib-1.2.12/
-LIBZ_PC:=$(ZLIB_DIR)zlib.pc
+LIBZ_FILE:=$(LIBZ_BUILD_DIR)zlib-1.2.13.tar.gz
+LIBZ_URL:=http://www.zlib.net/zlib-1.2.13.tar.gz
+LIBZ_DIR:=$(LIBZ_BUILD_DIR)zlib-1.2.13/
+LIBZ_PC:=$(LIBZ_DIR)zlib.pc
LIBZ_LIB:=$(LIBZ_DIR)libz.a
LIBPNG_FILE:=$(LIBPNG_BUILD_DIR)libpng-1.2.56.tar.gz
@@ -48,7 +48,7 @@ all: $(TEST_BIN)
CFLAGS="-m32" LDFLAGS="-m32" make $(TEST_BIN)
arm:
- ARCH="arm" CC="arm-linux-gnueabihf-gcc" CXX="arm-linux-gnueabihf-g++" make $(TEST_BIN)
+ CFLAGS="-marm" LDFLAGS="-marm" CC="arm-linux-gnueabihf-gcc" CXX="arm-linux-gnueabihf-g++" make $(TEST_BIN)
$(BUILD_DIR):
mkdir -p $@
@@ -96,7 +96,7 @@ $(LIBZ_PC): | $(LIBZ_DIR)
--static \
--archs="$(ARCH)"
-$(LIBZ_LIB): $(LIBZ_PC)
+$(LIBZ_LIB): | $(LIBZ_PC)
CFLAGS="$(CFLAGS) -fPIC" \
make \
-C $(LIBZ_DIR) \
@@ -133,7 +133,7 @@ png: $(LIBPNG_LIB)
######### TEST ########
-$(TEST_BIN): $(HARNESS_OBJ) $(PNGTEST_OBJ) $(LIBPNG_LIB)
+$(TEST_BIN): $(HARNESS_OBJ) $(PNGTEST_OBJ) $(LIBPNG_LIB) $(LIBZ_LIB)
$(CXX) \
$(CFLAGS) \
$(LDFLAGS) \

MODIFY
frida_mode/test/testinstr/GNUmakefile
frida_mode/test/testinstr/GNUmakefile
@@ -18,6 +18,9 @@ all: $(TESTINSTBIN)
32:
CFLAGS="-m32" LDFLAGS="-m32" ARCH="x86" make all
+arm:
+ CFLAGS="-marm" LDFLAGS="-marm" CC="arm-linux-gnueabihf-gcc" CXX="arm-linux-gnueabihf-g++" make $(TESTINSTBIN)
+
$(BUILD_DIR):
mkdir -p $@

Fixes to make things easier to build for ARM