添加部分ELF文件 [英] Adding section to ELF file
问题描述
我需要能够将任意部分添加到一个ELF文件。我无法使用GPL code在这个程序,所以BFD是出了问题。我可以使用libelf函数/ GELF阅读部分,但文档是这些相当稀疏,我无法弄清楚如何添加一个部分。是否有人知道如何做到这一点?我宁愿不写我自己的ELF code。
I need to be able to add an arbitrary section to an ELF file. I cannot use GPL code in this program, so BFD is out of the question. I can use libelf/gelf to read sections, but the documentation is fairly sparse for these, and I cannot figure out how to add a section. Does anybody know how to do this? I would rather not write my own ELF code.
推荐答案
有几个(可能)在有关答案关于ELF文件头这个问题的。使用 objcopy把
来的部分添加到一个ELF文件的接受的答案中提到,和 BSD bintools 声称有一个BSD许可的实施 objcopy把
可能会满足您的需求。
There's a few (possibly) related answers in this question about ELF file headers. The accepted answer mentioned using objcopy
to add sections to an ELF file, and the BSD bintools claims to have a BSD-licensed implementation of objcopy
that might suit your needs.
这篇关于添加部分ELF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!