diff options
author | Jeff Law <law@redhat.com> | 2000-03-14 17:50:00 +0000 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 2000-03-14 17:50:00 +0000 |
commit | cdee64284b48ced1c83544ce82750610afa7c21b (patch) | |
tree | c5128f68f481b6b8c2bf4ca97052cb628a8de1bb /bfd/reloc16.c | |
parent | 7ca01cb9a4141b9aef05ca6ee71b85fea8f55159 (diff) | |
download | gdb-cdee64284b48ced1c83544ce82750610afa7c21b.tar.gz |
* reloc16.c (bfd_coff_reloc16_relax_section): Count the total number
of shrinks properly, including the last reloc.
Diffstat (limited to 'bfd/reloc16.c')
-rw-r--r-- | bfd/reloc16.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/bfd/reloc16.c b/bfd/reloc16.c index fd8758aec4c..0e7c18abfd9 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); } |