OLD | NEW |
1 /* SPARC-specific support for 64-bit ELF | 1 /* SPARC-specific support for 64-bit ELF |
2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | 2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
3 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 | 3 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 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, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 /* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of | 50 /* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of |
51 them. We cannot use generic elf routines for this, because R_SPARC_OLO10 | 51 them. We cannot use generic elf routines for this, because R_SPARC_OLO10 |
52 has secondary addend in ELF64_R_TYPE_DATA. We handle it as two relocations | 52 has secondary addend in ELF64_R_TYPE_DATA. We handle it as two relocations |
53 for the same location, R_SPARC_LO10 and R_SPARC_13. */ | 53 for the same location, R_SPARC_LO10 and R_SPARC_13. */ |
54 | 54 |
55 static bfd_boolean | 55 static bfd_boolean |
56 elf64_sparc_slurp_one_reloc_table (bfd *abfd, asection *asect, | 56 elf64_sparc_slurp_one_reloc_table (bfd *abfd, asection *asect, |
57 Elf_Internal_Shdr *rel_hdr, | 57 Elf_Internal_Shdr *rel_hdr, |
58 asymbol **symbols, bfd_boolean dynamic) | 58 asymbol **symbols, bfd_boolean dynamic) |
59 { | 59 { |
60 PTR allocated = NULL; | 60 void * allocated = NULL; |
61 bfd_byte *native_relocs; | 61 bfd_byte *native_relocs; |
62 arelent *relent; | 62 arelent *relent; |
63 unsigned int i; | 63 unsigned int i; |
64 int entsize; | 64 int entsize; |
65 bfd_size_type count; | 65 bfd_size_type count; |
66 arelent *relents; | 66 arelent *relents; |
67 | 67 |
68 allocated = (PTR) bfd_malloc (rel_hdr->sh_size); | 68 allocated = bfd_malloc (rel_hdr->sh_size); |
69 if (allocated == NULL) | 69 if (allocated == NULL) |
70 goto error_return; | 70 goto error_return; |
71 | 71 |
72 if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0 | 72 if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0 |
73 || bfd_bread (allocated, rel_hdr->sh_size, abfd) != rel_hdr->sh_size) | 73 || bfd_bread (allocated, rel_hdr->sh_size, abfd) != rel_hdr->sh_size) |
74 goto error_return; | 74 goto error_return; |
75 | 75 |
76 native_relocs = (bfd_byte *) allocated; | 76 native_relocs = (bfd_byte *) allocated; |
77 | 77 |
78 relents = asect->relocation + canon_reloc_count (asect); | 78 relents = asect->relocation + canon_reloc_count (asect); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 } | 272 } |
273 | 273 |
274 *storage = NULL; | 274 *storage = NULL; |
275 | 275 |
276 return ret; | 276 return ret; |
277 } | 277 } |
278 | 278 |
279 /* Write out the relocs. */ | 279 /* Write out the relocs. */ |
280 | 280 |
281 static void | 281 static void |
282 elf64_sparc_write_relocs (bfd *abfd, asection *sec, PTR data) | 282 elf64_sparc_write_relocs (bfd *abfd, asection *sec, void * data) |
283 { | 283 { |
284 bfd_boolean *failedp = (bfd_boolean *) data; | 284 bfd_boolean *failedp = (bfd_boolean *) data; |
285 Elf_Internal_Shdr *rela_hdr; | 285 Elf_Internal_Shdr *rela_hdr; |
286 bfd_vma addr_offset; | 286 bfd_vma addr_offset; |
287 Elf64_External_Rela *outbound_relocas, *src_rela; | 287 Elf64_External_Rela *outbound_relocas, *src_rela; |
288 unsigned int idx, count; | 288 unsigned int idx, count; |
289 asymbol *last_sym = 0; | 289 asymbol *last_sym = 0; |
290 int last_sym_idx = 0; | 290 int last_sym_idx = 0; |
291 | 291 |
292 /* If we have already failed, don't do anything. */ | 292 /* If we have already failed, don't do anything. */ |
(...skipping 30 matching lines...) Expand all Loading... |
323 && r->address == addr | 323 && r->address == addr |
324 && bfd_is_abs_section ((*r->sym_ptr_ptr)->section) | 324 && bfd_is_abs_section ((*r->sym_ptr_ptr)->section) |
325 && (*r->sym_ptr_ptr)->value == 0) | 325 && (*r->sym_ptr_ptr)->value == 0) |
326 ++idx; | 326 ++idx; |
327 } | 327 } |
328 } | 328 } |
329 | 329 |
330 rela_hdr = elf_section_data (sec)->rela.hdr; | 330 rela_hdr = elf_section_data (sec)->rela.hdr; |
331 | 331 |
332 rela_hdr->sh_size = rela_hdr->sh_entsize * count; | 332 rela_hdr->sh_size = rela_hdr->sh_entsize * count; |
333 rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size); | 333 rela_hdr->contents = bfd_alloc (abfd, rela_hdr->sh_size); |
334 if (rela_hdr->contents == NULL) | 334 if (rela_hdr->contents == NULL) |
335 { | 335 { |
336 *failedp = TRUE; | 336 *failedp = TRUE; |
337 return; | 337 return; |
338 } | 338 } |
339 | 339 |
340 /* Figure out whether the relocations are RELA or REL relocations. */ | 340 /* Figure out whether the relocations are RELA or REL relocations. */ |
341 if (rela_hdr->sh_type != SHT_RELA) | 341 if (rela_hdr->sh_type != SHT_RELA) |
342 abort (); | 342 abort (); |
343 | 343 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 (_("Symbol `%s' has differing types: %s in %B, previously REGISTER
in %B"), | 535 (_("Symbol `%s' has differing types: %s in %B, previously REGISTER
in %B"), |
536 abfd, p->abfd, *namep, stt_types[type]); | 536 abfd, p->abfd, *namep, stt_types[type]); |
537 return FALSE; | 537 return FALSE; |
538 } | 538 } |
539 } | 539 } |
540 return TRUE; | 540 return TRUE; |
541 } | 541 } |
542 | 542 |
543 /* This function takes care of emitting STT_REGISTER symbols | 543 /* This function takes care of emitting STT_REGISTER symbols |
544 which we cannot easily keep in the symbol hash table. */ | 544 which we cannot easily keep in the symbol hash table. */ |
error: old chunk mismatch |
None
OLD | NEW |