175295Sdes/* Copyright 2002 Free Software Foundation, Inc. 275295Sdes 375295Sdes This file is part of BFD, the Binary File Descriptor library. 475295Sdes 575295Sdes This program is free software; you can redistribute it and/or modify 675295Sdes it under the terms of the GNU General Public License as published by 775295Sdes the Free Software Foundation; either version 2 of the License, or 875295Sdes (at your option) any later version. 975295Sdes 1075295Sdes This program is distributed in the hope that it will be useful, 1175295Sdes but WITHOUT ANY WARRANTY; without even the implied warranty of 1275295Sdes MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1375295Sdes GNU General Public License for more details. 1475295Sdes 1575295Sdes You should have received a copy of the GNU General Public License 1675295Sdes along with this program; if not, write to the Free Software 1775295Sdes Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 1875295Sdes 1975295Sdes#undef F_LSYMS 2075295Sdes#define F_LSYMS F_LSYMS_TICOFF 2175295Sdes 2275295Sdesstatic bfd_boolean 2375295Sdesticoff0_bad_format_hook (abfd, filehdr) 2475295Sdes bfd *abfd; 2575295Sdes PTR filehdr; 2675295Sdes{ 2775295Sdes struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; 2875295Sdes 2975295Sdes if (COFF0_BADMAG (*internal_f)) 3075295Sdes return FALSE; 3175295Sdes 3275295Sdes return TRUE; 3375295Sdes} 3475295Sdes 3575295Sdesstatic bfd_boolean 3684187Sdesticoff1_bad_format_hook (abfd, filehdr) 3778073Sdes bfd *abfd ATTRIBUTE_UNUSED; 3875295Sdes PTR filehdr; 3977967Sdes{ 4075295Sdes struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; 4175295Sdes 4275295Sdes if (COFF1_BADMAG (*internal_f)) 4375295Sdes return FALSE; 4475295Sdes 4575295Sdes return TRUE; 4675295Sdes} 4775295Sdes 4875295Sdes/* Replace the stock _bfd_coff_is_local_label_name 4975295Sdes to recognize TI COFF local labels. */ 5084098Sdesstatic bfd_boolean 5184098Sdesticoff_bfd_is_local_label_name (abfd, name) 5284098Sdes bfd *abfd ATTRIBUTE_UNUSED; 5384098Sdes const char *name; 5484098Sdes{ 5584098Sdes if (TICOFF_LOCAL_LABEL_P(name)) 5684098Sdes return TRUE; 5784098Sdes return FALSE; 5884098Sdes} 5984098Sdes 6084098Sdes#define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name 6184098Sdes 6284098Sdes/* Customize coffcode.h; the default coff_ functions are set up to use COFF2; 6384098Sdes coff_bad_format_hook uses BADMAG, so set that for COFF2. The COFF1 6484098Sdes and COFF0 vectors use custom _bad_format_hook procs instead of setting 6584098Sdes BADMAG. */ 6684098Sdes#define BADMAG(x) COFF2_BADMAG(x) 6784098Sdes#include "coffcode.h" 6884098Sdes 6975295Sdes/* COFF0 differs in file/section header size and relocation entry size. */ 7084246Sdesstatic const bfd_coff_backend_data ticoff0_swap_table = 7184246Sdes{ 7284246Sdes coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, 7384246Sdes coff_SWAP_aux_out, coff_SWAP_sym_out, 7484246Sdes coff_SWAP_lineno_out, coff_SWAP_reloc_out, 7584246Sdes coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out, 7684246Sdes coff_SWAP_scnhdr_out, 7784246Sdes FILHSZ_V0, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ_V0, LINESZ, FILNMLEN, 7884246Sdes#ifdef COFF_LONG_FILENAMES 7984246Sdes TRUE, 8084246Sdes#else 8184246Sdes FALSE, 8284246Sdes#endif 8384246Sdes#ifdef COFF_LONG_SECTION_NAMES 8484246Sdes TRUE, 8584246Sdes#else 8684246Sdes FALSE, 8784246Sdes#endif 8884246Sdes COFF_DEFAULT_SECTION_ALIGNMENT_POWER, 8984246Sdes coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, 9084246Sdes coff_SWAP_reloc_in, ticoff0_bad_format_hook, coff_set_arch_mach_hook, 9184246Sdes coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, 9284246Sdes coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, 9384246Sdes coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, 9484246Sdes coff_classify_symbol, coff_compute_section_file_positions, 9575295Sdes coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, 9675295Sdes coff_adjust_symndx, coff_link_add_one_symbol, 9775295Sdes coff_link_output_has_begun, coff_final_link_postscript 9875295Sdes}; 9975295Sdes 10075295Sdes/* COFF1 differs in section header size. */ 10184098Sdesstatic const bfd_coff_backend_data ticoff1_swap_table = 10284098Sdes{ 10375295Sdes coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, 10475295Sdes coff_SWAP_aux_out, coff_SWAP_sym_out, 10575295Sdes coff_SWAP_lineno_out, coff_SWAP_reloc_out, 10684098Sdes coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out, 10784098Sdes coff_SWAP_scnhdr_out, 10883366Sjulian FILHSZ, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN, 10975295Sdes#ifdef COFF_LONG_FILENAMES 11084246Sdes TRUE, 11175295Sdes#else 11275295Sdes FALSE, 11384246Sdes#endif 11475295Sdes#ifdef COFF_LONG_SECTION_NAMES 11575295Sdes TRUE, 11675295Sdes#else 11775295Sdes FALSE, 11875295Sdes#endif 11975295Sdes COFF_DEFAULT_SECTION_ALIGNMENT_POWER, 12075295Sdes coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, 12175295Sdes coff_SWAP_reloc_in, ticoff1_bad_format_hook, coff_set_arch_mach_hook, 12284187Sdes coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, 12375295Sdes coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, 12475295Sdes coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, 12575295Sdes coff_classify_symbol, coff_compute_section_file_positions, 12675295Sdes coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, 12775295Sdes coff_adjust_symndx, coff_link_add_one_symbol, 12875295Sdes coff_link_output_has_begun, coff_final_link_postscript 12975295Sdes}; 13075295Sdes 13175295Sdes