nlist.h revision 5207
11539Srgrimes/*-
21539Srgrimes * Copyright (c) 1991, 1993
31539Srgrimes *	The Regents of the University of California.  All rights reserved.
41539Srgrimes * (c) UNIX System Laboratories, Inc.
51539Srgrimes * All or some portions of this file are derived from material licensed
61539Srgrimes * to the University of California by American Telephone and Telegraph
71539Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with
81539Srgrimes * the permission of UNIX System Laboratories, Inc.
91539Srgrimes *
101539Srgrimes * Redistribution and use in source and binary forms, with or without
111539Srgrimes * modification, are permitted provided that the following conditions
121539Srgrimes * are met:
131539Srgrimes * 1. Redistributions of source code must retain the above copyright
141539Srgrimes *    notice, this list of conditions and the following disclaimer.
151539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
161539Srgrimes *    notice, this list of conditions and the following disclaimer in the
171539Srgrimes *    documentation and/or other materials provided with the distribution.
181539Srgrimes * 3. All advertising materials mentioning features or use of this software
191539Srgrimes *    must display the following acknowledgement:
201539Srgrimes *	This product includes software developed by the University of
211539Srgrimes *	California, Berkeley and its contributors.
221539Srgrimes * 4. Neither the name of the University nor the names of its contributors
231539Srgrimes *    may be used to endorse or promote products derived from this software
241539Srgrimes *    without specific prior written permission.
251539Srgrimes *
261539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
271539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
281539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
291539Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
301539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
311539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
321539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
331539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
341539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
351539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
361539Srgrimes * SUCH DAMAGE.
371539Srgrimes *
381539Srgrimes *	@(#)nlist.h	8.2 (Berkeley) 1/21/94
395207Snate *
405207Snate *	$Id$
411539Srgrimes */
421539Srgrimes
431539Srgrimes#ifndef _NLIST_H_
441539Srgrimes#define	_NLIST_H_
451539Srgrimes
461539Srgrimes/*
471539Srgrimes * Symbol table entry format.  The #ifdef's are so that programs including
481539Srgrimes * nlist.h can initialize nlist structures statically.
491539Srgrimes */
501539Srgrimesstruct nlist {
511539Srgrimes#ifdef _AOUT_INCLUDE_
521539Srgrimes	union {
531539Srgrimes		char *n_name;	/* symbol name (in memory) */
541539Srgrimes		long n_strx;	/* file string table offset (on disk) */
551539Srgrimes	} n_un;
561539Srgrimes#else
571539Srgrimes	char *n_name;		/* symbol name (in memory) */
581539Srgrimes#endif
591539Srgrimes
601539Srgrimes#define	N_UNDF	0x00		/* undefined */
611539Srgrimes#define	N_ABS	0x02		/* absolute address */
621539Srgrimes#define	N_TEXT	0x04		/* text segment */
631539Srgrimes#define	N_DATA	0x06		/* data segment */
641539Srgrimes#define	N_BSS	0x08		/* bss segment */
655207Snate#define	N_INDR	0x0a		/* alias definition */
665207Snate#define	N_SIZE	0x0c		/* pseudo type, defines a symbol's size */
671539Srgrimes#define	N_COMM	0x12		/* common reference */
685207Snate#define	N_FN	0x1e		/* file name (N_EXT on) */
695207Snate#define	N_WARN	0x1e		/* warning message (N_EXT off) */
701539Srgrimes
711539Srgrimes#define	N_EXT	0x01		/* external (global) bit, OR'ed in */
721539Srgrimes#define	N_TYPE	0x1e		/* mask for all the type bits */
731539Srgrimes	unsigned char n_type;	/* type defines */
741539Srgrimes
751539Srgrimes	char n_other;		/* spare */
761539Srgrimes#define	n_hash	n_desc		/* used internally by ld(1); XXX */
771539Srgrimes	short n_desc;		/* used by stab entries */
781539Srgrimes	unsigned long n_value;	/* address/value of the symbol */
791539Srgrimes};
801539Srgrimes
811539Srgrimes#define	N_FORMAT	"%08x"	/* namelist value format; XXX */
821539Srgrimes#define	N_STAB		0x0e0	/* mask for debugger symbols -- stab(5) */
831539Srgrimes
841539Srgrimes#include <sys/cdefs.h>
851539Srgrimes
861539Srgrimes__BEGIN_DECLS
871539Srgrimesint nlist __P((const char *, struct nlist *));
881539Srgrimes__END_DECLS
891539Srgrimes
901539Srgrimes#endif /* !_NLIST_H_ */
91