Add new field to bfd_target structure.
authorNick Clifton <nickc@redhat.com>
Mon, 19 Jul 1999 14:55:16 +0000 (14:55 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 19 Jul 1999 14:55:16 +0000 (14:55 +0000)
Initialise this field for all known bfd targets.
Add new search function to targets.c

55 files changed:
bfd/ChangeLog
bfd/aix386-core.c
bfd/aout-adobe.c
bfd/aout-arm.c
bfd/aout-target.h
bfd/aout-tic30.c
bfd/bfd-in2.h
bfd/binary.c
bfd/bout.c
bfd/cisco-core.c
bfd/coff-a29k.c
bfd/coff-alpha.c
bfd/coff-apollo.c
bfd/coff-arm.c
bfd/coff-h8300.c
bfd/coff-h8500.c
bfd/coff-i386.c
bfd/coff-i860.c
bfd/coff-i960.c
bfd/coff-m68k.c
bfd/coff-mcore.c
bfd/coff-mips.c
bfd/coff-ppc.c
bfd/coff-rs6000.c
bfd/coff-sh.c
bfd/coff-sparc.c
bfd/coff-tic30.c
bfd/coff-tic80.c
bfd/coff-w65.c
bfd/coff-we32k.c
bfd/coff-z8k.c
bfd/coffcode.h
bfd/elfxx-target.h
bfd/hppabsd-core.c
bfd/hpux-core.c
bfd/i386msdos.c
bfd/i386os9k.c
bfd/ieee.c
bfd/ihex.c
bfd/irix-core.c
bfd/mipsbsd.c
bfd/netbsd-core.c
bfd/nlm-target.h
bfd/oasys.c
bfd/osf-core.c
bfd/ppcboot.c
bfd/ptrace-core.c
bfd/sco5-core.c
bfd/som.c
bfd/srec.c
bfd/targets.c
bfd/tekhex.c
bfd/trad-core.c
bfd/versados.c
bfd/vms.c

index 04fa927..f355ed9 100644 (file)
@@ -1,3 +1,71 @@
+1999-07-19  Nick Clifton  <nickc@cygnus.com>
+
+       * targets.c (alternative_target): New field in bfd_target
+       structure.
+       (bfd_search_for_target): New function:  Find a target that
+       satisifies a search function.
+       * bfd-in2.h: Regenerate.
+
+       * elfxx-target.h: Initialise the alternative_target field of
+       the bfd_target structures to point to the other target (if
+       defined).
+       * nlm-target.h: Initialise the alternative_target field of
+       the bfd_target structures to point to the other target (if
+       defined).
+       
+       * coffcode.h (CREATE_BIG_COFF_TARGET_VEC): New macro.
+       (CREATE_LITTLE_COFF_TARGET_VEC): New macro.
+       
+       * aix386-core.c: Initialise new field of bfd_target structure. 
+       * aout-adobe.c: Initialise new field of bfd_target structure. 
+       * aout-arm.c: Initialise new field of bfd_target structure. 
+       * aout-target.h: Initialise new field of bfd_target structure. 
+       * aout-tic30.c: Initialise new field of bfd_target structure. 
+       * binary.c: Initialise new field of bfd_target structure. 
+       * bout.c: Initialise new field of bfd_target structure. 
+       * cisco-core.c: Initialise new field of bfd_target structure. 
+       * coff-a29k.c: Use CREATE_BIG_COFF_TARGET_VEC.
+       * coff-alpha.c: Initialise new field of bfd_target structure. 
+       * coff-apollo.c: Use CREATE_BIG_COFF_TARGET_VEC.
+       * coff-arm.c: Use CREATE_{BIG|LITTLE}_COFF_TARGET_VEC.
+       * coff-h8300.c: Use CREATE_BIG_COFF_TARGET_VEC.
+       * coff-h8500.c: Use CREATE_BIG_COFF_TARGET_VEC.
+       * coff-i386.c: Initialise new field of bfd_target structure. 
+       * coff-i860.c: Initialise new field of bfd_target structure. 
+       * coff-i960.c: Use CREATE_LITTLE_COFF_TARGET_VEC.
+       * coff-m68k.c: Use CREATE_BIG_COFF_TARGET_VEC.
+       * coff-mcore.c: Use CREATE_{BIG|LITTLE}_COFF_TARGET_VEC.
+       * coff-mips.c: Initialise new field of bfd_target structure. 
+       * coff-ppc.c: Initialise new field of bfd_target structure. 
+       * coff-rs6000.c: Initialise new field of bfd_target structure. 
+       * coff-sh.c:  Use CREATE_{BIG|LITTLE}_COFF_TARGET_VEC.
+       * coff-sparc.c: Use CREATE_BIG_COFF_TARGET_VEC.
+       * coff-tic30.c: Initialise new field of bfd_target structure. 
+       * coff-tic80.c: Use CREATE_LITTLE_COFF_TARGET_VEC.
+       * coff-w65.c:   Use CREATE_LITTLE_COFF_TARGET_VEC.
+       * coff-we32k.c: Use CREATE_BIG_COFF_TARGET_VEC.
+       * coff-z8k.c:   Use CREATE_BIG_COFF_TARGET_VEC.
+       * hppabsd-core.c: Initialise new field of bfd_target structure. 
+       * hpux-core.c: Initialise new field of bfd_target structure. 
+       * i386msdos.c: Initialise new field of bfd_target structure. 
+       * i386os9k.c: Initialise new field of bfd_target structure. 
+       * ieee.c: Initialise new field of bfd_target structure. 
+       * ihex.c: Initialise new field of bfd_target structure. 
+       * irix-core.c: Initialise new field of bfd_target structure. 
+       * mipsbsd.c: Initialise new field of bfd_target structure. 
+       * netbsd-core.c: Initialise new field of bfd_target structure. 
+       * oasys.c: Initialise new field of bfd_target structure. 
+       * osf-core.c: Initialise new field of bfd_target structure. 
+       * ppcboot.c: Initialise new field of bfd_target structure. 
+       * ptrace-core.c: Initialise new field of bfd_target structure. 
+       * sco5-core.c: Initialise new field of bfd_target structure. 
+       * som.c: Initialise new field of bfd_target structure. 
+       * srec.c: Initialise new field of bfd_target structure. 
+       * tekhex.c: Initialise new field of bfd_target structure. 
+       * trad-core.c: Initialise new field of bfd_target structure. 
+       * versados.c: Initialise new field of bfd_target structure. 
+       * vms.c: Initialise new field of bfd_target structure. 
+
 1999-07-19  Andreas Schwab  <schwab@suse.de>
 
        * elflink.h (elf_bfd_final_link): Remove unused variables rel_hash
index a75fa94..fb67b17 100644 (file)
@@ -279,5 +279,7 @@ const bfd_target aix386_core_vec =
      BFD_JUMP_TABLE_LINK (_bfd_nolink),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0
 };
