7888 installboot: print version info of the file
[unleashed.git] / include / syms.h
blobd18dda2ff4a5e7f47479cf384df477ad40a32458
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
22 /* Copyright (c) 1988 AT&T */
23 /* All Rights Reserved */
26 #ifndef _SYMS_H
27 #define _SYMS_H
29 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 2.8 */
31 /* Storage Classes are defined in storclass.h */
32 #include <storclass.h>
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 /* Number of characters in a symbol name */
39 #define SYMNMLEN 8
40 /* Number of characters in a file name */
41 #define FILNMLEN 14
42 /* Number of array dimensions in auxiliary entry */
43 #define DIMNUM 4
45 struct syment
47 union
49 char _n_name[SYMNMLEN]; /* old COFF version */
50 struct
52 long _n_zeroes; /* new == 0 */
53 long _n_offset; /* offset into string table */
54 } _n_n;
55 char *_n_nptr[2]; /* allows for overlaying */
56 } _n;
57 unsigned long n_value; /* value of symbol */
58 short n_scnum; /* section number */
59 unsigned short n_type; /* type and derived type */
60 char n_sclass; /* storage class */
61 char n_numaux; /* number of aux. entries */
64 #define n_name _n._n_name
65 #define n_nptr _n._n_nptr[1]
66 #define n_zeroes _n._n_n._n_zeroes
67 #define n_offset _n._n_n._n_offset
70 * Relocatable symbols have a section number of the
71 * section in which they are defined. Otherwise, section
72 * numbers have the following meanings:
74 /* undefined symbol */
75 #define N_UNDEF 0
76 /* value of symbol is absolute */
77 #define N_ABS -1
78 /* special debugging symbol -- value of symbol is meaningless */
79 #define N_DEBUG -2
80 /* indicates symbol needs transfer vector (preload) */
81 #define N_TV (unsigned short)-3
83 /* indicates symbol needs transfer vector (postload) */
85 #define P_TV (unsigned short)-4
88 * The fundamental type of a symbol packed into the low
89 * 4 bits of the word.
92 #define _EF ".ef"
94 #define T_NULL 0
95 #define T_ARG 1 /* function argument (only used by compiler) */
96 #define T_CHAR 2 /* character */
97 #define T_SHORT 3 /* short integer */
98 #define T_INT 4 /* integer */
99 #define T_LONG 5 /* long integer */
100 #define T_FLOAT 6 /* floating point */
101 #define T_DOUBLE 7 /* double word */
102 #define T_STRUCT 8 /* structure */
103 #define T_UNION 9 /* union */
104 #define T_ENUM 10 /* enumeration */
105 #define T_MOE 11 /* member of enumeration */
106 #define T_UCHAR 12 /* unsigned character */
107 #define T_USHORT 13 /* unsigned short */
108 #define T_UINT 14 /* unsigned integer */
109 #define T_ULONG 15 /* unsigned long */
112 * derived types are:
115 #define DT_NON 0 /* no derived type */
116 #define DT_PTR 1 /* pointer */
117 #define DT_FCN 2 /* function */
118 #define DT_ARY 3 /* array */
121 * type packing constants
124 #define N_BTMASK 017
125 #define N_TMASK 060
126 #define N_TMASK1 0300
127 #define N_TMASK2 0360
128 #define N_BTSHFT 4
129 #define N_TSHIFT 2
132 * MACROS
135 /* Basic Type of x */
137 #define BTYPE(x) ((x) & N_BTMASK)
139 /* Is x a pointer ? */
141 #define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
143 /* Is x a function ? */
145 #define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
147 /* Is x an array ? */
149 #define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
151 /* Is x a structure, union, or enumeration TAG? */
153 #define ISTAG(x) ((x) == C_STRTAG || (x) == C_UNTAG || (x) == C_ENTAG)
155 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(DT_PTR<<N_BTSHFT)|(x&N_BTMASK))
157 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
160 * AUXILIARY ENTRY FORMAT
163 union auxent
165 struct
167 long x_tagndx; /* str, un, or enum tag indx */
168 union
170 struct
172 unsigned short x_lnno; /* declaration line */
173 /* number */
174 unsigned short x_size; /* str, union, array */
175 /* size */
176 } x_lnsz;
177 long x_fsize; /* size of function */
178 } x_misc;
179 union
181 struct /* if ISFCN, tag, or .bb */
183 long x_lnnoptr; /* ptr to fcn line # */
184 long x_endndx; /* entry ndx past */
185 /* block end */
186 } x_fcn;
187 struct /* if ISARY, up to 4 dimen. */
189 unsigned short x_dimen[DIMNUM];
190 } x_ary;
191 } x_fcnary;
192 unsigned short x_tvndx; /* tv index */
193 } x_sym;
194 struct
196 char x_fname[FILNMLEN];
197 } x_file;
198 struct
200 long x_scnlen; /* section length */
201 unsigned short x_nreloc; /* number of reloc entries */
202 unsigned short x_nlinno; /* number of line numbers */
203 } x_scn;
205 struct
207 long x_tvfill; /* tv fill value */
208 unsigned short x_tvlen; /* length of .tv */
209 unsigned short x_tvran[2]; /* tv range */
210 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
213 #define SYMENT struct syment
214 #define SYMESZ 18 /* sizeof(SYMENT) */
216 #define AUXENT union auxent
217 #define AUXESZ 18 /* sizeof(AUXENT) */
219 /* Defines for "special" symbols */
221 #define _ETEXT "etext"
222 #define _EDATA "edata"
223 #define _END "end"
224 #define _START "_start"
226 #ifdef __cplusplus
228 #endif
230 #endif /* _SYMS_H */