go32exe_cleanup (bfd *abfd)
{
abfd->origin = 0;
+ coff_object_cleanup (abfd);
free (go32exe_temp_stub);
go32exe_temp_stub = NULL;
bfd_cleanup cleanup = coff_object_p (abfd);
if (cleanup == NULL)
goto fail;
- BFD_ASSERT (cleanup == _bfd_no_cleanup);
+ BFD_ASSERT (cleanup == coff_object_cleanup);
return go32exe_cleanup;
return result;
}
+void
+coff_object_cleanup (bfd *abfd)
+{
+ if (bfd_family_coff (abfd) && bfd_get_format (abfd) == bfd_object)
+ {
+ struct coff_tdata *td = coff_data (abfd);
+ if (td != NULL)
+ {
+ if (td->section_by_index)
+ htab_delete (td->section_by_index);
+ if (td->section_by_target_index)
+ htab_delete (td->section_by_target_index);
+ }
+ }
+}
+
/* Read in a COFF object and make it into a BFD. This is used by
ECOFF as well. */
bfd_cleanup
-coff_real_object_p (bfd *,
- unsigned,
- struct internal_filehdr *,
- struct internal_aouthdr *);
-bfd_cleanup
coff_real_object_p (bfd *abfd,
unsigned nscns,
struct internal_filehdr *internal_f,
}
_bfd_coff_free_symbols (abfd);
- return _bfd_no_cleanup;
+ return coff_object_cleanup;
fail:
+ coff_object_cleanup (abfd);
_bfd_coff_free_symbols (abfd);
bfd_release (abfd, tdata);
fail2:
};
/* Functions in coffgen.c. */
+extern void coff_object_cleanup
+ (bfd *);
+extern bfd_cleanup coff_real_object_p
+ (bfd *, unsigned, struct internal_filehdr *, struct internal_aouthdr *);
extern bfd_cleanup coff_object_p
(bfd *);
extern struct bfd_section *coff_section_from_bfd_index
};
/* Functions in coffgen.c. */
+extern void coff_object_cleanup
+ (bfd *);
+extern bfd_cleanup coff_real_object_p
+ (bfd *, unsigned, struct internal_filehdr *, struct internal_aouthdr *);
extern bfd_cleanup coff_object_p
(bfd *);
extern struct bfd_section *coff_section_from_bfd_index