home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 25.ddi / root.2 / usr / ucbinclude / a.out.h next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  11.2 KB  |  366 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10.  
  11. #ident    "@(#)//usr/ucbinclude/a.out.h.sl 1.1 4.0 12/08/90 6197 AT&T-USL"
  12.  
  13. /*******************************************************************
  14.  
  15.         PROPRIETARY NOTICE (Combined)
  16.  
  17. This source code is unpublished proprietary information
  18. constituting, or derived under license from AT&T's UNIX(r) System V.
  19. In addition, portions of such source code were derived from Berkeley
  20. 4.3 BSD under license from the Regents of the University of
  21. California.
  22.  
  23.  
  24.  
  25.         Copyright Notice 
  26.  
  27. Notice of copyright on this source code product does not indicate 
  28. publication.
  29.  
  30.     (c) 1986,1987,1988,1989  Sun Microsystems, Inc
  31.     (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  32.               All rights reserved.
  33. ********************************************************************/ 
  34.  
  35.  
  36. #ifndef _A_OUT_H
  37. #define _A_OUT_H
  38.  
  39. #ifndef _NLIST_H
  40. #include <nlist.h>    /* included for all machines */
  41. #endif
  42.  
  43. #if defined(__STDC__)
  44.  
  45. #if #machine(u370) || #machine(pdp11)
  46. /*
  47.  * Format of an a.out header
  48.  */
  49.  
  50. struct    exec {    /* a.out header */
  51. #if #machine(u370)
  52.     int        a_magic;    /* magic number */
  53.     int        a_stamp;    /* The version of a.out    */
  54.                     /* format of this file.    */
  55. #else
  56.     short        a_magic;    /* magic number */
  57. #endif
  58.     unsigned    a_text;        /* size of text segment */
  59.                     /* in bytes        */
  60.                     /* padded out to next    */
  61.                     /* page boundary with    */
  62.                     /* binary zeros.    */
  63.     unsigned    a_data;        /* size of initialized data */
  64.                     /* segment in bytes    */
  65.                     /* padded out to next    */
  66.                     /* page boundary with    */
  67.                     /* binary zeros.    */
  68.     unsigned    a_bss;        /* Actual size of    */
  69.                     /* uninitialized data    */
  70.                     /* segment in bytes.    */
  71.     unsigned    a_syms;        /* size of symbol table */
  72.     unsigned    a_entry;    /* entry point */
  73. #if #machine(u370)
  74.     unsigned    a_trsize;    /* size of text relocation */
  75.     unsigned    a_drsize;    /* size of data relocation */
  76.     unsigned    a_origin;    /* The origin to which     */
  77.                     /* this file was    */
  78.                     /* relocated.        */
  79.     unsigned    a_actext;    /* The actual size of    */
  80.                     /* the text segment in    */
  81.                     /* bytes.        */
  82.     unsigned    a_acdata;    /* The actual size of    */
  83.                     /* the data segment in    */
  84.                     /* bytes.        */
  85. #endif
  86. #if #machine(pdp11)
  87.     char        a_unused;    /* not used */
  88.     unsigned char    a_hitext;    /* high order text bits */
  89.     char        a_flag;        /* reloc info stripped */
  90.     char        a_stamp;    /* environment stamp */
  91. #endif
  92. };
  93.  
  94. #define    A_MAGIC1    0407        /* normal */
  95. #define    A_MAGIC0    0401        /* lpd (UNIX/RT) */
  96. #define    A_MAGIC2    0410        /* read-only text */
  97. #define    A_MAGIC3    0411        /* separated I&D */
  98. #define    A_MAGIC4    0405        /* overlay */
  99. #define    A_MAGIC5    0437        /* system overlay, separated I&D */
  100.  
  101. #define OMAGIC         0407        /* added for BSD compatibility */
  102. #define NMAGIC        0410
  103. #define ZMAGIC        0413
  104.  
  105. #if #machine(u370)
  106. struct relocation_info {
  107.       long  r_address;    /* relative to current segment */
  108.       unsigned int
  109.         r_symbolnum:24,    /* if extern then symbol table */
  110.                 /* ordinal (0, 1, 2, ...) else */
  111.                 /* segment number (same as symbol types) */
  112.             r_pcrel:1,     /* if so, segment offset has already */
  113.                 /* been subtracted */
  114.           r_length:2,    /* 0=byte, 1=word, 2=long */
  115.           r_extern:1,    /* does not include value */
  116.                 /* of symbol referenced */
  117.           r_offset:1,    /* already includes origin */
  118.                 /* of this segment (?) */
  119.         r_pad:3;    /* nothing, yet */
  120. };
  121. #endif
  122.  
  123. /* in invocation of BADMAG macro, argument should not be a function. */
  124.  
  125. #define    BADMAG(X) (X.a_magic != A_MAGIC1 &&\
  126.         X.a_magic != A_MAGIC2 &&\
  127.         X.a_magic != A_MAGIC3 &&\
  128.         X.a_magic != A_MAGIC4 &&\
  129.         X.a_magic != A_MAGIC5 &&\
  130.         X.a_magic != A_MAGIC0)
  131.  
  132.     /* values for type flag */
  133.  
  134. #define    N_UNDF    0    /* undefined */
  135. #define    N_TYPE    037
  136. #define    N_FN    037    /* file name symbol */
  137.  
  138. #if #machine(pdp11)
  139. #define    N_ABS    01    /* absolute */
  140. #define    N_TEXT    02    /* text symbol */
  141. #define    N_DATA    03    /* data symbol */
  142. #define    N_BSS    04    /* bss symbol */
  143. #define    N_REG    024    /* register name */
  144. #define    N_EXT    040    /* external bit, or'ed in */
  145. #define    FORMAT    "%.6o"    /* to print a value */
  146. #else
  147. #define    N_ABS    02    /* absolute */
  148. #define    N_TEXT    04    /* text */
  149. #define    N_DATA    06    /* data */
  150. #define    N_BSS    010
  151. #define    N_GSYM    0040    /* global sym: name,,type,0 */
  152. #define    N_FNAME 0042    /* procedure name (f77 kludge): name,,,0 */
  153. #define    N_FUN    0044    /* procedure: name,,linenumber,address */
  154. #define    N_STSYM 0046    /* static symbol: name,,type,address */
  155. #define    N_LCSYM 0050    /* .lcomm symbol: name,,type,address */
  156. #define    N_BSTR    0060    /* begin structure: name,,, */
  157. #define    N_RSYM    0100    /* register sym: name,,register,offset */
  158. #define    N_SLINE    0104    /* src line: ,,linenumber,address */
  159. #define    N_ESTR    0120    /* end structure: name,,, */
  160. #define    N_SSYM    0140    /* structure elt: name,,type,struct_offset */
  161. #define    N_SO    0144    /* source file name: name,,,address */
  162. #define    N_BENUM    0160    /* begin enum: name,,, */
  163. #define    N_LSYM    0200    /* local sym: name,,type,offset */
  164. #define    N_SOL    0204    /* #line source filename: name,,,address */
  165. #define    N_ENUM    0220    /* enum element: name,,,value */
  166. #define    N_PSYM    0240    /* parameter: name,,type,offset */
  167. #define    N_ENTRY    0244    /* alternate entry: name,,linenumber,address */
  168. #define    N_EENUM    0260    /* end enum: name,,, */
  169. #define    N_LBRAC    0300    /* left bracket: ,,nesting level,address */
  170. #define    N_RBRAC    0340    /* right bracket: ,,nesting level,address */
  171. #define    N_BCOMM    0342    /* begin common: name,,, */
  172. #define    N_ECOMM    0344    /* end common: name,,, */
  173. #define    N_ECOML    0350    /* end common (local name): ,,,address */
  174. #define    N_STRU    0374    /* 2nd entry for structure: str tag,,,length */
  175. #define    N_LENG    0376    /* second stab entry with length information */
  176. #define    N_EXT    01    /* external bit, or'ed in */
  177. #define    FORMAT    "%.8x"
  178. #define    STABTYPES 0340
  179. #endif
  180.  
  181. #else
  182.  /*        COMMON OBJECT FILE FORMAT
  183.  
  184.     For a description of the common object file format (COFF) see
  185.     the Common Object File Format chapter of the UNIX System V Support 
  186.     Tools Guide
  187.  
  188.          OBJECT FILE COMPONENTS
  189.  
  190.      HEADER FILES:
  191.              /usr/include/filehdr.h
  192.             /usr/include/aouthdr.h
  193.             /usr/include/scnhdr.h
  194.             /usr/include/reloc.h
  195.             /usr/include/linenum.h
  196.             /usr/include/syms.h
  197.             /usr/include/storclass.h
  198.  
  199.     STANDARD FILE:
  200.             /usr/include/a.out.h    "object file" 
  201.    */
  202.  
  203. #include "filehdr.h"
  204. #include "aouthdr.h"
  205. #include "scnhdr.h"
  206. #include "reloc.h"
  207. #include "linenum.h"
  208. #include "syms.h"
  209.  
  210. #endif
  211.  
  212. #else
  213. #if u3b || vax || M32 || u3b15 || u3b5 || u3b2 || i386 || i286
  214.  
  215.  /* see COMMON OBJECT FILE FORMAT above */
  216.  
  217. #include "filehdr.h"
  218. #include "aouthdr.h"
  219. #include "scnhdr.h"
  220. #include "reloc.h"
  221. #include "linenum.h"
  222. #include "syms.h"
  223.  
  224. #else /* u370 || pdp11 */
  225.  
  226. /*
  227.  * Format of an a.out header
  228.  */
  229.  
  230. struct    exec {    /* a.out header */
  231. #if u370
  232.     int        a_magic;    /* magic number */
  233.     int        a_stamp;    /* The version of a.out    */
  234.                     /* format of this file.    */
  235. #else
  236.     short        a_magic;    /* magic number */
  237. #endif
  238.     unsigned    a_text;        /* size of text segment */
  239.                     /* in bytes        */
  240.                     /* padded out to next    */
  241.                     /* page boundary with    */
  242.                     /* binary zeros.    */
  243.     unsigned    a_data;        /* size of initialized data */
  244.                     /* segment in bytes    */
  245.                     /* padded out to next    */
  246.                     /* page boundary with    */
  247.                     /* binary zeros.    */
  248.     unsigned    a_bss;        /* Actual size of    */
  249.                     /* uninitialized data    */
  250.                     /* segment in bytes.    */
  251.     unsigned    a_syms;        /* size of symbol table */
  252.     unsigned    a_entry;    /* entry point */
  253. #if u370
  254.     unsigned    a_trsize;    /* size of text relocation */
  255.     unsigned    a_drsize;    /* size of data relocation */
  256.     unsigned    a_origin;    /* The origin to which     */
  257.                     /* this file was    */
  258.                     /* relocated.        */
  259.     unsigned    a_actext;    /* The actual size of    */
  260.                     /* the text segment in    */
  261.                     /* bytes.        */
  262.     unsigned    a_acdata;    /* The actual size of    */
  263.                     /* the data segment in    */
  264.                     /* bytes.        */
  265. #endif
  266. #if pdp11
  267.     char        a_unused;    /* not used */
  268.     unsigned char    a_hitext;    /* high order text bits */
  269.     char        a_flag;        /* reloc info stripped */
  270.     char        a_stamp;    /* environment stamp */
  271. #endif
  272. };
  273.  
  274. #define    A_MAGIC1    0407        /* normal */
  275. #define    A_MAGIC0    0401        /* lpd (UNIX/RT) */
  276. #define    A_MAGIC2    0410        /* read-only text */
  277. #define    A_MAGIC3    0411        /* separated I&D */
  278. #define    A_MAGIC4    0405        /* overlay */
  279. #define    A_MAGIC5    0437        /* system overlay, separated I&D */
  280.  
  281. #define OMAGIC         0407        /* added for BSD compatibility */
  282. #define NMAGIC        0410
  283. #define ZMAGIC        0413
  284.  
  285. #if u370
  286. struct relocation_info {
  287.       long  r_address;    /* relative to current segment */
  288.       unsigned int
  289.         r_symbolnum:24,    /* if extern then symbol table */
  290.                 /* ordinal (0, 1, 2, ...) else */
  291.                 /* segment number (same as symbol types) */
  292.             r_pcrel:1,     /* if so, segment offset has already */
  293.                 /* been subtracted */
  294.           r_length:2,    /* 0=byte, 1=word, 2=long */
  295.           r_extern:1,    /* does not include value */
  296.                 /* of symbol referenced */
  297.           r_offset:1,    /* already includes origin */
  298.                 /* of this segment (?) */
  299.         r_pad:3;    /* nothing, yet */
  300. };
  301. #endif
  302.  
  303. /* in invocation of BADMAG macro, argument should not be a function. */
  304.  
  305. #define    BADMAG(X) (X.a_magic != A_MAGIC1 &&\
  306.         X.a_magic != A_MAGIC2 &&\
  307.         X.a_magic != A_MAGIC3 &&\
  308.         X.a_magic != A_MAGIC4 &&\
  309.         X.a_magic != A_MAGIC5 &&\
  310.         X.a_magic != A_MAGIC0)
  311.  
  312.     /* values for type flag */
  313.  
  314. #define    N_UNDF    0    /* undefined */
  315. #define    N_TYPE    037
  316. #define    N_FN    037    /* file name symbol */
  317.  
  318. #if pdp11
  319. #define    N_ABS    01    /* absolute */
  320. #define    N_TEXT    02    /* text symbol */
  321. #define    N_DATA    03    /* data symbol */
  322. #define    N_BSS    04    /* bss symbol */
  323. #define    N_REG    024    /* register name */
  324. #define    N_EXT    040    /* external bit, or'ed in */
  325. #define    FORMAT    "%.6o"    /* to print a value */
  326. #else
  327. #define    N_ABS    02    /* absolute */
  328. #define    N_TEXT    04    /* text */
  329. #define    N_DATA    06    /* data */
  330. #define    N_BSS    010
  331. #define    N_GSYM    0040    /* global sym: name,,type,0 */
  332. #define    N_FNAME 0042    /* procedure name (f77 kludge): name,,,0 */
  333. #define    N_FUN    0044    /* procedure: name,,linenumber,address */
  334. #define    N_STSYM 0046    /* static symbol: name,,type,address */
  335. #define    N_LCSYM 0050    /* .lcomm symbol: name,,type,address */
  336. #define    N_BSTR    0060    /* begin structure: name,,, */
  337. #define    N_RSYM    0100    /* register sym: name,,register,offset */
  338. #define    N_SLINE    0104    /* src line: ,,linenumber,address */
  339. #define    N_ESTR    0120    /* end structure: name,,, */
  340. #define    N_SSYM    0140    /* structure elt: name,,type,struct_offset */
  341. #define    N_SO    0144    /* source file name: name,,,address */
  342. #define    N_BENUM    0160    /* begin enum: name,,, */
  343. #define    N_LSYM    0200    /* local sym: name,,type,offset */
  344. #define    N_SOL    0204    /* #line source filename: name,,,address */
  345. #define    N_ENUM    0220    /* enum element: name,,,value */
  346. #define    N_PSYM    0240    /* parameter: name,,type,offset */
  347. #define    N_ENTRY    0244    /* alternate entry: name,,linenumber,address */
  348. #define    N_EENUM    0260    /* end enum: name,,, */
  349. #define    N_LBRAC    0300    /* left bracket: ,,nesting level,address */
  350. #define    N_RBRAC    0340    /* right bracket: ,,nesting level,address */
  351. #define    N_BCOMM    0342    /* begin common: name,,, */
  352. #define    N_ECOMM    0344    /* end common: name,,, */
  353. #define    N_ECOML    0350    /* end common (local name): ,,,address */
  354. #define    N_STRU    0374    /* 2nd entry for structure: str tag,,,length */
  355. #define    N_LENG    0376    /* second stab entry with length information */
  356. #define    N_EXT    01    /* external bit, or'ed in */
  357. #define    FORMAT    "%.8x"
  358. #define    STABTYPES 0340
  359. #endif
  360.  
  361. #endif    /* u3b, ... */
  362.  
  363. #endif  /* __STDC__ */
  364.  
  365. #endif /* _A_OUT_H */
  366.