aboutsummaryrefslogtreecommitdiff
path: root/ld/ldelf.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-09-15 13:05:04 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-09-15 13:07:38 -0700
commit0403e9ccae403b8b7bf82eef0536c5295a45a415 (patch)
tree5ac05a1b6e73d0b041f7a42bd72f2afe1db54e99 /ld/ldelf.c
parent47f0e2ff7f0a4479c511f5d3ed4c8a962cb1f237 (diff)
downloadgdb-0403e9ccae403b8b7bf82eef0536c5295a45a415.zip
gdb-0403e9ccae403b8b7bf82eef0536c5295a45a415.tar.gz
gdb-0403e9ccae403b8b7bf82eef0536c5295a45a415.tar.bz2
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.
Diffstat (limited to 'ld/ldelf.c')
-rw-r--r--ld/ldelf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ld/ldelf.c b/ld/ldelf.c
index 75c6c01..c37358f 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 ? */