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