Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GNU Binutils' Binary File Descriptor library - format example

As in title. I tried reading the BFD's ELF's code, but it's rather not a light reading. I also tried to get something from the documentation, but I would need an example to see how it works. Could anyone point me some easier example for me, to know how to define an executable format?

Edit: Looks like I didn't formulate the question properly. I don't ask "how to create own executable format specification?", nor "where is good ELF documentation?", but "how can I implement my own executable format using GNU BFD?".

like image 402
Griwes Avatar asked Oct 16 '25 13:10

Griwes


2 Answers

You did look here http://sourceware.org/binutils/docs-2.21/bfd/index.html and here http://sourceware.org/binutils/binutils-porting-guide.txt?

Also studying the MMO implementation of a BFD backend as mentioned here http://sourceware.org/binutils/docs-2.21/bfd/mmo.html#mmo (source: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/mmo.c?cvsroot=src) might be less complex than starting with ELF ... ;-)

like image 79
alk Avatar answered Oct 19 '25 03:10

alk


I agree that BFD documentation is somewhat lacking. Here are some better sources:

  • ELF Format
  • System V ABI (section 4)

Here are a couple of readable introductions:

  • Linux Journal
  • Dr. Dobbs

And some examples that don't use libbfd:

  • ELF IO
  • ELF Toolchain
  • LibELF
like image 27
Seth Avatar answered Oct 19 '25 05:10

Seth