Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* BFD back-end for raw ARM a.out binaries. |
1725a96e | 2 | Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001 |
7898deda | 3 | Free Software Foundation, Inc. |
252b5132 | 4 | Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) |
c4dfa77f | 5 | |
252b5132 RH |
6 | This file is part of BFD, the Binary File Descriptor library. |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
21 | ||
1725a96e NC |
22 | #include "bfd.h" |
23 | #include "sysdep.h" | |
24 | /* Avoid multiple defininitions from aoutx if supporting standarad a.out | |
25 | as well as our own. */ | |
26 | #define NAME(x,y) CAT3(aoutarm,_32_,y) | |
27 | ||
28 | #include "libaout.h" | |
29 | #include "aout/aout64.h" | |
30 | ||
252b5132 RH |
31 | #define N_TXTADDR(x) \ |
32 | ((N_MAGIC(x) == NMAGIC) ? 0x8000 : \ | |
33 | (N_MAGIC(x) != ZMAGIC) ? 0 : \ | |
34 | (N_SHARED_LIB(x)) ? ((x).a_entry & ~(TARGET_PAGE_SIZE - 1)) : \ | |
35 | TEXT_START_ADDR) | |
36 | ||
37 | #define TEXT_START_ADDR 0x8000 | |
38 | #define TARGET_PAGE_SIZE 0x8000 | |
39 | #define SEGMENT_SIZE TARGET_PAGE_SIZE | |
40 | #define DEFAULT_ARCH bfd_arch_arm | |
41 | ||
42 | #define MY(OP) CAT(aoutarm_,OP) | |
43 | #define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) && \ | |
44 | (((x).a_info & ~006000) != OMAGIC) && \ | |
45 | ((x).a_info != NMAGIC)) | |
46 | #define N_MAGIC(x) ((x).a_info & ~07200) | |
47 | ||
252b5132 RH |
48 | #define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup |
49 | ||
1725a96e NC |
50 | static boolean MY(write_object_contents) PARAMS ((bfd *)); |
51 | static bfd_reloc_status_type MY(fix_pcrel_26_done) PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | |
52 | static bfd_reloc_status_type MY(fix_pcrel_26) PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | |
53 | static void MY(swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **, bfd_size_type)); | |
54 | reloc_howto_type * MY(bfd_reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type)); | |
55 | reloc_howto_type * MY(reloc_howto) PARAMS ((bfd *, struct reloc_std_external *, int *, int *, int *)); | |
56 | void MY(put_reloc) PARAMS ((bfd *, int, int, long, reloc_howto_type *, struct reloc_std_external *)); | |
57 | void MY(relocatable_reloc) PARAMS ((reloc_howto_type *, bfd *, struct reloc_std_external *, bfd_vma *, bfd_vma)); | |
58 | void MY(swap_std_reloc_out) PARAMS ((bfd *, arelent *, struct reloc_std_external *)); | |
59 | \f | |
252b5132 | 60 | reloc_howto_type MY(howto_table)[] = |
1725a96e NC |
61 | { |
62 | /* Type rs size bsz pcrel bitpos ovrf sf name part_inpl | |
63 | readmask setmask pcdone. */ | |
64 | HOWTO (0, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "8", true, | |
65 | 0x000000ff, 0x000000ff, false), | |
66 | HOWTO (1, 0, 1, 16, false, 0, complain_overflow_bitfield, 0, "16", true, | |
67 | 0x0000ffff, 0x0000ffff, false), | |
68 | HOWTO (2, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "32", true, | |
69 | 0xffffffff, 0xffffffff, false), | |
70 | HOWTO (3, 2, 2, 26, true, 0, complain_overflow_signed, MY(fix_pcrel_26), | |
71 | "ARM26", true, 0x00ffffff, 0x00ffffff, true), | |
72 | HOWTO (4, 0, 0, 8, true, 0, complain_overflow_signed, 0, "DISP8", true, | |
73 | 0x000000ff, 0x000000ff, true), | |
74 | HOWTO (5, 0, 1, 16, true, 0, complain_overflow_signed, 0, "DISP16", true, | |
75 | 0x0000ffff, 0x0000ffff, true), | |
76 | HOWTO (6, 0, 2, 32, true, 0, complain_overflow_signed, 0, "DISP32", true, | |
77 | 0xffffffff, 0xffffffff, true), | |
78 | HOWTO (7, 2, 2, 26, false, 0, complain_overflow_signed, | |
79 | MY(fix_pcrel_26_done), "ARM26D", true, 0x0, 0x0, | |
80 | false), | |
81 | EMPTY_HOWTO (-1), | |
82 | HOWTO (9, 0, -1, 16, false, 0, complain_overflow_bitfield, 0, "NEG16", true, | |
83 | 0x0000ffff, 0x0000ffff, false), | |
84 | HOWTO (10, 0, -2, 32, false, 0, complain_overflow_bitfield, 0, "NEG32", true, | |
85 | 0xffffffff, 0xffffffff, false) | |
86 | }; | |
252b5132 RH |
87 | |
88 | #define RELOC_ARM_BITS_NEG_BIG ((unsigned int) 0x08) | |
89 | #define RELOC_ARM_BITS_NEG_LITTLE ((unsigned int) 0x10) | |
90 | ||
91 | reloc_howto_type * | |
beb0d161 | 92 | MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel) |
252b5132 RH |
93 | bfd *abfd; |
94 | struct reloc_std_external *rel; | |
95 | int *r_index; | |
96 | int *r_extern; | |
97 | int *r_pcrel; | |
98 | { | |
99 | unsigned int r_length; | |
100 | unsigned int r_pcrel_done; | |
101 | unsigned int r_neg; | |
102 | int index; | |
103 | ||
104 | *r_pcrel = 0; | |
105 | if (bfd_header_big_endian (abfd)) | |
106 | { | |
107 | *r_index = ((rel->r_index[0] << 16) | |
108 | | (rel->r_index[1] << 8) | |
109 | | rel->r_index[2]); | |
110 | *r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); | |
111 | r_pcrel_done = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); | |
112 | r_neg = (0 != (rel->r_type[0] & RELOC_ARM_BITS_NEG_BIG)); | |
113 | r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) | |
114 | >> RELOC_STD_BITS_LENGTH_SH_BIG); | |
115 | } | |
116 | else | |
117 | { | |
118 | *r_index = ((rel->r_index[2] << 16) | |
119 | | (rel->r_index[1] << 8) | |
120 | | rel->r_index[0]); | |
121 | *r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); | |
122 | r_pcrel_done = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); | |
123 | r_neg = (0 != (rel->r_type[0] & RELOC_ARM_BITS_NEG_LITTLE)); | |
124 | r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) | |
125 | >> RELOC_STD_BITS_LENGTH_SH_LITTLE); | |
126 | } | |
127 | index = r_length + 4 * r_pcrel_done + 8 * r_neg; | |
128 | if (index == 3) | |
129 | *r_pcrel = 1; | |
130 | ||
131 | return MY(howto_table) + index; | |
132 | } | |
c4dfa77f | 133 | |
252b5132 RH |
134 | #define MY_reloc_howto(BFD, REL, IN, EX, PC) \ |
135 | MY(reloc_howto) (BFD, REL, &IN, &EX, &PC) | |
136 | ||
137 | void | |
beb0d161 | 138 | MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc) |
252b5132 RH |
139 | bfd *abfd; |
140 | int r_extern; | |
141 | int r_index; | |
142 | long value; | |
143 | reloc_howto_type *howto; | |
144 | struct reloc_std_external *reloc; | |
145 | { | |
146 | unsigned int r_length; | |
147 | int r_pcrel; | |
148 | int r_neg; | |
149 | ||
150 | PUT_WORD (abfd, value, reloc->r_address); | |
1725a96e NC |
151 | /* Size as a power of two. */ |
152 | r_length = howto->size; | |
252b5132 | 153 | |
c4dfa77f | 154 | /* Special case for branch relocations. */ |
252b5132 RH |
155 | if (howto->type == 3 || howto->type == 7) |
156 | r_length = 3; | |
157 | ||
1725a96e NC |
158 | r_pcrel = howto->type & 4; /* PC Relative done? */ |
159 | r_neg = howto->type & 8; /* Negative relocation. */ | |
160 | ||
252b5132 RH |
161 | if (bfd_header_big_endian (abfd)) |
162 | { | |
163 | reloc->r_index[0] = r_index >> 16; | |
164 | reloc->r_index[1] = r_index >> 8; | |
165 | reloc->r_index[2] = r_index; | |
166 | reloc->r_type[0] = | |
167 | ((r_extern ? RELOC_STD_BITS_EXTERN_BIG : 0) | |
168 | | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG : 0) | |
169 | | (r_neg ? RELOC_ARM_BITS_NEG_BIG : 0) | |
170 | | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG)); | |
171 | } | |
172 | else | |
173 | { | |
174 | reloc->r_index[2] = r_index >> 16; | |
175 | reloc->r_index[1] = r_index >> 8; | |
176 | reloc->r_index[0] = r_index; | |
177 | reloc->r_type[0] = | |
178 | ((r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0) | |
179 | | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE : 0) | |
180 | | (r_neg ? RELOC_ARM_BITS_NEG_LITTLE : 0) | |
181 | | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE)); | |
182 | } | |
183 | } | |
c4dfa77f | 184 | |
252b5132 | 185 | #define MY_put_reloc(BFD, EXT, IDX, VAL, HOWTO, RELOC) \ |
beb0d161 | 186 | MY(put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC) |
252b5132 RH |
187 | |
188 | void | |
beb0d161 | 189 | MY(relocatable_reloc) (howto, abfd, reloc, amount, r_addr) |
252b5132 RH |
190 | reloc_howto_type *howto; |
191 | bfd *abfd; | |
192 | struct reloc_std_external *reloc; | |
193 | bfd_vma *amount; | |
194 | bfd_vma r_addr; | |
195 | { | |
196 | if (howto->type == 3) | |
197 | { | |
c4dfa77f | 198 | if (reloc->r_type[0] |
252b5132 RH |
199 | & (bfd_header_big_endian (abfd) |
200 | ? RELOC_STD_BITS_EXTERN_BIG : RELOC_STD_BITS_EXTERN_LITTLE)) | |
201 | { | |
c4dfa77f | 202 | /* The reloc is still external, so don't modify anything. */ |
252b5132 RH |
203 | *amount = 0; |
204 | } | |
205 | else | |
206 | { | |
207 | *amount -= r_addr; | |
208 | /* Change the r_pcrel value -- on the ARM, this bit is set once the | |
209 | relocation is done. */ | |
210 | if (bfd_header_big_endian (abfd)) | |
211 | reloc->r_type[0] |= RELOC_STD_BITS_PCREL_BIG; | |
212 | else | |
213 | reloc->r_type[0] |= RELOC_STD_BITS_PCREL_LITTLE; | |
214 | } | |
215 | } | |
216 | else if (howto->type == 7) | |
217 | *amount = 0; | |
218 | } | |
219 | ||
220 | #define MY_relocatable_reloc(HOW, BFD, REL, AMOUNT, ADDR) \ | |
beb0d161 | 221 | MY(relocatable_reloc) (HOW, BFD, REL, &(AMOUNT), ADDR) |
252b5132 RH |
222 | |
223 | static bfd_reloc_status_type | |
224 | MY(fix_pcrel_26_done) (abfd, reloc_entry, symbol, data, input_section, | |
225 | output_bfd, error_message) | |
5f771d47 ILT |
226 | bfd *abfd ATTRIBUTE_UNUSED; |
227 | arelent *reloc_entry ATTRIBUTE_UNUSED; | |
228 | asymbol *symbol ATTRIBUTE_UNUSED; | |
229 | PTR data ATTRIBUTE_UNUSED; | |
230 | asection *input_section ATTRIBUTE_UNUSED; | |
231 | bfd *output_bfd ATTRIBUTE_UNUSED; | |
232 | char **error_message ATTRIBUTE_UNUSED; | |
252b5132 RH |
233 | { |
234 | /* This is dead simple at present. */ | |
235 | return bfd_reloc_ok; | |
236 | } | |
237 | ||
238 | static bfd_reloc_status_type | |
239 | MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section, | |
240 | output_bfd, error_message) | |
241 | bfd *abfd; | |
242 | arelent *reloc_entry; | |
243 | asymbol *symbol; | |
244 | PTR data; | |
245 | asection *input_section; | |
246 | bfd *output_bfd; | |
5f771d47 | 247 | char **error_message ATTRIBUTE_UNUSED; |
252b5132 RH |
248 | { |
249 | bfd_vma relocation; | |
250 | bfd_size_type addr = reloc_entry->address; | |
251 | long target = bfd_get_32 (abfd, (bfd_byte *) data + addr); | |
252 | bfd_reloc_status_type flag = bfd_reloc_ok; | |
c4dfa77f | 253 | |
1725a96e | 254 | /* If this is an undefined symbol, return error. */ |
252b5132 RH |
255 | if (symbol->section == &bfd_und_section |
256 | && (symbol->flags & BSF_WEAK) == 0) | |
257 | return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined; | |
258 | ||
259 | /* If the sections are different, and we are doing a partial relocation, | |
260 | just ignore it for now. */ | |
261 | if (symbol->section->name != input_section->name | |
262 | && output_bfd != (bfd *)NULL) | |
263 | return bfd_reloc_ok; | |
264 | ||
265 | relocation = (target & 0x00ffffff) << 2; | |
1725a96e | 266 | relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend. */ |
252b5132 RH |
267 | relocation += symbol->value; |
268 | relocation += symbol->section->output_section->vma; | |
269 | relocation += symbol->section->output_offset; | |
270 | relocation += reloc_entry->addend; | |
271 | relocation -= input_section->output_section->vma; | |
272 | relocation -= input_section->output_offset; | |
273 | relocation -= addr; | |
274 | if (relocation & 3) | |
275 | return bfd_reloc_overflow; | |
276 | ||
1725a96e | 277 | /* Check for overflow. */ |
252b5132 RH |
278 | if (relocation & 0x02000000) |
279 | { | |
280 | if ((relocation & ~ (bfd_vma) 0x03ffffff) != ~ (bfd_vma) 0x03ffffff) | |
281 | flag = bfd_reloc_overflow; | |
282 | } | |
283 | else if (relocation & ~0x03ffffff) | |
284 | flag = bfd_reloc_overflow; | |
285 | ||
286 | target &= ~0x00ffffff; | |
287 | target |= (relocation >> 2) & 0x00ffffff; | |
288 | bfd_put_32 (abfd, target, (bfd_byte *) data + addr); | |
289 | ||
290 | /* Now the ARM magic... Change the reloc type so that it is marked as done. | |
291 | Strictly this is only necessary if we are doing a partial relocation. */ | |
292 | reloc_entry->howto = &MY(howto_table)[7]; | |
c4dfa77f | 293 | |
252b5132 RH |
294 | return flag; |
295 | } | |
296 | ||
297 | reloc_howto_type * | |
beb0d161 | 298 | MY(bfd_reloc_type_lookup) (abfd,code) |
252b5132 RH |
299 | bfd *abfd; |
300 | bfd_reloc_code_real_type code; | |
301 | { | |
302 | #define ASTD(i,j) case i: return &MY(howto_table)[j] | |
303 | if (code == BFD_RELOC_CTOR) | |
304 | switch (bfd_get_arch_info (abfd)->bits_per_address) | |
305 | { | |
306 | case 32: | |
307 | code = BFD_RELOC_32; | |
308 | break; | |
1725a96e NC |
309 | default: |
310 | return (CONST struct reloc_howto_struct *) 0; | |
252b5132 RH |
311 | } |
312 | ||
313 | switch (code) | |
314 | { | |
315 | ASTD (BFD_RELOC_16, 1); | |
316 | ASTD (BFD_RELOC_32, 2); | |
317 | ASTD (BFD_RELOC_ARM_PCREL_BRANCH, 3); | |
318 | ASTD (BFD_RELOC_8_PCREL, 4); | |
319 | ASTD (BFD_RELOC_16_PCREL, 5); | |
320 | ASTD (BFD_RELOC_32_PCREL, 6); | |
1725a96e NC |
321 | default: |
322 | return (CONST struct reloc_howto_struct *) 0; | |
252b5132 RH |
323 | } |
324 | } | |
325 | ||
326 | #define MY_swap_std_reloc_in MY(swap_std_reloc_in) | |
327 | #define MY_swap_std_reloc_out MY(swap_std_reloc_out) | |
328 | #define MY_get_section_contents _bfd_generic_get_section_contents | |
329 | /* #define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create */ | |
330 | /* #define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols */ | |
331 | /* #define MY_bfd_final_link _bfd_generic_final_link */ | |
332 | ||
333 | #include "aoutx.h" | |
334 | ||
335 | static void | |
336 | MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount) | |
337 | bfd *abfd; | |
338 | struct reloc_std_external *bytes; | |
339 | arelent *cache_ptr; | |
340 | asymbol **symbols; | |
5f771d47 | 341 | bfd_size_type symcount ATTRIBUTE_UNUSED; |
252b5132 RH |
342 | { |
343 | int r_index; | |
344 | int r_extern; | |
345 | int r_pcrel; | |
346 | struct aoutdata *su = &(abfd->tdata.aout_data->a); | |
347 | ||
348 | cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address); | |
349 | ||
350 | cache_ptr->howto = MY_reloc_howto (abfd, bytes, r_index, r_extern, r_pcrel); | |
351 | ||
352 | MOVE_ADDRESS (0); | |
353 | } | |
354 | ||
355 | void | |
356 | MY_swap_std_reloc_out (abfd, g, natptr) | |
357 | bfd *abfd; | |
358 | arelent *g; | |
359 | struct reloc_std_external *natptr; | |
360 | { | |
361 | int r_index; | |
362 | asymbol *sym = *(g->sym_ptr_ptr); | |
363 | int r_extern; | |
364 | int r_length; | |
365 | int r_pcrel; | |
366 | int r_neg = 0; /* Negative relocs use the BASEREL bit. */ | |
367 | asection *output_section = sym->section->output_section; | |
368 | ||
369 | PUT_WORD(abfd, g->address, natptr->r_address); | |
370 | ||
371 | r_length = g->howto->size ; /* Size as a power of two */ | |
372 | if (r_length < 0) | |
373 | { | |
374 | r_length = -r_length; | |
375 | r_neg = 1; | |
376 | } | |
377 | ||
378 | r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */ | |
379 | ||
380 | /* For RISC iX, in pc-relative relocs the r_pcrel bit means that the | |
381 | relocation has been done already (Only for the 26-bit one I think)???!!! | |
382 | */ | |
383 | ||
384 | if (g->howto->type == 3) | |
385 | { | |
386 | r_length = 3; | |
387 | r_pcrel = 0; | |
388 | } | |
389 | else if (g->howto->type == 7) | |
c4dfa77f | 390 | { |
252b5132 RH |
391 | r_length = 3; |
392 | r_pcrel = 1; | |
393 | } | |
252b5132 RH |
394 | |
395 | #if 0 | |
396 | /* For a standard reloc, the addend is in the object file. */ | |
397 | r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma; | |
398 | #endif | |
399 | ||
400 | /* name was clobbered by aout_write_syms to be symbol index */ | |
401 | ||
402 | /* If this relocation is relative to a symbol then set the | |
403 | r_index to the symbols index, and the r_extern bit. | |
404 | ||
405 | Absolute symbols can come in in two ways, either as an offset | |
406 | from the abs section, or as a symbol which has an abs value. | |
407 | check for that here | |
408 | */ | |
409 | ||
410 | if (bfd_is_com_section (output_section) | |
411 | || output_section == &bfd_abs_section | |
412 | || output_section == &bfd_und_section) | |
413 | { | |
414 | if (bfd_abs_section.symbol == sym) | |
415 | { | |
416 | /* Whoops, looked like an abs symbol, but is really an offset | |
1725a96e | 417 | from the abs section. */ |
252b5132 RH |
418 | r_index = 0; |
419 | r_extern = 0; | |
420 | } | |
421 | else | |
422 | { | |
1725a96e | 423 | /* Fill in symbol. */ |
252b5132 RH |
424 | r_extern = 1; |
425 | r_index = (*(g->sym_ptr_ptr))->KEEPIT; | |
426 | } | |
427 | } | |
428 | else | |
429 | { | |
1725a96e | 430 | /* Just an ordinary section. */ |
252b5132 RH |
431 | r_extern = 0; |
432 | r_index = output_section->target_index; | |
433 | } | |
434 | ||
1725a96e | 435 | /* Now the fun stuff. */ |
252b5132 RH |
436 | if (bfd_header_big_endian (abfd)) |
437 | { | |
438 | natptr->r_index[0] = r_index >> 16; | |
439 | natptr->r_index[1] = r_index >> 8; | |
440 | natptr->r_index[2] = r_index; | |
441 | natptr->r_type[0] = | |
442 | ( (r_extern ? RELOC_STD_BITS_EXTERN_BIG: 0) | |
443 | | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG: 0) | |
444 | | (r_neg ? RELOC_ARM_BITS_NEG_BIG: 0) | |
445 | | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG)); | |
446 | } | |
447 | else | |
448 | { | |
449 | natptr->r_index[2] = r_index >> 16; | |
450 | natptr->r_index[1] = r_index >> 8; | |
451 | natptr->r_index[0] = r_index; | |
452 | natptr->r_type[0] = | |
453 | ( (r_extern ? RELOC_STD_BITS_EXTERN_LITTLE: 0) | |
454 | | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE: 0) | |
455 | | (r_neg ? RELOC_ARM_BITS_NEG_LITTLE: 0) | |
456 | | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE)); | |
457 | } | |
458 | } | |
459 | ||
460 | #define MY_BFD_TARGET | |
461 | ||
462 | #include "aout-target.h" | |
463 | ||
c3c89269 NC |
464 | extern const bfd_target aout_arm_big_vec; |
465 | ||
252b5132 | 466 | const bfd_target aout_arm_little_vec = |
1725a96e NC |
467 | { |
468 | "a.out-arm-little", /* name */ | |
469 | bfd_target_aout_flavour, | |
470 | BFD_ENDIAN_LITTLE, /* target byte order (little) */ | |
471 | BFD_ENDIAN_LITTLE, /* target headers byte order (little) */ | |
472 | (HAS_RELOC | EXEC_P | /* object flags */ | |
473 | HAS_LINENO | HAS_DEBUG | | |
474 | HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), | |
475 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), | |
476 | MY_symbol_leading_char, | |
477 | AR_PAD_CHAR, /* ar_pad_char */ | |
478 | 15, /* ar_max_namelen */ | |
479 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
480 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
481 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ | |
482 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
483 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
484 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ | |
485 | {_bfd_dummy_target, MY_object_p, /* bfd_check_format */ | |
486 | bfd_generic_archive_p, MY_core_file_p}, | |
487 | {bfd_false, MY_mkobject, /* bfd_set_format */ | |
488 | _bfd_generic_mkarchive, bfd_false}, | |
489 | {bfd_false, MY_write_object_contents, /* bfd_write_contents */ | |
490 | _bfd_write_archive_contents, bfd_false}, | |
491 | ||
492 | BFD_JUMP_TABLE_GENERIC (MY), | |
493 | BFD_JUMP_TABLE_COPY (MY), | |
494 | BFD_JUMP_TABLE_CORE (MY), | |
495 | BFD_JUMP_TABLE_ARCHIVE (MY), | |
496 | BFD_JUMP_TABLE_SYMBOLS (MY), | |
497 | BFD_JUMP_TABLE_RELOCS (MY), | |
498 | BFD_JUMP_TABLE_WRITE (MY), | |
499 | BFD_JUMP_TABLE_LINK (MY), | |
500 | BFD_JUMP_TABLE_DYNAMIC (MY), | |
501 | ||
502 | & aout_arm_big_vec, | |
503 | ||
504 | (PTR) MY_backend_data, | |
505 | }; | |
252b5132 RH |
506 | |
507 | const bfd_target aout_arm_big_vec = | |
1725a96e NC |
508 | { |
509 | "a.out-arm-big", /* name */ | |
510 | bfd_target_aout_flavour, | |
511 | BFD_ENDIAN_BIG, /* target byte order (big) */ | |
512 | BFD_ENDIAN_BIG, /* target headers byte order (big) */ | |
513 | (HAS_RELOC | EXEC_P | /* object flags */ | |
514 | HAS_LINENO | HAS_DEBUG | | |
515 | HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), | |
516 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), | |
517 | MY_symbol_leading_char, | |
518 | AR_PAD_CHAR, /* ar_pad_char */ | |
519 | 15, /* ar_max_namelen */ | |
520 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, | |
521 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, | |
522 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ | |
523 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, | |
524 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, | |
525 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ | |
526 | {_bfd_dummy_target, MY_object_p, /* bfd_check_format */ | |
527 | bfd_generic_archive_p, MY_core_file_p}, | |
528 | {bfd_false, MY_mkobject, /* bfd_set_format */ | |
529 | _bfd_generic_mkarchive, bfd_false}, | |
530 | {bfd_false, MY_write_object_contents, /* bfd_write_contents */ | |
531 | _bfd_write_archive_contents, bfd_false}, | |
532 | ||
533 | BFD_JUMP_TABLE_GENERIC (MY), | |
534 | BFD_JUMP_TABLE_COPY (MY), | |
535 | BFD_JUMP_TABLE_CORE (MY), | |
536 | BFD_JUMP_TABLE_ARCHIVE (MY), | |
537 | BFD_JUMP_TABLE_SYMBOLS (MY), | |
538 | BFD_JUMP_TABLE_RELOCS (MY), | |
539 | BFD_JUMP_TABLE_WRITE (MY), | |
540 | BFD_JUMP_TABLE_LINK (MY), | |
541 | BFD_JUMP_TABLE_DYNAMIC (MY), | |
542 | ||
543 | & aout_arm_little_vec, | |
544 | ||
545 | (PTR) MY_backend_data, | |
546 | }; |