Merge remote-tracking branch 'asoc/fix/rcar' into asoc-linus
[sfrench/cifs-2.6.git] / include / uapi / linux / a.out.h
1 #ifndef _UAPI__A_OUT_GNU_H__
2 #define _UAPI__A_OUT_GNU_H__
3
4 #define __GNU_EXEC_MACROS__
5
6 #ifndef __STRUCT_EXEC_OVERRIDE__
7
8 #include <asm/a.out.h>
9
10 #endif /* __STRUCT_EXEC_OVERRIDE__ */
11
12 #ifndef __ASSEMBLY__
13
14 /* these go in the N_MACHTYPE field */
15 enum machine_type {
16 #if defined (M_OLDSUN2)
17   M__OLDSUN2 = M_OLDSUN2,
18 #else
19   M_OLDSUN2 = 0,
20 #endif
21 #if defined (M_68010)
22   M__68010 = M_68010,
23 #else
24   M_68010 = 1,
25 #endif
26 #if defined (M_68020)
27   M__68020 = M_68020,
28 #else
29   M_68020 = 2,
30 #endif
31 #if defined (M_SPARC)
32   M__SPARC = M_SPARC,
33 #else
34   M_SPARC = 3,
35 #endif
36   /* skip a bunch so we don't run into any of sun's numbers */
37   M_386 = 100,
38   M_MIPS1 = 151,        /* MIPS R3000/R3000 binary */
39   M_MIPS2 = 152         /* MIPS R6000/R4000 binary */
40 };
41
42 #if !defined (N_MAGIC)
43 #define N_MAGIC(exec) ((exec).a_info & 0xffff)
44 #endif
45 #define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
46 #define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
47 #define N_SET_INFO(exec, magic, type, flags) \
48         ((exec).a_info = ((magic) & 0xffff) \
49          | (((int)(type) & 0xff) << 16) \
50          | (((flags) & 0xff) << 24))
51 #define N_SET_MAGIC(exec, magic) \
52         ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
53
54 #define N_SET_MACHTYPE(exec, machtype) \
55         ((exec).a_info = \
56          ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
57
58 #define N_SET_FLAGS(exec, flags) \
59         ((exec).a_info = \
60          ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
61
62 /* Code indicating object file or impure executable.  */
63 #define OMAGIC 0407
64 /* Code indicating pure executable.  */
65 #define NMAGIC 0410
66 /* Code indicating demand-paged executable.  */
67 #define ZMAGIC 0413
68 /* This indicates a demand-paged executable with the header in the text. 
69    The first page is unmapped to help trap NULL pointer references */
70 #define QMAGIC 0314
71
72 /* Code indicating core file.  */
73 #define CMAGIC 0421
74
75 #if !defined (N_BADMAG)
76 #define N_BADMAG(x)       (N_MAGIC(x) != OMAGIC         \
77                         && N_MAGIC(x) != NMAGIC         \
78                         && N_MAGIC(x) != ZMAGIC \
79                         && N_MAGIC(x) != QMAGIC)
80 #endif
81
82 #define _N_HDROFF(x) (1024 - sizeof (struct exec))
83
84 #if !defined (N_TXTOFF)
85 #define N_TXTOFF(x) \
86  (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
87   (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
88 #endif
89
90 #if !defined (N_DATOFF)
91 #define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
92 #endif
93
94 #if !defined (N_TRELOFF)
95 #define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
96 #endif
97
98 #if !defined (N_DRELOFF)
99 #define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
100 #endif
101
102 #if !defined (N_SYMOFF)
103 #define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
104 #endif
105
106 #if !defined (N_STROFF)
107 #define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
108 #endif
109
110 /* Address of text segment in memory after it is loaded.  */
111 #if !defined (N_TXTADDR)
112 #define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
113 #endif
114
115 /* Address of data segment in memory after it is loaded. */
116 #ifndef __KERNEL__
117 #include <unistd.h>
118 #endif
119 #if defined(__i386__) || defined(__mc68000__)
120 #define SEGMENT_SIZE    1024
121 #else
122 #ifndef SEGMENT_SIZE
123 #ifndef __KERNEL__
124 #define SEGMENT_SIZE   getpagesize()
125 #endif
126 #endif
127 #endif
128
129 #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
130
131 #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
132
133 #ifndef N_DATADDR
134 #define N_DATADDR(x) \
135     (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
136      : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
137 #endif
138
139 /* Address of bss segment in memory after it is loaded.  */
140 #if !defined (N_BSSADDR)
141 #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
142 #endif
143 \f
144 #if !defined (N_NLIST_DECLARED)
145 struct nlist {
146   union {
147     char *n_name;
148     struct nlist *n_next;
149     long n_strx;
150   } n_un;
151   unsigned char n_type;
152   char n_other;
153   short n_desc;
154   unsigned long n_value;
155 };
156 #endif /* no N_NLIST_DECLARED.  */
157
158 #if !defined (N_UNDF)
159 #define N_UNDF 0
160 #endif
161 #if !defined (N_ABS)
162 #define N_ABS 2
163 #endif
164 #if !defined (N_TEXT)
165 #define N_TEXT 4
166 #endif
167 #if !defined (N_DATA)
168 #define N_DATA 6
169 #endif
170 #if !defined (N_BSS)
171 #define N_BSS 8
172 #endif
173 #if !defined (N_FN)
174 #define N_FN 15
175 #endif
176
177 #if !defined (N_EXT)
178 #define N_EXT 1
179 #endif
180 #if !defined (N_TYPE)
181 #define N_TYPE 036
182 #endif
183 #if !defined (N_STAB)
184 #define N_STAB 0340
185 #endif
186
187 /* The following type indicates the definition of a symbol as being
188    an indirect reference to another symbol.  The other symbol
189    appears as an undefined reference, immediately following this symbol.
190
191    Indirection is asymmetrical.  The other symbol's value will be used
192    to satisfy requests for the indirect symbol, but not vice versa.
193    If the other symbol does not have a definition, libraries will
194    be searched to find a definition.  */
195 #define N_INDR 0xa
196
197 /* The following symbols refer to set elements.
198    All the N_SET[ATDB] symbols with the same name form one set.
199    Space is allocated for the set in the text section, and each set
200    element's value is stored into one word of the space.
201    The first word of the space is the length of the set (number of elements).
202
203    The address of the set is made into an N_SETV symbol
204    whose name is the same as the name of the set.
205    This symbol acts like a N_DATA global symbol
206    in that it can satisfy undefined external references.  */
207
208 /* These appear as input to LD, in a .o file.  */
209 #define N_SETA  0x14            /* Absolute set element symbol */
210 #define N_SETT  0x16            /* Text set element symbol */
211 #define N_SETD  0x18            /* Data set element symbol */
212 #define N_SETB  0x1A            /* Bss set element symbol */
213
214 /* This is output from LD.  */
215 #define N_SETV  0x1C            /* Pointer to set vector in data area.  */
216 \f
217 #if !defined (N_RELOCATION_INFO_DECLARED)
218 /* This structure describes a single relocation to be performed.
219    The text-relocation section of the file is a vector of these structures,
220    all of which apply to the text section.
221    Likewise, the data-relocation section applies to the data section.  */
222
223 struct relocation_info
224 {
225   /* Address (within segment) to be relocated.  */
226   int r_address;
227   /* The meaning of r_symbolnum depends on r_extern.  */
228   unsigned int r_symbolnum:24;
229   /* Nonzero means value is a pc-relative offset
230      and it should be relocated for changes in its own address
231      as well as for changes in the symbol or section specified.  */
232   unsigned int r_pcrel:1;
233   /* Length (as exponent of 2) of the field to be relocated.
234      Thus, a value of 2 indicates 1<<2 bytes.  */
235   unsigned int r_length:2;
236   /* 1 => relocate with value of symbol.
237           r_symbolnum is the index of the symbol
238           in file's the symbol table.
239      0 => relocate with the address of a segment.
240           r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
241           (the N_EXT bit may be set also, but signifies nothing).  */
242   unsigned int r_extern:1;
243   /* Four bits that aren't used, but when writing an object file
244      it is desirable to clear them.  */
245   unsigned int r_pad:4;
246 };
247 #endif /* no N_RELOCATION_INFO_DECLARED.  */
248
249 #endif /*__ASSEMBLY__ */
250 #endif /* _UAPI__A_OUT_GNU_H__ */