index 60345d6..8216c7e 100644 (file)
@@ -524,5 +524,7 @@ const bfd_target a_out_adobe_vec =
      BFD_JUMP_TABLE_LINK (aout_32),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
index a2c6326..7365f9d 100644 (file)
@@ -467,6 +467,8 @@ MY_swap_std_reloc_out (abfd, g, natptr)
 
 #include "aout-target.h"
 
+extern const bfd_target aout_arm_big_vec;
+
 const bfd_target aout_arm_little_vec =
 {
   "a.out-arm-little",           /* name */
@@ -503,6 +505,8 @@ const bfd_target aout_arm_little_vec =
      BFD_JUMP_TABLE_LINK (MY),
      BFD_JUMP_TABLE_DYNAMIC (MY),
 
+  & aout_arm_big_vec,
+  
   (PTR) MY_backend_data,
 };
 
@@ -542,5 +546,7 @@ const bfd_target aout_arm_big_vec =
      BFD_JUMP_TABLE_LINK (MY),
      BFD_JUMP_TABLE_DYNAMIC (MY),
 
+  & aout_arm_little_vec,
+  
   (PTR) MY_backend_data,
 };
index 876b30a..5ca50ac 100644 (file)
@@ -645,6 +645,9 @@ const bfd_target MY(vec) =
      BFD_JUMP_TABLE_LINK (MY),
      BFD_JUMP_TABLE_DYNAMIC (MY),
 
-  (PTR) MY_backend_data,
+  /* Alternative_target */
+  NULL,
+  
+  (PTR) MY_backend_data
 };
 #endif /* MY_BFD_TARGET */
index 853c09a..0dcae0c 100644 (file)
@@ -1060,6 +1060,8 @@ const bfd_target tic30_aout_vec =
   BFD_JUMP_TABLE_LINK (MY),
   BFD_JUMP_TABLE_DYNAMIC (MY),
 
-  (PTR) MY_backend_data,
+  NULL,
+  
+  (PTR) MY_backend_data
 };
 #endif /* MY_BFD_TARGET */
index cbf883d..fa3c42e 100644 (file)
@@ -3002,8 +3002,12 @@ CAT(NAME,_canonicalize_dynamic_reloc)
    /* Read in the dynamic relocs.  */
   long  (*_bfd_canonicalize_dynamic_reloc)
     PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
-
+    
+ /* Opposite endian version of this target.  */
+ const struct bfd_target * alternative_target;
  PTR backend_data;
 } bfd_target;
 boolean 
 bfd_set_default_target  PARAMS ((const char *name));
@@ -3014,6 +3018,9 @@ bfd_find_target PARAMS ((CONST char *target_name, bfd *abfd));
 const char **
 bfd_target_list PARAMS ((void));
 
+const bfd_target *
+bfd_search_for_target PARAMS ((int (* search_func)(const bfd_target *, void *), void *));
+
 boolean 
 bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
 
index b5b2fad..c2980b0 100644 (file)
@@ -382,5 +382,7 @@ const bfd_target binary_vec =
   BFD_JUMP_TABLE_LINK (binary),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   NULL
 };
index 2e2b4b2..dd1754a 100644 (file)
@@ -1453,6 +1453,8 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
 #define aout_32_get_section_contents_in_window \
   _bfd_generic_get_section_contents_in_window
 
+extern const bfd_target b_out_vec_little_host;
+
 const bfd_target b_out_vec_big_host =
 {
   "b.out.big",                 /* name */
@@ -1490,6 +1492,8 @@ const bfd_target b_out_vec_big_host =
      BFD_JUMP_TABLE_LINK (b_out),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  & b_out_vec_little_host,
+  
   (PTR) 0,
 };
 
@@ -1531,5 +1535,7 @@ const bfd_target b_out_vec_little_host =
      BFD_JUMP_TABLE_LINK (b_out),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  & b_out_vec_big_host,
+  
   (PTR) 0
 };
index 11c9bbd..e1fa177 100644 (file)
@@ -323,5 +323,7 @@ const bfd_target cisco_core_vec =
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0                    /* backend_data */
 };
index cfd88ef..9eb6844 100644 (file)
@@ -601,61 +601,4 @@ coff_a29k_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
 
 #include "coffcode.h"
 
-const bfd_target a29kcoff_big_vec =
-{
-  "coff-a29k-big",             /* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,              /* data byte order is big */
-  BFD_ENDIAN_BIG,              /* header byte order is big */
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC /* section flags */
-   | SEC_LOAD | SEC_RELOC  
-   | SEC_READONLY ),
-  '_',                         /* leading underscore */
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-  /* data */
-  bfd_getb64, bfd_getb_signed_64, bfd_putb64,
-     bfd_getb32, bfd_getb_signed_32,   bfd_putb32,
-     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
-  /* hdrs */
-  bfd_getb64, bfd_getb_signed_64, bfd_putb64,
-     bfd_getb32, bfd_getb_signed_32,   bfd_putb32,
-     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
-
- {
-           
-   _bfd_dummy_target,
-   coff_object_p,
-   bfd_generic_archive_p,
-   _bfd_dummy_target
-  },
- {
-   bfd_false,
-   coff_mkobject,
-   _bfd_generic_mkarchive,
-   bfd_false
-  },
- {
-   bfd_false,
-   coff_write_object_contents,
-   _bfd_write_archive_contents,
-   bfd_false
-  },
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE
- };
+CREATE_BIG_COFF_TARGET_VEC (a29kcoff_big_vec, "coff-a29k-big", 0, SEC_READONLY, '_', NULL)
index d841663..5d7187f 100644 (file)
@@ -2398,5 +2398,7 @@ const bfd_target ecoffalpha_little_vec =
      BFD_JUMP_TABLE_LINK (_bfd_ecoff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) &alpha_ecoff_backend_data
 };
index 253ec89..6075d52 100644 (file)
@@ -105,57 +105,16 @@ apollo_howto2rtype (internal)
 
 #include "coffcode.h"
 
-const bfd_target 
-#ifdef TARGET_SYM
-  TARGET_SYM =
-#else
-  apollocoff_vec =
+#ifndef TARGET_SYM
+#define TARGET_SYM apollocoff_vec
 #endif
-{
-#ifdef TARGET_NAME
-  TARGET_NAME,
-#else
-  "apollo-m68k",                       /* name */
-#endif
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,              /* data byte order is big */
-  BFD_ENDIAN_BIG,              /* header byte order is big */
 
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT),
+#ifndef TARGET_NAME
+#define TARGET_NAME "apollo-m68k"
+#endif
 
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
 #ifdef NAMES_HAVE_UNDERSCORE
-  '_',
+CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, 0, 0, '_', NULL)
 #else
