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

fix build

parent efb8f4c6
...@@ -11,6 +11,7 @@ android { ...@@ -11,6 +11,7 @@ android {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild { externalNativeBuild {
cmake { cmake {
arguments '-DBUILD_TESTING=OFF','-DANDROID_TOOLCHAIN=gcc'
cppFlags "-frtti -fexceptions" cppFlags "-frtti -fexceptions"
abiFilters 'arm64-v8a' abiFilters 'arm64-v8a'
} }
......
...@@ -32,13 +32,13 @@ Java_com_swift_sandhook_MainActivity_calArtSize(JNIEnv *env, jobject instance, j ...@@ -32,13 +32,13 @@ Java_com_swift_sandhook_MainActivity_calArtSize(JNIEnv *env, jobject instance, j
return 0; return 0;
} }
extern void hook_trampoline(); extern "C" void hook_trampoline();
extern "C" extern "C"
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_com_swift_sandhook_MainActivity_initHook(JNIEnv *env, jobject instance) { Java_com_swift_sandhook_MainActivity_initHook(JNIEnv *env, jobject instance) {
void(*fp)() = hook_trampoline; hook_trampoline();
SandHook::cast_art_method::init(env); SandHook::cast_art_method::init(env);
......
#include "base.h" #include "base.h"
.align 4 FUNCTION_START(hook_trampoline)
.global hook_trampoline
hook_trampoline:
ldr x0, addr_art_method ldr x0, addr_art_method
ldr x16, addr_entry_code ldr x16, addr_entry_code
br x16 br x16
...@@ -11,4 +9,5 @@ addr_art_method: ...@@ -11,4 +9,5 @@ addr_art_method:
.long 0 .long 0
addr_entry_code: addr_entry_code:
.long 0 .long 0
.long 0 .long 0
\ No newline at end of file FUNCTION_END(hook_trampoline)
...@@ -5,15 +5,12 @@ ...@@ -5,15 +5,12 @@
#ifndef SANDHOOK_BASE_H #ifndef SANDHOOK_BASE_H
#define SANDHOOK_BASE_H #define SANDHOOK_BASE_H
#if defined(__WIN32__) || defined(__APPLE__) #define FUNCTION_START(x) \
#define cdecl(s) s .text; \
#else .align 4; \
#define cdecl(s) s .global x; \
#endif x: \
#define FUNCTION_START(x) .globl cdecl(x) \ #define FUNCTION_END(x) .size x, .-x
cdecl(x):
#define FUNCTION_END(x) .x:
#endif //SANDHOOK_BASE_H #endif //SANDHOOK_BASE_H
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#ifndef SANDHOOK_TRAMPOLINE_H #ifndef SANDHOOK_TRAMPOLINE_H
#define SANDHOOK_TRAMPOLINE_H #define SANDHOOK_TRAMPOLINE_H
extern void hook_trampoline();
#if defined(__i386__) #if defined(__i386__)
#define SIZE_TRAMPOLINE = 4 * 7 #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