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