1 |
104 |
markom |
/* BFD back-end for TMS320C54X coff binaries.
|
2 |
|
|
Copyright (C) 1999,2000 Free Software Foundation, Inc.
|
3 |
|
|
Contributed by Timothy Wall (twall@cygnus.com)
|
4 |
|
|
|
5 |
|
|
This file is part of BFD, the Binary File Descriptor library.
|
6 |
|
|
|
7 |
|
|
This program is free software; you can redistribute it and/or modify
|
8 |
|
|
it under the terms of the GNU General Public License as published by
|
9 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
10 |
|
|
(at your option) any later version.
|
11 |
|
|
|
12 |
|
|
This program is distributed in the hope that it will be useful,
|
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
GNU General Public License for more details.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with this program; if not, write to the Free Software
|
19 |
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
20 |
|
|
02111-1307, USA. */
|
21 |
|
|
|
22 |
|
|
#include "bfd.h"
|
23 |
|
|
#include "sysdep.h"
|
24 |
|
|
#include "libbfd.h"
|
25 |
|
|
#include "bfdlink.h"
|
26 |
|
|
#include "coff/tic54x.h"
|
27 |
|
|
#include "coff/internal.h"
|
28 |
|
|
#include "libcoff.h"
|
29 |
|
|
|
30 |
|
|
#undef F_LSYMS
|
31 |
|
|
#define F_LSYMS F_LSYMS_TICOFF
|
32 |
|
|
|
33 |
|
|
/*
|
34 |
|
|
32-bit operations
|
35 |
|
|
The octet order is screwy. words are LSB first (LS octet, actually), but
|
36 |
|
|
longwords are MSW first. For example, 0x12345678 is encoded 0x5678 in the
|
37 |
|
|
first word and 0x1234 in the second. When looking at the data as stored in
|
38 |
|
|
the COFF file, you would see the octets ordered as 0x78, 0x56, 0x34, 0x12.
|
39 |
|
|
Don't bother with 64-bits, as there aren't any.
|
40 |
|
|
*/
|
41 |
|
|
static bfd_vma
|
42 |
|
|
tic54x_getl32(addr)
|
43 |
|
|
register const bfd_byte *addr;
|
44 |
|
|
{
|
45 |
|
|
unsigned long v;
|
46 |
|
|
v = (unsigned long) addr[2];
|
47 |
|
|
v |= (unsigned long) addr[3] << 8;
|
48 |
|
|
v |= (unsigned long) addr[0] << 16;
|
49 |
|
|
v |= (unsigned long) addr[1] << 24;
|
50 |
|
|
return (bfd_vma) v;
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
static void
|
54 |
|
|
tic54x_putl32 (data, addr)
|
55 |
|
|
bfd_vma data;
|
56 |
|
|
register bfd_byte *addr;
|
57 |
|
|
{
|
58 |
|
|
addr[2] = (bfd_byte)data;
|
59 |
|
|
addr[3] = (bfd_byte)(data >> 8);
|
60 |
|
|
addr[0] = (bfd_byte)(data >> 16);
|
61 |
|
|
addr[1] = (bfd_byte)(data >> 24);
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
bfd_signed_vma
|
65 |
|
|
tic54x_getl_signed_32 (addr)
|
66 |
|
|
register const bfd_byte *addr;
|
67 |
|
|
{
|
68 |
|
|
unsigned long v;
|
69 |
|
|
|
70 |
|
|
v = (unsigned long) addr[2];
|
71 |
|
|
v |= (unsigned long) addr[3] << 8;
|
72 |
|
|
v |= (unsigned long) addr[0] << 16;
|
73 |
|
|
v |= (unsigned long) addr[1] << 24;
|
74 |
|
|
#define COERCE32(x) \
|
75 |
|
|
((bfd_signed_vma) (long) (((unsigned long) (x) ^ 0x80000000) - 0x80000000))
|
76 |
|
|
return COERCE32 (v);
|
77 |
|
|
}
|
78 |
|
|
|
79 |
|
|
static bfd_reloc_status_type
|
80 |
|
|
tic54x_relocation (abfd, reloc_entry, symbol, data, input_section,
|
81 |
|
|
output_bfd, error_message)
|
82 |
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
83 |
|
|
arelent *reloc_entry;
|
84 |
|
|
asymbol *symbol ATTRIBUTE_UNUSED;
|
85 |
|
|
PTR data ATTRIBUTE_UNUSED;
|
86 |
|
|
asection *input_section;
|
87 |
|
|
bfd *output_bfd;
|
88 |
|
|
char **error_message ATTRIBUTE_UNUSED;
|
89 |
|
|
{
|
90 |
|
|
|
91 |
|
|
if (output_bfd != (bfd *) NULL)
|
92 |
|
|
{
|
93 |
|
|
/* This is a partial relocation, and we want to apply the
|
94 |
|
|
relocation to the reloc entry rather than the raw data.
|
95 |
|
|
Modify the reloc inplace to reflect what we now know. */
|
96 |
|
|
reloc_entry->address += input_section->output_offset;
|
97 |
|
|
return bfd_reloc_ok;
|
98 |
|
|
}
|
99 |
|
|
return bfd_reloc_continue;
|
100 |
|
|
}
|
101 |
|
|
|
102 |
|
|
reloc_howto_type tic54x_howto_table[] =
|
103 |
|
|
{
|
104 |
|
|
/* type,rightshift,size (0=byte, 1=short, 2=long),
|
105 |
|
|
bit size, pc_relative, bitpos, dont complain_on_overflow,
|
106 |
|
|
special_function, name, partial_inplace, src_mask, dst_mask, pcrel_offset */
|
107 |
|
|
|
108 |
|
|
/* NORMAL BANK */
|
109 |
|
|
/* 16-bit direct reference to symbol's address */
|
110 |
|
|
HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont,
|
111 |
|
|
tic54x_relocation,"REL16",false,0xFFFF,0xFFFF,false),
|
112 |
|
|
|
113 |
|
|
/* 7 LSBs of an address */
|
114 |
|
|
HOWTO (R_PARTLS7,0,1,7,false,0,complain_overflow_dont,
|
115 |
|
|
tic54x_relocation,"LS7",false,0x007F,0x007F,false),
|
116 |
|
|
|
117 |
|
|
/* 9 MSBs of an address */
|
118 |
|
|
/* TI assembler doesn't shift its encoding, and is thus incompatible */
|
119 |
|
|
HOWTO (R_PARTMS9,7,1,9,false,0,complain_overflow_dont,
|
120 |
|
|
tic54x_relocation,"MS9",false,0x01FF,0x01FF,false),
|
121 |
|
|
|
122 |
|
|
/* 23-bit relocation */
|
123 |
|
|
HOWTO (R_EXTWORD,0,2,23,false,0,complain_overflow_dont,
|
124 |
|
|
tic54x_relocation,"RELEXT",false,0x7FFFFF,0x7FFFFF,false),
|
125 |
|
|
|
126 |
|
|
/* 16 bits of 23-bit extended address */
|
127 |
|
|
HOWTO (R_EXTWORD16,0,1,16,false,0,complain_overflow_dont,
|
128 |
|
|
tic54x_relocation,"RELEXT16",false,0x7FFFFF,0x7FFFFF,false),
|
129 |
|
|
|
130 |
|
|
/* upper 7 bits of 23-bit extended address */
|
131 |
|
|
HOWTO (R_EXTWORDMS7,16,1,7,false,0,complain_overflow_dont,
|
132 |
|
|
tic54x_relocation,"RELEXTMS7",false,0x7F,0x7F,false),
|
133 |
|
|
|
134 |
|
|
/* ABSOLUTE BANK */
|
135 |
|
|
/* 16-bit direct reference to symbol's address, absolute */
|
136 |
|
|
HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont,
|
137 |
|
|
tic54x_relocation,"AREL16",false,0xFFFF,0xFFFF,false),
|
138 |
|
|
|
139 |
|
|
/* 7 LSBs of an address, absolute */
|
140 |
|
|
HOWTO (R_PARTLS7,0,1,7,false,0,complain_overflow_dont,
|
141 |
|
|
tic54x_relocation,"ALS7",false,0x007F,0x007F,false),
|
142 |
|
|
|
143 |
|
|
/* 9 MSBs of an address, absolute */
|
144 |
|
|
/* TI assembler doesn't shift its encoding, and is thus incompatible */
|
145 |
|
|
HOWTO (R_PARTMS9,7,1,9,false,0,complain_overflow_dont,
|
146 |
|
|
tic54x_relocation,"AMS9",false,0x01FF,0x01FF,false),
|
147 |
|
|
|
148 |
|
|
/* 23-bit direct reference, absolute */
|
149 |
|
|
HOWTO (R_EXTWORD,0,2,23,false,0,complain_overflow_dont,
|
150 |
|
|
tic54x_relocation,"ARELEXT",false,0x7FFFFF,0x7FFFFF,false),
|
151 |
|
|
|
152 |
|
|
/* 16 bits of 23-bit extended address, absolute */
|
153 |
|
|
HOWTO (R_EXTWORD16,0,1,16,false,0,complain_overflow_dont,
|
154 |
|
|
tic54x_relocation,"ARELEXT16",false,0x7FFFFF,0x7FFFFF,false),
|
155 |
|
|
|
156 |
|
|
/* upper 7 bits of 23-bit extended address, absolute */
|
157 |
|
|
HOWTO (R_EXTWORDMS7,16,1,7,false,0,complain_overflow_dont,
|
158 |
|
|
tic54x_relocation,"ARELEXTMS7",false,0x7F,0x7F,false),
|
159 |
|
|
|
160 |
|
|
/* 32-bit relocation exclusively for stabs */
|
161 |
|
|
HOWTO (R_RELLONG,0,2,32,false,0,complain_overflow_dont,
|
162 |
|
|
tic54x_relocation,"STAB",false,0xFFFFFFFF,0xFFFFFFFF,false),
|
163 |
|
|
|
164 |
|
|
};
|
165 |
|
|
|
166 |
|
|
#define coff_bfd_reloc_type_lookup tic54x_coff_reloc_type_lookup
|
167 |
|
|
|
168 |
|
|
/* For the case statement use the code values used tc_gen_reloc (defined in
|
169 |
|
|
bfd/reloc.c) to map to the howto table entries */
|
170 |
|
|
reloc_howto_type *
|
171 |
|
|
tic54x_coff_reloc_type_lookup (abfd, code)
|
172 |
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
173 |
|
|
bfd_reloc_code_real_type code;
|
174 |
|
|
{
|
175 |
|
|
switch (code)
|
176 |
|
|
{
|
177 |
|
|
case BFD_RELOC_16:
|
178 |
|
|
return &tic54x_howto_table[0];
|
179 |
|
|
case BFD_RELOC_TIC54X_PARTLS7:
|
180 |
|
|
return &tic54x_howto_table[1];
|
181 |
|
|
case BFD_RELOC_TIC54X_PARTMS9:
|
182 |
|
|
return &tic54x_howto_table[2];
|
183 |
|
|
case BFD_RELOC_TIC54X_23:
|
184 |
|
|
return &tic54x_howto_table[3];
|
185 |
|
|
case BFD_RELOC_TIC54X_16_OF_23:
|
186 |
|
|
return &tic54x_howto_table[4];
|
187 |
|
|
case BFD_RELOC_TIC54X_MS7_OF_23:
|
188 |
|
|
return &tic54x_howto_table[5];
|
189 |
|
|
case BFD_RELOC_32:
|
190 |
|
|
return &tic54x_howto_table[12];
|
191 |
|
|
default:
|
192 |
|
|
return (reloc_howto_type *) NULL;
|
193 |
|
|
}
|
194 |
|
|
}
|
195 |
|
|
|
196 |
|
|
/* Code to turn a r_type into a howto ptr, uses the above howto table.
|
197 |
|
|
Called after some initial checking by the tic54x_rtype_to_howto fn below */
|
198 |
|
|
static void
|
199 |
|
|
tic54x_lookup_howto (internal, dst)
|
200 |
|
|
arelent *internal;
|
201 |
|
|
struct internal_reloc *dst;
|
202 |
|
|
{
|
203 |
|
|
unsigned i;
|
204 |
|
|
int bank = (dst->r_symndx == -1) ? HOWTO_BANK : 0;
|
205 |
|
|
for (i = 0; i < sizeof tic54x_howto_table/sizeof tic54x_howto_table[0]; i++)
|
206 |
|
|
{
|
207 |
|
|
if (tic54x_howto_table[i].type == dst->r_type)
|
208 |
|
|
{
|
209 |
|
|
internal->howto = tic54x_howto_table + i + bank;
|
210 |
|
|
return;
|
211 |
|
|
}
|
212 |
|
|
}
|
213 |
|
|
|
214 |
|
|
(*_bfd_error_handler) (_("Unrecognized reloc type 0x%x"),
|
215 |
|
|
(unsigned int) dst->r_type);
|
216 |
|
|
abort();
|
217 |
|
|
}
|
218 |
|
|
|
219 |
|
|
#define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\
|
220 |
|
|
tic54x_reloc_processing(RELENT,RELOC,SYMS,ABFD,SECT)
|
221 |
|
|
|
222 |
|
|
static void tic54x_reloc_processing();
|
223 |
|
|
|
224 |
|
|
#define coff_rtype_to_howto coff_tic54x_rtype_to_howto
|
225 |
|
|
|
226 |
|
|
static reloc_howto_type *
|
227 |
|
|
coff_tic54x_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
|
228 |
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
229 |
|
|
asection *sec;
|
230 |
|
|
struct internal_reloc *rel;
|
231 |
|
|
struct coff_link_hash_entry *h ATTRIBUTE_UNUSED;
|
232 |
|
|
struct internal_syment *sym ATTRIBUTE_UNUSED;
|
233 |
|
|
bfd_vma *addendp;
|
234 |
|
|
{
|
235 |
|
|
arelent genrel;
|
236 |
|
|
|
237 |
|
|
if (rel->r_symndx == -1 && addendp != NULL)
|
238 |
|
|
{
|
239 |
|
|
/* This is a TI "internal relocation", which means that the relocation
|
240 |
|
|
amount is the amount by which the current section is being relocated
|
241 |
|
|
in the output section. */
|
242 |
|
|
*addendp = (sec->output_section->vma + sec->output_offset) - sec->vma;
|
243 |
|
|
}
|
244 |
|
|
|
245 |
|
|
tic54x_lookup_howto (&genrel, rel);
|
246 |
|
|
|
247 |
|
|
return genrel.howto;
|
248 |
|
|
}
|
249 |
|
|
|
250 |
|
|
static boolean
|
251 |
|
|
ticoff0_bad_format_hook (abfd, filehdr)
|
252 |
|
|
bfd * abfd ATTRIBUTE_UNUSED;
|
253 |
|
|
PTR filehdr;
|
254 |
|
|
{
|
255 |
|
|
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
|
256 |
|
|
|
257 |
|
|
if (COFF0_BADMAG (*internal_f))
|
258 |
|
|
return false;
|
259 |
|
|
|
260 |
|
|
return true;
|
261 |
|
|
}
|
262 |
|
|
|
263 |
|
|
static boolean
|
264 |
|
|
ticoff1_bad_format_hook (abfd, filehdr)
|
265 |
|
|
bfd * abfd ATTRIBUTE_UNUSED;
|
266 |
|
|
PTR filehdr;
|
267 |
|
|
{
|
268 |
|
|
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
|
269 |
|
|
|
270 |
|
|
if (COFF1_BADMAG (*internal_f))
|
271 |
|
|
return false;
|
272 |
|
|
|
273 |
|
|
return true;
|
274 |
|
|
}
|
275 |
|
|
|
276 |
|
|
/* replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local
|
277 |
|
|
labels */
|
278 |
|
|
static boolean
|
279 |
|
|
ticoff_bfd_is_local_label_name (abfd, name)
|
280 |
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
281 |
|
|
const char *name;
|
282 |
|
|
{
|
283 |
|
|
if (TICOFF_LOCAL_LABEL_P(name))
|
284 |
|
|
return true;
|
285 |
|
|
return false;
|
286 |
|
|
}
|
287 |
|
|
|
288 |
|
|
#define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name
|
289 |
|
|
|
290 |
|
|
/* Customize coffcode.h; the default coff_ functions are set up to use COFF2;
|
291 |
|
|
coff_bad_format_hook uses BADMAG, so set that for COFF2. The COFF1
|
292 |
|
|
and COFF0 vectors use custom _bad_format_hook procs instead of setting
|
293 |
|
|
BADMAG.
|
294 |
|
|
*/
|
295 |
|
|
#define BADMAG(x) COFF2_BADMAG(x)
|
296 |
|
|
#include "coffcode.h"
|
297 |
|
|
|
298 |
|
|
static void
|
299 |
|
|
tic54x_reloc_processing (relent, reloc, symbols, abfd, section)
|
300 |
|
|
arelent *relent;
|
301 |
|
|
struct internal_reloc *reloc;
|
302 |
|
|
asymbol **symbols;
|
303 |
|
|
bfd *abfd;
|
304 |
|
|
asection *section;
|
305 |
|
|
{
|
306 |
|
|
asymbol *ptr;
|
307 |
|
|
|
308 |
|
|
relent->address = reloc->r_vaddr;
|
309 |
|
|
|
310 |
|
|
if (reloc->r_symndx != -1)
|
311 |
|
|
{
|
312 |
|
|
if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd))
|
313 |
|
|
{
|
314 |
|
|
(*_bfd_error_handler)
|
315 |
|
|
(_("%s: warning: illegal symbol index %ld in relocs"),
|
316 |
|
|
bfd_get_filename (abfd), reloc->r_symndx);
|
317 |
|
|
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
318 |
|
|
ptr = NULL;
|
319 |
|
|
}
|
320 |
|
|
else
|
321 |
|
|
{
|
322 |
|
|
relent->sym_ptr_ptr = (symbols
|
323 |
|
|
+ obj_convert (abfd)[reloc->r_symndx]);
|
324 |
|
|
ptr = *(relent->sym_ptr_ptr);
|
325 |
|
|
}
|
326 |
|
|
}
|
327 |
|
|
else
|
328 |
|
|
{
|
329 |
|
|
relent->sym_ptr_ptr = section->symbol_ptr_ptr;
|
330 |
|
|
ptr = *(relent->sym_ptr_ptr);
|
331 |
|
|
}
|
332 |
|
|
|
333 |
|
|
/* The symbols definitions that we have read in have been
|
334 |
|
|
relocated as if their sections started at 0. But the offsets
|
335 |
|
|
refering to the symbols in the raw data have not been
|
336 |
|
|
modified, so we have to have a negative addend to compensate.
|
337 |
|
|
|
338 |
|
|
Note that symbols which used to be common must be left alone */
|
339 |
|
|
|
340 |
|
|
/* Calculate any reloc addend by looking at the symbol */
|
341 |
|
|
CALC_ADDEND (abfd, ptr, *reloc, relent);
|
342 |
|
|
|
343 |
|
|
relent->address -= section->vma;
|
344 |
|
|
/* !! relent->section = (asection *) NULL;*/
|
345 |
|
|
|
346 |
|
|
/* Fill in the relent->howto field from reloc->r_type */
|
347 |
|
|
tic54x_lookup_howto (relent, reloc);
|
348 |
|
|
}
|
349 |
|
|
|
350 |
|
|
/* COFF0 differs in file/section header size and relocation entry size */
|
351 |
|
|
static CONST bfd_coff_backend_data ticoff0_swap_table =
|
352 |
|
|
{
|
353 |
|
|
coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
|
354 |
|
|
coff_SWAP_aux_out, coff_SWAP_sym_out,
|
355 |
|
|
coff_SWAP_lineno_out, coff_SWAP_reloc_out,
|
356 |
|
|
coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out,
|
357 |
|
|
coff_SWAP_scnhdr_out,
|
358 |
|
|
FILHSZ_V0, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ_V0, LINESZ, FILNMLEN,
|
359 |
|
|
#ifdef COFF_LONG_FILENAMES
|
360 |
|
|
true,
|
361 |
|
|
#else
|
362 |
|
|
false,
|
363 |
|
|
#endif
|
364 |
|
|
#ifdef COFF_LONG_SECTION_NAMES
|
365 |
|
|
true,
|
366 |
|
|
#else
|
367 |
|
|
false,
|
368 |
|
|
#endif
|
369 |
|
|
COFF_DEFAULT_SECTION_ALIGNMENT_POWER,
|
370 |
|
|
coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in,
|
371 |
|
|
coff_SWAP_reloc_in, ticoff0_bad_format_hook, coff_set_arch_mach_hook,
|
372 |
|
|
coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
|
373 |
|
|
coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook,
|
374 |
|
|
coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
|
375 |
|
|
coff_classify_symbol, coff_compute_section_file_positions,
|
376 |
|
|
coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
|
377 |
|
|
coff_adjust_symndx, coff_link_add_one_symbol,
|
378 |
|
|
coff_link_output_has_begun, coff_final_link_postscript
|
379 |
|
|
};
|
380 |
|
|
|
381 |
|
|
/* COFF1 differs in section header size */
|
382 |
|
|
static CONST bfd_coff_backend_data ticoff1_swap_table =
|
383 |
|
|
{
|
384 |
|
|
coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
|
385 |
|
|
coff_SWAP_aux_out, coff_SWAP_sym_out,
|
386 |
|
|
coff_SWAP_lineno_out, coff_SWAP_reloc_out,
|
387 |
|
|
coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out,
|
388 |
|
|
coff_SWAP_scnhdr_out,
|
389 |
|
|
FILHSZ, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN,
|
390 |
|
|
#ifdef COFF_LONG_FILENAMES
|
391 |
|
|
true,
|
392 |
|
|
#else
|
393 |
|
|
false,
|
394 |
|
|
#endif
|
395 |
|
|
#ifdef COFF_LONG_SECTION_NAMES
|
396 |
|
|
true,
|
397 |
|
|
#else
|
398 |
|
|
false,
|
399 |
|
|
#endif
|
400 |
|
|
COFF_DEFAULT_SECTION_ALIGNMENT_POWER,
|
401 |
|
|
coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in,
|
402 |
|
|
coff_SWAP_reloc_in, ticoff1_bad_format_hook, coff_set_arch_mach_hook,
|
403 |
|
|
coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
|
404 |
|
|
coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook,
|
405 |
|
|
coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
|
406 |
|
|
coff_classify_symbol, coff_compute_section_file_positions,
|
407 |
|
|
coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
|
408 |
|
|
coff_adjust_symndx, coff_link_add_one_symbol,
|
409 |
|
|
coff_link_output_has_begun, coff_final_link_postscript
|
410 |
|
|
};
|
411 |
|
|
|
412 |
|
|
|
413 |
|
|
/* TI COFF v0, DOS tools (little-endian headers) */
|
414 |
|
|
const bfd_target tic54x_coff0_vec =
|
415 |
|
|
{
|
416 |
|
|
"coff0-c54x", /* name */
|
417 |
|
|
bfd_target_coff_flavour,
|
418 |
|
|
BFD_ENDIAN_LITTLE, /* data byte order is little */
|
419 |
|
|
BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */
|
420 |
|
|
|
421 |
|
|
(HAS_RELOC | EXEC_P | /* object flags */
|
422 |
|
|
HAS_LINENO | HAS_DEBUG |
|
423 |
|
|
HAS_SYMS | HAS_LOCALS | WP_TEXT | HAS_LOAD_PAGE ),
|
424 |
|
|
|
425 |
|
|
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
426 |
|
|
'_', /* leading symbol underscore */
|
427 |
|
|
'/', /* ar_pad_char */
|
428 |
|
|
15, /* ar_max_namelen */
|
429 |
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
430 |
|
|
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
|
431 |
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
432 |
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
433 |
|
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
434 |
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
|
435 |
|
|
|
436 |
|
|
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
437 |
|
|
bfd_generic_archive_p, _bfd_dummy_target},
|
438 |
|
|
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
439 |
|
|
bfd_false},
|
440 |
|
|
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
441 |
|
|
_bfd_write_archive_contents, bfd_false},
|
442 |
|
|
|
443 |
|
|
BFD_JUMP_TABLE_GENERIC (coff),
|
444 |
|
|
BFD_JUMP_TABLE_COPY (coff),
|
445 |
|
|
BFD_JUMP_TABLE_CORE (_bfd_nocore),
|
446 |
|
|
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
|
447 |
|
|
BFD_JUMP_TABLE_SYMBOLS (coff),
|
448 |
|
|
BFD_JUMP_TABLE_RELOCS (coff),
|
449 |
|
|
BFD_JUMP_TABLE_WRITE (coff),
|
450 |
|
|
BFD_JUMP_TABLE_LINK (coff),
|
451 |
|
|
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
452 |
|
|
NULL,
|
453 |
|
|
|
454 |
|
|
(PTR)&ticoff0_swap_table
|
455 |
|
|
};
|
456 |
|
|
|
457 |
|
|
/* TI COFF v0, SPARC tools (big-endian headers) */
|
458 |
|
|
const bfd_target tic54x_coff0_beh_vec =
|
459 |
|
|
{
|
460 |
|
|
"coff0-beh-c54x", /* name */
|
461 |
|
|
bfd_target_coff_flavour,
|
462 |
|
|
BFD_ENDIAN_LITTLE, /* data byte order is little */
|
463 |
|
|
BFD_ENDIAN_BIG, /* header byte order is big */
|
464 |
|
|
|
465 |
|
|
(HAS_RELOC | EXEC_P | /* object flags */
|
466 |
|
|
HAS_LINENO | HAS_DEBUG |
|
467 |
|
|
HAS_SYMS | HAS_LOCALS | WP_TEXT | HAS_LOAD_PAGE ),
|
468 |
|
|
|
469 |
|
|
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
470 |
|
|
'_', /* leading symbol underscore */
|
471 |
|
|
'/', /* ar_pad_char */
|
472 |
|
|
15, /* ar_max_namelen */
|
473 |
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
474 |
|
|
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
|
475 |
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
476 |
|
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
477 |
|
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
478 |
|
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
|
479 |
|
|
|
480 |
|
|
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
481 |
|
|
bfd_generic_archive_p, _bfd_dummy_target},
|
482 |
|
|
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
483 |
|
|
bfd_false},
|
484 |
|
|
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
485 |
|
|
_bfd_write_archive_contents, bfd_false},
|
486 |
|
|
|
487 |
|
|
BFD_JUMP_TABLE_GENERIC (coff),
|
488 |
|
|
BFD_JUMP_TABLE_COPY (coff),
|
489 |
|
|
BFD_JUMP_TABLE_CORE (_bfd_nocore),
|
490 |
|
|
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
|
491 |
|
|
BFD_JUMP_TABLE_SYMBOLS (coff),
|
492 |
|
|
BFD_JUMP_TABLE_RELOCS (coff),
|
493 |
|
|
BFD_JUMP_TABLE_WRITE (coff),
|
494 |
|
|
BFD_JUMP_TABLE_LINK (coff),
|
495 |
|
|
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
496 |
|
|
|
497 |
|
|
&tic54x_coff0_vec,
|
498 |
|
|
|
499 |
|
|
(PTR)&ticoff0_swap_table
|
500 |
|
|
};
|
501 |
|
|
|
502 |
|
|
/* TI COFF v1, DOS tools (little-endian headers) */
|
503 |
|
|
const bfd_target tic54x_coff1_vec =
|
504 |
|
|
{
|
505 |
|
|
"coff1-c54x", /* name */
|
506 |
|
|
bfd_target_coff_flavour,
|
507 |
|
|
BFD_ENDIAN_LITTLE, /* data byte order is little */
|
508 |
|
|
BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */
|
509 |
|
|
|
510 |
|
|
(HAS_RELOC | EXEC_P | /* object flags */
|
511 |
|
|
HAS_LINENO | HAS_DEBUG |
|
512 |
|
|
HAS_SYMS | HAS_LOCALS | WP_TEXT | HAS_LOAD_PAGE ),
|
513 |
|
|
|
514 |
|
|
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
515 |
|
|
'_', /* leading symbol underscore */
|
516 |
|
|
'/', /* ar_pad_char */
|
517 |
|
|
15, /* ar_max_namelen */
|
518 |
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
519 |
|
|
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
|
520 |
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
521 |
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
522 |
|
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
523 |
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
|
524 |
|
|
|
525 |
|
|
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
526 |
|
|
bfd_generic_archive_p, _bfd_dummy_target},
|
527 |
|
|
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
528 |
|
|
bfd_false},
|
529 |
|
|
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
530 |
|
|
_bfd_write_archive_contents, bfd_false},
|
531 |
|
|
|
532 |
|
|
BFD_JUMP_TABLE_GENERIC (coff),
|
533 |
|
|
BFD_JUMP_TABLE_COPY (coff),
|
534 |
|
|
BFD_JUMP_TABLE_CORE (_bfd_nocore),
|
535 |
|
|
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
|
536 |
|
|
BFD_JUMP_TABLE_SYMBOLS (coff),
|
537 |
|
|
BFD_JUMP_TABLE_RELOCS (coff),
|
538 |
|
|
BFD_JUMP_TABLE_WRITE (coff),
|
539 |
|
|
BFD_JUMP_TABLE_LINK (coff),
|
540 |
|
|
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
541 |
|
|
|
542 |
|
|
&tic54x_coff0_beh_vec,
|
543 |
|
|
|
544 |
|
|
(PTR)&ticoff1_swap_table
|
545 |
|
|
};
|
546 |
|
|
|
547 |
|
|
/* TI COFF v1, SPARC tools (big-endian headers) */
|
548 |
|
|
const bfd_target tic54x_coff1_beh_vec =
|
549 |
|
|
{
|
550 |
|
|
"coff1-beh-c54x", /* name */
|
551 |
|
|
bfd_target_coff_flavour,
|
552 |
|
|
BFD_ENDIAN_LITTLE, /* data byte order is little */
|
553 |
|
|
BFD_ENDIAN_BIG, /* header byte order is big */
|
554 |
|
|
|
555 |
|
|
(HAS_RELOC | EXEC_P | /* object flags */
|
556 |
|
|
HAS_LINENO | HAS_DEBUG |
|
557 |
|
|
HAS_SYMS | HAS_LOCALS | WP_TEXT | HAS_LOAD_PAGE ),
|
558 |
|
|
|
559 |
|
|
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
560 |
|
|
'_', /* leading symbol underscore */
|
561 |
|
|
'/', /* ar_pad_char */
|
562 |
|
|
15, /* ar_max_namelen */
|
563 |
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
564 |
|
|
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
|
565 |
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
566 |
|
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
567 |
|
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
568 |
|
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
|
569 |
|
|
|
570 |
|
|
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
571 |
|
|
bfd_generic_archive_p, _bfd_dummy_target},
|
572 |
|
|
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
573 |
|
|
bfd_false},
|
574 |
|
|
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
575 |
|
|
_bfd_write_archive_contents, bfd_false},
|
576 |
|
|
|
577 |
|
|
BFD_JUMP_TABLE_GENERIC (coff),
|
578 |
|
|
BFD_JUMP_TABLE_COPY (coff),
|
579 |
|
|
BFD_JUMP_TABLE_CORE (_bfd_nocore),
|
580 |
|
|
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
|
581 |
|
|
BFD_JUMP_TABLE_SYMBOLS (coff),
|
582 |
|
|
BFD_JUMP_TABLE_RELOCS (coff),
|
583 |
|
|
BFD_JUMP_TABLE_WRITE (coff),
|
584 |
|
|
BFD_JUMP_TABLE_LINK (coff),
|
585 |
|
|
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
586 |
|
|
|
587 |
|
|
&tic54x_coff1_vec,
|
588 |
|
|
|
589 |
|
|
(PTR)&ticoff1_swap_table
|
590 |
|
|
};
|
591 |
|
|
|
592 |
|
|
/* TI COFF v2, TI DOS tools output (little-endian headers) */
|
593 |
|
|
const bfd_target tic54x_coff2_vec =
|
594 |
|
|
{
|
595 |
|
|
"coff2-c54x", /* name */
|
596 |
|
|
bfd_target_coff_flavour,
|
597 |
|
|
BFD_ENDIAN_LITTLE, /* data byte order is little */
|
598 |
|
|
BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */
|
599 |
|
|
|
600 |
|
|
(HAS_RELOC | EXEC_P | /* object flags */
|
601 |
|
|
HAS_LINENO | HAS_DEBUG |
|
602 |
|
|
HAS_SYMS | HAS_LOCALS | WP_TEXT | HAS_LOAD_PAGE ),
|
603 |
|
|
|
604 |
|
|
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
605 |
|
|
'_', /* leading symbol underscore */
|
606 |
|
|
'/', /* ar_pad_char */
|
607 |
|
|
15, /* ar_max_namelen */
|
608 |
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
609 |
|
|
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
|
610 |
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
611 |
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
612 |
|
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
613 |
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
|
614 |
|
|
|
615 |
|
|
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
616 |
|
|
bfd_generic_archive_p, _bfd_dummy_target},
|
617 |
|
|
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
618 |
|
|
bfd_false},
|
619 |
|
|
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
620 |
|
|
_bfd_write_archive_contents, bfd_false},
|
621 |
|
|
|
622 |
|
|
BFD_JUMP_TABLE_GENERIC (coff),
|
623 |
|
|
BFD_JUMP_TABLE_COPY (coff),
|
624 |
|
|
BFD_JUMP_TABLE_CORE (_bfd_nocore),
|
625 |
|
|
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
|
626 |
|
|
BFD_JUMP_TABLE_SYMBOLS (coff),
|
627 |
|
|
BFD_JUMP_TABLE_RELOCS (coff),
|
628 |
|
|
BFD_JUMP_TABLE_WRITE (coff),
|
629 |
|
|
BFD_JUMP_TABLE_LINK (coff),
|
630 |
|
|
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
631 |
|
|
|
632 |
|
|
&tic54x_coff1_beh_vec,
|
633 |
|
|
|
634 |
|
|
COFF_SWAP_TABLE
|
635 |
|
|
};
|
636 |
|
|
|
637 |
|
|
/* TI COFF v2, TI SPARC tools output (big-endian headers) */
|
638 |
|
|
const bfd_target tic54x_coff2_beh_vec =
|
639 |
|
|
{
|
640 |
|
|
"coff2-beh-c54x", /* name */
|
641 |
|
|
bfd_target_coff_flavour,
|
642 |
|
|
BFD_ENDIAN_LITTLE, /* data byte order is little */
|
643 |
|
|
BFD_ENDIAN_BIG, /* header byte order is big */
|
644 |
|
|
|
645 |
|
|
(HAS_RELOC | EXEC_P | /* object flags */
|
646 |
|
|
HAS_LINENO | HAS_DEBUG |
|
647 |
|
|
HAS_SYMS | HAS_LOCALS | WP_TEXT | HAS_LOAD_PAGE ),
|
648 |
|
|
|
649 |
|
|
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
650 |
|
|
'_', /* leading symbol underscore */
|
651 |
|
|
'/', /* ar_pad_char */
|
652 |
|
|
15, /* ar_max_namelen */
|
653 |
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
654 |
|
|
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
|
655 |
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
656 |
|
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
657 |
|
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
658 |
|
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
|
659 |
|
|
|
660 |
|
|
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
661 |
|
|
bfd_generic_archive_p, _bfd_dummy_target},
|
662 |
|
|
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
663 |
|
|
bfd_false},
|
664 |
|
|
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
665 |
|
|
_bfd_write_archive_contents, bfd_false},
|
666 |
|
|
|
667 |
|
|
BFD_JUMP_TABLE_GENERIC (coff),
|
668 |
|
|
BFD_JUMP_TABLE_COPY (coff),
|
669 |
|
|
BFD_JUMP_TABLE_CORE (_bfd_nocore),
|
670 |
|
|
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
|
671 |
|
|
BFD_JUMP_TABLE_SYMBOLS (coff),
|
672 |
|
|
BFD_JUMP_TABLE_RELOCS (coff),
|
673 |
|
|
BFD_JUMP_TABLE_WRITE (coff),
|
674 |
|
|
BFD_JUMP_TABLE_LINK (coff),
|
675 |
|
|
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
676 |
|
|
|
677 |
|
|
&tic54x_coff2_vec,
|
678 |
|
|
|
679 |
|
|
COFF_SWAP_TABLE
|
680 |
|
|
};
|