Fix arm-epoc-pe build problem:
[deliverable/binutils-gdb.git] / bfd / reloc16.c
index 7e7952ed5064ae4f1e4653807208b86357f74567..0e7c18abfd976bf81df1c8e0dd8c901906e3dbcc 100644 (file)
@@ -81,7 +81,8 @@ bfd_coff_reloc16_get_value (reloc, link_info, input_section)
        {
          if (! ((*link_info->callbacks->undefined_symbol)
                 (link_info, bfd_asymbol_name (symbol),
-                 input_section->owner, input_section, reloc->address)))
+                 input_section->owner, input_section, reloc->address,
+                 true)))
            abort ();
          value = 0;
        }
@@ -194,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 {
@@ -218,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);
     }
 
This page took 0.023387 seconds and 4 git commands to generate.