1 /* ECOFF support on Alpha machines.
2 coff/ecoff.h must be included before this file. */
4 /********************** FILE HEADER **********************/
6 struct external_filehdr
{
7 unsigned char f_magic
[2]; /* magic number */
8 unsigned char f_nscns
[2]; /* number of sections */
9 unsigned char f_timdat
[4]; /* time & date stamp */
10 unsigned char f_symptr
[8]; /* file pointer to symtab */
11 unsigned char f_nsyms
[4]; /* number of symtab entries */
12 unsigned char f_opthdr
[2]; /* sizeof(optional hdr) */
13 unsigned char f_flags
[2]; /* flags */
16 /* Magic numbers are defined in coff/ecoff.h. */
17 #define ALPHA_ECOFF_BADMAG(x) ((x).f_magic!=ALPHA_MAGIC)
19 #define FILHDR struct external_filehdr
20 #define FILHSZ sizeof(FILHDR)
22 /********************** AOUT "OPTIONAL HEADER" **********************/
25 typedef struct external_aouthdr
27 unsigned char magic
[2]; /* type of file */
28 unsigned char vstamp
[2]; /* version stamp */
29 unsigned char tsize
[8]; /* text size in bytes, padded to FW bdry*/
30 unsigned char dsize
[8]; /* initialized data " " */
31 unsigned char bsize
[8]; /* uninitialized data " " */
32 unsigned char entry
[8]; /* entry pt. */
33 unsigned char text_start
[8]; /* base of text used for this file */
34 unsigned char data_start
[8]; /* base of data used for this file */
35 unsigned char bss_start
[8]; /* base of bss used for this file */
36 unsigned char gprmask
[4]; /* ?? */
37 unsigned char cprmask
[4][8]; /* ?? */
38 unsigned char gp_value
[4]; /* value for gp register */
41 /* compute size of a header */
43 #define AOUTSZ (sizeof(AOUTHDR))
45 /********************** SECTION HEADER **********************/
47 struct external_scnhdr
{
48 unsigned char s_name
[8]; /* section name */
49 unsigned char s_paddr
[8]; /* physical address, aliased s_nlib */
50 unsigned char s_vaddr
[8]; /* virtual address */
51 unsigned char s_size
[8]; /* section size */
52 unsigned char s_scnptr
[8]; /* file ptr to raw data for section */
53 unsigned char s_relptr
[8]; /* file ptr to relocation */
54 unsigned char s_lnnoptr
[8]; /* file ptr to line numbers */
55 unsigned char s_nreloc
[2]; /* number of relocation entries */
56 unsigned char s_nlnno
[2]; /* number of line number entries*/
57 unsigned char s_flags
[4]; /* flags */
60 #define SCNHDR struct external_scnhdr
61 #define SCNHSZ sizeof(SCNHDR)
63 /********************** RELOCATION DIRECTIVES **********************/
65 struct external_reloc
{
66 unsigned char r_vaddr
[8];
67 unsigned char r_bits
[4];
70 #define RELOC struct external_reloc
73 /* MIPS ECOFF uses a packed 8 byte format for relocs. These constants
74 are used to unpack the r_bits field. */
76 #define RELOC_BITS0_SYMNDX_SH_LEFT_BIG 16
77 #define RELOC_BITS0_SYMNDX_SH_LEFT_LITTLE 0
79 #define RELOC_BITS1_SYMNDX_SH_LEFT_BIG 8
80 #define RELOC_BITS1_SYMNDX_SH_LEFT_LITTLE 8
82 #define RELOC_BITS2_SYMNDX_SH_LEFT_BIG 0
83 #define RELOC_BITS2_SYMNDX_SH_LEFT_LITTLE 16
85 #define RELOC_BITS3_TYPE_BIG 0x1E
86 #define RELOC_BITS3_TYPE_SH_BIG 1
87 #define RELOC_BITS3_TYPE_LITTLE 0x78
88 #define RELOC_BITS3_TYPE_SH_LITTLE 3
90 #define RELOC_BITS3_EXTERN_BIG 0x01
91 #define RELOC_BITS3_EXTERN_LITTLE 0x80
93 #define DEFAULT_DATA_SECTION_ALIGNMENT 16
94 #define DEFAULT_BSS_SECTION_ALIGNMENT 16
95 #define DEFAULT_TEXT_SECTION_ALIGNMENT 16
96 /* For new sections we havn't heard of before */
97 #define DEFAULT_SECTION_ALIGNMENT 16
99 /********************** SYMBOLIC INFORMATION **********************/
101 /* Written by John Gilmore. */
103 /* ECOFF uses COFF-like section structures, but its own symbol format.
104 This file defines the symbol format in fields whose size and alignment
105 will not vary on different host systems. */
107 /* File header as a set of bytes */
110 unsigned char h_magic
[2];
111 unsigned char h_vstamp
[2];
112 unsigned char h_ilineMax
[4];
113 unsigned char h_cbLine
[4];
114 unsigned char h_cbLineOffset
[4];
115 unsigned char h_idnMax
[4];
116 unsigned char h_cbDnOffset
[4];
117 unsigned char h_ipdMax
[4];
118 unsigned char h_cbPdOffset
[4];
119 unsigned char h_isymMax
[4];
120 unsigned char h_cbSymOffset
[4];
121 unsigned char h_ioptMax
[4];
122 unsigned char h_cbOptOffset
[4];
123 unsigned char h_iauxMax
[4];
124 unsigned char h_cbAuxOffset
[4];
125 unsigned char h_issMax
[4];
126 unsigned char h_cbSsOffset
[4];
127 unsigned char h_issExtMax
[4];
128 unsigned char h_cbSsExtOffset
[4];
129 unsigned char h_ifdMax
[4];
130 unsigned char h_cbFdOffset
[4];
131 unsigned char h_crfd
[4];
132 unsigned char h_cbRfdOffset
[4];
133 unsigned char h_iextMax
[4];
134 unsigned char h_cbExtOffset
[4];
137 /* File descriptor external record */
140 unsigned char f_adr
[4];
141 unsigned char f_rss
[4];
142 unsigned char f_issBase
[4];
143 unsigned char f_cbSs
[4];
144 unsigned char f_isymBase
[4];
145 unsigned char f_csym
[4];
146 unsigned char f_ilineBase
[4];
147 unsigned char f_cline
[4];
148 unsigned char f_ioptBase
[4];
149 unsigned char f_copt
[4];
150 unsigned char f_ipdFirst
[2];
151 unsigned char f_cpd
[2];
152 unsigned char f_iauxBase
[4];
153 unsigned char f_caux
[4];
154 unsigned char f_rfdBase
[4];
155 unsigned char f_crfd
[4];
156 unsigned char f_bits1
[1];
157 unsigned char f_bits2
[3];
158 unsigned char f_cbLineOffset
[4];
159 unsigned char f_cbLine
[4];
162 #define FDR_BITS1_LANG_BIG 0xF8
163 #define FDR_BITS1_LANG_SH_BIG 3
164 #define FDR_BITS1_LANG_LITTLE 0x1F
165 #define FDR_BITS1_LANG_SH_LITTLE 0
167 #define FDR_BITS1_FMERGE_BIG 0x04
168 #define FDR_BITS1_FMERGE_LITTLE 0x20
170 #define FDR_BITS1_FREADIN_BIG 0x02
171 #define FDR_BITS1_FREADIN_LITTLE 0x40
173 #define FDR_BITS1_FBIGENDIAN_BIG 0x01
174 #define FDR_BITS1_FBIGENDIAN_LITTLE 0x80
176 #define FDR_BITS2_GLEVEL_BIG 0xC0
177 #define FDR_BITS2_GLEVEL_SH_BIG 6
178 #define FDR_BITS2_GLEVEL_LITTLE 0x03
179 #define FDR_BITS2_GLEVEL_SH_LITTLE 0
181 /* We ignore the `reserved' field in bits2. */
183 /* Procedure descriptor external record */
186 unsigned char p_adr
[4];
187 unsigned char p_isym
[4];
188 unsigned char p_iline
[4];
189 unsigned char p_regmask
[4];
190 unsigned char p_regoffset
[4];
191 unsigned char p_iopt
[4];
192 unsigned char p_fregmask
[4];
193 unsigned char p_fregoffset
[4];
194 unsigned char p_frameoffset
[4];
195 unsigned char p_framereg
[2];
196 unsigned char p_pcreg
[2];
197 unsigned char p_lnLow
[4];
198 unsigned char p_lnHigh
[4];
199 unsigned char p_cbLineOffset
[4];
205 unsigned char l_line
[4];
208 /* Symbol external record */
211 unsigned char s_iss
[4];
212 unsigned char s_value
[4];
213 unsigned char s_bits1
[1];
214 unsigned char s_bits2
[1];
215 unsigned char s_bits3
[1];
216 unsigned char s_bits4
[1];
219 #define SYM_BITS1_ST_BIG 0xFC
220 #define SYM_BITS1_ST_SH_BIG 2
221 #define SYM_BITS1_ST_LITTLE 0x3F
222 #define SYM_BITS1_ST_SH_LITTLE 0
224 #define SYM_BITS1_SC_BIG 0x03
225 #define SYM_BITS1_SC_SH_LEFT_BIG 3
226 #define SYM_BITS1_SC_LITTLE 0xC0
227 #define SYM_BITS1_SC_SH_LITTLE 6
229 #define SYM_BITS2_SC_BIG 0xE0
230 #define SYM_BITS2_SC_SH_BIG 5
231 #define SYM_BITS2_SC_LITTLE 0x07
232 #define SYM_BITS2_SC_SH_LEFT_LITTLE 2
234 #define SYM_BITS2_RESERVED_BIG 0x10
235 #define SYM_BITS2_RESERVED_LITTLE 0x08
237 #define SYM_BITS2_INDEX_BIG 0x0F
238 #define SYM_BITS2_INDEX_SH_LEFT_BIG 16
239 #define SYM_BITS2_INDEX_LITTLE 0xF0
240 #define SYM_BITS2_INDEX_SH_LITTLE 4
242 #define SYM_BITS3_INDEX_SH_LEFT_BIG 8
243 #define SYM_BITS3_INDEX_SH_LEFT_LITTLE 4
245 #define SYM_BITS4_INDEX_SH_LEFT_BIG 0
246 #define SYM_BITS4_INDEX_SH_LEFT_LITTLE 12
248 /* External symbol external record */
251 unsigned char es_bits1
[1];
252 unsigned char es_bits2
[1];
253 unsigned char es_ifd
[2];
254 struct sym_ext es_asym
;
257 #define EXT_BITS1_JMPTBL_BIG 0x80
258 #define EXT_BITS1_JMPTBL_LITTLE 0x01
260 #define EXT_BITS1_COBOL_MAIN_BIG 0x40
261 #define EXT_BITS1_COBOL_MAIN_LITTLE 0x02
263 #define EXT_BITS1_WEAKEXT_BIG 0x20
264 #define EXT_BITS1_WEAKEXT_LITTLE 0x04
266 /* Dense numbers external record */
269 unsigned char d_rfd
[4];
270 unsigned char d_index
[4];
273 /* Relative file descriptor */
276 unsigned char rfd
[4];
279 /* Optimizer symbol external record */
282 unsigned char o_bits1
[1];
283 unsigned char o_bits2
[1];
284 unsigned char o_bits3
[1];
285 unsigned char o_bits4
[1];
286 struct rndx_ext o_rndx
;
287 unsigned char o_offset
[4];
290 #define OPT_BITS2_VALUE_SH_LEFT_BIG 16
291 #define OPT_BITS2_VALUE_SH_LEFT_LITTLE 0
293 #define OPT_BITS3_VALUE_SH_LEFT_BIG 8
294 #define OPT_BITS3_VALUE_SH_LEFT_LITTLE 8
296 #define OPT_BITS4_VALUE_SH_LEFT_BIG 0
297 #define OPT_BITS4_VALUE_SH_LEFT_LITTLE 16
This page took 0.035763 seconds and 4 git commands to generate.