remove DEFAULT_* defines
[deliverable/binutils-gdb.git] / include / coff / mips.h
1 /* ECOFF support on MIPS machines.
2 coff/ecoff.h must be included before this file. */
3
4 /********************** FILE HEADER **********************/
5
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[4]; /* 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 */
14 };
15
16 /* Magic numbers are defined in coff/ecoff.h. */
17 #define MIPS_ECOFF_BADMAG(x) (((x).f_magic!=MIPS_MAGIC_1) && \
18 ((x).f_magic!=MIPS_MAGIC_LITTLE) &&\
19 ((x).f_magic!=MIPS_MAGIC_BIG) && \
20 ((x).f_magic!=MIPS_MAGIC_LITTLE2) && \
21 ((x).f_magic!=MIPS_MAGIC_BIG2) && \
22 ((x).f_magic!=MIPS_MAGIC_LITTLE3) && \
23 ((x).f_magic!=MIPS_MAGIC_BIG3))
24
25 #define FILHDR struct external_filehdr
26 #define FILHSZ 20
27
28 /********************** AOUT "OPTIONAL HEADER" **********************/
29
30
31 typedef struct external_aouthdr
32 {
33 unsigned char magic[2]; /* type of file */
34 unsigned char vstamp[2]; /* version stamp */
35 unsigned char tsize[4]; /* text size in bytes, padded to FW bdry*/
36 unsigned char dsize[4]; /* initialized data " " */
37 unsigned char bsize[4]; /* uninitialized data " " */
38 unsigned char entry[4]; /* entry pt. */
39 unsigned char text_start[4]; /* base of text used for this file */
40 unsigned char data_start[4]; /* base of data used for this file */
41 unsigned char bss_start[4]; /* base of bss used for this file */
42 unsigned char gprmask[4]; /* ?? */
43 unsigned char cprmask[4][4]; /* ?? */
44 unsigned char gp_value[4]; /* value for gp register */
45 } AOUTHDR;
46
47 /* compute size of a header */
48
49 #define AOUTSZ (sizeof(AOUTHDR))
50
51 /********************** SECTION HEADER **********************/
52
53 struct external_scnhdr {
54 unsigned char s_name[8]; /* section name */
55 unsigned char s_paddr[4]; /* physical address, aliased s_nlib */
56 unsigned char s_vaddr[4]; /* virtual address */
57 unsigned char s_size[4]; /* section size */
58 unsigned char s_scnptr[4]; /* file ptr to raw data for section */
59 unsigned char s_relptr[4]; /* file ptr to relocation */
60 unsigned char s_lnnoptr[4]; /* file ptr to line numbers */
61 unsigned char s_nreloc[2]; /* number of relocation entries */
62 unsigned char s_nlnno[2]; /* number of line number entries*/
63 unsigned char s_flags[4]; /* flags */
64 };
65
66 #define SCNHDR struct external_scnhdr
67 #define SCNHSZ sizeof(SCNHDR)
68
69 /********************** RELOCATION DIRECTIVES **********************/
70
71 struct external_reloc {
72 unsigned char r_vaddr[4];
73 unsigned char r_bits[4];
74 };
75
76 #define RELOC struct external_reloc
77 #define RELSZ 8
78
79 /* MIPS ECOFF uses a packed 8 byte format for relocs. These constants
80 are used to unpack the r_bits field. */
81
82 #define RELOC_BITS0_SYMNDX_SH_LEFT_BIG 16
83 #define RELOC_BITS0_SYMNDX_SH_LEFT_LITTLE 0
84
85 #define RELOC_BITS1_SYMNDX_SH_LEFT_BIG 8
86 #define RELOC_BITS1_SYMNDX_SH_LEFT_LITTLE 8
87
88 #define RELOC_BITS2_SYMNDX_SH_LEFT_BIG 0
89 #define RELOC_BITS2_SYMNDX_SH_LEFT_LITTLE 16
90
91 #define RELOC_BITS3_TYPE_BIG 0x1E
92 #define RELOC_BITS3_TYPE_SH_BIG 1
93 #define RELOC_BITS3_TYPE_LITTLE 0x78
94 #define RELOC_BITS3_TYPE_SH_LITTLE 3
95
96 #define RELOC_BITS3_EXTERN_BIG 0x01
97 #define RELOC_BITS3_EXTERN_LITTLE 0x80
98
99 /* The r_type field in a reloc is one of the following values. I
100 don't know if any other values can appear. These seem to be all
101 that occur in the Ultrix 4.2 libraries. */
102 #define MIPS_R_IGNORE 0
103 #define MIPS_R_REFHALF 1
104 #define MIPS_R_REFWORD 2
105 #define MIPS_R_JMPADDR 3
106 #define MIPS_R_REFHI 4
107 #define MIPS_R_REFLO 5
108 #define MIPS_R_GPREL 6
109 #define MIPS_R_LITERAL 7
110
111 /* This reloc type is a Cygnus extension used when generating position
112 independent code for embedded systems. */
113 #define MIPS_R_PCREL16 8
114
115 /* This reloc type is a Cygnus extension used when generating position
116 independent code for embedded systems. It is used for an entry in
117 a switch table, which looks like this:
118 .switch $L3-$LS12
119 The object file will contain the correct difference, and does not
120 require adjustment. However, when the linker is relaxing PC
121 relative calls, it is possible for $L3 to move farther away. This
122 reloc always appears in the .text section, and is always against
123 the .text section. However, the symbol index is not
124 RELOC_SECTION_TEXT. It is, instead, the distance between this
125 switch table entry and $LS12. Thus, the original value of $L12 is
126 vaddr - symndx
127 and the original value of $L3 is
128 vaddr - symndx + addend
129 where addend is the value in the object file. Knowing this, the
130 linker can know whether the addend in the object file must be
131 adjusted. */
132 #define MIPS_R_SWITCH 9
133
134 /********************** STABS **********************/
135
136 #define MIPS_IS_STAB ECOFF_IS_STAB
137 #define MIPS_MARK_STAB ECOFF_MARK_STAB
138 #define MIPS_UNMARK_STAB ECOFF_UNMARK_STAB
139
140 #define DEFAULT_DATA_SECTION_ALIGNMENT 4
141 #define DEFAULT_BSS_SECTION_ALIGNMENT 4
142 #define DEFAULT_TEXT_SECTION_ALIGNMENT 16
143 /* For new sections we havn't heard of before */
144 #define DEFAULT_SECTION_ALIGNMENT 4
145
146 /********************** SYMBOLIC INFORMATION **********************/
147
148 /* Written by John Gilmore. */
149
150 /* ECOFF uses COFF-like section structures, but its own symbol format.
151 This file defines the symbol format in fields whose size and alignment
152 will not vary on different host systems. */
153
154 /* File header as a set of bytes */
155
156 struct hdr_ext {
157 unsigned char h_magic[2];
158 unsigned char h_vstamp[2];
159 unsigned char h_ilineMax[4];
160 unsigned char h_cbLine[4];
161 unsigned char h_cbLineOffset[4];
162 unsigned char h_idnMax[4];
163 unsigned char h_cbDnOffset[4];
164 unsigned char h_ipdMax[4];
165 unsigned char h_cbPdOffset[4];
166 unsigned char h_isymMax[4];
167 unsigned char h_cbSymOffset[4];
168 unsigned char h_ioptMax[4];
169 unsigned char h_cbOptOffset[4];
170 unsigned char h_iauxMax[4];
171 unsigned char h_cbAuxOffset[4];
172 unsigned char h_issMax[4];
173 unsigned char h_cbSsOffset[4];
174 unsigned char h_issExtMax[4];
175 unsigned char h_cbSsExtOffset[4];
176 unsigned char h_ifdMax[4];
177 unsigned char h_cbFdOffset[4];
178 unsigned char h_crfd[4];
179 unsigned char h_cbRfdOffset[4];
180 unsigned char h_iextMax[4];
181 unsigned char h_cbExtOffset[4];
182 };
183
184 /* File descriptor external record */
185
186 struct fdr_ext {
187 unsigned char f_adr[4];
188 unsigned char f_rss[4];
189 unsigned char f_issBase[4];
190 unsigned char f_cbSs[4];
191 unsigned char f_isymBase[4];
192 unsigned char f_csym[4];
193 unsigned char f_ilineBase[4];
194 unsigned char f_cline[4];
195 unsigned char f_ioptBase[4];
196 unsigned char f_copt[4];
197 unsigned char f_ipdFirst[2];
198 unsigned char f_cpd[2];
199 unsigned char f_iauxBase[4];
200 unsigned char f_caux[4];
201 unsigned char f_rfdBase[4];
202 unsigned char f_crfd[4];
203 unsigned char f_bits1[1];
204 unsigned char f_bits2[3];
205 unsigned char f_cbLineOffset[4];
206 unsigned char f_cbLine[4];
207 };
208
209 #define FDR_BITS1_LANG_BIG 0xF8
210 #define FDR_BITS1_LANG_SH_BIG 3
211 #define FDR_BITS1_LANG_LITTLE 0x1F
212 #define FDR_BITS1_LANG_SH_LITTLE 0
213
214 #define FDR_BITS1_FMERGE_BIG 0x04
215 #define FDR_BITS1_FMERGE_LITTLE 0x20
216
217 #define FDR_BITS1_FREADIN_BIG 0x02
218 #define FDR_BITS1_FREADIN_LITTLE 0x40
219
220 #define FDR_BITS1_FBIGENDIAN_BIG 0x01
221 #define FDR_BITS1_FBIGENDIAN_LITTLE 0x80
222
223 #define FDR_BITS2_GLEVEL_BIG 0xC0
224 #define FDR_BITS2_GLEVEL_SH_BIG 6
225 #define FDR_BITS2_GLEVEL_LITTLE 0x03
226 #define FDR_BITS2_GLEVEL_SH_LITTLE 0
227
228 /* We ignore the `reserved' field in bits2. */
229
230 /* Procedure descriptor external record */
231
232 struct pdr_ext {
233 unsigned char p_adr[4];
234 unsigned char p_isym[4];
235 unsigned char p_iline[4];
236 unsigned char p_regmask[4];
237 unsigned char p_regoffset[4];
238 unsigned char p_iopt[4];
239 unsigned char p_fregmask[4];
240 unsigned char p_fregoffset[4];
241 unsigned char p_frameoffset[4];
242 unsigned char p_framereg[2];
243 unsigned char p_pcreg[2];
244 unsigned char p_lnLow[4];
245 unsigned char p_lnHigh[4];
246 unsigned char p_cbLineOffset[4];
247 };
248
249 /* Line numbers */
250
251 struct line_ext {
252 unsigned char l_line[4];
253 };
254
255 /* Symbol external record */
256
257 struct sym_ext {
258 unsigned char s_iss[4];
259 unsigned char s_value[4];
260 unsigned char s_bits1[1];
261 unsigned char s_bits2[1];
262 unsigned char s_bits3[1];
263 unsigned char s_bits4[1];
264 };
265
266 #define SYM_BITS1_ST_BIG 0xFC
267 #define SYM_BITS1_ST_SH_BIG 2
268 #define SYM_BITS1_ST_LITTLE 0x3F
269 #define SYM_BITS1_ST_SH_LITTLE 0
270
271 #define SYM_BITS1_SC_BIG 0x03
272 #define SYM_BITS1_SC_SH_LEFT_BIG 3
273 #define SYM_BITS1_SC_LITTLE 0xC0
274 #define SYM_BITS1_SC_SH_LITTLE 6
275
276 #define SYM_BITS2_SC_BIG 0xE0
277 #define SYM_BITS2_SC_SH_BIG 5
278 #define SYM_BITS2_SC_LITTLE 0x07
279 #define SYM_BITS2_SC_SH_LEFT_LITTLE 2
280
281 #define SYM_BITS2_RESERVED_BIG 0x10
282 #define SYM_BITS2_RESERVED_LITTLE 0x08
283
284 #define SYM_BITS2_INDEX_BIG 0x0F
285 #define SYM_BITS2_INDEX_SH_LEFT_BIG 16
286 #define SYM_BITS2_INDEX_LITTLE 0xF0
287 #define SYM_BITS2_INDEX_SH_LITTLE 4
288
289 #define SYM_BITS3_INDEX_SH_LEFT_BIG 8
290 #define SYM_BITS3_INDEX_SH_LEFT_LITTLE 4
291
292 #define SYM_BITS4_INDEX_SH_LEFT_BIG 0
293 #define SYM_BITS4_INDEX_SH_LEFT_LITTLE 12
294
295 /* External symbol external record */
296
297 struct ext_ext {
298 unsigned char es_bits1[1];
299 unsigned char es_bits2[1];
300 unsigned char es_ifd[2];
301 struct sym_ext es_asym;
302 };
303
304 #define EXT_BITS1_JMPTBL_BIG 0x80
305 #define EXT_BITS1_JMPTBL_LITTLE 0x01
306
307 #define EXT_BITS1_COBOL_MAIN_BIG 0x40
308 #define EXT_BITS1_COBOL_MAIN_LITTLE 0x02
309
310 #define EXT_BITS1_WEAKEXT_BIG 0x20
311 #define EXT_BITS1_WEAKEXT_LITTLE 0x04
312
313 /* Dense numbers external record */
314
315 struct dnr_ext {
316 unsigned char d_rfd[4];
317 unsigned char d_index[4];
318 };
319
320 /* Relative file descriptor */
321
322 struct rfd_ext {
323 unsigned char rfd[4];
324 };
325
326 /* Optimizer symbol external record */
327
328 struct opt_ext {
329 unsigned char o_bits1[1];
330 unsigned char o_bits2[1];
331 unsigned char o_bits3[1];
332 unsigned char o_bits4[1];
333 struct rndx_ext o_rndx;
334 unsigned char o_offset[4];
335 };
336
337 #define OPT_BITS2_VALUE_SH_LEFT_BIG 16
338 #define OPT_BITS2_VALUE_SH_LEFT_LITTLE 0
339
340 #define OPT_BITS3_VALUE_SH_LEFT_BIG 8
341 #define OPT_BITS3_VALUE_SH_LEFT_LITTLE 8
342
343 #define OPT_BITS4_VALUE_SH_LEFT_BIG 0
344 #define OPT_BITS4_VALUE_SH_LEFT_LITTLE 16
This page took 0.037071 seconds and 4 git commands to generate.