OLD | NEW |
1 /* CRIS-specific support for 32-bit ELF. | 1 /* CRIS-specific support for 32-bit ELF. |
2 Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, | 2 Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, |
3 2010, 2011 Free Software Foundation, Inc. | 3 2010, 2011, 2012 Free Software Foundation, Inc. |
4 Contributed by Axis Communications AB. | 4 Contributed by Axis Communications AB. |
5 Written by Hans-Peter Nilsson, based on elf32-fr30.c | 5 Written by Hans-Peter Nilsson, based on elf32-fr30.c |
6 PIC and shlib bits based primarily on elf32-m68k.c and elf32-i386.c. | 6 PIC and shlib bits based primarily on elf32-m68k.c and elf32-i386.c. |
7 | 7 |
8 This file is part of BFD, the Binary File Descriptor library. | 8 This file is part of BFD, the Binary File Descriptor library. |
9 | 9 |
10 This program is free software; you can redistribute it and/or modify | 10 This program is free software; you can redistribute it and/or modify |
11 it under the terms of the GNU General Public License as published by | 11 it under the terms of the GNU General Public License as published by |
12 the Free Software Foundation; either version 3 of the License, or | 12 the Free Software Foundation; either version 3 of the License, or |
13 (at your option) any later version. | 13 (at your option) any later version. |
14 | 14 |
15 This program is distributed in the hope that it will be useful, | 15 This program is distributed in the hope that it will be useful, |
16 but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 GNU General Public License for more details. | 18 GNU General Public License for more details. |
19 | 19 |
20 You should have received a copy of the GNU General Public License | 20 You should have received a copy of the GNU General Public License |
21 along with this program; if not, write to the Free Software | 21 along with this program; if not, write to the Free Software |
22 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | 22 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
23 MA 02110-1301, USA. */ | 23 MA 02110-1301, USA. */ |
24 | 24 |
25 #include "sysdep.h" | 25 #include "sysdep.h" |
26 #include "bfd.h" | 26 #include "bfd.h" |
27 #include "libbfd.h" | 27 #include "libbfd.h" |
28 #include "elf-bfd.h" | 28 #include "elf-bfd.h" |
29 #include "elf/cris.h" | 29 #include "elf/cris.h" |
30 #include <limits.h> | 30 #include <limits.h> |
31 | 31 |
| 32 bfd_reloc_status_type |
| 33 cris_elf_pcrel_reloc (bfd *, arelent *, asymbol *, void *, |
| 34 asection *, bfd *, char **); |
| 35 static bfd_boolean |
| 36 cris_elf_set_mach_from_flags (bfd *, unsigned long); |
| 37 |
32 /* Forward declarations. */ | 38 /* Forward declarations. */ |
33 static reloc_howto_type * cris_reloc_type_lookup | |
34 PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); | |
35 | |
36 static void cris_info_to_howto_rela | |
37 PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); | |
38 | |
39 static bfd_reloc_status_type cris_elf_pcrel_reloc | |
40 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | |
41 | |
42 static bfd_boolean cris_elf_grok_prstatus | |
43 PARAMS ((bfd *abfd, Elf_Internal_Note *note)); | |
44 | |
45 static bfd_boolean cris_elf_grok_psinfo | |
46 PARAMS ((bfd *abfd, Elf_Internal_Note *note)); | |
47 | |
48 static bfd_boolean cris_elf_relocate_section | |
49 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, | |
50 Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); | |
51 | |
52 static bfd_reloc_status_type cris_final_link_relocate | |
53 PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, | |
54 Elf_Internal_Rela *, bfd_vma)); | |
55 | |
56 static bfd_boolean cris_elf_object_p PARAMS ((bfd *)); | |
57 | |
58 static void cris_elf_final_write_processing PARAMS ((bfd *, bfd_boolean)); | |
59 | |
60 static bfd_boolean cris_elf_set_mach_from_flags | |
61 PARAMS ((bfd *, unsigned long int)); | |
62 | |
63 static bfd_boolean cris_elf_print_private_bfd_data PARAMS ((bfd *, PTR)); | |
64 | |
65 static bfd_boolean cris_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *)); | |
66 static bfd_boolean cris_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *)); | |
67 | |
68 struct elf_cris_link_hash_entry; | |
69 static bfd_boolean elf_cris_discard_excess_dso_dynamics | |
70 PARAMS ((struct elf_cris_link_hash_entry *, PTR)); | |
71 static bfd_boolean elf_cris_discard_excess_program_dynamics | |
72 PARAMS ((struct elf_cris_link_hash_entry *, PTR)); | |
73 static bfd_boolean elf_cris_adjust_gotplt_to_got | |
74 PARAMS ((struct elf_cris_link_hash_entry *, PTR)); | |
75 static bfd_boolean elf_cris_try_fold_plt_to_got | |
76 PARAMS ((struct elf_cris_link_hash_entry *, PTR)); | |
77 static struct bfd_hash_entry *elf_cris_link_hash_newfunc | |
78 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); | |
79 static struct bfd_link_hash_table *elf_cris_link_hash_table_create | |
80 PARAMS ((bfd *)); | |
81 static bfd_boolean elf_cris_adjust_dynamic_symbol | |
82 PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); | |
83 static bfd_boolean cris_elf_check_relocs | |
84 PARAMS ((bfd *, struct bfd_link_info *, asection *, | |
85 const Elf_Internal_Rela *)); | |
86 | |
87 static bfd_boolean elf_cris_size_dynamic_sections | |
88 PARAMS ((bfd *, struct bfd_link_info *)); | |
89 static bfd_boolean elf_cris_finish_dynamic_symbol | |
90 PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, | |
91 Elf_Internal_Sym *)); | |
92 static bfd_boolean elf_cris_finish_dynamic_sections | |
93 PARAMS ((bfd *, struct bfd_link_info *)); | |
94 static void elf_cris_hide_symbol | |
95 PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean)); | |
96 static enum elf_reloc_type_class elf_cris_reloc_type_class | |
97 PARAMS ((const Elf_Internal_Rela *)); | |
98 | |
99 static reloc_howto_type cris_elf_howto_table [] = | 39 static reloc_howto_type cris_elf_howto_table [] = |
100 { | 40 { |
101 /* This reloc does nothing. */ | 41 /* This reloc does nothing. */ |
102 HOWTO (R_CRIS_NONE, /* type */ | 42 HOWTO (R_CRIS_NONE, /* type */ |
103 0, /* rightshift */ | 43 0, /* rightshift */ |
104 2, /* size (0 = byte, 1 = short, 2 = long) */ | 44 2, /* size (0 = byte, 1 = short, 2 = long) */ |
105 32, /* bitsize */ | 45 32, /* bitsize */ |
106 FALSE, /* pc_relative */ | 46 FALSE, /* pc_relative */ |
107 0, /* bitpos */ | 47 0, /* bitpos */ |
108 complain_overflow_bitfield, /* complain_on_overflow */ | 48 complain_overflow_bitfield, /* complain_on_overflow */ |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 { BFD_RELOC_CRIS_16_GOT_GD, R_CRIS_16_GOT_GD }, | 415 { BFD_RELOC_CRIS_16_GOT_GD, R_CRIS_16_GOT_GD }, |
476 { BFD_RELOC_CRIS_32_GD, R_CRIS_32_GD }, | 416 { BFD_RELOC_CRIS_32_GD, R_CRIS_32_GD }, |
477 { BFD_RELOC_CRIS_DTP, R_CRIS_DTP }, | 417 { BFD_RELOC_CRIS_DTP, R_CRIS_DTP }, |
478 { BFD_RELOC_CRIS_32_DTPREL, R_CRIS_32_DTPREL }, | 418 { BFD_RELOC_CRIS_32_DTPREL, R_CRIS_32_DTPREL }, |
479 { BFD_RELOC_CRIS_16_DTPREL, R_CRIS_16_DTPREL }, | 419 { BFD_RELOC_CRIS_16_DTPREL, R_CRIS_16_DTPREL }, |
480 { BFD_RELOC_CRIS_32_GOT_TPREL, R_CRIS_32_GOT_TPREL }, | 420 { BFD_RELOC_CRIS_32_GOT_TPREL, R_CRIS_32_GOT_TPREL }, |
481 { BFD_RELOC_CRIS_16_GOT_TPREL, R_CRIS_16_GOT_TPREL }, | 421 { BFD_RELOC_CRIS_16_GOT_TPREL, R_CRIS_16_GOT_TPREL }, |
482 { BFD_RELOC_CRIS_32_TPREL, R_CRIS_32_TPREL }, | 422 { BFD_RELOC_CRIS_32_TPREL, R_CRIS_32_TPREL }, |
483 { BFD_RELOC_CRIS_16_TPREL, R_CRIS_16_TPREL }, | 423 { BFD_RELOC_CRIS_16_TPREL, R_CRIS_16_TPREL }, |
484 { BFD_RELOC_CRIS_DTPMOD, R_CRIS_DTPMOD }, | 424 { BFD_RELOC_CRIS_DTPMOD, R_CRIS_DTPMOD }, |
error: old chunk mismatch |
None
OLD | NEW |