-  0,                           /* leading underscore */
+CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, 0, 0, 0, NULL)
 #endif
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-  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_getb64, bfd_getb_signed_64, bfd_putb64,
-     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
-   bfd_generic_archive_p, _bfd_dummy_target},
- {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
-   bfd_false},
- {bfd_false, coff_write_object_contents, /* bfd_write_contents */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE
- };
index 250373d..2af1a94 100644 (file)
@@ -2428,128 +2428,33 @@ arm_bfd_coff_swap_sym_in (abfd, ext1, in1)
 
 #include "coffcode.h"
 
-const bfd_target
-#ifdef TARGET_LITTLE_SYM
-TARGET_LITTLE_SYM =
-#else
-armcoff_little_vec =
+#ifndef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM armcoff_little_vec
 #endif
-{
-#ifdef TARGET_LITTLE_NAME
-  TARGET_LITTLE_NAME,
-#else
-  "coff-arm-little",
+#ifndef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "coff-arm-little"
 #endif
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_LITTLE,           /* data byte order is little */
-  BFD_ENDIAN_LITTLE,           /* header byte order is little */
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-#ifndef COFF_WITH_PE
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
-#else
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
-   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
+#ifndef TARGET_BIG_SYM
+#define TARGET_BIG_SYM armcoff_big_vec
 #endif
-
-#ifdef TARGET_UNDERSCORE
-  TARGET_UNDERSCORE,           /* leading underscore */
-#else
-  0,                           /* leading underscore */
+#ifndef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "coff-arm-big"
 #endif
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-
-  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_getl64, bfd_getl_signed_64, bfd_putl64,
-     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
-     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
-/* Note that we allow an object file to be treated as a core file as well. */
-    {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
-       bfd_generic_archive_p, coff_object_p},
-    {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
-       bfd_false},
-    {bfd_false, coff_write_object_contents, /* bfd_write_contents */
-       _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  (PTR) & bfd_coff_std_swap_table,
-};
 
-const bfd_target
-#ifdef TARGET_BIG_SYM
-TARGET_BIG_SYM =
-#else
-armcoff_big_vec =
+#ifndef TARGET_UNDERSCORE
+#define TARGET_UNDERSCORE 0
 #endif
-{
-#ifdef TARGET_BIG_NAME
-  TARGET_BIG_NAME,
+
+#ifdef COFF_WITH_PE
+#define EXTRA_S_FLAGS (SEC_LINK_ONCE | SEC_LINK_DUPLICATES)
 #else
-  "coff-arm-big",
+#define EXTRA_S_FLAGS 0
 #endif
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,              /* data byte order is big */
-  BFD_ENDIAN_BIG,              /* header byte order is big */
 
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
+/* Forward declaration for use initialising alternative_target field.  */
+extern const bfd_target TARGET_BIG_SYM ;
 
-#ifndef COFF_WITH_PE
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
-#else
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
-   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
-#endif
+/* Target vectors.  */
+CREATE_LITTLE_COFF_TARGET_VEC (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, D_PAGED, EXTRA_S_FLAGS, TARGET_UNDERSCORE, & TARGET_BIG_SYM)
+CREATE_BIG_COFF_TARGET_VEC (TARGET_BIG_SYM, TARGET_BIG_NAME, D_PAGED, EXTRA_S_FLAGS, TARGET_UNDERSCORE, & TARGET_LITTLE_SYM)
 
-#ifdef TARGET_UNDERSCORE
-  TARGET_UNDERSCORE,           /* leading underscore */
-#else
-  0,                           /* leading underscore */
-#endif
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-
-  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_getb64, bfd_getb_signed_64, bfd_putb64,
-     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
-/* Note that we allow an object file to be treated as a core file as well. */
-    {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
-       bfd_generic_archive_p, coff_object_p},
-    {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
-       bfd_false},
-    {bfd_false, coff_write_object_contents, /* bfd_write_contents */
-       _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  (PTR) & bfd_coff_std_swap_table,
-};
index ea947ea..3c1125c 100644 (file)
@@ -1346,44 +1346,4 @@ h8300_bfd_link_add_symbols(abfd, info)
 #define coff_bfd_relax_section bfd_coff_reloc16_relax_section
 
 
-
-const bfd_target h8300coff_vec =
-{
-  "coff-h8300",                        /* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,              /* data byte order is big */
-  BFD_ENDIAN_BIG,              /* header byte order is big */
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE ),
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),       /* section flags */
-  '_',                         /* leading char */
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-  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_getb64, bfd_getb_signed_64, bfd_putb64,
-  bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-  bfd_getb16, bfd_getb_signed_16, bfd_putb16,  /* hdrs */
-
-  {_bfd_dummy_target, coff_object_p,   /* bfd_check_format */
-   bfd_generic_archive_p, _bfd_dummy_target},
-  {bfd_false, coff_mkobject, _bfd_generic_mkarchive,   /* bfd_set_format */
-   bfd_false},
-  {bfd_false, coff_write_object_contents,      /* bfd_write_contents */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
+CREATE_BIG_COFF_TARGET_VEC (h8300coff_vec, "coff-h8300", BFD_IS_RELAXABLE, 0, '_', NULL)
index 91109ea..22eeaa5 100644 (file)
@@ -311,44 +311,4 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
   bfd_coff_reloc16_get_relocated_section_contents
 #define coff_bfd_relax_section bfd_coff_reloc16_relax_section
 
-const bfd_target h8500coff_vec =
-{
-  "coff-h8500",                        /* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,              /* data byte order is big */
-  BFD_ENDIAN_BIG,              /* header byte order is big */
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),       /* section flags */
-  '_',                         /* leading symbol underscore */
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-  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_getb64, bfd_getb_signed_64, bfd_putb64,
-     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-     bfd_getb16, bfd_getb_signed_16, bfd_putb16,       /* hdrs */
-
-  {_bfd_dummy_target, coff_object_p,   /* bfd_check_format */
-   bfd_generic_archive_p, _bfd_dummy_target},
-  {bfd_false, coff_mkobject, _bfd_generic_mkarchive,   /* bfd_set_format */
-   bfd_false},
-  {bfd_false, coff_write_object_contents,      /* bfd_write_contents */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
+CREATE_BIG_COFF_TARGET_VEC (h8500coff_vec, "coff-h8500", 0, 0, '_', NULL)
index b3fdc4a..0d10fe2 100644 (file)
@@ -633,5 +633,7 @@ const bfd_target
      BFD_JUMP_TABLE_LINK (coff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  COFF_SWAP_TABLE,
+  NULL,
+  
+  COFF_SWAP_TABLE
 };
index e07f9d4..ab3bb5f 100644 (file)
@@ -418,5 +418,7 @@ const bfd_target
      BFD_JUMP_TABLE_LINK (coff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  COFF_SWAP_TABLE,
+  NULL,
+  
+  COFF_SWAP_TABLE
 };
index ab4d4b6..2a7ebfb 100644 (file)
@@ -616,49 +616,9 @@ coff_i960_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
 
 #include "coffcode.h"
 
-const bfd_target icoff_little_vec =
-{
-  "coff-Intel-little",         /* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_LITTLE,           /* data byte order is little */
-  BFD_ENDIAN_LITTLE,           /* header byte order is little */
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
-  '_',                         /* leading underscore */
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-
-  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_getl64, bfd_getl_signed_64, bfd_putl64,
-     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
-     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
-   bfd_generic_archive_p, _bfd_dummy_target},
- {bfd_false, coff_mkobject,    /* bfd_set_format */
-   _bfd_generic_mkarchive, bfd_false},
- {bfd_false, coff_write_object_contents, /* bfd_write_contents */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
+extern const bfd_target icoff_big_vec;
 
+CREATE_LITTLE_COFF_TARGET_VEC (icoff_little_vec, "coff-Intel-little", 0, 0, '_', & icoff_big_vec)
 
 const bfd_target icoff_big_vec =
 {
@@ -700,5 +660,7 @@ bfd_getb64, bfd_getb_signed_64, bfd_putb64,
      BFD_JUMP_TABLE_LINK (coff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  COFF_SWAP_TABLE,
+  & icoff_little_vec,
+  
+  COFF_SWAP_TABLE
 };
index a80f017..d7138c0 100644 (file)
@@ -434,48 +434,8 @@ m68kcoff_common_addend_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
 #define TARGET_NAME "coff-m68k"
 #endif
 
-const bfd_target TARGET_SYM =
-{
-  TARGET_NAME,
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,              /* data byte order is big */
-  BFD_ENDIAN_BIG,              /* header byte order is big */
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
 #ifdef NAMES_HAVE_UNDERSCORE
-  '_',
+CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, D_PAGED, 0, '_', NULL)
 #else
-  0,                           /* leading underscore */
+CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, D_PAGED, 0, 0, NULL)
 #endif
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-  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_getb64, bfd_getb_signed_64, bfd_putb64,
-     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
-   bfd_generic_archive_p, _bfd_dummy_target},
- {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
-   bfd_false},
- {bfd_false, coff_write_object_contents, /* bfd_write_contents */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE
-};
index 04251eb..199a5ab 100644 (file)
@@ -610,121 +610,9 @@ pe_object_p (abfd)
   return coff_object_p (abfd);
 }
 \f
-/* The transfer vectors that lead the outside world to all of the above. */
-
-const bfd_target
-TARGET_BIG_SYM =
-{
-  TARGET_BIG_NAME,
-  bfd_target_coff_flavour,     
-  BFD_ENDIAN_BIG,              /* data byte order is big */
-  BFD_ENDIAN_BIG,              /* header byte order is big */
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
-   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
-
-  0,                           /* leading char */
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-
-  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_getb64, bfd_getb_signed_64, bfd_putb64,
-  bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-  bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
-  { _bfd_dummy_target,
-    pe_object_p,               /* bfd_check_format */
-    bfd_generic_archive_p,     /* _bfd_dummy_target */
-    pe_object_p
-  },
-  { bfd_false,
-    coff_mkobject,
-    _bfd_generic_mkarchive,    /* bfd_set_format */
-    bfd_false
-  },
-  { bfd_false,
-    coff_write_object_contents,        /* bfd_write_contents */
-    _bfd_write_archive_contents,
-    bfd_false
-  },
-
-  BFD_JUMP_TABLE_GENERIC (coff),
-  BFD_JUMP_TABLE_COPY (coff),
-  BFD_JUMP_TABLE_CORE (_bfd_nocore),
-  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-  BFD_JUMP_TABLE_SYMBOLS (coff),
-  BFD_JUMP_TABLE_RELOCS (coff),
-  BFD_JUMP_TABLE_WRITE (coff),
-  BFD_JUMP_TABLE_LINK (coff),
-  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
-
-const bfd_target
-TARGET_LITTLE_SYM =
-{
-  TARGET_LITTLE_NAME,
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_LITTLE,           /* data byte order is little */
-  BFD_ENDIAN_LITTLE,           /* header byte order is little */
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
-   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
-  
-  0,                           /* leading underscore */
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-
-  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_getl64, bfd_getl_signed_64, bfd_putl64,
-  bfd_getl32, bfd_getl_signed_32, bfd_putl32,
-  bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
-/* Note that we allow an object file to be treated as a core file as well. */
-  {
-    _bfd_dummy_target,
-    pe_object_p,               /* bfd_check_format */
-    bfd_generic_archive_p,
-    pe_object_p
-  },
-  {
-    bfd_false,
-    coff_mkobject,
-    _bfd_generic_mkarchive,    /* bfd_set_format */
-    bfd_false
-  },
-  {
-    bfd_false,
-    coff_write_object_contents, /* bfd_write_contents */
-    _bfd_write_archive_contents,
-    bfd_false
-  },
-
-  BFD_JUMP_TABLE_GENERIC (coff),
-  BFD_JUMP_TABLE_COPY (coff),
-  BFD_JUMP_TABLE_CORE (_bfd_nocore),
-  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-  BFD_JUMP_TABLE_SYMBOLS (coff),
-  BFD_JUMP_TABLE_RELOCS (coff),
-  BFD_JUMP_TABLE_WRITE (coff),
-  BFD_JUMP_TABLE_LINK (coff),
-  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
+/* Forward declaration to initialise alterbative_target field.  */
+extern const bfd_target TARGET_LITTLE_SYM;
 
+/* The transfer vectors that lead the outside world to all of the above. */
+CREATE_BIG_COFF_TARGET_VEC (TARGET_BIG_SYM, TARGET_BIG_NAME, D_PAGED, (SEC_LINK_ONCE | SEC_LINK_DUPLICATES), 0, & TARGET_LITTLE_SYM)
+CREATE_LITTLE_COFF_TARGET_VEC (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, D_PAGED, (SEC_LINK_ONCE | SEC_LINK_DUPLICATES), 0, & TARGET_BIG_SYM)
index dfadbe8..9ca395b 100644 (file)
@@ -2601,6 +2601,8 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
 /* GC of sections is not done.  */
 #define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
 
+extern const bfd_target ecoff_big_vec;
+
 const bfd_target ecoff_little_vec =
 {
   "ecoff-littlemips",          /* name */
@@ -2640,6 +2642,8 @@ const bfd_target ecoff_little_vec =
      BFD_JUMP_TABLE_LINK (_bfd_ecoff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  & ecoff_big_vec,
+  
   (PTR) &mips_ecoff_backend_data
 };
 
@@ -2681,6 +2685,8 @@ const bfd_target ecoff_big_vec =
      BFD_JUMP_TABLE_LINK (_bfd_ecoff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  & ecoff_little_vec,
+  
   (PTR) &mips_ecoff_backend_data
 };
 
@@ -2723,5 +2729,7 @@ const bfd_target ecoff_biglittle_vec =
      BFD_JUMP_TABLE_LINK (_bfd_ecoff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) &mips_ecoff_backend_data
 };
index 27982b5..6d5e781 100644 (file)
@@ -2824,11 +2824,15 @@ ppc_bfd_coff_final_link (abfd, info)
 #endif
 \f
 
+/* Forward declaration for use by alternative_target field.  */
+#ifdef TARGET_BIG_SYM
+extern const bfd_target TARGET_BIG_SYM;
+#endif
+
 /* The transfer vectors that lead the outside world to all of the above. */
 
 #ifdef TARGET_LITTLE_SYM
-const bfd_target
-TARGET_LITTLE_SYM =
+const bfd_target TARGET_LITTLE_SYM =
 {
   TARGET_LITTLE_NAME,          /* name or coff-arm-little */
   bfd_target_coff_flavour,
@@ -2874,14 +2878,20 @@ TARGET_LITTLE_SYM =
   BFD_JUMP_TABLE_WRITE (coff),
   BFD_JUMP_TABLE_LINK (coff),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+  /* Alternative_target.  */
+#ifdef TARGET_BIG_SYM
+  & TARGET_BIG_SYM,
+#else
+  NULL,
+#endif
   
-  COFF_SWAP_TABLE,
+  COFF_SWAP_TABLE
 };
 #endif
 
 #ifdef TARGET_BIG_SYM
-const bfd_target
-TARGET_BIG_SYM =
+const bfd_target TARGET_BIG_SYM =
 {
   TARGET_BIG_NAME,
   bfd_target_coff_flavour,     
@@ -2928,7 +2938,15 @@ TARGET_BIG_SYM =
   BFD_JUMP_TABLE_LINK (coff),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  COFF_SWAP_TABLE,
+
+  /* Alternative_target.  */
+#ifdef TARGET_LITTLE_SYM
+  & TARGET_LITTLE_SYM,
+#else
+  NULL,
+#endif
+  
+  COFF_SWAP_TABLE
 };
 
 #endif
index eec1b12..6923000 100644 (file)
@@ -1415,5 +1415,7 @@ const bfd_target
      BFD_JUMP_TABLE_LINK (_bfd_xcoff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_xcoff),
 
-  COFF_SWAP_TABLE,
+  NULL,
+  
+  COFF_SWAP_TABLE
 };
index dfa9837..cd54216 100644 (file)
@@ -2679,89 +2679,20 @@ sh_coff_get_relocated_section_contents (output_bfd, link_info, link_order,
 
 /* The target vectors.  */
 
-const bfd_target shcoff_vec =
-{
-  "coff-sh",                   /* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,              /* data byte order is big */
-  BFD_ENDIAN_BIG,              /* header byte order is big */
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),
-  '_',                         /* leading symbol underscore */
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-  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_getb64, bfd_getb_signed_64, bfd_putb64,
-  bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-  bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
+CREATE_BIG_COFF_TARGET_VEC (shcoff_vec, "coff-sh", BFD_IS_RELAXABLE, 0, '_', NULL)
 
-  {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
-     bfd_generic_archive_p, _bfd_dummy_target},
-  {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
-     bfd_false},
-  {bfd_false, coff_write_object_contents, /* bfd_write_contents */
-     _bfd_write_archive_contents, bfd_false},
-
-  BFD_JUMP_TABLE_GENERIC (coff),
-  BFD_JUMP_TABLE_COPY (coff),
-  BFD_JUMP_TABLE_CORE (_bfd_nocore),
-  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-  BFD_JUMP_TABLE_SYMBOLS (coff),
-  BFD_JUMP_TABLE_RELOCS (coff),
-  BFD_JUMP_TABLE_WRITE (coff),
-  BFD_JUMP_TABLE_LINK (coff),
-  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
-
-const bfd_target shlcoff_vec =
-{
-  "coff-shl",                  /* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_LITTLE,           /* data byte order is little */
-  BFD_ENDIAN_LITTLE,           /* header byte order is little endian too*/
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),
-  '_',                         /* leading symbol underscore */
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-  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_getl64, bfd_getl_signed_64, bfd_putl64,
-  bfd_getl32, bfd_getl_signed_32, bfd_putl32,
-  bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
-  {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
-     bfd_generic_archive_p, _bfd_dummy_target},   
-  {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
-     bfd_false},
-  {bfd_false, coff_write_object_contents, /* bfd_write_contents */
-     _bfd_write_archive_contents, bfd_false},
-
-  BFD_JUMP_TABLE_GENERIC (coff),
-  BFD_JUMP_TABLE_COPY (coff),
-  BFD_JUMP_TABLE_CORE (_bfd_nocore),
-  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-  BFD_JUMP_TABLE_SYMBOLS (coff),
-  BFD_JUMP_TABLE_RELOCS (coff),
-  BFD_JUMP_TABLE_WRITE (coff),
-  BFD_JUMP_TABLE_LINK (coff),
-  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+#ifdef TARGET_SHL_SYM
+#define TARGET_SYM TARGET_SHL_SYM
+#else
+#define TARGET_SYM shlcoff_vec
+#endif
+     
+#ifndef TARGET_SHL_NAME
+#define TARGET_SHL_NAME "coff-shl"
+#endif
 
-  COFF_SWAP_TABLE,
-};
+CREATE_LITTLE_COFF_TARGET_VEC (TARGET_SYM, TARGET_SHL_NAME, BFD_IS_RELAXABLE, 0, '_', NULL)
+     
 
 /* Some people want versions of the SH COFF target which do not align
    to 16 byte boundaries.  We implement that by adding a couple of new
@@ -2849,6 +2780,8 @@ static const bfd_coff_backend_data bfd_coff_small_swap_table =
 #define coff_small_get_section_contents_in_window \
   coff_get_section_contents_in_window
 
+extern const bfd_target shlcoff_small_vec;
+
 const bfd_target shcoff_small_vec =
 {
   "coff-sh-small",             /* name */
@@ -2888,6 +2821,8 @@ const bfd_target shcoff_small_vec =
   BFD_JUMP_TABLE_LINK (coff),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  & shlcoff_small_vec,
+  
   (PTR) &bfd_coff_small_swap_table
 };
 
@@ -2930,5 +2865,7 @@ const bfd_target shlcoff_small_vec =
   BFD_JUMP_TABLE_LINK (coff),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  & shcoff_small_vec,
+  
   (PTR) &bfd_coff_small_swap_table
 };
index a2e33e4..5e919da 100644 (file)
@@ -203,55 +203,12 @@ rtype2howto (cache_ptr, dst)
 
 #include "coffcode.h"
 
-const bfd_target
-#ifdef TARGET_SYM
-  TARGET_SYM =
-#else
-  sparccoff_vec =
+#ifndef TARGET_SYM
+#define TARGET_SYM sparccoff_vec
 #endif
-{
-#ifdef TARGET_NAME
-  TARGET_NAME,
-#else
-  "coff-sparc",                        /* name */
-#endif
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,      /* data byte order is big */
-  BFD_ENDIAN_BIG,      /* header byte order is big */
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
-  '_',                         /* leading underscore */
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
 
-  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_getb64, bfd_getb_signed_64, bfd_putb64,
-     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
-/* Note that we allow an object file to be treated as a core file as well. */
-    {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
-       bfd_generic_archive_p, coff_object_p},
-    {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
-       bfd_false},
-    {bfd_false, coff_write_object_contents, /* bfd_write_contents */
-       _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+#ifndef TARGET_NAME
+#define TARGET_NAME "coff-sparc"
+#endif
 
-  COFF_SWAP_TABLE,
-};
+CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, D_PAGED, 0, '_', NULL)
index 3d38da6..a971f76 100644 (file)
@@ -202,5 +202,7 @@ const bfd_target tic30_coff_vec =
   BFD_JUMP_TABLE_LINK (coff),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   COFF_SWAP_TABLE
 };
