aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffcode.h
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2003-10-07 08:49:11 +0000
committerNathan Sidwell <nathan@codesourcery.com>2003-10-07 08:49:11 +0000
commitcd339148dea20e4fffc4a184329a978c7894a9e5 (patch)
treea34c3c9a5252190f26d3098f074f6ac7b9f2d4a1 /bfd/coffcode.h
parent2f9626f3fd613ff1f0356f426d8b3b30e8acf766 (diff)
downloadgdb-cd339148dea20e4fffc4a184329a978c7894a9e5.zip
gdb-cd339148dea20e4fffc4a184329a978c7894a9e5.tar.gz
gdb-cd339148dea20e4fffc4a184329a978c7894a9e5.tar.bz2
* coffcode.h (coff_set_alignment_hook): With PE_COFF reloc
overflow, set reloc start position to after the count reloc. Subtract one from num relocs. Give error on 0xffff relocs and no overflow. * cofflink.c (_bfd_coff_final_link): Deal with PE_COFF reloc overflow. * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Do overflow if >= 0xffff.
Diffstat (limited to 'bfd/coffcode.h')
-rw-r--r--bfd/coffcode.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 3b39f09..f5262f6 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -1694,15 +1694,21 @@ coff_set_alignment_hook (abfd, section, scnhdr)
struct external_reloc dst;
struct internal_reloc n;
file_ptr oldpos = bfd_tell (abfd);
+ bfd_size_type relsz = bfd_coff_relsz (abfd);
+
bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0);
- if (bfd_bread ((PTR) &dst, (bfd_size_type) bfd_coff_relsz (abfd), abfd)
- != bfd_coff_relsz (abfd))
+ if (bfd_bread ((PTR) &dst, relsz, abfd) != relsz)
return;
coff_swap_reloc_in (abfd, &dst, &n);
bfd_seek (abfd, oldpos, 0);
- section->reloc_count = hdr->s_nreloc = n.r_vaddr;
+ section->reloc_count = hdr->s_nreloc = n.r_vaddr - 1;
+ section->rel_filepos += relsz;
}
+ else if (hdr->s_nreloc == 0xffff)
+ (*_bfd_error_handler)
+ ("%s: warning: claims to have 0xffff relocs, without overflow",
+ bfd_get_filename (abfd));
}
#undef ALIGN_SET
#undef ELIFALIGN_SET