xref: /original-bsd/include/a.out.h (revision 27f6e8d8)
1 /*-
2  * Copyright (c) 1991 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)a.out.h	5.5 (Berkeley) 04/04/91
8  */
9 
10 #ifndef	_AOUT_H_
11 #define	_AOUT_H_
12 
13 #include <sys/exec.h>
14 
15 /* Valid magic number check. */
16 #define	N_BADMAG(ex) \
17 	((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \
18 	    (ex).a_magic != ZMAGIC)
19 
20 /* Text segment offset. */
21 #if defined(vax) || defined(tahoe)
22 #define	N_TXTOFF(ex) \
23 	((ex).a_magic == ZMAGIC ? 1024 : sizeof(struct exec))
24 #endif
25 
26 #if defined(hp300) || defined(i386)
27 #define	N_TXTOFF(ex) \
28 	((ex).a_magic == ZMAGIC ? 4096 : sizeof(struct exec))
29 #endif
30 
31 /* Symbol table offset. */
32 #define N_SYMOFF(ex) \
33 	(N_TXTOFF(ex) + (ex).a_text + (ex).a_data + (ex).a_trsize + \
34 	    (ex).a_drsize)
35 
36 /* String table offset. */
37 #define	N_STROFF(ex) \
38 	(N_SYMOFF(ex) + (ex).a_syms)
39 
40 /* Relocation format. */
41 struct relocation_info {
42 	int r_address;			/* offset in text or data segment */
43 	unsigned int r_symbolnum : 24,	/* ordinal number of add symbol */
44 			 r_pcrel :  1,	/* 1 if value should be pc-relative */
45 			r_length :  2,	/* log base 2 of value's width */
46 			r_extern :  1,	/* 1 if need to add symbol to value */
47 				 :  4;	/* reserved */
48 };
49 
50 #define _AOUT_INCLUDE_
51 #include <nlist.h>
52 
53 #endif /* !_AOUT_H_ */
54