1178525Sjb/* 2178525Sjb * CDDL HEADER START 3178525Sjb * 4178525Sjb * The contents of this file are subject to the terms of the 5178525Sjb * Common Development and Distribution License, Version 1.0 only 6178525Sjb * (the "License"). You may not use this file except in compliance 7178525Sjb * with the License. 8178525Sjb * 9178525Sjb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10178525Sjb * or http://www.opensolaris.org/os/licensing. 11178525Sjb * See the License for the specific language governing permissions 12178525Sjb * and limitations under the License. 13178525Sjb * 14178525Sjb * When distributing Covered Code, include this CDDL HEADER in each 15178525Sjb * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16178525Sjb * If applicable, add the following below this CDDL HEADER, with the 17178525Sjb * fields enclosed by brackets "[]" replaced with your own identifying 18178525Sjb * information: Portions Copyright [yyyy] [name of copyright owner] 19178525Sjb * 20178525Sjb * CDDL HEADER END 21178525Sjb */ 22178525Sjb/* Copyright (c) 1988 AT&T */ 23178525Sjb/* All Rights Reserved */ 24178525Sjb 25178525Sjb 26178525Sjb#ifndef _SYMS_H 27178525Sjb#define _SYMS_H 28178525Sjb 29178525Sjb#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 2.8 */ 30178525Sjb 31178525Sjb/* Storage Classes are defined in storclass.h */ 32178525Sjb#include <storclass.h> 33178525Sjb 34178525Sjb#ifdef __cplusplus 35178525Sjbextern "C" { 36178525Sjb#endif 37178525Sjb 38178525Sjb/* Number of characters in a symbol name */ 39178525Sjb#define SYMNMLEN 8 40178525Sjb/* Number of characters in a file name */ 41178525Sjb#define FILNMLEN 14 42178525Sjb/* Number of array dimensions in auxiliary entry */ 43178525Sjb#define DIMNUM 4 44178525Sjb 45178525Sjbstruct syment 46178525Sjb{ 47178525Sjb union 48178525Sjb { 49178525Sjb char _n_name[SYMNMLEN]; /* old COFF version */ 50178525Sjb struct 51178525Sjb { 52178525Sjb long _n_zeroes; /* new == 0 */ 53178525Sjb long _n_offset; /* offset into string table */ 54178525Sjb } _n_n; 55178525Sjb char *_n_nptr[2]; /* allows for overlaying */ 56178525Sjb } _n; 57178525Sjb unsigned long n_value; /* value of symbol */ 58178525Sjb short n_scnum; /* section number */ 59178525Sjb unsigned short n_type; /* type and derived type */ 60178525Sjb char n_sclass; /* storage class */ 61178525Sjb char n_numaux; /* number of aux. entries */ 62178525Sjb}; 63178525Sjb 64178525Sjb#define n_name _n._n_name 65178525Sjb#define n_nptr _n._n_nptr[1] 66178525Sjb#define n_zeroes _n._n_n._n_zeroes 67178525Sjb#define n_offset _n._n_n._n_offset 68178525Sjb 69178525Sjb/* 70178525Sjb * Relocatable symbols have a section number of the 71178525Sjb * section in which they are defined. Otherwise, section 72178525Sjb * numbers have the following meanings: 73178525Sjb */ 74178525Sjb /* undefined symbol */ 75178525Sjb#define N_UNDEF 0 76178525Sjb /* value of symbol is absolute */ 77178525Sjb#define N_ABS -1 78178525Sjb /* special debugging symbol -- value of symbol is meaningless */ 79178525Sjb#define N_DEBUG -2 80178525Sjb /* indicates symbol needs transfer vector (preload) */ 81178525Sjb#define N_TV (unsigned short)-3 82178525Sjb 83178525Sjb /* indicates symbol needs transfer vector (postload) */ 84178525Sjb 85178525Sjb#define P_TV (unsigned short)-4 86178525Sjb 87178525Sjb/* 88178525Sjb * The fundamental type of a symbol packed into the low 89178525Sjb * 4 bits of the word. 90178525Sjb */ 91178525Sjb 92178525Sjb#define _EF ".ef" 93178525Sjb 94178525Sjb#define T_NULL 0 95178525Sjb#define T_ARG 1 /* function argument (only used by compiler) */ 96178525Sjb#define T_CHAR 2 /* character */ 97178525Sjb#define T_SHORT 3 /* short integer */ 98178525Sjb#define T_INT 4 /* integer */ 99178525Sjb#define T_LONG 5 /* long integer */ 100178525Sjb#define T_FLOAT 6 /* floating point */ 101178525Sjb#define T_DOUBLE 7 /* double word */ 102178525Sjb#define T_STRUCT 8 /* structure */ 103178525Sjb#define T_UNION 9 /* union */ 104178525Sjb#define T_ENUM 10 /* enumeration */ 105178525Sjb#define T_MOE 11 /* member of enumeration */ 106178525Sjb#define T_UCHAR 12 /* unsigned character */ 107178525Sjb#define T_USHORT 13 /* unsigned short */ 108178525Sjb#define T_UINT 14 /* unsigned integer */ 109178525Sjb#define T_ULONG 15 /* unsigned long */ 110178525Sjb 111178525Sjb/* 112178525Sjb * derived types are: 113178525Sjb */ 114178525Sjb 115178525Sjb#define DT_NON 0 /* no derived type */ 116178525Sjb#define DT_PTR 1 /* pointer */ 117178525Sjb#define DT_FCN 2 /* function */ 118178525Sjb#define DT_ARY 3 /* array */ 119178525Sjb 120178525Sjb/* 121178525Sjb * type packing constants 122178525Sjb */ 123178525Sjb 124178525Sjb#define N_BTMASK 017 125178525Sjb#define N_TMASK 060 126178525Sjb#define N_TMASK1 0300 127178525Sjb#define N_TMASK2 0360 128178525Sjb#define N_BTSHFT 4 129178525Sjb#define N_TSHIFT 2 130178525Sjb 131178525Sjb/* 132178525Sjb * MACROS 133178525Sjb */ 134178525Sjb 135178525Sjb /* Basic Type of x */ 136178525Sjb 137178525Sjb#define BTYPE(x) ((x) & N_BTMASK) 138178525Sjb 139178525Sjb /* Is x a pointer ? */ 140178525Sjb 141178525Sjb#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) 142178525Sjb 143178525Sjb /* Is x a function ? */ 144178525Sjb 145178525Sjb#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) 146178525Sjb 147178525Sjb /* Is x an array ? */ 148178525Sjb 149178525Sjb#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) 150178525Sjb 151178525Sjb /* Is x a structure, union, or enumeration TAG? */ 152178525Sjb 153178525Sjb#define ISTAG(x) ((x) == C_STRTAG || (x) == C_UNTAG || (x) == C_ENTAG) 154178525Sjb 155178525Sjb#define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(DT_PTR<<N_BTSHFT)|(x&N_BTMASK)) 156178525Sjb 157178525Sjb#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) 158178525Sjb 159178525Sjb/* 160178525Sjb * AUXILIARY ENTRY FORMAT 161178525Sjb */ 162178525Sjb 163178525Sjbunion auxent 164178525Sjb{ 165178525Sjb struct 166178525Sjb { 167178525Sjb long x_tagndx; /* str, un, or enum tag indx */ 168178525Sjb union 169178525Sjb { 170178525Sjb struct 171178525Sjb { 172178525Sjb unsigned short x_lnno; /* declaration line */ 173178525Sjb /* number */ 174178525Sjb unsigned short x_size; /* str, union, array */ 175178525Sjb /* size */ 176178525Sjb } x_lnsz; 177178525Sjb long x_fsize; /* size of function */ 178178525Sjb } x_misc; 179178525Sjb union 180178525Sjb { 181178525Sjb struct /* if ISFCN, tag, or .bb */ 182178525Sjb { 183178525Sjb long x_lnnoptr; /* ptr to fcn line # */ 184178525Sjb long x_endndx; /* entry ndx past */ 185178525Sjb /* block end */ 186178525Sjb } x_fcn; 187178525Sjb struct /* if ISARY, up to 4 dimen. */ 188178525Sjb { 189178525Sjb unsigned short x_dimen[DIMNUM]; 190178525Sjb } x_ary; 191178525Sjb } x_fcnary; 192178525Sjb unsigned short x_tvndx; /* tv index */ 193178525Sjb } x_sym; 194178525Sjb struct 195178525Sjb { 196178525Sjb char x_fname[FILNMLEN]; 197178525Sjb } x_file; 198178525Sjb struct 199178525Sjb { 200178525Sjb long x_scnlen; /* section length */ 201178525Sjb unsigned short x_nreloc; /* number of reloc entries */ 202178525Sjb unsigned short x_nlinno; /* number of line numbers */ 203178525Sjb } x_scn; 204178525Sjb 205178525Sjb struct 206178525Sjb { 207178525Sjb long x_tvfill; /* tv fill value */ 208178525Sjb unsigned short x_tvlen; /* length of .tv */ 209178525Sjb unsigned short x_tvran[2]; /* tv range */ 210178525Sjb } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ 211178525Sjb}; 212178525Sjb 213178525Sjb#define SYMENT struct syment 214178525Sjb#define SYMESZ 18 /* sizeof(SYMENT) */ 215178525Sjb 216178525Sjb#define AUXENT union auxent 217178525Sjb#define AUXESZ 18 /* sizeof(AUXENT) */ 218178525Sjb 219178525Sjb/* Defines for "special" symbols */ 220178525Sjb 221178525Sjb#define _ETEXT "etext" 222178525Sjb#define _EDATA "edata" 223178525Sjb#define _END "end" 224178525Sjb#define _START "_start" 225178525Sjb 226178525Sjb#ifdef __cplusplus 227178525Sjb} 228178525Sjb#endif 229178525Sjb 230178525Sjb#endif /* _SYMS_H */ 231