aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2000-03-14 17:50:00 +0000
committerJeff Law <law@redhat.com>2000-03-14 17:50:00 +0000
commitc4d5c859ba8a93e51316459fe336137b32766364 (patch)
treef7473717dc4e17353bf6ea6aa654fd9571cf5287 /bfd
parent751a959bb828352de7d12339268c363a0773af5f (diff)
downloadgdb-c4d5c859ba8a93e51316459fe336137b32766364.zip
gdb-c4d5c859ba8a93e51316459fe336137b32766364.tar.gz
gdb-c4d5c859ba8a93e51316459fe336137b32766364.tar.bz2
* reloc16.c (bfd_coff_reloc16_relax_section): Count the total number
of shrinks properly, including the last reloc.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/reloc16.c10
2 files changed, 11 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 5247acf..e931e32 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2000-03-14 Kazu Hirata <kazu@hxi.com>
+
+ * reloc16.c (bfd_coff_reloc16_relax_section): Count the total number
+ of shrinks properly, including the last reloc.
+
2000-03-13 Kazu Hirata <kazu@hxi.com>
* coff-h8300.c (h8300_reloc16_extra_cases): Fix the sanity
diff --git a/bfd/reloc16.c b/bfd/reloc16.c
index fd8758a..0e7c18a 100644
--- a/bfd/reloc16.c
+++ b/bfd/reloc16.c
@@ -195,9 +195,10 @@ bfd_coff_reloc16_relax_section (abfd, i, link_info, again)
{
int another_pass = 0;
- /* Allocate and initialize the shrinks array for this section. */
- shrinks = (int *) bfd_malloc (reloc_count * sizeof (int));
- memset (shrinks, 0, reloc_count * sizeof (int));
+ /* Allocate and initialize the shrinks array for this section.
+ The last element is used as an accumlator of shrinks. */
+ shrinks = (int *) bfd_malloc ((reloc_count + 1) * sizeof (int));
+ memset (shrinks, 0, (reloc_count + 1) * sizeof (int));
/* Loop until nothing changes in this section. */
do {
@@ -219,13 +220,14 @@ bfd_coff_reloc16_relax_section (abfd, i, link_info, again)
if (shrink != shrinks[i])
{
another_pass = 1;
- for (j = i + 1; j < reloc_count; j++)
+ for (j = i + 1; j <= reloc_count; j++)
shrinks[j] += shrink - shrinks[i];
}
}
} while (another_pass);
+ shrink = shrinks[reloc_count];
free((char *)shrinks);
}