Page 1 of 1

New executable, BFD and toolchain

Posted: Sat Mar 11, 2006 5:15 pm
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

Re:New executable, BFD and toolchain

Posted: Sat Mar 11, 2006 7:02 pm
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 ?

Re:New executable, BFD and toolchain

Posted: Sun Mar 12, 2006 12:27 pm
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

Re:New executable, BFD and toolchain

Posted: Mon Mar 13, 2006 2:13 pm
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

Re:New executable, BFD and toolchain

Posted: Tue Mar 14, 2006 12:44 am
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. ;-)

Re:New executable, BFD and toolchain

Posted: Tue Mar 14, 2006 5:37 am
by Pype.Clicker
just out of curiousity, what do "BFD" stands for ? Binary Format Descriptor ?

Re:New executable, BFD and toolchain

Posted: Tue Mar 14, 2006 6:48 am
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.

Re:New executable, BFD and toolchain

Posted: Sat Mar 18, 2006 1:23 pm
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 ?

Re:New executable, BFD and toolchain

Posted: Sat Mar 18, 2006 1:48 pm
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"?

Re:New executable, BFD and toolchain

Posted: Sat Mar 18, 2006 1:55 pm
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.

Re:New executable, BFD and toolchain

Posted: Sat Mar 18, 2006 2:00 pm
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)

Re:New executable, BFD and toolchain

Posted: Mon Mar 20, 2006 3:18 pm
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.