index bf5c4bb..1132ea6 100644 (file)
@@ -715,45 +715,4 @@ coff_tic80_relocate_section (output_bfd, info, input_bfd,
 #undef C_LASTENT               /* Clashes with TIc80's C_STATLAB */
 #include "coffcode.h"
 
-const bfd_target 
-  tic80coff_vec =
-{
-  "coff-tic80",                        /* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_LITTLE,           /* data byte order is little (arch supports both) */
-  BFD_ENDIAN_LITTLE,           /* header byte order is little */
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
-  '_',                         /* leading underscore */
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-  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_getl64, bfd_getl_signed_64, bfd_putl64,
-     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
-     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
-   bfd_generic_archive_p, _bfd_dummy_target},
- {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
-   bfd_false},
- {bfd_false, coff_write_object_contents, /* bfd_write_contents */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE
- };
+CREATE_LITTLE_COFF_TARGET_VEC (tic80coff_vec, "coff-tic80", D_PAGED, 0, '_', NULL)
index 28d68c3..0379bfb 100644 (file)
@@ -401,45 +401,4 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
   bfd_coff_reloc16_get_relocated_section_contents
 #define coff_bfd_relax_section bfd_coff_reloc16_relax_section
 
-
-
-bfd_target w65_vec =
-{
-  "coff-w65",                  /* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_LITTLE,           /* data byte order is little */
-  BFD_ENDIAN_LITTLE,           /* header byte order is little */
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE ),
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),       /* section flags */
-  '_',                         /* leading char */
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-  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_getl64, bfd_getl_signed_64, bfd_putl64,
-  bfd_getl32, bfd_getl_signed_32, bfd_putl32,
-  bfd_getl16, bfd_getl_signed_16, bfd_putl16,  /* hdrs */
-
-  {_bfd_dummy_target, coff_object_p,   /* bfd_check_format */
-   bfd_generic_archive_p, _bfd_dummy_target},
-  {bfd_false, coff_mkobject, _bfd_generic_mkarchive,   /* bfd_set_format */
-   bfd_false},
-  {bfd_false, coff_write_object_contents,      /* bfd_write_contents */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
+CREATE_LITTLE_COFF_TARGET_VEC (w65_vec, "coff-w95", BFD_IS_RELAXABLE, 0, '_', NULL)
index 84b518d..c559ad7 100644 (file)
@@ -65,45 +65,4 @@ static reloc_howto_type howto_table[] =
 
 #define coff_write_armap bsd_write_armap
 
-const bfd_target we32kcoff_vec =
-{
-  "coff-we32k",                        /* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,              /* data byte order is big */
-  BFD_ENDIAN_BIG,              /* header byte order is big */
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
-  0,                           /* leading underscore */
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-
-  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_getb64, bfd_getb_signed_64, bfd_putb64,
-     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
-   bfd_generic_archive_p, _bfd_dummy_target},
- {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
-   bfd_false},
- {bfd_false, coff_write_object_contents, /* bfd_write_contents */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
+CREATE_BIG_COFF_TARGET_VEC (we32kcoff_vec, "coff-we32k", 0, 0, 0, NULL)
index 04049e8..21f29a8 100644 (file)
@@ -237,44 +237,4 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
   bfd_coff_reloc16_get_relocated_section_contents
 #define coff_bfd_relax_section bfd_coff_reloc16_relax_section
 
-const bfd_target z8kcoff_vec =
-{
-  "coff-z8k",                  /* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,              /* data byte order is big */
-  BFD_ENDIAN_BIG,              /* header byte order is big */
-
-  (HAS_RELOC | EXEC_P |                /* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),       /* section flags */
-  '_',                         /* leading symbol underscore */
-  '/',                         /* ar_pad_char */
-  15,                          /* ar_max_namelen */
-  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_getb64, bfd_getb_signed_64, bfd_putb64,
-     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-     bfd_getb16, bfd_getb_signed_16, bfd_putb16,       /* hdrs */
-
-  {_bfd_dummy_target, coff_object_p,   /* bfd_check_format */
-   bfd_generic_archive_p, _bfd_dummy_target},
-  {bfd_false, coff_mkobject, _bfd_generic_mkarchive,   /* bfd_set_format */
-   bfd_false},
-  {bfd_false, coff_write_object_contents,      /* bfd_write_contents */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
+CREATE_BIG_COFF_TARGET_VEC (z8kcoff_vec, "coff-z8k", 0, 0, '_', NULL)
index 467bde5..f905c94 100644 (file)
@@ -4352,3 +4352,97 @@ static CONST bfd_coff_backend_data bfd_coff_std_swap_table =
 #ifndef coff_bfd_gc_sections
 #define coff_bfd_gc_sections               bfd_generic_gc_sections
 #endif
+
+#define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE)        \
+const bfd_target VAR =                                                                         \
+{                                                                                              \
+  NAME ,                                                                                       \
+  bfd_target_coff_flavour,                                                                     \
+  BFD_ENDIAN_BIG,              /* data byte order is big */                                    \
+  BFD_ENDIAN_BIG,              /* header byte order is big */                                  \
+  /* object flags */                                                                           \
+  (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG |                                               \
+   HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS),                                           \
+  /* section flags */                                                                          \
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),                       \
+  UNDER,                       /* leading symbol underscore */                                 \
+  '/',                         /* ar_pad_char */                                               \
+  15,                          /* ar_max_namelen */                                            \
+                                                                                               \
+  /* Data conversion functions.  */                                                            \
+  bfd_getb64, bfd_getb_signed_64, bfd_putb64,                                                  \
+  bfd_getb32, bfd_getb_signed_32, bfd_putb32,                                                  \
+  bfd_getb16, bfd_getb_signed_16, bfd_putb16,                                                  \
+                                                                                               \
+  /* Header conversion functions.  */                                                          \
+  bfd_getb64, bfd_getb_signed_64, bfd_putb64,                                                  \
+  bfd_getb32, bfd_getb_signed_32, bfd_putb32,                                                  \
+  bfd_getb16, bfd_getb_signed_16, bfd_putb16,                                                  \
+                                                                                               \
+       /* bfd_check_format */                                                                  \
+  { _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, _bfd_dummy_target },              \
+       /* bfd_set_format */                                                                    \
+  { bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false },                             \
+       /* bfd_write_contents */                                                                \
+  { bfd_false, coff_write_object_contents, _bfd_write_archive_contents, bfd_false },           \
+                                                                                               \
+  BFD_JUMP_TABLE_GENERIC (coff),                                                               \
+  BFD_JUMP_TABLE_COPY (coff),                                                                  \
+  BFD_JUMP_TABLE_CORE (_bfd_nocore),                                                           \
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),                                                  \
+  BFD_JUMP_TABLE_SYMBOLS (coff),                                                               \
+  BFD_JUMP_TABLE_RELOCS (coff),                                                                        \
+  BFD_JUMP_TABLE_WRITE (coff),                                                                 \
+  BFD_JUMP_TABLE_LINK (coff),                                                                  \
+  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),                                                     \
+                                                                                               \
+  ALTERNATIVE,                                                                                 \
+                                                                                               \
+  COFF_SWAP_TABLE                                                                              \
+};
+
+#define CREATE_LITTLE_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE)     \
+const bfd_target VAR =                                                                         \
+{                                                                                              \
+  NAME ,                                                                                       \
+  bfd_target_coff_flavour,                                                                     \
+  BFD_ENDIAN_LITTLE,           /* data byte order is little */                                 \
+  BFD_ENDIAN_LITTLE,           /* header byte order is little */                               \
+       /* object flags */                                                                      \
+  (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG |                                               \
+   HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS),                                           \
+       /* section flags */                                                                     \
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),                       \
+  UNDER,                       /* leading symbol underscore */                                 \
+  '/',                         /* ar_pad_char */                                               \
+  15,                          /* ar_max_namelen */                                            \
+                                                                                               \
+  /* Data conversion functions.  */                                                            \
+  bfd_getl64, bfd_getl_signed_64, bfd_putl64,                                                  \
+  bfd_getl32, bfd_getl_signed_32, bfd_putl32,                                                  \
+  bfd_getl16, bfd_getl_signed_16, bfd_putl16,                                                  \
+  /* Header conversion functions.  */                                                          \
+  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_check_format */                                                                  \
+  { _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, _bfd_dummy_target },              \
+       /* bfd_set_format */                                                                    \
+  { bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false },                             \
+       /* bfd_write_contents */                                                                \
+  { bfd_false, coff_write_object_contents, _bfd_write_archive_contents, bfd_false },           \
+                                                                                               \
+  BFD_JUMP_TABLE_GENERIC (coff),                                                               \
+  BFD_JUMP_TABLE_COPY (coff),                                                                  \
+  BFD_JUMP_TABLE_CORE (_bfd_nocore),                                                           \
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),                                                  \
+  BFD_JUMP_TABLE_SYMBOLS (coff),                                                               \
+  BFD_JUMP_TABLE_RELOCS (coff),                                                                        \
+  BFD_JUMP_TABLE_WRITE (coff),                                                                 \
+  BFD_JUMP_TABLE_LINK (coff),                                                                  \
+  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),                                                     \
+                                                                                               \
+  ALTERNATIVE,                                                                                 \
+                                                                                               \
+  COFF_SWAP_TABLE                                                                              \
+};
index 5b06d06..d40a870 100644 (file)
@@ -388,6 +388,11 @@ static CONST struct elf_backend_data elfNN_bed =
   elf_backend_want_dynbss
 };
 
