1 /* a.out.h - Definitions and declarations for GNU-style a.out
2    binaries.
3    Written by Guido Flohr (gufl0000@stud.uni-sb.de).
4 
5    This file is in the public domain. */
6 
7 #ifndef __A_OUT_GNU_H__
8 #define __A_OUT_GNU_H__ 1
9 
10 struct nlist {
11   union {
12     const char *n_name;     /* in memory address */
13     struct nlist *n_next;
14     size_t n_strx;          /* string table offset */
15   } n_un;
16   unsigned char n_type;
17   char n_other;
18   short n_desc;
19   uint32_t n_value;
20 };
21 
22 /* sizeof(struct nlist) on disk */
23 #define SIZEOF_STRUCT_NLIST 12
24 
25 
26 #define N_UNDF   0x00       /* undefined */
27 #define N_ABS    0x02       /* absolute */
28 #define N_TEXT   0x04       /* text */
29 #define N_DATA   0x06       /* data */
30 #define N_BSS    0x08       /* bss */
31 #define N_SIZE   0x0c       /* pseudo type, defines a symbol's size */
32 #define N_FN     0x1f       /* File name of a .o file */
33 #define N_COMM   0x12       /* common (internal to ld) */
34 
35 #define N_EXT    0x01       /* external bit, or'ed in */
36 #define N_TYPE   0x1e       /* mask for all the type bits */
37 #define N_STAB   0xe0       /* if any of these bits set, don't discard */
38 
39 /* The following type indicates the definition of a symbol as being
40    an indirect reference to another symbol.  The other symbol
41    appears as an undefined reference, immediately following this symbol.
42 
43    Indirection is asymmetrical.  The other symbol's value will be used
44    to satisfy requests for the indirect symbol, but not vice versa.
45    If the other symbol does not have a definition, libraries will
46    be searched to find a definition. */
47 #define N_INDR 0x0a
48 
49 /* The following symbols refer to set elements.
50    All the N_SET[ATDB] symbols with the same name form one set.
51    Space is allocated for the set in the text section, and each set
52    element's value is stored into one word of the space.
53    The first word of the space is the length of the set (number of elements).
54 
55    The address of the set is made into an N_SETV symbol
56    whose name is the same as the name of the set.
57    This symbol acts like a N_DATA global symbol
58    in that it can satisfy undefined external references. */
59 
60 /* These appear as input to LD, in a .o file. */
61 #define N_SETA  0x14        /* Absolute set element symbol */
62 #define N_SETT  0x16        /* Text set element symbol */
63 #define N_SETD  0x18        /* Data set element symbol */
64 #define N_SETB  0x1A        /* Bss set element symbol */
65 
66 /* This is output from LD. */
67 #define N_SETV  0x1C        /* Pointer to set vector in data area. */
68 
69 /* Warning symbol. The text gives a warning message, the next symbol
70    in the table will be undefined. When the symbol is referenced, the
71    message is printed. */
72 
73 #define N_WARNING 0x1e
74 
75 /* Weak symbols.  These are a GNU extension to the a.out format.  The
76    semantics are those of ELF weak symbols.  Weak symbols are always
77    externally visible.  The N_WEAK? values are squeezed into the
78    available slots.  The value of a N_WEAKU symbol is 0.  The values
79    of the other types are the definitions. */
80 #define N_WEAKU 0x0d        /* Weak undefined symbol. */
81 #define N_WEAKA 0x0e        /* Weak absolute symbol. */
82 #define N_WEAKT 0x0f        /* Weak text symbol. */
83 #define N_WEAKD 0x10        /* Weak data symbol. */
84 #define N_WEAKB 0x11        /* Weak bss symbol. */
85 
86 #endif /* __A_OUT_GNU_H__ */
87