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