|
|
1.1 ! root 1: /* ! 2: * COFF symbol symbol entry file. ! 3: */ ! 4: ! 5: /* Storage Classes are defined in storclass.h */ ! 6: #include "storclass.h" ! 7: ! 8: /* Number of characters in a symbol name */ ! 9: #define SYMNMLEN 8 ! 10: /* Number of characters in a file name */ ! 11: #define FILNMLEN 14 ! 12: /* Number of array dimensions in auxiliary entry */ ! 13: #define DIMNUM 4 ! 14: ! 15: ! 16: struct syment ! 17: { ! 18: union ! 19: { ! 20: char _n_name[SYMNMLEN]; /* old COFF version */ ! 21: struct ! 22: { ! 23: long _n_zeroes; /* new == 0 */ ! 24: long _n_offset; /* offset into string table */ ! 25: } _n_n; ! 26: char *_n_nptr[2]; /* allows for overlaying */ ! 27: } _n; ! 28: long n_value; /* value of symbol */ ! 29: short n_scnum; /* section number */ ! 30: unsigned short n_type; /* type and derived type */ ! 31: char n_sclass; /* storage class */ ! 32: char n_numaux; /* number of aux. entries */ ! 33: }; ! 34: ! 35: #define n_name _n._n_name ! 36: #define n_nptr _n._n_nptr[1] ! 37: #define n_zeroes _n._n_n._n_zeroes ! 38: #define n_offset _n._n_n._n_offset ! 39: ! 40: /* ! 41: Relocatable symbols have a section number of the ! 42: section in which they are defined. Otherwise, section ! 43: numbers have the following meanings: ! 44: */ ! 45: /* undefined symbol */ ! 46: #define N_UNDEF 0 ! 47: /* value of symbol is absolute */ ! 48: #define N_ABS -1 ! 49: /* special debugging symbol -- value of symbol is meaningless */ ! 50: #define N_DEBUG -2 ! 51: /* indicates symbol needs transfer vector (preload) */ ! 52: #define N_TV (unsigned short)-3 ! 53: ! 54: /* indicates symbol needs transfer vector (postload) */ ! 55: ! 56: #define P_TV (unsigned short)-4 ! 57: ! 58: /* ! 59: The fundamental type of a symbol packed into the low ! 60: 4 bits of the word. ! 61: */ ! 62: ! 63: #define _EF ".ef" ! 64: ! 65: #define T_NULL 0 ! 66: #define T_ARG 1 /* function argument (only used by compiler) */ ! 67: #define T_CHAR 2 /* character */ ! 68: #define T_SHORT 3 /* short integer */ ! 69: #define T_INT 4 /* integer */ ! 70: #define T_LONG 5 /* long integer */ ! 71: #define T_FLOAT 6 /* floating point */ ! 72: #define T_DOUBLE 7 /* double word */ ! 73: #define T_STRUCT 8 /* structure */ ! 74: #define T_UNION 9 /* union */ ! 75: #define T_ENUM 10 /* enumeration */ ! 76: #define T_MOE 11 /* member of enumeration */ ! 77: #define T_UCHAR 12 /* unsigned character */ ! 78: #define T_USHORT 13 /* unsigned short */ ! 79: #define T_UINT 14 /* unsigned integer */ ! 80: #define T_ULONG 15 /* unsigned long */ ! 81: ! 82: /* ! 83: * derived types are: ! 84: */ ! 85: ! 86: #define DT_NON 0 /* no derived type */ ! 87: #define DT_PTR 1 /* pointer */ ! 88: #define DT_FCN 2 /* function */ ! 89: #define DT_ARY 3 /* array */ ! 90: ! 91: /* ! 92: * type packing constants ! 93: */ ! 94: ! 95: #define N_BTMASK 017 ! 96: #define N_TMASK 060 ! 97: #define N_TMASK1 0300 ! 98: #define N_TMASK2 0360 ! 99: #define N_BTSHFT 4 ! 100: #define N_TSHIFT 2 ! 101: ! 102: /* ! 103: * MACROS ! 104: */ ! 105: ! 106: /* Basic Type of x */ ! 107: ! 108: #define BTYPE(x) ((x) & N_BTMASK) ! 109: ! 110: /* Is x a pointer ? */ ! 111: ! 112: #define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) ! 113: ! 114: /* Is x a function ? */ ! 115: ! 116: #define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) ! 117: ! 118: /* Is x an array ? */ ! 119: ! 120: #define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) ! 121: ! 122: /* Is x a structure, union, or enumeration TAG? */ ! 123: ! 124: #define ISTAG(x) ((x)==C_STRTAG || (x)==C_UNTAG || (x)==C_ENTAG) ! 125: ! 126: #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(DT_PTR<<N_BTSHFT)|(x&N_BTMASK)) ! 127: ! 128: #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) ! 129: ! 130: /* ! 131: * AUXILIARY ENTRY FORMAT ! 132: */ ! 133: ! 134: union auxent ! 135: { ! 136: struct ! 137: { ! 138: long x_tagndx; /* str, un, or enum tag indx */ ! 139: union ! 140: { ! 141: struct ! 142: { ! 143: unsigned short x_lnno; /* declaration line number */ ! 144: unsigned short x_size; /* str, union, array size */ ! 145: } x_lnsz; ! 146: long x_fsize; /* size of function */ ! 147: } x_misc; ! 148: union ! 149: { ! 150: struct /* if ISFCN, tag, or .bb */ ! 151: { ! 152: long x_lnnoptr; /* ptr to fcn line # */ ! 153: long x_endndx; /* entry ndx past block end */ ! 154: } x_fcn; ! 155: struct /* if ISARY, up to 4 dimen. */ ! 156: { ! 157: unsigned short x_dimen[DIMNUM]; ! 158: } x_ary; ! 159: } x_fcnary; ! 160: unsigned short x_tvndx; /* tv index */ ! 161: } x_sym; ! 162: struct ! 163: { ! 164: char x_fname[FILNMLEN]; ! 165: } x_file; ! 166: struct ! 167: { ! 168: long x_scnlen; /* section length */ ! 169: unsigned short x_nreloc; /* number of relocation entries */ ! 170: unsigned short x_nlinno; /* number of line numbers */ ! 171: } x_scn; ! 172: ! 173: struct ! 174: { ! 175: long x_tvfill; /* tv fill value */ ! 176: unsigned short x_tvlen; /* length of .tv */ ! 177: unsigned short x_tvran[2]; /* tv range */ ! 178: } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ ! 179: }; ! 180: ! 181: #define SYMENT struct syment ! 182: #define SYMESZ 18 /* sizeof(SYMENT) */ ! 183: ! 184: #define AUXENT union auxent ! 185: #define AUXESZ 18 /* sizeof(AUXENT) */ ! 186: ! 187: /* Defines for "special" symbols */ ! 188: ! 189: #if VAX ! 190: #define _ETEXT "_etext" ! 191: #define _EDATA "_edata" ! 192: #define _END "_end" ! 193: #else ! 194: #define _ETEXT "etext" ! 195: #define _EDATA "edata" ! 196: #define _END "end" ! 197: #endif ! 198: ! 199: #define _START "_start" ! 200: ! 201: #define _TVORIG "_tvorig" ! 202: #define _TORIGIN "_torigin" ! 203: #define _DORIGIN "_dorigin" ! 204: ! 205: #define _SORIGIN "_sorigin"
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.