summaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2011-06-04 04:07:52 +0000
committerAlan Modra <amodra@bigpond.net.au>2011-06-04 04:07:52 +0000
commit72578de7c541848f67f5a992d22509b7418ac130 (patch)
tree892978a3deab2d656a44438c70954f2c6df0af10 /bfd/elfcode.h
parentedca786eb9e5de10ec80e90af55189e33445065a (diff)
downloadbinutils-redhat-72578de7c541848f67f5a992d22509b7418ac130.tar.gz
* archures.c (bfd_arch_get_compatible): If one arch is unknown,
return the other arch. * elfcode.h (elf_object_p): Allow explicit match to generic ELF target.
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r--bfd/elfcode.h41
1 files changed, 21 insertions, 20 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index d8833dfdcf..fdfeee9b27 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -595,26 +595,27 @@ elf_object_p (bfd *abfd)
/* 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;
- }
- }
+ if (abfd->target_defaulted)
+ 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;
+ }
+ }
}
if (i_ehdrp->e_type == ET_EXEC)