Now there are two incarnations of relocs, linenos and syments. One for
[deliverable/binutils-gdb.git] / include / coff-m88k.h
1 /*** coff information for 88k bcs */
2
3 /********************** FILE HEADER **********************/
4
5 struct filehdr {
6 unsigned short f_magic; /* magic number */
7 unsigned short f_nscns; /* number of sections */
8 long f_timdat; /* time & date stamp */
9 long f_symptr; /* file pointer to symtab */
10 long f_nsyms; /* number of symtab entries */
11 unsigned short f_opthdr; /* sizeof(optional hdr) */
12 unsigned short f_flags; /* flags */
13 };
14
15 /* Bits for f_flags:
16 * F_RELFLG relocation info stripped from file
17 * F_EXEC file is executable (no unresolved externel references)
18 * F_LNNO line nunbers stripped from file
19 * F_LSYMS local symbols stripped from file
20 * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
21 */
22 #define F_RELFLG 0000001
23 #define F_EXEC 0000002
24 #define F_LNNO 0000004
25 #define F_LSYMS 0000010
26 #define F_AR32WR 0x100
27 #define F_AR32W 0x200
28
29 #define MC88MAGIC 0540 /* 88k BCS executable */
30 #define MC88DMAGIC 0541 /* DG/UX executable */
31 #define MC88OMAGIC 0555 /* Object file */
32
33 #define MC88BADMAG(x) (((x).f_magic!=MC88MAGIC) &&((x).f_magic!=MC88DMAGIC) && ((x).f_magic != MC88OMAGIC))
34
35 #define FILHDR struct filehdr
36 #define FILHSZ sizeof(FILHDR)
37
38
39 /********************** AOUT "OPTIONAL HEADER" **********************/
40
41
42 #define PAGEMAGIC3 0414 /* Split i&d, zero mapped */
43 #define PAGEMAGICBCS 0413
44
45 typedef struct aouthdr {
46 short magic; /* type of file */
47 short vstamp; /* version stamp */
48 unsigned long tsize; /* text size in bytes, padded to FW bdry*/
49 unsigned long dsize; /* initialized data " " */
50 unsigned long bsize; /* uninitialized data " " */
51
52 unsigned long entry; /* entry pt. */
53 unsigned long text_start; /* base of text used for this file */
54 unsigned long data_start; /* base of data used for this file */
55
56 } AOUTHDR;
57
58
59 /* compute size of a header */
60
61 #define AOUTSZ (sizeof(AOUTHDR))
62
63 /********************** STORAGE CLASSES **********************/
64
65 #define C_EFCN -1 /* physical end of function */
66 #define C_NULL 0
67 #define C_AUTO 1 /* automatic variable */
68 #define C_EXT 2 /* external symbol */
69 #define C_STAT 3 /* static */
70 #define C_REG 4 /* register variable */
71 #define C_EXTDEF 5 /* external definition */
72 #define C_LABEL 6 /* label */
73 #define C_ULABEL 7 /* undefined label */
74 #define C_MOS 8 /* member of structure */
75 #define C_ARG 9 /* function argument */
76 #define C_STRTAG 10 /* structure tag */
77 #define C_MOU 11 /* member of union */
78 #define C_UNTAG 12 /* union tag */
79 #define C_TPDEF 13 /* type definition */
80 #define C_USTATIC 14 /* undefined static */
81 #define C_ENTAG 15 /* enumeration tag */
82 #define C_MOE 16 /* member of enumeration */
83 #define C_REGPARM 17 /* register parameter */
84 #define C_FIELD 18 /* bit field */
85 #define C_BLOCK 100 /* ".bb" or ".eb" */
86 #define C_FCN 101 /* ".bf" or ".ef" */
87 #define C_EOS 102 /* end of structure */
88 #define C_FILE 103 /* file name */
89 #define C_LINE 104 /* line # reformatted as symbol table entry */
90 #define C_ALIAS 105 /* duplicate tag */
91 #define C_HIDDEN 106 /* ext symbol in dmert public lib */
92 #define C_SHADOW 107 /* shadow symbol */
93 #define C_VERSION 108 /* coff version symbol */
94
95
96 /********************** SECTION HEADER **********************/
97
98 struct scnhdr {
99 char s_name[8]; /* section name */
100 long s_paddr; /* physical address, aliased s_nlib */
101 long s_vaddr; /* virtual address */
102 long s_size; /* section size */
103 long s_scnptr; /* file ptr to raw data for section */
104 long s_relptr; /* file ptr to relocation */
105 long s_lnnoptr; /* file ptr to line numbers */
106 long s_nreloc; /* number of relocation entries */
107 long s_nlnno; /* number of line number entries*/
108 long s_flags; /* flags */
109 };
110
111 /*
112 * names of "special" sections
113 */
114 #define _TEXT ".text"
115 #define _DATA ".data"
116 #define _BSS ".bss"
117
118 /*
119 * s_flags "type"
120 */
121 #define STYP_TEXT 0x20 /* section contains text only */
122 #define STYP_DATA 0x40 /* section contains data only */
123 #define STYP_BSS 0x80 /* section contains bss only */
124
125 #define SCNHDR struct scnhdr
126 #define SCNHSZ sizeof(SCNHDR)
127
128
129 /********************** LINE NUMBERS **********************/
130
131 /* 1 line number entry for every "breakpointable" source line in a section.
132 * Line numbers are grouped on a per function basis; first entry in a function
133 * grouping will have l_lnno = 0 and in place of physical address will be the
134 * symbol table index of the function name.
135 */
136 struct external_lineno{
137 union {
138 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
139 char l_paddr[4]; /* (physical) address of line number */
140 } l_addr;
141
142 char l_lnno[4];
143
144 };
145 struct internal_lineno{
146 union {
147 long l_symndx; /* function name symbol index, iff l_lnno == 0*/
148 long l_paddr; /* (physical) address of line number */
149 } l_addr;
150
151 long l_lnno;
152
153 };
154
155 #define LINENO struct external_lineno
156 #define LINESZ 8
157
158
159 /********************** SYMBOLS **********************/
160
161 #define SYMNMLEN 8 /* # characters in a symbol name */
162 #define FILNMLEN 14 /* # characters in a file name */
163 #define DIMNUM 4 /* # array dimensions in auxiliary entry */
164
165 struct external_syment
166 {
167 union {
168 char e_name[SYMNMLEN];
169 struct {
170 char e_zeroes[4];
171 char e_offset[4];
172 } e;
173 } e;
174 char e_value[4];
175 char e_scnum[2];
176 char e_type[2];
177 char e_sclass[1];
178 char e_numaux[1];
179 char pad2[2];
180 };
181
182 struct internal_syment {
183 union {
184 char _n_name[SYMNMLEN]; /* old COFF version */
185 struct {
186 long _n_zeroes; /* new == 0 */
187 long _n_offset; /* offset into string table */
188 } _n_n;
189 char *_n_nptr[2]; /* allows for overlaying */
190 } _n;
191 long n_value; /* value of symbol */
192 short n_scnum; /* section number */
193 unsigned short n_type; /* type and derived type */
194 char n_sclass; /* storage class */
195 char n_numaux; /* number of aux. entries */
196
197 };
198
199 /*
200 * Relocatable symbols have number of the section in which they are defined,
201 * or one of the following:
202 */
203 #define N_UNDEF 0 /* undefined symbol */
204 #define N_ABS -1 /* value of symbol is absolute */
205 #define N_DEBUG -2 /* debugging symbol -- symbol value is meaningless */
206
207 /*
208 * Type of a symbol, in low 4 bits of the word
209 */
210 #define T_NULL 0
211 #define T_VOID 1 /* function argument (only used by compiler) */
212 #define T_CHAR 2 /* character */
213 #define T_SHORT 3 /* short integer */
214 #define T_INT 4 /* integer */
215 #define T_LONG 5 /* long integer */
216 #define T_FLOAT 6 /* floating point */
217 #define T_DOUBLE 7 /* double word */
218 #define T_STRUCT 8 /* structure */
219 #define T_UNION 9 /* union */
220 #define T_ENUM 10 /* enumeration */
221 #define T_MOE 11 /* member of enumeration*/
222 #define T_UCHAR 12 /* unsigned character */
223 #define T_USHORT 13 /* unsigned short */
224 #define T_UINT 14 /* unsigned integer */
225 #define T_ULONG 15 /* unsigned long */
226
227
228
229 /*
230 * derived types
231 */
232 #define DT_NON 0
233 #define DT_PTR 1 /* pointer */
234 #define DT_FCN 2 /* function */
235 #define DT_ARY 3 /* array */
236
237 #define N_BTMASK 017
238 #define N_TMASK 060
239 #define N_BTSHFT 4
240 #define N_TSHIFT 2
241
242 #define BTYPE(x) ((x) & N_BTMASK)
243
244
245 #define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
246 #define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
247 #define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
248
249 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
250
251 union external_auxent {
252 struct {
253 char x_tagndx[4]; /* str, un, or enum tag indx */
254 union {
255 struct {
256 char x_lnno[2]; /* declaration line number */
257 char x_size[2]; /* str/union/array size */
258 } x_lnsz;
259 char x_fsize[4]; /* size of function */
260 } x_misc;
261 union {
262 struct { /* if ISFCN, tag, or .bb */
263 char x_lnnoptr[4]; /* ptr to fcn line # */
264 char x_endndx[4]; /* entry ndx past block end */
265 } x_fcn;
266 struct { /* if ISARY, up to 4 dimen. */
267 char x_dimen[DIMNUM][2];
268 } x_ary;
269 } x_fcnary;
270 char x_tvndx[2]; /* tv index */
271 } x_sym;
272
273 union {
274 char x_fname[FILNMLEN];
275 struct {
276 char x_zeroes[4];
277 char x_offset[4];
278 } x_n;
279 } x_file;
280
281 struct {
282 char x_scnlen[4]; /* section length */
283 char x_nreloc[2]; /* # relocation entries */
284 char x_nlinno[2]; /* # line numbers */
285 } x_scn;
286
287 struct {
288 char x_tvfill[4]; /* tv fill value */
289 char x_tvlen[2]; /* length of .tv */
290 char x_tvran[2][2]; /* tv range */
291 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
292
293
294 };
295 union internal_auxent
296 {
297 struct {
298 long x_tagndx; /* str, un, or enum tag indx */
299 union {
300 struct {
301 unsigned short x_lnno; /* declaration line number */
302 unsigned short x_size; /* str/union/array size */
303 } x_lnsz;
304 long x_fsize; /* size of function */
305 } x_misc;
306 union {
307 struct { /* if ISFCN, tag, or .bb */
308 long x_lnnoptr; /* ptr to fcn line # */
309 long x_endndx; /* entry ndx past block end */
310 } x_fcn;
311 struct { /* if ISARY, up to 4 dimen. */
312 unsigned short x_dimen[DIMNUM];
313 } x_ary;
314 } x_fcnary;
315 unsigned short x_tvndx; /* tv index */
316 } x_sym;
317
318 union {
319 char x_fname[FILNMLEN];
320 struct {
321 long x_zeroes;
322 long x_offset;
323 } x_n;
324 } x_file;
325
326 struct {
327 long x_scnlen; /* section length */
328 unsigned short x_nreloc; /* # relocation entries */
329 unsigned short x_nlinno; /* # line numbers */
330 } x_scn;
331
332 struct {
333 long x_tvfill; /* tv fill value */
334 unsigned short x_tvlen; /* length of .tv */
335 unsigned short x_tvran[2]; /* tv range */
336 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
337 };
338
339 #define SYMENT struct external_syment
340 #define SYMESZ 20
341 #define AUXENT union external_auxent
342 #define AUXESZ 20
343
344
345 /********************** RELOCATION DIRECTIVES **********************/
346
347 struct external_reloc {
348 char r_vaddr[4];
349 char r_symndx[4];
350 char r_type[2];
351 char r_offset[2];
352 };
353
354 struct internal_reloc {
355 long r_vaddr; /* Virtual address of reference */
356 long r_symndx; /* Index into symbol table */
357 unsigned short r_type; /* Relocation type */
358 unsigned short r_offset; /* Hi 16 bits of constant */
359 };
360
361 /* Only values of r_type GNU/88k cares about */
362 #define R_PCR16L 128
363 #define R_PCR26L 129
364 #define R_VRT16 130
365 #define R_HVRT16 131
366 #define R_LVRT16 132
367 #define R_VRT32 133
368
369
370
371
372 #define RELOC struct external_reloc
373 #define RELSZ 12
374
375 #define DEFAULT_SECTION_ALIGNMENT 8 /* double word */
This page took 0.043844 seconds and 4 git commands to generate.