Mail Archives: djgpp/1998/04/27/05:48:40
Guido <guido DOT de DOT jong AT tip DOT nl> writes:
>* Is there a way to get rid of the linker script and the "__main()" function?
> I don't intend to use any C++ code in the kernel, so I don't need them
> (or do I?).
I had the same problems, when I was writing early code for PUNIX.
Basically, I rewrote the ld scripts and told ld to link only the files
that I specify (i.e. no going and secretly linking crt0.o and friends);
of course, to permit gcc to work normally, I had to go through a fair bit
of jiggery-pokery to get into protected mode, which ended up looking a
lot like Linux's three-stage load.
Unfortunately, I won't be able to get access to my source until July --
if you desperately need a solution before then, I'm afraid I can only
describe ... very vaguely ... what I accomplished a few months ago.
Oh yeah -- I had to tell ld to output to a binary image, allowing me to
load the kernel directly into memory without (too much) fiddling around.
Of course, if you want to use a COFF image (there are probably some
advantages to doing so), it's certainly possible...
>* If I can not drop the "__main()", what should I put in there? Maybe I could
> copy the "__main()" from the DJGPP source?
In the ld script, you can specify the entry label...
>* What compiler options can I use best? I use "-ansi -Wall -O2 -fomit-frame-
> pointer" by default.
IIRC, I think mine's setup for '-Wall -O3 -m486 -fomit-frame-pointer'; I
could probably do without the 486's alignments, since I've got a Pentium
(and, it seems, so do heck of a lot of people), but it's hardly a
pressing concern when there's a scheduler to be debugged...
- Raw text -