Developer's Topics
Chapter 7, Common Object File Format (COFF)

Section headers

Section headers

Every object file has a table of section headers to specify the layout of data within the file. The section header table consists of one entry for every section in the file. The information in the section header is described in Table 7-6, ``Section header contents''.



Table 7-6 Section header contents

 Bytes   Declaration      Name        Description
 ---------------------------------------------------------
   0-7   char             s_name      8-character null
                                      padded section name
  8-11   long int         s_paddr     Physical address of
                                      section
 12-15   long int         s_vaddr     Virtual address of
                                      section
 16-19   long int         s_size      Section size in
                                      bytes
 20-23   long int         s_scnptr    File pointer to raw
                                      data
 24-27   long int         s_relptr    File pointer to
                                      relocation entries
 28-31   long int         s_lnnoptr   File pointer to line
                                      number entries
 32-33   unsigned short   s_nreloc    Number of relocation
                                      entries
 34-35   unsigned short   s_nlnno     Number of line
                                      number entries
 36-39   long int         s_flags     Flags (see Table 7-
                                      7, ``Section header
                                      flags'' 

The size of a section is padded to a multiple of 4 bytes. File pointers are byte offsets that can be used to locate the start of data, relocation, or line number entries for the section. They can be readily used with the function fseek(S).