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 / m68k.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-28  |  5.4 KB  |  217 lines

  1. /*** coff information for M68K */
  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. /* Motorola 68000/68008/68010/68020 */
  17. #define    MC68MAGIC    0520
  18. #define MC68KWRMAGIC    0520    /* writeable text segments */
  19. #define    MC68TVMAGIC    0521
  20. #define MC68KROMAGIC    0521    /* readonly shareable text segments */
  21. #define MC68KPGMAGIC    0522    /* demand paged text segments */
  22. #define    M68MAGIC    0210
  23. #define    M68TVMAGIC    0211
  24.  
  25. /* this is the magic of the Bull dpx/2 */
  26. #define MC68KBCSMAGIC    0526
  27.  
  28. /* This is Lynx's all-platform magic number for executables. */
  29.  
  30. #define LYNXCOFFMAGIC    0415
  31.  
  32. #define OMAGIC M68MAGIC
  33.  
  34. /* This intentionally does not include MC68KBCSMAGIC; it only includes
  35.    magic numbers which imply that names do not have underscores.  */
  36. #define M68KBADMAG(x) (((x).f_magic!=MC68MAGIC) && ((x).f_magic!=MC68KWRMAGIC) && ((x).f_magic!=MC68TVMAGIC) && \
  37.   ((x).f_magic!=MC68KROMAGIC) && ((x).f_magic!=MC68KPGMAGIC) && ((x).f_magic!=M68MAGIC) && ((x).f_magic!=M68TVMAGIC) && ((x).f_magic!=LYNXCOFFMAGIC) )
  38.  
  39.  
  40. #define    FILHDR    struct external_filehdr
  41. #define    FILHSZ    sizeof(FILHDR)
  42.  
  43.  
  44. /********************** AOUT "OPTIONAL HEADER" **********************/
  45.  
  46.  
  47. typedef struct 
  48. {
  49.   char     magic[2];        /* type of file                */
  50.   char    vstamp[2];        /* version stamp            */
  51.   char    tsize[4];        /* text size in bytes, padded to FW bdry*/
  52.   char    dsize[4];        /* initialized data "  "        */
  53.   char    bsize[4];        /* uninitialized data "   "        */
  54.   char    entry[4];        /* entry pt.                */
  55.   char     text_start[4];        /* base of text used for this file */
  56.   char     data_start[4];        /* base of data used for this file */
  57. }
  58. AOUTHDR;
  59.  
  60. #define AOUTSZ (sizeof(AOUTHDR))
  61.  
  62.  
  63.  
  64. /********************** SECTION HEADER **********************/
  65.  
  66.  
  67. struct external_scnhdr {
  68.     char        s_name[8];    /* section name            */
  69.     char        s_paddr[4];    /* physical address, aliased s_nlib */
  70.     char        s_vaddr[4];    /* virtual address        */
  71.     char        s_size[4];    /* section size            */
  72.     char        s_scnptr[4];    /* file ptr to raw data for section */
  73.     char        s_relptr[4];    /* file ptr to relocation    */
  74.     char        s_lnnoptr[4];    /* file ptr to line numbers    */
  75.     char        s_nreloc[2];    /* number of relocation entries    */
  76.     char        s_nlnno[2];    /* number of line number entries*/
  77.     char        s_flags[4];    /* flags            */
  78. };
  79.  
  80. /*
  81.  * names of "special" sections
  82.  */
  83. #define _TEXT    ".text"
  84. #define _DATA    ".data"
  85. #define _BSS    ".bss"
  86.  
  87.  
  88. #define    SCNHDR    struct external_scnhdr
  89. #define    SCNHSZ    sizeof(SCNHDR)
  90.  
  91.  
  92. /********************** LINE NUMBERS **********************/
  93.  
  94. /* 1 line number entry for every "breakpointable" source line in a section.
  95.  * Line numbers are grouped on a per function basis; first entry in a function
  96.  * grouping will have l_lnno = 0 and in place of physical address will be the
  97.  * symbol table index of the function name.
  98.  */
  99. struct external_lineno {
  100.     union {
  101.         char l_symndx[4];    /* function name symbol index, iff l_lnno == 0*/
  102.         char l_paddr[4];    /* (physical) address of line number    */
  103.     } l_addr;
  104.     char l_lnno[2];    /* line number        */
  105. };
  106.  
  107.  
  108. #define    LINENO    struct external_lineno
  109. #define    LINESZ    sizeof(LINENO) 
  110.  
  111.  
  112. /********************** SYMBOLS **********************/
  113.  
  114. #define E_SYMNMLEN    8    /* # characters in a symbol name    */
  115. #define E_FILNMLEN    14    /* # characters in a file name        */
  116. #define E_DIMNUM    4    /* # array dimensions in auxiliary entry */
  117.  
  118. struct external_syment 
  119. {
  120.   union {
  121.     char e_name[E_SYMNMLEN];
  122.     struct {
  123.       char e_zeroes[4];
  124.       char e_offset[4];
  125.     } e;
  126.   } e;
  127.   char e_value[4];
  128.   char e_scnum[2];
  129.   char e_type[2];
  130.   char e_sclass[1];
  131.   char e_numaux[1];
  132. };
  133.  
  134.  
  135.  
  136. #define N_BTMASK    (017)
  137. #define N_TMASK        (060)
  138. #define N_BTSHFT    (4)
  139. #define N_TSHIFT    (2)
  140.   
  141.  
  142. union external_auxent {
  143.     struct {
  144.         char x_tagndx[4];    /* str, un, or enum tag indx */
  145.         union {
  146.             struct {
  147.                 char  x_lnno[2]; /* declaration line number */
  148.                 char  x_size[2]; /* str/union/array size */
  149.             } x_lnsz;
  150.             char x_fsize[4];    /* size of function */
  151.         } x_misc;
  152.         union {
  153.             struct {        /* if ISFCN, tag, or .bb */
  154.                 char x_lnnoptr[4];    /* ptr to fcn line # */
  155.                 char x_endndx[4];    /* entry ndx past block end */
  156.             } x_fcn;
  157.             struct {        /* if ISARY, up to 4 dimen. */
  158.                 char x_dimen[E_DIMNUM][2];
  159.             } x_ary;
  160.         } x_fcnary;
  161.         char x_tvndx[2];        /* tv index */
  162.     } x_sym;
  163.  
  164.     union {
  165.         char x_fname[E_FILNMLEN];
  166.         struct {
  167.             char x_zeroes[4];
  168.             char x_offset[4];
  169.         } x_n;
  170.     } x_file;
  171.  
  172.     struct {
  173.         char x_scnlen[4];            /* section length */
  174.         char x_nreloc[2];    /* # relocation entries */
  175.         char x_nlinno[2];    /* # line numbers */
  176.     } x_scn;
  177.  
  178.         struct {
  179.         char x_tvfill[4];    /* tv fill value */
  180.         char x_tvlen[2];    /* length of .tv */
  181.         char x_tvran[2][2];    /* tv range */
  182.     } x_tv;        /* info about .tv section (in auxent of symbol .tv)) */
  183.  
  184.  
  185. };
  186.  
  187. #define    SYMENT    struct external_syment
  188. #define    SYMESZ    18    
  189. #define    AUXENT    union external_auxent
  190. #define    AUXESZ    18
  191.  
  192.  
  193.  
  194. /********************** RELOCATION DIRECTIVES **********************/
  195.  
  196.  
  197. struct external_reloc {
  198.   char r_vaddr[4];
  199.   char r_symndx[4];
  200.   char r_type[2];
  201. #ifdef M68K_COFF_OFFSET
  202.   char r_offset[4];
  203. #endif
  204.  
  205. };
  206.  
  207.  
  208. #define RELOC struct external_reloc
  209.  
  210. #define RELSZ sizeof(struct external_reloc)
  211.  
  212. #define DEFAULT_DATA_SECTION_ALIGNMENT 4
  213. #define DEFAULT_BSS_SECTION_ALIGNMENT 4
  214. #define DEFAULT_TEXT_SECTION_ALIGNMENT 4
  215. /* For new sections we havn't heard of before */
  216. #define DEFAULT_SECTION_ALIGNMENT 4
  217.