unrecord_section_with_aarch64_elf_section_data (sec);
}
-static bool
-elfNN_aarch64_close_and_cleanup (bfd *abfd)
-{
- if (abfd->sections)
- bfd_map_over_sections (abfd,
- unrecord_section_via_map_over_sections, NULL);
-
- return _bfd_elf_close_and_cleanup (abfd);
-}
-
static bool
elfNN_aarch64_bfd_free_cached_info (bfd *abfd)
{
#define ELF_MAXPAGESIZE 0x10000
#define ELF_COMMONPAGESIZE 0x1000
-#define bfd_elfNN_close_and_cleanup \
- elfNN_aarch64_close_and_cleanup
-
#define bfd_elfNN_bfd_free_cached_info \
elfNN_aarch64_bfd_free_cached_info
static void
_bfd_delete_bfd (bfd *abfd)
{
+ /* Give the target _bfd_free_cached_info a chance to free memory. */
+ if (abfd->memory)
+ bfd_free_cached_info (abfd);
+
+ /* The target _bfd_free_cached_info may not have done anything.. */
if (abfd->memory)
{
bfd_hash_table_free (&abfd->section_htab);
#undef FREE
}
- return _bfd_generic_close_and_cleanup (abfd);
+ /* Do not call _bfd_free_cached_info here. som_write_armap needs
+ to access the bfd obj_alloc memory. */
+ return true;
}
/* End of miscellaneous support functions. */
#define som_find_line _bfd_nosymbols_find_line
#define som_get_symbol_version_string _bfd_nosymbols_get_symbol_version_string
-#define som_close_and_cleanup som_bfd_free_cached_info
+#define som_close_and_cleanup _bfd_generic_close_and_cleanup
#define som_read_ar_hdr _bfd_generic_read_ar_hdr
#define som_write_ar_hdr _bfd_generic_write_ar_hdr
#define som_openr_next_archived_file bfd_generic_openr_next_archived_file