From: Alan Modra Date: Thu, 17 Sep 2015 03:23:29 +0000 (+0930) Subject: Remove one unnecessary iteration in insertion sort X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5d93219b34f4c92b7686944bd4be03da4d86ef0d;p=thirdparty%2Fbinutils-gdb.git Remove one unnecessary iteration in insertion sort PR 18867 * elflink.c (elf_link_adjust_relocs): Correct start of insertion sort main loop. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bff0c56432b..da5f8862500 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2015-09-17 Alan Modra + + PR 18867 + * elflink.c (elf_link_adjust_relocs): Correct start of insertion + sort main loop. + 2015-09-16 Alan Modra PR 18867 diff --git a/bfd/elflink.c b/bfd/elflink.c index a754ac52437..076fa6d9c0d 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -8172,7 +8172,7 @@ elf_link_adjust_relocs (bfd *abfd, memcpy (base, onebuf, elt_size); } - for (p = base + elt_size; p < end; ) + for (p = base + elt_size; (p += elt_size) < end; ) { /* base to p is sorted, *p is next to insert. */ r_off = (*ext_r_off) (p); @@ -8214,10 +8214,8 @@ elf_link_adjust_relocs (bfd *abfd, memmove (loc, p, runlen); memcpy (loc + runlen, buf, sortlen); } - p += runlen; + p += runlen - elt_size; } - else - p += elt_size; } /* Hashes are no longer valid. */ free (reldata->hashes);