delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2006/03/03/14:15:19

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <44089208$0$488$cc7c7865@news.luth.se>
From: Martin Str|mberg <ams AT speedy DOT ludd DOT ltu DOT se>
Subject: Re: djgpp for kernel dev.
Newsgroups: comp.os.msdos.djgpp
References: <4404EB6F DOT D050DB39 AT compuserve DOT de> <200603011425 DOT k21EPHCE005449 AT envy DOT delorie DOT com> <du5jr6$fs81$1 AT news3 DOT infoave DOT net> <440798e7 DOT 2544010 AT news DOT execpc DOT com>
User-Agent: tin/1.4.6-20020816 ("Aerials") (UNIX) (NetBSD/1.6Q (alpha))
Date: 03 Mar 2006 18:59:20 GMT
Lines: 68
NNTP-Posting-Host: speedy.ludd.ltu.se
X-Trace: 1141412360 news.luth.se 488 130.240.16.13
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Chris Giese <NoEmailAds AT execpc DOT com> wrote:

Oooh, Chris is back!


> 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).

Well, it's sufficiently good for me with this linker script (you don't
need a header):

ENTRY(start)
SECTIONS
{
  .text  0 : {
    stack.o(.stack)
    entry.o(.text)
    *(.text)
    etext  =  . ; _etext = .;
    . = ALIGN(0x8);
  }
  .data  ALIGN(0x8) : {
    *(.data)
     . = ALIGN(0x8);
     edata  =  . ; _edata = .;
  }
  .bss  SIZEOF(.data) + ADDR(.data) :
  { 
    . = ALIGN(0x8);
    *(.bss)
    *(COMMON)
    . = ALIGN(0x1000);
     end = . ; _end = .;
  }
}


With that you have the size of the BSS (e. g. ) as
unsigned char end[], edata[];

unsigned long size_of_bss(void)
{
	unsigned long size = end - edata;

	return 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.

Indeed, with that linker script (or a variation thereof) plus some
loader and setup 32-bit PM, you're not depending on any output
format.

Obviously you can't call any DJGPP function (except for those that are
OS independed or whatever the term is) and get away with it. But as
you're coding your own OS you need to provide your own functions
anyway.


Right,

						MartinS

- Raw text -


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