m88k.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /* coff information for 88k bcs
  2. Copyright (C) 2001-2015 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  14. MA 02110-1301, USA. */
  15. #define DO_NOT_DEFINE_SCNHDR
  16. #define L_LNNO_SIZE 4
  17. #define DO_NOT_DEFINE_SYMENT
  18. #define DO_NOT_DEFINE_AUXENT
  19. #include "coff/external.h"
  20. #define MC88MAGIC 0540 /* 88k BCS executable */
  21. #define MC88DMAGIC 0541 /* DG/UX executable */
  22. #define MC88OMAGIC 0555 /* Object file */
  23. #define MC88BADMAG(x) (((x).f_magic != MC88MAGIC) \
  24. && ((x).f_magic != MC88DMAGIC) \
  25. && ((x).f_magic != MC88OMAGIC))
  26. #define PAGEMAGIC3 0414 /* Split i&d, zero mapped */
  27. #define PAGEMAGICBCS 0413
  28. /********************** SECTION HEADER **********************/
  29. struct external_scnhdr
  30. {
  31. char s_name[8]; /* section name */
  32. char s_paddr[4]; /* physical address, aliased s_nlib */
  33. char s_vaddr[4]; /* virtual address */
  34. char s_size[4]; /* section size */
  35. char s_scnptr[4]; /* file ptr to raw data for section */
  36. char s_relptr[4]; /* file ptr to relocation */
  37. char s_lnnoptr[4]; /* file ptr to line numbers */
  38. char s_nreloc[4]; /* number of relocation entries */
  39. char s_nlnno[4]; /* number of line number entries*/
  40. char s_flags[4]; /* flags */
  41. };
  42. #define SCNHDR struct external_scnhdr
  43. #define SCNHSZ 44
  44. /* Names of "special" sections. */
  45. #define _TEXT ".text"
  46. #define _DATA ".data"
  47. #define _BSS ".bss"
  48. #define _COMMENT ".comment"
  49. /********************** SYMBOLS **********************/
  50. #define E_SYMNMLEN 8 /* # characters in a symbol name */
  51. #define E_FILNMLEN 14 /* # characters in a file name */
  52. #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
  53. struct external_syment
  54. {
  55. union
  56. {
  57. char e_name[E_SYMNMLEN];
  58. struct
  59. {
  60. char e_zeroes[4];
  61. char e_offset[4];
  62. } e;
  63. } e;
  64. char e_value[4];
  65. char e_scnum[2];
  66. char e_type[2];
  67. char e_sclass[1];
  68. char e_numaux[1];
  69. char pad2[2];
  70. };
  71. #define N_BTMASK 017
  72. #define N_TMASK 060
  73. #define N_BTSHFT 4
  74. #define N_TSHIFT 2
  75. /* Note that this isn't the same shape as other coffs */
  76. union external_auxent
  77. {
  78. struct
  79. {
  80. char x_tagndx[4]; /* str, un, or enum tag indx */
  81. /* 4 */
  82. union
  83. {
  84. char x_fsize[4]; /* size of function */
  85. struct
  86. {
  87. char x_lnno[4]; /* declaration line number */
  88. char x_size[4]; /* str/union/array size */
  89. } x_lnsz;
  90. } x_misc;
  91. /* 12 */
  92. union
  93. {
  94. struct /* if ISFCN, tag, or .bb */
  95. {
  96. char x_lnnoptr[4]; /* ptr to fcn line # */
  97. char x_endndx[4]; /* entry ndx past block end */
  98. } x_fcn;
  99. struct /* if ISARY, up to 4 dimen. */
  100. {
  101. char x_dimen[E_DIMNUM][2];
  102. } x_ary;
  103. } x_fcnary;
  104. /* 20 */
  105. } x_sym;
  106. union
  107. {
  108. char x_fname[E_FILNMLEN];
  109. struct
  110. {
  111. char x_zeroes[4];
  112. char x_offset[4];
  113. } x_n;
  114. } x_file;
  115. struct
  116. {
  117. char x_scnlen[4]; /* section length */
  118. char x_nreloc[4]; /* # relocation entries */
  119. char x_nlinno[4]; /* # line numbers */
  120. } x_scn;
  121. struct
  122. {
  123. char x_tvfill[4]; /* tv fill value */
  124. char x_tvlen[2]; /* length of .tv */
  125. char x_tvran[2][2]; /* tv range */
  126. } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
  127. };
  128. #define GET_LNSZ_SIZE(abfd, ext) \
  129. H_GET_32 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
  130. #define GET_LNSZ_LNNO(abfd, ext) \
  131. H_GET_32 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
  132. #define PUT_LNSZ_LNNO(abfd, in, ext) \
  133. H_PUT_32 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
  134. #define PUT_LNSZ_SIZE(abfd, in, ext) \
  135. H_PUT_32 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
  136. #define GET_SCN_NRELOC(abfd, ext) \
  137. H_GET_32 (abfd, ext->x_scn.x_nreloc)
  138. #define GET_SCN_NLINNO(abfd, ext) \
  139. H_GET_32 (abfd, ext->x_scn.x_nlinno)
  140. #define PUT_SCN_NRELOC(abfd, in, ext) \
  141. H_PUT_32 (abfd, in, ext->x_scn.x_nreloc)
  142. #define PUT_SCN_NLINNO(abfd, in, ext) \
  143. H_PUT_32 (abfd,in, ext->x_scn.x_nlinno)
  144. #define SYMENT struct external_syment
  145. #define SYMESZ 20
  146. #define AUXENT union external_auxent
  147. #define AUXESZ 20
  148. /********************** RELOCATION DIRECTIVES **********************/
  149. struct external_reloc
  150. {
  151. char r_vaddr[4];
  152. char r_symndx[4];
  153. char r_type[2];
  154. char r_offset[2];
  155. };
  156. #define RELOC struct external_reloc
  157. #define RELSZ 12
  158. #define NO_TVNDX