delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/27/05:48:40

From: wanpsm98 AT octarine DOT cc DOT adfa DOT oz DOT au (WANKADIA PAUL SAPAL MICHAEL)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Question about "crt0.s"
Date: 27 Apr 98 08:52:42 GMT
Organization: ADFA News Service
Lines: 34
Message-ID: <wanpsm98.893667162@octarine>
References: <01BD7158 DOT ADC3E840 AT arnhem-001 DOT std DOT pop DOT tip DOT nl>
NNTP-Posting-Host: 131.236.253.20
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019