aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2002-07-08 05:34:08 +0000
committerMark Mitchell <mark@codesourcery.com>2002-07-08 05:34:08 +0000
commite9168c1e2b14c89a5701688c93d42a6c9ae4bb12 (patch)
tree95e9ce6d557087cd520e261a83dea14bd2fe336c /bfd
parentd1e122bd6a4a3280358caa7978abc54034f8e137 (diff)
downloadgdb-e9168c1e2b14c89a5701688c93d42a6c9ae4bb12.zip
gdb-e9168c1e2b14c89a5701688c93d42a6c9ae4bb12.tar.gz
gdb-e9168c1e2b14c89a5701688c93d42a6c9ae4bb12.tar.bz2
* cofflink.c (_bfd_coff_final_link): On PE COFF systems, take into
account the impact of relocation count overflow when computing section offsets. * coffcode.h (coff_write_relocs): Use obj_pe when deciding whether or not to apply the PE COFF reloc overflow handling. Fix a fencepost error in deciding whether or not to use that technique.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/coffcode.h6
-rw-r--r--bfd/cofflink.c4
3 files changed, 17 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0e66cda..2e442ba 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,13 @@
+2002-07-07 Mark Mitchell <mark@codesourcery.com>
+ Alan Modra <amodra@bigpond.net.au>
+
+ * cofflink.c (_bfd_coff_final_link): On PE COFF systems, take into
+ account the impact of relocation count overflow when computing
+ section offsets.
+ * coffcode.h (coff_write_relocs): Use obj_pe when deciding whether
+ or not to apply the PE COFF reloc overflow handling. Fix a
+ fencepost error in deciding whether or not to use that technique.
+
2002-07-07 Alan Modra <amodra@bigpond.net.au>
* elf-bfd.h (struct elf_reloc_cookie): Remove locsym_shndx,
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 6040026..bb777aa 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -2394,7 +2394,7 @@ coff_write_relocs (abfd, first_undef)
return false;
#ifdef COFF_WITH_PE
- if (s->reloc_count > 0xffff)
+ if (obj_pe (abfd) && s->reloc_count >= 0xffff)
{
/* encode real count here as first reloc */
struct internal_reloc n;
@@ -3420,7 +3420,7 @@ coff_write_object_contents (abfd)
{
#ifdef COFF_WITH_PE
/* we store the actual reloc count in the first reloc's addr */
- if (current->reloc_count > 0xffff)
+ if (obj_pe (abfd) && current->reloc_count >= 0xffff)
reloc_count ++;
#endif
reloc_count += current->reloc_count;
@@ -3451,7 +3451,7 @@ coff_write_object_contents (abfd)
reloc_base += current->reloc_count * bfd_coff_relsz (abfd);
#ifdef COFF_WITH_PE
/* extra reloc to hold real count */
- if (current->reloc_count > 0xffff)
+ if (obj_pe (abfd) && current->reloc_count >= 0xffff)
reloc_base += bfd_coff_relsz (abfd);
#endif
}
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 32200a8..eb9388f 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -757,6 +757,10 @@ _bfd_coff_final_link (abfd, info)
o->flags |= SEC_RELOC;
o->rel_filepos = rel_filepos;
rel_filepos += o->reloc_count * relsz;
+ /* In PE COFF, if there are at least 0xffff relocations an
+ extra relocation will be written out to encode the count. */
+ if (obj_pe (abfd) && o->reloc_count >= 0xffff)
+ rel_filepos += relsz;
}
if (bfd_coff_long_section_names (abfd)