如何重命名arm elf .so文件中的动态符号? [英] How to rename dynamic symbols in arm elf .so file?

查看:211
本文介绍了如何重命名arm elf .so文件中的动态符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Android APK中修改一个.任务是在so旁边重命名动态符号(这是函数名).

I need to modify a so inside an Android APK. The task is to rename the dynamic symbols in side the so (which is the function name).

例如,从Java_com_example_abc _....更改为Java_com_yahoo_zzz _....

For example, change from Java_com_example_abc_.... to Java_com_yahoo_zzz_....

我尝试使用WinHex直接搜索并替换文本单词,导致apk启动错误.似乎也需要更新.hash节,但我不知道如何更新.hash节.

I try to use WinHex directly search and replace text words, the apk startup error. Seems like the .hash section also needs to be updated, but i do not know how to update the .hash section.

我的问题是重命名动态符号的正确或首选方法是什么?

My question is what is the correct or preferable way to rename the dynamic Symbol?

我被困了三天,请帮助我,非常感谢!

I heave been stuck for 3 days, please help me, thank you very much!

找到一个可能与之相关的帖子,但他没有给出替代解决方案. https://sourceware.org/ml/binutils/2006-03/msg00266.html

Found a post might related, but he didn't gave the alternative solution. https://sourceware.org/ml/binutils/2006-03/msg00266.html

推荐答案

我被困了3天,请帮助我,

I heave been stuck for 3 days, please help me,

您要实现的目标有效是不可能的.

What you are trying to achieve is effectively impossible.

ELF文件的内部结构复杂,要执行操作需要将其分解并重新组装零件.打个比方,就是将Intel CPU分解成晶体管,然后用它们重新组装AMD CPU.

ELF files have complicated internal structure, and what you want to do requires that you break it up and re-assemble the parts. An analogy would be to break an Intel CPU into transistors and re-assemble an AMD CPU from them.

找到可能与之相关的帖子

Found a post might related

相关.引用:

基本上,它会执行以下操作:

Basically it does the following:

  1. 在.dynsym上循环并重新创建.dynstr
  2. 从头开始重新创建.hash表
  3. 计算新的lma/vma,新的内存布局(.dynstr大小已更改!)
  4. 根据新布局固定.dynamic的内容
  5. 修复.rel.dyn
  6. 修复.rel.plt
  7. 再次修复.dynsym
  8. 写出新部分的内容

在copy_section中:将复制的部分排除在复制之外.

In copy_section: exclude the rewritten sections from being copyied.

目前看来,它会创建一个语法上有效的ELF文件,但是.plt和.got之间的距离发生变化,其中的相对地址.plt已损坏.此外,必须重新修复.got.

Currently it seems to create a syntactically valid ELF file, but as the distance between .plt and .got changes, the relative addressing in .plt is broken. Additionally the .got has to be fixed again.

因此,作者设法将看起来像AMD CPU的东西粘合在一起,但不起作用.

So the author managed to glue together something that looks like an AMD CPU, but which doesn't work.

当然,您可以再花2周的时间来了解作者的所作所为,然后再花3周的时间来修复剩余的碎片.然后,您可能会得到一些有时可以工作的东西.

Sure, you can spend another 2 weeks to understand what the author did, and then another 3 weeks to fix the remaining broken pieces. And after that, you may get something that kind of sometimes works.

您的时间在其他地方花费的时间可能更多.

Your time is likely better spent elsewhere.

这篇关于如何重命名arm elf .so文件中的动态符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