1 /* 32-bit ELF support for ARM new abi option.
2 Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4 This file is part of BFD, the Binary File Descriptor library.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
27 #define NUM_ELEM(a) (sizeof (a) / (sizeof (a)[0]))
32 #define TARGET_LITTLE_SYM bfd_elf32_littlearm_vec
33 #define TARGET_LITTLE_NAME "elf32-littlearm"
34 #define TARGET_BIG_SYM bfd_elf32_bigarm_vec
35 #define TARGET_BIG_NAME "elf32-bigarm"
37 #define elf_info_to_howto 0
38 #define elf_info_to_howto_rel elf32_arm_info_to_howto
40 #define ARM_ELF_ABI_VERSION 0
41 #define ARM_ELF_OS_ABI_VERSION ELFOSABI_ARM
43 static reloc_howto_type
* elf32_arm_reloc_type_lookup
44 PARAMS ((bfd
* abfd
, bfd_reloc_code_real_type code
));
45 static bfd_boolean elf32_arm_nabi_grok_prstatus
46 PARAMS ((bfd
*abfd
, Elf_Internal_Note
*note
));
47 static bfd_boolean elf32_arm_nabi_grok_psinfo
48 PARAMS ((bfd
*abfd
, Elf_Internal_Note
*note
));
50 /* Note: code such as elf32_arm_reloc_type_lookup expect to use e.g.
51 R_ARM_PC24 as an index into this, and find the R_ARM_PC24 HOWTO
54 static reloc_howto_type elf32_arm_howto_table
[] =
57 HOWTO (R_ARM_NONE
, /* type */
59 0, /* size (0 = byte, 1 = short, 2 = long) */
61 FALSE
, /* pc_relative */
63 complain_overflow_dont
,/* complain_on_overflow */
64 bfd_elf_generic_reloc
, /* special_function */
65 "R_ARM_NONE", /* name */
66 FALSE
, /* partial_inplace */
69 FALSE
), /* pcrel_offset */
71 HOWTO (R_ARM_PC24
, /* type */
73 2, /* size (0 = byte, 1 = short, 2 = long) */
75 TRUE
, /* pc_relative */
77 complain_overflow_signed
,/* complain_on_overflow */
78 bfd_elf_generic_reloc
, /* special_function */
79 "R_ARM_PC24", /* name */
80 FALSE
, /* partial_inplace */
81 0x00ffffff, /* src_mask */
82 0x00ffffff, /* dst_mask */
83 TRUE
), /* pcrel_offset */
86 HOWTO (R_ARM_ABS32
, /* type */
88 2, /* size (0 = byte, 1 = short, 2 = long) */
90 FALSE
, /* pc_relative */
92 complain_overflow_bitfield
,/* complain_on_overflow */
93 bfd_elf_generic_reloc
, /* special_function */
94 "R_ARM_ABS32", /* name */
95 FALSE
, /* partial_inplace */
96 0xffffffff, /* src_mask */
97 0xffffffff, /* dst_mask */
98 FALSE
), /* pcrel_offset */
100 /* standard 32bit pc-relative reloc */
101 HOWTO (R_ARM_REL32
, /* type */
103 2, /* size (0 = byte, 1 = short, 2 = long) */
105 TRUE
, /* pc_relative */
107 complain_overflow_bitfield
,/* complain_on_overflow */
108 bfd_elf_generic_reloc
, /* special_function */
109 "R_ARM_REL32", /* name */
110 FALSE
, /* partial_inplace */
111 0xffffffff, /* src_mask */
112 0xffffffff, /* dst_mask */
113 TRUE
), /* pcrel_offset */
116 HOWTO (R_ARM_PC13
, /* type */
118 0, /* size (0 = byte, 1 = short, 2 = long) */
120 FALSE
, /* pc_relative */
122 complain_overflow_bitfield
,/* complain_on_overflow */
123 bfd_elf_generic_reloc
, /* special_function */
124 "R_ARM_PC13", /* name */
125 FALSE
, /* partial_inplace */
126 0x000000ff, /* src_mask */
127 0x000000ff, /* dst_mask */
128 FALSE
), /* pcrel_offset */
130 /* 16 bit absolute */
131 HOWTO (R_ARM_ABS16
, /* type */
133 1, /* size (0 = byte, 1 = short, 2 = long) */
135 FALSE
, /* pc_relative */
137 complain_overflow_bitfield
,/* complain_on_overflow */
138 bfd_elf_generic_reloc
, /* special_function */
139 "R_ARM_ABS16", /* name */
140 FALSE
, /* partial_inplace */
141 0x0000ffff, /* src_mask */
142 0x0000ffff, /* dst_mask */
143 FALSE
), /* pcrel_offset */
145 /* 12 bit absolute */
146 HOWTO (R_ARM_ABS12
, /* type */
148 2, /* size (0 = byte, 1 = short, 2 = long) */
150 FALSE
, /* pc_relative */
152 complain_overflow_bitfield
,/* complain_on_overflow */
153 bfd_elf_generic_reloc
, /* special_function */
154 "R_ARM_ABS12", /* name */
155 FALSE
, /* partial_inplace */
156 0x000008ff, /* src_mask */
157 0x000008ff, /* dst_mask */
158 FALSE
), /* pcrel_offset */
160 HOWTO (R_ARM_THM_ABS5
, /* type */
162 1, /* size (0 = byte, 1 = short, 2 = long) */
164 FALSE
, /* pc_relative */
166 complain_overflow_bitfield
,/* complain_on_overflow */
167 bfd_elf_generic_reloc
, /* special_function */
168 "R_ARM_THM_ABS5", /* name */
169 FALSE
, /* partial_inplace */
170 0x000007e0, /* src_mask */
171 0x000007e0, /* dst_mask */
172 FALSE
), /* pcrel_offset */
175 HOWTO (R_ARM_ABS8
, /* type */
177 0, /* size (0 = byte, 1 = short, 2 = long) */
179 FALSE
, /* pc_relative */
181 complain_overflow_bitfield
,/* complain_on_overflow */
182 bfd_elf_generic_reloc
, /* special_function */
183 "R_ARM_ABS8", /* name */
184 FALSE
, /* partial_inplace */
185 0x000000ff, /* src_mask */
186 0x000000ff, /* dst_mask */
187 FALSE
), /* pcrel_offset */
189 HOWTO (R_ARM_SBREL32
, /* type */
191 2, /* size (0 = byte, 1 = short, 2 = long) */
193 FALSE
, /* pc_relative */
195 complain_overflow_dont
,/* complain_on_overflow */
196 bfd_elf_generic_reloc
, /* special_function */
197 "R_ARM_SBREL32", /* name */
198 FALSE
, /* partial_inplace */
199 0xffffffff, /* src_mask */
200 0xffffffff, /* dst_mask */
201 FALSE
), /* pcrel_offset */
203 HOWTO (R_ARM_THM_PC22
, /* type */
205 2, /* size (0 = byte, 1 = short, 2 = long) */
207 TRUE
, /* pc_relative */
209 complain_overflow_signed
,/* complain_on_overflow */
210 bfd_elf_generic_reloc
, /* special_function */
211 "R_ARM_THM_PC22", /* name */
212 FALSE
, /* partial_inplace */
213 0x07ff07ff, /* src_mask */
214 0x07ff07ff, /* dst_mask */
215 TRUE
), /* pcrel_offset */
217 HOWTO (R_ARM_THM_PC8
, /* type */
219 1, /* size (0 = byte, 1 = short, 2 = long) */
221 TRUE
, /* pc_relative */
223 complain_overflow_signed
,/* complain_on_overflow */
224 bfd_elf_generic_reloc
, /* special_function */
225 "R_ARM_THM_PC8", /* name */
226 FALSE
, /* partial_inplace */
227 0x000000ff, /* src_mask */
228 0x000000ff, /* dst_mask */
229 TRUE
), /* pcrel_offset */
231 HOWTO (R_ARM_AMP_VCALL9
, /* type */
233 1, /* size (0 = byte, 1 = short, 2 = long) */
235 TRUE
, /* pc_relative */
237 complain_overflow_signed
,/* complain_on_overflow */
238 bfd_elf_generic_reloc
, /* special_function */
239 "R_ARM_AMP_VCALL9", /* name */
240 FALSE
, /* partial_inplace */
241 0x000000ff, /* src_mask */
242 0x000000ff, /* dst_mask */
243 TRUE
), /* pcrel_offset */
245 HOWTO (R_ARM_SWI24
, /* type */
247 0, /* size (0 = byte, 1 = short, 2 = long) */
249 FALSE
, /* pc_relative */
251 complain_overflow_signed
,/* complain_on_overflow */
252 bfd_elf_generic_reloc
, /* special_function */
253 "R_ARM_SWI24", /* name */
254 FALSE
, /* partial_inplace */
255 0x00000000, /* src_mask */
256 0x00000000, /* dst_mask */
257 FALSE
), /* pcrel_offset */
259 HOWTO (R_ARM_THM_SWI8
, /* type */
261 0, /* size (0 = byte, 1 = short, 2 = long) */
263 FALSE
, /* pc_relative */
265 complain_overflow_signed
,/* complain_on_overflow */
266 bfd_elf_generic_reloc
, /* special_function */
267 "R_ARM_SWI8", /* name */
268 FALSE
, /* partial_inplace */
269 0x00000000, /* src_mask */
270 0x00000000, /* dst_mask */
271 FALSE
), /* pcrel_offset */
273 /* BLX instruction for the ARM. */
274 HOWTO (R_ARM_XPC25
, /* type */
276 2, /* size (0 = byte, 1 = short, 2 = long) */
278 TRUE
, /* pc_relative */
280 complain_overflow_signed
,/* complain_on_overflow */
281 bfd_elf_generic_reloc
, /* special_function */
282 "R_ARM_XPC25", /* name */
283 FALSE
, /* partial_inplace */
284 0x00ffffff, /* src_mask */
285 0x00ffffff, /* dst_mask */
286 TRUE
), /* pcrel_offset */
288 /* BLX instruction for the Thumb. */
289 HOWTO (R_ARM_THM_XPC22
, /* type */
291 2, /* size (0 = byte, 1 = short, 2 = long) */
293 TRUE
, /* pc_relative */
295 complain_overflow_signed
,/* complain_on_overflow */
296 bfd_elf_generic_reloc
, /* special_function */
297 "R_ARM_THM_XPC22", /* name */
298 FALSE
, /* partial_inplace */
299 0x07ff07ff, /* src_mask */
300 0x07ff07ff, /* dst_mask */
301 TRUE
), /* pcrel_offset */
303 /* These next three relocs are not defined, but we need to fill the space. */
305 HOWTO (R_ARM_NONE
, /* type */
307 0, /* size (0 = byte, 1 = short, 2 = long) */
309 FALSE
, /* pc_relative */
311 complain_overflow_dont
,/* complain_on_overflow */
312 bfd_elf_generic_reloc
, /* special_function */
313 "R_ARM_unknown_17", /* name */
314 FALSE
, /* partial_inplace */
317 FALSE
), /* pcrel_offset */
319 HOWTO (R_ARM_NONE
, /* type */
321 0, /* size (0 = byte, 1 = short, 2 = long) */
323 FALSE
, /* pc_relative */
325 complain_overflow_dont
,/* complain_on_overflow */
326 bfd_elf_generic_reloc
, /* special_function */
327 "R_ARM_unknown_18", /* name */
328 FALSE
, /* partial_inplace */
331 FALSE
), /* pcrel_offset */
333 HOWTO (R_ARM_NONE
, /* type */
335 0, /* size (0 = byte, 1 = short, 2 = long) */
337 FALSE
, /* pc_relative */
339 complain_overflow_dont
,/* complain_on_overflow */
340 bfd_elf_generic_reloc
, /* special_function */
341 "R_ARM_unknown_19", /* name */
342 FALSE
, /* partial_inplace */
345 FALSE
), /* pcrel_offset */
347 /* Relocs used in ARM Linux */
349 HOWTO (R_ARM_COPY
, /* type */
351 2, /* size (0 = byte, 1 = short, 2 = long) */
353 FALSE
, /* pc_relative */
355 complain_overflow_bitfield
,/* complain_on_overflow */
356 bfd_elf_generic_reloc
, /* special_function */
357 "R_ARM_COPY", /* name */
358 TRUE
, /* partial_inplace */
359 0xffffffff, /* src_mask */
360 0xffffffff, /* dst_mask */
361 FALSE
), /* pcrel_offset */
363 HOWTO (R_ARM_GLOB_DAT
, /* type */
365 2, /* size (0 = byte, 1 = short, 2 = long) */
367 FALSE
, /* pc_relative */
369 complain_overflow_bitfield
,/* complain_on_overflow */
370 bfd_elf_generic_reloc
, /* special_function */
371 "R_ARM_GLOB_DAT", /* name */
372 TRUE
, /* partial_inplace */
373 0xffffffff, /* src_mask */
374 0xffffffff, /* dst_mask */
375 FALSE
), /* pcrel_offset */
377 HOWTO (R_ARM_JUMP_SLOT
, /* type */
379 2, /* size (0 = byte, 1 = short, 2 = long) */
381 FALSE
, /* pc_relative */
383 complain_overflow_bitfield
,/* complain_on_overflow */
384 bfd_elf_generic_reloc
, /* special_function */
385 "R_ARM_JUMP_SLOT", /* name */
386 TRUE
, /* partial_inplace */
387 0xffffffff, /* src_mask */
388 0xffffffff, /* dst_mask */
389 FALSE
), /* pcrel_offset */
391 HOWTO (R_ARM_RELATIVE
, /* type */
393 2, /* size (0 = byte, 1 = short, 2 = long) */
395 FALSE
, /* pc_relative */
397 complain_overflow_bitfield
,/* complain_on_overflow */
398 bfd_elf_generic_reloc
, /* special_function */
399 "R_ARM_RELATIVE", /* name */
400 TRUE
, /* partial_inplace */
401 0xffffffff, /* src_mask */
402 0xffffffff, /* dst_mask */
403 FALSE
), /* pcrel_offset */
405 HOWTO (R_ARM_GOTOFF
, /* type */
407 2, /* size (0 = byte, 1 = short, 2 = long) */
409 FALSE
, /* pc_relative */
411 complain_overflow_bitfield
,/* complain_on_overflow */
412 bfd_elf_generic_reloc
, /* special_function */
413 "R_ARM_GOTOFF", /* name */
414 TRUE
, /* partial_inplace */
415 0xffffffff, /* src_mask */
416 0xffffffff, /* dst_mask */
417 FALSE
), /* pcrel_offset */
419 HOWTO (R_ARM_GOTPC
, /* type */
421 2, /* size (0 = byte, 1 = short, 2 = long) */
423 TRUE
, /* pc_relative */
425 complain_overflow_bitfield
,/* complain_on_overflow */
426 bfd_elf_generic_reloc
, /* special_function */
427 "R_ARM_GOTPC", /* name */
428 TRUE
, /* partial_inplace */
429 0xffffffff, /* src_mask */
430 0xffffffff, /* dst_mask */
431 TRUE
), /* pcrel_offset */
433 HOWTO (R_ARM_GOT32
, /* type */
435 2, /* size (0 = byte, 1 = short, 2 = long) */
437 FALSE
, /* pc_relative */
439 complain_overflow_bitfield
,/* complain_on_overflow */
440 bfd_elf_generic_reloc
, /* special_function */
441 "R_ARM_GOT32", /* name */
442 TRUE
, /* partial_inplace */
443 0xffffffff, /* src_mask */
444 0xffffffff, /* dst_mask */
445 FALSE
), /* pcrel_offset */
447 HOWTO (R_ARM_PLT32
, /* type */
449 2, /* size (0 = byte, 1 = short, 2 = long) */
451 TRUE
, /* pc_relative */
453 complain_overflow_bitfield
,/* complain_on_overflow */
454 bfd_elf_generic_reloc
, /* special_function */
455 "R_ARM_PLT32", /* name */
456 TRUE
, /* partial_inplace */
457 0x00ffffff, /* src_mask */
458 0x00ffffff, /* dst_mask */
459 TRUE
), /* pcrel_offset */
461 /* End of relocs used in ARM Linux */
463 HOWTO (R_ARM_RREL32
, /* type */
465 0, /* size (0 = byte, 1 = short, 2 = long) */
467 FALSE
, /* pc_relative */
469 complain_overflow_dont
,/* complain_on_overflow */
470 bfd_elf_generic_reloc
, /* special_function */
471 "R_ARM_RREL32", /* name */
472 FALSE
, /* partial_inplace */
475 FALSE
), /* pcrel_offset */
477 HOWTO (R_ARM_RABS32
, /* type */
479 0, /* size (0 = byte, 1 = short, 2 = long) */
481 FALSE
, /* pc_relative */
483 complain_overflow_dont
,/* complain_on_overflow */
484 bfd_elf_generic_reloc
, /* special_function */
485 "R_ARM_RABS32", /* name */
486 FALSE
, /* partial_inplace */
489 FALSE
), /* pcrel_offset */
491 HOWTO (R_ARM_RPC24
, /* type */
493 0, /* size (0 = byte, 1 = short, 2 = long) */
495 FALSE
, /* pc_relative */
497 complain_overflow_dont
,/* complain_on_overflow */
498 bfd_elf_generic_reloc
, /* special_function */
499 "R_ARM_RPC24", /* name */
500 FALSE
, /* partial_inplace */
503 FALSE
), /* pcrel_offset */
505 HOWTO (R_ARM_RBASE
, /* type */
507 0, /* size (0 = byte, 1 = short, 2 = long) */
509 FALSE
, /* pc_relative */
511 complain_overflow_dont
,/* complain_on_overflow */
512 bfd_elf_generic_reloc
, /* special_function */
513 "R_ARM_RBASE", /* name */
514 FALSE
, /* partial_inplace */
517 FALSE
), /* pcrel_offset */
519 HOWTO (R_ARM_ALU_PCREL7_0
, /* type */
521 2, /* size (0 = byte, 1 = short, 2 = long) */
523 TRUE
, /* pc_relative */
525 complain_overflow_dont
,/* complain_on_overflow */
526 bfd_elf_generic_reloc
, /* special_function */
527 "R_ARM_ALU_PCREL_7_0", /* name */
528 FALSE
, /* partial_inplace */
529 0x00000fff, /* src_mask */
530 0x00000fff, /* dst_mask */
531 TRUE
), /* pcrel_offset */
533 HOWTO (R_ARM_ALU_PCREL15_8
, /* type */
535 2, /* size (0 = byte, 1 = short, 2 = long) */
537 TRUE
, /* pc_relative */
539 complain_overflow_dont
,/* complain_on_overflow */
540 bfd_elf_generic_reloc
, /* special_function */
541 "R_ARM_ALU_PCREL_15_8",/* name */
542 FALSE
, /* partial_inplace */
543 0x00000fff, /* src_mask */
544 0x00000fff, /* dst_mask */
545 TRUE
), /* pcrel_offset */
547 HOWTO (R_ARM_ALU_PCREL23_15
, /* type */
549 2, /* size (0 = byte, 1 = short, 2 = long) */
551 TRUE
, /* pc_relative */
553 complain_overflow_dont
,/* complain_on_overflow */
554 bfd_elf_generic_reloc
, /* special_function */
555 "R_ARM_ALU_PCREL_23_15",/* name */
556 FALSE
, /* partial_inplace */
557 0x00000fff, /* src_mask */
558 0x00000fff, /* dst_mask */
559 TRUE
), /* pcrel_offset */
561 HOWTO (R_ARM_LDR_SBREL_11_0
, /* type */
563 2, /* size (0 = byte, 1 = short, 2 = long) */
565 FALSE
, /* pc_relative */
567 complain_overflow_dont
,/* complain_on_overflow */
568 bfd_elf_generic_reloc
, /* special_function */
569 "R_ARM_LDR_SBREL_11_0",/* name */
570 FALSE
, /* partial_inplace */
571 0x00000fff, /* src_mask */
572 0x00000fff, /* dst_mask */
573 FALSE
), /* pcrel_offset */
575 HOWTO (R_ARM_ALU_SBREL_19_12
, /* type */
577 2, /* size (0 = byte, 1 = short, 2 = long) */
579 FALSE
, /* pc_relative */
581 complain_overflow_dont
,/* complain_on_overflow */
582 bfd_elf_generic_reloc
, /* special_function */
583 "R_ARM_ALU_SBREL_19_12",/* name */
584 FALSE
, /* partial_inplace */
585 0x000ff000, /* src_mask */
586 0x000ff000, /* dst_mask */
587 FALSE
), /* pcrel_offset */
589 HOWTO (R_ARM_ALU_SBREL_27_20
, /* type */
591 2, /* size (0 = byte, 1 = short, 2 = long) */
593 FALSE
, /* pc_relative */
595 complain_overflow_dont
,/* complain_on_overflow */
596 bfd_elf_generic_reloc
, /* special_function */
597 "R_ARM_ALU_SBREL_27_20",/* name */
598 FALSE
, /* partial_inplace */
599 0x0ff00000, /* src_mask */
600 0x0ff00000, /* dst_mask */
601 FALSE
), /* pcrel_offset */
603 HOWTO (R_ARM_RELABS32
, /* type */
605 2, /* size (0 = byte, 1 = short, 2 = long) */
607 FALSE
, /* pc_relative */
609 complain_overflow_dont
,/* complain_on_overflow */
610 bfd_elf_generic_reloc
, /* special_function */
611 "R_ARM_RELABS32", /* name */
612 FALSE
, /* partial_inplace */
613 0xffffffff, /* src_mask */
614 0xffffffff, /* dst_mask */
615 FALSE
), /* pcrel_offset */
617 HOWTO (R_ARM_ROSEGREL32
, /* type */
619 2, /* size (0 = byte, 1 = short, 2 = long) */
621 FALSE
, /* pc_relative */
623 complain_overflow_dont
,/* complain_on_overflow */
624 bfd_elf_generic_reloc
, /* special_function */
625 "R_ARM_ROSEGREL32", /* name */
626 FALSE
, /* partial_inplace */
627 0xffffffff, /* src_mask */
628 0xffffffff, /* dst_mask */
629 FALSE
), /* pcrel_offset */
631 HOWTO (R_ARM_V4BX
, /* type */
633 2, /* size (0 = byte, 1 = short, 2 = long) */
635 FALSE
, /* pc_relative */
637 complain_overflow_dont
,/* complain_on_overflow */
638 bfd_elf_generic_reloc
, /* special_function */
639 "R_ARM_V4BX", /* name */
640 FALSE
, /* partial_inplace */
641 0xffffffff, /* src_mask */
642 0xffffffff, /* dst_mask */
643 FALSE
), /* pcrel_offset */
646 /* GNU extension to record C++ vtable hierarchy */
647 static reloc_howto_type elf32_arm_vtinherit_howto
=
648 HOWTO (R_ARM_GNU_VTINHERIT
, /* type */
650 2, /* size (0 = byte, 1 = short, 2 = long) */
652 FALSE
, /* pc_relative */
654 complain_overflow_dont
, /* complain_on_overflow */
655 NULL
, /* special_function */
656 "R_ARM_GNU_VTINHERIT", /* name */
657 FALSE
, /* partial_inplace */
660 FALSE
); /* pcrel_offset */
662 /* GNU extension to record C++ vtable member usage */
663 static reloc_howto_type elf32_arm_vtentry_howto
=
664 HOWTO (R_ARM_GNU_VTENTRY
, /* type */
666 2, /* size (0 = byte, 1 = short, 2 = long) */
668 FALSE
, /* pc_relative */
670 complain_overflow_dont
, /* complain_on_overflow */
671 _bfd_elf_rel_vtable_reloc_fn
, /* special_function */
672 "R_ARM_GNU_VTENTRY", /* name */
673 FALSE
, /* partial_inplace */
676 FALSE
); /* pcrel_offset */
678 /* 12 bit pc relative */
679 static reloc_howto_type elf32_arm_thm_pc11_howto
=
680 HOWTO (R_ARM_THM_PC11
, /* type */
682 1, /* size (0 = byte, 1 = short, 2 = long) */
684 TRUE
, /* pc_relative */
686 complain_overflow_signed
, /* complain_on_overflow */
687 bfd_elf_generic_reloc
, /* special_function */
688 "R_ARM_THM_PC11", /* name */
689 FALSE
, /* partial_inplace */
690 0x000007ff, /* src_mask */
691 0x000007ff, /* dst_mask */
692 TRUE
); /* pcrel_offset */
694 /* 12 bit pc relative */
695 static reloc_howto_type elf32_arm_thm_pc9_howto
=
696 HOWTO (R_ARM_THM_PC9
, /* type */
698 1, /* size (0 = byte, 1 = short, 2 = long) */
700 TRUE
, /* pc_relative */
702 complain_overflow_signed
, /* complain_on_overflow */
703 bfd_elf_generic_reloc
, /* special_function */
704 "R_ARM_THM_PC9", /* name */
705 FALSE
, /* partial_inplace */
706 0x000000ff, /* src_mask */
707 0x000000ff, /* dst_mask */
708 TRUE
); /* pcrel_offset */
710 static void elf32_arm_info_to_howto
711 PARAMS ((bfd
*, arelent
*, Elf_Internal_Rela
*));
714 elf32_arm_info_to_howto (abfd
, bfd_reloc
, elf_reloc
)
715 bfd
* abfd ATTRIBUTE_UNUSED
;
717 Elf_Internal_Rela
* elf_reloc
;
721 r_type
= ELF32_R_TYPE (elf_reloc
->r_info
);
725 case R_ARM_GNU_VTINHERIT
:
726 bfd_reloc
->howto
= & elf32_arm_vtinherit_howto
;
729 case R_ARM_GNU_VTENTRY
:
730 bfd_reloc
->howto
= & elf32_arm_vtentry_howto
;
734 bfd_reloc
->howto
= & elf32_arm_thm_pc11_howto
;
738 bfd_reloc
->howto
= & elf32_arm_thm_pc9_howto
;
742 if (r_type
>= NUM_ELEM (elf32_arm_howto_table
))
743 bfd_reloc
->howto
= NULL
;
745 bfd_reloc
->howto
= & elf32_arm_howto_table
[r_type
];
750 struct elf32_arm_reloc_map
752 bfd_reloc_code_real_type bfd_reloc_val
;
753 unsigned char elf_reloc_val
;
756 static const struct elf32_arm_reloc_map elf32_arm_reloc_map
[] =
758 {BFD_RELOC_NONE
, R_ARM_NONE
},
759 {BFD_RELOC_ARM_PCREL_BRANCH
, R_ARM_PC24
},
760 {BFD_RELOC_ARM_PCREL_BLX
, R_ARM_XPC25
},
761 {BFD_RELOC_THUMB_PCREL_BLX
, R_ARM_THM_XPC22
},
762 {BFD_RELOC_32
, R_ARM_ABS32
},
763 {BFD_RELOC_32_PCREL
, R_ARM_REL32
},
764 {BFD_RELOC_8
, R_ARM_ABS8
},
765 {BFD_RELOC_16
, R_ARM_ABS16
},
766 {BFD_RELOC_ARM_OFFSET_IMM
, R_ARM_ABS12
},
767 {BFD_RELOC_ARM_THUMB_OFFSET
, R_ARM_THM_ABS5
},
768 {BFD_RELOC_THUMB_PCREL_BRANCH23
, R_ARM_THM_PC22
},
769 {BFD_RELOC_ARM_COPY
, R_ARM_COPY
},
770 {BFD_RELOC_ARM_GLOB_DAT
, R_ARM_GLOB_DAT
},
771 {BFD_RELOC_ARM_JUMP_SLOT
, R_ARM_JUMP_SLOT
},
772 {BFD_RELOC_ARM_RELATIVE
, R_ARM_RELATIVE
},
773 {BFD_RELOC_ARM_GOTOFF
, R_ARM_GOTOFF
},
774 {BFD_RELOC_ARM_GOTPC
, R_ARM_GOTPC
},
775 {BFD_RELOC_ARM_GOT32
, R_ARM_GOT32
},
776 {BFD_RELOC_ARM_PLT32
, R_ARM_PLT32
},
777 {BFD_RELOC_ARM_RELABS32
, R_ARM_RELABS32
},
778 {BFD_RELOC_ARM_ROSEGREL32
, R_ARM_ROSEGREL32
},
779 {BFD_RELOC_ARM_SBREL32
, R_ARM_SBREL32
}
782 static reloc_howto_type
*
783 elf32_arm_reloc_type_lookup (abfd
, code
)
784 bfd
*abfd ATTRIBUTE_UNUSED
;
785 bfd_reloc_code_real_type code
;
791 case BFD_RELOC_VTABLE_INHERIT
:
792 return & elf32_arm_vtinherit_howto
;
794 case BFD_RELOC_VTABLE_ENTRY
:
795 return & elf32_arm_vtentry_howto
;
797 case BFD_RELOC_THUMB_PCREL_BRANCH12
:
798 return & elf32_arm_thm_pc11_howto
;
800 case BFD_RELOC_THUMB_PCREL_BRANCH9
:
801 return & elf32_arm_thm_pc9_howto
;
804 for (i
= 0; i
< NUM_ELEM (elf32_arm_reloc_map
); i
++)
805 if (elf32_arm_reloc_map
[i
].bfd_reloc_val
== code
)
806 return & elf32_arm_howto_table
[elf32_arm_reloc_map
[i
].elf_reloc_val
];
812 /* Support for core dump NOTE sections */
814 elf32_arm_nabi_grok_prstatus (abfd
, note
)
816 Elf_Internal_Note
*note
;
821 switch (note
->descsz
)
826 case 148: /* Linux/ARM 32-bit*/
828 elf_tdata (abfd
)->core_signal
= bfd_get_16 (abfd
, note
->descdata
+ 12);
831 elf_tdata (abfd
)->core_pid
= bfd_get_32 (abfd
, note
->descdata
+ 24);
840 /* Make a ".reg/999" section. */
841 return _bfd_elfcore_make_pseudosection (abfd
, ".reg",
842 size
, note
->descpos
+ offset
);
846 elf32_arm_nabi_grok_psinfo (abfd
, note
)
848 Elf_Internal_Note
*note
;
850 switch (note
->descsz
)
855 case 124: /* Linux/ARM elf_prpsinfo */
856 elf_tdata (abfd
)->core_program
857 = _bfd_elfcore_strndup (abfd
, note
->descdata
+ 28, 16);
858 elf_tdata (abfd
)->core_command
859 = _bfd_elfcore_strndup (abfd
, note
->descdata
+ 44, 80);
862 /* Note that for some reason, a spurious space is tacked
863 onto the end of the args in some (at least one anyway)
864 implementations, so strip it off if it exists. */
867 char *command
= elf_tdata (abfd
)->core_command
;
868 int n
= strlen (command
);
870 if (0 < n
&& command
[n
- 1] == ' ')
871 command
[n
- 1] = '\0';
877 #define elf_backend_grok_prstatus elf32_arm_nabi_grok_prstatus
878 #define elf_backend_grok_psinfo elf32_arm_nabi_grok_psinfo
880 #include "elf32-arm.h"