home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 202.img / SCO386N2.TD0 / usr / include / sys / coff.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-05-18  |  4.5 KB  |  166 lines

  1.  
  2. /*
  3.  *    @(#) coff.h 1.1 88/05/18 
  4.  *
  5.  *    Copyright (C) The Santa Cruz Operation, 1984, 1985, 1986, 1987, 1988.
  6.  *    Copyright (C) Microsoft Corporation, 1984, 1985, 1986, 1987, 1988.
  7.  *    This Module contains Proprietary Information of
  8.  *    The Santa Cruz Operation, Microsoft Corporation
  9.  *    and AT&T, and should be treated as Confidential.
  10.  */
  11.  
  12. /*
  13.  * COFF file definitions
  14.  */
  15.  
  16. /*
  17.  * COFF file header
  18.  */
  19. struct filehdr
  20. {
  21.     unsigned short    f_magic;    /* magic number            */
  22.     unsigned short    f_nscns;    /* number of sections        */
  23.     long        f_timdat;    /* time & date stamp        */
  24.     long        f_symptr;    /* file pointer to symtab    */
  25.     long        f_nsyms;    /* number of symtab entries    */
  26.     unsigned short    f_opthdr;    /* sizeof(optional hdr)        */
  27.     unsigned short    f_flags;    /* flags            */
  28. };
  29.  
  30.  
  31. /*
  32.  *   Bits for f_flags:
  33.  *
  34.  *    F_RELFLG    relocation info stripped from file
  35.  *    F_EXEC        file is executable  (i.e. no unresolved
  36.  *                externel references)
  37.  *    F_LNNO        line nunbers stripped from file
  38.  *    F_LSYMS        local symbols stripped from file
  39.  *    F_MINMAL    this is a minimal object file (".m") output of fextract
  40.  *    F_UPDATE    this is a fully bound update file, output of ogen
  41.  *    F_SWABD        this file has had its bytes swabbed (in names)
  42.  *    F_AR16WR    this file has the byte ordering of an AR16WR
  43.  *                (e.g. 11/70) machine
  44.  *                (it was created there, or was produced by conv)
  45.  *    F_AR32WR    this file has the byte ordering of an AR32WR machine
  46.  *                (e.g. vax)
  47.  *    F_AR32W        this file has the byte ordering of an AR32W machine
  48.  *                (e.g. 3b,maxi)
  49.  *    F_PATCH        file contains "patch" list in optional header
  50.  *    F_NODF        (minimal file only) no decision functions for
  51.  *                replaced functions
  52.  */
  53.  
  54. #define  F_RELFLG    0000001
  55. #define  F_EXEC        0000002
  56. #define  F_LNNO        0000004
  57. #define  F_LSYMS    0000010
  58. #define  F_MINMAL    0000020
  59. #define  F_UPDATE    0000040
  60. #define  F_SWABD    0000100
  61. #define  F_AR16WR    0000200
  62. #define  F_AR32WR    0000400
  63. #define  F_AR32W    0001000
  64. #define  F_PATCH    0002000
  65. #define  F_NODF        0002000
  66.  
  67. /*
  68.  *   Magic Numbers
  69.  */
  70.     /* Intel 386 */
  71.  
  72. #define  I386MAGIC    0514
  73.  
  74.  
  75. /*
  76.  * COFF UNIX a.out header
  77.  */
  78. typedef    struct aouthdr
  79. {
  80.     short    magic;        /* see magic.h                */
  81.     short    vstamp;        /* version stamp            */
  82.     long    tsize;        /* text size in bytes, padded to FW
  83.                    bdry                    */
  84.     long    dsize;        /* initialized data "  "        */
  85.     long    bsize;        /* uninitialized data "   "        */
  86. #if U3B
  87.     long    dum1;
  88.     long    dum2;        /* pad to entry point    */
  89. #endif
  90.     long    entry;        /* entry pt.                */
  91.     long    text_start;    /* base of text used for this file    */
  92.     long    data_start;    /* base of data used for this file    */
  93. } AOUTHDR;
  94.  
  95. /*
  96. /*
  97.  * COFF section header
  98.  */
  99. struct scnhdr
  100. {
  101.     char        s_name[8];    /* section name            */
  102.     long        s_paddr;    /* physical address, aliased s_nlib */
  103.     long        s_vaddr;    /* virtual address        */
  104.     long        s_size;        /* section size            */
  105.     long        s_scnptr;    /* file ptr to raw data for section */
  106.     long        s_relptr;    /* file ptr to relocation    */
  107.     long        s_lnnoptr;    /* file ptr to line numbers    */
  108.     unsigned short    s_nreloc;    /* number of relocation entries    */
  109.     unsigned short    s_nlnno;    /* number of line number entries*/
  110.     long        s_flags;    /* flags            */
  111. };
  112.  
  113. /* the number of shared libraries in a .lib section in an absolute output file
  114.  * is put in the s_paddr field of the .lib section header, the following define
  115.  * allows it to be referenced as s_nlib
  116.  */
  117.  
  118. #define s_nlib    s_paddr
  119. #define    SCNHDR    struct scnhdr
  120. #define    SCNHSZ    sizeof(SCNHDR)
  121.  
  122.  
  123. /*
  124.  * Define constants for names of "special" sections
  125.  */
  126.  
  127. #define _TEXT ".text"
  128. #define _DATA ".data"
  129. #define _BSS  ".bss"
  130. #define _TV  ".tv"
  131. #define _INIT ".init"
  132. #define _FINI ".fini"
  133.  
  134. /*
  135.  * The low 2 bytes of s_flags is used as a section "type"
  136.  */
  137.  
  138. #define STYP_REG    0x00        /* "regular" section:
  139.                         allocated, relocated, loaded */
  140. #define STYP_DSECT    0x01        /* "dummy" section:
  141.                         not allocated, relocated,
  142.                         not loaded */
  143. #define STYP_NOLOAD    0x02        /* "noload" section:
  144.                         allocated, relocated,
  145.                          not loaded */
  146. #define STYP_GROUP    0x04        /* "grouped" section:
  147.                         formed of input sections */
  148. #define STYP_PAD    0x08        /* "padding" section:
  149.                         not allocated, not relocated,
  150.                          loaded */
  151. #define STYP_COPY    0x10        /* "copy" section:
  152.                         for decision function used
  153.                         by field update;  not
  154.                         allocated, not relocated,
  155.                         loaded;  reloc & lineno
  156.                         entries processed normally */
  157. #define STYP_INFO    0x200        /* comment section : not allocated
  158.                         not relocated, not loaded */
  159. #define STYP_LIB    0x800        /* for .lib section : same as INFO */
  160. #define STYP_OVER    0x400        /* overlay section : relocated
  161.                         not allocated or loaded */
  162. #define    STYP_TEXT    0x20        /* section contains text only */
  163. #define STYP_DATA    0x40        /* section contains data only */
  164. #define STYP_BSS    0x80        /* section contains bss only */
  165.  
  166.