diff options
author | Alan Modra <amodra@gmail.com> | 2008-10-20 10:57:33 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2008-10-20 10:57:33 +0000 |
commit | 58217f292890a480df33735fd9292a4173f6b210 (patch) | |
tree | c1a1f72426c417df209647f252225d266ca995ca | |
parent | bef264833bf5549bfef8e3495d514ff4a3b72e9f (diff) | |
download | gdb-58217f292890a480df33735fd9292a4173f6b210.zip gdb-58217f292890a480df33735fd9292a4173f6b210.tar.gz gdb-58217f292890a480df33735fd9292a4173f6b210.tar.bz2 |
* elflink.c (bfd_elf_final_link): Move code reading relocs to..
* elf32-spu.c (spu_elf_count_relocs): ..here. Adjust params.
* elf-bfd.h (struct elf_backend_data): Update elf_backend_count_relocs
params.
-rw-r--r-- | bfd/ChangeLog | 14 | ||||
-rw-r--r-- | bfd/elf-bfd.h | 2 | ||||
-rw-r--r-- | bfd/elf32-spu.c | 23 | ||||
-rw-r--r-- | bfd/elflink.c | 17 |
4 files changed, 30 insertions, 26 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9447166..bd6e909 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,12 @@ 2008-10-20 Alan Modra <amodra@bigpond.net.au> + * elflink.c (bfd_elf_final_link): Move code reading relocs to.. + * elf32-spu.c (spu_elf_count_relocs): ..here. Adjust params. + * elf-bfd.h (struct elf_backend_data): Update elf_backend_count_relocs + params. + +2008-10-20 Alan Modra <amodra@bigpond.net.au> + * elflink.c (bfd_elf_final_link): Use d_ptr rather than d_val where Elf_Internal_Dyn holds an address. @@ -10,7 +17,8 @@ 2008-10-09 Kai Tietz <kai.tietz@onevision.com> - * cofflink.c (_bfd_coff_generic_relocate_section): Dump bfd_vma sized addresses instead of long sized. + * cofflink.c (_bfd_coff_generic_relocate_section): Dump bfd_vma + sized addresses instead of long sized. 2008-10-09 Alan Modra <amodra@bigpond.net.au> @@ -191,7 +199,7 @@ BFD_MACH_O_x86_EXCEPTION_STATE. (bfd_mach_o_load_command_type): Add BFD_MACH_O_LC_SEGMENT_64, BFD_MACH_O_LC_ROUTINES_64, - BFD_MACH_O_LC_UUID. + BFD_MACH_O_LC_UUID. (BFD_MACH_O_CPU_IS64BIT): Added. (bfd_mach_o_cpu_type): Add BFD_MACH_O_CPU_TYPE_POWERPC_64, BFD_MACH_O_CPU_TYPE_X86_64. @@ -223,7 +231,7 @@ (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_scan): Ditto. (bfd_mach_o_lookup_section): Ditto. - + 2008-08-27 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> * elf-hppa.h (elf_hppa_reloc_final_type): Handle R_PARISC_GPREL64, diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 993458e..9615a4a 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1012,7 +1012,7 @@ struct elf_backend_data /* Count relocations. Not called for relocatable links or if all relocs are being preserved in the output. */ unsigned int (*elf_backend_count_relocs) - (asection *, Elf_Internal_Rela *); + (struct bfd_link_info *, asection *); /* This function, if defined, is called when an NT_PRSTATUS note is found in a core file. */ diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c index 00681b2..708ab24 100644 --- a/bfd/elf32-spu.c +++ b/bfd/elf32-spu.c @@ -3895,16 +3895,27 @@ spu_elf_final_link (bfd *output_bfd, struct bfd_link_info *info) that need to be emitted. */ static unsigned int -spu_elf_count_relocs (asection *sec, Elf_Internal_Rela *relocs) +spu_elf_count_relocs (struct bfd_link_info *info, asection *sec) { + Elf_Internal_Rela *relocs; unsigned int count = 0; - Elf_Internal_Rela *relend = relocs + sec->reloc_count; - for (; relocs < relend; relocs++) + relocs = _bfd_elf_link_read_relocs (sec->owner, sec, NULL, NULL, + info->keep_memory); + if (relocs != NULL) { - int r_type = ELF32_R_TYPE (relocs->r_info); - if (r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64) - ++count; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend = relocs + sec->reloc_count; + + for (rel = relocs; rel < relend; rel++) + { + int r_type = ELF32_R_TYPE (rel->r_info); + if (r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64) + ++count; + } + + if (elf_section_data (sec)->relocs != relocs) + free (relocs); } return count; diff --git a/bfd/elflink.c b/bfd/elflink.c index d39ec68..f2015ee 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -10095,22 +10095,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (info->relocatable || info->emitrelocations) reloc_count = sec->reloc_count; else if (bed->elf_backend_count_relocs) - { - Elf_Internal_Rela * relocs; - - relocs = _bfd_elf_link_read_relocs (sec->owner, sec, - NULL, NULL, - info->keep_memory); - - if (relocs != NULL) - { - reloc_count - = (*bed->elf_backend_count_relocs) (sec, relocs); - - if (elf_section_data (sec)->relocs != relocs) - free (relocs); - } - } + reloc_count = (*bed->elf_backend_count_relocs) (info, sec); if (sec->rawsize > max_contents_size) max_contents_size = sec->rawsize; |