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

交叉编译arm32无法正确运行程序 #28

Open
RelaxOne opened this issue Nov 4, 2022 · 1 comment
Open

交叉编译arm32无法正确运行程序 #28

RelaxOne opened this issue Nov 4, 2022 · 1 comment
Labels

Comments

@RelaxOne
Copy link

RelaxOne commented Nov 4, 2022

前两天在使用 stub 进行插桩时,遇到了在 arm32 上执行段错误的问题,通过对源代码的反汇编分析发现,使用 arm-linux-g++ 编译器编译出来的地址和程序中获取函数的地址有差距,后来发现需要在编译的时候添加 -marm 参数。这样就能得到正确的地址了。
11f6541a1ddc6849375b98c057e77f2

@coolxv coolxv added the example label Nov 4, 2022
@iDings
Copy link
Contributor

iDings commented Dec 13, 2023

对thumb模式跟arm模式混合使用的话,现在的打桩需要做下处理,
我现在正在使用rt-thread,它的qemu-vexpress-a9是使用的thumb模式的libc,然后用cpp-stub打桩的话之后会挂掉。

 arm-none-eabi-gcc -march=armv7-a -marm -msoft-float --print-file-name=libc.a
gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib/thumb/v7/nofp/libc.a

初步想法是, 对于thumb模式的话,获取的符号地址的最地位是1,增对这个需要做下特殊处理,但是我现在还没有成功构建thumb到arm的跳转指令

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

No branches or pull requests

3 participants