3

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?".

alfC
  • 14,261
  • 4
  • 67
  • 118
Griwes
  • 8,805
  • 2
  • 43
  • 70

3 Answers3

4

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 ... ;-)

alk
  • 69,737
  • 10
  • 105
  • 255
2

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

Here are a couple of readable introductions:

And some examples that don't use libbfd:

Seth
  • 2,683
  • 18
  • 18
  • Hmm, I think I must reformulate my question. 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". – Griwes Sep 30 '11 at 13:59
1

The DOS COM file is the simplest possible format.

Load up to 64k less 256 bytes at seg:0100h, set DS,ES,SS=seg, SP=FFFFh and jump to seg:0100h

Joshua
  • 40,822
  • 8
  • 72
  • 132
  • Hmm, but the binutils' msdos format lack some features... and as most gnu code, lack almost any documentation - assuming I should always know what is going on, when reading the code. – Griwes Sep 22 '11 at 21:36