Linux 用户空间 ELF 加载器 [英] Linux user-space ELF loader

查看:27
本文介绍了Linux 用户空间 ELF 加载器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要做一件相当不寻常的事情:手动执行一个 elf 可执行文件.IE.将所有部分加载到正确的位置,查询 main() 并调用它(然后进行清理).可执行文件将被静态链接,因此无需链接库.我也控制基地址,所以不用担心可能的冲突.

I need to do a rather unusual thing: manually execute an elf executable. I.e. load all sections into right places, query main() and call it (and cleanup then). Executable will be statically linked, so there will be no need to link libraries. I also control base address, so no worries about possible conflicts.

那么,有没有相关的库?

So, is there are any libraries for that?

我找到了 OSKit 和它的 liboskit_exec,但是这个项目似乎从 2002 年就已经死了.

I found OSKit and its liboskit_exec, but project seems to be dead since 2002.

我可以参与项目的一部分(当然尊重许可证)并根据我的需要定制它们,但是由于我在 linux 世界中是个菜鸟,我什至不知道在哪里可以找到这些部分!:)

I'm OK with taking parts of projects (respecting licenses, of course) and tailoring them to my need, but as I'm quite a noob in the linux world, I dont even know where to find those parts! :)

附注.我需要 ARM 平台.

PS. I need that for ARM platform.

UPD 好吧,加载精灵的问题似乎需要一些很好的知识(叹气),所以我出去阅读一些规范和手册.我想我会坚持使用仿生/链接器和 libelfsh.谢谢你们!

UPD Well, the matter of loading elfs seems to require some good knowledge about it (sigh), so I'm out to read some specs and manuals. And I think I will stick to bionic/linker and libelfsh. Thanks guys!

总结结果:

  • libelf: http://directory.fsf.org/project/libelf/
  • elfsh and libelfsh (are now part of eresi): http://www.eresi-project.org/
  • elfio (another elf library): http://sourceforge.net/projects/elfio/
  • OSKit and liboskit_exec (outdated): http://www.cs.utah.edu/flux/oskit/
  • bionic/linker: https://android.googlesource.com/platform/bionic

推荐答案

A quick apt-cache search 建议 libelf1libelfg0 和/或 libelfsh0.我认为 elfsh 程序(在同名包中)可能是如何使用 libelfsh0 的一个有趣的实际例子.

A quick apt-cache search suggests libelf1, libelfg0 and/or libelfsh0. I think the elfsh program (in the namesake package) might be an interesting practical example of how to use libelfsh0.

我自己没有尝试过,但我希望它们可能会有所帮助.祝你好运:-)

I haven't tried any myself, but I hope they might be helpful. Good luck :-)

这篇关于Linux 用户空间 ELF 加载器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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