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