|
|
1.1 root 1: /* @(#)syms.h 2.4 2/28/83 */
2:
3: /* Storage Classes are defined in storclass.h */
4: #include "storclass.h"
5:
6: /* Number of characters in a symbol name */
7: #define SYMNMLEN 8
8: /* Number of characters in a file name */
9: #define FILNMLEN 14
10: /* Number of array dimensions in auxiliary entry */
11: #define DIMNUM 4
12:
13:
14: struct syment
15: {
16: union
17: {
18: char _n_name[SYMNMLEN]; /* old COFF version */
19: struct
20: {
21: long _n_zeroes; /* new == 0 */
22: long _n_offset; /* offset into string table */
23: } _n_n;
24: char *_n_nptr[2]; /* allows for overlaying */
25: } _n;
26: #ifndef pdp11
27: unsigned
28: #endif
29: long n_value; /* value of symbol */
30: short n_scnum; /* section number */
31: unsigned short n_type; /* type and derived type */
32: char n_sclass; /* storage class */
33: char n_numaux; /* number of aux. entries */
34: };
35:
36: #define n_name _n._n_name
37: #define n_nptr _n._n_nptr[1]
38: #define n_zeroes _n._n_n._n_zeroes
39: #define n_offset _n._n_n._n_offset
40:
41: /*
42: Relocatable symbols have a section number of the
43: section in which they are defined. Otherwise, section
44: numbers have the following meanings:
45: */
46: /* undefined symbol */
47: #define N_UNDEF 0
48: /* value of symbol is absolute */
49: #define N_ABS -1
50: /* special debugging symbol -- value of symbol is meaningless */
51: #define N_DEBUG -2
52: /* indicates symbol needs transfer vector (preload) */
53: #define N_TV (unsigned short)-3
54:
55: /* indicates symbol needs transfer vector (postload) */
56:
57: #define P_TV (unsigned short)-4
58:
59: /*
60: The fundamental type of a symbol packed into the low
61: 4 bits of the word.
62: */
63:
64: #define _EF ".ef"
65:
66: #define T_NULL 0
67: #define T_ARG 1 /* function argument (only used by compiler) */
68: #define T_CHAR 2 /* character */
69: #define T_SHORT 3 /* short integer */
70: #define T_INT 4 /* integer */
71: #define T_LONG 5 /* long integer */
72: #define T_FLOAT 6 /* floating point */
73: #define T_DOUBLE 7 /* double word */
74: #define T_STRUCT 8 /* structure */
75: #define T_UNION 9 /* union */
76: #define T_ENUM 10 /* enumeration */
77: #define T_MOE 11 /* member of enumeration */
78: #define T_UCHAR 12 /* unsigned character */
79: #define T_USHORT 13 /* unsigned short */
80: #define T_UINT 14 /* unsigned integer */
81: #define T_ULONG 15 /* unsigned long */
82:
83: /*
84: * derived types are:
85: */
86:
87: #define DT_NON 0 /* no derived type */
88: #define DT_PTR 1 /* pointer */
89: #define DT_FCN 2 /* function */
90: #define DT_ARY 3 /* array */
91:
92: /*
93: * type packing constants
94: */
95:
96: #define N_BTMASK 017
97: #define N_TMASK 060
98: #define N_TMASK1 0300
99: #define N_TMASK2 0360
100: #define N_BTSHFT 4
101: #define N_TSHIFT 2
102:
103: /*
104: * MACROS
105: */
106:
107: /* Basic Type of x */
108:
109: #define BTYPE(x) ((x) & N_BTMASK)
110:
111: /* Is x a pointer ? */
112:
113: #define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
114:
115: /* Is x a function ? */
116:
117: #define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
118:
119: /* Is x an array ? */
120:
121: #define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
122:
123: /* Is x a structure, union, or enumeration TAG? */
124:
125: #define ISTAG(x) ((x)==C_STRTAG || (x)==C_UNTAG || (x)==C_ENTAG)
126:
127: #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(DT_PTR<<N_BTSHFT)|(x&N_BTMASK))
128:
129: #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
130:
131: /*
132: * AUXILIARY ENTRY FORMAT
133: */
134:
135: union auxent
136: {
137: struct
138: {
139: long x_tagndx; /* str, un, or enum tag indx */
140: union
141: {
142: struct
143: {
144: unsigned short x_lnno; /* declaration line number */
145: unsigned short x_size; /* str, union, array size */
146: } x_lnsz;
147: long x_fsize; /* size of function */
148: } x_misc;
149: union
150: {
151: struct /* if ISFCN, tag, or .bb */
152: {
153: long x_lnnoptr; /* ptr to fcn line # */
154: long x_endndx; /* entry ndx past block end */
155: } x_fcn;
156: struct /* if ISARY, up to 4 dimen. */
157: {
158: unsigned short x_dimen[DIMNUM];
159: } x_ary;
160: } x_fcnary;
161: unsigned short x_tvndx; /* tv index */
162: } x_sym;
163: struct
164: {
165: char x_fname[FILNMLEN];
166: } x_file;
167: struct
168: {
169: long x_scnlen; /* section length */
170: unsigned short x_nreloc; /* number of relocation entries */
171: unsigned short x_nlinno; /* number of line numbers */
172: } x_scn;
173:
174: struct
175: {
176: long x_tvfill; /* tv fill value */
177: unsigned short x_tvlen; /* length of .tv */
178: unsigned short x_tvran[2]; /* tv range */
179: } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
180: };
181:
182: #define SYMENT struct syment
183: #define SYMESZ 18 /* sizeof(SYMENT) */
184:
185: #define AUXENT union auxent
186: #define AUXESZ 18 /* sizeof(AUXENT) */
187:
188: /* Defines for "special" symbols */
189:
190: #if vax
191: #define _ETEXT "_etext"
192: #define _EDATA "_edata"
193: #define _END "_end"
194: #else
195: #define _ETEXT "etext"
196: #define _EDATA "edata"
197: #define _END "end"
198: #endif
199:
200: #define _START "_start"
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.