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
horoz

Executable File Format

Post by horoz »

hi all
i have passed the task, memory management stage and i've
written a basic fat12 and floppy driver. i've used flat memory model.
now i want to decide on which executable file format to use for applications. i don't want to use elf or pe. I've considered LX and rdoff (btw i couldn't find Rdoff 2.0 specification. not on google nor on wotsit :-\ ) If you have any suggestions on a format can you please give a link to any kind of specification.

thanks
Whatever5k

Re:Executable File Format

Post by Whatever5k »

Why don't you want to use ELF? I'd go for it...
horoz

Re:Executable File Format

Post by horoz »

i don't know maybe i can i thought there might be a better format that's why i am asking.
Tim

Re:Executable File Format

Post by Tim »

ELF and PE are both fine executable formats for 99% of what you might need. They're both very general-purpose. I believe PE is slightly better, as it has a few more bells and whistles (e.g. resources), and its relocations aren't based on Position-Independent Code, as ELF is. (PIC performs badly on x86 because it takes up one register which, in PE, can be used by the compiler.)
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Executable File Format

Post by Pype.Clicker »

You know, Tim, you're not forced to use PIC (position independent code) with elves. you just *can*, and that's the way Linux dynamic loader works ... but you can for sure write another loader that do not enforce this. Relocation infos are there too :p
Tim

Re:Executable File Format

Post by Tim »

You mean you can get the linker to emit a relocatable image with relocations instead of PIC? I never knew that.

To be honest, it's been a struggle getting ld to emit relocatable images even with PE (my relocatable drivers invoke ld three times -- apparently this is the only way of doing it).
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Executable File Format

Post by Pype.Clicker »

there is something like a "-r" or "-i" file that forces it to keep relocation information in the final object file. That's how Clicker modules are built

(though i admit there's no much more bits of elves when i'm done with them ... Maybe i should name my file format 'Obscure Relocatable Code' or something alike :p)
Post Reply