aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-06-04 04:07:54 +0000
committerAlan Modra <amodra@gmail.com>2011-06-04 04:07:54 +0000
commitd50ec8a7e1a44e1de5db93d18e7369c000cce008 (patch)
tree9e74098d9f4d8d66924aa613c2cd975db22aab74 /bfd/elfcode.h
parentf973cbf1c64682429604ed373cf7a0edbab76502 (diff)
downloadgdb-d50ec8a7e1a44e1de5db93d18e7369c000cce008.zip
gdb-d50ec8a7e1a44e1de5db93d18e7369c000cce008.tar.gz
gdb-d50ec8a7e1a44e1de5db93d18e7369c000cce008.tar.bz2
* 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 d8833df..fdfeee9 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)