Commit | Line | Data |
---|---|---|
70ef870f JK |
1 | /* `a.out' object-file definitions, including extensions to 64-bit fields */ |
2 | ||
3 | #ifndef __A_OUT_64_H__ | |
4 | #define __A_OUT_64_H__ | |
5 | ||
6 | /* This is the layout on disk of the 32-bit or 64-bit exec header. */ | |
7 | ||
8 | #ifndef external_exec | |
9 | struct external_exec | |
10 | { | |
11 | bfd_byte e_info[4]; /* magic number and stuff */ | |
12 | bfd_byte e_text[BYTES_IN_WORD]; /* length of text section in bytes */ | |
13 | bfd_byte e_data[BYTES_IN_WORD]; /* length of data section in bytes */ | |
14 | bfd_byte e_bss[BYTES_IN_WORD]; /* length of bss area in bytes */ | |
15 | bfd_byte e_syms[BYTES_IN_WORD]; /* length of symbol table in bytes */ | |
16 | bfd_byte e_entry[BYTES_IN_WORD]; /* start address */ | |
17 | bfd_byte e_trsize[BYTES_IN_WORD]; /* length of text relocation info */ | |
18 | bfd_byte e_drsize[BYTES_IN_WORD]; /* length of data relocation info */ | |
19 | }; | |
20 | ||
21 | #define EXEC_BYTES_SIZE (4 + BYTES_IN_WORD * 7) | |
22 | ||
23 | /* Magic numbers for a.out files */ | |
24 | ||
25 | #if ARCH_SIZE==64 | |
26 | #define OMAGIC 0x1001 /* Code indicating object file */ | |
27 | #define ZMAGIC 0x1002 /* Code indicating demand-paged executable. */ | |
28 | #define NMAGIC 0x1003 /* Code indicating pure executable. */ | |
29 | ||
30 | /* There is no 64-bit QMAGIC as far as I know. */ | |
31 | ||
32 | #define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \ | |
33 | && N_MAGIC(x) != NMAGIC \ | |
34 | && N_MAGIC(x) != ZMAGIC) | |
35 | #else | |
36 | #define OMAGIC 0407 /* ...object file or impure executable. */ | |
37 | #define NMAGIC 0410 /* Code indicating pure executable. */ | |
38 | #define ZMAGIC 0413 /* Code indicating demand-paged executable. */ | |
8150d765 | 39 | #define BMAGIC 0415 /* Used by a b.out object. */ |
70ef870f JK |
40 | |
41 | /* This indicates a demand-paged executable with the header in the text. | |
0242cd56 | 42 | It is used by 386BSD (and variants) and Linux, at least. */ |
70ef870f | 43 | #define QMAGIC 0314 |
2cae2362 DM |
44 | # ifndef N_BADMAG |
45 | # define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \ | |
70ef870f JK |
46 | && N_MAGIC(x) != NMAGIC \ |
47 | && N_MAGIC(x) != ZMAGIC \ | |
48 | && N_MAGIC(x) != QMAGIC) | |
2cae2362 | 49 | # endif /* N_BADMAG */ |
70ef870f JK |
50 | #endif |
51 | ||
52 | #endif | |
53 | ||
3b7f6de0 JK |
54 | #ifdef QMAGIC |
55 | #define N_IS_QMAGIC(x) (N_MAGIC (x) == QMAGIC) | |
56 | #else | |
57 | #define N_IS_QMAGIC(x) (0) | |
58 | #endif | |
59 | ||
70ef870f | 60 | /* The difference between PAGE_SIZE and N_SEGSIZE is that PAGE_SIZE is |
2cae2362 | 61 | the finest granularity at which you can page something, thus it |
70ef870f JK |
62 | controls the padding (if any) before the text segment of a ZMAGIC |
63 | file. N_SEGSIZE is the resolution at which things can be marked as | |
64 | read-only versus read/write, so it controls the padding between the | |
2cae2362 DM |
65 | text segment and the data segment (in memory; on disk the padding |
66 | between them is PAGE_SIZE). PAGE_SIZE and N_SEGSIZE are the same | |
67 | for most machines, but different for sun3. */ | |
70ef870f JK |
68 | |
69 | /* By default, segment size is constant. But some machines override this | |
70 | to be a function of the a.out header (e.g. machine type). */ | |
71 | ||
72 | #ifndef N_SEGSIZE | |
73 | #define N_SEGSIZE(x) SEGMENT_SIZE | |
74 | #endif | |
75 | \f | |
76 | /* Virtual memory address of the text section. | |
77 | This is getting very complicated. A good reason to discard a.out format | |
78 | for something that specifies these fields explicitly. But til then... | |
79 | ||
80 | * OMAGIC and NMAGIC files: | |
81 | (object files: text for "relocatable addr 0" right after the header) | |
82 | start at 0, offset is EXEC_BYTES_SIZE, size as stated. | |
83 | * The text address, offset, and size of ZMAGIC files depend | |
84 | on the entry point of the file: | |
85 | * entry point below TEXT_START_ADDR: | |
86 | (hack for SunOS shared libraries) | |
87 | start at 0, offset is 0, size as stated. | |
88 | * If N_HEADER_IN_TEXT(x) is true (which defaults to being the | |
89 | case when the entry point is EXEC_BYTES_SIZE or further into a page): | |
90 | no padding is needed; text can start after exec header. Sun | |
91 | considers the text segment of such files to include the exec header; | |
92 | for BFD's purposes, we don't, which makes more work for us. | |
93 | start at TEXT_START_ADDR + EXEC_BYTES_SIZE, offset is EXEC_BYTES_SIZE, | |
94 | size as stated minus EXEC_BYTES_SIZE. | |
95 | * If N_HEADER_IN_TEXT(x) is false (which defaults to being the case when | |
96 | the entry point is less than EXEC_BYTES_SIZE into a page (e.g. page | |
97 | aligned)): (padding is needed so that text can start at a page boundary) | |
98 | start at TEXT_START_ADDR, offset PAGE_SIZE, size as stated. | |
99 | ||
100 | Specific configurations may want to hardwire N_HEADER_IN_TEXT, | |
101 | for efficiency or to allow people to play games with the entry point. | |
102 | In that case, you would #define N_HEADER_IN_TEXT(x) as 1 for sunos, | |
103 | and as 0 for most other hosts (Sony News, Vax Ultrix, etc). | |
104 | (Do this in the appropriate bfd target file.) | |
105 | (The default is a heuristic that will break if people try changing | |
106 | the entry point, perhaps with the ld -e flag.) | |
107 | ||
108 | * QMAGIC is always like a ZMAGIC for which N_HEADER_IN_TEXT is true, | |
109 | and for which the starting address is PAGE_SIZE (or should this be | |
110 | SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC). | |
111 | */ | |
112 | ||
113 | /* This macro is only relevant for ZMAGIC files; QMAGIC always has the header | |
114 | in the text. */ | |
115 | #ifndef N_HEADER_IN_TEXT | |
116 | #define N_HEADER_IN_TEXT(x) (((x).a_entry & (PAGE_SIZE-1)) >= EXEC_BYTES_SIZE) | |
117 | #endif | |
118 | ||
119 | /* Sun shared libraries, not linux. This macro is only relevant for ZMAGIC | |
120 | files. */ | |
121 | #ifndef N_SHARED_LIB | |
122 | #define N_SHARED_LIB(x) ((x).a_entry < TEXT_START_ADDR) | |
123 | #endif | |
124 | ||
0242cd56 ILT |
125 | /* Returning 0 not TEXT_START_ADDR for OMAGIC and NMAGIC is based on |
126 | the assumption that we are dealing with a .o file, not an | |
127 | executable. This is necessary for OMAGIC (but means we don't work | |
128 | right on the output from ld -N); more questionable for NMAGIC. */ | |
129 | ||
70ef870f JK |
130 | #ifndef N_TXTADDR |
131 | #define N_TXTADDR(x) \ | |
3b7f6de0 | 132 | (/* The address of a QMAGIC file is always one page in, */ \ |
70ef870f | 133 | /* with the header in the text. */ \ |
3b7f6de0 | 134 | N_IS_QMAGIC (x) ? PAGE_SIZE + EXEC_BYTES_SIZE : \ |
70ef870f JK |
135 | N_MAGIC(x) != ZMAGIC ? 0 : /* object file or NMAGIC */\ |
136 | N_SHARED_LIB(x) ? 0 : \ | |
137 | N_HEADER_IN_TEXT(x) ? \ | |
138 | TEXT_START_ADDR + EXEC_BYTES_SIZE : /* no padding */\ | |
139 | TEXT_START_ADDR /* a page of padding */\ | |
140 | ) | |
141 | #endif | |
142 | ||
0242cd56 ILT |
143 | /* If N_HEADER_IN_TEXT is not true for ZMAGIC, there is some padding |
144 | to make the text segment start at a certain boundary. For most | |
145 | systems, this boundary is PAGE_SIZE. But for Linux, in the | |
146 | time-honored tradition of crazy ZMAGIC hacks, it is 1024 which is | |
147 | not what PAGE_SIZE needs to be for QMAGIC. */ | |
148 | ||
149 | #ifndef ZMAGIC_DISK_BLOCK_SIZE | |
150 | #define ZMAGIC_DISK_BLOCK_SIZE PAGE_SIZE | |
151 | #endif | |
152 | ||
153 | #define N_DISK_BLOCK_SIZE(x) \ | |
154 | (N_MAGIC(x) == ZMAGIC ? ZMAGIC_DISK_BLOCK_SIZE : PAGE_SIZE) | |
155 | ||
70ef870f JK |
156 | /* Offset in an a.out of the start of the text section. */ |
157 | #ifndef N_TXTOFF | |
158 | #define N_TXTOFF(x) \ | |
159 | (/* For {O,N,Q}MAGIC, no padding. */ \ | |
160 | N_MAGIC(x) != ZMAGIC ? EXEC_BYTES_SIZE : \ | |
161 | N_SHARED_LIB(x) ? 0 : \ | |
162 | N_HEADER_IN_TEXT(x) ? \ | |
163 | EXEC_BYTES_SIZE : /* no padding */\ | |
0242cd56 | 164 | ZMAGIC_DISK_BLOCK_SIZE /* a page of padding */\ |
70ef870f JK |
165 | ) |
166 | #endif | |
167 | /* Size of the text section. It's always as stated, except that we | |
168 | offset it to `undo' the adjustment to N_TXTADDR and N_TXTOFF | |
169 | for ZMAGIC files that nominally include the exec header | |
170 | as part of the first page of text. (BFD doesn't consider the | |
171 | exec header to be part of the text segment.) */ | |
172 | #ifndef N_TXTSIZE | |
173 | #define N_TXTSIZE(x) \ | |
174 | (/* For QMAGIC, we don't consider the header part of the text section. */\ | |
3b7f6de0 | 175 | N_IS_QMAGIC (x) ? (x).a_text - EXEC_BYTES_SIZE : \ |
70ef870f JK |
176 | (N_MAGIC(x) != ZMAGIC || N_SHARED_LIB(x)) ? (x).a_text : \ |
177 | N_HEADER_IN_TEXT(x) ? \ | |
178 | (x).a_text - EXEC_BYTES_SIZE: /* no padding */\ | |
179 | (x).a_text /* a page of padding */\ | |
180 | ) | |
181 | #endif | |
182 | /* The address of the data segment in virtual memory. | |
183 | It is the text segment address, plus text segment size, rounded | |
184 | up to a N_SEGSIZE boundary for pure or pageable files. */ | |
185 | #ifndef N_DATADDR | |
186 | #define N_DATADDR(x) \ | |
187 | (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+N_TXTSIZE(x)) \ | |
188 | : (N_SEGSIZE(x) + ((N_TXTADDR(x)+N_TXTSIZE(x)-1) & ~(N_SEGSIZE(x)-1)))) | |
189 | #endif | |
190 | /* The address of the BSS segment -- immediately after the data segment. */ | |
191 | ||
192 | #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data) | |
193 | ||
194 | /* Offsets of the various portions of the file after the text segment. */ | |
195 | ||
0242cd56 ILT |
196 | /* For {Q,Z}MAGIC, there is padding to make the data segment start on |
197 | a page boundary. Most of the time the a_text field (and thus | |
198 | N_TXTSIZE) already contains this padding. It is possible that for | |
199 | BSDI and/or 386BSD it sometimes doesn't contain the padding, and | |
200 | perhaps we should be adding it here. But this seems kind of | |
201 | questionable and probably should be BSDI/386BSD-specific if we do | |
202 | do it. | |
203 | ||
204 | For NMAGIC (at least for hp300 BSD, probably others), there is | |
205 | padding in memory only, not on disk, so we must *not* ever pad here | |
206 | for NMAGIC. */ | |
70ef870f JK |
207 | |
208 | #ifndef N_DATOFF | |
209 | #define N_DATOFF(x) \ | |
0242cd56 | 210 | (N_TXTOFF(x) + N_TXTSIZE(x)) |
70ef870f JK |
211 | #endif |
212 | ||
213 | #ifndef N_TRELOFF | |
214 | #define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data ) | |
215 | #endif | |
216 | #ifndef N_DRELOFF | |
217 | #define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize ) | |
218 | #endif | |
219 | #ifndef N_SYMOFF | |
220 | #define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize ) | |
221 | #endif | |
222 | #ifndef N_STROFF | |
223 | #define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) | |
224 | #endif | |
225 | \f | |
226 | /* Symbols */ | |
227 | #ifndef external_nlist | |
228 | struct external_nlist { | |
229 | bfd_byte e_strx[BYTES_IN_WORD]; /* index into string table of name */ | |
230 | bfd_byte e_type[1]; /* type of symbol */ | |
231 | bfd_byte e_other[1]; /* misc info (usually empty) */ | |
232 | bfd_byte e_desc[2]; /* description field */ | |
233 | bfd_byte e_value[BYTES_IN_WORD]; /* value of symbol */ | |
234 | }; | |
235 | #define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD) | |
236 | #endif | |
237 | ||
238 | struct internal_nlist { | |
239 | unsigned long n_strx; /* index into string table of name */ | |
240 | unsigned char n_type; /* type of symbol */ | |
241 | unsigned char n_other; /* misc info (usually empty) */ | |
242 | unsigned short n_desc; /* description field */ | |
243 | bfd_vma n_value; /* value of symbol */ | |
244 | }; | |
245 | ||
246 | /* The n_type field is the symbol type, containing: */ | |
247 | ||
248 | #define N_UNDF 0 /* Undefined symbol */ | |
249 | #define N_ABS 2 /* Absolute symbol -- defined at particular addr */ | |
250 | #define N_TEXT 4 /* Text sym -- defined at offset in text seg */ | |
251 | #define N_DATA 6 /* Data sym -- defined at offset in data seg */ | |
252 | #define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg */ | |
253 | #define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink) */ | |
254 | #define N_FN 0x1f /* File name of .o file */ | |
255 | #define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh) */ | |
256 | /* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT, | |
257 | N_DATA, or N_BSS. When the low-order bit of other types is set, | |
258 | (e.g. N_WARNING versus N_FN), they are two different types. */ | |
259 | #define N_EXT 1 /* External symbol (as opposed to local-to-this-file) */ | |
260 | #define N_TYPE 0x1e | |
261 | #define N_STAB 0xe0 /* If any of these bits are on, it's a debug symbol */ | |
262 | ||
263 | #define N_INDR 0x0a | |
264 | ||
265 | /* The following symbols refer to set elements. | |
266 | All the N_SET[ATDB] symbols with the same name form one set. | |
267 | Space is allocated for the set in the text section, and each set | |
268 | elements value is stored into one word of the space. | |
269 | The first word of the space is the length of the set (number of elements). | |
270 | ||
271 | The address of the set is made into an N_SETV symbol | |
272 | whose name is the same as the name of the set. | |
273 | This symbol acts like a N_DATA global symbol | |
274 | in that it can satisfy undefined external references. */ | |
275 | ||
276 | /* These appear as input to LD, in a .o file. */ | |
277 | #define N_SETA 0x14 /* Absolute set element symbol */ | |
278 | #define N_SETT 0x16 /* Text set element symbol */ | |
279 | #define N_SETD 0x18 /* Data set element symbol */ | |
280 | #define N_SETB 0x1A /* Bss set element symbol */ | |
281 | ||
282 | /* This is output from LD. */ | |
283 | #define N_SETV 0x1C /* Pointer to set vector in data area. */ | |
284 | ||
285 | /* Warning symbol. The text gives a warning message, the next symbol | |
286 | in the table will be undefined. When the symbol is referenced, the | |
287 | message is printed. */ | |
288 | ||
289 | #define N_WARNING 0x1e | |
290 | ||
0242cd56 ILT |
291 | /* Weak symbols. These are a GNU extension to the a.out format. The |
292 | semantics are those of ELF weak symbols. Weak symbols are always | |
293 | externally visible. The N_WEAK? values are squeezed into the | |
294 | available slots. The value of a N_WEAKU symbol is 0. The values | |
295 | of the other types are the definitions. */ | |
296 | #define N_WEAKU 0x0d /* Weak undefined symbol. */ | |
297 | #define N_WEAKA 0x0e /* Weak absolute symbol. */ | |
298 | #define N_WEAKT 0x0f /* Weak text symbol. */ | |
299 | #define N_WEAKD 0x10 /* Weak data symbol. */ | |
300 | #define N_WEAKB 0x11 /* Weak bss symbol. */ | |
301 | ||
70ef870f JK |
302 | /* Relocations |
303 | ||
304 | There are two types of relocation flavours for a.out systems, | |
305 | standard and extended. The standard form is used on systems where the | |
306 | instruction has room for all the bits of an offset to the operand, whilst | |
307 | the extended form is used when an address operand has to be split over n | |
308 | instructions. Eg, on the 68k, each move instruction can reference | |
309 | the target with a displacement of 16 or 32 bits. On the sparc, move | |
310 | instructions use an offset of 14 bits, so the offset is stored in | |
311 | the reloc field, and the data in the section is ignored. | |
312 | */ | |
313 | ||
314 | /* This structure describes a single relocation to be performed. | |
315 | The text-relocation section of the file is a vector of these structures, | |
316 | all of which apply to the text section. | |
317 | Likewise, the data-relocation section applies to the data section. */ | |
318 | ||
319 | struct reloc_std_external { | |
320 | bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */ | |
321 | bfd_byte r_index[3]; /* symbol table index of symbol */ | |
322 | bfd_byte r_type[1]; /* relocation type */ | |
323 | }; | |
324 | ||
0242cd56 ILT |
325 | #define RELOC_STD_BITS_PCREL_BIG ((unsigned int) 0x80) |
326 | #define RELOC_STD_BITS_PCREL_LITTLE ((unsigned int) 0x01) | |
70ef870f | 327 | |
0242cd56 ILT |
328 | #define RELOC_STD_BITS_LENGTH_BIG ((unsigned int) 0x60) |
329 | #define RELOC_STD_BITS_LENGTH_SH_BIG 5 | |
330 | #define RELOC_STD_BITS_LENGTH_LITTLE ((unsigned int) 0x06) | |
70ef870f JK |
331 | #define RELOC_STD_BITS_LENGTH_SH_LITTLE 1 |
332 | ||
0242cd56 ILT |
333 | #define RELOC_STD_BITS_EXTERN_BIG ((unsigned int) 0x10) |
334 | #define RELOC_STD_BITS_EXTERN_LITTLE ((unsigned int) 0x08) | |
70ef870f | 335 | |
0242cd56 ILT |
336 | #define RELOC_STD_BITS_BASEREL_BIG ((unsigned int) 0x08) |
337 | #define RELOC_STD_BITS_BASEREL_LITTLE ((unsigned int) 0x10) | |
70ef870f | 338 | |
0242cd56 ILT |
339 | #define RELOC_STD_BITS_JMPTABLE_BIG ((unsigned int) 0x04) |
340 | #define RELOC_STD_BITS_JMPTABLE_LITTLE ((unsigned int) 0x20) | |
70ef870f | 341 | |
0242cd56 ILT |
342 | #define RELOC_STD_BITS_RELATIVE_BIG ((unsigned int) 0x02) |
343 | #define RELOC_STD_BITS_RELATIVE_LITTLE ((unsigned int) 0x40) | |
70ef870f JK |
344 | |
345 | #define RELOC_STD_SIZE (BYTES_IN_WORD + 3 + 1) /* Bytes per relocation entry */ | |
346 | ||
347 | struct reloc_std_internal | |
348 | { | |
349 | bfd_vma r_address; /* Address (within segment) to be relocated. */ | |
350 | /* The meaning of r_symbolnum depends on r_extern. */ | |
351 | unsigned int r_symbolnum:24; | |
352 | /* Nonzero means value is a pc-relative offset | |
353 | and it should be relocated for changes in its own address | |
354 | as well as for changes in the symbol or section specified. */ | |
355 | unsigned int r_pcrel:1; | |
356 | /* Length (as exponent of 2) of the field to be relocated. | |
357 | Thus, a value of 2 indicates 1<<2 bytes. */ | |
358 | unsigned int r_length:2; | |
359 | /* 1 => relocate with value of symbol. | |
360 | r_symbolnum is the index of the symbol | |
361 | in files the symbol table. | |
362 | 0 => relocate with the address of a segment. | |
363 | r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS | |
364 | (the N_EXT bit may be set also, but signifies nothing). */ | |
365 | unsigned int r_extern:1; | |
366 | /* The next three bits are for SunOS shared libraries, and seem to | |
367 | be undocumented. */ | |
368 | unsigned int r_baserel:1; /* Linkage table relative */ | |
369 | unsigned int r_jmptable:1; /* pc-relative to jump table */ | |
370 | unsigned int r_relative:1; /* "relative relocation" */ | |
371 | /* unused */ | |
372 | unsigned int r_pad:1; /* Padding -- set to zero */ | |
373 | }; | |
374 | ||
375 | ||
376 | /* EXTENDED RELOCS */ | |
377 | ||
378 | struct reloc_ext_external { | |
379 | bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */ | |
380 | bfd_byte r_index[3]; /* symbol table index of symbol */ | |
381 | bfd_byte r_type[1]; /* relocation type */ | |
382 | bfd_byte r_addend[BYTES_IN_WORD]; /* datum addend */ | |
383 | }; | |
384 | ||
0242cd56 ILT |
385 | #define RELOC_EXT_BITS_EXTERN_BIG ((unsigned int) 0x80) |
386 | #define RELOC_EXT_BITS_EXTERN_LITTLE ((unsigned int) 0x01) | |
70ef870f | 387 | |
0242cd56 | 388 | #define RELOC_EXT_BITS_TYPE_BIG ((unsigned int) 0x1F) |
70ef870f | 389 | #define RELOC_EXT_BITS_TYPE_SH_BIG 0 |
0242cd56 | 390 | #define RELOC_EXT_BITS_TYPE_LITTLE ((unsigned int) 0xF8) |
70ef870f JK |
391 | #define RELOC_EXT_BITS_TYPE_SH_LITTLE 3 |
392 | ||
393 | /* Bytes per relocation entry */ | |
394 | #define RELOC_EXT_SIZE (BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD) | |
395 | ||
396 | enum reloc_type | |
397 | { | |
398 | /* simple relocations */ | |
399 | RELOC_8, /* data[0:7] = addend + sv */ | |
400 | RELOC_16, /* data[0:15] = addend + sv */ | |
401 | RELOC_32, /* data[0:31] = addend + sv */ | |
402 | /* pc-rel displacement */ | |
403 | RELOC_DISP8, /* data[0:7] = addend - pc + sv */ | |
404 | RELOC_DISP16, /* data[0:15] = addend - pc + sv */ | |
405 | RELOC_DISP32, /* data[0:31] = addend - pc + sv */ | |
406 | /* Special */ | |
407 | RELOC_WDISP30, /* data[0:29] = (addend + sv - pc)>>2 */ | |
408 | RELOC_WDISP22, /* data[0:21] = (addend + sv - pc)>>2 */ | |
409 | RELOC_HI22, /* data[0:21] = (addend + sv)>>10 */ | |
410 | RELOC_22, /* data[0:21] = (addend + sv) */ | |
411 | RELOC_13, /* data[0:12] = (addend + sv) */ | |
412 | RELOC_LO10, /* data[0:9] = (addend + sv) */ | |
413 | RELOC_SFA_BASE, | |
414 | RELOC_SFA_OFF13, | |
415 | /* P.I.C. (base-relative) */ | |
416 | RELOC_BASE10, /* Not sure - maybe we can do this the */ | |
417 | RELOC_BASE13, /* right way now */ | |
418 | RELOC_BASE22, | |
419 | /* for some sort of pc-rel P.I.C. (?) */ | |
420 | RELOC_PC10, | |
421 | RELOC_PC22, | |
422 | /* P.I.C. jump table */ | |
423 | RELOC_JMP_TBL, | |
424 | /* reputedly for shared libraries somehow */ | |
425 | RELOC_SEGOFF16, | |
426 | RELOC_GLOB_DAT, | |
427 | RELOC_JMP_SLOT, | |
428 | RELOC_RELATIVE, | |
429 | ||
430 | RELOC_11, | |
431 | RELOC_WDISP2_14, | |
432 | RELOC_WDISP19, | |
433 | RELOC_HHI22, /* data[0:21] = (addend + sv) >> 42 */ | |
434 | RELOC_HLO10, /* data[0:9] = (addend + sv) >> 32 */ | |
435 | ||
436 | /* 29K relocation types */ | |
437 | RELOC_JUMPTARG, | |
438 | RELOC_CONST, | |
439 | RELOC_CONSTH, | |
440 | ||
441 | /* All the new ones I can think of *//*v9*/ | |
442 | ||
443 | RELOC_64, /* data[0:63] = addend + sv *//*v9*/ | |
444 | RELOC_DISP64, /* data[0:63] = addend - pc + sv *//*v9*/ | |
445 | RELOC_WDISP21, /* data[0:20] = (addend + sv - pc)>>2 *//*v9*/ | |
446 | RELOC_DISP21, /* data[0:20] = addend - pc + sv *//*v9*/ | |
447 | RELOC_DISP14, /* data[0:13] = addend - pc + sv *//*v9*/ | |
448 | /* Q . | |
449 | What are the other ones, | |
450 | Since this is a clean slate, can we throw away the ones we dont | |
451 | understand ? Should we sort the values ? What about using a | |
452 | microcode format like the 68k ? | |
453 | */ | |
454 | NO_RELOC | |
455 | }; | |
456 | ||
457 | ||
458 | struct reloc_internal { | |
459 | bfd_vma r_address; /* offset of of data to relocate */ | |
460 | long r_index; /* symbol table index of symbol */ | |
461 | enum reloc_type r_type; /* relocation type */ | |
462 | bfd_vma r_addend; /* datum addend */ | |
463 | }; | |
464 | ||
465 | /* Q. | |
466 | Should the length of the string table be 4 bytes or 8 bytes ? | |
467 | ||
468 | Q. | |
469 | What about archive indexes ? | |
470 | ||
471 | */ | |
472 | ||
473 | #endif /* __A_OUT_64_H__ */ |