|
|
1.1 root 1: /*
2: * static char ID_structsh[] = "@(#) structs.h: 1.8 12/1/83";
3: */
4:
5: #include "filehdr.h"
6: #include "scnhdr.h"
7: #include "syms.h"
8:
9:
10: typedef union act_item ACTITEM;
11: typedef struct infile INFILE;
12: typedef struct gsym SYMTAB;
13: typedef struct gaux AUXTAB;
14: typedef struct region REGION;
15: typedef struct anode ANODE;
16: typedef struct memtype MEMTYPE;
17: typedef struct insect INSECT;
18: typedef struct outsect OUTSECT;
19: typedef union exprnode ENODE;
20: typedef struct listown LISTOWN;
21:
22: #if pdp11
23: typedef long ADDRESS;
24: #else
25: typedef unsigned long ADDRESS;
26: #endif
27:
28: #define SYMSIZ sizeof(SYMTAB)
29: #define AUXSIZ sizeof(AUXTAB)
30:
31:
32: struct listown {
33: char *head;
34: char *tail;
35: };
36:
37: #ifndef ITEMID
38: #define ITEMID long /* size of a SDP access id */
39: #endif
40:
41:
42:
43: /*
44: * The following are the possible types of Action_Items
45: */
46:
47: #define AILDFILE 3 /* Load a Input Object File */
48: #define AILDLBRY 4 /* Load a Library */
49: #define AIEVEXPR 5 /* Evaluate an Expression */
50: #define AIDFNSCN 6 /* Define an Output Section */
51: #define AIADDSCN 7 /* Add Input Sect to Output Section */
52: #define AIADFILE 8 /* Add file to Output Section */
53: #define AIBOND 9 /* Bond output section to address */
54: #define AIDFOWNR 10 /* Allocate section within owner */
55: #define AIOWNATR 11 /* Alloc sect within owner with given attributes*/
56: #define AIDFNGRP 12 /* Define a "GROUP" */
57: #define AIDFNSYM 13 /* Define or undefine a symbol */
58: /*eject*/
59: union act_item {
60: /*
61: * This structure is used for types
62: * AILDFILE and AILDLBRY
63: */
64: struct {
65: ACTITEM *ainext; /* ptr to next act_item on list */
66: short aitype;
67: char *aiinflnm; /* ifile that contained directive */
68: short aiinlnno; /* line number of directive */
69: char *aifilnam; /* file name */
70: } ldlbry;
71: /*
72: * This structure is used for type
73: * AIADFILE
74: */
75: struct {
76: ACTITEM *ainext; /* ptr to next act_item on list */
77: short aitype;
78: char *aiinflnm; /* ifile that contained directive */
79: short aiinlnno; /* line number of directive */
80: char *aifilnam; /* file name */
81: short ainadscs; /* no. of ADSCN actions to follow*/
82: short aifill2; /* fill value to be used for ADSCNs */
83: char aifilflg; /* flag indicating that fill was set */
84: } adfile;
85: /*
86: * This structure is used for types
87: * AIDFNSCN and AIDFNGRP
88: */
89: struct {
90: ACTITEM *ainext; /* ptr to next act_item on list */
91: short aitype;
92: char *aiinflnm; /* ifile that contained directive */
93: short aiinlnno; /* line number of directive */
94: char ainame[8]; /* name of output section */
95: short aifill; /* value with which to fill "holes" */
96: char aiowname[8]; /* name of owner, only if specified */
97: ADDRESS aibndadr; /* bond address, only if specified */
98: short aiattown; /* attr. of owner, only if specified */
99: long aialign; /* no. of bits for alignment */
100: long aiblock; /* no. of bits for "file" alignment */
101: char aifillfg; /* flag indicating that fill was set */
102: char aisctype; /* section type (see scnhdr.h) */
103: struct listown sectspec; /* "head" of SECTSPEC List*/
104: } dfnscn;
105: /*
106: * This structure is used for type
107: * AIADDSCN
108: */
109: struct {
110: ACTITEM *ainext; /* ptr to next act_item on list */
111: short aitype;
112: char *aiinflnm; /* ifile that contained directive */
113: short aiinlnno; /* line number of directive */
114: char ainame[8]; /* name of input section */
115: short aifill; /* value with which to fill if uninitialized */
116: char *aiscfile; /* file name containing input section */
117: } addscn;
118: /*
119: * This structure is used for type
120: * AIEVEXPR
121: */
122: struct {
123: ACTITEM *ainext; /* ptr to next act_item on list */
124: short aitype;
125: char *aiinflnm; /* ifile that contained directive */
126: short aiinlnno; /* line number of directive */
127: ENODE *aiexptr; /* ptr to expression node */
128: } evexpr;
129: /*
130: * This structure is used for type
131: * AIDFNSYM
132: */
133: struct {
134: ACTITEM *ainext; /* ptr to next act_item on list */
135: short aitype;
136: char *aiinflnm; /* ifile that contained directive */
137: short aiinlnno; /* line number of directive */
138: char *aisymbol; /* symbol name */
139: short aideflag; /* symbol def/undef flag */
140: long aidefval; /* symbol def value */
141: } dfnsym;
142: /*
143: * This structure is used for type
144: * AIBOND
145: */
146: struct {
147: ACTITEM *ainext; /* ptr to next act_item on list */
148: short aitype;
149: char *aiinflnm; /* ifile that contained directive */
150: short aiinlnno; /* line number of directive */
151: OUTSECT *aioutsec; /* ptr to output section */
152: ADDRESS aiadrbnd;
153: } bond;
154: /*
155: * This structure is used for type
156: * AIDFOWNR
157: */
158: struct {
159: ACTITEM *ainext; /* ptr to next act_item on list */
160: short aitype;
161: char *aiinflnm; /* ifile that contained directive */
162: short aiinlnno; /* line number of directive */
163: OUTSECT *aioutsec; /* ptr to output section */
164: char ainamown[8];
165: } dfownr;
166: /*
167: * This structure is used for type
168: * AIOWNATR
169: */
170: struct {
171: ACTITEM *ainext; /* ptr to next act_item on list */
172: short aitype;
173: char *aiinflnm; /* ifile that contained directive */
174: short aiinlnno; /* line number of directive */
175: OUTSECT *aioutsec; /* ptr to output section */
176: short aiownatt;
177: } ownatr;
178: };
179: /*eject*/
180: /*
181: * Structure for REGIONs
182: */
183:
184: struct region {
185: REGION *rgnext; /* ptr to next region on REGLIST */
186: char rgname[8]; /* name of region */
187: ADDRESS rgorig;
188: ADDRESS rglength;
189: ADDRESS rgvaddr; /* virtual address */
190: ANODE *rgaddrhd; /* "head" of list of addr nodes */
191: ANODE *rgaddrtl; /* "tail" of list of addr nodes */
192: };
193:
194:
195:
196:
197: /*
198: * Address nodes (ANODEs) are linked off of REGIONs containing
199: * an entry for every configured piece of memory.
200: */
201:
202: struct anode {
203: ANODE *adnext; /* ptr to next ANODE */
204: ANODE *adprev; /* ptr to previous ANODE */
205: int adtype;
206: ADDRESS adpaddr; /* physical address */
207: ADDRESS adsize;
208: OUTSECT *adscnptr; /* used only for type == SECT */
209: MEMTYPE *admemp; /* ptr to owning memory type */
210: REGION *adregp; /* ptr to owning region */
211: };
212:
213: /*
214: * Possible values for adtype
215: * ADAVAIL : anode represents (a fragment of) unallocated
216: * configured virtual memory
217: * ADSECT : anode represents an allocated output section
218: * ADPAD : anode represents a file-padding output section
219: */
220:
221: #define ADAVAIL 1
222: #define ADSECT 2
223: #define ADPAD 4
224: /*eject*/
225: /*
226: * Structure for Memory Type
227: */
228:
229: struct memtype {
230: MEMTYPE *mtnext; /* ptr to next memtype on MEMLIST */
231: char mtname[8]; /* name of memtype */
232: ADDRESS mtorig;
233: ADDRESS mtlength;
234: int mtattr; /* attributes of memory type */
235: ANODE *mtaddrhd, /* start of owned memory nodes */
236: *mtaddrtl; /* end of same */
237: };
238: /*eject*/
239: /*
240: * Input Section Header Structure
241: */
242:
243: struct insect {
244: struct scnhdr ishdr;
245: INSECT *isnext; /* next input sect on INSEC List */
246: INFILE *isfilptr; /* ptr to input file */
247: OUTSECT *isoutsec; /* ptr to output section */
248: INSECT *isincnxt; /* ptr to next input sect on INCLUDE List*/
249: long isdispl; /* Displacement w.r.t. output section */
250: long isrldisp; /* Displacement of reloc entries
251: w.r.t. reloc of output section */
252: long islndisp; /* Displacement of linno entries
253: w.r.t. linno of output section */
254: long isnewvad; /* "relocated" virtual addr of sect*/
255: long isnewpad; /* "relocated" physical addr of sect*/
256: short isfill; /* Fill value, if bss section */
257: short isecnum; /* input section number */
258: char isfillfg; /* flag indicating fill was set */
259: };
260:
261:
262:
263:
264: /*
265: * Output Section Header Structure
266: */
267:
268: struct outsect {
269: struct scnhdr oshdr;
270: int ossecnum; /* Section Number */
271: short osfill; /* Fill value for holes in section */
272: INSECT *osinclhd; /* List of input sects included in
273: this output section */
274: INSECT *osincltl;
275: OUTSECT *osnext; /* Next section on OUTSEC List */
276: long osalign; /* no. of bits for alignment */
277: long osblock; /* no. of bits for "file" alignment */
278: OUTSECT *osdsnext; /* next section on DSECT list */
279: char osflags; /* flags */
280: };
281: /*
282: * Possible values for osflags
283: * FILL : flag indicating fill was set
284: * OSDSECT : flag indicating at least one input section was a dummy section
285: * OSREG : at least one of the input sections was a regular section
286: * OSINFO : at least one of the input sections was an info section
287: * OSCOPY : at least one of the input sections was a copy section
288: */
289: #define FILL 1
290: #define OSDSECT 2
291: #define OSREG 4
292: #define OSINFO 8
293: #define OSCOPY 16
294:
295:
296:
297:
298:
299: /*
300: * Symbol Table Entry structure for global symbols and auxiliary
301: * entries
302: */
303:
304: struct gsym {
305: SYMENT sment; /* symbol table entry */
306: INSECT *smscnptr; /* input section ptr */
307: ITEMID smmyacid; /* SDP id of this entry */
308: ITEMID smchainid; /* SDP id ptr to collision chain */
309: ITEMID smauxid; /* SDP id to aux entry list */
310: long smnewval; /* symbol value after relocation*/
311: long smoutndx; /* index of symbol in output sym tab*/
312: long smnewvirt; /* "new" virtual value or offset */
313: int smnamelength;
314: char smlocflg; /* flag indicating this entry is to be
315: written in the "local" part of table
316: (for example, functions) */
317: char smundmsg; /* flag for undefined symbols to
318: indicate that error msg was printed
319: (see plocsyms in output.c) */
320: };
321:
322:
323:
324: struct gaux {
325: AUXENT axent; /* aux entry for a symbol */
326: int axord; /* position of aux entry in the list */
327: ITEMID axmyacid; /* SDP id of this entry */
328: ITEMID axchainid; /* SDP id to next aux entry in list */
329: };
330: /*eject*/
331: /*
332: * Nodes in the Expression Tree
333: */
334:
335: union exprnode {
336: struct {
337: char exop; /* Operator of the node */
338: ENODE *exleft; /* left expr ptr for binary operator*/
339: /* only left ptr used for unary ops */
340: ENODE *exright; /* right expr ptr for binary operator*/
341: } gnode;
342: /*
343: * These structures are used for
344: * op == NAME and op == DOT
345: *
346: * The first is generated during PASS 1 (parsing), and converted
347: * into the second form in PASS 2
348: */
349: struct {
350: char exop; /* Operator of the node */
351: char symbol[9]; /* NAME */
352: } pnnode;
353: struct {
354: char exop; /* Operator of the node */
355: ITEMID exsymptr; /* SDP access id of symbol table entry*/
356: } nnode;
357: /*
358: * This structure is used for
359: * op == INT
360: */
361: struct {
362: char exop; /* Operator of the node */
363: long exvalue;
364: } vnode;
365: };
366: /*eject*/
367: /*
368: * Input File structure in INFILIST
369: */
370:
371: struct infile {
372: INFILE *flnext; /* Next file on INFILIST */
373: char *flname; /* pointer to file name */
374: long flnlsyms; /* No. local sym entries in input file*/
375: long flsymndx; /* index into output symbol table
376: for local syms from this file */
377: INSECT *flishead; /* head of INSEC list for this file */
378: INSECT *flistail; /* tail of INSEC list for this file */
379: long flfiloff; /* used for archive libraries: offset
380: form the beginning of the library
381: to this member */
382: #if FLEXNAMES
383: char *flstrings;
384: #endif
385: int flfilndx; /* used for archive libraries: # of
386: files to skip before this file*/
387: #if DMERT || XL
388: char flplib; /* to indicate the file is DMERT's
389: public library */
390: #endif
391: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.