binutils-gdb/ld/testsuite/ld-elf/pr29259.d
Tomoaki Kawada fba1ac87dc Fix the sorting algorithm for reloc entries
The optimized insertion sort algorithm in `elf_link_adjust_relocs`
incorrectly assembled "runs" from unsorted entries and inserted them to an
already-sorted prefix, breaking the loop invariants of insertion sort.
This commit updates the run assembly loop to break upon encountering a
non-monotonic change in the sort key.

	PR 29259
bfd/
	* elflink.c (elf_link_adjust_relocs): Ensure run being inserted
	is sorted.
ld/
	* testsuite/ld-elf/pr29259.d,
	* testsuite/ld-elf/pr29259.s,
	* testsuite/ld-elf/pr29259.t: New test.
2022-06-18 20:11:23 +09:30

14 lines
135 B
Makefile

#ld: -r -T pr29259.t
#readelf: -Wr
Relocation section .*
+Offset +Info +Type .*
0+00 .*
#...
0+20 .*
#...
0+40 .*
#...
0+60 .*
#pass