diff options
Diffstat (limited to 'bfd/coffcode.h')
-rw-r--r-- | bfd/coffcode.h | 180 |
1 files changed, 176 insertions, 4 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 31338ee99ea..e9ad4df7e80 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -362,6 +362,12 @@ static unsigned int coff_compute_checksum static bfd_boolean coff_apply_checksum PARAMS ((bfd *)); #endif +#ifdef TICOFF +static bfd_boolean ticoff0_bad_format_hook + PARAMS ((bfd *, PTR )); +static bfd_boolean ticoff1_bad_format_hook + PARAMS ((bfd *, PTR )); +#endif /* void warning(); */ @@ -1439,6 +1445,36 @@ coff_bad_format_hook (abfd, filehdr) return TRUE; } +#ifdef TICOFF +static bfd_boolean +ticoff0_bad_format_hook (abfd, filehdr) + bfd *abfd ATTRIBUTE_UNUSED; + PTR filehdr; +{ + struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; + + if (COFF0_BADMAG (*internal_f)) + return FALSE; + + return TRUE; +} +#endif + +#ifdef TICOFF +static bfd_boolean +ticoff1_bad_format_hook (abfd, filehdr) + bfd *abfd ATTRIBUTE_UNUSED; + PTR filehdr; +{ + struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; + + if (COFF1_BADMAG (*internal_f)) + return FALSE; + + return TRUE; +} +#endif + /* Check whether this section uses an alignment other than the default. */ @@ -5338,6 +5374,92 @@ static const bfd_coff_backend_data bfd_coff_std_swap_table = coff_link_output_has_begun, coff_final_link_postscript }; +#ifdef TICOFF +/* COFF0 differs in file/section header size and relocation entry size. */ +static const bfd_coff_backend_data ticoff0_swap_table = +{ + coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, + coff_SWAP_aux_out, coff_SWAP_sym_out, + coff_SWAP_lineno_out, coff_SWAP_reloc_out, + coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out, + coff_SWAP_scnhdr_out, + FILHSZ_V0, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ_V0, LINESZ, FILNMLEN, +#ifdef COFF_LONG_FILENAMES + TRUE, +#else + FALSE, +#endif +#ifdef COFF_LONG_SECTION_NAMES + TRUE, +#else + FALSE, +#endif + COFF_DEFAULT_SECTION_ALIGNMENT_POWER, +#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS + TRUE, +#else + FALSE, +#endif +#ifdef COFF_DEBUG_STRING_WIDE_PREFIX + 4, +#else + 2, +#endif + coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, + coff_SWAP_reloc_in, ticoff0_bad_format_hook, coff_set_arch_mach_hook, + coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, + coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, + coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, + coff_classify_symbol, coff_compute_section_file_positions, + coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, + coff_adjust_symndx, coff_link_add_one_symbol, + coff_link_output_has_begun, coff_final_link_postscript +}; +#endif + +#ifdef TICOFF +/* COFF1 differs in section header size. */ +static const bfd_coff_backend_data ticoff1_swap_table = +{ + coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, + coff_SWAP_aux_out, coff_SWAP_sym_out, + coff_SWAP_lineno_out, coff_SWAP_reloc_out, + coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out, + coff_SWAP_scnhdr_out, + FILHSZ, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN, +#ifdef COFF_LONG_FILENAMES + TRUE, +#else + FALSE, +#endif +#ifdef COFF_LONG_SECTION_NAMES + TRUE, +#else + FALSE, +#endif + COFF_DEFAULT_SECTION_ALIGNMENT_POWER, +#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS + TRUE, +#else + FALSE, +#endif +#ifdef COFF_DEBUG_STRING_WIDE_PREFIX + 4, +#else + 2, +#endif + coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, + coff_SWAP_reloc_in, ticoff1_bad_format_hook, coff_set_arch_mach_hook, + coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, + coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, + coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, + coff_classify_symbol, coff_compute_section_file_positions, + coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, + coff_adjust_symndx, coff_link_add_one_symbol, + coff_link_output_has_begun, coff_final_link_postscript +}; +#endif + #ifndef coff_close_and_cleanup #define coff_close_and_cleanup _bfd_generic_close_and_cleanup #endif @@ -5413,7 +5535,7 @@ static const bfd_coff_backend_data bfd_coff_std_swap_table = #define coff_bfd_discard_group bfd_generic_discard_group #endif -#define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE) \ +#define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE) \ const bfd_target VAR = \ { \ NAME , \ @@ -5460,10 +5582,60 @@ const bfd_target VAR = \ \ ALTERNATIVE, \ \ - COFF_SWAP_TABLE \ + SWAP_TABLE \ +}; + +#define CREATE_BIGHDR_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE) \ +const bfd_target VAR = \ +{ \ + NAME , \ + bfd_target_coff_flavour, \ + BFD_ENDIAN_LITTLE, /* data byte order is little */ \ + 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, \ + \ + SWAP_TABLE \ }; -#define CREATE_LITTLE_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE) \ +#define CREATE_LITTLE_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE) \ const bfd_target VAR = \ { \ NAME , \ @@ -5508,5 +5680,5 @@ const bfd_target VAR = \ \ ALTERNATIVE, \ \ - COFF_SWAP_TABLE \ + SWAP_TABLE \ }; |