Linker for my executable format

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Otter
Member
Member
Posts: 75
Joined: Sun Dec 31, 2006 11:56 am
Location: Germany

Linker for my executable format

Post 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 ...
hendric
Member
Member
Posts: 38
Joined: Sat Oct 21, 2006 10:56 am
Location: China

Post by hendric »

Porting current ld causes a too huge project as my thought , to Port the eariliest ld version?
Just Lazy Writing Anything...
User avatar
Assembler
Member
Member
Posts: 30
Joined: Fri Oct 27, 2006 5:26 am
Contact:

Post 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
Systems and Computer Engineering Researcher
"Do you pine for the nice days of Minix-1.1, when men were men and wrote their own device drivers?" -- Linus Torvalds
http://sce.carleton.ca/~maslan
Otter
Member
Member
Posts: 75
Joined: Sun Dec 31, 2006 11:56 am
Location: Germany

Post 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.
Post Reply