* tm-{irix3,mips,nindy960,pn,symmetry,vx960}.h: Move
[deliverable/binutils-gdb.git] / include / coff-i386.h
CommitLineData
517496c5
SC
1/*** coff information for M68K */
2
3
4/********************** FILE HEADER **********************/
5
6struct 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
517496c5
SC
16
17/* Bits for f_flags:
18 * F_RELFLG relocation info stripped from file
19 * F_EXEC file is executable (no unresolved external references)
20 * F_LNNO line numbers stripped from file
21 * F_LSYMS local symbols stripped from file
22 * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
23 */
24
8215bbac
JG
25#define F_RELFLG (0x0001)
26#define F_EXEC (0x0002)
27#define F_LNNO (0x0004)
28#define F_LSYMS (0x0008)
29
30
31
32#define I386MAGIC 0x14c
517496c5
SC
33#define I386BADMAG(x) (((x).f_magic!=I386MAGIC))
34
35
36#define FILHDR struct external_filehdr
37#define FILHSZ sizeof(FILHDR)
38
39
40/********************** AOUT "OPTIONAL HEADER" **********************/
517496c5
SC
41
42
43typedef struct
44{
45 char magic[2]; /* type of file */
46 char vstamp[2]; /* version stamp */
47 char tsize[4]; /* text size in bytes, padded to FW bdry*/
48 char dsize[4]; /* initialized data " " */
49 char bsize[4]; /* uninitialized data " " */
50 char entry[4]; /* entry pt. */
51 char text_start[4]; /* base of text used for this file */
52 char data_start[4]; /* base of data used for this file */
53}
54AOUTHDR;
55
56#define AOUTSZ (sizeof(AOUTHDR))
57
58
59/********************** STORAGE CLASSES **********************/
60
61#define C_EFCN -1 /* physical end of function */
62#define C_NULL 0
63#define C_AUTO 1 /* automatic variable */
64#define C_EXT 2 /* external symbol */
65#define C_STAT 3 /* static */
66#define C_REG 4 /* register variable */
67#define C_EXTDEF 5 /* external definition */
68#define C_LABEL 6 /* label */
69#define C_ULABEL 7 /* undefined label */
70#define C_MOS 8 /* member of structure */
71#define C_ARG 9 /* function argument */
72#define C_STRTAG 10 /* structure tag */
73#define C_MOU 11 /* member of union */
74#define C_UNTAG 12 /* union tag */
75#define C_TPDEF 13 /* type definition */
76#define C_USTATIC 14 /* undefined static */
77#define C_ENTAG 15 /* enumeration tag */
78#define C_MOE 16 /* member of enumeration */
79#define C_REGPARM 17 /* register parameter */
80#define C_FIELD 18 /* bit field */
81#define C_AUTOARG 19 /* auto argument */
82#define C_LASTENT 20 /* dummy entry (end of block) */
83#define C_BLOCK 100 /* ".bb" or ".eb" */
84#define C_FCN 101 /* ".bf" or ".ef" */
85#define C_EOS 102 /* end of structure */
86#define C_FILE 103 /* file name */
87#define C_LINE 104 /* line # reformatted as symbol table entry */
88#define C_ALIAS 105 /* duplicate tag */
89#define C_HIDDEN 106 /* ext symbol in dmert public lib */
90
91/********************** SECTION HEADER **********************/
92
517496c5
SC
93
94struct external_scnhdr {
95 char s_name[8]; /* section name */
96 char s_paddr[4]; /* physical address, aliased s_nlib */
97 char s_vaddr[4]; /* virtual address */
98 char s_size[4]; /* section size */
99 char s_scnptr[4]; /* file ptr to raw data for section */
100 char s_relptr[4]; /* file ptr to relocation */
101 char s_lnnoptr[4]; /* file ptr to line numbers */
102 char s_nreloc[2]; /* number of relocation entries */
103 char s_nlnno[2]; /* number of line number entries*/
104 char s_flags[4]; /* flags */
105};
106
107/*
108 * names of "special" sections
109 */
110#define _TEXT ".text"
111#define _DATA ".data"
112#define _BSS ".bss"
8215bbac 113
517496c5
SC
114/*
115 * s_flags "type"
116 */
117#define STYP_REG (0x0000) /* "regular": allocated, relocated, loaded */
118#define STYP_DSECT (0x0001) /* "dummy": relocated only*/
119#define STYP_NOLOAD (0x0002) /* "noload": allocated, relocated, not loaded */
120#define STYP_GROUP (0x0004) /* "grouped": formed of input sections */
121#define STYP_PAD (0x0008) /* "padding": not allocated, not relocated, loaded */
122#define STYP_COPY (0x0010) /* "copy": for decision function used by field update; not allocated, not relocated,
123 loaded; reloc & lineno entries processed normally */
124#define STYP_TEXT (0x0020) /* section contains text only */
125#define S_SHRSEG (0x0020) /* In 3b Update files (output of ogen), sections which appear in SHARED segments of the Pfile
126 will have the S_SHRSEG flag set by ogen, to inform dufr that updating 1 copy of the proc. will
127 update all process invocations. */
128#define STYP_DATA (0x0040) /* section contains data only */
129#define STYP_BSS (0x0080) /* section contains bss only */
130#define S_NEWFCN (0x0100) /* In a minimal file or an update file, a new function (as compared with a replaced function) */
131#define STYP_INFO (0x0200) /* comment: not allocated not relocated, not loaded */
132#define STYP_OVER (0x0400) /* overlay: relocated not allocated or loaded */
133#define STYP_LIB (0x0800) /* for .lib: same as INFO */
134#define STYP_MERGE (0x2000) /* merge section -- combines with text, data or bss sections only */
135#define STYP_REVERSE_PAD (0x4000) /* section will be padded with no-op instructions wherever padding is necessary and there is a
136 word of contiguous bytes beginning on a word boundary. */
137
138#define SCNHDR struct external_scnhdr
139#define SCNHSZ sizeof(SCNHDR)
140
141
142/********************** LINE NUMBERS **********************/
143
144/* 1 line number entry for every "breakpointable" source line in a section.
145 * Line numbers are grouped on a per function basis; first entry in a function
146 * grouping will have l_lnno = 0 and in place of physical address will be the
147 * symbol table index of the function name.
148 */
149struct external_lineno {
150 union {
151 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
152 char l_paddr[4]; /* (physical) address of line number */
153 } l_addr;
154 char l_lnno[2]; /* line number */
155};
156
517496c5
SC
157
158#define LINENO struct external_lineno
b1815762 159#define LINESZ 6
517496c5
SC
160
161
162/********************** SYMBOLS **********************/
163
054862cf
JG
164#define E_SYMNMLEN 8 /* # characters in a symbol name */
165#define E_FILNMLEN 14 /* # characters in a file name */
166#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
517496c5
SC
167
168struct external_syment
169{
170 union {
054862cf 171 char e_name[E_SYMNMLEN];
517496c5
SC
172 struct {
173 char e_zeroes[4];
174 char e_offset[4];
175 } e;
176 } e;
177 char e_value[4];
178 char e_scnum[2];
179 char e_type[2];
180 char e_sclass[1];
181 char e_numaux[1];
182};
183
517496c5
SC
184
185/*#define n_name _n._n_name
186#define n_ptr _n._n_nptr[1]
187#define n_zeroes _n._n_n._n_zeroes
188#define n_offset _n._n_n._n_offset
189*/
190
191/*
192 * Relocatable symbols have number of the section in which they are defined,
193 * or one of the following:
194 */
195#define N_UNDEF ((short)0) /* undefined symbol */
196#define N_ABS ((short)-1) /* value of symbol is absolute */
197#define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */
198#define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */
199#define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/
200
201/*
202 * Type of a symbol, in low 4 bits of the word
203 */
204#define T_NULL 0
205#define T_VOID 1 /* function argument (only used by compiler) */
206#define T_CHAR 2 /* character */
207#define T_SHORT 3 /* short integer */
208#define T_INT 4 /* integer */
209#define T_LONG 5 /* long integer */
210#define T_FLOAT 6 /* floating point */
211#define T_DOUBLE 7 /* double word */
212#define T_STRUCT 8 /* structure */
213#define T_UNION 9 /* union */
214#define T_ENUM 10 /* enumeration */
215#define T_MOE 11 /* member of enumeration*/
216#define T_UCHAR 12 /* unsigned character */
217#define T_USHORT 13 /* unsigned short */
218#define T_UINT 14 /* unsigned integer */
219#define T_ULONG 15 /* unsigned long */
220#define T_LNGDBL 16 /* long double */
221
222/*
223 * derived types, in n_type
224*/
225#define DT_NON (0) /* no derived type */
226#define DT_PTR (1) /* pointer */
227#define DT_FCN (2) /* function */
228#define DT_ARY (3) /* array */
229
2700c3c7
SC
230#define N_BTMASK (0xf)
231#define N_TMASK (0x30)
232#define N_BTSHFT (4)
517496c5
SC
233#define N_TSHIFT (2)
234
235#define BTYPE(x) ((x) & N_BTMASK)
236
237#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
238#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
239#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
240
241#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
242
243union external_auxent {
244 struct {
245 char x_tagndx[4]; /* str, un, or enum tag indx */
246 union {
247 struct {
248 char x_lnno[2]; /* declaration line number */
249 char x_size[2]; /* str/union/array size */
250 } x_lnsz;
251 char x_fsize[4]; /* size of function */
252 } x_misc;
253 union {
254 struct { /* if ISFCN, tag, or .bb */
255 char x_lnnoptr[4]; /* ptr to fcn line # */
256 char x_endndx[4]; /* entry ndx past block end */
257 } x_fcn;
258 struct { /* if ISARY, up to 4 dimen. */
054862cf 259 char x_dimen[E_DIMNUM][2];
517496c5
SC
260 } x_ary;
261 } x_fcnary;
262 char x_tvndx[2]; /* tv index */
263 } x_sym;
264
265 union {
054862cf 266 char x_fname[E_FILNMLEN];
517496c5
SC
267 struct {
268 char x_zeroes[4];
269 char x_offset[4];
270 } x_n;
271 } x_file;
272
273 struct {
274 char x_scnlen[4]; /* section length */
275 char x_nreloc[2]; /* # relocation entries */
276 char x_nlinno[2]; /* # line numbers */
277 } x_scn;
278
279 struct {
280 char x_tvfill[4]; /* tv fill value */
281 char x_tvlen[2]; /* length of .tv */
282 char x_tvran[2][2]; /* tv range */
283 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
284
285
517496c5
SC
286};
287
288#define SYMENT struct external_syment
289#define SYMESZ 18
290#define AUXENT union external_auxent
291#define AUXESZ 18
292
293
294# define _ETEXT "etext"
295
296
297/********************** RELOCATION DIRECTIVES **********************/
298
517496c5
SC
299
300
301struct external_reloc {
302 char r_vaddr[4];
303 char r_symndx[4];
304 char r_type[2];
305};
306
517496c5
SC
307
308#define RELOC struct external_reloc
309#define RELSZ 10
310
311#define DEFAULT_DATA_SECTION_ALIGNMENT 4
312#define DEFAULT_BSS_SECTION_ALIGNMENT 4
313#define DEFAULT_TEXT_SECTION_ALIGNMENT 4
314/* For new sections we havn't heard of before */
315#define DEFAULT_SECTION_ALIGNMENT 4
This page took 0.041817 seconds and 4 git commands to generate.