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