1#ifndef __A_OUT_GNU_H__
2#define __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
11
12#ifndef __ASSEMBLY__
13
14
15enum 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
37 M_386 = 100,
38 M_MIPS1 = 151,
39 M_MIPS2 = 152
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
63#define OMAGIC 0407
64
65#define NMAGIC 0410
66
67#define ZMAGIC 0413
68
69
70#define QMAGIC 0314
71
72
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
111#if !defined (N_TXTADDR)
112#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
113#endif
114
115
116
117
118#if defined(vax) || defined(hp300) || defined(pyr)
119#define SEGMENT_SIZE page_size
120#endif
121#ifdef sony
122#define SEGMENT_SIZE 0x2000
123#endif
124#ifdef is68k
125#define SEGMENT_SIZE 0x20000
126#endif
127#if defined(m68k) && defined(PORTAR)
128#define PAGE_SIZE 0x400
129#define SEGMENT_SIZE PAGE_SIZE
130#endif
131
132#ifdef linux
133#ifdef __KERNEL__
134#include <asm/page.h>
135#else
136#include <unistd.h>
137#endif
138#if defined(__i386__) || defined(__mc68000__)
139#define SEGMENT_SIZE 1024
140#else
141#ifndef SEGMENT_SIZE
142#ifdef __KERNEL__
143#define SEGMENT_SIZE PAGE_SIZE
144#else
145#define SEGMENT_SIZE getpagesize()
146#endif
147#endif
148#endif
149#endif
150
151#define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
152
153#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
154
155#ifndef N_DATADDR
156#define N_DATADDR(x) \
157 (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
158 : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
159#endif
160
161
162#if !defined (N_BSSADDR)
163#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
164#endif
165
166#if !defined (N_NLIST_DECLARED)
167struct nlist {
168 union {
169 char *n_name;
170 struct nlist *n_next;
171 long n_strx;
172 } n_un;
173 unsigned char n_type;
174 char n_other;
175 short n_desc;
176 unsigned long n_value;
177};
178#endif
179
180#if !defined (N_UNDF)
181#define N_UNDF 0
182#endif
183#if !defined (N_ABS)
184#define N_ABS 2
185#endif
186#if !defined (N_TEXT)
187#define N_TEXT 4
188#endif
189#if !defined (N_DATA)
190#define N_DATA 6
191#endif
192#if !defined (N_BSS)
193#define N_BSS 8
194#endif
195#if !defined (N_FN)
196#define N_FN 15
197#endif
198
199#if !defined (N_EXT)
200#define N_EXT 1
201#endif
202#if !defined (N_TYPE)
203#define N_TYPE 036
204#endif
205#if !defined (N_STAB)
206#define N_STAB 0340
207#endif
208
209
210
211
212
213
214
215
216
217#define N_INDR 0xa
218
219
220
221
222
223
224
225
226
227
228
229
230
231#define N_SETA 0x14
232#define N_SETT 0x16
233#define N_SETD 0x18
234#define N_SETB 0x1A
235
236
237#define N_SETV 0x1C
238
239#if !defined (N_RELOCATION_INFO_DECLARED)
240
241
242
243
244
245struct relocation_info
246{
247
248 int r_address;
249
250 unsigned int r_symbolnum:24;
251
252
253
254 unsigned int r_pcrel:1;
255
256
257 unsigned int r_length:2;
258
259
260
261
262
263
264 unsigned int r_extern:1;
265
266
267#ifdef NS32K
268 unsigned r_bsr:1;
269 unsigned r_disp:1;
270 unsigned r_pad:2;
271#else
272 unsigned int r_pad:4;
273#endif
274};
275#endif
276
277#endif
278#endif
279