home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / binutils-2.7-src.tgz / tar.out / fsf / binutils / include / coff / h8300.h < prev    next >
C/C++ Source or Header  |  1996-09-28  |  5KB  |  203 lines

  1. /*** coff information for Hitachi H8/300 and H8/300-H */
  2.  
  3. /********************** FILE HEADER **********************/
  4.  
  5. struct external_filehdr {
  6.     char f_magic[2];    /* magic number            */
  7.     char f_nscns[2];    /* number of sections        */
  8.     char f_timdat[4];    /* time & date stamp        */
  9.     char f_symptr[4];    /* file pointer to symtab    */
  10.     char f_nsyms[4];    /* number of symtab entries    */
  11.     char f_opthdr[2];    /* sizeof(optional hdr)        */
  12.     char f_flags[2];    /* flags            */
  13. };
  14.  
  15.  
  16.  
  17. #define    H8300MAGIC    0x8300
  18. #define    H8300HMAGIC    0x8301
  19.  
  20. #define H8300BADMAG(x) (((x).f_magic!=H8300MAGIC))
  21. #define H8300HBADMAG(x) (((x).f_magic!=H8300HMAGIC))
  22.  
  23. #define    FILHDR    struct external_filehdr
  24. #define    FILHSZ    20
  25.  
  26.  
  27. /********************** AOUT "OPTIONAL HEADER" **********************/
  28.  
  29.  
  30. typedef struct 
  31. {
  32.   char     magic[2];        /* type of file                */
  33.   char    vstamp[2];        /* version stamp            */
  34.   char    tsize[4];        /* text size in bytes, padded to FW bdry*/
  35.   char    dsize[4];        /* initialized data "  "        */
  36.   char    bsize[4];        /* uninitialized data "   "        */
  37.   char    entry[4];        /* entry pt.                */
  38.   char     text_start[4];        /* base of text used for this file */
  39.   char     data_start[4];        /* base of data used for this file */
  40. }
  41. AOUTHDR;
  42.  
  43.  
  44. #define AOUTHDRSZ 28
  45. #define AOUTSZ 28
  46.  
  47.  
  48.  
  49.  
  50. /********************** SECTION HEADER **********************/
  51.  
  52.  
  53. struct external_scnhdr {
  54.     char        s_name[8];    /* section name            */
  55.     char        s_paddr[4];    /* physical address, aliased s_nlib */
  56.     char        s_vaddr[4];    /* virtual address        */
  57.     char        s_size[4];    /* section size            */
  58.     char        s_scnptr[4];    /* file ptr to raw data for section */
  59.     char        s_relptr[4];    /* file ptr to relocation    */
  60.     char        s_lnnoptr[4];    /* file ptr to line numbers    */
  61.     char        s_nreloc[2];    /* number of relocation entries    */
  62.     char        s_nlnno[2];    /* number of line number entries*/
  63.     char        s_flags[4];    /* flags            */
  64. };
  65.  
  66. /*
  67.  * names of "special" sections
  68.  */
  69. #define _TEXT    ".text"
  70. #define _DATA    ".data"
  71. #define _BSS    ".bss"
  72.  
  73.  
  74. #define    SCNHDR    struct external_scnhdr
  75. #define    SCNHSZ    40
  76.  
  77.  
  78. /********************** LINE NUMBERS **********************/
  79.  
  80. /* 1 line number entry for every "breakpointable" source line in a section.
  81.  * Line numbers are grouped on a per function basis; first entry in a function
  82.  * grouping will have l_lnno = 0 and in place of physical address will be the
  83.  * symbol table index of the function name.
  84.  */
  85. struct external_lineno {
  86.     union {
  87.         char l_symndx[4];    /* function name symbol index, iff l_lnno == 0*/
  88.         char l_paddr[4];    /* (physical) address of line number    */
  89.     } l_addr;
  90.     char l_lnno[4];    /* line number        */
  91. };
  92.  
  93. #define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno));
  94. #define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_32(abfd,val,  (bfd_byte *) (ext->l_lnno));
  95.  
  96. #define    LINENO    struct external_lineno
  97. #define    LINESZ    8
  98.  
  99.  
  100. /********************** SYMBOLS **********************/
  101.  
  102. #define E_SYMNMLEN    8    /* # characters in a symbol name    */
  103. #define E_FILNMLEN    14    /* # characters in a file name        */
  104. #define E_DIMNUM    4    /* # array dimensions in auxiliary entry */
  105.  
  106. struct external_syment 
  107. {
  108.   union {
  109.     char e_name[E_SYMNMLEN];
  110.     struct {
  111.       char e_zeroes[4];
  112.       char e_offset[4];
  113.     } e;
  114.   } e;
  115.   char e_value[4];
  116.   char e_scnum[2];
  117.   char e_type[2];
  118.   char e_sclass[1];
  119.   char e_numaux[1];
  120. };
  121.  
  122.  
  123.  
  124. #define N_BTMASK    (017)
  125. #define N_TMASK        (060)
  126. #define N_BTSHFT    (4)
  127. #define N_TSHIFT    (2)
  128.   
  129.  
  130. union external_auxent {
  131.     struct {
  132.         char x_tagndx[4];    /* str, un, or enum tag indx */
  133.         union {
  134.             struct {
  135.                 char  x_lnno[2]; /* declaration line number */
  136.                 char  x_size[2]; /* str/union/array size */
  137.             } x_lnsz;
  138.             char x_fsize[4];    /* size of function */
  139.         } x_misc;
  140.         union {
  141.             struct {        /* if ISFCN, tag, or .bb */
  142.                 char x_lnnoptr[4];    /* ptr to fcn line # */
  143.                 char x_endndx[4];    /* entry ndx past block end */
  144.             } x_fcn;
  145.             struct {        /* if ISARY, up to 4 dimen. */
  146.                 char x_dimen[E_DIMNUM][2];
  147.             } x_ary;
  148.         } x_fcnary;
  149.         char x_tvndx[2];        /* tv index */
  150.     } x_sym;
  151.  
  152.     union {
  153.         char x_fname[E_FILNMLEN];
  154.         struct {
  155.             char x_zeroes[4];
  156.             char x_offset[4];
  157.         } x_n;
  158.     } x_file;
  159.  
  160.     struct {
  161.         char x_scnlen[4];            /* section length */
  162.         char x_nreloc[2];    /* # relocation entries */
  163.         char x_nlinno[2];    /* # line numbers */
  164.     } x_scn;
  165.  
  166.         struct {
  167.         char x_tvfill[4];    /* tv fill value */
  168.         char x_tvlen[2];    /* length of .tv */
  169.         char x_tvran[2][2];    /* tv range */
  170.     } x_tv;        /* info about .tv section (in auxent of symbol .tv)) */
  171.  
  172.  
  173. };
  174.  
  175. #define    SYMENT    struct external_syment
  176. #define    SYMESZ    18    
  177. #define    AUXENT    union external_auxent
  178. #define    AUXESZ    18
  179.  
  180.  
  181.  
  182. /********************** RELOCATION DIRECTIVES **********************/
  183.  
  184. /* The external reloc has an offset field, because some of the reloc
  185.    types on the h8 don't have room in the instruction for the entire
  186.    offset - eg the strange jump and high page addressing modes */
  187.  
  188. struct external_reloc {
  189.   char r_vaddr[4];
  190.   char r_symndx[4];
  191.   char r_offset[4];
  192.   char r_type[2];
  193.   char r_stuff[2];
  194. };
  195.  
  196.  
  197. #define RELOC struct external_reloc
  198. #define RELSZ 16
  199.  
  200.  
  201.  
  202.  
  203.