aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2015-09-17 12:53:29 +0930
committerAlan Modra <amodra@gmail.com>2015-09-18 12:39:16 +0930
commitb29b8669ad250df649a0f02c5575e7163a2cd9e4 (patch)
tree6206757e6be3cd73050872b6446b4cd9bf5b91e6 /bfd/elflink.c
parenta8aa551e5abde13e063beb32ec0366bdc6008d71 (diff)
downloadgdb-b29b8669ad250df649a0f02c5575e7163a2cd9e4.zip
gdb-b29b8669ad250df649a0f02c5575e7163a2cd9e4.tar.gz
gdb-b29b8669ad250df649a0f02c5575e7163a2cd9e4.tar.bz2
Remove one unnecessary iteration in insertion sort
PR 18867 * elflink.c (elf_link_adjust_relocs): Correct start of insertion sort main loop.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 8659099..4e52d7b 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -8313,7 +8313,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);
@@ -8355,10 +8355,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);