错误:无法使用宽度后缀-`mov r2,#0x0'

时间:2018-07-19 08:34:14

标签: android-ndk gradlew

我写这样的代码:

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

当我运行gradlew.bat build时,出现错误:

  

Android NDK:   警告:G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/Android.mk:DexHunter:   链接器标志中的非系统库:-ldvm Android NDK:这是   可能会导致构建错误。尝试使用LOCAL_STATIC_LIBRARIES   Android NDK:或LOCAL_SHARED_LIBRARIES代替列出库   Android NDK的依赖项:当前模块Android NDK:   警告:G:/tuoke_software/Inspector-master/app/src/main/jni/trace_anti/Android.mk:TraceAnti:   链接器标志中的非系统库文件:-ldvm Android NDK:这是   可能会导致构建错误。尝试使用LOCAL_STATIC_LIBRARIES   Android NDK:或LOCAL_SHARED_LIBRARIES代替列出库   Android NDK的依赖项:当前模块Android NDK:   警告:G:/tuoke_software/Inspector-master/app/src/main/jni/adbi/ddi/Android.mk:dalvikhook:   对于静态库Android NDK,始终会忽略LOCAL_LDLIBS:   警告:G:/tuoke_software/Inspector-master/app/src/main/jni/adbi/ddi/Android.mk:dalvikhook:   链接器标志中的非系统库:-ldvm Android NDK:这是   可能会导致构建错误。尝试使用LOCAL_STATIC_LIBRARIES   Android NDK:或LOCAL_SHARED_LIBRARIES代替列出库   Android NDK的依赖项:当前模块Android NDK:   警告:G:/tuoke_software/Inspector-master/app/src/main/jni/dvmutil/Android.mk:dvmutil:   链接程序标志中的非系统librarie:-ldvm Android NDK:这是   可能会导致构建错误。尝试使用LOCAL_STATIC_LIBRARIES   Android NDK:或LOCAL_SHARED_LIBRARIES代替列出库   NDK的依赖关系:当前模块[armeabi]编译   拇指:基本<= hook.c   G:/tuoke_software/Inspector-master/app/src/main/jni/adbi/base/hook.c:205:6:   警告:函数“ u nlockpt”的隐式声明在以下位置无效   C99 [-Wimplicit函数声明]           如果(unlockpt( coms)<0){               ^ G:/tuoke_software/Inspector-master/app/src/main/jni/adbi/base/hook.c:211:23:   警告:函数'ptsname'的隐式声明在C99中无效   [-Wimplicit函数声明]                   strcpy(ptsn,(char )ptsname(* coms));                                       ^产生2条警告。 C:\ Users \ johnyang \ AppData \ Local \ Temp \ hook-abd8f4.s:汇编器   消息:C:\ Users \ johnyang \ AppData \ Local \ Temp \ hook-abd8f4.s:80:   错误:无法遵守宽度后缀-`mov r2,#0x0'clang.exe:错误:   汇编器命令失败,退出代码为1(使用-v查看调用)   制作:***   [G:/ tuoke_software / Inspector-master / app / build / intermediates / ndkBuild / debug / obj / local / armeabi / objs-debug / base / h   ook.o]错误1

     
      
  • 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--debug选项运行,以获取更多日志输出。
  •   
     

建立失败

所以我这样修改我的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) -llog
    include $(BUILD_SHARED_LIBRARY)
endif

当我重建时,出现此错误:

  

1条警告。   G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/DexHunter.cpp:768:   错误:对dexStringCacheInit(DexStringCache *)的未定义引用   G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/DexHunter.cpp:769:   错误:未定义对'dexProtoGetMethodDescriptor(DexProto   const *,DexStringCache *)'   G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/DexHunter.cpp:405:   错误:未定义对“ dvmThreadSelf()”的引用   G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/DexHunter.cpp:405:   错误:对'dvmDecodeIndirectRef(Thread *,   _jobject *)'G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/DexHunter.cpp:467:   错误:未定义对'dvmDefineClass(DvmDex *,char const *,   宾语*)'   G:/tuoke_software/Inspector-master/app/src/main/jni/DexHunter/DexHunter.cpp:476:   错误:未定义对“ dvmInitClass”的引用   G:/ tuoke_software / Inspector-master / app / src / main / jni / DexHunter /../ android / common.h:50:   错误:对'dvmGetRelativeTimeNsec()'的未定义引用clang ++。exe:   错误:链接器命令失败,退出代码为1(使用-v查看   调用):***   [G:/tuoke_software/Inspector-master/app/build/intermediates/ndkBuild/debug/obj/local/x86/libDexHunter.so]   错误1

谁来帮助我解决问题?

0 个答案:

没有答案