Kernel executable formats
Kernel executable formats
I know there are a few, but which is most common?
What advantages/disadvantages do each of them have have?
What advantages/disadvantages do each of them have have?
Re:Kernel executable formats
Em, I think the best thing is to choose a format to suit your needs even if its "outdated". If its the best one for what you want to do then there is no need using anything else.
Your question is vague,advantages and disadvantages depend on what you want to do.
If you tell us your plans then we will be better informed to give points
Your question is vague,advantages and disadvantages depend on what you want to do.
If you tell us your plans then we will be better informed to give points
Re:Kernel executable formats
Well I hope that sometime in the future I will have an OS as capable as lets say FreeBSD or Mac OS X. I would need a format that I can use all the way up to that level... but maybe they all are capable of that ???
Other than that though, at this point, I can't say anything more about my OS as it is in it's early stages... maybe I'll need to get back to you.
Other than that though, at this point, I can't say anything more about my OS as it is in it's early stages... maybe I'll need to get back to you.
Re:Kernel executable formats
as for this I can only advise you to use a well-supported format, since it allows for more interoperability (compiling on any platform without using a special compiler or cross-compiler). For that I'd advise ELF since I use it myself but I hear PE is also quite well supported (more than ELF by some commercial compilers) so you might want to choose either of those.xxchrisxx wrote: Well I hope that sometime in the future I will have an OS as capable as lets say FreeBSD or Mac OS X. I would need a format that I can use all the way up to that level... but maybe they all are capable of that ???
Other than that though, at this point, I can't say anything more about my OS as it is in it's early stages... maybe I'll need to get back to you.
If you're going to make your own compiler or something like that, you can devise your own, but not until you look at all the others you can find and explain exactly what is wrong with them.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Kernel executable formats
One of the nice things that ELF offers for OS dev' is that it supports custom sections, which means that you can - for instance - have an "kinit" section which will collect {"module name", init function pointer, init level} structures from many places in the system and build a system initialisation table that you can parse easily at boot time.
To get the same functionnality with COFF, i had to write a small program that scanned sources for specially-formatted comments, which is imho much less elegant
To get the same functionnality with COFF, i had to write a small program that scanned sources for specially-formatted comments, which is imho much less elegant
Re:Kernel executable formats
As for that, that's exactly what I was planning on doing. It's just that, up to now, I haven't been able to find a nice way to tell GCC to put a certain function in a different section...
Do you have any ideas?
Do you have any ideas?
Re:Kernel executable formats
http://my.execpc.com/~geezer/osd/misc/index.htm#discardCandy wrote: It's just that, up to now, I haven't been able to find a nice way to tell GCC to put a certain function in a different section...
__attribute__((section ("FOO"))) works with DJGPP (COFF), MinGW (Win32 PE COFF), and GCC for Linux (ELF).
Re:Kernel executable formats
Thanks
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Kernel executable formats
i used to use COFF because it was the only supported thing under DJGPP (afaik) when i started my project. Now, i can use either ELF or COFF, and the last time i tried it (gcc 2.59.3), gcc (or maybe it was LD) refused the 'section("FOO")' thing, saying that freely named sections was not valid in COFF ...chris wrote: @Pype.Clicker, why do you use COFF instead of ELF?
Re:Kernel executable formats
The big question being, why don't you switch to ELF then? Or, if you have both, or have already switched, did it even cost you any trouble?Pype.Clicker wrote:i used to use COFF because it was the only supported thing under DJGPP (afaik) when i started my project. Now, i can use either ELF or COFF, and the last time i tried it (gcc 2.59.3), gcc (or maybe it was LD) refused the 'section("FOO")' thing, saying that freely named sections was not valid in COFF ...chris wrote: @Pype.Clicker, why do you use COFF instead of ELF?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Kernel executable formats
i now have both ... This came mainly at the cost of moving the appropriate flags into some makefile.$(OSTYPE) included, so that my main makefiles only do
As there are things like "-fno-leading-underscore", most of the code have been made ELF-like with tricks around for DJGPP ... however, in some cases (like the 'init' section), i'm restricted to the "lowest commonly available feature set" ...
The main difficulty has been for building custom object files (like the SFS header for the kernel or my KernelMODules) out of two different kind of input formats in a maintainable way... For the modules, for instance, i need to deal with relocation tables and symbol tables, which are quite different in both formats as you can expect, but i finally made it and now, i'm a bit more comfortable with those formats and a bit more ready to write loaders for them ...
Code: Select all
nasm -f $(objformat) $< -o $@
The main difficulty has been for building custom object files (like the SFS header for the kernel or my KernelMODules) out of two different kind of input formats in a maintainable way... For the modules, for instance, i need to deal with relocation tables and symbol tables, which are quite different in both formats as you can expect, but i finally made it and now, i'm a bit more comfortable with those formats and a bit more ready to write loaders for them ...