* All files: Define FILHSZ, AOUTSZ, AOUTHDRSZ, SCNHSZ, SYMESZ,
[deliverable/binutils-gdb.git] / include / coff / sym.h
1 /*
2 * |-----------------------------------------------------------|
3 * | Copyright (c) 1992, 1991, 1990 MIPS Computer Systems, Inc.|
4 * | MIPS Computer Systems, Inc. grants reproduction and use |
5 * | rights to all parties, PROVIDED that this comment is |
6 * | maintained in the copy. |
7 * |-----------------------------------------------------------|
8 */
9 /* $Header$ */
10 #ifndef _SYM_H
11 #define _SYM_H
12
13 /* (C) Copyright 1984 by Third Eye Software, Inc.
14 *
15 * Third Eye Software, Inc. grants reproduction and use rights to
16 * all parties, PROVIDED that this comment is maintained in the copy.
17 *
18 * Third Eye makes no claims about the applicability of this
19 * symbol table to a particular use.
20 */
21
22 /*
23 * This file contains the definition of the Third Eye Symbol Table.
24 *
25 * Symbols are assumed to be in 'encounter order' - i.e. the order that
26 * the things they represent were encountered by the compiler/assembler/loader.
27 * EXCEPT for globals! These are assumed to be bunched together,
28 * probably right after the last 'normal' symbol. Globals ARE sorted
29 * in ascending order.
30 *
31 * -----------------------------------------------------------------------
32 * A brief word about Third Eye naming/use conventions:
33 *
34 * All arrays and index's are 0 based.
35 * All "ifooMax" values are the highest legal value PLUS ONE. This makes
36 * them good for allocating arrays, etc. All checks are "ifoo < ifooMax".
37 *
38 * "isym" Index into the SYMbol table.
39 * "ipd" Index into the Procedure Descriptor array.
40 * "ifd" Index into the File Descriptor array.
41 * "iss" Index into String Space.
42 * "cb" Count of Bytes.
43 * "rgPd" array whose domain is "0..ipdMax-1" and RanGe is PDR.
44 * "rgFd" array whose domain is "0..ifdMax-1" and RanGe is FDR.
45 */
46
47
48 /*
49 * Symbolic Header (HDR) structure.
50 * As long as all the pointers are set correctly,
51 * we don't care WHAT order the various sections come out in!
52 *
53 * A file produced solely for the use of CDB will probably NOT have
54 * any instructions or data areas in it, as these are available
55 * in the original.
56 */
57
58 #ifdef _LANGUAGE_C
59
60 #ifdef __lint
61 #include <exception.h> /* defines struct exception_info */
62 #endif
63
64 typedef struct {
65 short magic; /* to verify validity of the table */
66 short vstamp; /* version stamp */
67 long ilineMax; /* number of line number entries */
68 long cbLine; /* number of bytes for line number entries */
69 long cbLineOffset; /* offset to start of line number entries*/
70 long idnMax; /* max index into dense number table */
71 long cbDnOffset; /* offset to start dense number table */
72 long ipdMax; /* number of procedures */
73 long cbPdOffset; /* offset to procedure descriptor table */
74 long isymMax; /* number of local symbols */
75 long cbSymOffset; /* offset to start of local symbols*/
76 long ioptMax; /* max index into optimization symbol entries */
77 long cbOptOffset; /* offset to optimization symbol entries */
78 long iauxMax; /* number of auxillary symbol entries */
79 long cbAuxOffset; /* offset to start of auxillary symbol entries*/
80 long issMax; /* max index into local strings */
81 long cbSsOffset; /* offset to start of local strings */
82 long issExtMax; /* max index into external strings */
83 long cbSsExtOffset; /* offset to start of external strings */
84 long ifdMax; /* number of file descriptor entries */
85 long cbFdOffset; /* offset to file descriptor table */
86 long crfd; /* number of relative file descriptor entries */
87 long cbRfdOffset; /* offset to relative file descriptor table */
88 long iextMax; /* max index into external symbols */
89 long cbExtOffset; /* offset to start of external symbol entries*/
90 /* If you add machine dependent fields, add them here */
91 } HDRR, *pHDRR;
92 #define cbHDRR sizeof(HDRR)
93 #define hdrNil ((pHDRR)0)
94
95 /*
96 * The FDR and PDR structures speed mapping of address <-> name.
97 * They are sorted in ascending memory order and are kept in
98 * memory by CDB at runtime.
99 */
100
101 /*
102 * File Descriptor
103 *
104 * There is one of these for EVERY FILE, whether compiled with
105 * full debugging symbols or not. The name of a file should be
106 * the path name given to the compiler. This allows the user
107 * to simply specify the names of the directories where the COMPILES
108 * were done, and we will be able to find their files.
109 * A field whose comment starts with "R - " indicates that it will be
110 * setup at runtime.
111 */
112 typedef struct fdr {
113 unsigned long adr; /* memory address of beginning of file */
114 long rss; /* file name (of source, if known) */
115 long issBase; /* file's string space */
116 long cbSs; /* number of bytes in the ss */
117 long isymBase; /* beginning of symbols */
118 long csym; /* count file's of symbols */
119 long ilineBase; /* file's line symbols */
120 long cline; /* count of file's line symbols */
121 long ioptBase; /* file's optimization entries */
122 long copt; /* count of file's optimization entries */
123 unsigned short ipdFirst;/* start of procedures for this file */
124 short cpd; /* count of procedures for this file */
125 long iauxBase; /* file's auxiliary entries */
126 long caux; /* count of file's auxiliary entries */
127 long rfdBase; /* index into the file indirect table */
128 long crfd; /* count file indirect entries */
129 unsigned lang: 5; /* language for this file */
130 unsigned fMerge : 1; /* whether this file can be merged */
131 unsigned fReadin : 1; /* true if it was read in (not just created) */
132 unsigned fBigendian : 1;/* if set, was compiled on big endian machine */
133 /* aux's will be in compile host's sex */
134 unsigned glevel : 2; /* level this file was compiled with */
135 unsigned reserved : 22; /* reserved for future use */
136 long cbLineOffset; /* byte offset from header for this file ln's */
137 long cbLine; /* size of lines for this file */
138 } FDR, *pFDR;
139 #define cbFDR sizeof(FDR)
140 #define fdNil ((pFDR)0)
141 #define ifdNil -1
142 #define ifdTemp 0
143 #define ilnNil -1
144
145
146 /*
147 * Procedure Descriptor
148 *
149 * There is one of these for EVERY TEXT LABEL.
150 * If a procedure is in a file with full symbols, then isym
151 * will point to the PROC symbols, else it will point to the
152 * global symbol for the label.
153 */
154
155 typedef struct pdr {
156 unsigned long adr; /* memory address of start of procedure */
157 long isym; /* start of local symbol entries */
158 long iline; /* start of line number entries*/
159 long regmask; /* save register mask */
160 long regoffset; /* save register offset */
161 long iopt; /* start of optimization symbol entries*/
162 long fregmask; /* save floating point register mask */
163 long fregoffset; /* save floating point register offset */
164 long frameoffset; /* frame size */
165 short framereg; /* frame pointer register */
166 short pcreg; /* offset or reg of return pc */
167 long lnLow; /* lowest line in the procedure */
168 long lnHigh; /* highest line in the procedure */
169 long cbLineOffset; /* byte offset for this procedure from the fd base */
170 } PDR, *pPDR;
171 #define cbPDR sizeof(PDR)
172 #define pdNil ((pPDR) 0)
173 #define ipdNil -1
174
175 /*
176 * The structure of the runtime procedure descriptor created by the loader
177 * for use by the static exception system.
178 */
179 typedef struct runtime_pdr {
180 unsigned long adr; /* memory address of start of procedure */
181 long regmask; /* save register mask */
182 long regoffset; /* save register offset */
183 long fregmask; /* save floating point register mask */
184 long fregoffset; /* save floating point register offset */
185 long frameoffset; /* frame size */
186 short framereg; /* frame pointer register */
187 short pcreg; /* offset or reg of return pc */
188 long irpss; /* index into the runtime string table */
189 long reserved;
190 struct exception_info *exception_info;/* pointer to exception array */
191 } RPDR, *pRPDR;
192 #define cbRPDR sizeof(RPDR)
193 #define rpdNil ((pRPDR) 0)
194
195 /*
196 * Line Numbers
197 *
198 * Line Numbers are segregated from the normal symbols because they
199 * are [1] smaller , [2] are of no interest to your
200 * average loader, and [3] are never needed in the middle of normal
201 * scanning and therefore slow things down.
202 *
203 * By definition, the first LINER for any given procedure will have
204 * the first line of a procedure and represent the first address.
205 */
206
207 typedef long LINER, *pLINER;
208 #define lineNil ((pLINER)0)
209 #define cbLINER sizeof(LINER)
210 #define ilineNil -1
211
212
213
214 /*
215 * The Symbol Structure (GFW, to those who Know!)
216 */
217
218 typedef struct {
219 long iss; /* index into String Space of name */
220 long value; /* value of symbol */
221 unsigned st : 6; /* symbol type */
222 unsigned sc : 5; /* storage class - text, data, etc */
223 unsigned reserved : 1; /* reserved */
224 unsigned index : 20; /* index into sym/aux table */
225 } SYMR, *pSYMR;
226 #define symNil ((pSYMR)0)
227 #define cbSYMR sizeof(SYMR)
228 #define isymNil -1
229 #define indexNil 0xfffff
230 #define issNil -1
231 #define issNull 0
232
233
234 /* The following converts a memory resident string to an iss.
235 * This hack is recognized in SbFIss, in sym.c of the debugger.
236 */
237 #define IssFSb(sb) (0x80000000 | ((unsigned long)(sb)))
238
239 /* E X T E R N A L S Y M B O L R E C O R D
240 *
241 * Same as the SYMR except it contains file context to determine where
242 * the index is.
243 */
244 typedef struct {
245 unsigned jmptbl:1; /* symbol is a jump table entry for shlibs */
246 unsigned cobol_main:1; /* symbol is a cobol main procedure */
247 unsigned weakext:1; /* symbol is weak external */
248 unsigned reserved:13; /* reserved for future use */
249 short ifd; /* where the iss and index fields point into */
250 SYMR asym; /* symbol for the external */
251 } EXTR, *pEXTR;
252 #define extNil ((pEXTR)0)
253 #define cbEXTR sizeof(EXTR)
254
255
256 /* A U X I L L A R Y T Y P E I N F O R M A T I O N */
257
258 /*
259 * Type Information Record
260 */
261 typedef struct {
262 unsigned fBitfield : 1; /* set if bit width is specified */
263 unsigned continued : 1; /* indicates additional TQ info in next AUX */
264 unsigned bt : 6; /* basic type */
265 unsigned tq4 : 4;
266 unsigned tq5 : 4;
267 /* ---- 16 bit boundary ---- */
268 unsigned tq0 : 4;
269 unsigned tq1 : 4; /* 6 type qualifiers - tqPtr, etc. */
270 unsigned tq2 : 4;
271 unsigned tq3 : 4;
272 } TIR, *pTIR;
273 #define cbTIR sizeof(TIR)
274 #define tiNil ((pTIR)0)
275 #define itqMax 6
276
277 /*
278 * Relative symbol record
279 *
280 * If the rfd field is 4095, the index field indexes into the global symbol
281 * table.
282 */
283
284 typedef struct {
285 unsigned rfd : 12; /* index into the file indirect table */
286 unsigned index : 20; /* index int sym/aux/iss tables */
287 } RNDXR, *pRNDXR;
288 #define cbRNDXR sizeof(RNDXR)
289 #define rndxNil ((pRNDXR)0)
290
291 /* dense numbers or sometimes called block numbers are stored in this type,
292 * a rfd of 0xffffffff is an index into the global table.
293 */
294 typedef struct {
295 unsigned long rfd; /* index into the file table */
296 unsigned long index; /* index int sym/aux/iss tables */
297 } DNR, *pDNR;
298 #define cbDNR sizeof(DNR)
299 #define dnNil ((pDNR)0)
300
301
302
303 /*
304 * Auxillary information occurs only if needed.
305 * It ALWAYS occurs in this order when present.
306
307 isymMac used by stProc only
308 TIR type info
309 TIR additional TQ info (if first TIR was not enough)
310 rndx if (bt == btStruct,btUnion,btEnum,btSet,btRange,
311 btTypedef):
312 rsym.index == iaux for btSet or btRange
313 else rsym.index == isym
314 dimLow btRange, btSet
315 dimMac btRange, btSet
316 rndx0 As many as there are tq arrays
317 dimLow0
318 dimHigh0
319 ...
320 rndxMax-1
321 dimLowMax-1
322 dimHighMax-1
323 width in bits if (bit field), width in bits.
324 */
325 #define cAuxMax (6 + (idimMax*3))
326
327 /* a union of all possible info in the AUX universe */
328 typedef union {
329 TIR ti; /* type information record */
330 RNDXR rndx; /* relative index into symbol table */
331 long dnLow; /* low dimension */
332 long dnHigh; /* high dimension */
333 long isym; /* symbol table index (end of proc) */
334 long iss; /* index into string space (not used) */
335 long width; /* width for non-default sized struc fields */
336 long count; /* count of ranges for variant arm */
337 } AUXU, *pAUXU;
338 #define cbAUXU sizeof(AUXU)
339 #define auxNil ((pAUXU)0)
340 #define iauxNil -1
341
342
343 /*
344 * Optimization symbols
345 *
346 * Optimization symbols contain some overlap information with the normal
347 * symbol table. In particular, the proc information
348 * is somewhat redundant but necessary to easily find the other information
349 * present.
350 *
351 * All of the offsets are relative to the beginning of the last otProc
352 */
353
354 typedef struct {
355 unsigned ot: 8; /* optimization type */
356 unsigned value: 24; /* address where we are moving it to */
357 RNDXR rndx; /* points to a symbol or opt entry */
358 unsigned long offset; /* relative offset this occured */
359 } OPTR, *pOPTR;
360 #define optNil ((pOPTR) 0)
361 #define cbOPTR sizeof(OPTR)
362 #define ioptNil -1
363
364 /*
365 * File Indirect
366 *
367 * When a symbol is referenced across files the following procedure is used:
368 * 1) use the file index to get the File indirect entry.
369 * 2) use the file indirect entry to get the File descriptor.
370 * 3) add the sym index to the base of that file's sym table
371 *
372 */
373
374 typedef long RFDT, *pRFDT;
375 #define cbRFDT sizeof(RFDT)
376 #define rfdNil -1
377
378 /*
379 * The file indirect table in the mips loader is known as an array of FITs.
380 * This is done to keep the code in the loader readable in the area where
381 * these tables are merged. Note this is only a name change.
382 */
383 typedef long FIT, *pFIT;
384 #define cbFIT sizeof(FIT)
385 #define ifiNil -1
386 #define fiNil ((pFIT) 0)
387
388 #endif /* _LANGUAGE_C */
389
390 #ifdef _LANGUAGE_PASCAL
391 #define ifdNil -1
392 #define ilnNil -1
393 #define ipdNil -1
394 #define ilineNil -1
395 #define isymNil -1
396 #define indexNil 16#fffff
397 #define issNil -1
398 #define issNull 0
399 #define itqMax 6
400 #define iauxNil -1
401 #define ioptNil -1
402 #define rfdNil -1
403 #define ifiNil -1
404 #endif /* _LANGUAGE_PASCAL */
405
406
407 /* Dense numbers
408 *
409 * Rather than use file index, symbol index pairs to represent symbols
410 * and globals, we use dense number so that they can be easily embeded
411 * in intermediate code and the programs that process them can
412 * use direct access tabls instead of hash table (which would be
413 * necesary otherwise because of the sparse name space caused by
414 * file index, symbol index pairs. Dense number are represented
415 * by RNDXRs.
416 */
417
418 /*
419 * The following table defines the meaning of each SYM field as
420 * a function of the "st". (scD/B == scData OR scBss)
421 *
422 * Note: the value "isymMac" is used by symbols that have the concept
423 * of enclosing a block of related information. This value is the
424 * isym of the first symbol AFTER the end associated with the primary
425 * symbol. For example if a procedure was at isym==90 and had an
426 * isymMac==155, the associated end would be at isym==154, and the
427 * symbol at 155 would probably (although not necessarily) be the
428 * symbol for the next procedure. This allows rapid skipping over
429 * internal information of various sorts. "stEnd"s ALWAYS have the
430 * isym of the primary symbol that started the block.
431 *
432
433 ST SC VALUE INDEX
434 -------- ------ -------- ------
435 stFile scText address isymMac
436 stLabel scText address ---
437 stGlobal scD/B address iaux
438 stStatic scD/B address iaux
439 stParam scAbs offset iaux
440 stLocal scAbs offset iaux
441 stProc scText address iaux (isymMac is first AUX)
442 stStaticProc scText address iaux (isymMac is first AUX)
443
444 stMember scNil ordinal --- (if member of enum)
445 stMember scNil byte offset iaux (if member of struct/union)
446 stMember scBits bit offset iaux (bit field spec)
447
448 stBlock scText address isymMac (text block)
449 stBlock scNil cb isymMac (struct/union member define)
450 stBlock scNil cMembers isymMac (enum member define)
451
452 stEnd scText address isymStart
453 stEnd scNil ------- isymStart (struct/union/enum)
454
455 stTypedef scNil ------- iaux
456 stRegReloc sc??? value old register number
457 stForward sc??? new address isym to original symbol
458
459 stConstant scInfo value --- (scalar)
460 stConstant scInfo iss --- (complex, e.g. string)
461
462 *
463 */
464 /* $Log$
465 /* Revision 1.1 1992/04/03 04:01:32 gnu
466 /* Date: Thu, 2 Apr 92 15:48:13 -0800
467 /* From: wu@mips.com (Alex Wu)
468 /* Message-Id: <9204022348.AA20058@goofy.mips.com>
469 /* To: gnu@cygnus.com
470 /* Subject: sym.h & symconst.h
471 /*
472 /* John,
473 /* I finally get our lawyer's approval. Here is the symconst.h and
474 /* the sym.h. Please let me know if there is anything else I can help.
475 /*
476 * Revision 3000.5.1.2 91/05/31 18:27:22 bettina
477 * fix DFARS in copyright
478 *
479 * Revision 3000.5.1.1 91/04/15 20:51:26 bettina
480 * fix copyright
481 *
482 * Revision 3000.5 91/04/09 13:39:51 keithm
483 * Added DEC specific changes.
484 *
485 * Revision 3000.3 91/03/13 18:55:54 karen
486 * changed __SYM_H to _SYM_H
487 *
488 * Revision 3000.2 90/12/10 13:53:26 zaineb
489 * Ansi Changes
490 *
491 * Revision 2020.2.1.1 90/10/30 12:31:15 shin
492 * copy from 2.21 for weakext flag
493 *
494 * Revision 2021.2 90/10/19 10:55:23 shin
495 * added weakext flag in EXTR structure
496 *
497 * Revision 2021.1 90/06/07 23:09:19 bettina
498 * 2.21 - branching off 2.20 for ansi C
499 *
500 * Revision 2020.2 90/05/17 18:17:57 chan
501 * *** empty log message ***
502 *
503 * Revision 2010.7.1.6 90/02/22 19:53:48 bettina
504 * 2.10 F1
505 *
506 * Revision 2010.7.1.5 89/11/29 22:41:00 bettina
507 * 2.10 BETA2
508 *
509 * Revision 2010.3 89/10/05 10:44:44 lai
510 * added lint wrapper
511 *
512 * Revision 2010.2 89/09/26 23:40:45 lai
513 * added #include exception.h
514 *
515 * Revision 2010.1 89/09/26 20:47:45 lai
516 * updated to 2.10
517 *
518 * Revision 1.3 89/09/26 20:08:54 lai
519 * added wrapper and $LOG
520 * updated for 2.10
521 *
522 */
523 #endif
This page took 0.072933 seconds and 4 git commands to generate.