Desire to make my own executable format, like ELF, COFF, PE?

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: Desire to make my own executable format, like ELF, COFF,

Post by dozniak »

bluemoon wrote:or zip multiple ELF together to implement multi-target.
https://icculus.org/fatelf/
Learn to read.
User avatar
LieutenantHacker
Member
Member
Posts: 69
Joined: Sat May 04, 2013 2:24 pm
Location: Canada

Re: Desire to make my own executable format, like ELF, COFF,

Post by LieutenantHacker »

Yeah, FatELF binaries work fine, but my original plan was to make my own executable format and release binaries, not use or add on to existing ones.

But nonetheless all the responses have been great, so thanks for all of the input.
The desire to hack, with the ethics to code.
I'm gonna build an 8-bit computer soon, with this as reference: http://www.instructables.com/id/How-to- ... -Computer/
feare56
Member
Member
Posts: 97
Joined: Sun Dec 23, 2012 5:48 pm

Re: Desire to make my own executable format, like ELF, COFF,

Post by feare56 »

I would use elf or pe until you have you os near finished to your initial design. You can make it ahead of time but as said you would have to edit someone else's code which will be the hard part. I would make it when you have all you want ported to the os and can run some type of game/graphical program
User avatar
LieutenantHacker
Member
Member
Posts: 69
Joined: Sat May 04, 2013 2:24 pm
Location: Canada

Re: Desire to make my own executable format, like ELF, COFF,

Post by LieutenantHacker »

Yeah, I might just come up with some specification as mentioned earlier, but just implement an existing format for now, or modify one, or just go flat for now.

Nonetheless, I still want my own format, but thanks for the heads up again.
The desire to hack, with the ethics to code.
I'm gonna build an 8-bit computer soon, with this as reference: http://www.instructables.com/id/How-to- ... -Computer/
h0bby1
Member
Member
Posts: 240
Joined: Wed Aug 21, 2013 7:08 am

Re: Desire to make my own executable format, like ELF, COFF,

Post by h0bby1 »

i did my own relocatable/dynamically exe format already, the motivation was specially because i worked sometime with different compiler and development environement, and even if pe/elf format can seem simple enougth, there are many way cross compiler compatibility can break, if only because of name mangling, and i don't like the idea to implement broken loader who fail to deal with a particular elf , and as i want to be able to develop module for my os from all plateform, and i didn't want the hassle to implement fully the whole spec of PE and elf, and that otherwise there is always a risk that the pe or elf will use some fancy thing from hell, i prefered to go that way

and also i wanted something that can be run 'in place' without needing memory allocation, and can be easily relocated anywhere even with simple asm code

i could have gone by make an elf or PE post processor to handle name mangling and basic sanity check to make sure the object is conform to what i expect, but then i'd either have to handle both format natively, or to onvert from each other, to be able to develop things from both windows and unix plateform without problem

i opted to make tool to convert so and dll to my own format, it's very simple tool made in plain C that can compile without problem with gcc or windows, and can easily be included into building tool chain without any kind of overhead, i compile everything under visual and just add the conversion in the custom post build step, and i generate the makefile for unix from the visual studio project, so it doesn't change anything for the building tool chain at all, just a little command run after the compilation to generate the file to the image, it also support to make compressed image

the name mangling is unified and so module can link with each other without any kind of specific interaction due to the file format, no matter if they are compiled to a .so under linux or to a dll under windows, and it doesn't change anything to the way i develop everything in general

for now it works pretty well, at first i wondered if that was the best way to go, but it didn't take that much time to make, and i only had to change the design once to handle relative relocation from the elf format, and it can already handle pretty complex module definition

and also i plan to do something similar to com, and to have some higher level component definition and encapsulation in binary module, and i like the idea to have more flexibility to handle this because elf is not supposed to handle anything simiar at all, and COM dlls can be pretty much of a mess as well, i don't see myself porting the whole com layer to my OS, not even sure it would be legal to do so, and i could use this format as a basis to make a more evolved component definition
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: Desire to make my own executable format, like ELF, COFF,

Post by bubach »

I'm thinking of this too, mostly because my OS is such a primitive little experiment, that I have no need for 90% of the header information. I might just write a converter from some existing format - would probably be much easier and also support any toolchain capable of outputting to that format.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
linguofreak
Member
Member
Posts: 510
Joined: Wed Mar 09, 2011 3:55 am

Re: Desire to make my own executable format, like ELF, COFF,

Post by linguofreak »

I have from time to time mused about an multifile executable format taking the form of one file for each segment of the executable plus a plaintext file looking something like the following:

Code: Select all

#loadscriptMarkerString
text = /bin/Foo.code $RELOCATION_OPTIONS1
data = /bin/Foo.data $RELOCATION_OPTIONS2
library1 = /lib/Bar.code $RELOCATION_OPTIONS3
#And so forth
Post Reply