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 * 4. Neither the name of the University nor the names of its contributors 191539Srgrimes * may be used to endorse or promote products derived from this software 201539Srgrimes * without specific prior written permission. 211539Srgrimes * 221539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 231539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 241539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 251539Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 261539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 271539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 281539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 291539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 301539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 311539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 321539Srgrimes * SUCH DAMAGE. 331539Srgrimes * 341539Srgrimes * @(#)nlist.h 8.2 (Berkeley) 1/21/94 355207Snate * 3650473Speter * $FreeBSD$ 371539Srgrimes */ 381539Srgrimes 39102285Speter#ifndef _SYS_NLIST_AOUT_H_ 40102285Speter#define _SYS_NLIST_AOUT_H_ 411539Srgrimes 421539Srgrimes/* 4331584Sjdp * Symbol table entries in a.out files. 441539Srgrimes */ 4531584Sjdp 4631584Sjdp/* 4731584Sjdp * Layout of each symbol. The "#ifdef _AOUT_INCLUDE_" is so that 4831584Sjdp * programs including nlist.h can initialize nlist structures 4931584Sjdp * statically. 5031584Sjdp */ 511539Srgrimesstruct nlist { 521539Srgrimes#ifdef _AOUT_INCLUDE_ 531539Srgrimes union { 54208986Sbz const char *n_name; /* symbol name (in memory) */ 551539Srgrimes long n_strx; /* file string table offset (on disk) */ 561539Srgrimes } n_un; 571539Srgrimes#else 58208986Sbz const char *n_name; /* symbol name (in memory) */ 59102953Sbde int : 8 * (sizeof(long) > sizeof(char *) ? 60102953Sbde sizeof(long) - sizeof(char *) : sizeof(char *) - sizeof(long)); 611539Srgrimes#endif 6231584Sjdp unsigned char n_type; /* type defines */ 6331584Sjdp char n_other; /* ".type" and binding information */ 6431584Sjdp short n_desc; /* used by stab entries */ 6531584Sjdp unsigned long n_value; /* address/value of the symbol */ 6631584Sjdp}; 671539Srgrimes 6831584Sjdp#define n_hash n_desc /* used internally by ld(1); XXX */ 6931584Sjdp 7031584Sjdp/* 7131584Sjdp * Defines for n_type. 7231584Sjdp */ 731539Srgrimes#define N_UNDF 0x00 /* undefined */ 741539Srgrimes#define N_ABS 0x02 /* absolute address */ 751539Srgrimes#define N_TEXT 0x04 /* text segment */ 761539Srgrimes#define N_DATA 0x06 /* data segment */ 771539Srgrimes#define N_BSS 0x08 /* bss segment */ 785207Snate#define N_INDR 0x0a /* alias definition */ 795207Snate#define N_SIZE 0x0c /* pseudo type, defines a symbol's size */ 801539Srgrimes#define N_COMM 0x12 /* common reference */ 8118589Speter/* GNU extensions */ 8218589Speter#define N_SETA 0x14 /* Absolute set element symbol */ 8318589Speter#define N_SETT 0x16 /* Text set element symbol */ 8418589Speter#define N_SETD 0x18 /* Data set element symbol */ 8518589Speter#define N_SETB 0x1a /* Bss set element symbol */ 8618589Speter#define N_SETV 0x1c /* Pointer to set vector in data area. */ 8718589Speter/* end GNU extensions */ 885207Snate#define N_FN 0x1e /* file name (N_EXT on) */ 895207Snate#define N_WARN 0x1e /* warning message (N_EXT off) */ 901539Srgrimes 911539Srgrimes#define N_EXT 0x01 /* external (global) bit, OR'ed in */ 921539Srgrimes#define N_TYPE 0x1e /* mask for all the type bits */ 9331584Sjdp#define N_STAB 0xe0 /* mask for debugger symbols -- stab(5) */ 941539Srgrimes 9531584Sjdp/* 9631584Sjdp * Defines for n_other. It contains the ".type" (AUX) field in the least 9731584Sjdp * significant 4 bits, and the binding (for weak symbols) in the most 9831584Sjdp * significant 4 bits. 9931584Sjdp */ 10031584Sjdp#define N_AUX(p) ((p)->n_other & 0xf) 10131584Sjdp#define N_BIND(p) (((unsigned int)(p)->n_other >> 4) & 0xf) 10231584Sjdp#define N_OTHER(r, v) (((unsigned int)(r) << 4) | ((v) & 0xf)) 1031539Srgrimes 10431584Sjdp#define AUX_OBJECT 1 /* data object */ 10531584Sjdp#define AUX_FUNC 2 /* function */ 10631584Sjdp 10731584Sjdp/*#define BIND_LOCAL 0 not used */ 10831584Sjdp/*#define BIND_GLOBAL 1 not used */ 10931584Sjdp#define BIND_WEAK 2 /* weak binding */ 11031584Sjdp 1111539Srgrimes#define N_FORMAT "%08x" /* namelist value format; XXX */ 1121539Srgrimes 113102285Speter#endif /* !_SYS_NLIST_AOUT_H_ */ 114