elf: Check bfd_target_elf_flavour on input first
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 15 Sep 2020 20:05:04 +0000 (13:05 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 15 Sep 2020 20:07:38 +0000 (13:07 -0700)
Check bfd_target_elf_flavour on input first in ldelf_after_open before
checking elf_tdata.

* ldelf.c (ldelf_after_open): Check bfd_target_elf_flavour first.

ld/ChangeLog
ld/ldelf.c

index c65a18873607062f7885cf3fdd3739b2f79a795a..01587d86214511f60fdd9c9e62550b2eee8f4783 100644 (file)
@@ -1,3 +1,7 @@
+2020-09-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * ldelf.c (ldelf_after_open): Check bfd_target_elf_flavour first.
+
 2020-09-15  Hans-Peter Nilsson  <hp@axis.com>
 
        PR ld/26589
index 75c6c015aee8002e6f744adc5b9b261ad7163147..c37358f05e58e19a810110e0a8440ad218caa665 100644 (file)
@@ -1043,7 +1043,8 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
   /* Do not allow executable files to be used as inputs to the link.  */
   for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
     {
-      if (!bfd_input_just_syms (abfd)
+      if (abfd->xvec->flavour == bfd_target_elf_flavour
+         && !bfd_input_just_syms (abfd)
          && elf_tdata (abfd) != NULL
          && elf_tdata (abfd)->elf_header != NULL
          /* FIXME: Maybe check for other non-supportable types as well ?  */
This page took 0.048222 seconds and 4 git commands to generate.