qsort: SHF_LINK_ORDER section sort
authorAlan Modra <amodra@gmail.com>
Mon, 14 Oct 2019 03:19:34 +0000 (13:49 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 14 Oct 2019 06:17:13 +0000 (16:47 +1030)
commit8c1c5e5de46f415bbdeabb3cad3fd1383f5fb995
treef8065506654e5d7d4329be4629e253e8692ecfa3
parentdcea6a95d78370c8b4ac3c0033d9f15aaabf31bf
qsort: SHF_LINK_ORDER section sort

The linker SHF_LINK_ORDER section sorting had a number of defects.
1) The ordering was by VMA, which won't work with overlays.  LMA is
   better.
2) Zero size sections can result in two sections at the same LMA/VMA.
   When only one of the two sections at the same LMA is zero size,
   that one must be first.
3) Warnings given by elf_get_linked_section_vma won't ever be emitted
   since elf_object_p warns and excludes objects with zero sh_link on
   a SHF_LINK_ORDER section.
4) Section offset was adjusted down rather than up by section
   alignment, possibly creating overlapping sections.
5) Finding the linked section did so the hard way, rather than simply
   using elf_linked_to_section.

* elflink.c (elf_get_linked_section_vma): Delete.
(compare_link_order): Use elf_linked_to_section and sort by lma,
size, and id.
(elf_fixup_link_order): Use size_t variables where appropriate.
Make use of elf_linked_to_section.  Formatting.  Properly align
sections.
bfd/ChangeLog
bfd/elflink.c
This page took 0.026267 seconds and 4 git commands to generate.