| delorie.com/archives/browse.cgi | search |
| From: | no AT email DOT ads (Christopher Giese) |
| Newsgroups: | comp.os.msdos.djgpp,gnu.gcc.help |
| Subject: | DJGPP -> coff-go32 -> .COM file |
| Date: | Wed, 12 Aug 1998 02:42:31 GMT |
| Organization: | Cheeseland Clench |
| Lines: | 40 |
| Message-ID: | <35d10075.6016014@news.axisnet.net> |
| NNTP-Posting-Host: | cnn.axisnet.net |
| Cache-Post-Path: | cnn.axisnet.net!unknown AT 207 DOT 112 DOT 220 DOT 24 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
I have been trying to write my own OS using DJGPP and NASM. I've
had good luck assembling the startup code to "aout" format and using
the following linker script to build a .COM file:
----------- BEGIN LINKER SCRIPT ---------------
/* Adapted from /djgpp/lib/djgpp.djl */
OUTPUT_FORMAT("binary") /* "binary" for .COM file */
ENTRY(_start)
SECTIONS
{ .text 0x100 + SIZEOF_HEADERS : /* 0x100 for .COM file */
{ *(.text)
etext = .; _etext = .; }
.data . :
{ *(.data)
edata = .; _edata = .; }
.bss SIZEOF(.data) + ADDR(.data) :
{ *(.bss)
*(COMMON)
end = .; _end = .; }}
----------- END LINKER SCRIPT ---------------
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. I changed OUTPUT_FORMAT in the linker script to "coff-go32"
and tried:
ld --noinhibit-exec -o krnl.cof -Tlink.scr $(OBJECTS)
nm --line-numbers krnl.cof | sort >krnl.lst
objcopy --input-format coff-go32 --output-format binary krnl.cof
krnl.com
but all the data references have the wrong addresses.
Help!
(The code I've got so far can be found at
http://www.netwurx.net/~geezer/os)
--
geezer@ | Sales rushes in where
netwurx.net | Engineering fears to tread.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |