diff options
author | Alan Modra <amodra@gmail.com> | 2015-09-17 12:53:29 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2018-03-06 18:25:01 +1030 |
commit | a0808d1a996fb1c1616b7ae9c93787a674d0c4f8 (patch) | |
tree | 306e950d8b5bb0020fd8db98eb418f74183db469 | |
parent | fb375cb026777c18559764e5fe11bd576d21e5d4 (diff) | |
download | gdb-a0808d1a996fb1c1616b7ae9c93787a674d0c4f8.zip gdb-a0808d1a996fb1c1616b7ae9c93787a674d0c4f8.tar.gz gdb-a0808d1a996fb1c1616b7ae9c93787a674d0c4f8.tar.bz2 |
Remove one unnecessary iteration in insertion sort
PR 18867
* elflink.c (elf_link_adjust_relocs): Correct start of insertion
sort main loop.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elflink.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bff0c56..da5f886 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2015-09-17 Alan Modra <amodra@gmail.com> + + PR 18867 + * elflink.c (elf_link_adjust_relocs): Correct start of insertion + sort main loop. + 2015-09-16 Alan Modra <amodra@gmail.com> PR 18867 diff --git a/bfd/elflink.c b/bfd/elflink.c index a754ac5..076fa6d 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); |