Change GDB over to GNU General Public License version 2.
[deliverable/binutils-gdb.git] / include / coff-i386.h
1 /*** coff information for M68K */
2
3
4 /********************** FILE HEADER **********************/
5
6 struct external_filehdr {
7 char f_magic[2]; /* magic number */
8 char f_nscns[2]; /* number of sections */
9 char f_timdat[4]; /* time & date stamp */
10 char f_symptr[4]; /* file pointer to symtab */
11 char f_nsyms[4]; /* number of symtab entries */
12 char f_opthdr[2]; /* sizeof(optional hdr) */
13 char f_flags[2]; /* flags */
14 };
15
16 struct internal_filehdr
17 {
18 unsigned short f_magic; /* magic number */
19 unsigned short f_nscns; /* number of sections */
20 long f_timdat; /* time & date stamp */
21 long f_symptr; /* file pointer to symtab */
22 long f_nsyms; /* number of symtab entries */
23 unsigned short f_opthdr; /* sizeof(optional hdr) */
24 unsigned short f_flags; /* flags */
25 };
26
27 /* Bits for f_flags:
28 * F_RELFLG relocation info stripped from file
29 * F_EXEC file is executable (no unresolved external references)
30 * F_LNNO line numbers stripped from file
31 * F_LSYMS local symbols stripped from file
32 * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
33 */
34
35 #define F_RELFLG (0x0001)
36 #define F_EXEC (0x0002)
37 #define F_LNNO (0x0004)
38 #define F_LSYMS (0x0008)
39 #define F_AR32WR (0400)
40
41
42 #define I386MAGIC 0x14c
43 #define I386BADMAG(x) (((x).f_magic!=I386MAGIC))
44
45
46 #define FILHDR struct external_filehdr
47 #define FILHSZ sizeof(FILHDR)
48
49
50 /********************** AOUT "OPTIONAL HEADER" **********************/
51 struct internal_aouthdr {
52 short magic; /* type of file */
53 short vstamp; /* version stamp */
54 unsigned long tsize; /* text size in bytes, padded to FW bdry*/
55 unsigned long dsize; /* initialized data " " */
56 unsigned long bsize; /* uninitialized data " " */
57 unsigned long entry; /* entry pt. */
58 unsigned long text_start; /* base of text used for this file */
59 unsigned long data_start; /* base of data used for this file */
60 unsigned long tagentries; /* number of tag entries to follow */
61 } ;
62
63
64 typedef struct
65 {
66 char magic[2]; /* type of file */
67 char vstamp[2]; /* version stamp */
68 char tsize[4]; /* text size in bytes, padded to FW bdry*/
69 char dsize[4]; /* initialized data " " */
70 char bsize[4]; /* uninitialized data " " */
71 char entry[4]; /* entry pt. */
72 char text_start[4]; /* base of text used for this file */
73 char data_start[4]; /* base of data used for this file */
74 }
75 AOUTHDR;
76
77 #define AOUTSZ (sizeof(AOUTHDR))
78
79
80 /********************** STORAGE CLASSES **********************/
81
82 #define C_EFCN -1 /* physical end of function */
83 #define C_NULL 0
84 #define C_AUTO 1 /* automatic variable */
85 #define C_EXT 2 /* external symbol */
86 #define C_STAT 3 /* static */
87 #define C_REG 4 /* register variable */
88 #define C_EXTDEF 5 /* external definition */
89 #define C_LABEL 6 /* label */
90 #define C_ULABEL 7 /* undefined label */
91 #define C_MOS 8 /* member of structure */
92 #define C_ARG 9 /* function argument */
93 #define C_STRTAG 10 /* structure tag */
94 #define C_MOU 11 /* member of union */
95 #define C_UNTAG 12 /* union tag */
96 #define C_TPDEF 13 /* type definition */
97 #define C_USTATIC 14 /* undefined static */
98 #define C_ENTAG 15 /* enumeration tag */
99 #define C_MOE 16 /* member of enumeration */
100 #define C_REGPARM 17 /* register parameter */
101 #define C_FIELD 18 /* bit field */
102 #define C_AUTOARG 19 /* auto argument */
103 #define C_LASTENT 20 /* dummy entry (end of block) */
104 #define C_BLOCK 100 /* ".bb" or ".eb" */
105 #define C_FCN 101 /* ".bf" or ".ef" */
106 #define C_EOS 102 /* end of structure */
107 #define C_FILE 103 /* file name */
108 #define C_LINE 104 /* line # reformatted as symbol table entry */
109 #define C_ALIAS 105 /* duplicate tag */
110 #define C_HIDDEN 106 /* ext symbol in dmert public lib */
111
112 /********************** SECTION HEADER **********************/
113
114 struct internal_scnhdr {
115 char s_name[8]; /* section name */
116 long s_paddr; /* physical address, aliased s_nlib */
117 long s_vaddr; /* virtual address */
118 long s_size; /* section size */
119 long s_scnptr; /* file ptr to raw data for section */
120 long s_relptr; /* file ptr to relocation */
121 long s_lnnoptr; /* file ptr to line numbers */
122 unsigned short s_nreloc; /* number of relocation entries */
123 unsigned short s_nlnno; /* number of line number entries*/
124 long s_flags; /* flags */
125 };
126
127 struct external_scnhdr {
128 char s_name[8]; /* section name */
129 char s_paddr[4]; /* physical address, aliased s_nlib */
130 char s_vaddr[4]; /* virtual address */
131 char s_size[4]; /* section size */
132 char s_scnptr[4]; /* file ptr to raw data for section */
133 char s_relptr[4]; /* file ptr to relocation */
134 char s_lnnoptr[4]; /* file ptr to line numbers */
135 char s_nreloc[2]; /* number of relocation entries */
136 char s_nlnno[2]; /* number of line number entries*/
137 char s_flags[4]; /* flags */
138 };
139
140 /*
141 * names of "special" sections
142 */
143 #define _TEXT ".text"
144 #define _DATA ".data"
145 #define _BSS ".bss"
146
147 /*
148 * s_flags "type"
149 */
150 #define STYP_REG (0x0000) /* "regular": allocated, relocated, loaded */
151 #define STYP_DSECT (0x0001) /* "dummy": relocated only*/
152 #define STYP_NOLOAD (0x0002) /* "noload": allocated, relocated, not loaded */
153 #define STYP_GROUP (0x0004) /* "grouped": formed of input sections */
154 #define STYP_PAD (0x0008) /* "padding": not allocated, not relocated, loaded */
155 #define STYP_COPY (0x0010) /* "copy": for decision function used by field update; not allocated, not relocated,
156 loaded; reloc & lineno entries processed normally */
157 #define STYP_TEXT (0x0020) /* section contains text only */
158 #define S_SHRSEG (0x0020) /* In 3b Update files (output of ogen), sections which appear in SHARED segments of the Pfile
159 will have the S_SHRSEG flag set by ogen, to inform dufr that updating 1 copy of the proc. will
160 update all process invocations. */
161 #define STYP_DATA (0x0040) /* section contains data only */
162 #define STYP_BSS (0x0080) /* section contains bss only */
163 #define S_NEWFCN (0x0100) /* In a minimal file or an update file, a new function (as compared with a replaced function) */
164 #define STYP_INFO (0x0200) /* comment: not allocated not relocated, not loaded */
165 #define STYP_OVER (0x0400) /* overlay: relocated not allocated or loaded */
166 #define STYP_LIB (0x0800) /* for .lib: same as INFO */
167 #define STYP_MERGE (0x2000) /* merge section -- combines with text, data or bss sections only */
168 #define STYP_REVERSE_PAD (0x4000) /* section will be padded with no-op instructions wherever padding is necessary and there is a
169 word of contiguous bytes beginning on a word boundary. */
170
171 #define SCNHDR struct external_scnhdr
172 #define SCNHSZ sizeof(SCNHDR)
173
174
175 /********************** LINE NUMBERS **********************/
176
177 /* 1 line number entry for every "breakpointable" source line in a section.
178 * Line numbers are grouped on a per function basis; first entry in a function
179 * grouping will have l_lnno = 0 and in place of physical address will be the
180 * symbol table index of the function name.
181 */
182 struct external_lineno {
183 union {
184 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
185 char l_paddr[4]; /* (physical) address of line number */
186 } l_addr;
187 char l_lnno[2]; /* line number */
188 };
189
190 struct internal_lineno {
191 union {
192 long l_symndx; /* function name symbol index, iff l_lnno == 0*/
193 long l_paddr; /* (physical) address of line number */
194 } l_addr;
195 unsigned short l_lnno; /* line number */
196 };
197
198 #define LINENO struct external_lineno
199 #define LINESZ sizeof(LINENO)
200
201
202 /********************** SYMBOLS **********************/
203
204 #define SYMNMLEN 8 /* # characters in a symbol name */
205 #define FILNMLEN 14 /* # characters in a file name */
206 #define DIMNUM 4 /* # array dimensions in auxiliary entry */
207
208 struct external_syment
209 {
210 union {
211 char e_name[SYMNMLEN];
212 struct {
213 char e_zeroes[4];
214 char e_offset[4];
215 } e;
216 } e;
217 char e_value[4];
218 char e_scnum[2];
219 char e_type[2];
220 char e_sclass[1];
221 char e_numaux[1];
222 };
223
224 struct internal_syment {
225 union {
226 char _n_name[SYMNMLEN]; /* old COFF version */
227 struct {
228 long _n_zeroes; /* new == 0 */
229 long _n_offset; /* offset into string table */
230 } _n_n;
231 char *_n_nptr[2]; /* allows for overlaying */
232 } _n;
233 long n_value; /* value of symbol */
234 short n_scnum; /* section number */
235 unsigned short n_flags; /* copy of flags from filhdr */
236 unsigned short n_type; /* type and derived type */
237 char n_sclass; /* storage class */
238 char n_numaux; /* number of aux. entries */
239 };
240
241 /*#define n_name _n._n_name
242 #define n_ptr _n._n_nptr[1]
243 #define n_zeroes _n._n_n._n_zeroes
244 #define n_offset _n._n_n._n_offset
245 */
246
247 /*
248 * Relocatable symbols have number of the section in which they are defined,
249 * or one of the following:
250 */
251 #define N_UNDEF ((short)0) /* undefined symbol */
252 #define N_ABS ((short)-1) /* value of symbol is absolute */
253 #define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */
254 #define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */
255 #define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/
256
257 /*
258 * Type of a symbol, in low 4 bits of the word
259 */
260 #define T_NULL 0
261 #define T_VOID 1 /* function argument (only used by compiler) */
262 #define T_CHAR 2 /* character */
263 #define T_SHORT 3 /* short integer */
264 #define T_INT 4 /* integer */
265 #define T_LONG 5 /* long integer */
266 #define T_FLOAT 6 /* floating point */
267 #define T_DOUBLE 7 /* double word */
268 #define T_STRUCT 8 /* structure */
269 #define T_UNION 9 /* union */
270 #define T_ENUM 10 /* enumeration */
271 #define T_MOE 11 /* member of enumeration*/
272 #define T_UCHAR 12 /* unsigned character */
273 #define T_USHORT 13 /* unsigned short */
274 #define T_UINT 14 /* unsigned integer */
275 #define T_ULONG 15 /* unsigned long */
276 #define T_LNGDBL 16 /* long double */
277
278 /*
279 * derived types, in n_type
280 */
281 #define DT_NON (0) /* no derived type */
282 #define DT_PTR (1) /* pointer */
283 #define DT_FCN (2) /* function */
284 #define DT_ARY (3) /* array */
285
286 #define N_BTMASK (0xf)
287 #define N_TMASK (0x30)
288 #define N_BTSHFT (4)
289 #define N_TSHIFT (2)
290
291 #define BTYPE(x) ((x) & N_BTMASK)
292
293 #define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
294 #define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
295 #define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
296
297 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
298
299 union external_auxent {
300 struct {
301 char x_tagndx[4]; /* str, un, or enum tag indx */
302 union {
303 struct {
304 char x_lnno[2]; /* declaration line number */
305 char x_size[2]; /* str/union/array size */
306 } x_lnsz;
307 char x_fsize[4]; /* size of function */
308 } x_misc;
309 union {
310 struct { /* if ISFCN, tag, or .bb */
311 char x_lnnoptr[4]; /* ptr to fcn line # */
312 char x_endndx[4]; /* entry ndx past block end */
313 } x_fcn;
314 struct { /* if ISARY, up to 4 dimen. */
315 char x_dimen[DIMNUM][2];
316 } x_ary;
317 } x_fcnary;
318 char x_tvndx[2]; /* tv index */
319 } x_sym;
320
321 union {
322 char x_fname[FILNMLEN];
323 struct {
324 char x_zeroes[4];
325 char x_offset[4];
326 } x_n;
327 } x_file;
328
329 struct {
330 char x_scnlen[4]; /* section length */
331 char x_nreloc[2]; /* # relocation entries */
332 char x_nlinno[2]; /* # line numbers */
333 } x_scn;
334
335 struct {
336 char x_tvfill[4]; /* tv fill value */
337 char x_tvlen[2]; /* length of .tv */
338 char x_tvran[2][2]; /* tv range */
339 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
340
341
342 };
343 union internal_auxent {
344 struct {
345 long x_tagndx; /* str, un, or enum tag indx */
346 union {
347 struct {
348 unsigned short x_lnno; /* declaration line number */
349 unsigned short x_size; /* str/union/array size */
350 } x_lnsz;
351 long x_fsize; /* size of function */
352 } x_misc;
353 union {
354 struct { /* if ISFCN, tag, or .bb */
355 long x_lnnoptr; /* ptr to fcn line # */
356 long x_endndx; /* entry ndx past block end */
357 } x_fcn;
358 struct { /* if ISARY, up to 4 dimen. */
359 unsigned short x_dimen[DIMNUM];
360 } x_ary;
361 } x_fcnary;
362 unsigned short x_tvndx; /* tv index */
363 } x_sym;
364
365 union {
366 char x_fname[FILNMLEN];
367 struct {
368 long x_zeroes;
369 long x_offset;
370 } x_n;
371 } x_file;
372
373 struct {
374 long x_scnlen; /* section length */
375 unsigned short x_nreloc; /* # relocation entries */
376 unsigned short x_nlinno; /* # line numbers */
377 } x_scn;
378
379 struct {
380 long x_tvfill; /* tv fill value */
381 unsigned short x_tvlen; /* length of .tv */
382 unsigned short x_tvran[2]; /* tv range */
383 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
384
385 /******************************************
386 * I960-specific *2nd* aux. entry formats
387 ******************************************/
388 struct {
389 /* This is a very old typo that keeps getting propagated. */
390 #define x_stdindx x_stindx
391 long x_stindx; /* sys. table entry */
392 } x_sc; /* system call entry */
393
394 struct {
395 unsigned long x_balntry; /* BAL entry point */
396 } x_bal; /* BAL-callable function */
397
398 struct {
399 unsigned long x_timestamp; /* time stamp */
400 char x_idstring[20]; /* producer identity string */
401 } x_ident; /* Producer ident info */
402
403
404 };
405
406 #define SYMENT struct external_syment
407 #define SYMESZ 18
408 #define AUXENT union external_auxent
409 #define AUXESZ 18
410
411
412 # define _ETEXT "etext"
413
414
415 /********************** RELOCATION DIRECTIVES **********************/
416
417 struct internal_reloc {
418 long r_vaddr; /* Virtual address of reference */
419 long r_symndx; /* Index into symbol table */
420 unsigned short r_type; /* Relocation type */
421 };
422
423
424 struct external_reloc {
425 char r_vaddr[4];
426 char r_symndx[4];
427 char r_type[2];
428 };
429
430 #define R_DIR32 06
431 #define R_PCLONG 020
432 #define R_RELBYTE 017
433 #define R_RELWORD 020
434 #define R_RELLONG 021
435 #define R_PCRBYTE 022
436 #define R_PCRWORD 023
437 #define R_PCRLONG 024
438
439 #define RELOC struct external_reloc
440 #define RELSZ 10
441
442 #define DEFAULT_DATA_SECTION_ALIGNMENT 4
443 #define DEFAULT_BSS_SECTION_ALIGNMENT 4
444 #define DEFAULT_TEXT_SECTION_ALIGNMENT 4
445 /* For new sections we havn't heard of before */
446 #define DEFAULT_SECTION_ALIGNMENT 4
This page took 0.038267 seconds and 4 git commands to generate.