aboutsummaryrefslogtreecommitdiff
path: root/bfd/archures.c
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/archures.c
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/archures.c')
-rw-r--r--bfd/archures.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/bfd/archures.c b/bfd/archures.c
index cd8500f..df22b81 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -1,6 +1,6 @@
/* BFD library support routines for architectures.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
@@ -748,25 +748,26 @@ bfd_arch_get_compatible (const bfd *abfd,
const bfd *bbfd,
bfd_boolean accept_unknowns)
{
- const bfd * ubfd = NULL;
+ const bfd *ubfd, *kbfd;
/* Look for an unknown architecture. */
- if (((ubfd = abfd) && ubfd->arch_info->arch == bfd_arch_unknown)
- || ((ubfd = bbfd) && ubfd->arch_info->arch == bfd_arch_unknown))
- {
- /* We can allow an unknown architecture if accept_unknowns
- is true, or if the target is the "binary" format, which
- has an unknown architecture. Since the binary format can
- only be set by explicit request from the user, it is safe
- to assume that they know what they are doing. */
- if (accept_unknowns
- || strcmp (bfd_get_target (ubfd), "binary") == 0)
- return ubfd->arch_info;
- return NULL;
- }
-
- /* Otherwise architecture-specific code has to decide. */
- return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
+ if (abfd->arch_info->arch == bfd_arch_unknown)
+ ubfd = abfd, kbfd = bbfd;
+ else if (bbfd->arch_info->arch == bfd_arch_unknown)
+ ubfd = bbfd, kbfd = abfd;
+ else
+ /* Otherwise architecture-specific code has to decide. */
+ return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
+
+ /* We can allow an unknown architecture if accept_unknowns
+ is true, or if the target is the "binary" format, which
+ has an unknown architecture. Since the binary format can
+ only be set by explicit request from the user, it is safe
+ to assume that they know what they are doing. */
+ if (accept_unknowns
+ || strcmp (bfd_get_target (ubfd), "binary") == 0)
+ return kbfd->arch_info;
+ return NULL;
}
/*