+/* Forward declaration for use when initialising alternative_target field.  */
+#ifdef TARGET_LITTLE_SYM
+extern const bfd_target TARGET_LITTLE_SYM;
+#endif
+
 #ifdef TARGET_BIG_SYM
 const bfd_target TARGET_BIG_SYM =
 {
@@ -471,8 +476,15 @@ const bfd_target TARGET_BIG_SYM =
       BFD_JUMP_TABLE_LINK (bfd_elfNN),
       BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
 
+  /* Alternative endian target.  */
+#ifdef TARGET_LITTLE_SYM
+  & TARGET_LITTLE_SYM,
+#else
+  NULL,
+#endif
+
   /* backend_data: */
-  (PTR) &elfNN_bed,
+  (PTR) &elfNN_bed
 };
 #endif
 
@@ -559,7 +571,14 @@ const bfd_target TARGET_LITTLE_SYM =
       BFD_JUMP_TABLE_LINK (bfd_elfNN),
       BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
 
+  /* Alternative endian target.  */
+#ifdef TARGET_BIG_SYM
+  & TARGET_BIG_SYM,
+#else
+  NULL,
+#endif
+  
   /* backend_data: */
-  (PTR) &elfNN_bed,
+  (PTR) &elfNN_bed
 };
 #endif
