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