a.out.h
001: #ifndef __A_OUT_GNU_H__
002: #define __A_OUT_GNU_H__
003:
004: #define __GNU_EXEC_MACROS__
005:
006: #ifndef __STRUCT_EXEC_OVERRIDE__
007:
008: #include <asm/a.out.h>
009:
010: #endif
011:
012: #ifndef __ASSEMBLY__
013:
014:
015: enum machine_type {
016: #if defined (M_OLDSUN2)
017: M__OLDSUN2 = M_OLDSUN2,
018: #else
019: M_OLDSUN2 = 0,
020: #endif
021: #if defined (M_68010)
022: M__68010 = M_68010,
023: #else
024: M_68010 = 1,
025: #endif
026: #if defined (M_68020)
027: M__68020 = M_68020,
028: #else
029: M_68020 = 2,
030: #endif
031: #if defined (M_SPARC)
032: M__SPARC = M_SPARC,
033: #else
034: M_SPARC = 3,
035: #endif
036:
037: M_386 = 100,
038: M_MIPS1 = 151,
039: M_MIPS2 = 152
040: };
041:
042: #if !defined (N_MAGIC)
043: #define N_MAGIC(exec) ((exec).a_info & 0xffff)
044: #endif
045: #define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
046: #define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
047: #define N_SET_INFO(exec, magic, type, flags) \
048: ((exec).a_info = ((magic) & 0xffff) \
049: | (((int)(type) & 0xff) << 16) \
050: | (((flags) & 0xff) << 24))
051: #define N_SET_MAGIC(exec, magic) \
052: ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
053:
054: #define N_SET_MACHTYPE(exec, machtype) \
055: ((exec).a_info = \
056: ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
057:
058: #define N_SET_FLAGS(exec, flags) \
059: ((exec).a_info = \
060: ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
061:
062:
063: #define OMAGIC 0407
064:
065: #define NMAGIC 0410
066:
067: #define ZMAGIC 0413
068:
069:
070: #define QMAGIC 0314
071:
072:
073: #define CMAGIC 0421
074:
075: #if !defined (N_BADMAG)
076: #define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
077: && N_MAGIC(x) != NMAGIC \
078: && N_MAGIC(x) != ZMAGIC \
079: && N_MAGIC(x) != QMAGIC)
080: #endif
081:
082: #define _N_HDROFF(x) (1024 - sizeof (struct exec))
083:
084: #if !defined (N_TXTOFF)
085: #define N_TXTOFF(x) \
086: (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
087: (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
088: #endif
089:
090: #if !defined (N_DATOFF)
091: #define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
092: #endif
093:
094: #if !defined (N_TRELOFF)
095: #define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
096: #endif
097:
098: #if !defined (N_DRELOFF)
099: #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: #include <unistd.h>
134: #if defined(__i386__) || defined(__mc68000__)
135: #define SEGMENT_SIZE 1024
136: #else
137: #ifndef SEGMENT_SIZE
138: #define SEGMENT_SIZE getpagesize()
139: #endif
140: #endif
141: #endif
142:
143: #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
144:
145: #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
146:
147: #ifndef N_DATADDR
148: #define N_DATADDR(x) \
149: (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
150: : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
151: #endif
152:
153:
154: #if !defined (N_BSSADDR)
155: #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
156: #endif
157:
158: #if !defined (N_NLIST_DECLARED)
159: struct nlist {
160: union {
161: char *n_name;
162: struct nlist *n_next;
163: long n_strx;
164: } n_un;
165: unsigned char n_type;
166: char n_other;
167: short n_desc;
168: unsigned long n_value;
169: };
170: #endif
171:
172: #if !defined (N_UNDF)
173: #define N_UNDF 0
174: #endif
175: #if !defined (N_ABS)
176: #define N_ABS 2
177: #endif
178: #if !defined (N_TEXT)
179: #define N_TEXT 4
180: #endif
181: #if !defined (N_DATA)
182: #define N_DATA 6
183: #endif
184: #if !defined (N_BSS)
185: #define N_BSS 8
186: #endif
187: #if !defined (N_FN)
188: #define N_FN 15
189: #endif
190:
191: #if !defined (N_EXT)
192: #define N_EXT 1
193: #endif
194: #if !defined (N_TYPE)
195: #define N_TYPE 036
196: #endif
197: #if !defined (N_STAB)
198: #define N_STAB 0340
199: #endif
200:
201:
202:
203:
204:
205:
206:
207:
208:
209: #define N_INDR 0xa
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223: #define N_SETA 0x14
224: #define N_SETT 0x16
225: #define N_SETD 0x18
226: #define N_SETB 0x1A
227:
228:
229: #define N_SETV 0x1C
230:
231: #if !defined (N_RELOCATION_INFO_DECLARED)
232:
233:
234:
235:
236:
237: struct relocation_info
238: {
239:
240: int r_address;
241:
242: unsigned int r_symbolnum:24;
243:
244:
245:
246: unsigned int r_pcrel:1;
247:
248:
249: unsigned int r_length:2;
250:
251:
252:
253:
254:
255:
256: unsigned int r_extern:1;
257:
258:
259: #ifdef NS32K
260: unsigned r_bsr:1;
261: unsigned r_disp:1;
262: unsigned r_pad:2;
263: #else
264: unsigned int r_pad:4;
265: #endif
266: };
267: #endif
268:
269: #endif
270: #endif
271:
© Andrew Scott 2006 -
2025,
All Rights Reserved