Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

几个编译错误 #1

Closed
Fors3cDream opened this issue Apr 19, 2018 · 2 comments
Closed

几个编译错误 #1

Fors3cDream opened this issue Apr 19, 2018 · 2 comments

Comments

@Fors3cDream
Copy link

  1. xh_core.c中未引入stdio.h导致编译时产生如下错误:
    jni/xh_core.c:140:5: error: use of undeclared identifier 'FILE'
    FILE *fp;

  2. xh_elf.h中一些宏重复定义或者没有定义:

jni/xh_elf.c:61:9: error: 'ELF_R_SYM' macro redefined [-Werror,-Wmacro-redefined]
#define ELF_R_SYM(info) ELF32_R_SYM(info)
^
/Users/killer/AndTool/ndk/platforms/android-14/arch-arm/usr/include/sys/exec_elf.h:559:9: note: previous definition is here
#define ELF_R_SYM ELF32_R_SYM
^
jni/xh_elf.c:62:9: error: 'ELF_R_TYPE' macro redefined [-Werror,-Wmacro-redefined]
#define ELF_R_TYPE(info) ELF32_R_TYPE(info)
^
/Users/killer/AndTool/ndk/platforms/android-14/arch-arm/usr/include/sys/exec_elf.h:560:9: note: previous definition is here
#define ELF_R_TYPE ELF32_R_TYPE
^
jni/xh_elf.c:906:14: error: use of undeclared identifier 'DT_ANDROID_REL'
case DT_ANDROID_REL:
^
jni/xh_elf.c:907:14: error: use of undeclared identifier 'DT_ANDROID_RELA'
case DT_ANDROID_RELA:
^
jni/xh_elf.c:913:14: error: use of undeclared identifier 'DT_ANDROID_RELSZ'
case DT_ANDROID_RELSZ:
^
jni/xh_elf.c:914:14: error: use of undeclared identifier 'DT_ANDROID_RELASZ'
case DT_ANDROID_RELASZ:
^
jni/xh_elf.c:927:14: error: use of undeclared identifier 'DT_GNU_HASH'
case DT_GNU_HASH:
^
jni/xh_elf.c:1026:28: error: use of undeclared identifier 'R_ARM_JUMP_SLOT'
if(is_plt && r_type != R_GENERIC_JUMP_SLOT) return 0;
^
jni/xh_elf.c:48:29: note: expanded from macro 'R_GENERIC_JUMP_SLOT'
#define R_GENERIC_JUMP_SLOT R_ARM_JUMP_SLOT //.rel.plt
^
jni/xh_elf.c:1027:30: error: use of undeclared identifier 'R_ARM_GLOB_DAT'
if(!is_plt && (r_type != R_GENERIC_GLOB_DAT && r_type != R_GENERIC_ABS)) return 0;
^
jni/xh_elf.c:49:29: note: expanded from macro 'R_GENERIC_GLOB_DAT'
#define R_GENERIC_GLOB_DAT R_ARM_GLOB_DAT //.rel.dyn
^
jni/xh_elf.c:1027:62: error: use of undeclared identifier 'R_ARM_ABS32'
if(!is_plt && (r_type != R_GENERIC_GLOB_DAT && r_type != R_GENERIC_ABS)) return 0;
^
jni/xh_elf.c:50:29: note: expanded from macro 'R_GENERIC_ABS'
#define R_GENERIC_ABS R_ARM_ABS32 //.rel.dyn
^
10 errors generated.

@caikelun
Copy link
Collaborator

谢谢反馈!

应该是NDK版本差异导致的编译问题。我们目前使用的NDK版本是r16b,我已经修改了readme加入了对NDK版本的说明。

  1. 根据规范,fopen和FILE确实应该include stdio.h。已修复。

  2. ELF宏重复定义。xhook中自己定义的一些ELF宏,确实和旧版本NDK中定义的ELF宏有冲突。已修复。

  3. ELF宏未定义。这个问题还是请你升级到最新版的NDK解决吧,android ELF格式的扩展还是比较频繁的,旧版本NDK中的宏定义肯定会有缺少。我这边目前不太可能去维护和测试旧版本NDK的兼容性。抱歉。

@Fors3cDream
Copy link
Author

ok!用最新的版本测试成功。多谢楼主提供好用的hook。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants