diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-04-13 23:20:00 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-04-13 23:20:00 +0000 |
commit | aed64b35fbdb4d924b081158fd31015bb5d366c2 (patch) | |
tree | 39bf3df56deb3ebcb15f6abf3a69f544efb117ef /bfd/elflink.c | |
parent | ca7781d2ae089e04d44ed0b14d946dcb651a3cf8 (diff) | |
download | binutils-aed64b35fbdb4d924b081158fd31015bb5d366c2.zip binutils-aed64b35fbdb4d924b081158fd31015bb5d366c2.tar.gz binutils-aed64b35fbdb4d924b081158fd31015bb5d366c2.tar.bz2 |
Set reloc_count to 0 for reloc sections
bfd/
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.
ld/testsuite/
2012-04-13 H.J. Lu <hongjiu.lu@intel.com>
PR ld/13947
* ld-x86-64/x86-64.exp: Run pr13947.
* ld-x86-64/pr13947.d: New file.
* ld-x86-64/pr13947.s: Likewise.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index 0ed5208..aa02e25 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); |