This fixes pr35570.
We were creating these symbols after parsing version scripts, so they could not be versioned.
We cannot move the version script later because we need it for lto.
One option is to move both addReservedSymbols and createSyntheticSections earlier. The disadvantage is that some sections created by createSyntheticSections replace other input sections. For example, gdb index replaces .debug_gnu_pubnames, so it wants to run after gc sections so that it can set S->Live to false.
What this patch does instead is to move just the ElfHeader creation early.