summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elflink.c8
2 files changed, 13 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6eea52d56c5..ab5fd6fb6bc 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2012-04-13 Alan Modra <amodra@gmail.com>
+
+ PR ld/13947
+ * elflink.c (bfd_elf_final_link): Set reloc_count to 0 for
+ reloc sections.
+
2012-04-12 David S. Miller <davem@davemloft.net>
* reloc.c (BFD_RELOC_SPARC_H34, BFD_RELOC_SPARC_SIZE32,
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 0ed52081999..aa02e2597bd 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -10396,7 +10396,13 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (sec->flags & SEC_MERGE)
merged = TRUE;
- if (info->relocatable || info->emitrelocations)
+ if (esdo->this_hdr.sh_type == SHT_REL
+ || esdo->this_hdr.sh_type == SHT_RELA)
+ /* Some backends use reloc_count in relocation sections
+ to count particular types of relocs. Of course,
+ reloc sections themselves can't have relocations. */
+ reloc_count = 0;
+ else if (info->relocatable || info->emitrelocations)
reloc_count = sec->reloc_count;
else if (bed->elf_backend_count_relocs)
reloc_count = (*bed->elf_backend_count_relocs) (info, sec);