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