aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-spu.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2008-10-20 10:57:33 +0000
committerAlan Modra <amodra@gmail.com>2008-10-20 10:57:33 +0000
commit58217f292890a480df33735fd9292a4173f6b210 (patch)
treec1a1f72426c417df209647f252225d266ca995ca /bfd/elf32-spu.c
parentbef264833bf5549bfef8e3495d514ff4a3b72e9f (diff)
downloadgdb-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.
Diffstat (limited to 'bfd/elf32-spu.c')
-rw-r--r--bfd/elf32-spu.c23
1 files changed, 17 insertions, 6 deletions
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;