index a7c22f5..0a3e6b2 100644 (file)
@@ -298,6 +298,8 @@ const bfd_target hppabsd_core_vec =
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0                    /* backend_data */
 };
 #endif
index 6be709f..bfaa2c2 100644 (file)
@@ -400,5 +400,7 @@ const bfd_target hpux_core_vec =
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0                    /* backend_data */
 };
index 13a2c4f..c9ec864 100644 (file)
@@ -239,6 +239,8 @@ const bfd_target i386msdos_vec =
   BFD_JUMP_TABLE_LINK (msdos),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
 
index 91f204c..0aadee5 100644 (file)
@@ -367,5 +367,7 @@ const bfd_target i386os9k_vec =
      BFD_JUMP_TABLE_LINK (os9k),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0,
 };
index 3c42faa..aebc064 100644 (file)
@@ -3966,5 +3966,7 @@ const bfd_target ieee_vec =
   BFD_JUMP_TABLE_LINK (ieee),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
index 5eb3862..17740d8 100644 (file)
@@ -1037,5 +1037,7 @@ const bfd_target ihex_vec =
   BFD_JUMP_TABLE_LINK (ihex),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
index 964ca20..006e6a7 100644 (file)
@@ -270,6 +270,8 @@ const bfd_target irix_core_vec =
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0                    /* backend_data */
 };
 
