I write a code like this:
void inline hook_cacheflush(unsigned int begin, unsigned int end)
{
const int syscall = 0xf0002;
__asm __volatile (
"mov r0, %0\n"
"mov r1, %1\n"
"mov r7, %2\n"
"mov r2, #0x0\n"
"svc 0x00000000\n"
:
: "r" (begin), "r" (end), "r" (syscall)
: "r0", "r1", "r7"
);
}
Android.mk
LOCAL_PATH := $(call my-dir)
ifneq ($(TARGET_ARCH_ABI),arm64-v8a)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../android \
$(LOCAL_PATH)/../inspector
LOCAL_MODULE := DexHunter
LOCAL_SHARED_LIBRARIES := Inspector
LOCAL_SRC_FILES := DexHunter.cpp
LOCAL_LDLIBS := -L$(LOCAL_PATH)/../so/$(TARGET_ARCH_ABI) -ldvm -llog
include $(BUILD_SHARED_LIBRARY)
endif
when i run gradlew.bat build ,get error:
Android NDK: WARNING:G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/Android.mk:DexHunter: non-system libr aries in linker flags: -ldvm Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the Android NDK: current module Android NDK: WARNING:G:/tuoke_software/Inspector-master/app/src/main/jni/trace_anti/Android.mk:TraceAnti: non-system lib raries in linker flags: -ldvm Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the Android NDK: current module Android NDK: WARNING:G:/tuoke_software/Inspector-master/app/src/main/jni/adbi/ddi/Android.mk:dalvikhook: LOCAL_LDLIBS is always ignored for static libraries Android NDK: WARNING:G:/tuoke_software/Inspector-master/app/src/main/jni/adbi/ddi/Android.mk:dalvikhook: non-system libr aries in linker flags: -ldvm Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the Android NDK: current module Android NDK: WARNING:G:/tuoke_software/Inspector-master/app/src/main/jni/dvmutil/Android.mk:dvmutil: non-system librarie s in linker flags: -ldvm Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the Android NDK: current module [armeabi] Compile thumb : base <= hook.c G:/tuoke_software/Inspector-master/app/src/main/jni/adbi/base/hook.c:205:6: warning: implicit declaration of function 'u nlockpt' is invalid in C99 [-Wimplicit-function-declaration] if (unlockpt(coms) < 0) { ^ G:/tuoke_software/Inspector-master/app/src/main/jni/adbi/base/hook.c:211:23: warning: implicit declaration of function ' ptsname' is invalid in C99 [-Wimplicit-function-declaration] strcpy(ptsn, (char)ptsname(*coms)); ^ 2 warnings generated. C:\Users\johnyang\AppData\Local\Temp\hook-abd8f4.s: Assembler messages: C:\Users\johnyang\AppData\Local\Temp\hook-abd8f4.s:80: Error: cannot honor width suffix -- `mov r2,#0x0' clang.exe: error: assembler command failed with exit code 1 (use -v to see invocation) make: *** [G:/tuoke_software/Inspector-master/app/build/intermediates/ndkBuild/debug/obj/local/armeabi/objs-debug/base/h ook.o] Error 1
- Try: Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
so i modify my Android.mk like this:
LOCAL_PATH := $(call my-dir)
ifneq ($(TARGET_ARCH_ABI),arm64-v8a)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../android \
$(LOCAL_PATH)/../inspector
LOCAL_MODULE := DexHunter
LOCAL_SHARED_LIBRARIES := Inspector
LOCAL_SRC_FILES := DexHunter.cpp
LOCAL_LDLIBS := -L$(LOCAL_PATH)/../so/$(TARGET_ARCH_ABI) -llog
include $(BUILD_SHARED_LIBRARY)
endif
when i rebuild,i get this error:
1 warning generated. G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/DexHunter.cpp:768: error: undefined reference to 'dexStringCacheInit(DexStringCache*)' G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/DexHunter.cpp:769: error: undefined reference to 'dexProtoGetMethodDescriptor(DexProto const*, DexStringCache*)' G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/DexHunter.cpp:405: error: undefined reference to 'dvmThreadSelf()' G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/DexHunter.cpp:405: error: undefined reference to 'dvmDecodeIndirectRef(Thread*, _jobject*)' G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/DexHunter.cpp:467: error: undefined reference to 'dvmDefineClass(DvmDex*, char const*, Object*)' G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/DexHunter.cpp:476: error: undefined reference to 'dvmInitClass' G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/../android/common.h:50: error: undefined reference to 'dvmGetRelativeTimeNsec()' clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [G:/tuoke_software/Inspector-master/app/build/intermediates/ndkBuild/debug/obj/local/x86/libDexHunter.so] Error 1
who help me repair the problem?
User contributions licensed under CC BY-SA 3.0