1: # include <stdio.h>
2: #ifdef vax
3: #define WORD unsigned short
4: #endif vax
5: #ifdef pdp11
6: #define WORD unsigned
7: #endif pdp11
8:
9: /********************* structure declarations *************************/
10:
11: struct psect /* program section structure
12: ** Since program sections have to be referenced in
13: ** different ways, there are multiple link-lists
14: ** running through each structure.
15: ** Program sections are referenced 1) by ins-dat-bss
16: ** type to facilitate the computation of relocation
17: ** constants (*next), 2) by object file so that relocation
18: ** constants may be found when interpreting the code
19: ** section within a object file (*obsame).
20: ** In addition global program sections of the same
21: ** name and type must be grouped together (*pssame).
22: ** Also, a list of global relocatable symbols defined
23: ** in the psect in used to relocate these
24: ** symbols (*slist). */
25: {
26: char name[7];
27: char type; /* attribute byte from M11 */
28: int nbytes; /* number of bytes in psect */
29: WORD rc; /* relocation constant */
30: struct psect *next; /* next psect of same ins-dat-bss type */
31: struct psect *pssame; /* same psect from different object file */
32: struct psect *obsame; /* next psect in same object file */
33: struct symbol *slist; /* list of symbols defined in this psect */
34: };
35:
36:
37: struct symbol /* global symbol structure, the symbol
38: ** table is a binary tree of these structures .
39: ** There are also link-lists from each psect
40: ** running through the symbol table to
41: ** facilitate the relocation of symbols. */
42: {
43: char name[7];
44: char type; /* attribute byte from M11 */
45: int value;
46: int t_numb; /* number of the symbol in the out
47: ** file symbol table */
48: struct symbol *symlist; /* continuation of list of symbols
49: ** defined in this symbol's psect */
50: struct psect *prsect; /* program section of the symbol */
51: struct symbol *left; /* left child */
52: struct symbol *right; /* right child */
53: };
54:
55:
56: struct objfile /* object file structure */
57: {
58: char *fname;
59: struct objfile *nextfile; /* next file in link-list of files */
60: struct psect *psect_list; /* root to link-list of psects
61: ** in this object file */
62: char pname[7]; /* program name */
63: char *ver_id; /* version identification */
64: };
65:
66:
67: struct outword /* structure for linking a word to be written in
68: ** the out file with its relocation bits */
69: {
70: WORD val;
71: WORD rbits;
72: };
73:
74:
75: struct g_sect /* structure for global program section tree */
76: {
77: char name[7]; /* psect name */
78: char type; /* M11 coded type */
79: struct psect *last_sect; /* pointer to the last psect in the
80: ** link-list of global same psects */
81: struct g_sect *leftt; /* left child */
82: struct g_sect *rightt; /* right child */
83: };
84:
85:
86: /*********************** macros ****************************************/
87:
88:
89: /* macros for requesting input from the different parts of the
90: ** object files. */
91:
92: # define 001
93: # define CODE 017
94: # define SYMBOLS 022
95:
96: /* bit flags for attributes of psects and symbols */
97:
98: # define SHR 001
99: # define INS 002
100: # define BSS 004
101: # define DEF 010
102: # define OVR 020
103: # define REL 040
104: # define GBL 0100
105:
106: # define isabs(x) (((x)->type & REL) == 0)
107: # define isrel(x) (((x)->type & REL) != 0)
108: # define islcl(x) (((x)->type & GBL) == 0)
109: # define isgbl(x) (((x)->type & GBL) != 0)
110: # define isprv(x) (((x)->type & SHR) == 0)
111: # define isshr(x) (((x)->type & SHR) != 0)
112: # define isins(x) (((x)->type & INS) != 0)
113: # define isbss(x) (((x)->type & BSS) != 0)
114: # define isovr(x) (((x)->type & OVR) != 0)
115: # define iscon(x) (((x)->type & OVR) == 0)
116: # define isdef(x) (((x)->type & DEF) != 0)
117: # define isudf(x) (((x)->type & DEF) == 0)
Defined struct's
g_sect
defined in line
75; used 20 times
objfile
defined in line
56; used 36 times
- in line 59(2)
- in /usr/src/ucb/l11/link.c line
15(2),
45(2),
90-92(4),
255-260(8),
292(2),
711(2)
- in /usr/src/ucb/l11/pass2.c line
10(2),
179(2),
197(2),
404(2),
607(2),
653(2),
763(2)
psect
defined in line
11; used 56 times
- in line 30-32(6),
50(2),
60(2),
79(2)
- in /usr/src/ucb/l11/link.c line
9-14(12),
225-230(8),
246(2),
293(2),
299(2),
419(2),
462(2),
624-628(4),
712(2)
- in /usr/src/ucb/l11/pass2.c line
409(2),
656(2),
767-768(4)
symbol
defined in line
37; used 41 times
Defined macros
BSS
defined in line
100; used 6 times
CODE
defined in line
93; used 2 times
DEF
defined in line
101; used 7 times
GBL
defined in line
104; used 3 times
defined in line
92; used 1 times
INS
defined in line
99; used 7 times
OVR
defined in line
102; used 4 times
REL
defined in line
103; used 7 times
SHR
defined in line
98; used 4 times
WORD
defined in line
6; used 32 times
- in line 29,
70-71(2)
- in /usr/src/ucb/l11/in.c line
110
- in /usr/src/ucb/l11/link.c line
3,
18-20(2),
44-49(4)
- in /usr/src/ucb/l11/pass2.c line
3,
13-15(2),
34,
42-44(3),
69,
212-224(6),
354-355(2),
369-370(2),
729-730(2)
- in /usr/src/ucb/l11/sup.c line
26
Usage of this include