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