From: H.J. Lu Date: Tue, 15 Sep 2020 20:05:04 +0000 (-0700) Subject: elf: Check bfd_target_elf_flavour on input first X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0403e9ccae403b8b7bf82eef0536c5295a45a415;p=binutils-gdb.git elf: Check bfd_target_elf_flavour on input first 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. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index c65a1887360..01587d86214 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,7 @@ +2020-09-15 H.J. Lu + + * ldelf.c (ldelf_after_open): Check bfd_target_elf_flavour first. + 2020-09-15 Hans-Peter Nilsson PR ld/26589 diff --git a/ld/ldelf.c b/ld/ldelf.c index 75c6c015aee..c37358f05e5 100644 --- a/ld/ldelf.c +++ b/ld/ldelf.c @@ -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 ? */