Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: bfd/elf-m10200.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « bfd/elf-eh-frame.c ('k') | bfd/elf-m10300.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
None
OLDNEW
1 /* Matsushita 10200 specific support for 32-bit ELF 1 /* Matsushita 10200 specific support for 32-bit ELF
2 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
3 2007, 2010 3 2007, 2010, 2012
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 5
6 This file is part of BFD, the Binary File Descriptor library. 6 This file is part of BFD, the Binary File Descriptor library.
7 7
8 This program is free software; you can redistribute it and/or modify 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 9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or 10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version. 11 (at your option) any later version.
12 12
13 This program is distributed in the hope that it will be useful, 13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17 17
18 You should have received a copy of the GNU General Public License 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 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 MA 02110-1301, USA. */ 21 MA 02110-1301, USA. */
22 22
23 #include "sysdep.h" 23 #include "sysdep.h"
24 #include "bfd.h" 24 #include "bfd.h"
25 #include "libbfd.h" 25 #include "libbfd.h"
26 #include "elf-bfd.h" 26 #include "elf-bfd.h"
27 27
28 static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup 28 static bfd_boolean
29 PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); 29 mn10200_elf_relax_delete_bytes (bfd *, asection *, bfd_vma, int);
30 static void mn10200_info_to_howto 30 static bfd_boolean
31 PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); 31 mn10200_elf_symbol_address_p (bfd *, asection *, Elf_Internal_Sym *, bfd_vma);
32 static bfd_boolean mn10200_elf_relax_delete_bytes
33 PARAMS ((bfd *, asection *, bfd_vma, int));
34 static bfd_boolean mn10200_elf_symbol_address_p
35 PARAMS ((bfd *, asection *, Elf_Internal_Sym *, bfd_vma));
36 static bfd_reloc_status_type mn10200_elf_final_link_relocate
37 PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *,
38 » bfd_byte *, bfd_vma, bfd_vma, bfd_vma,
39 » struct bfd_link_info *, asection *, int));
40 static bfd_boolean mn10200_elf_relocate_section
41 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
42 » bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *,
43 » asection **));
44 static bfd_boolean mn10200_elf_relax_section
45 PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
46 static bfd_byte * mn10200_elf_get_relocated_section_contents
47 PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
48 » bfd_byte *, bfd_boolean, asymbol **));
49 32
50 enum reloc_type { 33 enum reloc_type
34 {
51 R_MN10200_NONE = 0, 35 R_MN10200_NONE = 0,
52 R_MN10200_32, 36 R_MN10200_32,
53 R_MN10200_16, 37 R_MN10200_16,
54 R_MN10200_8, 38 R_MN10200_8,
55 R_MN10200_24, 39 R_MN10200_24,
56 R_MN10200_PCREL8, 40 R_MN10200_PCREL8,
57 R_MN10200_PCREL16, 41 R_MN10200_PCREL16,
58 R_MN10200_PCREL24, 42 R_MN10200_PCREL24,
59 R_MN10200_MAX 43 R_MN10200_MAX
60 }; 44 };
61 45
62 static reloc_howto_type elf_mn10200_howto_table[] = { 46 static reloc_howto_type elf_mn10200_howto_table[] =
47 {
63 /* Dummy relocation. Does nothing. */ 48 /* Dummy relocation. Does nothing. */
64 HOWTO (R_MN10200_NONE, 49 HOWTO (R_MN10200_NONE,
65 0, 50 0,
66 2, 51 2,
67 16, 52 16,
68 FALSE, 53 FALSE,
69 0, 54 0,
70 complain_overflow_bitfield, 55 complain_overflow_bitfield,
71 bfd_elf_generic_reloc, 56 bfd_elf_generic_reloc,
72 "R_MN10200_NONE", 57 "R_MN10200_NONE",
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 0, 153 0,
169 complain_overflow_bitfield, 154 complain_overflow_bitfield,
170 bfd_elf_generic_reloc, 155 bfd_elf_generic_reloc,
171 "R_MN10200_PCREL24", 156 "R_MN10200_PCREL24",
172 FALSE, 157 FALSE,
173 0xffffff, 158 0xffffff,
174 0xffffff, 159 0xffffff,
175 TRUE), 160 TRUE),
176 }; 161 };
177 162
178 struct mn10200_reloc_map { 163 struct mn10200_reloc_map
164 {
179 bfd_reloc_code_real_type bfd_reloc_val; 165 bfd_reloc_code_real_type bfd_reloc_val;
180 unsigned char elf_reloc_val; 166 unsigned char elf_reloc_val;
181 }; 167 };
182 168
183 static const struct mn10200_reloc_map mn10200_reloc_map[] = { 169 static const struct mn10200_reloc_map mn10200_reloc_map[] =
170 {
184 { BFD_RELOC_NONE , R_MN10200_NONE , }, 171 { BFD_RELOC_NONE , R_MN10200_NONE , },
185 { BFD_RELOC_32 , R_MN10200_32 , }, 172 { BFD_RELOC_32 , R_MN10200_32 , },
186 { BFD_RELOC_16 , R_MN10200_16 , }, 173 { BFD_RELOC_16 , R_MN10200_16 , },
187 { BFD_RELOC_8 , R_MN10200_8 , }, 174 { BFD_RELOC_8 , R_MN10200_8 , },
188 { BFD_RELOC_24 , R_MN10200_24 , }, 175 { BFD_RELOC_24 , R_MN10200_24 , },
189 { BFD_RELOC_8_PCREL , R_MN10200_PCREL8 , }, 176 { BFD_RELOC_8_PCREL , R_MN10200_PCREL8 , },
190 { BFD_RELOC_16_PCREL, R_MN10200_PCREL16, }, 177 { BFD_RELOC_16_PCREL, R_MN10200_PCREL16, },
191 { BFD_RELOC_24_PCREL, R_MN10200_PCREL24, }, 178 { BFD_RELOC_24_PCREL, R_MN10200_PCREL24, },
192 }; 179 };
193 180
194 static reloc_howto_type * 181 static reloc_howto_type *
195 bfd_elf32_bfd_reloc_type_lookup (abfd, code) 182 bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
196 bfd *abfd ATTRIBUTE_UNUSED; 183 » » » » bfd_reloc_code_real_type code)
197 bfd_reloc_code_real_type code;
198 { 184 {
199 unsigned int i; 185 unsigned int i;
200 186
201 for (i = 0; 187 for (i = 0;
202 i < sizeof (mn10200_reloc_map) / sizeof (struct mn10200_reloc_map); 188 i < sizeof (mn10200_reloc_map) / sizeof (struct mn10200_reloc_map);
203 i++) 189 i++)
204 { 190 {
205 if (mn10200_reloc_map[i].bfd_reloc_val == code) 191 if (mn10200_reloc_map[i].bfd_reloc_val == code)
206 return &elf_mn10200_howto_table[mn10200_reloc_map[i].elf_reloc_val]; 192 return &elf_mn10200_howto_table[mn10200_reloc_map[i].elf_reloc_val];
207 } 193 }
(...skipping 14 matching lines...) Expand all
222 if (elf_mn10200_howto_table[i].name != NULL 208 if (elf_mn10200_howto_table[i].name != NULL
223 && strcasecmp (elf_mn10200_howto_table[i].name, r_name) == 0) 209 && strcasecmp (elf_mn10200_howto_table[i].name, r_name) == 0)
224 return &elf_mn10200_howto_table[i]; 210 return &elf_mn10200_howto_table[i];
225 211
226 return NULL; 212 return NULL;
227 } 213 }
228 214
229 /* Set the howto pointer for an MN10200 ELF reloc. */ 215 /* Set the howto pointer for an MN10200 ELF reloc. */
230 216
231 static void 217 static void
232 mn10200_info_to_howto (abfd, cache_ptr, dst) 218 mn10200_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
233 bfd *abfd ATTRIBUTE_UNUSED; 219 » » arelent *cache_ptr,
234 arelent *cache_ptr; 220 » » Elf_Internal_Rela *dst)
235 Elf_Internal_Rela *dst;
236 { 221 {
237 unsigned int r_type; 222 unsigned int r_type;
238 223
239 r_type = ELF32_R_TYPE (dst->r_info); 224 r_type = ELF32_R_TYPE (dst->r_info);
240 BFD_ASSERT (r_type < (unsigned int) R_MN10200_MAX); 225 BFD_ASSERT (r_type < (unsigned int) R_MN10200_MAX);
241 cache_ptr->howto = &elf_mn10200_howto_table[r_type]; 226 cache_ptr->howto = &elf_mn10200_howto_table[r_type];
242 } 227 }
243 228
244 /* Perform a relocation as part of a final link. */ 229 /* Perform a relocation as part of a final link. */
245 230
246 static bfd_reloc_status_type 231 static bfd_reloc_status_type
247 mn10200_elf_final_link_relocate (howto, input_bfd, output_bfd, 232 mn10200_elf_final_link_relocate (reloc_howto_type *howto,
248 » » » » input_section, contents, offset, value, 233 » » » » bfd *input_bfd,
249 » » » » addend, info, sym_sec, is_local) 234 » » » » bfd *output_bfd ATTRIBUTE_UNUSED,
250 reloc_howto_type *howto; 235 » » » » asection *input_section,
251 bfd *input_bfd; 236 » » » » bfd_byte *contents,
252 bfd *output_bfd ATTRIBUTE_UNUSED; 237 » » » » bfd_vma offset,
253 asection *input_section; 238 » » » » bfd_vma value,
254 bfd_byte *contents; 239 » » » » bfd_vma addend,
255 bfd_vma offset; 240 » » » » struct bfd_link_info *info ATTRIBUTE_UNUSED,
256 bfd_vma value; 241 » » » » asection *sym_sec ATTRIBUTE_UNUSED,
257 bfd_vma addend; 242 » » » » int is_local ATTRIBUTE_UNUSED)
258 struct bfd_link_info *info ATTRIBUTE_UNUSED;
259 asection *sym_sec ATTRIBUTE_UNUSED;
260 int is_local ATTRIBUTE_UNUSED;
261 { 243 {
262 unsigned long r_type = howto->type; 244 unsigned long r_type = howto->type;
263 bfd_byte *hit_data = contents + offset; 245 bfd_byte *hit_data = contents + offset;
264 246
265 switch (r_type) 247 switch (r_type)
266 { 248 {
267 249
268 case R_MN10200_NONE: 250 case R_MN10200_NONE:
269 return bfd_reloc_ok; 251 return bfd_reloc_ok;
270 252
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 319
338 value &= 0xffffff; 320 value &= 0xffffff;
339 value |= (bfd_get_32 (input_bfd, hit_data) & 0xff000000); 321 value |= (bfd_get_32 (input_bfd, hit_data) & 0xff000000);
340 bfd_put_32 (input_bfd, value, hit_data); 322 bfd_put_32 (input_bfd, value, hit_data);
341 return bfd_reloc_ok; 323 return bfd_reloc_ok;
342 324
343 default: 325 default:
344 return bfd_reloc_notsupported; 326 return bfd_reloc_notsupported;
345 } 327 }
346 } 328 }

error: old chunk mismatch

OLDNEW
« no previous file with comments | « bfd/elf-eh-frame.c ('k') | bfd/elf-m10300.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698