index 6abfdc7..7a680fb 100644 (file)
@@ -389,6 +389,8 @@ static CONST struct aout_backend_data MY(backend_data) = {
   0                            /* finish_dynamic_link */
 };
 
+extern const bfd_target aout_mips_big_vec;
+
 const bfd_target aout_mips_little_vec =
 {
   "a.out-mips-little",         /* name */
@@ -425,7 +427,9 @@ const bfd_target aout_mips_little_vec =
      BFD_JUMP_TABLE_LINK (MY),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  (PTR) MY_backend_data,
+  & aout_mips_big_vec,
+  
+  (PTR) MY_backend_data
 };
 
 const bfd_target aout_mips_big_vec =
@@ -464,5 +468,7 @@ const bfd_target aout_mips_big_vec =
      BFD_JUMP_TABLE_LINK (MY),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  (PTR) MY_backend_data,
+  & aout_mips_little_vec,
+  
+  (PTR) MY_backend_data
 };
index 21b184d..828c2a1 100644 (file)
@@ -247,5 +247,7 @@ const bfd_target netbsd_core_vec =
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0                    /* backend_data */
 };
index 6f1d47d..5c1e255 100644 (file)
@@ -55,6 +55,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    There are two such structures here:  one for big-endian machines and
    one for little-endian machines.   */
 
