Commit 48df9f47 authored by swift_gan's avatar swift_gan Committed by swift_gan

fix build

parent efb8f4c6
......@@ -11,6 +11,7 @@ android {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
arguments '-DBUILD_TESTING=OFF','-DANDROID_TOOLCHAIN=gcc'
cppFlags "-frtti -fexceptions"
abiFilters 'arm64-v8a'
}
......
......@@ -32,13 +32,13 @@ Java_com_swift_sandhook_MainActivity_calArtSize(JNIEnv *env, jobject instance, j
return 0;
}
extern void hook_trampoline();
extern "C" void hook_trampoline();
extern "C"
JNIEXPORT void JNICALL
Java_com_swift_sandhook_MainActivity_initHook(JNIEnv *env, jobject instance) {
void(*fp)() = hook_trampoline;
hook_trampoline();
SandHook::cast_art_method::init(env);
......
#include "base.h"
.align 4
.global hook_trampoline
hook_trampoline:
FUNCTION_START(hook_trampoline)
ldr x0, addr_art_method
ldr x16, addr_entry_code
br x16
......@@ -12,3 +10,4 @@ addr_art_method:
addr_entry_code:
.long 0
.long 0
FUNCTION_END(hook_trampoline)
......@@ -5,15 +5,12 @@
#ifndef SANDHOOK_BASE_H
#define SANDHOOK_BASE_H
#if defined(__WIN32__) || defined(__APPLE__)
#define cdecl(s) s
#else
#define cdecl(s) s
#endif
#define FUNCTION_START(x) \
.text; \
.align 4; \
.global x; \
x: \
#define FUNCTION_START(x) .globl cdecl(x) \
cdecl(x):
#define FUNCTION_END(x) .x:
#define FUNCTION_END(x) .size x, .-x
#endif //SANDHOOK_BASE_H
......@@ -5,7 +5,6 @@
#ifndef SANDHOOK_TRAMPOLINE_H
#define SANDHOOK_TRAMPOLINE_H
extern void hook_trampoline();
#if defined(__i386__)
#define SIZE_TRAMPOLINE = 4 * 7
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment