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