Mail Archives: djgpp/2006/03/02/20:32:22
"Rod Pemberton" <do_not_have AT sorry DOT bitbucket DOT cmm> wrote:
>
>"DJ Delorie" <dj AT delorie DOT com> wrote in message
>news:200603011425 DOT k21EPHCE005449 AT envy DOT delorie DOT com...
>> "Florian Liebig" <FlorianLiebigEMD AT compuserve DOT de> wrote in message
>news:4404EB6F DOT D050DB39 AT compuserve DOT de...
>>>
>>> i'm using djgpp gnu gcc package 2.7.2 and all i want to use it for is
>>> developing a kernel in high level language. the compiled 32bit kernel
>>> shall be used by an experimental os written by myself. but there's my
>>> problem : the output of gcc.exe/ld.exe always need to link in some
>>> library functions of libgpp/ libc etc., what i do not understand,
>>> because the code that i wrote doesn't makes the use any of the specific
>>> gnu libraries.
If you use "ld" to run the linker instead of "gcc", it should link
only what you tell it to link, and not link in the standard libraries
or startup code by default.
>>> the next problem is ld.exe's behaviour to link in the stub program, that
>>> makes it executable in msdos env's.
Either use "ld --oformat coff-go32 ..." or read up on linker scripts
and set the output file format there. I think the "coff-go32-exe"
format is the default (COFF with .EXE stub); at least, it is if
you use "gcc" to link.
>>> is there any way to link the .o files with ld.exe to a plain 32bit
>>> prot.-mode binary image ??
Yes ("ld --oformat binary ..."), but don't do it. If you make a COFF
file, you can run objdump on it to make sure it's linked properly.
Also, there's no good way to determine the size of a plain-binary
kernel (because there's no header that gives you the BSS size).
>> You want a cross compiler, not a native compiler. You probably want
>> to build an i386-elf compiler that runs on djgpp.
I disagree. For simple OS development (no dynamic linking),
ELF has no compelling advantage over COFF.
>I'm already doing that with both DJGPP and OW. I'm running a Ring 0 OS
>written in DJGPP and OW without using a cross-compiler for either one. The
>disadvantage is that it can only be started from RM DOS (so far). It won't
>be startable with GRUB, etc...(at least not immediately, this can be added
>later on in development)
I have used GRUB to boot kernels made with DJGPP (COFF format), MinGW
(Win32 PE COFF format), and GCC for Linux (ELF format). I used the GRUB
"a.out kludge" feature to boot the non-ELF kernels. It works well,
and I recommend it.
http://my.execpc.com/~geezer/osd/index.htm
- Raw text -