Page 1 of 1

Linker for my executable format

Posted: Mon Feb 05, 2007 11:18 am
by Otter
Hello,
I want to create my own format for executables and shared libraries, and now I wonder how to create executables using this format ... of course I could write my own linker, which uses ELF reloctable objects to create my executable, but this is a lot of work ( boring work because it only tooks a lot of time, but it's not really complicated cause I'm familiar with stuff like relocation, sections, alignments, ... ) .

Is there a good way to port ld to know my format or is there a less-complex one to port ? Maybe you know some simple elf-loader I could use or something like that ... I would really like to go on with my os and not to waste lots of time on this problem ...

Posted: Mon Feb 05, 2007 11:52 am
by hendric
Porting current ld causes a too huge project as my thought , to Port the eariliest ld version?

Posted: Mon Feb 05, 2007 12:20 pm
by Assembler
Hello

If you want to add your own executable-object format to LD you have to play with BFD, then build binutils that targets your format.

1- Write a backend for BFD
2- Play with Makefile.am Makefile.in configure.in in bfd and gas
3- Write some scripts i think they have the extension *.sc in gas
4- Compile your binutils
5- Test if it works by compiling gcc with your target --target=i586-myformat

May be i forgot alot of things, but that's what popped from my head stack now.

Thanks

Posted: Tue Feb 06, 2007 8:09 am
by Otter
Thanks, that sounds great. Never heard of bfd before, but I googled for it and found some interesting things. That's exactly what I wanted.

I dunno yet whether I write a backend for bfd or a bfd frontent to create my execuatble out of some elf files, cause I think last one could be easierer and whould be still enough.