xref: /original-bsd/include/nlist.h (revision 333da485)
1 /*-
2  * Copyright (c) 1991, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  * (c) UNIX System Laboratories, Inc.
5  * All or some portions of this file are derived from material licensed
6  * to the University of California by American Telephone and Telegraph
7  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8  * the permission of UNIX System Laboratories, Inc.
9  *
10  * %sccs.include.redist.c%
11  *
12  *	@(#)nlist.h	8.2 (Berkeley) 01/21/94
13  */
14 
15 #ifndef _NLIST_H_
16 #define	_NLIST_H_
17 
18 /*
19  * Symbol table entry format.  The #ifdef's are so that programs including
20  * nlist.h can initialize nlist structures statically.
21  */
22 struct nlist {
23 #ifdef _AOUT_INCLUDE_
24 	union {
25 		char *n_name;	/* symbol name (in memory) */
26 		long n_strx;	/* file string table offset (on disk) */
27 	} n_un;
28 #else
29 	char *n_name;		/* symbol name (in memory) */
30 #endif
31 
32 #define	N_UNDF	0x00		/* undefined */
33 #define	N_ABS	0x02		/* absolute address */
34 #define	N_TEXT	0x04		/* text segment */
35 #define	N_DATA	0x06		/* data segment */
36 #define	N_BSS	0x08		/* bss segment */
37 #define	N_COMM	0x12		/* common reference */
38 #define	N_FN	0x1e		/* file name */
39 
40 #define	N_EXT	0x01		/* external (global) bit, OR'ed in */
41 #define	N_TYPE	0x1e		/* mask for all the type bits */
42 	unsigned char n_type;	/* type defines */
43 
44 	char n_other;		/* spare */
45 #define	n_hash	n_desc		/* used internally by ld(1); XXX */
46 	short n_desc;		/* used by stab entries */
47 	unsigned long n_value;	/* address/value of the symbol */
48 };
49 
50 #define	N_FORMAT	"%08x"	/* namelist value format; XXX */
51 #define	N_STAB		0x0e0	/* mask for debugger symbols -- stab(5) */
52 
53 #include <sys/cdefs.h>
54 
55 __BEGIN_DECLS
56 int nlist __P((const char *, struct nlist *));
57 __END_DECLS
58 
59 #endif /* !_NLIST_H_ */
60