Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:02

0001 /*
0002  * Copyright © 2009 Guillem Jover <guillem@hadrons.org>
0003  *
0004  * Redistribution and use in source and binary forms, with or without
0005  * modification, are permitted provided that the following conditions
0006  * are met:
0007  * 1. Redistributions of source code must retain the above copyright
0008  *    notice, this list of conditions and the following disclaimer.
0009  * 2. Redistributions in binary form must reproduce the above copyright
0010  *    notice, this list of conditions and the following disclaimer in the
0011  *    documentation and/or other materials provided with the distribution.
0012  * 3. The name of the author may not be used to endorse or promote products
0013  *    derived from this software without specific prior written permission.
0014  *
0015  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
0016  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
0017  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
0018  * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
0019  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
0020  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
0021  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
0022  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
0023  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
0024  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0025  */
0026 
0027 #ifndef LIBBSD_NLIST_H
0028 #define LIBBSD_NLIST_H
0029 
0030 #ifdef LIBBSD_OVERLAY
0031 #include <sys/cdefs.h>
0032 #else
0033 #include <bsd/sys/cdefs.h>
0034 #endif
0035 
0036 struct nlist {
0037     union {
0038         char *n_name;
0039         union {
0040             char *n_name;
0041             struct n_list *n_next;
0042             long n_strx;
0043         } n_un;
0044     };
0045     unsigned char n_type;
0046     char n_other;
0047     short n_desc;
0048     unsigned long n_value;
0049 };
0050 
0051 #define n_hash  n_desc      /* used internally by ld(1); XXX */
0052 
0053 /*
0054  * Defines for n_type.
0055  */
0056 #define N_UNDF  0x00        /* Undefined */
0057 #define N_ABS   0x02        /* Absolute address */
0058 #define N_TEXT  0x04        /* Text segment */
0059 #define N_DATA  0x06        /* Data segment */
0060 #define N_BSS   0x08        /* Bss segment */
0061 #define N_INDR  0x0a        /* Alias definition */
0062 #define N_SIZE  0x0c        /* Pseudo type, defines a symbol's size */
0063 #define N_COMM  0x12        /* Common reference */
0064 /* GNU extensions */
0065 #define N_SETA  0x14        /* Absolute set element symbol */
0066 #define N_SETT  0x16        /* Text set element symbol */
0067 #define N_SETD  0x18        /* Data set element symbol */
0068 #define N_SETB  0x1a        /* Bss set element symbol */
0069 #define N_SETV  0x1c        /* Set vector symbol */
0070 /* end GNU extensions */
0071 #define N_FN    0x1e        /* File name (N_EXT on) */
0072 #define N_WARN  0x1e        /* Warning message (N_EXT off) */
0073 
0074 #define N_EXT   0x01        /* External (global) bit, OR'ed in */
0075 #define N_TYPE  0x1e        /* Mask for all the type bits */
0076 #define N_STAB  0xe0        /* Mask for debugger symbols -- stab(5) */
0077 
0078 #define N_NAME(p)   ((p)->n_un.n_name)
0079 
0080 /*
0081  * Defines for n_other.  It contains the ".type" (AUX) field in the least
0082  * significant 4 bits, and the binding (for weak symbols) in the most
0083  * significant 4 bits.
0084  */
0085 #define N_AUX(p)    ((p)->n_other & 0xf)
0086 #define N_BIND(p)   (((unsigned int)(p)->n_other >> 4) & 0xf)
0087 #define N_OTHER(r, v)   (((unsigned int)(r) << 4) | ((v) & 0xf))
0088 
0089 #define AUX_OBJECT  1   /* Data object */
0090 #define AUX_FUNC    2   /* Function */
0091 
0092 /*#define BIND_LOCAL    0   Not used */
0093 /*#define BIND_GLOBAL   1   Not used */
0094 #define BIND_WEAK   2   /* Weak binding */
0095 
0096 #define N_FORMAT    "%08x"  /* namelist value format; XXX */
0097 
0098 __BEGIN_DECLS
0099 extern int nlist(const char *filename, struct nlist *list);
0100 __END_DECLS
0101 
0102 #endif