1*3d8817e4Smiod /* Copyright 2002 Free Software Foundation, Inc.
2*3d8817e4Smiod
3*3d8817e4Smiod This file is part of BFD, the Binary File Descriptor library.
4*3d8817e4Smiod
5*3d8817e4Smiod This program is free software; you can redistribute it and/or modify
6*3d8817e4Smiod it under the terms of the GNU General Public License as published by
7*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or
8*3d8817e4Smiod (at your option) any later version.
9*3d8817e4Smiod
10*3d8817e4Smiod This program is distributed in the hope that it will be useful,
11*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of
12*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*3d8817e4Smiod GNU General Public License for more details.
14*3d8817e4Smiod
15*3d8817e4Smiod You should have received a copy of the GNU General Public License
16*3d8817e4Smiod along with this program; if not, write to the Free Software
17*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
18*3d8817e4Smiod
19*3d8817e4Smiod #undef F_LSYMS
20*3d8817e4Smiod #define F_LSYMS F_LSYMS_TICOFF
21*3d8817e4Smiod
22*3d8817e4Smiod static bfd_boolean
ticoff0_bad_format_hook(abfd,filehdr)23*3d8817e4Smiod ticoff0_bad_format_hook (abfd, filehdr)
24*3d8817e4Smiod bfd *abfd;
25*3d8817e4Smiod PTR filehdr;
26*3d8817e4Smiod {
27*3d8817e4Smiod struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
28*3d8817e4Smiod
29*3d8817e4Smiod if (COFF0_BADMAG (*internal_f))
30*3d8817e4Smiod return FALSE;
31*3d8817e4Smiod
32*3d8817e4Smiod return TRUE;
33*3d8817e4Smiod }
34*3d8817e4Smiod
35*3d8817e4Smiod static bfd_boolean
ticoff1_bad_format_hook(abfd,filehdr)36*3d8817e4Smiod ticoff1_bad_format_hook (abfd, filehdr)
37*3d8817e4Smiod bfd *abfd ATTRIBUTE_UNUSED;
38*3d8817e4Smiod PTR filehdr;
39*3d8817e4Smiod {
40*3d8817e4Smiod struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
41*3d8817e4Smiod
42*3d8817e4Smiod if (COFF1_BADMAG (*internal_f))
43*3d8817e4Smiod return FALSE;
44*3d8817e4Smiod
45*3d8817e4Smiod return TRUE;
46*3d8817e4Smiod }
47*3d8817e4Smiod
48*3d8817e4Smiod /* Replace the stock _bfd_coff_is_local_label_name
49*3d8817e4Smiod to recognize TI COFF local labels. */
50*3d8817e4Smiod static bfd_boolean
ticoff_bfd_is_local_label_name(abfd,name)51*3d8817e4Smiod ticoff_bfd_is_local_label_name (abfd, name)
52*3d8817e4Smiod bfd *abfd ATTRIBUTE_UNUSED;
53*3d8817e4Smiod const char *name;
54*3d8817e4Smiod {
55*3d8817e4Smiod if (TICOFF_LOCAL_LABEL_P(name))
56*3d8817e4Smiod return TRUE;
57*3d8817e4Smiod return FALSE;
58*3d8817e4Smiod }
59*3d8817e4Smiod
60*3d8817e4Smiod #define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name
61*3d8817e4Smiod
62*3d8817e4Smiod /* Customize coffcode.h; the default coff_ functions are set up to use COFF2;
63*3d8817e4Smiod coff_bad_format_hook uses BADMAG, so set that for COFF2. The COFF1
64*3d8817e4Smiod and COFF0 vectors use custom _bad_format_hook procs instead of setting
65*3d8817e4Smiod BADMAG. */
66*3d8817e4Smiod #define BADMAG(x) COFF2_BADMAG(x)
67*3d8817e4Smiod #include "coffcode.h"
68*3d8817e4Smiod
69*3d8817e4Smiod /* COFF0 differs in file/section header size and relocation entry size. */
70*3d8817e4Smiod static const bfd_coff_backend_data ticoff0_swap_table =
71*3d8817e4Smiod {
72*3d8817e4Smiod coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
73*3d8817e4Smiod coff_SWAP_aux_out, coff_SWAP_sym_out,
74*3d8817e4Smiod coff_SWAP_lineno_out, coff_SWAP_reloc_out,
75*3d8817e4Smiod coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out,
76*3d8817e4Smiod coff_SWAP_scnhdr_out,
77*3d8817e4Smiod FILHSZ_V0, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ_V0, LINESZ, FILNMLEN,
78*3d8817e4Smiod #ifdef COFF_LONG_FILENAMES
79*3d8817e4Smiod TRUE,
80*3d8817e4Smiod #else
81*3d8817e4Smiod FALSE,
82*3d8817e4Smiod #endif
83*3d8817e4Smiod #ifdef COFF_LONG_SECTION_NAMES
84*3d8817e4Smiod TRUE,
85*3d8817e4Smiod #else
86*3d8817e4Smiod FALSE,
87*3d8817e4Smiod #endif
88*3d8817e4Smiod COFF_DEFAULT_SECTION_ALIGNMENT_POWER,
89*3d8817e4Smiod coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in,
90*3d8817e4Smiod coff_SWAP_reloc_in, ticoff0_bad_format_hook, coff_set_arch_mach_hook,
91*3d8817e4Smiod coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
92*3d8817e4Smiod coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook,
93*3d8817e4Smiod coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
94*3d8817e4Smiod coff_classify_symbol, coff_compute_section_file_positions,
95*3d8817e4Smiod coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
96*3d8817e4Smiod coff_adjust_symndx, coff_link_add_one_symbol,
97*3d8817e4Smiod coff_link_output_has_begun, coff_final_link_postscript
98*3d8817e4Smiod };
99*3d8817e4Smiod
100*3d8817e4Smiod /* COFF1 differs in section header size. */
101*3d8817e4Smiod static const bfd_coff_backend_data ticoff1_swap_table =
102*3d8817e4Smiod {
103*3d8817e4Smiod coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
104*3d8817e4Smiod coff_SWAP_aux_out, coff_SWAP_sym_out,
105*3d8817e4Smiod coff_SWAP_lineno_out, coff_SWAP_reloc_out,
106*3d8817e4Smiod coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out,
107*3d8817e4Smiod coff_SWAP_scnhdr_out,
108*3d8817e4Smiod FILHSZ, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN,
109*3d8817e4Smiod #ifdef COFF_LONG_FILENAMES
110*3d8817e4Smiod TRUE,
111*3d8817e4Smiod #else
112*3d8817e4Smiod FALSE,
113*3d8817e4Smiod #endif
114*3d8817e4Smiod #ifdef COFF_LONG_SECTION_NAMES
115*3d8817e4Smiod TRUE,
116*3d8817e4Smiod #else
117*3d8817e4Smiod FALSE,
118*3d8817e4Smiod #endif
119*3d8817e4Smiod COFF_DEFAULT_SECTION_ALIGNMENT_POWER,
120*3d8817e4Smiod coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in,
121*3d8817e4Smiod coff_SWAP_reloc_in, ticoff1_bad_format_hook, coff_set_arch_mach_hook,
122*3d8817e4Smiod coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
123*3d8817e4Smiod coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook,
124*3d8817e4Smiod coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
125*3d8817e4Smiod coff_classify_symbol, coff_compute_section_file_positions,
126*3d8817e4Smiod coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
127*3d8817e4Smiod coff_adjust_symndx, coff_link_add_one_symbol,
128*3d8817e4Smiod coff_link_output_has_begun, coff_final_link_postscript
129*3d8817e4Smiod };
130*3d8817e4Smiod
131