coff header

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
shaz

coff header

Post by shaz »

i'm trying to write loader for coff-go32 format.
in the linker script i specify 3 sections.but when i read coff header,it shows that there are 4 sections.
here are commands for compiling and linking c and asm files.

Code: Select all

gcc  -c kernel_c.c
NASM -f coff kernel.asm
ld  -o k.o -Tlinker.ld kernel.o kernel_c.o
here is my linker script.

Code: Select all

OUTPUT_FORMAT("coff-go32")
ENTRY(_start)
SECTIONS
{
  .text 0x100000 : {
    *(.text)
  }
  .data  : {
    *(.data)
  }
  .bss  :
  {                
    *(.bss)
  }
}

please tell why it is showing 4 sections and what might be the 4th section.
shaz

Re:coff header

Post by shaz »

the 4th section added is .comment section.
what does this section contain.is it added by default because in limker script there is nothing about .comment section.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:coff header

Post by df »

.comment == comment.

nasm adds comments to its objects, basically saying what something like 'nasm 0.98' or something. you can strip it out if you want. it wont be loaded either.
-- Stu --
shaz

Re:coff header

Post by shaz »

here are steps which i'll follow to load statically linked coff kernel.
1) i'll get no.of sections from coff file header

2)then i'll read initial entry point from a.out file header

3)by using the "section offset" fields,i'll load .code,.data and .bss sections to desired physical addresses(pointed to by "physical addresses of sections" field in section header.

4)then i'll jump to initial entry point obtained from a.out header.

are these steps correct to load a statically linked coff kernel.
Post Reply