Path: blob/main/cddl/contrib/opensolaris/head/syms.h
39483 views
/*1* CDDL HEADER START2*3* The contents of this file are subject to the terms of the4* Common Development and Distribution License, Version 1.0 only5* (the "License"). You may not use this file except in compliance6* with the License.7*8* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE9* or http://www.opensolaris.org/os/licensing.10* See the License for the specific language governing permissions11* and limitations under the License.12*13* When distributing Covered Code, include this CDDL HEADER in each14* file and include the License file at usr/src/OPENSOLARIS.LICENSE.15* If applicable, add the following below this CDDL HEADER, with the16* fields enclosed by brackets "[]" replaced with your own identifying17* information: Portions Copyright [yyyy] [name of copyright owner]18*19* CDDL HEADER END20*/21/* Copyright (c) 1988 AT&T */22/* All Rights Reserved */232425#ifndef _SYMS_H26#define _SYMS_H2728#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 2.8 */2930/* Storage Classes are defined in storclass.h */31#include <storclass.h>3233#ifdef __cplusplus34extern "C" {35#endif3637/* Number of characters in a symbol name */38#define SYMNMLEN 839/* Number of characters in a file name */40#define FILNMLEN 1441/* Number of array dimensions in auxiliary entry */42#define DIMNUM 44344struct syment45{46union47{48char _n_name[SYMNMLEN]; /* old COFF version */49struct50{51long _n_zeroes; /* new == 0 */52long _n_offset; /* offset into string table */53} _n_n;54char *_n_nptr[2]; /* allows for overlaying */55} _n;56unsigned long n_value; /* value of symbol */57short n_scnum; /* section number */58unsigned short n_type; /* type and derived type */59char n_sclass; /* storage class */60char n_numaux; /* number of aux. entries */61};6263#define n_name _n._n_name64#define n_nptr _n._n_nptr[1]65#define n_zeroes _n._n_n._n_zeroes66#define n_offset _n._n_n._n_offset6768/*69* Relocatable symbols have a section number of the70* section in which they are defined. Otherwise, section71* numbers have the following meanings:72*/73/* undefined symbol */74#define N_UNDEF 075/* value of symbol is absolute */76#define N_ABS -177/* special debugging symbol -- value of symbol is meaningless */78#define N_DEBUG -279/* indicates symbol needs transfer vector (preload) */80#define N_TV (unsigned short)-38182/* indicates symbol needs transfer vector (postload) */8384#define P_TV (unsigned short)-48586/*87* The fundamental type of a symbol packed into the low88* 4 bits of the word.89*/9091#define _EF ".ef"9293#define T_NULL 094#define T_ARG 1 /* function argument (only used by compiler) */95#define T_CHAR 2 /* character */96#define T_SHORT 3 /* short integer */97#define T_INT 4 /* integer */98#define T_LONG 5 /* long integer */99#define T_FLOAT 6 /* floating point */100#define T_DOUBLE 7 /* double word */101#define T_STRUCT 8 /* structure */102#define T_UNION 9 /* union */103#define T_ENUM 10 /* enumeration */104#define T_MOE 11 /* member of enumeration */105#define T_UCHAR 12 /* unsigned character */106#define T_USHORT 13 /* unsigned short */107#define T_UINT 14 /* unsigned integer */108#define T_ULONG 15 /* unsigned long */109110/*111* derived types are:112*/113114#define DT_NON 0 /* no derived type */115#define DT_PTR 1 /* pointer */116#define DT_FCN 2 /* function */117#define DT_ARY 3 /* array */118119/*120* type packing constants121*/122123#define N_BTMASK 017124#define N_TMASK 060125#define N_TMASK1 0300126#define N_TMASK2 0360127#define N_BTSHFT 4128#define N_TSHIFT 2129130/*131* MACROS132*/133134/* Basic Type of x */135136#define BTYPE(x) ((x) & N_BTMASK)137138/* Is x a pointer ? */139140#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))141142/* Is x a function ? */143144#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))145146/* Is x an array ? */147148#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))149150/* Is x a structure, union, or enumeration TAG? */151152#define ISTAG(x) ((x) == C_STRTAG || (x) == C_UNTAG || (x) == C_ENTAG)153154#define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(DT_PTR<<N_BTSHFT)|(x&N_BTMASK))155156#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))157158/*159* AUXILIARY ENTRY FORMAT160*/161162union auxent163{164struct165{166long x_tagndx; /* str, un, or enum tag indx */167union168{169struct170{171unsigned short x_lnno; /* declaration line */172/* number */173unsigned short x_size; /* str, union, array */174/* size */175} x_lnsz;176long x_fsize; /* size of function */177} x_misc;178union179{180struct /* if ISFCN, tag, or .bb */181{182long x_lnnoptr; /* ptr to fcn line # */183long x_endndx; /* entry ndx past */184/* block end */185} x_fcn;186struct /* if ISARY, up to 4 dimen. */187{188unsigned short x_dimen[DIMNUM];189} x_ary;190} x_fcnary;191unsigned short x_tvndx; /* tv index */192} x_sym;193struct194{195char x_fname[FILNMLEN];196} x_file;197struct198{199long x_scnlen; /* section length */200unsigned short x_nreloc; /* number of reloc entries */201unsigned short x_nlinno; /* number of line numbers */202} x_scn;203204struct205{206long x_tvfill; /* tv fill value */207unsigned short x_tvlen; /* length of .tv */208unsigned short x_tvran[2]; /* tv range */209} x_tv; /* info about .tv section (in auxent of symbol .tv)) */210};211212#define SYMENT struct syment213#define SYMESZ 18 /* sizeof(SYMENT) */214215#define AUXENT union auxent216#define AUXESZ 18 /* sizeof(AUXENT) */217218/* Defines for "special" symbols */219220#define _ETEXT "etext"221#define _EDATA "edata"222#define _END "end"223#define _START "_start"224225#ifdef __cplusplus226}227#endif228229#endif /* _SYMS_H */230231232