17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* Copyright (c) 1988 AT&T */ 23b4203d75SMarcel Telka /* All Rights Reserved */ 247c478bd9Sstevel@tonic-gate 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYMS_H 277c478bd9Sstevel@tonic-gate #define _SYMS_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate /* Storage Classes are defined in storclass.h */ 307c478bd9Sstevel@tonic-gate #include <storclass.h> 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* Number of characters in a symbol name */ 377c478bd9Sstevel@tonic-gate #define SYMNMLEN 8 387c478bd9Sstevel@tonic-gate /* Number of characters in a file name */ 397c478bd9Sstevel@tonic-gate #define FILNMLEN 14 407c478bd9Sstevel@tonic-gate /* Number of array dimensions in auxiliary entry */ 417c478bd9Sstevel@tonic-gate #define DIMNUM 4 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate struct syment 447c478bd9Sstevel@tonic-gate { 457c478bd9Sstevel@tonic-gate union 467c478bd9Sstevel@tonic-gate { 477c478bd9Sstevel@tonic-gate char _n_name[SYMNMLEN]; /* old COFF version */ 487c478bd9Sstevel@tonic-gate struct 497c478bd9Sstevel@tonic-gate { 507c478bd9Sstevel@tonic-gate long _n_zeroes; /* new == 0 */ 517c478bd9Sstevel@tonic-gate long _n_offset; /* offset into string table */ 527c478bd9Sstevel@tonic-gate } _n_n; 537c478bd9Sstevel@tonic-gate char *_n_nptr[2]; /* allows for overlaying */ 547c478bd9Sstevel@tonic-gate } _n; 557c478bd9Sstevel@tonic-gate unsigned long n_value; /* value of symbol */ 567c478bd9Sstevel@tonic-gate short n_scnum; /* section number */ 577c478bd9Sstevel@tonic-gate unsigned short n_type; /* type and derived type */ 587c478bd9Sstevel@tonic-gate char n_sclass; /* storage class */ 597c478bd9Sstevel@tonic-gate char n_numaux; /* number of aux. entries */ 607c478bd9Sstevel@tonic-gate }; 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate #define n_name _n._n_name 637c478bd9Sstevel@tonic-gate #define n_nptr _n._n_nptr[1] 647c478bd9Sstevel@tonic-gate #define n_zeroes _n._n_n._n_zeroes 657c478bd9Sstevel@tonic-gate #define n_offset _n._n_n._n_offset 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate /* 687c478bd9Sstevel@tonic-gate * Relocatable symbols have a section number of the 697c478bd9Sstevel@tonic-gate * section in which they are defined. Otherwise, section 707c478bd9Sstevel@tonic-gate * numbers have the following meanings: 717c478bd9Sstevel@tonic-gate */ 727c478bd9Sstevel@tonic-gate /* undefined symbol */ 737c478bd9Sstevel@tonic-gate #define N_UNDEF 0 747c478bd9Sstevel@tonic-gate /* value of symbol is absolute */ 757c478bd9Sstevel@tonic-gate #define N_ABS -1 767c478bd9Sstevel@tonic-gate /* special debugging symbol -- value of symbol is meaningless */ 777c478bd9Sstevel@tonic-gate #define N_DEBUG -2 787c478bd9Sstevel@tonic-gate /* indicates symbol needs transfer vector (preload) */ 797c478bd9Sstevel@tonic-gate #define N_TV (unsigned short)-3 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate /* indicates symbol needs transfer vector (postload) */ 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate #define P_TV (unsigned short)-4 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate /* 867c478bd9Sstevel@tonic-gate * The fundamental type of a symbol packed into the low 877c478bd9Sstevel@tonic-gate * 4 bits of the word. 887c478bd9Sstevel@tonic-gate */ 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate #define _EF ".ef" 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate #define T_NULL 0 937c478bd9Sstevel@tonic-gate #define T_ARG 1 /* function argument (only used by compiler) */ 947c478bd9Sstevel@tonic-gate #define T_CHAR 2 /* character */ 957c478bd9Sstevel@tonic-gate #define T_SHORT 3 /* short integer */ 967c478bd9Sstevel@tonic-gate #define T_INT 4 /* integer */ 977c478bd9Sstevel@tonic-gate #define T_LONG 5 /* long integer */ 987c478bd9Sstevel@tonic-gate #define T_FLOAT 6 /* floating point */ 997c478bd9Sstevel@tonic-gate #define T_DOUBLE 7 /* double word */ 1007c478bd9Sstevel@tonic-gate #define T_STRUCT 8 /* structure */ 1017c478bd9Sstevel@tonic-gate #define T_UNION 9 /* union */ 1027c478bd9Sstevel@tonic-gate #define T_ENUM 10 /* enumeration */ 1037c478bd9Sstevel@tonic-gate #define T_MOE 11 /* member of enumeration */ 1047c478bd9Sstevel@tonic-gate #define T_UCHAR 12 /* unsigned character */ 1057c478bd9Sstevel@tonic-gate #define T_USHORT 13 /* unsigned short */ 1067c478bd9Sstevel@tonic-gate #define T_UINT 14 /* unsigned integer */ 1077c478bd9Sstevel@tonic-gate #define T_ULONG 15 /* unsigned long */ 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate /* 1107c478bd9Sstevel@tonic-gate * derived types are: 1117c478bd9Sstevel@tonic-gate */ 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate #define DT_NON 0 /* no derived type */ 1147c478bd9Sstevel@tonic-gate #define DT_PTR 1 /* pointer */ 1157c478bd9Sstevel@tonic-gate #define DT_FCN 2 /* function */ 1167c478bd9Sstevel@tonic-gate #define DT_ARY 3 /* array */ 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate /* 1197c478bd9Sstevel@tonic-gate * type packing constants 1207c478bd9Sstevel@tonic-gate */ 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gate #define N_BTMASK 017 1237c478bd9Sstevel@tonic-gate #define N_TMASK 060 1247c478bd9Sstevel@tonic-gate #define N_TMASK1 0300 1257c478bd9Sstevel@tonic-gate #define N_TMASK2 0360 1267c478bd9Sstevel@tonic-gate #define N_BTSHFT 4 1277c478bd9Sstevel@tonic-gate #define N_TSHIFT 2 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate /* 1307c478bd9Sstevel@tonic-gate * MACROS 1317c478bd9Sstevel@tonic-gate */ 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate /* Basic Type of x */ 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate #define BTYPE(x) ((x) & N_BTMASK) 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate /* Is x a pointer ? */ 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate #define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate /* Is x a function ? */ 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate #define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate /* Is x an array ? */ 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate #define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate /* Is x a structure, union, or enumeration TAG? */ 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate #define ISTAG(x) ((x) == C_STRTAG || (x) == C_UNTAG || (x) == C_ENTAG) 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(DT_PTR<<N_BTSHFT)|(x&N_BTMASK)) 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gate /* 1587c478bd9Sstevel@tonic-gate * AUXILIARY ENTRY FORMAT 1597c478bd9Sstevel@tonic-gate */ 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate union auxent 1627c478bd9Sstevel@tonic-gate { 1637c478bd9Sstevel@tonic-gate struct 1647c478bd9Sstevel@tonic-gate { 1657c478bd9Sstevel@tonic-gate long x_tagndx; /* str, un, or enum tag indx */ 1667c478bd9Sstevel@tonic-gate union 1677c478bd9Sstevel@tonic-gate { 1687c478bd9Sstevel@tonic-gate struct 1697c478bd9Sstevel@tonic-gate { 1707c478bd9Sstevel@tonic-gate unsigned short x_lnno; /* declaration line */ 1717c478bd9Sstevel@tonic-gate /* number */ 1727c478bd9Sstevel@tonic-gate unsigned short x_size; /* str, union, array */ 1737c478bd9Sstevel@tonic-gate /* size */ 1747c478bd9Sstevel@tonic-gate } x_lnsz; 1757c478bd9Sstevel@tonic-gate long x_fsize; /* size of function */ 1767c478bd9Sstevel@tonic-gate } x_misc; 1777c478bd9Sstevel@tonic-gate union 1787c478bd9Sstevel@tonic-gate { 1797c478bd9Sstevel@tonic-gate struct /* if ISFCN, tag, or .bb */ 1807c478bd9Sstevel@tonic-gate { 1817c478bd9Sstevel@tonic-gate long x_lnnoptr; /* ptr to fcn line # */ 1827c478bd9Sstevel@tonic-gate long x_endndx; /* entry ndx past */ 1837c478bd9Sstevel@tonic-gate /* block end */ 184*6e270ca8SMarcel Telka } x_fcn; 1857c478bd9Sstevel@tonic-gate struct /* if ISARY, up to 4 dimen. */ 1867c478bd9Sstevel@tonic-gate { 1877c478bd9Sstevel@tonic-gate unsigned short x_dimen[DIMNUM]; 188*6e270ca8SMarcel Telka } x_ary; 1897c478bd9Sstevel@tonic-gate } x_fcnary; 1907c478bd9Sstevel@tonic-gate unsigned short x_tvndx; /* tv index */ 191*6e270ca8SMarcel Telka } x_sym; 1927c478bd9Sstevel@tonic-gate struct 1937c478bd9Sstevel@tonic-gate { 1947c478bd9Sstevel@tonic-gate char x_fname[FILNMLEN]; 195*6e270ca8SMarcel Telka } x_file; 1967c478bd9Sstevel@tonic-gate struct 1977c478bd9Sstevel@tonic-gate { 1987c478bd9Sstevel@tonic-gate long x_scnlen; /* section length */ 1997c478bd9Sstevel@tonic-gate unsigned short x_nreloc; /* number of reloc entries */ 2007c478bd9Sstevel@tonic-gate unsigned short x_nlinno; /* number of line numbers */ 2017c478bd9Sstevel@tonic-gate } x_scn; 2027c478bd9Sstevel@tonic-gate 2037c478bd9Sstevel@tonic-gate struct 2047c478bd9Sstevel@tonic-gate { 2057c478bd9Sstevel@tonic-gate long x_tvfill; /* tv fill value */ 2067c478bd9Sstevel@tonic-gate unsigned short x_tvlen; /* length of .tv */ 2077c478bd9Sstevel@tonic-gate unsigned short x_tvran[2]; /* tv range */ 2087c478bd9Sstevel@tonic-gate } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ 2097c478bd9Sstevel@tonic-gate }; 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate #define SYMENT struct syment 2127c478bd9Sstevel@tonic-gate #define SYMESZ 18 /* sizeof(SYMENT) */ 2137c478bd9Sstevel@tonic-gate 2147c478bd9Sstevel@tonic-gate #define AUXENT union auxent 2157c478bd9Sstevel@tonic-gate #define AUXESZ 18 /* sizeof(AUXENT) */ 2167c478bd9Sstevel@tonic-gate 2177c478bd9Sstevel@tonic-gate /* Defines for "special" symbols */ 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate #define _ETEXT "etext" 2207c478bd9Sstevel@tonic-gate #define _EDATA "edata" 2217c478bd9Sstevel@tonic-gate #define _END "end" 2227c478bd9Sstevel@tonic-gate #define _START "_start" 2237c478bd9Sstevel@tonic-gate 2247c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2257c478bd9Sstevel@tonic-gate } 2267c478bd9Sstevel@tonic-gate #endif 2277c478bd9Sstevel@tonic-gate 2287c478bd9Sstevel@tonic-gate #endif /* _SYMS_H */ 229