aboutsummaryrefslogtreecommitdiff
path: root/bfd/cofflink.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-11-01 11:35:42 +0000
committerNick Clifton <nickc@redhat.com>2017-11-01 11:35:42 +0000
commitee357486aa87b17782111295c5e7bd4ac9e6970f (patch)
tree26750ac53e7ea4c06e31a9230d11fce21678126f /bfd/cofflink.c
parent4070243b5c1f66a36dd43a7b722e991ac9fc40e1 (diff)
downloadbinutils-ee357486aa87b17782111295c5e7bd4ac9e6970f.zip
binutils-ee357486aa87b17782111295c5e7bd4ac9e6970f.tar.gz
binutils-ee357486aa87b17782111295c5e7bd4ac9e6970f.tar.bz2
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.
Diffstat (limited to 'bfd/cofflink.c')
-rw-r--r--bfd/cofflink.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 32d62bd..5b18e54 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -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;