Commit | Line | Data |
---|---|---|
19ef9aae KB |
1 | /*- |
2 | * Copyright (c) 1991 The Regents of the University of California. | |
3 | * All rights reserved. | |
bb0cfa24 | 4 | * |
19ef9aae KB |
5 | * %sccs.include.redist.c% |
6 | * | |
8b171282 | 7 | * @(#)a.out.h 5.8 (Berkeley) %G% |
bb0cfa24 | 8 | */ |
6f86c72f | 9 | |
19ef9aae KB |
10 | #ifndef _AOUT_H_ |
11 | #define _AOUT_H_ | |
12 | ||
8715e60f | 13 | #include <sys/exec.h> |
6f86c72f | 14 | |
8b171282 | 15 | #if defined(hp300) || defined(i386) || defined(mips) |
7c7b8a0c KB |
16 | #define __LDPGSZ 4096 |
17 | #endif | |
18 | #if defined(tahoe) || defined(vax) | |
19 | #define __LDPGSZ 1024 | |
20 | #endif | |
21 | ||
19ef9aae KB |
22 | /* Valid magic number check. */ |
23 | #define N_BADMAG(ex) \ | |
24 | ((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \ | |
25 | (ex).a_magic != ZMAGIC) | |
6f86c72f | 26 | |
7c7b8a0c | 27 | /* Address of the bottom of the text segment. */ |
8b171282 | 28 | #ifndef mips |
7c7b8a0c KB |
29 | #define N_TXTADDR(X) 0 |
30 | ||
31 | /* Address of the bottom of the data segment. */ | |
32 | #define N_DATADDR(ex) \ | |
33 | (N_TXTADDR(ex) + ((ex).a_magic == OMAGIC ? (ex).a_text \ | |
34 | : __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1)))) | |
35 | ||
19ef9aae | 36 | /* Text segment offset. */ |
19ef9aae | 37 | #define N_TXTOFF(ex) \ |
7c7b8a0c | 38 | ((ex).a_magic == ZMAGIC ? __LDPGSZ : sizeof(struct exec)) |
bad2f352 | 39 | |
7c7b8a0c KB |
40 | /* Data segment offset. */ |
41 | #define N_DATOFF(ex) \ | |
42 | (N_TXTOFF(ex) + ((ex).a_magic != ZMAGIC ? (ex).a_text : \ | |
6b039c11 | 43 | __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1)))) |
bad2f352 | 44 | |
19ef9aae KB |
45 | /* Symbol table offset. */ |
46 | #define N_SYMOFF(ex) \ | |
47 | (N_TXTOFF(ex) + (ex).a_text + (ex).a_data + (ex).a_trsize + \ | |
48 | (ex).a_drsize) | |
bad2f352 | 49 | |
19ef9aae | 50 | /* String table offset. */ |
7c7b8a0c | 51 | #define N_STROFF(ex) (N_SYMOFF(ex) + (ex).a_syms) |
6f86c72f | 52 | |
19ef9aae | 53 | /* Relocation format. */ |
6f86c72f | 54 | struct relocation_info { |
19ef9aae KB |
55 | int r_address; /* offset in text or data segment */ |
56 | unsigned int r_symbolnum : 24, /* ordinal number of add symbol */ | |
57 | r_pcrel : 1, /* 1 if value should be pc-relative */ | |
58 | r_length : 2, /* log base 2 of value's width */ | |
59 | r_extern : 1, /* 1 if need to add symbol to value */ | |
60 | : 4; /* reserved */ | |
6f86c72f | 61 | }; |
8b171282 RC |
62 | #else /* mips */ |
63 | #define N_TXTADDR(X) 0x400000 | |
64 | #endif /* mips */ | |
6f86c72f | 65 | |
19ef9aae KB |
66 | #define _AOUT_INCLUDE_ |
67 | #include <nlist.h> | |
6f86c72f | 68 | |
19ef9aae | 69 | #endif /* !_AOUT_H_ */ |