|
|
1.1 ! root 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_trsize; /* size of text relocation */ ! 12: unsigned long a_drsize; /* size of data relocation */ ! 13: unsigned long a_entry; /* entry point (WRONG) */ ! 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"
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.