Add match_priority.
* configure.in: Bump bfd version.
* elfcode.h (elf_object_p): Delete hacks preventing match of
EM_NONE and ELFOSABI_NONE targets when a better match exists.
* elfxx-target.h (elf_match_priority): Define and use.
* format.c (bfd_check_format_matches): Use target match_priority
to choose best of multiple matching targets. In cases with multiple
matches rerun _bfd_check_format if we don't choose the last match.
* aout-adobe.c, * aout-arm.c, * aout-target.h, * aout-tic30.c,
* binary.c, * bout.c, * coff-alpha.c, * coff-i386.c, * coff-i860.c,
* coff-i960.c, * coff-ia64.c, * coff-mips.c, * coff-or32.c,
* coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-tic30.c,
* coff-tic54x.c, * coff-x86_64.c, * coff64-rs6000.c, * coffcode.h,
* i386msdos.c, * i386os9k.c, * ieee.c, * ihex.c, * mach-o-target.c,
* mipsbsd.c, * mmo.c, * nlm-target.h, * oasys.c, * pdp11.c,
* pe-mips.c, * pef.c, * plugin.c, * ppcboot.c, * som.c, * srec.c,
* tekhex.c, * trad-core.c, * verilog.c, * versados.c, * vms-alpha.c,
* vms-lib.c, * xsym.c: Init match_priority field.
* configure: Regenerate.
* bfd-in2.h: Regenerate.
+2011-06-06 Alan Modra <amodra@gmail.com>
+
+ * targets.c (bfd_target): Make ar_max_namelen an unsigned char.
+ Add match_priority.
+ * configure.in: Bump bfd version.
+ * elfcode.h (elf_object_p): Delete hacks preventing match of
+ EM_NONE and ELFOSABI_NONE targets when a better match exists.
+ * elfxx-target.h (elf_match_priority): Define and use.
+ * format.c (bfd_check_format_matches): Use target match_priority
+ to choose best of multiple matching targets. In cases with multiple
+ matches rerun _bfd_check_format if we don't choose the last match.
+ * aout-adobe.c, * aout-arm.c, * aout-target.h, * aout-tic30.c,
+ * binary.c, * bout.c, * coff-alpha.c, * coff-i386.c, * coff-i860.c,
+ * coff-i960.c, * coff-ia64.c, * coff-mips.c, * coff-or32.c,
+ * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-tic30.c,
+ * coff-tic54x.c, * coff-x86_64.c, * coff64-rs6000.c, * coffcode.h,
+ * i386msdos.c, * i386os9k.c, * ieee.c, * ihex.c, * mach-o-target.c,
+ * mipsbsd.c, * mmo.c, * nlm-target.h, * oasys.c, * pdp11.c,
+ * pe-mips.c, * pef.c, * plugin.c, * ppcboot.c, * som.c, * srec.c,
+ * tekhex.c, * trad-core.c, * verilog.c, * versados.c, * vms-alpha.c,
+ * vms-lib.c, * xsym.c: Init match_priority field.
+ * configure: Regenerate.
+ * bfd-in2.h: Regenerate.
+
2011-06-04 H.J. Lu <hongjiu.lu@intel.com>
PR ld/12842
/* BFD back-end for a.out.adobe binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2011
Free Software Foundation, Inc.
Written by Cygnus Support. Based on bout.c.
'_', /* Symbol leading char. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
/* BFD back-end for raw ARM a.out binaries.
Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005,
- 2007, 2009, 2010 Free Software Foundation, Inc.
+ 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library.
MY_symbol_leading_char,
AR_PAD_CHAR, /* AR_pad_char. */
15, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
MY_symbol_leading_char,
- AR_PAD_CHAR, /* AR_pad_char. */
- 15, /* AR_max_namelen. */
+ AR_PAD_CHAR, /* AR_pad_char. */
+ 15, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
/* Define a target vector and some small routines for a variant of a.out.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
MY_symbol_leading_char,
AR_PAD_CHAR, /* AR_pad_char. */
15, /* AR_max_namelen. */
+ 0, /* match priority. */
#ifdef TARGET_IS_BIG_ENDIAN_P
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
/* BFD back-end for TMS320C30 a.out binaries.
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009,
- 2010
+ 2010, 2011
Free Software Foundation, Inc.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
MY_symbol_leading_char,
AR_PAD_CHAR, /* AR_pad_char. */
15, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
char ar_pad_char;
/* The maximum number of characters in an archive header. */
- unsigned short ar_max_namelen;
+ unsigned char ar_max_namelen;
+
+ /* How well this target matches, used to select between various
+ possible targets when more than one target matches. */
+ unsigned char match_priority;
/* Entries for byte swapping for data. These are different from the
other entry points, since they don't take a BFD as the first argument.
/* BFD back-end for binary objects.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007, 2009, 2011 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
This file is part of BFD, the Binary File Descriptor library.
0, /* symbol_leading_char */
' ', /* ar_pad_char */
16, /* ar_max_namelen */
+ 255, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
/* BFD back-end for Intel 960 b.out binaries.
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.
Written by Cygnus Support.
'_', /* Symbol leading char. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
-
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
'_', /* Symbol leading char. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
/* BFD back-end for ALPHA Extended-Coff files.
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2007, 2008, 2009, 2010
+ 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
Ian Lance Taylor <ian@cygnus.com>.
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
/* BFD back-end for Intel 386 COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Written by Cygnus Support.
#endif
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
'_', /* leading underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
/* BFD back-end for Intel 960 COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2011
+ Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
'_', /* leading underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
/* BFD back-end for HP/Intel IA-64 COFF files.
- Copyright 1999, 2000, 2001, 2002, 2005, 2007, 2008, 2009
+ Copyright 1999, 2000, 2001, 2002, 2005, 2007, 2008, 2009, 2011
Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
#endif
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
/* BFD back-end for MIPS Extended-Coff files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2011
Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16,
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
/* BFD back-end for OpenRISC 1000 COFF binaries.
- Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2011
Free Software Foundation, Inc.
Contributed by Ivan Guzvinec <ivang@opencores.org>
'_', /* Leading underscore. */
'/', /* ar_pad_char. */
15, /* ar_max_namelen. */
+ 0, /* match priority. */
/* Data. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
0, /* leading char */
'/', /* ar_pad_char */
15, /* ar_max_namelen??? FIXMEmgo */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
0, /* leading char */
'/', /* ar_pad_char */
15, /* ar_max_namelen??? FIXMEmgo */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
/* BFD back-end for IBM RS/6000 "XCOFF" files.
Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009, 2010
+ 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Written by Metin G. Ozisik, Mimi Phuong-Thao Vo, and John Gilmore.
Archive support from Damon A. Permezel.
0, /* leading char */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
/* data */
bfd_getb64,
0, /* leading char */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
/* data */
bfd_getb64,
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
/* BFD back-end for TMS320C30 coff binaries.
- Copyright 1998, 1999, 2000, 2001, 2002, 2005, 2007, 2008
+ Copyright 1998, 1999, 2000, 2001, 2002, 2005, 2007, 2008, 2011
Free Software Foundation, Inc.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
/* BFD back-end for TMS320C54X coff binaries.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2011
Free Software Foundation, Inc.
Contributed by Timothy Wall (twall@cygnus.com)
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
/* BFD back-end for AMD 64 COFF files.
- Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright 2006, 2007, 2008, 2009, 2010, 2011
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
#endif
'/', /* Ar_pad_char. */
15, /* Ar_max_namelen. */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
/* BFD back-end for IBM RS/6000 "XCOFF64" files.
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
- 2010
+ 2010, 2011
Free Software Foundation, Inc.
Written Clinton Popetz.
Contributed by Cygnus Support.
0, /* leading char */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
/* data */
bfd_getb64,
0, /* leading char */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
/* data */
bfd_getb64,
/* Support for the generic parts of most COFF variants, for BFD.
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.
Written by Cygnus Support.
UNDER, /* Leading symbol underscore. */ \
'/', /* AR_pad_char. */ \
15, /* AR_max_namelen. */ \
+ 0, /* match priority. */ \
\
/* Data conversion functions. */ \
bfd_getb64, bfd_getb_signed_64, bfd_putb64, \
UNDER, /* Leading symbol underscore. */ \
'/', /* AR_pad_char. */ \
15, /* AR_max_namelen. */ \
+ 0, /* match priority. */ \
\
/* Data conversion functions. */ \
bfd_getb64, bfd_getb_signed_64, bfd_putb64, \
UNDER, /* Leading symbol underscore. */ \
'/', /* AR_pad_char. */ \
15, /* AR_max_namelen. */ \
+ 0, /* match priority. */ \
\
/* Data conversion functions. */ \
bfd_getl64, bfd_getl_signed_64, bfd_putl64, \
# Define the identity of the package.
PACKAGE=bfd
- VERSION=2.21.51
+ VERSION=2.21.52
cat >>confdefs.h <<_ACEOF
AC_CANONICAL_TARGET
AC_ISC_POSIX
-AM_INIT_AUTOMAKE(bfd, 2.21.51)
+AM_INIT_AUTOMAKE(bfd, 2.21.52)
dnl These must be called before LT_INIT, because it may want
dnl to call AC_CHECK_PROG.
asection *s;
bfd_size_type amt;
const bfd_target *target;
- const bfd_target * const *target_ptr;
preserve.marker = NULL;
&& (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;
}
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)
{
/* Target definitions for NN-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
#define elf_backend_is_function_type _bfd_elf_is_function_type
#endif
+#ifndef elf_match_priority
+#define elf_match_priority \
+ (ELF_ARCH == bfd_arch_unknown ? 2 : ELF_OSABI == ELFOSABI_NONE ? 1 : 0)
+#endif
+
extern const struct elf_size_info _bfd_elfNN_size_info;
static struct elf_backend_data elfNN_bed =
Chapter 7 (Formats & Protocols), Archive section sets this as 15. */
15,
+ elf_match_priority,
+
/* Routines to byte-swap various sized integers from the data sections */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
Chapter 7 (Formats & Protocols), Archive section sets this as 15. */
15,
+ elf_match_priority,
+
/* Routines to byte-swap various sized integers from the data sections */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
extern const bfd_target binary_vec;
const bfd_target * const *target;
const bfd_target **matching_vector = NULL;
- const bfd_target *save_targ, *right_targ, *ar_right_targ;
- int match_count;
+ const bfd_target *save_targ, *right_targ, *ar_right_targ, *match_targ;
+ int match_count, best_count, best_match;
int ar_match_index;
if (matching != NULL)
right_targ = 0;
ar_right_targ = 0;
+ match_targ = 0;
+ best_match = 256;
+ best_count = 0;
/* Presume the answer is yes. */
abfd->format = format;
/* Don't check the default target twice. */
if (*target == &binary_vec
- || (!abfd->target_defaulted && *target == save_targ))
+ || (!abfd->target_defaulted && *target == save_targ)
+ || (*target)->match_priority > best_match)
continue;
abfd->xvec = *target; /* Change BFD's target temporarily. */
bfd_set_error (bfd_error_wrong_format);
temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
+ if (temp)
+ match_targ = temp;
if (temp && (abfd->format != bfd_archive || bfd_has_map (abfd)))
{
targets might match. People who want those other targets
have to set the GNUTARGET variable. */
if (temp == bfd_default_vector[0])
- {
- match_count = 1;
- break;
- }
+ goto ok_ret;
if (matching_vector)
matching_vector[match_count] = temp;
match_count++;
+
+ if (temp->match_priority < best_match)
+ {
+ best_match = temp->match_priority;
+ best_count = 0;
+ }
+ best_count++;
}
else if (temp
|| (err = bfd_get_error ()) == bfd_error_wrong_object_format
goto err_ret;
}
+ if (best_count == 1)
+ match_count = 1;
+
if (match_count == 0)
{
/* Try partial matches. */
if (match_count == 1)
{
- ok_ret:
- abfd->xvec = right_targ; /* Change BFD's target permanently. */
+ abfd->xvec = right_targ;
+ /* If we come out of the loop knowing that the last target that
+ matched is the one we want, then ABFD should still be in a usable
+ state (except possibly for XVEC). */
+ if (match_targ != right_targ)
+ {
+ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ goto err_ret;
+ match_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
+ }
+ ok_ret:
/* If the file was opened for update, then `output_has_begun'
some time ago when the file was created. Do not recompute
sections sizes or alignments in _bfd_set_section_contents.
/* BFD back-end for MS-DOS executables.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007, 2009, 2011 Free Software Foundation, Inc.
Written by Bryan Ford of the University of Utah.
Contributed by the Center for Software Science at the
0, /* leading underscore */
' ', /* ar_pad_char */
16, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
/* BFD back-end for os9000 i386 binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, 2002,
- 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007, 2009, 2011 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
0, /* symbol leading char */
' ', /* ar_pad_char */
16, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
/* BFD back-end for ieee-695 objects.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
'_', /* Leading underscore. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
/* BFD back-end for Intel Hex objects.
Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2009 Free Software Foundation, Inc.
+ 2006, 2007, 2009, 2011 Free Software Foundation, Inc.
Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>.
This file is part of BFD, the Binary File Descriptor library.
0, /* Leading underscore. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
/* Mach-O support for BFD.
- Copyright 1999, 2000, 2001, 2002, 2005, 2007, 2008, 2009, 2010
+ Copyright 1999, 2000, 2001, 2002, 2005, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
'_', /* symbol_leading_char. */
' ', /* ar_pad_char. */
16, /* ar_max_namelen. */
+ 0, /* match priority. */
#if TARGET_BIG_ENDIAN
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
/* BFD backend for MIPS BSD (a.out) binaries.
Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2005, 2007, 2009 Free Software Foundation, Inc.
+ 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
Written by Ralph Campbell.
This file is part of BFD, the Binary File Descriptor library.
MY_symbol_leading_char,
' ', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
MY_symbol_leading_char,
' ', /* ar_pad_char */
15, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
/* BFD back-end for mmo objects (MMIX-specific object-format).
- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
Free Software Foundation, Inc.
Written by Hans-Peter Nilsson (hp@bitrange.com).
Infrastructure and other bits originally copied from srec.c and
0, /* leading underscore */
' ', /* ar_pad_char */
16, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
/* Target definitions for 32/64-bit NLM (NetWare Loadable Module)
Copyright 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2007, 2009 Free Software Foundation, Inc.
+ 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
of the archiver and should be independently tunable. This value is
a WAG (wild a** guess). */
15,
+ 0, /* match priority. */
/* Routines to byte-swap various sized integers from the data sections. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
of the archiver and should be independently tunable. This value is
a WAG (wild a** guess). */
15,
+ 0, /* match priority. */
/* Routines to byte-swap various sized integers from the data sections. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
/* BFD back-end for oasys objects.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+ 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support, <sac@cygnus.com>.
0, /* Leading underscore. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
/* BFD back-end for PDP-11 a.out binaries.
- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
MY_symbol_leading_char,
AR_PAD_CHAR, /* AR_pad_char. */
15, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getp32, bfd_getp_signed_32, bfd_putp32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
/* BFD back-end for MIPS PE COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Modified from coff-i386.c by DJ Delorie, dj@cygnus.com
#endif
'/', /* AR_pad_char. */
15, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
0, /* Symbol_leading_char. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
0, /* Symbol_leading_char. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
/* Plugin support for BFD.
- Copyright 2009
+ Copyright 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
0, /* symbol_leading_char. */
'/', /* ar_pad_char. */
15, /* ar_max_namelen. */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
/* BFD back-end for PPCbug boot records.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com>
This file is part of BFD, the Binary File Descriptor library.
0, /* symbol_leading_char */
' ', /* ar_pad_char */
16, /* ar_max_namelen */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
0,
'/', /* AR_pad_char. */
14, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
/* BFD back-end for s-record objects.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
0, /* Leading underscore. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
0, /* Leading underscore. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
. char ar_pad_char;
.
. {* The maximum number of characters in an archive header. *}
-. unsigned short ar_max_namelen;
+. unsigned char ar_max_namelen;
+.
+. {* How well this target matches, used to select between various
+. possible targets when more than one target matches. *}
+. unsigned char match_priority;
.
. {* Entries for byte swapping for data. These are different from the
. other entry points, since they don't take a BFD as the first argument.
/* BFD backend for Extended Tektronix Hex Format objects.
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007, 2009, 2011 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
This file is part of BFD, the Binary File Descriptor library.
0, /* Leading underscore. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
/* BFD back end for traditional Unix core files (U-area and raw sections)
Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2011
Free Software Foundation, Inc.
Written by John Gilmore of Cygnus Support.
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- 0, /* symbol prefix */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
+ 0, /* symbol prefix */
+ ' ', /* ar_pad_char */
+ 16, /* ar_max_namelen */
+ 0, /* match priority. */
NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data */
NO_GET, NO_GETS, NO_PUT, /* 32 bit data */
NO_GET, NO_GETS, NO_PUT, /* 16 bit data */
/* BFD back-end for verilog hex memory dump files.
- Copyright 2009, 2010
+ Copyright 2009, 2010, 2011
Free Software Foundation, Inc.
Written by Anthony Green <green@moxielogic.com>
0, /* Leading underscore. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
/* BFD back-end for VERSAdos-E objects.
Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+ 2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
Versados is a Motorola trademark.
0, /* Leading underscore. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
0, /* symbol_leading_char. */
' ', /* ar_pad_char. */
15, /* ar_max_namelen. */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16,
/* BFD back-end for VMS archive files.
- Copyright 2010 Free Software Foundation, Inc.
+ Copyright 2010, 2011 Free Software Foundation, Inc.
Written by Tristan Gingold <gingold@adacore.com>, AdaCore.
This file is part of BFD, the Binary File Descriptor library.
0, /* symbol_leading_char. */
' ', /* ar_pad_char. */
15, /* ar_max_namelen. */
+ 0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16,
/* xSYM symbol-file support for BFD.
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
- 2009, 2010 Free Software Foundation, Inc.
+ 2009, 2010, 2011 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
0, /* Symbol_leading_char. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
+ 0, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */