Call bfd_close_all_done in ld_cleanup
authorAlan Modra <amodra@gmail.com>
Fri, 27 Jan 2023 05:02:06 +0000 (15:32 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 27 Jan 2023 05:17:09 +0000 (15:47 +1030)
commit1f5e6267aacce29ad21b0c2d072b6029ba6c14ac
treed2afcf864bd435dbb8284d4dfee7dfa78a5db2d5
parent8219cab3f883cb9981e533407d3ce93d9da7d5f2
Call bfd_close_all_done in ld_cleanup

This is similar to "Call bfd_close_all_done in output_file_close",
but with some code tidying in the pe/pep write_build_id functions.
write_build_id is passed the output bfd as its parameter, so there is
no need to go looking for the output bfd via link_info (and doing so
will no longer work since I clear link_info.output_bfd before calling
bfd_close).

* emultempl/pe.em (write_build_id): Rename t to td.  Formatting.
Don't access pe_data(link_info.output_bfd), use td instead.
(setup_build_id): Rename t to td.  Formatting.
* emultempl/pep.em: As for pe.em.
* ldmain.c (ld_cleanup): Call bfd_close_all_done on linker bfds.
(main): Clear link_info.output_bfd when closing.
ld/emultempl/pe.em
ld/emultempl/pep.em
ld/ldmain.c