Following an idea that cam in the os dev forum I'd like to experiment with linking at runtime in a smaller stub. I've googled and searched Sourceforge for small linkers and can't find one that supports the output formats of AR and GCC.
I'm willing to try to write my own if anyone could give me some pointers.
Cheers
Pete
Linkers
Re:Linkers
No the idea is that the boot loader loads the object files in at boot and links them giving the output to a memory location which is then jumped to. As my OS is for servers this would speed up time taken to update the kernel. Just replace one object file and reboot. It could also be used for drivers etc. as well.
Pete
PS I posted here because I'm mainly concerned about the general linking process. Which I will first test under Windows
Pete
PS I posted here because I'm mainly concerned about the general linking process. Which I will first test under Windows
Re:Linkers
Ah, so you want to use dynamic linking? Well, you should link as normal to PE or ELF, and set the 'shared library' option. Then your loader needs to know how to parse the import table/symbol table and resolve references to external symbols.
A copy of the relevant file format spec should be all you need.
A copy of the relevant file format spec should be all you need.
Re:Linkers
I've found info on Chris Geise's site with example code which explains a lot. But I can see a lot of work ahead if I have to support more than one object file type. Is there one 'universal' format amongst gcc.
ELF doesn't work with Cygwin
COFF is different for DJGPP
etc.
Pete
ELF doesn't work with Cygwin
COFF is different for DJGPP
etc.
Pete
Re:Linkers
ELF works on Cygwin if you link to PE then use objcopy to convert to ELF.
All the versions I've seen have COFF in common, even DJGPP and Cygwin.
All the versions I've seen have COFF in common, even DJGPP and Cygwin.
Re:Linkers
Like I say, all the versions I've seen support 'regular' COFF. Cygwin also supports Win32-COFF, which is slightly different.