Fix an invalid free called when attempting to link a COFF object against an ELF archive with --no-keep-memory enabled.

PR 22369
	* coffgen.c (_bfd_coff_free_symbols): Fail if called on a non-COFF
	file.
	* cofflink.c (coff_link_check_archive_element): Skip non-COFF
	members of an archive.
This commit is contained in:
Nick Clifton
2017-11-01 11:35:42 +00:00
parent 4070243b5c
commit ee357486aa
4 changed files with 27 additions and 3 deletions

View File

@@ -212,6 +212,10 @@ coff_link_check_archive_element (bfd *abfd,
if (h->type != bfd_link_hash_undefined)
return TRUE;
/* PR 22369 - Skip non COFF objects in the archive. */
if (! bfd_family_coff (abfd))
return TRUE;
/* Include this element? */
if (!(*info->callbacks->add_archive_element) (info, abfd, name, &abfd))
return TRUE;