|
|
1.1 root 1: .TH STAB 5
2: .CT 1 lib_obj
3: .SH NAME
4: stab \- symbol table types
5: .SH SYNOPSIS
6: .B "#include <stab.h>"
7: .SH DESCRIPTION
8: The include file
9: .L <stab.h>
10: defines some values of the
11: .L n_type
12: field of the symbol table of object files; see
13: .IR a.out (5).
14: These are the types for permanent symbols
15: used by the compilers
16: .IR cc (1)
17: and
18: .IR f77 (1)
19: and the debugger
20: .IR pi (9.1).
21: Symbol table entries are produced by assembler directives:
22: .TP \w'\f5.stabs\ \ \fP'u
23: .B .stabs
24: specifies a name in quotes \f5" "\fR, a symbol type
25: .RL ( n_type ),
26: one char
27: .RL ( n_other ),
28: one short
29: .RL ( n_desc),
30: and an unsigned long
31: .RL ( n_value ,
32: usually an address).
33: .PD 0
34: .TP
35: .B .stabd
36: the same, referring to the current location without an explicit
37: name.
38: .TP
39: .B .stabn
40: generates entries with no name.
41: .PD
42: .LP
43: The loader
44: .IR ld (1)
45: preserves the order of symbol table entries produced
46: by these directives.
47: .PP
48: The low bits of the
49: .L n_type
50: field place a symbol into
51: at most one segment, according to
52: the following masks, defined in
53: .BR <a.out.h> .
54: .PP
55: .EX
56: .ta \w'#define\ 'u +\w'N_FNAME\ 'u +\w'0x0\ \ \ 'u
57: #define N_UNDF 0x0 /* undefined */
58: #define N_ABS 0x2 /* absolute */
59: #define N_TEXT 0x4 /* text */
60: #define N_DATA 0x6 /* data */
61: #define N_BSS 0x8 /* bss */
62: #define N_EXT 0x1 /* external bit, or'ed in */
63: .EE
64: .PP
65: The
66: .L n_value
67: field of a symbol is relocated by
68: .I ld
69: as an address within the appropriate segment,
70: or is unchanged for a symbol not in any segment.
71: In addition, the loader will discard certain symbols, according to rules
72: of its own, unless the
73: .L n_type
74: field has one of the following bits set:
75: .PP
76: .L
77: #define N_STAB 0xe0
78: .PP
79: This allows up to 112 symbol types, split among the various
80: segments.
81: Some of these have already been claimed.
82: Option
83: .B -g
84: of
85: .I cc
86: uses the following values, all 4 mod 16, for text symbols.
87: Comments show the pertinent fields of the
88: .B .stabs
89: directive.
90: .PP
91: .EX
92: .ta \w'#define\ 'u +\w'N_ECOMM\ 'u +\w'0x0\ \ \ 'u +\n(wwu
93: #define N_BFUN 0x24 /* procedure: name,,0,lineno,address */
94: #define N_FUN 0x24
95: #define N_NARGS 0x34 /* function call: ,,0,nbytes,address */
96: #define N_SLINE 0x44 /* src line: ,,0,lineno,address */
97: #define N_SO 0x64 /* source file: name,,0,lineno,address */
98: #define N_SOL 0x84 /* #include file: name,,0,lineno,address */
99: #define N_ESO 0x94 /* end source file: name,,0,lineno,address */
100: #define N_ENTRY 0xa4 /* alternate entry: name,,0,lineno,address */
101: #define N_RFUN 0xb4 /* return from function: ,,0,lineno,address */
102: #define N_LBRAC 0xc4 /* left bracket: ,,0,level,address */
103: #define N_RBRAC 0xd4 /* right bracket: ,,0,level,address */
104: #define N_EFUN 0xf4 /* end of function: name,,0,lineno,address */
105: .EE
106: .PP
107: These values, all 8 mod 16, are used for data symbols:
108: .PP
109: .EX
110: #define N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,address */
111: #define N_ECOML 0xe8 /* end common (local name): ,,address */
112: .EE
113: .PP
114: And these for non-relocated symbols:
115: .PP
116: .EX
117: #define N_GSYM 0x20 /* global symbol: name,,0,type,0 */
118: #define N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */
119: #define N_STFUN 0x32 /* static function: name,,0,type,0 */
120: #define N_RSYM 0x40 /* register sym: name,,0,type,register */
121: #define N_BSTR 0x5c /* begin structure: name,,0,type,length */
122: #define N_ESTR 0x5e /* end structure: name,,0,type,length */
123: #define N_SSYM 0x60 /* structure elt: name,,0,type,offset */
124: #define N_SFLD 0x70 /* structure field: name,,0,type,offset */
125: #define N_LSYM 0x80 /* local sym: name,,0,type,offset */
126: #define N_PSYM 0xa0 /* parameter: name,,0,type,offset */
127: #define N_BCOMM 0xe2 /* begin common: name,, */
128: #define N_ECOMM 0xe4 /* end common: name,, */
129: #define N_VER 0xf0 /* symbol table version number */
130: #define N_TYID 0xfa /* struct, union, or enum name */
131: #define N_DIM 0xfc /* dimension for arrays */
132: .EE
133: .PP
134: Field
135: .L n_desc
136: holds a type specifier in the form used by
137: .IR cc (1),
138: by up to 6 qualifiers, with
139: .B q1
140: most significant:
141: .PP
142: .EX
143: .ta \w'#define 'u +\w'short\ \ 'u
144: struct desc {
145: short q6:2, q5:2, q4:2, q3:2, q2:2, q1:2;
146: short basic:5;
147: };
148: .EE
149: .PP
150: The qualifiers are coded thus:
151: .2C
152: \f50\fR none
153: \f51\fR pointer
154: \f52\fR function
155: \f53\fR array
156: .1C
157: .PP
158: The basic types are coded thus:
159: .2C
160: \f50\fR undefined
161: \f51\fR function argument
162: \f52\fR character
163: \f53\fR short
164: \f54\fR int
165: \f55\fR long
166: \f56\fR float
167: \f57\fR double
168: \f58\fR structure
169: \f59\fR union
170: \f510\fR enumeration
171: \f511\fR member of enumeration
172: \f512\fR unsigned character
173: \f513\fR unsigned short
174: \f514\fR unsigned int
175: \f515\fR unsigned long
176: \f516\fR void
177: .1C
178: .PP
179: The Pascal compiler,
180: .IR pc (A),
181: uses the following
182: .L n_type
183: value:
184: .PP
185: .L
186: #define N_PC 0x30 /* global pascal symbol: name,,0,subtype,line */
187: .PP
188: and uses the following subtypes to do type checking across separately
189: compiled files:
190: .2C
191: \f51\fR source file name
192: \f52\fR included file name
193: \f53\fR global label
194: \f54\fR global constant
195: \f55\fR global type
196: \f56\fR global variable
197: \f57\fR global function
198: \f58\fR global procedure
199: \f59\fR external function
200: \f510\fR external procedure
201: .1C
202: .SH "SEE ALSO"
203: .IR a.out (5),
204: .IR pi (9.1),
205: .IR as (1),
206: .IR ld (1)
207: .SH BUGS
208: .PP
209: The loader's relocation conventions limit the number of useful
210: .LR n_type
211: values.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.