OLD | NEW |
1 /* Morpho Technologies MT specific support for 32-bit ELF | 1 /* Morpho Technologies MT specific support for 32-bit ELF |
2 Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 | 2 Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 |
3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of BFD, the Binary File Descriptor library. | 5 This file is part of BFD, the Binary File Descriptor library. |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
11 | 11 |
12 This program is distributed in the hope that it will be useful, | 12 This program is distributed in the hope that it will be useful, |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 GNU General Public License for more details. | 15 GNU General Public License for more details. |
16 | 16 |
17 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
18 along with this program; if not, write to the Free Software | 18 along with this program; if not, write to the Free Software |
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, | 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
20 MA 02111-1307, USA. */ | 20 MA 02111-1307, USA. */ |
21 | 21 |
22 #include "sysdep.h" | 22 #include "sysdep.h" |
23 #include "bfd.h" | 23 #include "bfd.h" |
24 #include "libbfd.h" | 24 #include "libbfd.h" |
25 #include "elf-bfd.h" | 25 #include "elf-bfd.h" |
26 #include "elf/mt.h" | 26 #include "elf/mt.h" |
27 | 27 |
28 /* Prototypes. */ | 28 /* Prototypes. */ |
29 static reloc_howto_type * mt_reloc_type_lookup | 29 static reloc_howto_type * mt_reloc_type_lookup |
30 (bfd *, bfd_reloc_code_real_type); | 30 (bfd *, bfd_reloc_code_real_type); |
31 | 31 |
32 static void mt_info_to_howto_rela | 32 static void mt_info_to_howto_rela |
33 (bfd *, arelent *, Elf_Internal_Rela *); | 33 (bfd *, arelent *, Elf_Internal_Rela *); |
34 | 34 |
35 static bfd_reloc_status_type mt_elf_relocate_hi16 | 35 static bfd_reloc_status_type mt_elf_relocate_hi16 |
36 (bfd *, Elf_Internal_Rela *, bfd_byte *, bfd_vma); | 36 (bfd *, Elf_Internal_Rela *, bfd_byte *, bfd_vma); |
37 | 37 |
38 static bfd_reloc_status_type mt_final_link_relocate | 38 static bfd_reloc_status_type mt_final_link_relocate |
39 (reloc_howto_type *, bfd *, asection *, bfd_byte *, | 39 (reloc_howto_type *, bfd *, asection *, bfd_byte *, |
40 Elf_Internal_Rela *, bfd_vma); | 40 Elf_Internal_Rela *, bfd_vma); |
41 | 41 |
42 static bfd_boolean mt_elf_relocate_section | 42 static bfd_boolean mt_elf_relocate_section |
43 (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, | 43 (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, |
44 Elf_Internal_Rela *, Elf_Internal_Sym *, asection **); | 44 Elf_Internal_Rela *, Elf_Internal_Sym *, asection **); |
45 | 45 |
46 /* Relocation tables. */ | 46 /* Relocation tables. */ |
47 static reloc_howto_type mt_elf_howto_table [] = | 47 static reloc_howto_type mt_elf_howto_table [] = |
48 { | 48 { |
49 /* This reloc does nothing. */ | 49 /* This reloc does nothing. */ |
50 HOWTO (R_MT_NONE, /* type */ | 50 HOWTO (R_MT_NONE, /* type */ |
51 0, /* rightshift */ | 51 0, /* rightshift */ |
52 2, /* size (0 = byte, 1 = short, 2 = long) */ | 52 2, /* size (0 = byte, 1 = short, 2 = long) */ |
53 32, /* bitsize */ | 53 32, /* bitsize */ |
54 FALSE, /* pc_relative */ | 54 FALSE, /* pc_relative */ |
55 0, /* bitpos */ | 55 0, /* bitpos */ |
56 complain_overflow_dont, /* complain_on_overflow */ | 56 complain_overflow_dont, /* complain_on_overflow */ |
57 bfd_elf_generic_reloc, /* special_function */ | 57 bfd_elf_generic_reloc, /* special_function */ |
58 "R_MT_NONE", /* name */ | 58 "R_MT_NONE", /* name */ |
59 FALSE, /* partial_inplace */ | 59 FALSE, /* partial_inplace */ |
60 0 , /* src_mask */ | 60 0 , /* src_mask */ |
61 0, /* dst_mask */ | 61 0, /* dst_mask */ |
62 FALSE), /* pcrel_offset */ | 62 FALSE), /* pcrel_offset */ |
63 | 63 |
64 /* A 16 bit absolute relocation. */ | 64 /* A 16 bit absolute relocation. */ |
65 HOWTO (R_MT_16, /* type */ | 65 HOWTO (R_MT_16, /* type */ |
66 0, /* rightshift */ | 66 0, /* rightshift */ |
67 2, /* size (0 = byte, 1 = short, 2 = long) */ | 67 2, /* size (0 = byte, 1 = short, 2 = long) */ |
68 16, /* bitsize */ | 68 16, /* bitsize */ |
69 FALSE, /* pc_relative */ | 69 FALSE, /* pc_relative */ |
70 0, /* bitpos */ | 70 0, /* bitpos */ |
71 complain_overflow_dont, /* complain_on_overflow */ | 71 complain_overflow_dont, /* complain_on_overflow */ |
72 bfd_elf_generic_reloc, /* special_function */ | 72 bfd_elf_generic_reloc, /* special_function */ |
73 "R_MT_16", /* name */ | 73 "R_MT_16", /* name */ |
74 FALSE, /* partial_inplace */ | 74 FALSE, /* partial_inplace */ |
75 0 , /* src_mask */ | 75 0 , /* src_mask */ |
76 0xffff, /* dst_mask */ | 76 0xffff, /* dst_mask */ |
77 FALSE), /* pcrel_offset */ | 77 FALSE), /* pcrel_offset */ |
78 | 78 |
79 /* A 32 bit absolute relocation. */ | 79 /* A 32 bit absolute relocation. */ |
80 HOWTO (R_MT_32, /* type */ | 80 HOWTO (R_MT_32, /* type */ |
81 0, /* rightshift */ | 81 0, /* rightshift */ |
82 2, /* size (0 = byte, 1 = short, 2 = long) */ | 82 2, /* size (0 = byte, 1 = short, 2 = long) */ |
83 32, /* bitsize */ | 83 32, /* bitsize */ |
84 FALSE, /* pc_relative */ | 84 FALSE, /* pc_relative */ |
85 0, /* bitpos */ | 85 0, /* bitpos */ |
86 complain_overflow_dont, /* complain_on_overflow */ | 86 complain_overflow_dont, /* complain_on_overflow */ |
87 bfd_elf_generic_reloc, /* special_function */ | 87 bfd_elf_generic_reloc, /* special_function */ |
88 "R_MT_32", /* name */ | 88 "R_MT_32", /* name */ |
89 FALSE, /* partial_inplace */ | 89 FALSE, /* partial_inplace */ |
90 0 , /* src_mask */ | 90 0 , /* src_mask */ |
91 0xffffffff, /* dst_mask */ | 91 0xffffffff, /* dst_mask */ |
92 FALSE), /* pcrel_offset */ | 92 FALSE), /* pcrel_offset */ |
93 | 93 |
94 /* A 32 bit pc-relative relocation. */ | 94 /* A 32 bit pc-relative relocation. */ |
95 HOWTO (R_MT_32_PCREL, /* type */ | 95 HOWTO (R_MT_32_PCREL, /* type */ |
96 0, /* rightshift */ | 96 0, /* rightshift */ |
97 2, /* size (0 = byte, 1 = short, 2 = long) */ | 97 2, /* size (0 = byte, 1 = short, 2 = long) */ |
98 32, /* bitsize */ | 98 32, /* bitsize */ |
99 TRUE, /* pc_relative */ | 99 TRUE, /* pc_relative */ |
100 0, /* bitpos */ | 100 0, /* bitpos */ |
101 complain_overflow_dont, /* complain_on_overflow */ | 101 complain_overflow_dont, /* complain_on_overflow */ |
102 bfd_elf_generic_reloc, /* special_function */ | 102 bfd_elf_generic_reloc, /* special_function */ |
103 "R_MT_32_PCREL", /* name */ | 103 "R_MT_32_PCREL", /* name */ |
104 FALSE, /* partial_inplace */ | 104 FALSE, /* partial_inplace */ |
105 0 , /* src_mask */ | 105 0 , /* src_mask */ |
106 0xffffffff, /* dst_mask */ | 106 0xffffffff, /* dst_mask */ |
107 TRUE), /* pcrel_offset */ | 107 TRUE), /* pcrel_offset */ |
108 | 108 |
109 /* A 16 bit pc-relative relocation. */ | 109 /* A 16 bit pc-relative relocation. */ |
110 HOWTO (R_MT_PC16, /* type */ | 110 HOWTO (R_MT_PC16, /* type */ |
111 0, /* rightshift */ | 111 0, /* rightshift */ |
112 2, /* size (0 = byte, 1 = short, 2 = long) */ | 112 2, /* size (0 = byte, 1 = short, 2 = long) */ |
113 16, /* bitsize */ | 113 16, /* bitsize */ |
114 TRUE, /* pc_relative */ | 114 TRUE, /* pc_relative */ |
115 0, /* bitpos */ | 115 0, /* bitpos */ |
116 complain_overflow_signed, /* complain_on_overflow */ | 116 complain_overflow_signed, /* complain_on_overflow */ |
117 bfd_elf_generic_reloc, /* special_function */ | 117 bfd_elf_generic_reloc, /* special_function */ |
118 "R_MT_PC16", /* name */ | 118 "R_MT_PC16", /* name */ |
119 FALSE, /* partial_inplace */ | 119 FALSE, /* partial_inplace */ |
120 0, /* src_mask */ | 120 0, /* src_mask */ |
121 0xffff, /* dst_mask */ | 121 0xffff, /* dst_mask */ |
122 TRUE), /* pcrel_offset */ | 122 TRUE), /* pcrel_offset */ |
123 | 123 |
124 /* high 16 bits of symbol value. */ | 124 /* high 16 bits of symbol value. */ |
125 HOWTO (R_MT_HI16, /* type */ | 125 HOWTO (R_MT_HI16, /* type */ |
126 0, /* rightshift */ | 126 0, /* rightshift */ |
127 2, /* size (0 = byte, 1 = short, 2 = long) */ | 127 2, /* size (0 = byte, 1 = short, 2 = long) */ |
128 16, /* bitsize */ | 128 16, /* bitsize */ |
129 FALSE, /* pc_relative */ | 129 FALSE, /* pc_relative */ |
130 0, /* bitpos */ | 130 0, /* bitpos */ |
131 complain_overflow_dont, /* complain_on_overflow */ | 131 complain_overflow_dont, /* complain_on_overflow */ |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 sym_hashes = elf_sym_hashes (input_bfd); | 311 sym_hashes = elf_sym_hashes (input_bfd); |
312 relend = relocs + input_section->reloc_count; | 312 relend = relocs + input_section->reloc_count; |
313 | 313 |
314 for (rel = relocs; rel < relend; rel ++) | 314 for (rel = relocs; rel < relend; rel ++) |
315 { | 315 { |
316 reloc_howto_type * howto; | 316 reloc_howto_type * howto; |
317 unsigned long r_symndx; | 317 unsigned long r_symndx; |
318 Elf_Internal_Sym * sym; | 318 Elf_Internal_Sym * sym; |
319 asection * sec; | 319 asection * sec; |
320 struct elf_link_hash_entry * h; | 320 struct elf_link_hash_entry * h; |
error: old chunk mismatch |
None
OLD | NEW |