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
13enum machine_type {
14#if defined (M_OLDSUN2)
15 M__OLDSUN2 = M_OLDSUN2,
16#else
17 M_OLDSUN2 = 0,
18#endif
19#if defined (M_68010)
20 M__68010 = M_68010,
21#else
22 M_68010 = 1,
23#endif
24#if defined (M_68020)
25 M__68020 = M_68020,
26#else
27 M_68020 = 2,
28#endif
29#if defined (M_SPARC)
30 M__SPARC = M_SPARC,
31#else
32 M_SPARC = 3,
33#endif
34
35 M_386 = 100,
36 M_MIPS1 = 151,
37 M_MIPS2 = 152
38};
39
40#if !defined (N_MAGIC)
41#define N_MAGIC(exec) ((exec).a_info & 0xffff)
42#endif
43#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
44#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
45#define N_SET_INFO(exec, magic, type, flags) \
46 ((exec).a_info = ((magic) & 0xffff) \
47 | (((int)(type) & 0xff) << 16) \
48 | (((flags) & 0xff) << 24))
49#define N_SET_MAGIC(exec, magic) \
50 ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
51
52#define N_SET_MACHTYPE(exec, machtype) \
53 ((exec).a_info = \
54 ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
55
56#define N_SET_FLAGS(exec, flags) \
57 ((exec).a_info = \
58 ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
59
60
61#define OMAGIC 0407
62
63#define NMAGIC 0410
64
65#define ZMAGIC 0413
66
67
68#define QMAGIC 0314
69
70
71#define CMAGIC 0421
72
73#if !defined (N_BADMAG)
74#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
75 && N_MAGIC(x) != NMAGIC \
76 && N_MAGIC(x) != ZMAGIC \
77 && N_MAGIC(x) != QMAGIC)
78#endif
79
80#define _N_HDROFF(x) (1024 - sizeof (struct exec))
81
82#if !defined (N_TXTOFF)
83#define N_TXTOFF(x) \
84 (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
85 (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
86#endif
87
88#if !defined (N_DATOFF)
89#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
90#endif
91
92#if !defined (N_TRELOFF)
93#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
94#endif
95
96#if !defined (N_DRELOFF)
97#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
98#endif
99
100#if !defined (N_SYMOFF)
101#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
102#endif
103
104#if !defined (N_STROFF)
105#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
106#endif
107
108
109#if !defined (N_TXTADDR)
110#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
111#endif
112
113
114
115
116#if defined(vax) || defined(hp300) || defined(pyr)
117#define SEGMENT_SIZE page_size
118#endif
119#ifdef sony
120#define SEGMENT_SIZE 0x2000
121#endif
122#ifdef is68k
123#define SEGMENT_SIZE 0x20000
124#endif
125#if defined(m68k) && defined(PORTAR)
126#define PAGE_SIZE 0x400
127#define SEGMENT_SIZE PAGE_SIZE
128#endif
129
130#ifdef linux
131#include <asm/page.h>
132#if defined(__i386__) || defined(__mc68000__)
133#define SEGMENT_SIZE 1024
134#else
135#ifndef SEGMENT_SIZE
136#define SEGMENT_SIZE PAGE_SIZE
137#endif
138#endif
139#endif
140
141#define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
142
143#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
144
145#ifndef N_DATADDR
146#define N_DATADDR(x) \
147 (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
148 : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
149#endif
150
151
152#if !defined (N_BSSADDR)
153#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
154#endif
155
156#if !defined (N_NLIST_DECLARED)
157struct nlist {
158 union {
159 char *n_name;
160 struct nlist *n_next;
161 long n_strx;
162 } n_un;
163 unsigned char n_type;
164 char n_other;
165 short n_desc;
166 unsigned long n_value;
167};
168#endif
169
170#if !defined (N_UNDF)
171#define N_UNDF 0
172#endif
173#if !defined (N_ABS)
174#define N_ABS 2
175#endif
176#if !defined (N_TEXT)
177#define N_TEXT 4
178#endif
179#if !defined (N_DATA)
180#define N_DATA 6
181#endif
182#if !defined (N_BSS)
183#define N_BSS 8
184#endif
185#if !defined (N_FN)
186#define N_FN 15
187#endif
188
189#if !defined (N_EXT)
190#define N_EXT 1
191#endif
192#if !defined (N_TYPE)
193#define N_TYPE 036
194#endif
195#if !defined (N_STAB)
196#define N_STAB 0340
197#endif
198
199
200
201
202
203
204
205
206
207#define N_INDR 0xa
208
209
210
211
212
213
214
215
216
217
218
219
220
221#define N_SETA 0x14
222#define N_SETT 0x16
223#define N_SETD 0x18
224#define N_SETB 0x1A
225
226
227#define N_SETV 0x1C
228
229#if !defined (N_RELOCATION_INFO_DECLARED)
230
231
232
233
234
235struct relocation_info
236{
237
238 int r_address;
239
240 unsigned int r_symbolnum:24;
241
242
243
244 unsigned int r_pcrel:1;
245
246
247 unsigned int r_length:2;
248
249
250
251
252
253
254 unsigned int r_extern:1;
255
256
257#ifdef NS32K
258 unsigned r_bsr:1;
259 unsigned r_disp:1;
260 unsigned r_pad:2;
261#else
262 unsigned int r_pad:4;
263#endif
264};
265#endif
266
267
268#endif
269