diff options
author | Nick Clifton <nickc@redhat.com> | 1999-07-19 14:55:16 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 1999-07-19 14:55:16 +0000 |
commit | c3c89269f8afef30bf467225f538d56daf57e245 (patch) | |
tree | 203ceab6adb9b30d0831d3eaeeecfb2fd875115f /bfd | |
parent | a9602746fa290e999d3df58bb9281f80340bf5ac (diff) | |
download | fsf-binutils-gdb-c3c89269f8afef30bf467225f538d56daf57e245.zip fsf-binutils-gdb-c3c89269f8afef30bf467225f538d56daf57e245.tar.gz fsf-binutils-gdb-c3c89269f8afef30bf467225f538d56daf57e245.tar.bz2 |
Add new field to bfd_target structure.
Initialise this field for all known bfd targets.
Add new search function to targets.c
Diffstat (limited to 'bfd')
55 files changed, 444 insertions, 823 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 04fa927..f355ed9 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -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 diff --git a/bfd/aix386-core.c b/bfd/aix386-core.c index a75fa94..fb67b17 100644 --- a/bfd/aix386-core.c +++ b/bfd/aix386-core.c @@ -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 }; diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c index 60345d6..8216c7e 100644 --- a/bfd/aout-adobe.c +++ b/bfd/aout-adobe.c @@ -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 }; diff --git a/bfd/aout-arm.c b/bfd/aout-arm.c index a2c6326..7365f9d 100644 --- a/bfd/aout-arm.c +++ b/bfd/aout-arm.c @@ -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, }; diff --git a/bfd/aout-target.h b/bfd/aout-target.h index 876b30a..5ca50ac 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -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 */ diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c index 853c09a..0dcae0c 100644 --- a/bfd/aout-tic30.c +++ b/bfd/aout-tic30.c @@ -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 */ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index cbf883d..fa3c42e 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -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)); diff --git a/bfd/binary.c b/bfd/binary.c index b5b2fad..c2980b0 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -382,5 +382,7 @@ const bfd_target binary_vec = BFD_JUMP_TABLE_LINK (binary), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + NULL, + NULL }; @@ -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 }; diff --git a/bfd/cisco-core.c b/bfd/cisco-core.c index 11c9bbd..e1fa177 100644 --- a/bfd/cisco-core.c +++ b/bfd/cisco-core.c @@ -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 */ }; diff --git a/bfd/coff-a29k.c b/bfd/coff-a29k.c index cfd88ef..9eb6844 100644 --- a/bfd/coff-a29k.c +++ b/bfd/coff-a29k.c @@ -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) diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index d841663..5d7187f 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -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 }; diff --git a/bfd/coff-apollo.c b/bfd/coff-apollo.c index 253ec89..6075d52 100644 --- a/bfd/coff-apollo.c +++ b/bfd/coff-apollo.c @@ -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 - }; diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c index 250373d..2af1a94 100644 --- a/bfd/coff-arm.c +++ b/bfd/coff-arm.c @@ -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, -}; diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index ea947ea..3c1125c 100644 --- a/bfd/coff-h8300.c +++ b/bfd/coff-h8300.c @@ -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) diff --git a/bfd/coff-h8500.c b/bfd/coff-h8500.c index 91109ea..22eeaa5 100644 --- a/bfd/coff-h8500.c +++ b/bfd/coff-h8500.c @@ -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) diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c index b3fdc4a..0d10fe2 100644 --- a/bfd/coff-i386.c +++ b/bfd/coff-i386.c @@ -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 }; diff --git a/bfd/coff-i860.c b/bfd/coff-i860.c index e07f9d4..ab3bb5f 100644 --- a/bfd/coff-i860.c +++ b/bfd/coff-i860.c @@ -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 }; diff --git a/bfd/coff-i960.c b/bfd/coff-i960.c index ab4d4b6..2a7ebfb 100644 --- a/bfd/coff-i960.c +++ b/bfd/coff-i960.c @@ -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 }; diff --git a/bfd/coff-m68k.c b/bfd/coff-m68k.c index a80f017..d7138c0 100644 --- a/bfd/coff-m68k.c +++ b/bfd/coff-m68k.c @@ -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 -}; diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c index 04251eb..199a5ab 100644 --- a/bfd/coff-mcore.c +++ b/bfd/coff-mcore.c @@ -610,121 +610,9 @@ pe_object_p (abfd) return coff_object_p (abfd); } -/* 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) diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c index dfadbe8..9ca395b 100644 --- a/bfd/coff-mips.c +++ b/bfd/coff-mips.c @@ -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 }; diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c index 27982b5..6d5e781 100644 --- a/bfd/coff-ppc.c +++ b/bfd/coff-ppc.c @@ -2824,11 +2824,15 @@ ppc_bfd_coff_final_link (abfd, info) #endif +/* 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 diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index eec1b12..6923000 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -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 }; diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index dfa9837..cd54216 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -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 }; diff --git a/bfd/coff-sparc.c b/bfd/coff-sparc.c index a2e33e4..5e919da 100644 --- a/bfd/coff-sparc.c +++ b/bfd/coff-sparc.c @@ -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) diff --git a/bfd/coff-tic30.c b/bfd/coff-tic30.c index 3d38da6..a971f76 100644 --- a/bfd/coff-tic30.c +++ b/bfd/coff-tic30.c @@ -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 }; diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c index bf5c4bb..1132ea6 100644 --- a/bfd/coff-tic80.c +++ b/bfd/coff-tic80.c @@ -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) diff --git a/bfd/coff-w65.c b/bfd/coff-w65.c index 28d68c3..0379bfb 100644 --- a/bfd/coff-w65.c +++ b/bfd/coff-w65.c @@ -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) diff --git a/bfd/coff-we32k.c b/bfd/coff-we32k.c index 84b518d..c559ad7 100644 --- a/bfd/coff-we32k.c +++ b/bfd/coff-we32k.c @@ -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) diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c index 04049e89..21f29a8 100644 --- a/bfd/coff-z8k.c +++ b/bfd/coff-z8k.c @@ -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) diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 467bde5..f905c94 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -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 \ +}; diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 5b06d06..d40a870 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -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 diff --git a/bfd/hppabsd-core.c b/bfd/hppabsd-core.c index a7c22f5..0a3e6b2 100644 --- a/bfd/hppabsd-core.c +++ b/bfd/hppabsd-core.c @@ -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 diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c index 6be709f..bfaa2c2 100644 --- a/bfd/hpux-core.c +++ b/bfd/hpux-core.c @@ -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 */ }; diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c index 13a2c4f..c9ec864 100644 --- a/bfd/i386msdos.c +++ b/bfd/i386msdos.c @@ -239,6 +239,8 @@ const bfd_target i386msdos_vec = BFD_JUMP_TABLE_LINK (msdos), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + NULL, + (PTR) 0 }; diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c index 91f204c..0aadee5 100644 --- a/bfd/i386os9k.c +++ b/bfd/i386os9k.c @@ -367,5 +367,7 @@ const bfd_target i386os9k_vec = BFD_JUMP_TABLE_LINK (os9k), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + NULL, + (PTR) 0, }; @@ -3966,5 +3966,7 @@ const bfd_target ieee_vec = BFD_JUMP_TABLE_LINK (ieee), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + NULL, + (PTR) 0 }; @@ -1037,5 +1037,7 @@ const bfd_target ihex_vec = BFD_JUMP_TABLE_LINK (ihex), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + NULL, + (PTR) 0 }; diff --git a/bfd/irix-core.c b/bfd/irix-core.c index 964ca20..006e6a7 100644 --- a/bfd/irix-core.c +++ b/bfd/irix-core.c @@ -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 */ }; diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c index 6abfdc7..7a680fb 100644 --- a/bfd/mipsbsd.c +++ b/bfd/mipsbsd.c @@ -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 }; diff --git a/bfd/netbsd-core.c b/bfd/netbsd-core.c index 21b184d..828c2a1 100644 --- a/bfd/netbsd-core.c +++ b/bfd/netbsd-core.c @@ -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 */ }; diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h index 6f1d47d..5c1e255 100644 --- a/bfd/nlm-target.h +++ b/bfd/nlm-target.h @@ -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 }; diff --git a/bfd/oasys.c b/bfd/oasys.c index e4d11c7..e69053b 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -1531,5 +1531,7 @@ const bfd_target oasys_vec = BFD_JUMP_TABLE_LINK (oasys), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + NULL, + (PTR) 0 }; diff --git a/bfd/osf-core.c b/bfd/osf-core.c index 671f4af..4f4fc12 100644 --- a/bfd/osf-core.c +++ b/bfd/osf-core.c @@ -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 */ }; diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c index 4539ee0..d9db826 100644 --- a/bfd/ppcboot.c +++ b/bfd/ppcboot.c @@ -531,5 +531,7 @@ const bfd_target ppcboot_vec = BFD_JUMP_TABLE_LINK (ppcboot), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + NULL, + NULL }; diff --git a/bfd/ptrace-core.c b/bfd/ptrace-core.c index 2b4fdbb..0969dce 100644 --- a/bfd/ptrace-core.c +++ b/bfd/ptrace-core.c @@ -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 */ }; diff --git a/bfd/sco5-core.c b/bfd/sco5-core.c index f10c8f1..46c97d2 100644 --- a/bfd/sco5-core.c +++ b/bfd/sco5-core.c @@ -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 */ }; @@ -6257,6 +6257,8 @@ const bfd_target som_vec = BFD_JUMP_TABLE_LINK (som), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + NULL, + (PTR) 0 }; @@ -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 }; diff --git a/bfd/targets.c b/bfd/targets.c index 604c268..f7ad7b0 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -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; +} diff --git a/bfd/tekhex.c b/bfd/tekhex.c index cd1563f..b1ffe75 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -1062,5 +1062,7 @@ const bfd_target tekhex_vec = BFD_JUMP_TABLE_LINK (tekhex), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + NULL, + (PTR) 0 }; diff --git a/bfd/trad-core.c b/bfd/trad-core.c index 253eb7a..2a6f69b 100644 --- a/bfd/trad-core.c +++ b/bfd/trad-core.c @@ -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 */ }; diff --git a/bfd/versados.c b/bfd/versados.c index 4de0736..27f4f88 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -919,5 +919,7 @@ const bfd_target versados_vec = BFD_JUMP_TABLE_LINK (versados), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + NULL, + (PTR) 0 }; @@ -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 }; |