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 04fa927d706cd6c6068f03c60500444bc4e2c3c7..f355ed9244925238628ad1da1f2aac2b1e8bdf97 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 a75fa94262ad6b51f0f87fae4a4a927caf2481ce..fb67b17081f89ab86f9be88fc1cac191f66ba4ef 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 60345d644d128264bd32d287ef58ba4ce2847d11..8216c7ea5091640df1d034b218889b226ac504f3 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 a2c63269290e55713924143847e2e6e700d1b28d..7365f9d8e35ea1357e0603e2d27ec3cd29c10975 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 876b30a95a37fd8cc2d00aacb7dfb4452f6bd2fe..5ca50ac5682634c383017fcb196b01e061580c1a 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 853c09acba78649b146cdaa13756236d943616c8..0dcae0c25bc27cb6f669661f297ee89a85461a5a 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 cbf883d3bd7c2e27146894b551b7cf7ea86b0429..fa3c42ee19578783c55a162721eec13d45c146ae 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 b5b2fad3fbc7b1d74dbbe2ba2055bba643f945de..c2980b02621a1f2ac4e4c41e0c79414f1080a188 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 2e2b4b21e436c9957f67ad463ae2f7b7f7a83da5..dd1754af255c527a95b0c88844d4a2ce8b219c5e 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 11c9bbd49453fc393ef8ffa643c4a7dd9e4e5be0..e1fa17795d3002d397443c601dde49981ca74288 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 cfd88efa77da369f6792234efb00b2c6c509df6c..9eb68448a2d66415bc37f00b3e44133be683d72e 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 d841663edd55fcf2c2211c12294b53073246accb..5d7187fe72cff32c1d00874e985f13e240c4c5b3 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 253ec8944b8c0550ad6de627cf2af75e3c0331bf..6075d52b1e9e7910eba3bf7b2525e358a89faae2 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 250373d2a2d7f90699b506dd541500667dddecaf..2af1a94fe3f2f4a2e0cbe831092b25da99b5f9ef 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 ea947eadef654ffa41e152eb455911ebec48cf6b..3c1125c3dd8c8a6c3c5e8d296431e96dd8a04aa6 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 91109eaa9213332fc1a9dc03db0e4ca8a4cb4b67..22eeaa55954c5b651a4ade665be0ec8067704c03 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 b3fdc4ad29b014989e1cacbca23781d33f9f0d6c..0d10fe2bcaa5c1599d1a074186f827bdd48cfcb7 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 e07f9d4e661c1fd141a6db3a39355e4824fdf66f..ab3bb5f759fe5c7cf454530d9bd3165a39b592a4 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 ab4d4b663c6fc7000d5db63bf1950022ec94173a..2a7ebfbe96453fdc77350f53c5c47766cc52617a 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 a80f017cbc423befbb1520bf3aecd2b1db561471..d7138c082e0b4e6298eca3e57267344e6132b8bd 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 04251ebc9a5a13ea8f5c40822db2d66ea8d218c0..199a5ab70f0633482202a6154c43268197a0f1cd 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 dfadbe8f4234f3adce3d64f028c2659ad40172f1..9ca395b1ba7b3a337f0177179e646a39624f2819 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 27982b5d6ff52beb09d51de85b65c14692b433f4..6d5e7814b71ab232415ead205b0bc2b93d496233 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 eec1b12c652458abfacd495ee801d8b2b274b9d8..69230001e49bae619446f67476912bab2dfecac6 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 dfa9837969b16038c67e14a7a6f4eecdf02525f2..cd542169ca8065195548ec15e346db2b0d03eac3 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 a2e33e4f625e8785506bd8a88b7b2435ad9c86ae..5e919da1f990f01c3faef5fe93ce71d4f26f1605 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 3d38da6225037a653141672e9645cfee706aff25..a971f76d7be9f6724d10533092ad77ed8814c649 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 bf5c4bbaddb1ac519ca6ce623d546b6e5768d724..1132ea6e8419b6b238677bd48e97b0d06c977758 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 28d68c37998a771845fbb12d4350ea49306c2b9a..0379bfbc325ea8fa7dc4e063196af1fa6fa947b5 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 84b518dce2b3dc2548622d08b41139d9e038f571..c559ad7c76f7a275071049c16f9126230c865e07 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 04049e89c28856974116c3efdc0727759d984e72..21f29a82969050495e69482bf6737ae3a236f428 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 467bde59a52633085fc3f6eab4688e40ea04fbea..f905c940a266533b227a17781e63f81051b4b876 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 5b06d069c9f21a6ea7d3f235eabacad9edacf72d..d40a8706808e2cd3c71a05aae399288e7e73e0b5 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 a7c22f519eba035efbffae6bebdb26e7e7644128..0a3e6b224d218fcf21ffe689176af3716d15c384 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 6be709f4999a01dabc9f3a571c38db2227664932..bfaa2c21b258275923772a912195541c6b6bf2af 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 13a2c4f997bb7b6851e69f1a45743247f476ab53..c9ec86482c57f0114e17ec4dc435cd0e56a9926c 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 91f204ce8348f1b3d05f98831ff053f4ab685b2b..0aadee52d73d4f590ce3a49192f839cd2394a650 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 3c42faa2f2f6078bae35d1c39c28950e5008d574..aebc0643e22785e6b461259c4951fb7ada388744 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 5eb3862b44832cb293c428beeb5aa093e761558a..17740d8239ec2d06f92669b23f65e134bc740a7b 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 964ca20eac52e843e2eec11ff7ab49898db727e6..006e6a751b1347657db4de51a281e0dc6ea94c34 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 6abfdc7536a6e0997f6bbc28f71e45634158f7b4..7a680fb3894931408054583c84ef7fa0f78d28b0 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 21b184dce3bc0faf8a1579ea278d84b1fe5aea59..828c2a1ceb13ab597b5de31126dcb7cc045851a5 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 6f1d47d8c45e7304c84341037c2e3f7af45d722c..5c1e255b4c88514eddc28fb0ed8d2fc7b29c477e 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 e4d11c76d584e90e450460e816c402f99e35f015..e69053b82823d315af19b9b58fa8c4e58192086d 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 671f4af495c01cc30e5d608be9c5a99d5cfc1159..4f4fc12dc727a23ffee6526175512f52004f05d0 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 4539ee0c240728aca2bfa2c72f72c6b644ee0810..d9db8268d478502b392be6fff6d4813b704b9ea3 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 2b4fdbbd01f487ae8f249ce4ecbf055f23b1c878..0969dce4c0548e6cf6698d45ebbff23616721a66 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 f10c8f139f687f5c7ec5d219e49e203837830aec..46c97d25889f461eb59b99bf327c4737a3593847 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 ee1fac09205c47e71486b408f91ad68d3e2f38e9..4f6b11fefaa8fd945a2218034d7b34cb32253161 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 e77ba407a51e776292459679b83ffbfc399a372e..aefdc64167c4f34495a18d8def3f11f1d0ab057b 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 604c2689f3864f9af874e592ace5d939b43d9ce8..f7ad7b0cb7edcc09d01ada6f394a5c9362fa21ca 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 cd1563ffc8ad8100bc2cd992f50d52dc0ca8a2c2..b1ffe75e0731ce5dc86527bc2aea848d4f3da2f2 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 253eb7ad06fd191104a4525f6d361adb9b853f1e..2a6f69bcfd967c101d586b3b7823f009be19b673 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 4de0736f2dab8d6d5b3da5c590527132ca573148..27f4f882088a4cc982dbe46da8cf9cc16045bf8d 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 762c74e17d156eb8a7c1449cee83be4f3e6c0c19..f0ea63ff92d30630de0792c4035075cd642cd259 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
This page took 0.085566 seconds and 4 git commands to generate.