Executable file format

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
pepito

Executable file format

Post by pepito »

Hello:

Which could be the simplest already existing 'executable file format'
(a.out, coff, elf, exe, etc) ?

pepito
Neptune

RE:Executable file format

Post by Neptune »

I'm not sure, though from what I have learned of the PE (.exe) format, I can say with certainty that it is *not* one of them! (Since it is based on the COFF format, the two are probably quite similar). I far as I know, the .com file is probably closest thing to straight binary - maybe that would be a good starting point?  
Gandalf

RE:Executable file format

Post by Gandalf »

hi pepito,

I believe though elf is not simple but still using it will pay off in the future.

rgds
Gandalf
jmpnop

RE:Executable file format

Post by jmpnop »

Isn't COM-files raw binary executables??
Khumba

RE:Executable file format

Post by Khumba »

Yes but a header is attached to it when it's loaded.
ASHLEY4

RE:Executable file format

Post by ASHLEY4 »

If you want the simplist file format the, COM file is it,they do not come much simpler than eg:
1)find program on disk.
2)allocate all memory.
3)get file size.
4)load file size bytes form file.
5)default CS and SS to load address,IP to 100h and SP to FFFEh.
(This is in dos).

ASHLEY4.
Chris Giese

RE:Executable file format

Post by Chris Giese »

>Which could be the simplest already existing 'executable file format'

.COM files are a good starting point for a 16-bit OS. But .COM files are
essentially plain binary files, which have their disadvantages:
http://my.execpc.com/~geezer/osd/exec/index.htm#binary

For a 32-bit OS, use the "native" file format produced by whatever linker
you're using: DJGPP COFF for DJGPP, Win32 PE COFF for Windows-based
compilers, and ELF for Linux compilers (usually GCC).

With static linking, code to load DJGPP COFF, Win32 PE COFF, and ELF
executables are all roughly equal in complexity:
http://my.execpc.com/~geezer/osd/exec/i ... m#snippets
djcoff.c - 3.7K, 121 lines of code
elf.c - 4.4K, 134 lines of code
pecoff.c - 5.5K, 178 lines of code

If you later want to support dynamic linking, I would use either ELF
or Win32 PE COFF.
pepito

RE:Executable file format

Post by pepito »

OK,

I see that the simplest 'executable file format' (.com) is not the best chioce!
I will try COFF or ELF...

Thank you very much for every one!

pepito
Post Reply