* mcheck.c: Avoid warning about undeclared abort fn.
[deliverable/binutils-gdb.git] / include / internalcoff.h
1 /********************** FILE HEADER **********************/
2 struct internal_filehdr
3 {
4 unsigned short f_magic; /* magic number */
5 unsigned short f_nscns; /* number of sections */
6 long f_timdat; /* time & date stamp */
7 long f_symptr; /* file pointer to symtab */
8 long f_nsyms; /* number of symtab entries */
9 unsigned short f_opthdr; /* sizeof(optional hdr) */
10 unsigned short f_flags; /* flags */
11 };
12
13 /* Bits for f_flags:
14 * F_RELFLG relocation info stripped from file
15 * F_EXEC file is executable (no unresolved external references)
16 * F_LNNO line numbers stripped from file
17 * F_LSYMS local symbols stripped from file
18 * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
19 */
20
21 #define F_RELFLG (0x0001)
22 #define F_EXEC (0x0002)
23 #define F_LNNO (0x0004)
24 #define F_LSYMS (0x0008)
25 #define F_AR32WR (0x0010)
26 #define F_AR32W 0x200
27 /********************** AOUT "OPTIONAL HEADER" **********************/
28 struct internal_aouthdr {
29 short magic; /* type of file */
30 short vstamp; /* version stamp */
31 unsigned long tsize; /* text size in bytes, padded to FW bdry*/
32 unsigned long dsize; /* initialized data " " */
33 unsigned long bsize; /* uninitialized data " " */
34 unsigned long entry; /* entry pt. */
35 unsigned long text_start; /* base of text used for this file */
36 unsigned long data_start; /* base of data used for this file */
37 unsigned long tagentries; /* number of tag entries to follow */
38 } ;
39
40 /********************** STORAGE CLASSES **********************/
41
42 #define C_EFCN -1 /* physical end of function */
43 #define C_NULL 0
44 #define C_AUTO 1 /* automatic variable */
45 #define C_EXT 2 /* external symbol */
46 #define C_STAT 3 /* static */
47 #define C_REG 4 /* register variable */
48 #define C_EXTDEF 5 /* external definition */
49 #define C_LABEL 6 /* label */
50 #define C_ULABEL 7 /* undefined label */
51 #define C_MOS 8 /* member of structure */
52 #define C_ARG 9 /* function argument */
53 #define C_STRTAG 10 /* structure tag */
54 #define C_MOU 11 /* member of union */
55 #define C_UNTAG 12 /* union tag */
56 #define C_TPDEF 13 /* type definition */
57 #define C_USTATIC 14 /* undefined static */
58 #define C_ENTAG 15 /* enumeration tag */
59 #define C_MOE 16 /* member of enumeration */
60 #define C_REGPARM 17 /* register parameter */
61 #define C_FIELD 18 /* bit field */
62 #define C_AUTOARG 19 /* auto argument */
63 #define C_LASTENT 20 /* dummy entry (end of block) */
64 #define C_BLOCK 100 /* ".bb" or ".eb" */
65 #define C_FCN 101 /* ".bf" or ".ef" */
66 #define C_EOS 102 /* end of structure */
67 #define C_FILE 103 /* file name */
68 #define C_LINE 104 /* line # reformatted as symbol table entry */
69 #define C_ALIAS 105 /* duplicate tag */
70 #define C_HIDDEN 106 /* ext symbol in dmert public lib */
71
72 /* New storage classes for 80960 */
73
74 /* C_LEAFPROC is obsolete. Use C_LEAFEXT or C_LEAFSTAT */
75 #define C_LEAFPROC 108 /* Leaf procedure, "call" via BAL */
76
77 #define C_SCALL 107 /* Procedure reachable via system call */
78 #define C_LEAFEXT 108 /* External leaf */
79 #define C_LEAFSTAT 113 /* Static leaf */
80 #define C_OPTVAR 109 /* Optimized variable */
81 #define C_DEFINE 110 /* Preprocessor #define */
82 #define C_PRAGMA 111 /* Advice to compiler or linker */
83 #define C_SEGMENT 112 /* 80960 segment name */
84
85 /********************** SECTION HEADER **********************/
86 struct internal_scnhdr {
87 char s_name[8]; /* section name */
88 long s_paddr; /* physical address, aliased s_nlib */
89 long s_vaddr; /* virtual address */
90 long s_size; /* section size */
91 long s_scnptr; /* file ptr to raw data for section */
92 long s_relptr; /* file ptr to relocation */
93 long s_lnnoptr; /* file ptr to line numbers */
94 #ifdef M88
95 unsigned long s_nreloc;
96 unsigned long s_nlnno;
97 #else
98 unsigned short s_nreloc; /* number of relocation entries */
99 unsigned short s_nlnno; /* number of line number entries*/
100 #endif
101 long s_flags; /* flags */
102 #ifdef I960
103 long s_align;
104 #endif
105 };
106
107
108 /*
109 * names of "special" sections
110 */
111 #define _TEXT ".text"
112 #define _DATA ".data"
113 #define _BSS ".bss"
114
115 /*
116 * s_flags "type"
117 */
118 #define STYP_REG (0x0000) /* "regular": allocated, relocated, loaded */
119 #define STYP_DSECT (0x0001) /* "dummy": relocated only*/
120 #define STYP_NOLOAD (0x0002) /* "noload": allocated, relocated, not loaded */
121 #define STYP_GROUP (0x0004) /* "grouped": formed of input sections */
122 #define STYP_PAD (0x0008) /* "padding": not allocated, not relocated, loaded */
123 #define STYP_COPY (0x0010) /* "copy": for decision function used by field update; not allocated, not relocated,
124 loaded; reloc & lineno entries processed normally */
125 #define STYP_TEXT (0x0020) /* section contains text only */
126 #define S_SHRSEG (0x0020) /* In 3b Update files (output of ogen), sections which appear in SHARED segments of the Pfile
127 will have the S_SHRSEG flag set by ogen, to inform dufr that updating 1 copy of the proc. will
128 update all process invocations. */
129 #define STYP_DATA (0x0040) /* section contains data only */
130 #define STYP_BSS (0x0080) /* section contains bss only */
131 #define S_NEWFCN (0x0100) /* In a minimal file or an update file, a new function (as compared with a replaced function) */
132 #define STYP_INFO (0x0200) /* comment: not allocated not relocated, not loaded */
133 #define STYP_OVER (0x0400) /* overlay: relocated not allocated or loaded */
134 #define STYP_LIB (0x0800) /* for .lib: same as INFO */
135 #define STYP_MERGE (0x2000) /* merge section -- combines with text, data or bss sections only */
136 #define STYP_REVERSE_PAD (0x4000) /* section will be padded with no-op instructions wherever padding is necessary and there is a
137 word of contiguous bytes beginning on a word boundary. */
138 /********************** LINE NUMBERS **********************/
139
140 /* 1 line number entry for every "breakpointable" source line in a section.
141 * Line numbers are grouped on a per function basis; first entry in a function
142 * grouping will have l_lnno = 0 and in place of physical address will be the
143 * symbol table index of the function name.
144 */
145
146 struct internal_lineno {
147 union {
148 long l_symndx; /* function name symbol index, iff l_lnno == 0*/
149 long l_paddr; /* (physical) address of line number */
150 } l_addr;
151 #ifdef M88
152 unsigned long l_lnno; /* line number */
153 #else
154 unsigned short l_lnno; /* line number */
155 #endif
156 };
157
158
159 /********************** SYMBOLS **********************/
160
161 struct internal_syment {
162 union {
163 char _n_name[SYMNMLEN]; /* old COFF version */
164 struct {
165 long _n_zeroes; /* new == 0 */
166 long _n_offset; /* offset into string table */
167 } _n_n;
168 char *_n_nptr[2]; /* allows for overlaying */
169 } _n;
170 long n_value; /* value of symbol */
171 short n_scnum; /* section number */
172 unsigned short n_flags; /* copy of flags from filhdr */
173 unsigned short n_type; /* type and derived type */
174 #if __STDC__
175 signed
176 #endif
177 char n_sclass; /* storage class */
178 char n_numaux; /* number of aux. entries */
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 ((short)0) /* undefined symbol */
185 #define N_ABS ((short)-1) /* value of symbol is absolute */
186 #define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */
187 #define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */
188 #define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/
189
190 /*
191 * Type of a symbol, in low N bits of the word
192 */
193 #define T_NULL 0
194 #define T_VOID 1 /* function argument (only used by compiler) */
195 #define T_CHAR 2 /* character */
196 #define T_SHORT 3 /* short integer */
197 #define T_INT 4 /* integer */
198 #define T_LONG 5 /* long integer */
199 #define T_FLOAT 6 /* floating point */
200 #define T_DOUBLE 7 /* double word */
201 #define T_STRUCT 8 /* structure */
202 #define T_UNION 9 /* union */
203 #define T_ENUM 10 /* enumeration */
204 #define T_MOE 11 /* member of enumeration*/
205 #define T_UCHAR 12 /* unsigned character */
206 #define T_USHORT 13 /* unsigned short */
207 #define T_UINT 14 /* unsigned integer */
208 #define T_ULONG 15 /* unsigned long */
209 #define T_LNGDBL 16 /* long double */
210
211 /*
212 * derived types, in n_type
213 */
214 #define DT_NON (0) /* no derived type */
215 #define DT_PTR (1) /* pointer */
216 #define DT_FCN (2) /* function */
217 #define DT_ARY (3) /* array */
218
219 #define BTYPE(x) ((x) & N_BTMASK)
220
221 #define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
222 #define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
223 #define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
224 #define ISTAG(x) ((x)==C_STRTAG||(x)==C_UNTAG||(x)==C_ENTAG)
225 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
226
227
228 union internal_auxent
229 {
230 struct {
231 union {
232 long l; /* str, un, or enum tag indx */
233 struct coff_ptr_struct *p;
234 } x_tagndx;
235
236 union {
237 struct {
238 unsigned short x_lnno; /* declaration line number */
239 unsigned short x_size; /* str/union/array size */
240 } x_lnsz;
241 long x_fsize; /* size of function */
242 } x_misc;
243 union {
244
245 struct { /* if ISFCN, tag, or .bb */
246 long x_lnnoptr; /* ptr to fcn line # */
247 union { /* entry ndx past block end */
248 long l;
249 struct coff_ptr_struct *p;
250
251 } x_endndx;
252
253
254 } x_fcn;
255 struct { /* if ISARY, up to 4 dimen. */
256 unsigned short x_dimen[DIMNUM];
257 } x_ary;
258 } x_fcnary;
259 unsigned short x_tvndx; /* tv index */
260 } x_sym;
261
262 union {
263 char x_fname[FILNMLEN];
264 struct {
265 long x_zeroes;
266 long x_offset;
267 } x_n;
268 } x_file;
269
270 struct {
271 long x_scnlen; /* section length */
272 unsigned short x_nreloc; /* # relocation entries */
273 unsigned short x_nlinno; /* # line numbers */
274 } x_scn;
275
276 struct {
277 long x_tvfill; /* tv fill value */
278 unsigned short x_tvlen; /* length of .tv */
279 unsigned short x_tvran[2]; /* tv range */
280 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
281
282 /******************************************
283 * I960-specific *2nd* aux. entry formats
284 ******************************************/
285 struct {
286 /* This is a very old typo that keeps getting propagated. */
287 #define x_stdindx x_stindx
288 long x_stindx; /* sys. table entry */
289 } x_sc; /* system call entry */
290
291 struct {
292 unsigned long x_balntry; /* BAL entry point */
293 } x_bal; /* BAL-callable function */
294
295 struct {
296 unsigned long x_timestamp; /* time stamp */
297 char x_idstring[20]; /* producer identity string */
298 } x_ident; /* Producer ident info */
299
300
301 };
302
303 /********************** RELOCATION DIRECTIVES **********************/
304
305 struct internal_reloc {
306 long r_vaddr; /* Virtual address of reference */
307 long r_symndx; /* Index into symbol table */
308 unsigned short r_type; /* Relocation type */
309 #if M88
310 unsigned short r_offset;
311 #endif
312 };
313
314 #define R_RELBYTE 017
315 #define R_RELWORD 020
316 #define R_PCRBYTE 022
317 #define R_PCRWORD 023
318 #define R_PCRLONG 024
319
320 #define R_DIR32 06
321 #define R_PCLONG 020
322 #define R_RELBYTE 017
323 #define R_RELWORD 020
324
325 #define R_PCRBYTE 022
326 #define R_PCRWORD 023
327 #define R_PCRLONG 024
328
329 #define R_PCR16L 128
330 #define R_PCR26L 129
331 #define R_VRT16 130
332 #define R_HVRT16 131
333 #define R_LVRT16 132
334 #define R_VRT32 133
335 #define R_RELLONG (0x11) /* Direct 32-bit relocation */
336 #define R_IPRSHORT (0x18)
337 #define R_IPRMED (0x19) /* 24-bit ip-relative relocation */
338 #define R_IPRLONG (0x1a)
339 #define R_OPTCALL (0x1b) /* 32-bit optimizable call (leafproc/sysproc) */
340 #define R_OPTCALLX (0x1c) /* 64-bit optimizable call (leafproc/sysproc) */
341 #define R_GETSEG (0x1d)
342 #define R_GETPA (0x1e)
343 #define R_TAGWORD (0x1f)
This page took 0.038582 seconds and 4 git commands to generate.