rs6k64.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. /* IBM RS/6000 "XCOFF64" file definitions for BFD.
  2. Copyright (C) 2000-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. /********************** FILE HEADER **********************/
  16. struct external_filehdr
  17. {
  18. char f_magic[2]; /* magic number */
  19. char f_nscns[2]; /* number of sections */
  20. char f_timdat[4]; /* time & date stamp */
  21. char f_symptr[8]; /* file pointer to symtab */
  22. char f_opthdr[2]; /* sizeof(optional hdr) */
  23. char f_flags[2]; /* flags */
  24. char f_nsyms[4]; /* number of symtab entries */
  25. };
  26. /* IBM RS/6000. */
  27. #define U803XTOCMAGIC 0757 /* Aix 4.3 64-bit XCOFF */
  28. #define U64_TOCMAGIC 0767 /* AIX 5+ 64-bit XCOFF */
  29. #define BADMAG(x) ((x).f_magic != U803XTOCMAGIC && (x).f_magic != U64_TOCMAGIC)
  30. #define FILHDR struct external_filehdr
  31. #define FILHSZ 24
  32. /********************** AOUT "OPTIONAL HEADER" **********************/
  33. typedef struct
  34. {
  35. unsigned char magic[2]; /* type of file */
  36. unsigned char vstamp[2]; /* version stamp */
  37. unsigned char o_debugger[4]; /* reserved */
  38. unsigned char text_start[8]; /* base of text used for this file */
  39. unsigned char data_start[8]; /* base of data used for this file */
  40. unsigned char o_toc[8]; /* address of TOC */
  41. unsigned char o_snentry[2]; /* section number of entry point */
  42. unsigned char o_sntext[2]; /* section number of .text section */
  43. unsigned char o_sndata[2]; /* section number of .data section */
  44. unsigned char o_sntoc[2]; /* section number of TOC */
  45. unsigned char o_snloader[2]; /* section number of .loader section */
  46. unsigned char o_snbss[2]; /* section number of .bss section */
  47. unsigned char o_algntext[2]; /* .text alignment */
  48. unsigned char o_algndata[2]; /* .data alignment */
  49. unsigned char o_modtype[2]; /* module type (??) */
  50. unsigned char o_cputype[2]; /* cpu type */
  51. unsigned char o_resv2[4]; /* reserved */
  52. unsigned char tsize[8]; /* text size bytes, padded to FW bdry */
  53. unsigned char dsize[8]; /* initialized data " " */
  54. unsigned char bsize[8]; /* uninitialized data " " */
  55. unsigned char entry[8]; /* entry pt. */
  56. unsigned char o_maxstack[8]; /* max stack size (??) */
  57. unsigned char o_maxdata[8]; /* max data size (??) */
  58. unsigned char o_resv3[16]; /* reserved */
  59. }
  60. AOUTHDR;
  61. #define AOUTSZ 120
  62. #define SMALL_AOUTSZ (0)
  63. #define AOUTHDRSZ 72
  64. /********************** SECTION HEADER **********************/
  65. struct external_scnhdr
  66. {
  67. char s_name[8]; /* section name */
  68. char s_paddr[8]; /* physical address, aliased s_nlib */
  69. char s_vaddr[8]; /* virtual address */
  70. char s_size[8]; /* section size */
  71. char s_scnptr[8]; /* file ptr to raw data for section */
  72. char s_relptr[8]; /* file ptr to relocation */
  73. char s_lnnoptr[8]; /* file ptr to line numbers */
  74. char s_nreloc[4]; /* number of relocation entries */
  75. char s_nlnno[4]; /* number of line number entries*/
  76. char s_flags[4]; /* flags */
  77. char s_pad[4]; /* padding */
  78. };
  79. #define SCNHDR struct external_scnhdr
  80. #define SCNHSZ 72
  81. /********************** LINE NUMBERS **********************/
  82. /* 1 line number entry for every "breakpointable" source line in a section.
  83. Line numbers are grouped on a per function basis; first entry in a function
  84. grouping will have l_lnno = 0 and in place of physical address will be the
  85. symbol table index of the function name. */
  86. struct external_lineno
  87. {
  88. union
  89. {
  90. char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
  91. char l_paddr[8]; /* (physical) address of line number */
  92. } l_addr;
  93. char l_lnno[4]; /* line number */
  94. };
  95. #define LINENO struct external_lineno
  96. #define LINESZ 12
  97. /********************** SYMBOLS **********************/
  98. #define E_SYMNMLEN 8 /* # characters in a symbol name */
  99. #define E_FILNMLEN 14 /* # characters in a file name */
  100. #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
  101. struct external_syment
  102. {
  103. char e_value[8];
  104. char e_offset[4];
  105. char e_scnum[2];
  106. char e_type[2];
  107. char e_sclass[1];
  108. char e_numaux[1];
  109. };
  110. #define N_BTMASK (017)
  111. #define N_TMASK (060)
  112. #define N_BTSHFT (4)
  113. #define N_TSHIFT (2)
  114. union external_auxent
  115. {
  116. struct {
  117. union {
  118. struct {
  119. char x_lnno[4]; /* declaration line number */
  120. char x_size[2]; /* str/union/array size */
  121. } x_lnsz;
  122. struct {
  123. char x_lnnoptr[8];/* ptr to fcn line */
  124. char x_fsize[4]; /* size of function */
  125. char x_endndx[4]; /* entry ndx past block end */
  126. } x_fcn;
  127. } x_fcnary;
  128. } x_sym;
  129. struct {
  130. union {
  131. char x_fname[E_FILNMLEN];
  132. struct {
  133. char x_zeroes[4];
  134. char x_offset[4];
  135. char x_pad[6];
  136. } x_n;
  137. } x_n;
  138. unsigned char x_ftype[1];
  139. unsigned char x_resv[2];
  140. } x_file;
  141. struct {
  142. char x_exptr[8];
  143. char x_fsize[4];
  144. char x_endndx[4];
  145. char x_pad[1];
  146. } x_except;
  147. struct {
  148. unsigned char x_scnlen_lo[4];
  149. unsigned char x_parmhash[4];
  150. unsigned char x_snhash[2];
  151. unsigned char x_smtyp[1];
  152. unsigned char x_smclas[1];
  153. unsigned char x_scnlen_hi[4];
  154. unsigned char x_pad[1];
  155. } x_csect;
  156. struct {
  157. char x_pad[17];
  158. char x_auxtype[1];
  159. } x_auxtype;
  160. };
  161. #define SYMENT struct external_syment
  162. #define SYMESZ 18
  163. #define AUXENT union external_auxent
  164. #define AUXESZ 18
  165. #define DBXMASK 0x80 /* for dbx storage mask */
  166. #define SYMNAME_IN_DEBUG(symptr) ((symptr)->n_sclass & DBXMASK)
  167. /* Values for auxtype field in XCOFF64, taken from AIX 4.3 sym.h. */
  168. #define _AUX_EXCEPT 255
  169. #define _AUX_FCN 254
  170. #define _AUX_SYM 253
  171. #define _AUX_FILE 252
  172. #define _AUX_CSECT 251
  173. /********************** RELOCATION DIRECTIVES **********************/
  174. struct external_reloc
  175. {
  176. char r_vaddr[8];
  177. char r_symndx[4];
  178. char r_size[1];
  179. char r_type[1];
  180. };
  181. #define RELOC struct external_reloc
  182. #define RELSZ 14
  183. #define DEFAULT_DATA_SECTION_ALIGNMENT 4
  184. #define DEFAULT_BSS_SECTION_ALIGNMENT 4
  185. #define DEFAULT_TEXT_SECTION_ALIGNMENT 4
  186. /* For new sections we havn't heard of before */
  187. #define DEFAULT_SECTION_ALIGNMENT 4
  188. /* The ldhdr structure. This appears at the start of the .loader
  189. section. */
  190. struct external_ldhdr
  191. {
  192. bfd_byte l_version[4];
  193. bfd_byte l_nsyms[4];
  194. bfd_byte l_nreloc[4];
  195. bfd_byte l_istlen[4];
  196. bfd_byte l_nimpid[4];
  197. bfd_byte l_stlen[4];
  198. bfd_byte l_impoff[8];
  199. bfd_byte l_stoff[8];
  200. bfd_byte l_symoff[8];
  201. bfd_byte l_rldoff[8];
  202. };
  203. #define LDHDRSZ (56)
  204. struct external_ldsym
  205. {
  206. bfd_byte l_value[8];
  207. bfd_byte l_offset[4];
  208. bfd_byte l_scnum[2];
  209. bfd_byte l_smtype[1];
  210. bfd_byte l_smclas[1];
  211. bfd_byte l_ifile[4];
  212. bfd_byte l_parm[4];
  213. };
  214. #define LDSYMSZ (24)
  215. struct external_ldrel
  216. {
  217. bfd_byte l_vaddr[8];
  218. bfd_byte l_rtype[2];
  219. bfd_byte l_rsecnm[2];
  220. bfd_byte l_symndx[4];
  221. };
  222. #define LDRELSZ (16)
  223. struct external_exceptab
  224. {
  225. union {
  226. bfd_byte e_symndx[4];
  227. bfd_byte e_paddr[8];
  228. } e_addr;
  229. bfd_byte e_lang[1];
  230. bfd_byte e_reason[1];
  231. };
  232. #define EXCEPTSZ (10)