[279] | 1 | /**************************************************************************/
|
---|
| 2 | /* COFF.H */
|
---|
| 3 | /* COFF data structures and related definitions used by the linker */
|
---|
| 4 | /**************************************************************************/
|
---|
| 5 |
|
---|
| 6 | /*------------------------------------------------------------------------*/
|
---|
| 7 | /* COFF FILE HEADER */
|
---|
| 8 | /*------------------------------------------------------------------------*/
|
---|
| 9 | struct filehdr {
|
---|
| 10 | unsigned short f_magic; /* magic number */
|
---|
| 11 | unsigned short f_nscns; /* number of sections */
|
---|
| 12 | long f_timdat; /* time & date stamp */
|
---|
| 13 | long f_symptr; /* file pointer to symtab */
|
---|
| 14 | long f_nsyms; /* number of symtab entries */
|
---|
| 15 | unsigned short f_opthdr; /* sizeof(optional hdr) */
|
---|
| 16 | unsigned short f_flags; /* flags */
|
---|
| 17 | unsigned short f_TargetID; /* for C6x = 0x0099 */
|
---|
| 18 | };
|
---|
| 19 |
|
---|
| 20 | /*------------------------------------------------------------------------*/
|
---|
| 21 | /* File header flags */
|
---|
| 22 | /*------------------------------------------------------------------------*/
|
---|
| 23 | #define F_RELFLG 0x01 /* relocation info stripped from file */
|
---|
| 24 | #define F_EXEC 0x02 /* file is executable (no unresolved refs) */
|
---|
[331] | 25 | #define F_LNNO 0x04 /* line numbers stripped from file */
|
---|
[279] | 26 | #define F_LSYMS 0x08 /* local symbols stripped from file */
|
---|
| 27 | #define F_GSP10 0x10 /* 34010 version */
|
---|
| 28 | #define F_GSP20 0x20 /* 34020 version */
|
---|
| 29 | #define F_SWABD 0x40 /* bytes swabbed (in names) */
|
---|
| 30 | #define F_AR16WR 0x80 /* byte ordering of an AR16WR (PDP-11) */
|
---|
| 31 | #define F_LITTLE 0x100 /* byte ordering of an AR32WR (vax) */
|
---|
| 32 | #define F_BIG 0x200 /* byte ordering of an AR32W (3B, maxi) */
|
---|
| 33 | #define F_PATCH 0x400 /* contains "patch" list in optional header */
|
---|
| 34 | #define F_NODF 0x400
|
---|
| 35 |
|
---|
| 36 | #define F_VERSION (F_GSP10 | F_GSP20)
|
---|
| 37 | #define F_BYTE_ORDER (F_LITTLE | F_BIG)
|
---|
| 38 | #define FILHDR struct filehdr
|
---|
| 39 |
|
---|
[331] | 40 | /* #define FILHSZ sizeof(FILHDR) */
|
---|
| 41 | #define FILHSZ 22 /* above rounds to align on 4 bytes which causes problems */
|
---|
[279] | 42 |
|
---|
| 43 | #define COFF_C67_MAGIC 0x00c2
|
---|
| 44 |
|
---|
| 45 | /*------------------------------------------------------------------------*/
|
---|
| 46 | /* Macros to recognize magic numbers */
|
---|
| 47 | /*------------------------------------------------------------------------*/
|
---|
| 48 | #define ISMAGIC(x) (((unsigned short)(x))==(unsigned short)magic)
|
---|
| 49 | #define ISARCHIVE(x) ((((unsigned short)(x))==(unsigned short)ARTYPE))
|
---|
| 50 | #define BADMAGIC(x) (((unsigned short)(x) & 0x8080) && !ISMAGIC(x))
|
---|
| 51 |
|
---|
| 52 | |
---|
| 53 |
|
---|
| 54 | /*------------------------------------------------------------------------*/
|
---|
| 55 | /* OPTIONAL FILE HEADER */
|
---|
| 56 | /*------------------------------------------------------------------------*/
|
---|
| 57 | typedef struct aouthdr {
|
---|
| 58 | short magic; /* see magic.h */
|
---|
| 59 | short vstamp; /* version stamp */
|
---|
| 60 | long tsize; /* text size in bytes, padded to FW bdry*/
|
---|
| 61 | long dsize; /* initialized data " " */
|
---|
| 62 | long bsize; /* uninitialized data " " */
|
---|
| 63 | long entrypt; /* entry pt. */
|
---|
| 64 | long text_start; /* base of text used for this file */
|
---|
| 65 | long data_start; /* base of data used for this file */
|
---|
| 66 | } AOUTHDR;
|
---|
| 67 |
|
---|
| 68 | #define AOUTSZ sizeof(AOUTHDR)
|
---|
| 69 |
|
---|
| 70 | /*----------------------------------------------------------------------*/
|
---|
| 71 | /* When a UNIX aout header is to be built in the optional header, */
|
---|
| 72 | /* the following magic numbers can appear in that header: */
|
---|
| 73 | /* */
|
---|
| 74 | /* AOUT1MAGIC : default : readonly sharable text segment */
|
---|
| 75 | /* AOUT2MAGIC: : writable text segment */
|
---|
| 76 | /* PAGEMAGIC : : configured for paging */
|
---|
| 77 | /*----------------------------------------------------------------------*/
|
---|
| 78 | #define AOUT1MAGIC 0410
|
---|
| 79 | #define AOUT2MAGIC 0407
|
---|
| 80 | #define PAGEMAGIC 0413
|
---|
| 81 |
|
---|
| 82 | |
---|
| 83 |
|
---|
| 84 | /*------------------------------------------------------------------------*/
|
---|
| 85 | /* COMMON ARCHIVE FILE STRUCTURES */
|
---|
| 86 | /* */
|
---|
| 87 | /* ARCHIVE File Organization: */
|
---|
| 88 | /* _______________________________________________ */
|
---|
| 89 | /* |__________ARCHIVE_MAGIC_STRING_______________| */
|
---|
| 90 | /* |__________ARCHIVE_FILE_MEMBER_1______________| */
|
---|
| 91 | /* | | */
|
---|
| 92 | /* | Archive File Header "ar_hdr" | */
|
---|
| 93 | /* |.............................................| */
|
---|
| 94 | /* | Member Contents | */
|
---|
| 95 | /* | 1. External symbol directory | */
|
---|
| 96 | /* | 2. Text file | */
|
---|
| 97 | /* |_____________________________________________| */
|
---|
| 98 | /* |________ARCHIVE_FILE_MEMBER_2________________| */
|
---|
| 99 | /* | "ar_hdr" | */
|
---|
| 100 | /* |.............................................| */
|
---|
| 101 | /* | Member Contents (.o or text file) | */
|
---|
| 102 | /* |_____________________________________________| */
|
---|
| 103 | /* | . . . | */
|
---|
| 104 | /* | . . . | */
|
---|
| 105 | /* | . . . | */
|
---|
| 106 | /* |_____________________________________________| */
|
---|
| 107 | /* |________ARCHIVE_FILE_MEMBER_n________________| */
|
---|
| 108 | /* | "ar_hdr" | */
|
---|
| 109 | /* |.............................................| */
|
---|
| 110 | /* | Member Contents | */
|
---|
| 111 | /* |_____________________________________________| */
|
---|
| 112 | /* */
|
---|
| 113 | /*------------------------------------------------------------------------*/
|
---|
| 114 |
|
---|
| 115 | #define COFF_ARMAG "!<arch>\n"
|
---|
| 116 | #define SARMAG 8
|
---|
| 117 | #define ARFMAG "`\n"
|
---|
| 118 |
|
---|
| 119 | struct ar_hdr /* archive file member header - printable ascii */
|
---|
| 120 | {
|
---|
| 121 | char ar_name[16]; /* file member name - `/' terminated */
|
---|
| 122 | char ar_date[12]; /* file member date - decimal */
|
---|
| 123 | char ar_uid[6]; /* file member user id - decimal */
|
---|
| 124 | char ar_gid[6]; /* file member group id - decimal */
|
---|
| 125 | char ar_mode[8]; /* file member mode - octal */
|
---|
| 126 | char ar_size[10]; /* file member size - decimal */
|
---|
| 127 | char ar_fmag[2]; /* ARFMAG - string to end header */
|
---|
| 128 | };
|
---|
| 129 |
|
---|
| 130 | |
---|
| 131 |
|
---|
| 132 | /*------------------------------------------------------------------------*/
|
---|
| 133 | /* SECTION HEADER */
|
---|
| 134 | /*------------------------------------------------------------------------*/
|
---|
| 135 | struct scnhdr {
|
---|
| 136 | char s_name[8]; /* section name */
|
---|
| 137 | long s_paddr; /* physical address */
|
---|
| 138 | long s_vaddr; /* virtual address */
|
---|
| 139 | long s_size; /* section size */
|
---|
| 140 | long s_scnptr; /* file ptr to raw data for section */
|
---|
| 141 | long s_relptr; /* file ptr to relocation */
|
---|
| 142 | long s_lnnoptr; /* file ptr to line numbers */
|
---|
| 143 | unsigned int s_nreloc; /* number of relocation entries */
|
---|
| 144 | unsigned int s_nlnno; /* number of line number entries */
|
---|
| 145 | unsigned int s_flags; /* flags */
|
---|
| 146 | unsigned short s_reserved; /* reserved byte */
|
---|
| 147 | unsigned short s_page; /* memory page id */
|
---|
| 148 | };
|
---|
| 149 |
|
---|
| 150 | #define SCNHDR struct scnhdr
|
---|
| 151 | #define SCNHSZ sizeof(SCNHDR)
|
---|
| 152 |
|
---|
[331] | 153 | /*------------------------------------------------------------------------*/
|
---|
[279] | 154 | /* Define constants for names of "special" sections */
|
---|
| 155 | /*------------------------------------------------------------------------*/
|
---|
| 156 | /* #define _TEXT ".text" */
|
---|
| 157 | #define _DATA ".data"
|
---|
| 158 | #define _BSS ".bss"
|
---|
| 159 | #define _CINIT ".cinit"
|
---|
| 160 | #define _TV ".tv"
|
---|
| 161 |
|
---|
| 162 | /*------------------------------------------------------------------------*/
|
---|
| 163 | /* The low 4 bits of s_flags is used as a section "type" */
|
---|
| 164 | /*------------------------------------------------------------------------*/
|
---|
| 165 | #define STYP_REG 0x00 /* "regular" : allocated, relocated, loaded */
|
---|
| 166 | #define STYP_DSECT 0x01 /* "dummy" : not allocated, relocated, not loaded */
|
---|
| 167 | #define STYP_NOLOAD 0x02 /* "noload" : allocated, relocated, not loaded */
|
---|
| 168 | #define STYP_GROUP 0x04 /* "grouped" : formed of input sections */
|
---|
| 169 | #define STYP_PAD 0x08 /* "padding" : not allocated, not relocated, loaded */
|
---|
| 170 | #define STYP_COPY 0x10 /* "copy" : used for C init tables -
|
---|
| 171 | not allocated, relocated,
|
---|
| 172 | loaded; reloc & lineno
|
---|
| 173 | entries processed normally */
|
---|
| 174 | #define STYP_TEXT 0x20 /* section contains text only */
|
---|
| 175 | #define STYP_DATA 0x40 /* section contains data only */
|
---|
| 176 | #define STYP_BSS 0x80 /* section contains bss only */
|
---|
| 177 |
|
---|
| 178 | #define STYP_ALIGN 0x100 /* align flag passed by old version assemblers */
|
---|
| 179 | #define ALIGN_MASK 0x0F00 /* part of s_flags that is used for align vals */
|
---|
| 180 | #define ALIGNSIZE(x) (1 << ((x & ALIGN_MASK) >> 8))
|
---|
| 181 |
|
---|
| 182 | |
---|
| 183 |
|
---|
| 184 | /*------------------------------------------------------------------------*/
|
---|
| 185 | /* RELOCATION ENTRIES */
|
---|
| 186 | /*------------------------------------------------------------------------*/
|
---|
| 187 | struct reloc
|
---|
| 188 | {
|
---|
| 189 | long r_vaddr; /* (virtual) address of reference */
|
---|
| 190 | short r_symndx; /* index into symbol table */
|
---|
| 191 | unsigned short r_disp; /* additional bits for address calculation */
|
---|
| 192 | unsigned short r_type; /* relocation type */
|
---|
| 193 | };
|
---|
| 194 |
|
---|
| 195 | #define RELOC struct reloc
|
---|
| 196 | #define RELSZ 10 /* sizeof(RELOC) */
|
---|
| 197 |
|
---|
| 198 | /*--------------------------------------------------------------------------*/
|
---|
| 199 | /* define all relocation types */
|
---|
| 200 | /*--------------------------------------------------------------------------*/
|
---|
| 201 |
|
---|
| 202 | #define R_ABS 0 /* absolute address - no relocation */
|
---|
| 203 | #define R_DIR16 01 /* UNUSED */
|
---|
| 204 | #define R_REL16 02 /* UNUSED */
|
---|
| 205 | #define R_DIR24 04 /* UNUSED */
|
---|
| 206 | #define R_REL24 05 /* 24 bits, direct */
|
---|
| 207 | #define R_DIR32 06 /* UNUSED */
|
---|
| 208 | #define R_RELBYTE 017 /* 8 bits, direct */
|
---|
| 209 | #define R_RELWORD 020 /* 16 bits, direct */
|
---|
| 210 | #define R_RELLONG 021 /* 32 bits, direct */
|
---|
| 211 | #define R_PCRBYTE 022 /* 8 bits, PC-relative */
|
---|
| 212 | #define R_PCRWORD 023 /* 16 bits, PC-relative */
|
---|
| 213 | #define R_PCRLONG 024 /* 32 bits, PC-relative */
|
---|
| 214 | #define R_OCRLONG 030 /* GSP: 32 bits, one's complement direct */
|
---|
| 215 | #define R_GSPPCR16 031 /* GSP: 16 bits, PC relative (in words) */
|
---|
| 216 | #define R_GSPOPR32 032 /* GSP: 32 bits, direct big-endian */
|
---|
| 217 | #define R_PARTLS16 040 /* Brahma: 16 bit offset of 24 bit address*/
|
---|
| 218 | #define R_PARTMS8 041 /* Brahma: 8 bit page of 24 bit address */
|
---|
| 219 | #define R_PARTLS7 050 /* DSP: 7 bit offset of 16 bit address */
|
---|
| 220 | #define R_PARTMS9 051 /* DSP: 9 bit page of 16 bit address */
|
---|
| 221 | #define R_REL13 052 /* DSP: 13 bits, direct */
|
---|
| 222 |
|
---|
| 223 | |
---|
| 224 |
|
---|
| 225 | /*------------------------------------------------------------------------*/
|
---|
| 226 | /* LINE NUMBER ENTRIES */
|
---|
| 227 | /*------------------------------------------------------------------------*/
|
---|
| 228 | struct lineno
|
---|
| 229 | {
|
---|
| 230 | union
|
---|
| 231 | {
|
---|
| 232 | long l_symndx ; /* sym. table index of function name
|
---|
| 233 | iff l_lnno == 0 */
|
---|
| 234 | long l_paddr ; /* (physical) address of line number */
|
---|
| 235 | } l_addr ;
|
---|
| 236 | unsigned short l_lnno ; /* line number */
|
---|
| 237 | };
|
---|
| 238 |
|
---|
| 239 | #define LINENO struct lineno
|
---|
| 240 | #define LINESZ 6 /* sizeof(LINENO) */
|
---|
| 241 |
|
---|
| 242 | |
---|
| 243 |
|
---|
| 244 | /*------------------------------------------------------------------------*/
|
---|
| 245 | /* STORAGE CLASSES */
|
---|
| 246 | /*------------------------------------------------------------------------*/
|
---|
| 247 | #define C_EFCN -1 /* physical end of function */
|
---|
| 248 | #define C_NULL 0
|
---|
| 249 | #define C_AUTO 1 /* automatic variable */
|
---|
| 250 | #define C_EXT 2 /* external symbol */
|
---|
| 251 | #define C_STAT 3 /* static */
|
---|
| 252 | #define C_REG 4 /* register variable */
|
---|
| 253 | #define C_EXTDEF 5 /* external definition */
|
---|
| 254 | #define C_LABEL 6 /* label */
|
---|
| 255 | #define C_ULABEL 7 /* undefined label */
|
---|
| 256 | #define C_MOS 8 /* member of structure */
|
---|
| 257 | #define C_ARG 9 /* function argument */
|
---|
| 258 | #define C_STRTAG 10 /* structure tag */
|
---|
| 259 | #define C_MOU 11 /* member of union */
|
---|
| 260 | #define C_UNTAG 12 /* union tag */
|
---|
| 261 | #define C_TPDEF 13 /* type definition */
|
---|
| 262 | #define C_USTATIC 14 /* undefined static */
|
---|
| 263 | #define C_ENTAG 15 /* enumeration tag */
|
---|
| 264 | #define C_MOE 16 /* member of enumeration */
|
---|
| 265 | #define C_REGPARM 17 /* register parameter */
|
---|
| 266 | #define C_FIELD 18 /* bit field */
|
---|
| 267 |
|
---|
| 268 | #define C_BLOCK 100 /* ".bb" or ".eb" */
|
---|
| 269 | #define C_FCN 101 /* ".bf" or ".ef" */
|
---|
| 270 | #define C_EOS 102 /* end of structure */
|
---|
| 271 | #define C_FILE 103 /* file name */
|
---|
| 272 | #define C_LINE 104 /* dummy sclass for line number entry */
|
---|
| 273 | #define C_ALIAS 105 /* duplicate tag */
|
---|
| 274 | #define C_HIDDEN 106 /* special storage class for external */
|
---|
| 275 | /* symbols in dmert public libraries */
|
---|
| 276 | |
---|
| 277 |
|
---|
| 278 | /*------------------------------------------------------------------------*/
|
---|
| 279 | /* SYMBOL TABLE ENTRIES */
|
---|
| 280 | /*------------------------------------------------------------------------*/
|
---|
| 281 |
|
---|
| 282 | #define SYMNMLEN 8 /* Number of characters in a symbol name */
|
---|
| 283 | #define FILNMLEN 14 /* Number of characters in a file name */
|
---|
| 284 | #define DIMNUM 4 /* Number of array dimensions in auxiliary entry */
|
---|
| 285 |
|
---|
| 286 |
|
---|
| 287 | struct syment
|
---|
| 288 | {
|
---|
| 289 | union
|
---|
| 290 | {
|
---|
| 291 | char _n_name[SYMNMLEN]; /* old COFF version */
|
---|
| 292 | struct
|
---|
| 293 | {
|
---|
| 294 | long _n_zeroes; /* new == 0 */
|
---|
| 295 | long _n_offset; /* offset into string table */
|
---|
| 296 | } _n_n;
|
---|
| 297 | char *_n_nptr[2]; /* allows for overlaying */
|
---|
| 298 | } _n;
|
---|
| 299 | long n_value; /* value of symbol */
|
---|
| 300 | short n_scnum; /* section number */
|
---|
| 301 | unsigned short n_type; /* type and derived type */
|
---|
| 302 | char n_sclass; /* storage class */
|
---|
| 303 | char n_numaux; /* number of aux. entries */
|
---|
| 304 | };
|
---|
| 305 |
|
---|
| 306 | #define n_name _n._n_name
|
---|
| 307 | #define n_nptr _n._n_nptr[1]
|
---|
| 308 | #define n_zeroes _n._n_n._n_zeroes
|
---|
| 309 | #define n_offset _n._n_n._n_offset
|
---|
| 310 |
|
---|
| 311 | /*------------------------------------------------------------------------*/
|
---|
| 312 | /* Relocatable symbols have a section number of the */
|
---|
| 313 | /* section in which they are defined. Otherwise, section */
|
---|
| 314 | /* numbers have the following meanings: */
|
---|
| 315 | /*------------------------------------------------------------------------*/
|
---|
| 316 | #define N_UNDEF 0 /* undefined symbol */
|
---|
| 317 | #define N_ABS -1 /* value of symbol is absolute */
|
---|
| 318 | #define N_DEBUG -2 /* special debugging symbol */
|
---|
| 319 | #define N_TV (unsigned short)-3 /* needs transfer vector (preload) */
|
---|
| 320 | #define P_TV (unsigned short)-4 /* needs transfer vector (postload) */
|
---|
| 321 |
|
---|
| 322 | |
---|
| 323 |
|
---|
| 324 | /*------------------------------------------------------------------------*/
|
---|
| 325 | /* The fundamental type of a symbol packed into the low */
|
---|
| 326 | /* 4 bits of the word. */
|
---|
| 327 | /*------------------------------------------------------------------------*/
|
---|
| 328 | #define _EF ".ef"
|
---|
| 329 |
|
---|
| 330 | #define T_NULL 0 /* no type info */
|
---|
| 331 | #define T_ARG 1 /* function argument (only used by compiler) */
|
---|
| 332 | #define T_CHAR 2 /* character */
|
---|
| 333 | #define T_SHORT 3 /* short integer */
|
---|
| 334 | #define T_INT 4 /* integer */
|
---|
| 335 | #define T_LONG 5 /* long integer */
|
---|
| 336 | #define T_FLOAT 6 /* floating point */
|
---|
| 337 | #define T_DOUBLE 7 /* double word */
|
---|
| 338 | #define T_STRUCT 8 /* structure */
|
---|
| 339 | #define T_UNION 9 /* union */
|
---|
| 340 | #define T_ENUM 10 /* enumeration */
|
---|
| 341 | #define T_MOE 11 /* member of enumeration */
|
---|
| 342 | #define T_UCHAR 12 /* unsigned character */
|
---|
| 343 | #define T_USHORT 13 /* unsigned short */
|
---|
| 344 | #define T_UINT 14 /* unsigned integer */
|
---|
| 345 | #define T_ULONG 15 /* unsigned long */
|
---|
| 346 |
|
---|
| 347 | /*------------------------------------------------------------------------*/
|
---|
| 348 | /* derived types are: */
|
---|
| 349 | /*------------------------------------------------------------------------*/
|
---|
| 350 | #define DT_NON 0 /* no derived type */
|
---|
| 351 | #define DT_PTR 1 /* pointer */
|
---|
| 352 | #define DT_FCN 2 /* function */
|
---|
| 353 | #define DT_ARY 3 /* array */
|
---|
| 354 |
|
---|
| 355 | #define MKTYPE(basic, d1,d2,d3,d4,d5,d6) \
|
---|
| 356 | ((basic) | ((d1) << 4) | ((d2) << 6) | ((d3) << 8) |\
|
---|
| 357 | ((d4) << 10) | ((d5) << 12) | ((d6) << 14))
|
---|
| 358 |
|
---|
| 359 | /*------------------------------------------------------------------------*/
|
---|
| 360 | /* type packing constants and macros */
|
---|
| 361 | /*------------------------------------------------------------------------*/
|
---|
| 362 | #define N_BTMASK_COFF 017
|
---|
| 363 | #define N_TMASK_COFF 060
|
---|
| 364 | #define N_TMASK1_COFF 0300
|
---|
| 365 | #define N_TMASK2_COFF 0360
|
---|
| 366 | #define N_BTSHFT_COFF 4
|
---|
| 367 | #define N_TSHIFT_COFF 2
|
---|
| 368 |
|
---|
| 369 | #define BTYPE_COFF(x) ((x) & N_BTMASK_COFF)
|
---|
| 370 | #define ISINT(x) (((x) >= T_CHAR && (x) <= T_LONG) || \
|
---|
| 371 | ((x) >= T_UCHAR && (x) <= T_ULONG) || (x) == T_ENUM)
|
---|
| 372 | #define ISFLT_COFF(x) ((x) == T_DOUBLE || (x) == T_FLOAT)
|
---|
| 373 | #define ISPTR_COFF(x) (((x) & N_TMASK_COFF) == (DT_PTR << N_BTSHFT_COFF))
|
---|
| 374 | #define ISFCN_COFF(x) (((x) & N_TMASK_COFF) == (DT_FCN << N_BTSHFT_COFF))
|
---|
| 375 | #define ISARY_COFF(x) (((x) & N_TMASK_COFF) == (DT_ARY << N_BTSHFT_COFF))
|
---|
| 376 | #define ISTAG_COFF(x) ((x)==C_STRTAG || (x)==C_UNTAG || (x)==C_ENTAG)
|
---|
| 377 |
|
---|
| 378 | #define INCREF_COFF(x) ((((x)&~N_BTMASK_COFF)<<N_TSHIFT_COFF)|(DT_PTR<<N_BTSHFT_COFF)|(x&N_BTMASK_COFF))
|
---|
| 379 | #define DECREF_COFF(x) ((((x)>>N_TSHIFT_COFF)&~N_BTMASK_COFF)|((x)&N_BTMASK_COFF))
|
---|
| 380 |
|
---|
| 381 | |
---|
| 382 |
|
---|
| 383 | /*------------------------------------------------------------------------*/
|
---|
| 384 | /* AUXILIARY SYMBOL ENTRY */
|
---|
| 385 | /*------------------------------------------------------------------------*/
|
---|
| 386 | union auxent
|
---|
| 387 | {
|
---|
| 388 | struct
|
---|
| 389 | {
|
---|
| 390 | long x_tagndx; /* str, un, or enum tag indx */
|
---|
| 391 | union
|
---|
| 392 | {
|
---|
| 393 | struct
|
---|
| 394 | {
|
---|
| 395 | unsigned short x_lnno; /* declaration line number */
|
---|
| 396 | unsigned short x_size; /* str, union, array size */
|
---|
| 397 | } x_lnsz;
|
---|
| 398 | long x_fsize; /* size of function */
|
---|
| 399 | } x_misc;
|
---|
| 400 | union
|
---|
| 401 | {
|
---|
| 402 | struct /* if ISFCN, tag, or .bb */
|
---|
| 403 | {
|
---|
| 404 | long x_lnnoptr; /* ptr to fcn line # */
|
---|
| 405 | long x_endndx; /* entry ndx past block end */
|
---|
| 406 | } x_fcn;
|
---|
| 407 | struct /* if ISARY, up to 4 dimen. */
|
---|
| 408 | {
|
---|
| 409 | unsigned short x_dimen[DIMNUM];
|
---|
| 410 | } x_ary;
|
---|
| 411 | } x_fcnary;
|
---|
| 412 | unsigned short x_regcount; /* number of registers used by func */
|
---|
| 413 | } x_sym;
|
---|
| 414 | struct
|
---|
| 415 | {
|
---|
| 416 | char x_fname[FILNMLEN];
|
---|
| 417 | } x_file;
|
---|
| 418 | struct
|
---|
| 419 | {
|
---|
| 420 | long x_scnlen; /* section length */
|
---|
| 421 | unsigned short x_nreloc; /* number of relocation entries */
|
---|
| 422 | unsigned short x_nlinno; /* number of line numbers */
|
---|
| 423 | } x_scn;
|
---|
| 424 | };
|
---|
| 425 |
|
---|
| 426 | #define SYMENT struct syment
|
---|
| 427 | #define SYMESZ 18 /* sizeof(SYMENT) */
|
---|
| 428 |
|
---|
| 429 | #define AUXENT union auxent
|
---|
| 430 | #define AUXESZ 18 /* sizeof(AUXENT) */
|
---|
| 431 |
|
---|
| 432 | /*------------------------------------------------------------------------*/
|
---|
| 433 | /* NAMES OF "SPECIAL" SYMBOLS */
|
---|
| 434 | /*------------------------------------------------------------------------*/
|
---|
| 435 | #define _STEXT ".text"
|
---|
| 436 | #define _ETEXT "etext"
|
---|
| 437 | #define _SDATA ".data"
|
---|
| 438 | #define _EDATA "edata"
|
---|
| 439 | #define _SBSS ".bss"
|
---|
| 440 | #define _END "end"
|
---|
| 441 | #define _CINITPTR "cinit"
|
---|
| 442 |
|
---|
| 443 | /*--------------------------------------------------------------------------*/
|
---|
| 444 | /* ENTRY POINT SYMBOLS */
|
---|
| 445 | /*--------------------------------------------------------------------------*/
|
---|
| 446 | #define _START "_start"
|
---|
| 447 | #define _MAIN "_main"
|
---|
| 448 | /* _CSTART "_c_int00" (defined in params.h) */
|
---|
| 449 |
|
---|
| 450 |
|
---|
| 451 | #define _TVORIG "_tvorig"
|
---|
| 452 | #define _TORIGIN "_torigin"
|
---|
| 453 | #define _DORIGIN "_dorigin"
|
---|
| 454 |
|
---|
| 455 | #define _SORIGIN "_sorigin"
|
---|