This is important for FreeBSD EFI bootloaders one of which has next script:
.sdata : { *(.got.plt .got) ... }
So it wants to place got.plt and got into single section of name .sdata.
That was not supported before as there was no way to get access to
synthetic sections from script.
To do that we need to add them early to Symtab<ELFT>::X->Sections.
That involves next problems:
- Not all sections are required in output finally. For example we do not need
to emit got content when it has no entries. Patch solves that in next way:
after script do its job of layouting, removeUnusedSynthetics() is called.
Main intention to check the condition for each synthetic and remove it from output
if it is not needed.
- Adding sections early involves possible change in ordering. That is why this patch
does not do support for all sections at ones. Otherwise too many tests fill fail (up to 150).
It still breaks order for .eh_frame, that is why few relative testcases were fixes.
I believe that is not a problem.
If we land this - we might be able to add all rest sections in next patches
and get rid off addPredefinedSections() fully I think.