Delay writing of stub bfd sections
AARCH64 continues an ARM tradition of updating stubs late. See
coff_arm_link_output_has_begun. Commit e189bfd9b492 broke AARCH64,
because adding dynamic sections to the stub bfd resulted in that
entire bfd being written out fairly early. Prior to e189bfd9b492
dynamic sections were usually added to crt1.o, the first object being
linked. If crt1.o happened to need an erratum_843419 stub I think
we'd see the same sort of breakage exposed by e189bfd9b492, with later
object files' erratum_843419 stubs not being updated (resulting in
an all-zero insn in the stub). You would likely hit the same problem
if user linker scripts divided up code sections for some reason.
There likely is no reason to clear sub->output_has_begun here, but
I'll leave removing that to a followup patch.
* elflink.c (_bfd_elf_final_link): Write any linker created
bfd last.
1 file changed