aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-10-14 13:50:48 +1030
committerAlan Modra <amodra@gmail.com>2019-10-14 16:47:13 +1030
commit48db3297342d798e58a00771a67b9b4c93412920 (patch)
tree610c95421aade3fa9371ccb796f8b99d83e56077 /bfd/elflink.c
parent8c1c5e5de46f415bbdeabb3cad3fd1383f5fb995 (diff)
downloadgdb-48db3297342d798e58a00771a67b9b4c93412920.zip
gdb-48db3297342d798e58a00771a67b9b4c93412920.tar.gz
gdb-48db3297342d798e58a00771a67b9b4c93412920.tar.bz2
qsort: elf_sort_sections use of target_index
elf_sort_sections tried to ensure a stable qsort by using target_index as the final comparison, but target_index hasn't been set by anything at the time elf_sort_sections was run. This patch arrange to have target_index set. * elf.c (_bfd_elf_map_sections_to_segments): Init target_index for sections about to be sorted. (assign_file_positions_for_load_sections): Likewise. (elf_sort_sections): Don't bother optimising both TOEND case. * elflink.c (bfd_elf_final_link): Reset target_index.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index fedaf4b..bfd0f01 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -12048,6 +12048,10 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
goto error_return;
}
+ /* _bfd_elf_compute_section_file_positions makes temporary use
+ of target_index. Reset it. */
+ o->target_index = 0;
+
/* Now, reset REL_COUNT and REL_COUNT2 so that we can use them
to count upwards while actually outputting the relocations. */
esdo->rel.count = 0;