DLL's
- einsteinjunior
- Member
- Posts: 90
- Joined: Tue Sep 11, 2007 6:42 am
Hi,
Actually i am using the windows PE file format in my OS.
The Dlls are mostly used as modules containing exported functions that i dynamically load(used mostly for my device drivers).
Unfortunately the web pages are not yet finished so you can chek out the source code.
But i will recommend you to read this :
http://win32assembly.online.fr/tutorials.html
The section on the PE file format helped me quite a lot in understanding.
I will try and write some tutorial on it.Nut if you are still too new in the os design business then go for the elf executable format.It also supports dynamical loadind and is easier than the PE executable format.
Good luck.
Actually i am using the windows PE file format in my OS.
The Dlls are mostly used as modules containing exported functions that i dynamically load(used mostly for my device drivers).
Unfortunately the web pages are not yet finished so you can chek out the source code.
But i will recommend you to read this :
http://win32assembly.online.fr/tutorials.html
The section on the PE file format helped me quite a lot in understanding.
I will try and write some tutorial on it.Nut if you are still too new in the os design business then go for the elf executable format.It also supports dynamical loadind and is easier than the PE executable format.
Good luck.
- einsteinjunior
- Member
- Posts: 90
- Joined: Tue Sep 11, 2007 6:42 am
I use coff in my kernel right now, it's pretty simple to understand, and I can link files in memory easily. Many files are useable, coff, a.out (which also supports 16 and 32-bit relocations if you plan on doing any vm86 work), elf (which has a 64-bit version for x86-64 cpu's, as well as the standard 32-bit version), pe (dll files are simply PE files with a specific format if i'm not mistaken), .obj files... pretty much just look around, and pick one that suits your needs. I will probably end up using a custom format when i'm done, and finish up my linker to support a.out, coff, elf32/64, etc and have my file format support 16,32 and 64-bit relocations, since no one format will do that for you, and it will be easy for me to strip useless information out of the files (like unused symbols, larger than required headers, i don't care what the file name's where when i compiled it so i can remove those symbols, etc).einsteinjunior wrote:Hi,
Try the elf executable file format.
Its easier than all of the rest.
As a note, a lot of people tend to use ELF because it's supported by GRUB, and is documented pretty well (or so I hear), the djgpp coff is pretty well documented as well (which is what i used to implement my reolocation and linking code).
- einsteinjunior
- Member
- Posts: 90
- Joined: Tue Sep 11, 2007 6:42 am
I typed djgpp coff file format into google, and it is the first link.einsteinjunior wrote:Please can you provide me with some informations or links on the coff file format?
I am also doing some comparisons about executable file formats.
I want some more infos apart from what i got.
http://www.delorie.com/djgpp/doc/coff/
Microsoft uses a similar, but incompatible version of coff, so be careful if trying to use different compilers.
Just another quick link to read up a bit, and find some info on formats, has a listing of the most popular, and some links to specs.
http://my.execpc.com/~geezer/osd/exec/
Well (after a long break) i have gotten static ELF relocation working, i wrote the base for my code a while ago, and after a month or so break from my OS (for revision) i completed the code in about 10-15 minutes. It was remarkably easy.
I'm going to start on symbol table stuff, along with the import/export tables now. I'll post back if i have any ideas etc.
I'm going to start on symbol table stuff, along with the import/export tables now. I'll post back if i have any ideas etc.
For everyone interested in shared libraries and dynamic linking, this documentation is great: http://www.iecc.com/linker/
- einsteinjunior
- Member
- Posts: 90
- Joined: Tue Sep 11, 2007 6:42 am
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Just a quick question - why do you need dynamic linking? Are you wanting it to load modules/drivers or dynamic libraries. There's a (huge) difference .lukem95 wrote:Has any body got dynamic linking working with the ELF format? i am struggling to see where to start with this step :S
EDIT: But in the context of this thread, I'm going to assume dynamic libraries.
You need to keep track of all SOs loaded, where they are, etc... When loading a binary, you look in the .dyn section (which has a heap of information) and work to relocate the symbols to libraries that are in memory at that point in time.
NewOS's source code is a highly suggested read if you're stuck on dynamic linking.
well i was planning to use it for my drivers actually... i was going to have a common set of functions my drivers need to implement, and from that call them using their exported functions.
I shall read NewOS's source, iv just been through the specification for the nth time, and it seemed slightly clearer, i think its going to be one of those trial and error jobs though
I shall read NewOS's source, iv just been through the specification for the nth time, and it seemed slightly clearer, i think its going to be one of those trial and error jobs though
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
I personally use relocation of object files (-r on the ld command line) for my drivers - I feel that dynamic linking is overkill. I basically have a "dmain" that gets called and tells the kernel whatever functions need to be exported.
Relocation still has a link step, where you resolve external references (hence it often gets confused with dynamic linking).
SO dynamic linking is more for resolving external references to the SO file, instead of from it.
(Really tired and on a caffeine high at the moment, so this might not make any sense - I'm more than happy to clarify myself if you need it).
Relocation still has a link step, where you resolve external references (hence it often gets confused with dynamic linking).
SO dynamic linking is more for resolving external references to the SO file, instead of from it.
(Really tired and on a caffeine high at the moment, so this might not make any sense - I'm more than happy to clarify myself if you need it).