1:         /*	a.out.h	1.1	82/08/26	*/
   2: /*
   3:  * Header prepended to each a.out file.
   4:  */
   5: struct exec {
   6:     long    a_magic;    /* magic number */
   7: unsigned long   a_text;     /* size of text segment */
   8: unsigned long   a_data;     /* size of initialized data */
   9: unsigned long   a_bss;      /* size of uninitialized data */
  10: unsigned long   a_syms;     /* size of symbol table */
  11: unsigned long   a_entry;    /* entry point (WRONG) */
  12: unsigned long   a_trsize;   /* size of text relocation */
  13: unsigned long   a_drsize;   /* size of data relocation */
  14: };
  15: 
  16: #define OMAGIC  0407        /* old impure format */
  17: #define NMAGIC  0410        /* read-only text */
  18: #define ZMAGIC  0413        /* demand load format */
  19: 
  20: /*
  21:  * Macros which take exec structures as arguments and tell whether
  22:  * the file has a reasonable magic number or offsets to text|symbols|strings.
  23:  */
  24: #define N_BADMAG(x) \
  25:     (((x).a_magic)!=OMAGIC && ((x).a_magic)!=NMAGIC && ((x).a_magic)!=ZMAGIC)
  26: 
  27: #define N_TXTOFF(x) \
  28:     ((x).a_magic==ZMAGIC ? 1024 : sizeof (struct exec))
  29: #define N_SYMOFF(x) \
  30:     (N_TXTOFF(x) + (x).a_text+(x).a_data + (x).a_trsize+(x).a_drsize)
  31: #define N_STROFF(x) \
  32:     (N_SYMOFF(x) + (x).a_syms)
  33: 
  34: /*
  35:  * Format of a relocation datum.
  36:  */
  37: struct relocation_info {
  38:     int r_address;  /* address which is relocated */
  39: unsigned int    r_symbolnum:24, /* local symbol ordinal */
  40:         r_pcrel:1,  /* was relocated pc relative already */
  41:         r_length:2, /* 0=byte, 1=word, 2=long */
  42:         r_extern:1, /* does not include value of sym referenced */
  43:         :4;     /* nothing, yet */
  44: };
  45: 
  46: /*
  47:  * Format of a symbol table entry; this file is included by <a.out.h>
  48:  * and should be used if you aren't interested the a.out header
  49:  * or relocation information.
  50:  */
  51: struct  nlist {
  52:     union {
  53:         char    *n_name;    /* for use when in-core */
  54:         long    n_strx;     /* index into file string table */
  55:     } n_un;
  56: unsigned char   n_type;     /* type flag, i.e. N_TEXT etc; see below */
  57:     char    n_other;    /* unused */
  58:     short   n_desc;     /* see <stab.h> */
  59: unsigned long   n_value;    /* value of this symbol (or sdb offset) */
  60: };
  61: #define n_hash  n_desc      /* used internally by ld */
  62: 
  63: /*
  64:  * Simple values for n_type.
  65:  */
  66: #define N_UNDF  0x0     /* undefined */
  67: #define N_ABS   0x2     /* absolute */
  68: #define N_TEXT  0x4     /* text */
  69: #define N_DATA  0x6     /* data */
  70: #define N_BSS   0x8     /* bss */
  71: #define N_COMM  0x12        /* common (internal to ld) */
  72: #define N_FN    0x1f        /* file name symbol */
  73: 
  74: #define N_EXT   01      /* external bit, or'ed in */
  75: #define N_TYPE  0x1e        /* mask for all the type bits */
  76: 
  77: /*
  78:  * Sdb entries have some of the N_STAB bits set.
  79:  * These are given in <stab.h>
  80:  */
  81: #define N_STAB  0xe0        /* if any of these bits set, a SDB entry */
  82: 
  83: /*
  84:  * Format for namelist values.
  85:  */
  86: #define N_FORMAT    "%08x"

Defined struct's

exec defined in line 5; never used
nlist defined in line 51; never used
relocation_info defined in line 37; never used

Defined macros

NMAGIC defined in line 17; used 1 times
  • in line 25
N_ABS defined in line 67; never used
N_BADMAG defined in line 24; never used
N_BSS defined in line 70; never used
N_COMM defined in line 71; never used
N_DATA defined in line 69; never used
N_EXT defined in line 74; never used
N_FN defined in line 72; never used
N_FORMAT defined in line 86; never used
N_STAB defined in line 81; never used
N_STROFF defined in line 31; never used
N_SYMOFF defined in line 29; used 1 times
  • in line 32
N_TEXT defined in line 68; never used
N_TXTOFF defined in line 27; used 1 times
  • in line 30
N_TYPE defined in line 75; never used
N_UNDF defined in line 66; never used
OMAGIC defined in line 16; used 1 times
  • in line 25
ZMAGIC defined in line 18; used 2 times
n_hash defined in line 61; never used
Last modified: 1985-08-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 585
Valid CSS Valid XHTML 1.0 Strict