This generalizes D68094 (relocatable link) to non-relocatable links.
sh_link(foo) = .text.f1
sh_link(foo) = .text.f2
If .text.f1 and .text.f2 and placed in different output sections, we
currently produce one output foo with the sh_link field arbitrarily set
to the output section index of first input foo.
This patch combines SHF_LINK_ORDER sections linking different output
sections. The idea is similar to D66717 (do not ICF two sections with
different output sections).
If an output section description combines generic SHF_LINK_ORDER
sections, we have to respect the user requirements. Due to the "by name"
nature of section matching, SHF_LINK_ORDER sections linking different
output sections may be combined.
The use of start_/stop_ symbols has an expectation that the pair of
symbols delimiter the section contents (D65770 __start_hwasan_globals is
a use case). Don't create multiple output sections.
Note, .ARM.exidx (singleton synthetic section) is not affected by this change.
D76409 improved the test.