+/* Forward declaration for use when initialising alternative_target field.  */
+#ifdef TARGET_LITTLE_SYM
+extern const bfd_target TARGET_LITTLE_SYM;
+#endif
 
 #ifdef TARGET_BIG_SYM
 const bfd_target TARGET_BIG_SYM =
@@ -137,6 +141,13 @@ const bfd_target TARGET_BIG_SYM =
   BFD_JUMP_TABLE_LINK (nlm),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  /* Alternative endian target.  */
+#ifdef TARGET_LITTLE_SYM
+  & TARGET_LITTLE_SYM,
+#else
+  NULL,
+#endif
+  
   /* backend_data: */
   (PTR) TARGET_BACKEND_DATA
 };
@@ -223,6 +234,13 @@ const bfd_target TARGET_LITTLE_SYM =
   BFD_JUMP_TABLE_LINK (nlm),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  /* Alternative endian target.  */
+#ifdef TARGET_BIG_SYM
+  & TARGET_BIG_SYM,
+#else
+  NULL,
+#endif
+  
   /* backend_data: */
   (PTR) TARGET_BACKEND_DATA
 };
index e4d11c7..e69053b 100644 (file)
@@ -1531,5 +1531,7 @@ const bfd_target oasys_vec =
   BFD_JUMP_TABLE_LINK (oasys),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
index 671f4af..4f4fc12 100644 (file)
@@ -250,5 +250,7 @@ const bfd_target osf_core_vec =
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0                    /* backend_data */
 };
index 4539ee0..d9db826 100644 (file)
@@ -531,5 +531,7 @@ const bfd_target ppcboot_vec =
   BFD_JUMP_TABLE_LINK (ppcboot),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   NULL
 };
index 2b4fdbb..0969dce 100644 (file)
@@ -224,6 +224,8 @@ const bfd_target ptrace_core_vec =
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0                    /* backend_data */
 };
 
index f10c8f1..46c97d2 100644 (file)
@@ -425,5 +425,7 @@ const bfd_target sco5_core_vec =
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0                     /* backend_data */
 };
index ee1fac0..4f6b11f 100644 (file)
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -6257,6 +6257,8 @@ const bfd_target som_vec =
   BFD_JUMP_TABLE_LINK (som),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
 
index e77ba40..aefdc64 100644 (file)
@@ -1318,6 +1318,8 @@ const bfd_target srec_vec =
   BFD_JUMP_TABLE_LINK (srec),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
 
@@ -1373,5 +1375,7 @@ const bfd_target symbolsrec_vec =
   BFD_JUMP_TABLE_LINK (srec),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
index 604c268..f7ad7b0 100644 (file)
@@ -460,10 +460,21 @@ The general target vector.
 .    PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
 .
 
+A pointer to an alternative bfd_target in case the current one is not
+satisfactory.  This can happen when the target cpu supports both big
+and little endian code, and target chosen by the linker has the wrong
+endianness.  The function open_output() in ld/ldlang.c uses this field
+to find an alternative output format that is suitable.
+
+. {* Opposite endian version of this target.  *}  
+. const struct bfd_target * alternative_target;
+. 
+
 Data for use by back-end routines, which isn't generic enough to belong
 in this structure.
 
 . PTR backend_data;
+. 
 .} bfd_target;
 
 */
@@ -1079,3 +1090,32 @@ bfd_target_list ()
 
   return name_list;
 }
+
+/*
+FUNCTION
+       bfd_seach_for_target
+
+SYNOPSIS
+       const bfd_target * bfd_search_for_target (int (* search_func)(const bfd_target *, void *), void *);
+
+DESCRIPTION
+       Return a pointer to the first transfer vector in the list of
+       transfer vectors maintained by BFD that produces a non-zero
+       result when passed to the function @var{search_func}.  The
+       parameter @var{data} is passed, unexamined, to the search
+       function.
+*/
+
+const bfd_target *
+bfd_search_for_target (search_func, data)
+     int (* search_func) PARAMS ((const bfd_target * target, void * data));
+     void * data;
+{
+  const bfd_target * const * target;
+
+  for (target = bfd_target_vector; * target != NULL; target ++)
+    if (search_func (* target, data))
+      return * target;
+
+  return NULL;
+}
index cd1563f..b1ffe75 100644 (file)
@@ -1062,5 +1062,7 @@ const bfd_target tekhex_vec =
   BFD_JUMP_TABLE_LINK (tekhex),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
index 253eb7a..2a6f69b 100644 (file)
@@ -315,5 +315,7 @@ const bfd_target trad_core_vec =
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0                    /* backend_data */
 };
index 4de0736..27f4f88 100644 (file)
@@ -919,5 +919,7 @@ const bfd_target versados_vec =
   BFD_JUMP_TABLE_LINK (versados),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
index 762c74e..f0ea63f 100644 (file)
--- a/bfd/vms.c
+++ b/bfd/vms.c
@@ -132,11 +132,10 @@ static boolean vms_bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
 
 const bfd_target vms_alpha_vec =
 {
-
   "vms-alpha",                 /* name */
   bfd_target_evax_flavour,
-  false,                       /* data byte order is little */
-  false,                       /* header byte order is little */
+  BFD_ENDIAN_LITTLE,           /* data byte order is little */
+  BFD_ENDIAN_LITTLE,           /* header byte order is little */
 
   (HAS_RELOC | HAS_SYMS
    | WP_TEXT | D_PAGED),       /* object flags */
@@ -170,16 +169,17 @@ const bfd_target vms_alpha_vec =
   BFD_JUMP_TABLE_LINK (vms),
   BFD_JUMP_TABLE_DYNAMIC (vms),
 
+  NULL,
+  
   (PTR) 0
 };
 
 const bfd_target vms_vax_vec =
 {
-
   "vms-vax",                   /* name */
   bfd_target_ovax_flavour,
-  false,                       /* data byte order is little */
-  false,                       /* header byte order is little */
+  BFD_ENDIAN_LITTLE,           /* data byte order is little */
+  BFD_ENDIAN_LITTLE,           /* header byte order is little */
 
   (HAS_RELOC | HAS_SYMS        /* object flags */
    | WP_TEXT | D_PAGED
@@ -215,6 +215,8 @@ const bfd_target vms_vax_vec =
   BFD_JUMP_TABLE_LINK (vms),
   BFD_JUMP_TABLE_DYNAMIC (vms),
 
+  NULL,
+  
   (PTR) 0
 };
 \f