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.
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.
i should admit i have no experience with integrating a new format in binutils (and doing it in GCC just scares me )
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 ?
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
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.
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.
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.
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!
Every good solution is obvious once you've found it.
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.