home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / GDB / GDB-4.13 / GDB-4 / gdb-4.13 / include / coff / sparc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-21  |  5.8 KB  |  215 lines

  1. /*** coff information for Sparc.  */
  2.  
  3. /* This file is an amalgamation of several standard include files that
  4.    define coff format, such as filehdr.h, aouthdr.h, and so forth.  In
  5.    addition, all datatypes have been translated into character arrays of
  6.    (presumed) equivalent size.  This is necessary so that this file can
  7.    be used with different systems while still yielding the same results.  */
  8.  
  9. /********************** FILE HEADER **********************/
  10.  
  11. struct external_filehdr
  12. {
  13.   char f_magic[2];        /* magic number            */
  14.   char f_nscns[2];        /* number of sections        */
  15.   char f_timdat[4];        /* time & date stamp        */
  16.   char f_symptr[4];        /* file pointer to symtab    */
  17.   char f_nsyms[4];        /* number of symtab entries    */
  18.   char f_opthdr[2];        /* sizeof(optional hdr)        */
  19.   char f_flags[2];        /* flags            */
  20. };
  21.  
  22. #define F_RELFLG    (0x0001)    /* relocation info stripped */
  23. #define F_EXEC        (0x0002)    /* file is executable */
  24. #define F_LNNO        (0x0004)    /* line numbers stripped */
  25. #define F_LSYMS        (0x0008)    /* local symbols stripped */
  26.  
  27. #define SPARCMAGIC    (0540)
  28.  
  29. /* This is Lynx's all-platform magic number for executables. */
  30.  
  31. #define LYNXCOFFMAGIC    (0415)
  32.  
  33. #define    FILHDR    struct external_filehdr
  34. #define    FILHSZ    sizeof(FILHDR)
  35.  
  36. /********************** AOUT "OPTIONAL HEADER" **********************/
  37.  
  38. typedef struct 
  39. {
  40.   char magic[2];        /* type of file                */
  41.   char vstamp[2];        /* version stamp            */
  42.   char tsize[4];        /* text size in bytes, padded to FW bdry*/
  43.   char dsize[4];        /* initialized data "  "        */
  44.   char bsize[4];        /* uninitialized data "   "        */
  45.   char entry[4];        /* entry pt.                */
  46.   char text_start[4];        /* base of text used for this file */
  47.   char data_start[4];        /* base of data used for this file */
  48. }
  49. AOUTHDR;
  50.  
  51. #define AOUTSZ (sizeof(AOUTHDR))
  52.  
  53. #define OMAGIC          0404    /* object files, eg as output */
  54. #define ZMAGIC          0413    /* demand load format, eg normal ld output */
  55. #define STMAGIC        0401    /* target shlib */
  56. #define SHMAGIC        0443    /* host   shlib */
  57.  
  58. /********************** SECTION HEADER **********************/
  59.  
  60. struct external_scnhdr
  61. {
  62.   char s_name[8];        /* section name            */
  63.   char s_paddr[4];        /* physical address, aliased s_nlib */
  64.   char s_vaddr[4];        /* virtual address        */
  65.   char s_size[4];        /* section size            */
  66.   char s_scnptr[4];        /* file ptr to raw data for section */
  67.   char s_relptr[4];        /* file ptr to relocation    */
  68.   char s_lnnoptr[4];        /* file ptr to line numbers    */
  69.   char s_nreloc[2];        /* number of relocation entries    */
  70.   char s_nlnno[2];        /* number of line number entries*/
  71.   char s_flags[4];        /* flags            */
  72. };
  73.  
  74. #define    SCNHDR    struct external_scnhdr
  75. #define    SCNHSZ    sizeof(SCNHDR)
  76.  
  77. /* Names of "special" sections. */
  78.  
  79. #define _TEXT    ".text"
  80. #define _DATA    ".data"
  81. #define _BSS    ".bss"
  82. #define _TV    ".tv"
  83. #define _INIT    ".init"
  84. #define _FINI    ".fini"
  85. #define _COMMENT ".comment"
  86. #define _LIB ".lib"
  87.  
  88. /********************** LINE NUMBERS **********************/
  89.  
  90. /* 1 line number entry for every "breakpointable" source line in a section.
  91.    Line numbers are grouped on a per function basis; first entry in a function
  92.    grouping will have l_lnno = 0 and in place of physical address will be the
  93.    symbol table index of the function name. */
  94.  
  95. struct external_lineno
  96. {
  97.   union {
  98.     char l_symndx[4];        /* fn name symbol index, iff l_lnno == 0 */
  99.     char l_paddr[4];        /* (physical) address of line number */
  100.   } l_addr;
  101.   char l_lnno[2];        /* line number */
  102. };
  103.  
  104. #define    LINENO    struct external_lineno
  105. #define    LINESZ    (6)
  106.  
  107. /********************** SYMBOLS **********************/
  108.  
  109. #define E_SYMNMLEN    (8)    /* # characters in a symbol name    */
  110. #define E_FILNMLEN    (14)    /* # characters in a file name        */
  111. #define E_DIMNUM    (4)    /* # array dimensions in auxiliary entry */
  112.  
  113. struct external_syment 
  114. {
  115.   union {
  116.     char e_name[E_SYMNMLEN];
  117.     struct {
  118.       char e_zeroes[4];
  119.       char e_offset[4];
  120.     } e;
  121. #if 0 /* of doubtful value */
  122.     char e_nptr[2][4];
  123.     struct {
  124.       char e_leading_zero[1];
  125.       char e_dbx_type[1];
  126.       char e_dbx_desc[2];
  127.     } e_dbx;
  128. #endif
  129.   } e;
  130.  
  131.   char e_value[4];
  132.   char e_scnum[2];
  133.   char e_type[2];
  134.   char e_sclass[1];
  135.   char e_numaux[1];
  136.   char padding[2];
  137. };
  138.  
  139. #define N_BTMASK    (0xf)
  140. #define N_TMASK        (0x30)
  141. #define N_BTSHFT    (4)
  142. #define N_TSHIFT    (2)
  143.   
  144. union external_auxent
  145. {
  146.   struct {
  147.     char x_tagndx[4];        /* str, un, or enum tag indx */
  148.     union {
  149.       struct {
  150.     char  x_lnno[2];    /* declaration line number */
  151.     char  x_size[2];    /* str/union/array size */
  152.       } x_lnsz;
  153.       char x_fsize[4];        /* size of function */
  154.     } x_misc;
  155.     union {
  156.       struct {            /* if ISFCN, tag, or .bb */
  157.     char x_lnnoptr[4];    /* ptr to fcn line # */
  158.     char x_endndx[4];    /* entry ndx past block end */
  159.       } x_fcn;
  160.       struct {        /* if ISARY, up to 4 dimen. */
  161.     char x_dimen[E_DIMNUM][2];
  162.       } x_ary;
  163.     } x_fcnary;
  164.     char x_tvndx[2];        /* tv index */
  165.   } x_sym;
  166.   
  167.   union {
  168.     char x_fname[E_FILNMLEN];
  169.     struct {
  170.       char x_zeroes[4];
  171.       char x_offset[4];
  172.     } x_n;
  173.   } x_file;
  174.   
  175.   struct {
  176.     char x_scnlen[4];        /* section length */
  177.     char x_nreloc[2];        /* # relocation entries */
  178.     char x_nlinno[2];        /* # line numbers */
  179.   } x_scn;
  180.   
  181.   struct {
  182.     char x_tvfill[4];        /* tv fill value */
  183.     char x_tvlen[2];        /* length of .tv */
  184.     char x_tvran[2][2];        /* tv range */
  185.   } x_tv;            /* .tv section info (in auxent of sym .tv)) */
  186.  
  187.   char x_fill[20];        /* forces to 20-byte size */
  188. };
  189.  
  190. #define    SYMENT    struct external_syment
  191. #define    SYMESZ    20    
  192. #define    AUXENT    union external_auxent
  193. #define    AUXESZ    20
  194.  
  195. #define _ETEXT    "etext"
  196.  
  197. /********************** RELOCATION DIRECTIVES **********************/
  198.  
  199. struct external_reloc {
  200.   char r_vaddr[4];
  201.   char r_symndx[4];
  202.   char r_type[2];
  203.   char r_spare[2];
  204.   char r_offset[4];
  205. };
  206.  
  207. #define RELOC struct external_reloc
  208. #define RELSZ sizeof (RELOC)
  209.  
  210. #define DEFAULT_DATA_SECTION_ALIGNMENT 4
  211. #define DEFAULT_BSS_SECTION_ALIGNMENT 4
  212. #define DEFAULT_TEXT_SECTION_ALIGNMENT 4
  213. /* For new sections we havn't heard of before */
  214. #define DEFAULT_SECTION_ALIGNMENT 4
  215.