nlist.h revision 1.1
11.1Stsutsui/*	$NetBSD: nlist.h,v 1.1 2011/07/16 15:52:02 tsutsui Exp $	*/
21.1Stsutsui
31.1Stsutsui/*-
41.1Stsutsui * Copyright (c) 1991, 1993
51.1Stsutsui *	The Regents of the University of California.  All rights reserved.
61.1Stsutsui * (c) UNIX System Laboratories, Inc.
71.1Stsutsui * All or some portions of this file are derived from material licensed
81.1Stsutsui * to the University of California by American Telephone and Telegraph
91.1Stsutsui * Co. or Unix System Laboratories, Inc. and are reproduced herein with
101.1Stsutsui * the permission of UNIX System Laboratories, Inc.
111.1Stsutsui *
121.1Stsutsui * Redistribution and use in source and binary forms, with or without
131.1Stsutsui * modification, are permitted provided that the following conditions
141.1Stsutsui * are met:
151.1Stsutsui * 1. Redistributions of source code must retain the above copyright
161.1Stsutsui *    notice, this list of conditions and the following disclaimer.
171.1Stsutsui * 2. Redistributions in binary form must reproduce the above copyright
181.1Stsutsui *    notice, this list of conditions and the following disclaimer in the
191.1Stsutsui *    documentation and/or other materials provided with the distribution.
201.1Stsutsui * 3. Neither the name of the University nor the names of its contributors
211.1Stsutsui *    may be used to endorse or promote products derived from this software
221.1Stsutsui *    without specific prior written permission.
231.1Stsutsui *
241.1Stsutsui * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
251.1Stsutsui * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
261.1Stsutsui * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
271.1Stsutsui * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
281.1Stsutsui * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
291.1Stsutsui * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
301.1Stsutsui * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
311.1Stsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
321.1Stsutsui * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
331.1Stsutsui * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
341.1Stsutsui * SUCH DAMAGE.
351.1Stsutsui *
361.1Stsutsui *	@(#)nlist.h	8.2 (Berkeley) 1/21/94
371.1Stsutsui */
381.1Stsutsui
391.1Stsutsui#ifndef _NLIST_H_
401.1Stsutsui#define	_NLIST_H_
411.1Stsutsui
421.1Stsutsui#include <sys/cdefs.h>
431.1Stsutsui
441.1Stsutsui/*
451.1Stsutsui * Symbol table entry format.  The #ifdef's are so that programs including
461.1Stsutsui * nlist.h can initialize nlist structures statically.
471.1Stsutsui */
481.1Stsutsuistruct nlist {
491.1Stsutsui#ifdef _AOUT_INCLUDE_
501.1Stsutsui	union {
511.1Stsutsui#if 0
521.1Stsutsui		__aconst char *n_name;	/* symbol name (in memory) */
531.1Stsutsui#endif
541.1Stsutsui		int32_t n_strx;		/* file string table offset (on disk) */
551.1Stsutsui	} n_un;
561.1Stsutsui# define N_NAME(nlp)	((nlp)->n_un.n_name)
571.1Stsutsui#else
581.1Stsutsui	const char *n_name;		/* symbol name (in memory) */
591.1Stsutsui# define N_NAME(nlp)	((nlp)->n_name)
601.1Stsutsui#endif
611.1Stsutsui
621.1Stsutsui#define	N_UNDF	0x00		/* undefined */
631.1Stsutsui#define	N_ABS	0x02		/* absolute address */
641.1Stsutsui#define	N_TEXT	0x04		/* text segment */
651.1Stsutsui#define	N_DATA	0x06		/* data segment */
661.1Stsutsui#define	N_BSS	0x08		/* bss segment */
671.1Stsutsui#define	N_INDR	0x0a		/* alias definition */
681.1Stsutsui#define	N_SIZE	0x0c		/* pseudo type, defines a symbol's size */
691.1Stsutsui#define	N_COMM	0x12		/* common reference */
701.1Stsutsui#define N_SETA	0x14		/* absolute set element symbol */
711.1Stsutsui#define N_SETT	0x16		/* text set element symbol */
721.1Stsutsui#define N_SETD	0x18		/* data set element symbol */
731.1Stsutsui#define N_SETB	0x1a		/* bss set element symbol */
741.1Stsutsui#define N_SETV	0x1c		/* set vector symbol */
751.1Stsutsui#define	N_FN	0x1e		/* file name (N_EXT on) */
761.1Stsutsui#define	N_WARN	0x1e		/* warning message (N_EXT off) */
771.1Stsutsui
781.1Stsutsui#define	N_EXT	0x01		/* external (global) bit, OR'ed in */
791.1Stsutsui#define	N_TYPE	0x1e		/* mask for all the type bits */
801.1Stsutsui	unsigned char n_type;	/* type defines */
811.1Stsutsui
821.1Stsutsui	char n_other;		/* spare */
831.1Stsutsui#define	n_hash	n_desc		/* used internally by ld(1); XXX */
841.1Stsutsui	int16_t n_desc;		/* used by stab entries */
851.1Stsutsui	uint32_t n_value;	/* address/value of the symbol */
861.1Stsutsui};
871.1Stsutsui
881.1Stsutsui#define	N_FORMAT	"%08x"	/* namelist value format; XXX */
891.1Stsutsui#define	N_STAB		0x0e0	/* mask for debugger symbols -- stab(5) */
901.1Stsutsui
911.1Stsutsui__BEGIN_DECLS
921.1Stsutsuiint nlist(const char *, struct nlist *);
931.1Stsutsuiint __fdnlist(int, struct nlist *);		/* XXX for libkvm */
941.1Stsutsui__END_DECLS
951.1Stsutsui
961.1Stsutsui#endif /* !_NLIST_H_ */
97