public inbox for binutils-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Revert "Fix fbsd core matching"
@ 2022-06-14 9:08 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2022-06-14 9:08 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=476288fa2bddecf0f0e13dee826a076309bf01fe
commit 476288fa2bddecf0f0e13dee826a076309bf01fe
Author: Tom de Vries <tdevries@suse.de>
Date: Tue Jun 14 11:08:43 2022 +0200
Revert "Fix fbsd core matching"
This reverts commit a7e29f797cecd5a2f73c27838b09eae1f1b6c657.
I accidentally pushed this, so revert.
Diff:
---
bfd/elfcore.h | 40 ++++++++++++++++++++++++++++++----------
1 file changed, 30 insertions(+), 10 deletions(-)
diff --git a/bfd/elfcore.h b/bfd/elfcore.h
index 59b73bd57de..809f6711aed 100644
--- a/bfd/elfcore.h
+++ b/bfd/elfcore.h
@@ -149,14 +149,37 @@ elf_core_file_p (bfd *abfd)
&& (ebd->elf_machine_alt1 == 0
|| i_ehdrp->e_machine != ebd->elf_machine_alt1)
&& (ebd->elf_machine_alt2 == 0
- || i_ehdrp->e_machine != ebd->elf_machine_alt2)
- && ebd->elf_machine_code != EM_NONE)
- goto wrong;
+ || i_ehdrp->e_machine != ebd->elf_machine_alt2))
+ {
+ const bfd_target * const *target_ptr;
- if (ebd->elf_machine_code != EM_NONE
- && i_ehdrp->e_ident[EI_OSABI] != ebd->elf_osabi
- && ebd->elf_osabi != ELFOSABI_NONE)
- goto wrong;
+ if (ebd->elf_machine_code != EM_NONE)
+ goto wrong;
+
+ /* This is the generic ELF target. Let it match any ELF target
+ for which we do not have a specific backend. */
+
+ for (target_ptr = bfd_target_vector; *target_ptr != NULL; target_ptr++)
+ {
+ const struct elf_backend_data *back;
+
+ if ((*target_ptr)->flavour != bfd_target_elf_flavour)
+ continue;
+ back = xvec_get_elf_backend_data (*target_ptr);
+ if (back->s->arch_size != ARCH_SIZE)
+ continue;
+ if (back->elf_machine_code == i_ehdrp->e_machine
+ || (back->elf_machine_alt1 != 0
+ && i_ehdrp->e_machine == back->elf_machine_alt1)
+ || (back->elf_machine_alt2 != 0
+ && i_ehdrp->e_machine == back->elf_machine_alt2))
+ {
+ /* target_ptr is an ELF backend which matches this
+ object file, so reject the generic ELF target. */
+ goto wrong;
+ }
+ }
+ }
/* If there is no program header, or the type is not a core file, then
we are hosed. */
@@ -176,9 +199,6 @@ elf_core_file_p (bfd *abfd)
Elf_Internal_Shdr i_shdr;
file_ptr where = (file_ptr) i_ehdrp->e_shoff;
- if (i_ehdrp->e_shoff < sizeof (x_ehdr))
- goto wrong;
-
/* Seek to the section header table in the file. */
if (bfd_seek (abfd, where, SEEK_SET) != 0)
goto fail;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-14 9:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14 9:08 [binutils-gdb] Revert "Fix fbsd core matching" Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).