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