From b62e86b3831919a70572235013010746e9b442fa Mon Sep 17 00:00:00 2001 From: jdp Date: Sat, 6 Dec 1997 17:59:52 +0000 Subject: Move nlist related defines from link.h into nlist.h. Clean up nlist.h. --- include/link.h | 17 +++-------------- include/nlist.h | 44 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 24 deletions(-) (limited to 'include') diff --git a/include/link.h b/include/link.h index 870e13d..5ff1f78 100644 --- a/include/link.h +++ b/include/link.h @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: link.h,v 1.15 1997/11/22 03:34:39 brian Exp $ + * $Id: link.h,v 1.16 1997/11/28 19:05:11 jdp Exp $ */ /* @@ -84,6 +84,8 @@ struct so_map { /* Shared Object Map */ struct nzlist { struct nlist nlist; u_long nz_size; +}; + #define nz_un nlist.n_un #define nz_strx nlist.n_un.n_strx #define nz_name nlist.n_un.n_name @@ -91,18 +93,6 @@ struct nzlist { #define nz_value nlist.n_value #define nz_desc nlist.n_desc #define nz_other nlist.n_other -}; - -#define N_AUX(p) ((p)->n_other & 0xf) -#define N_BIND(p) (((unsigned int)(p)->n_other >> 4) & 0xf) -#define N_OTHER(r, v) (((unsigned int)(r) << 4) | ((v) & 0xf)) - -#define AUX_OBJECT 1 -#define AUX_FUNC 2 -/*#define BIND_LOCAL 0 not used */ -/*#define BIND_GLOBAL 1 not used */ -#define BIND_WEAK 2 - /* * The `section_dispatch_table' structure contains offsets to various data @@ -290,4 +280,3 @@ struct hints_bucket { #define _PATH_LD_HINTS "/var/run/ld.so.hints" #endif /* _LINK_H_ */ - diff --git a/include/nlist.h b/include/nlist.h index b91af10..cd26daf 100644 --- a/include/nlist.h +++ b/include/nlist.h @@ -37,15 +37,20 @@ * * @(#)nlist.h 8.2 (Berkeley) 1/21/94 * - * $Id$ + * $Id: nlist.h,v 1.5 1997/02/23 09:17:14 peter Exp $ */ #ifndef _NLIST_H_ #define _NLIST_H_ /* - * Symbol table entry format. The #ifdef's are so that programs including - * nlist.h can initialize nlist structures statically. + * Symbol table entries in a.out files. + */ + +/* + * Layout of each symbol. The "#ifdef _AOUT_INCLUDE_" is so that + * programs including nlist.h can initialize nlist structures + * statically. */ struct nlist { #ifdef _AOUT_INCLUDE_ @@ -56,7 +61,17 @@ struct nlist { #else char *n_name; /* symbol name (in memory) */ #endif + unsigned char n_type; /* type defines */ + char n_other; /* ".type" and binding information */ + short n_desc; /* used by stab entries */ + unsigned long n_value; /* address/value of the symbol */ +}; +#define n_hash n_desc /* used internally by ld(1); XXX */ + +/* + * Defines for n_type. + */ #define N_UNDF 0x00 /* undefined */ #define N_ABS 0x02 /* absolute address */ #define N_TEXT 0x04 /* text segment */ @@ -77,16 +92,25 @@ struct nlist { #define N_EXT 0x01 /* external (global) bit, OR'ed in */ #define N_TYPE 0x1e /* mask for all the type bits */ - unsigned char n_type; /* type defines */ +#define N_STAB 0xe0 /* mask for debugger symbols -- stab(5) */ - char n_other; /* spare */ -#define n_hash n_desc /* used internally by ld(1); XXX */ - short n_desc; /* used by stab entries */ - unsigned long n_value; /* address/value of the symbol */ -}; +/* + * Defines for n_other. It contains the ".type" (AUX) field in the least + * significant 4 bits, and the binding (for weak symbols) in the most + * significant 4 bits. + */ +#define N_AUX(p) ((p)->n_other & 0xf) +#define N_BIND(p) (((unsigned int)(p)->n_other >> 4) & 0xf) +#define N_OTHER(r, v) (((unsigned int)(r) << 4) | ((v) & 0xf)) + +#define AUX_OBJECT 1 /* data object */ +#define AUX_FUNC 2 /* function */ + +/*#define BIND_LOCAL 0 not used */ +/*#define BIND_GLOBAL 1 not used */ +#define BIND_WEAK 2 /* weak binding */ #define N_FORMAT "%08x" /* namelist value format; XXX */ -#define N_STAB 0x0e0 /* mask for debugger symbols -- stab(5) */ #include -- cgit v1.1