New executable, BFD and toolchain

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
Unlink

New executable, BFD and toolchain

Post by Unlink »

Hi guys,
i want to know how to achieve this :
1- Creating a new exe format (i know how to, so this isn't a problem).
2- Adding this exe format to BFD (any tutorial or how to).
3- Building the toolchain (binutils, gcc) exe with the new exe format.

Any good examples, tutorial, howto or a wiki :)

Thanks
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:New executable, BFD and toolchain

Post by Pype.Clicker »

i should admit i have no experience with integrating a new format in binutils (and doing it in GCC just scares me :P)

My suggestion would be "why not to just write a converter that produces your format out of what GCC outputs ?" ... or do you have specificities that makes in-kernel or in-linker integration mandatory ?
Unlink

Re:New executable, BFD and toolchain

Post by Unlink »

No i don't want converter tools, i need a full port of binutils so i can get the benefits of all tools, nm, ldd, ....
do u've any clue
Unlink

Re:New executable, BFD and toolchain

Post by Unlink »

Hmm, Ok,
Can any one provide me with the list of essential function that i need to write them as backend for bfd.
Assume, my format is used as both executable & object file, and i need to support both relocation & virtual memory(for executables).
Thanks
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:New executable, BFD and toolchain

Post by Solar »

Unlink wrote: Can any one provide me with the list of essential function that i need to write them as backend for bfd.
No.

But the BFD docs can. ;-)
Every good solution is obvious once you've found it.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:New executable, BFD and toolchain

Post by Pype.Clicker »

just out of curiousity, what do "BFD" stands for ? Binary Format Descriptor ?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:New executable, BFD and toolchain

Post by Solar »

From the aforementioned docs:
The name came from a conversation David Wallace was having with Richard Stallman about the library: RMS said that it would be quite hard?David said ?BFD?. Stallman was right, but the name stuck.
Every good solution is obvious once you've found it.
Unlink

Re:New executable, BFD and toolchain

Post by Unlink »

What about openwatcom, wlink, compiler & tools, can they be easier to port to a new os, and add support for new executable format ?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:New executable, BFD and toolchain

Post by Solar »

What makes you think that porting GCC / binutils - probably the best-documented compiler toolchain that has been ported to more platforms than any other - is "not easy"? What makes you think that Watcom (which is specific to Win32 / OS/2, with ports to Linux / BSD "under development") could be "easier"?
Every good solution is obvious once you've found it.
Unlink

Re:New executable, BFD and toolchain

Post by Unlink »

i'm not thinking of openwatcom or lcc, but i'm searching for an easily portable compiler with less headache with its linker where they allow the addition of new executable format easily.
Since porting binutils, glibc, gcc to your os is not an easy task specially when your os use it own executable format.
tinycc is good but the development is going slowly, beside it hasn't its own linker.
most of hacker fall in this trouble when they finish their kernel (mm, and fs, syscall, schedular, ...).
i think the os development world lacks a portable c-compiler/ linker, while newlibc now is more portable than glibc, the binutils has no replacement for now.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:New executable, BFD and toolchain

Post by Solar »

Well, a portable compiler backend / assembler / linker is no piece of cake. You need some abstraction for binary formats etc. - which, in case of binutils, is the BFD lib. If you make an abstraction as portable as that, I doubt it would be much simpler...

As for a portable lib... I'm working on it, damn it! 8)
Every good solution is obvious once you've found it.
paulbarker

Re:New executable, BFD and toolchain

Post by paulbarker »

Have you looked at TCC - the Tiny C Compiler?

http://www.tinycc.org

It really is tiny, total code size is just under 1MB (excluding win32 stuff) including targets for ELF and COFF on x86, ARM and C67. Its well split up into the core, code for each executable type and code for each target platform. My only complaint is that the main file uses #include's to get the other c files rather than compiling everything separately then linking.
Post Reply