delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/15/06:30:29

From: no AT email DOT ads (geezer)
Newsgroups: comp.os.msdos.djgpp,gnu.gcc.help
Subject: Re: DJGPP -> coff-go32 -> .COM file
Date: Sat, 15 Aug 1998 07:45:38 GMT
Organization: Cheeseland Clench
Lines: 58
Message-ID: <35d53c85.995509@news.axisnet.net>
References: <35d10075 DOT 6016014 AT news DOT axisnet DOT net>
NNTP-Posting-Host: cnn.axisnet.net
Cache-Post-Path: cnn.axisnet.net!unknown AT dial197 DOT netwurx DOT net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I wrote:

>To help with debugging, I would like to link the kernel as
>"coff-go32", use 'nm' to dump all the symbols, _then_ convert it to a
>.COM file.

GEEZ, you people. Must I do everything myself ???  :)

/----- begin makefile -------------
CFLAGS=-c -O2
OBJECTS=krnla.o krnlc.o

krnl.com: $(OBJECTS) link.scr
  ld -o krnl.cof -Tlink.scr $(OBJECTS)
  echo CAUTION: inaccurate disassembly until _start32	>krnl.lst
  objdump --disassemble krnl.cof >>krnl.lst
  nm --line-numbers krnl.cof | sort >krnl.sym
  objcopy --input-format coff-go32 --output-format binary krnl.cof
krnl.com

krnla.o: makefile krnla.asm
  nasm -f aout -o krnla.o krnla.asm

krnlc.o: krnlc.c
  gcc $(CFLAGS) krnlc.c

clean:
  del *.o
  del krnl.com
  del krnl.cof
  del krnl.lst
  del krnl.sym
\----- end makefile -------------

/----- begin link.scr -------------
/* Adapted from /djgpp/lib/djgpp.djl */
OUTPUT_FORMAT("coff-go32")
ENTRY(_start16)
SECTIONS
{   .text 0x100 : /* 0x100 for .COM file */
    {	*(.text)
	etext = .; _etext = .; }
    .data . :
    {	*(.data)
	edata = .; _edata = .; }
    .bss SIZEOF(.data) + ADDR(.data) :
    {	*(.bss)
	*(COMMON)
	end = .; _end = .; }}
\----- end link.scr -------------

Disassembly in krnl.lst, line numbers in krnl.sym. objdump claims
to have a "--source" option but it did nothing.

-- 
geezer@     | Sales rushes in where
netwurx.net | Engineering fears to tread.

- Raw text -


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