* 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.
This commit is contained in:
Alan Modra 2008-10-20 10:57:33 +00:00
parent bef264833b
commit 58217f2928
4 changed files with 30 additions and 26 deletions

View File

@ -1,3 +1,10 @@
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
@ -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,

View File

@ -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. */

View File

@ -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;

View File

@ -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;