nlist.h revision 1.13
11.13Sdsl/*	$NetBSD: nlist.h,v 1.13 2005/02/26 21:16:35 dsl Exp $	*/
21.5Scgd
31.3Scgd/*-
41.3Scgd * Copyright (c) 1991, 1993
51.3Scgd *	The Regents of the University of California.  All rights reserved.
61.3Scgd * (c) UNIX System Laboratories, Inc.
71.3Scgd * All or some portions of this file are derived from material licensed
81.3Scgd * to the University of California by American Telephone and Telegraph
91.3Scgd * Co. or Unix System Laboratories, Inc. and are reproduced herein with
101.3Scgd * the permission of UNIX System Laboratories, Inc.
111.3Scgd *
121.3Scgd * Redistribution and use in source and binary forms, with or without
131.3Scgd * modification, are permitted provided that the following conditions
141.3Scgd * are met:
151.3Scgd * 1. Redistributions of source code must retain the above copyright
161.3Scgd *    notice, this list of conditions and the following disclaimer.
171.3Scgd * 2. Redistributions in binary form must reproduce the above copyright
181.3Scgd *    notice, this list of conditions and the following disclaimer in the
191.3Scgd *    documentation and/or other materials provided with the distribution.
201.11Sagc * 3. Neither the name of the University nor the names of its contributors
211.3Scgd *    may be used to endorse or promote products derived from this software
221.3Scgd *    without specific prior written permission.
231.3Scgd *
241.3Scgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
251.3Scgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
261.3Scgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
271.3Scgd * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
281.3Scgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
291.3Scgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
301.3Scgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
311.3Scgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
321.3Scgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
331.3Scgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
341.3Scgd * SUCH DAMAGE.
351.3Scgd *
361.5Scgd *	@(#)nlist.h	8.2 (Berkeley) 1/21/94
371.3Scgd */
381.3Scgd
391.3Scgd#ifndef _NLIST_H_
401.3Scgd#define	_NLIST_H_
411.3Scgd
421.8Smycroft#include <sys/cdefs.h>
431.8Smycroft
441.3Scgd/*
451.3Scgd * Symbol table entry format.  The #ifdef's are so that programs including
461.3Scgd * nlist.h can initialize nlist structures statically.
471.3Scgd */
481.3Scgdstruct nlist {
491.3Scgd#ifdef _AOUT_INCLUDE_
501.3Scgd	union {
511.8Smycroft		__aconst char *n_name;	/* symbol name (in memory) */
521.7Smycroft		long n_strx;		/* file string table offset (on disk) */
531.3Scgd	} n_un;
541.3Scgd#else
551.13Sdsl	const char *n_name;		/* symbol name (in memory) */
561.3Scgd#endif
571.3Scgd
581.3Scgd#define	N_UNDF	0x00		/* undefined */
591.3Scgd#define	N_ABS	0x02		/* absolute address */
601.3Scgd#define	N_TEXT	0x04		/* text segment */
611.3Scgd#define	N_DATA	0x06		/* data segment */
621.3Scgd#define	N_BSS	0x08		/* bss segment */
631.4Spk#define	N_INDR	0x0a		/* alias definition */
641.4Spk#define	N_SIZE	0x0c		/* pseudo type, defines a symbol's size */
651.3Scgd#define	N_COMM	0x12		/* common reference */
661.10Spk#define N_SETA	0x14		/* absolute set element symbol */
671.10Spk#define N_SETT	0x16		/* text set element symbol */
681.10Spk#define N_SETD	0x18		/* data set element symbol */
691.10Spk#define N_SETB	0x1a		/* bss set element symbol */
701.10Spk#define N_SETV	0x1c		/* set vector symbol */
711.4Spk#define	N_FN	0x1e		/* file name (N_EXT on) */
721.4Spk#define	N_WARN	0x1e		/* warning message (N_EXT off) */
731.3Scgd
741.3Scgd#define	N_EXT	0x01		/* external (global) bit, OR'ed in */
751.3Scgd#define	N_TYPE	0x1e		/* mask for all the type bits */
761.3Scgd	unsigned char n_type;	/* type defines */
771.3Scgd
781.3Scgd	char n_other;		/* spare */
791.3Scgd#define	n_hash	n_desc		/* used internally by ld(1); XXX */
801.3Scgd	short n_desc;		/* used by stab entries */
811.3Scgd	unsigned long n_value;	/* address/value of the symbol */
821.3Scgd};
831.3Scgd
841.3Scgd#define	N_FORMAT	"%08x"	/* namelist value format; XXX */
851.3Scgd#define	N_STAB		0x0e0	/* mask for debugger symbols -- stab(5) */
861.3Scgd
871.3Scgd__BEGIN_DECLS
881.12Sperryint nlist(const char *, struct nlist *);
891.12Sperryint __fdnlist(int, struct nlist *);		/* XXX for libkvm */
901.3Scgd__END_DECLS
911.3Scgd
921.3Scgd#endif /* !_NLIST_H_ */
93