summaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r--bfd/elfcode.h72
1 files changed, 6 insertions, 66 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index d8833dfdcf3..b7e022614ca 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -499,7 +499,6 @@ elf_object_p (bfd *abfd)
asection *s;
bfd_size_type amt;
const bfd_target *target;
- const bfd_target * const *target_ptr;
preserve.marker = NULL;
@@ -588,34 +587,9 @@ elf_object_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))
- {
- if (ebd->elf_machine_code != EM_NONE)
- goto got_wrong_format_error;
-
- /* 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
- && back->elf_machine_alt1 == i_ehdrp->e_machine)
- || (back->elf_machine_alt2 != 0
- && back->elf_machine_alt2 == i_ehdrp->e_machine))
- {
- /* target_ptr is an ELF backend which matches this
- object file, so reject the generic ELF target. */
- goto got_wrong_format_error;
- }
- }
- }
+ || i_ehdrp->e_machine != ebd->elf_machine_alt2)
+ && ebd->elf_machine_code != EM_NONE)
+ goto got_wrong_format_error;
if (i_ehdrp->e_type == ET_EXEC)
abfd->flags |= EXEC_P;
@@ -633,43 +607,9 @@ elf_object_p (bfd *abfd)
}
if (ebd->elf_machine_code != EM_NONE
- && i_ehdrp->e_ident[EI_OSABI] != ebd->elf_osabi)
- {
- if (ebd->elf_osabi != ELFOSABI_NONE)
- goto got_wrong_format_error;
-
- /* This is an ELFOSABI_NONE ELF target. Let it match any ELF
- target of the compatible machine for which we do not have a
- backend with matching ELFOSABI. */
- for (target_ptr = bfd_target_vector;
- *target_ptr != NULL;
- target_ptr++)
- {
- const struct elf_backend_data *back;
-
- /* Skip this target and targets with incompatible byte
- order. */
- if (*target_ptr == target
- || (*target_ptr)->flavour != bfd_target_elf_flavour
- || (*target_ptr)->byteorder != target->byteorder
- || ((*target_ptr)->header_byteorder
- != target->header_byteorder))
- continue;
-
- back = xvec_get_elf_backend_data (*target_ptr);
- if (back->elf_osabi == i_ehdrp->e_ident[EI_OSABI]
- && (back->elf_machine_code == i_ehdrp->e_machine
- || (back->elf_machine_alt1 != 0
- && back->elf_machine_alt1 == i_ehdrp->e_machine)
- || (back->elf_machine_alt2 != 0
- && back->elf_machine_alt2 == i_ehdrp->e_machine)))
- {
- /* target_ptr is an ELF backend which matches this
- object file, so reject the ELFOSABI_NONE ELF target. */
- goto got_wrong_format_error;
- }
- }
- }
+ && i_ehdrp->e_ident[EI_OSABI] != ebd->elf_osabi
+ && ebd->elf_osabi != ELFOSABI_NONE)
+ goto got_wrong_format_error;
if (i_ehdrp->e_shoff != 0)
{