Orphan input sections are sections that do not match any InputSectionDescription, these are either placed in existing OutputSections if their name matches for example
.text : { *(.text) }
will match all orphans with a prefix of .text. However an orphan that does not match the name of an existing OutputSection will have an OutputSection created. The orphan input sections are added to OutputSections, and are handled by the flush() function when doing address assignment. These orphan sections will be invisible to Thunk creation and the ordering of .ARM.exidx sections as they won't appear on any InputSection description.
This change fabricates InputSectionDescriptions to cover the inserted orphan sections. I've checked that this matches the behavior of GNU ld when there is a symbol definition at the end of an existing InputSectionDescription. For example:
.text : { *(.text) SYM = .; }
The orphans are added after SYM is defined.
It will now be possible for createThunks to insert thunks into orphan InputSectionDescriptions and for .ARM.exidx section sorting to work with linker scripts that have orphan Sections. For example the InputSectionDescription:
.ARM.exidx : { *(.ARM.exidx) }
Will only match sections with a name of .ARM.exidx, sections such as .ARM.exidx.text.foo will not match the InputSectionDescription, but will match the OutputSection as an orphan.
Note that the .ARM.exidx ordering code in OutputSections currently works on OutputSections::Sections, so it is likely to be wrong when there is a linker script. I've put a temporary FIXME in that makes the script ordering work. I have a full fix that rewrites the .ARM.exidx ordering code that I'll post in a separate review.