Commit | Line | Data |
---|---|---|
026df7c5 NC |
1 | /* BFD back-end for TMS320C4X coff binaries. |
2 | Copyright (C) 1996-99, 2000, 2002 Free Software Foundation, Inc. | |
3 | Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz) | |
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/tic4x.h" | |
27 | #include "coff/internal.h" | |
28 | #include "libcoff.h" | |
29 | ||
30 | #undef F_LSYMS | |
31 | #define F_LSYMS F_LSYMS_TICOFF | |
32 | ||
33 | static boolean | |
34 | ticoff0_bad_format_hook (abfd, filehdr) | |
35 | bfd *abfd; | |
36 | PTR filehdr; | |
37 | { | |
38 | struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; | |
39 | ||
40 | if (COFF0_BADMAG (*internal_f)) | |
41 | return false; | |
42 | ||
43 | return true; | |
44 | } | |
45 | ||
46 | static boolean | |
47 | ticoff1_bad_format_hook (abfd, filehdr) | |
48 | bfd *abfd ATTRIBUTE_UNUSED; | |
49 | PTR filehdr; | |
50 | { | |
51 | struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; | |
52 | ||
53 | if (COFF1_BADMAG (*internal_f)) | |
54 | return false; | |
55 | ||
56 | return true; | |
57 | } | |
58 | ||
59 | /* Replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local | |
60 | labels. */ | |
61 | static boolean | |
62 | ticoff_bfd_is_local_label_name (abfd, name) | |
63 | bfd *abfd ATTRIBUTE_UNUSED; | |
64 | const char *name; | |
65 | { | |
66 | if (TICOFF_LOCAL_LABEL_P(name)) | |
67 | return true; | |
68 | return false; | |
69 | } | |
70 | ||
71 | #define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name | |
72 | ||
73 | static void tic4x_reloc_processing | |
74 | PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); | |
75 | ||
76 | #define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\ | |
77 | tic4x_reloc_processing (RELENT,RELOC,SYMS,ABFD,SECT) | |
78 | ||
79 | /* Customize coffcode.h; the default coff_ functions are set up to use | |
80 | COFF2; coff_bad_format_hook uses BADMAG, so set that for COFF2. | |
81 | The COFF1 and COFF0 vectors use custom _bad_format_hook procs | |
82 | instead of setting BADMAG. */ | |
83 | #define BADMAG(x) COFF2_BADMAG(x) | |
84 | #include "coffcode.h" | |
85 | ||
86 | static bfd_reloc_status_type | |
87 | tic4x_relocation (abfd, reloc_entry, symbol, data, input_section, | |
88 | output_bfd, error_message) | |
89 | bfd *abfd ATTRIBUTE_UNUSED; | |
90 | arelent *reloc_entry; | |
91 | asymbol *symbol ATTRIBUTE_UNUSED; | |
92 | PTR data ATTRIBUTE_UNUSED; | |
93 | asection *input_section; | |
94 | bfd *output_bfd; | |
95 | char **error_message ATTRIBUTE_UNUSED; | |
96 | { | |
97 | if (output_bfd != (bfd *) NULL) | |
98 | { | |
99 | /* This is a partial relocation, and we want to apply the | |
100 | relocation to the reloc entry rather than the raw data. | |
101 | Modify the reloc inplace to reflect what we now know. */ | |
102 | reloc_entry->address += input_section->output_offset; | |
103 | return bfd_reloc_ok; | |
104 | } | |
105 | return bfd_reloc_continue; | |
106 | } | |
107 | ||
108 | reloc_howto_type tic4x_howto_table[] = | |
109 | { | |
110 | HOWTO(R_RELWORD, 0, 2, 16, false, 0, complain_overflow_signed, tic4x_relocation, "RELWORD", true, 0x0000ffff, 0x0000ffff, false), | |
111 | HOWTO(R_REL24, 0, 2, 24, false, 0, complain_overflow_bitfield, tic4x_relocation, "REL24", true, 0x00ffffff, 0x00ffffff, false), | |
112 | HOWTO(R_RELLONG, 0, 2, 32, false, 0, complain_overflow_dont, tic4x_relocation, "RELLONG", true, 0xffffffff, 0xffffffff, false), | |
113 | HOWTO(R_PCRWORD, 0, 2, 16, true, 0, complain_overflow_signed, tic4x_relocation, "PCRWORD", true, 0x0000ffff, 0x0000ffff, false), | |
114 | HOWTO(R_PCR24, 0, 2, 24, true, 0, complain_overflow_signed, tic4x_relocation, "PCR24", true, 0x00ffffff, 0x00ffffff, false), | |
115 | HOWTO(R_PARTLS16, 0, 2, 16, false, 0, complain_overflow_dont, tic4x_relocation, "PARTLS16", true, 0x0000ffff, 0x0000ffff, false), | |
116 | HOWTO(R_PARTMS8, 16, 2, 16, false, 0, complain_overflow_dont, tic4x_relocation, "PARTMS8", true, 0x0000ffff, 0x0000ffff, false), | |
117 | HOWTO(R_RELWORD, 0, 2, 16, false, 0, complain_overflow_signed, tic4x_relocation, "ARELWORD", true, 0x0000ffff, 0x0000ffff, false), | |
118 | HOWTO(R_REL24, 0, 2, 24, false, 0, complain_overflow_signed, tic4x_relocation, "AREL24", true, 0x00ffffff, 0x00ffffff, false), | |
119 | HOWTO(R_RELLONG, 0, 2, 32, false, 0, complain_overflow_signed, tic4x_relocation, "ARELLONG", true, 0xffffffff, 0xffffffff, false), | |
120 | HOWTO(R_PCRWORD, 0, 2, 16, true, 0, complain_overflow_signed, tic4x_relocation, "APCRWORD", true, 0x0000ffff, 0x0000ffff, false), | |
121 | HOWTO(R_PCR24, 0, 2, 24, true, 0, complain_overflow_signed, tic4x_relocation, "APCR24", true, 0x00ffffff, 0x00ffffff, false), | |
122 | HOWTO(R_PARTLS16, 0, 2, 16, false, 0, complain_overflow_dont, tic4x_relocation, "APARTLS16", true, 0x0000ffff, 0x0000ffff, false), | |
123 | HOWTO(R_PARTMS8, 16, 2, 16, false, 0, complain_overflow_dont, tic4x_relocation, "APARTMS8", true, 0x0000ffff, 0x0000ffff, false), | |
124 | }; | |
125 | #define HOWTO_SIZE (sizeof(tic4x_howto_table) / sizeof(tic4x_howto_table[0])) | |
126 | ||
127 | #undef coff_bfd_reloc_type_lookup | |
128 | #define coff_bfd_reloc_type_lookup tic4x_coff_reloc_type_lookup | |
129 | ||
130 | /* For the case statement use the code values used tc_gen_reloc (defined in | |
131 | bfd/reloc.c) to map to the howto table entries. */ | |
132 | ||
133 | static reloc_howto_type * | |
134 | tic4x_coff_reloc_type_lookup (abfd, code) | |
135 | bfd *abfd ATTRIBUTE_UNUSED; | |
136 | bfd_reloc_code_real_type code; | |
137 | { | |
138 | unsigned int type; | |
139 | unsigned int i; | |
140 | ||
141 | switch (code) | |
142 | { | |
143 | case BFD_RELOC_32: type = R_RELLONG; break; | |
144 | case BFD_RELOC_24: type = R_REL24; break; | |
145 | case BFD_RELOC_16: type = R_RELWORD; break; | |
146 | case BFD_RELOC_24_PCREL: type = R_PCR24; break; | |
147 | case BFD_RELOC_16_PCREL: type = R_PCRWORD; break; | |
148 | case BFD_RELOC_HI16: type = R_PARTMS8; break; | |
149 | case BFD_RELOC_LO16: type = R_PARTLS16; break; | |
150 | default: | |
151 | return NULL; | |
152 | } | |
153 | ||
154 | for (i = 0; i < HOWTO_SIZE; i++) | |
155 | { | |
156 | if (tic4x_howto_table[i].type == type) | |
157 | return tic4x_howto_table + i; | |
158 | } | |
159 | return NULL; | |
160 | } | |
161 | ||
162 | ||
163 | /* Code to turn a r_type into a howto ptr, uses the above howto table. | |
164 | Called after some initial checking by the tic4x_rtype_to_howto fn | |
165 | below. */ | |
166 | static void | |
167 | tic4x_lookup_howto (internal, dst) | |
168 | arelent *internal; | |
169 | struct internal_reloc *dst; | |
170 | { | |
171 | unsigned int i; | |
172 | int bank = (dst->r_symndx == -1) ? HOWTO_BANK : 0; | |
173 | ||
174 | for (i = 0; i < HOWTO_SIZE; i++) | |
175 | { | |
176 | if (tic4x_howto_table[i].type == dst->r_type) | |
177 | { | |
178 | internal->howto = tic4x_howto_table + i + bank; | |
179 | return; | |
180 | } | |
181 | } | |
182 | ||
183 | (*_bfd_error_handler) (_("Unrecognized reloc type 0x%x"), | |
184 | (unsigned int) dst->r_type); | |
185 | abort(); | |
186 | } | |
187 | ||
188 | #undef coff_rtype_to_howto | |
189 | #define coff_rtype_to_howto coff_tic4x_rtype_to_howto | |
190 | ||
191 | static reloc_howto_type * | |
192 | coff_tic4x_rtype_to_howto (abfd, sec, rel, h, sym, addendp) | |
193 | bfd *abfd ATTRIBUTE_UNUSED; | |
194 | asection *sec; | |
195 | struct internal_reloc *rel; | |
196 | struct coff_link_hash_entry *h ATTRIBUTE_UNUSED; | |
197 | struct internal_syment *sym ATTRIBUTE_UNUSED; | |
198 | bfd_vma *addendp; | |
199 | { | |
200 | arelent genrel; | |
201 | ||
202 | if (rel->r_symndx == -1 && addendp != NULL) | |
203 | /* This is a TI "internal relocation", which means that the relocation | |
204 | amount is the amount by which the current section is being relocated | |
205 | in the output section. */ | |
206 | *addendp = (sec->output_section->vma + sec->output_offset) - sec->vma; | |
207 | ||
208 | tic4x_lookup_howto (&genrel, rel); | |
209 | ||
210 | return genrel.howto; | |
211 | } | |
212 | ||
213 | ||
214 | static void | |
215 | tic4x_reloc_processing (relent, reloc, symbols, abfd, section) | |
216 | arelent *relent; | |
217 | struct internal_reloc *reloc; | |
218 | asymbol **symbols; | |
219 | bfd *abfd; | |
220 | asection *section; | |
221 | { | |
222 | asymbol *ptr; | |
223 | ||
224 | relent->address = reloc->r_vaddr; | |
225 | ||
226 | if (reloc->r_symndx != -1) | |
227 | { | |
228 | if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd)) | |
229 | { | |
230 | (*_bfd_error_handler) | |
231 | (_("%s: warning: illegal symbol index %ld in relocs"), | |
232 | bfd_get_filename (abfd), reloc->r_symndx); | |
233 | relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; | |
234 | ptr = NULL; | |
235 | } | |
236 | else | |
237 | { | |
238 | relent->sym_ptr_ptr = (symbols | |
239 | + obj_convert (abfd)[reloc->r_symndx]); | |
240 | ptr = *(relent->sym_ptr_ptr); | |
241 | } | |
242 | } | |
243 | else | |
244 | { | |
245 | relent->sym_ptr_ptr = section->symbol_ptr_ptr; | |
246 | ptr = *(relent->sym_ptr_ptr); | |
247 | } | |
248 | ||
249 | /* The symbols definitions that we have read in have been relocated | |
250 | as if their sections started at 0. But the offsets refering to | |
251 | the symbols in the raw data have not been modified, so we have to | |
252 | have a negative addend to compensate. | |
253 | ||
254 | Note that symbols which used to be common must be left alone. */ | |
255 | ||
256 | /* Calculate any reloc addend by looking at the symbol. */ | |
257 | CALC_ADDEND (abfd, ptr, *reloc, relent); | |
258 | ||
259 | relent->address -= section->vma; | |
260 | /* !! relent->section = (asection *) NULL; */ | |
261 | ||
262 | /* Fill in the relent->howto field from reloc->r_type. */ | |
263 | tic4x_lookup_howto (relent, reloc); | |
264 | } | |
265 | ||
266 | ||
267 | static const bfd_coff_backend_data ticoff0_swap_table = | |
268 | { | |
269 | coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, | |
270 | coff_SWAP_aux_out, coff_SWAP_sym_out, | |
271 | coff_SWAP_lineno_out, coff_SWAP_reloc_out, | |
272 | coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out, | |
273 | coff_SWAP_scnhdr_out, | |
274 | FILHSZ_V0, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ_V0, LINESZ, FILNMLEN, | |
275 | #ifdef COFF_LONG_FILENAMES | |
276 | true, | |
277 | #else | |
278 | false, | |
279 | #endif | |
280 | #ifdef COFF_LONG_SECTION_NAMES | |
281 | true, | |
282 | #else | |
283 | false, | |
284 | #endif | |
285 | #ifdef COFF_FORCE_SYMBOLS_IN_STRINGS | |
286 | true, | |
287 | #else | |
288 | false, | |
289 | #endif | |
290 | #ifdef COFF_DEBUG_STRING_WIDE_PREFIX | |
291 | 4, | |
292 | #else | |
293 | 2, | |
294 | #endif | |
295 | COFF_DEFAULT_SECTION_ALIGNMENT_POWER, | |
296 | coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, | |
297 | coff_SWAP_reloc_in, ticoff0_bad_format_hook, coff_set_arch_mach_hook, | |
298 | coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, | |
299 | coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, | |
300 | coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, | |
301 | coff_classify_symbol, coff_compute_section_file_positions, | |
302 | coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, | |
303 | coff_adjust_symndx, coff_link_add_one_symbol, | |
304 | coff_link_output_has_begun, coff_final_link_postscript | |
305 | }; | |
306 | ||
307 | /* COFF1 differs in section header size. */ | |
308 | static const bfd_coff_backend_data ticoff1_swap_table = | |
309 | { | |
310 | coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, | |
311 | coff_SWAP_aux_out, coff_SWAP_sym_out, | |
312 | coff_SWAP_lineno_out, coff_SWAP_reloc_out, | |
313 | coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out, | |
314 | coff_SWAP_scnhdr_out, | |
315 | FILHSZ, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN, | |
316 | #ifdef COFF_LONG_FILENAMES | |
317 | true, | |
318 | #else | |
319 | false, | |
320 | #endif | |
321 | #ifdef COFF_LONG_SECTION_NAMES | |
322 | true, | |
323 | #else | |
324 | false, | |
325 | #endif | |
326 | #ifdef COFF_FORCE_SYMBOLS_IN_STRINGS | |
327 | true, | |
328 | #else | |
329 | false, | |
330 | #endif | |
331 | #ifdef COFF_DEBUG_STRING_WIDE_PREFIX | |
332 | 4, | |
333 | #else | |
334 | 2, | |
335 | #endif | |
336 | COFF_DEFAULT_SECTION_ALIGNMENT_POWER, | |
337 | coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, | |
338 | coff_SWAP_reloc_in, ticoff1_bad_format_hook, coff_set_arch_mach_hook, | |
339 | coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, | |
340 | coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, | |
341 | coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, | |
342 | coff_classify_symbol, coff_compute_section_file_positions, | |
343 | coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, | |
344 | coff_adjust_symndx, coff_link_add_one_symbol, | |
345 | coff_link_output_has_begun, coff_final_link_postscript | |
346 | }; | |
347 | ||
348 | ||
349 | /* TI COFF v0, DOS tools (little-endian headers). */ | |
350 | const bfd_target tic4x_coff0_vec = | |
351 | { | |
352 | "coff0-c4x", /* Name. */ | |
353 | bfd_target_coff_flavour, | |
354 | BFD_ENDIAN_LITTLE, /* Data byte order is little. */ | |
355 | BFD_ENDIAN_LITTLE, /* Header byte order is little (DOS tools). */ | |
356 | ||
357 | (HAS_RELOC | EXEC_P | /* Object flags. */ | |
358 | HAS_LINENO | HAS_DEBUG | | |
359 | HAS_SYMS | HAS_LOCALS | WP_TEXT | HAS_LOAD_PAGE ), | |
360 | ||
361 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ | |
362 | '_', /* Leading symbol underscore. */ | |
363 | '/', /* ar_pad_char. */ | |
364 | 15, /* ar_max_namelen. */ | |
365 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
366 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
367 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ | |
368 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
369 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
370 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ | |
371 | ||
372 | {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ | |
373 | bfd_generic_archive_p, _bfd_dummy_target}, | |
374 | {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ | |
375 | bfd_false}, | |
376 | {bfd_false, coff_write_object_contents, /* bfd_write_contents */ | |
377 | _bfd_write_archive_contents, bfd_false}, | |
378 | ||
379 | BFD_JUMP_TABLE_GENERIC (coff), | |
380 | BFD_JUMP_TABLE_COPY (coff), | |
381 | BFD_JUMP_TABLE_CORE (_bfd_nocore), | |
382 | BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), | |
383 | BFD_JUMP_TABLE_SYMBOLS (coff), | |
384 | BFD_JUMP_TABLE_RELOCS (coff), | |
385 | BFD_JUMP_TABLE_WRITE (coff), | |
386 | BFD_JUMP_TABLE_LINK (coff), | |
387 | BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), | |
388 | NULL, | |
389 | ||
390 | (PTR)&ticoff0_swap_table | |
391 | }; | |
392 | ||
393 | /* TI COFF v0, SPARC tools (big-endian headers). */ | |
394 | const bfd_target tic4x_coff0_beh_vec = | |
395 | { | |
396 | "coff0-beh-c4x", /* Name. */ | |
397 | bfd_target_coff_flavour, | |
398 | BFD_ENDIAN_LITTLE, /* Data byte order is little. */ | |
399 | BFD_ENDIAN_BIG, /* Header byte order is big. */ | |
400 | ||
401 | (HAS_RELOC | EXEC_P | /* Object flags. */ | |
402 | HAS_LINENO | HAS_DEBUG | | |
403 | HAS_SYMS | HAS_LOCALS | WP_TEXT | HAS_LOAD_PAGE ), | |
404 | ||
405 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ | |
406 | '_', /* Leading symbol underscore. */ | |
407 | '/', /* ar_pad_char */ | |
408 | 15, /* ar_max_namelen */ | |
409 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
410 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
411 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ | |
412 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, | |
413 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, | |
414 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ | |
415 | ||
416 | {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ | |
417 | bfd_generic_archive_p, _bfd_dummy_target}, | |
418 | {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ | |
419 | bfd_false}, | |
420 | {bfd_false, coff_write_object_contents, /* bfd_write_contents */ | |
421 | _bfd_write_archive_contents, bfd_false}, | |
422 | ||
423 | BFD_JUMP_TABLE_GENERIC (coff), | |
424 | BFD_JUMP_TABLE_COPY (coff), | |
425 | BFD_JUMP_TABLE_CORE (_bfd_nocore), | |
426 | BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), | |
427 | BFD_JUMP_TABLE_SYMBOLS (coff), | |
428 | BFD_JUMP_TABLE_RELOCS (coff), | |
429 | BFD_JUMP_TABLE_WRITE (coff), | |
430 | BFD_JUMP_TABLE_LINK (coff), | |
431 | BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), | |
432 | ||
433 | &tic4x_coff0_vec, | |
434 | ||
435 | (PTR)&ticoff0_swap_table | |
436 | }; | |
437 | ||
438 | /* TI COFF v1, DOS tools (little-endian headers). */ | |
439 | const bfd_target tic4x_coff1_vec = | |
440 | { | |
441 | "coff1-c4x", /* Name. */ | |
442 | bfd_target_coff_flavour, | |
443 | BFD_ENDIAN_LITTLE, /* Data byte order is little. */ | |
444 | BFD_ENDIAN_LITTLE, /* Header byte order is little (DOS tools). */ | |
445 | ||
446 | (HAS_RELOC | EXEC_P | /* Object flags. */ | |
447 | HAS_LINENO | HAS_DEBUG | | |
448 | HAS_SYMS | HAS_LOCALS | WP_TEXT | HAS_LOAD_PAGE ), | |
449 | ||
450 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ | |
451 | '_', /* Leading symbol underscore. */ | |
452 | '/', /* ar_pad_char */ | |
453 | 15, /* ar_max_namelen */ | |
454 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
455 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
456 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ | |
457 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
458 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
459 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ | |
460 | ||
461 | {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ | |
462 | bfd_generic_archive_p, _bfd_dummy_target}, | |
463 | {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ | |
464 | bfd_false}, | |
465 | {bfd_false, coff_write_object_contents, /* bfd_write_contents */ | |
466 | _bfd_write_archive_contents, bfd_false}, | |
467 | ||
468 | BFD_JUMP_TABLE_GENERIC (coff), | |
469 | BFD_JUMP_TABLE_COPY (coff), | |
470 | BFD_JUMP_TABLE_CORE (_bfd_nocore), | |
471 | BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), | |
472 | BFD_JUMP_TABLE_SYMBOLS (coff), | |
473 | BFD_JUMP_TABLE_RELOCS (coff), | |
474 | BFD_JUMP_TABLE_WRITE (coff), | |
475 | BFD_JUMP_TABLE_LINK (coff), | |
476 | BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), | |
477 | ||
478 | &tic4x_coff0_beh_vec, | |
479 | ||
480 | (PTR)&ticoff1_swap_table | |
481 | }; | |
482 | ||
483 | /* TI COFF v1, SPARC tools (big-endian headers). */ | |
484 | const bfd_target tic4x_coff1_beh_vec = | |
485 | { | |
486 | "coff1-beh-c4x", /* Name. */ | |
487 | bfd_target_coff_flavour, | |
488 | BFD_ENDIAN_LITTLE, /* Data byte order is little. */ | |
489 | BFD_ENDIAN_BIG, /* Header byte order is big. */ | |
490 | ||
491 | (HAS_RELOC | EXEC_P | /* Object flags. */ | |
492 | HAS_LINENO | HAS_DEBUG | | |
493 | HAS_SYMS | HAS_LOCALS | WP_TEXT | HAS_LOAD_PAGE ), | |
494 | ||
495 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ | |
496 | '_', /* Leading symbol underscore. */ | |
497 | '/', /* ar_pad_char */ | |
498 | 15, /* ar_max_namelen */ | |
499 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
500 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
501 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ | |
502 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, | |
503 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, | |
504 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ | |
505 | ||
506 | {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ | |
507 | bfd_generic_archive_p, _bfd_dummy_target}, | |
508 | {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ | |
509 | bfd_false}, | |
510 | {bfd_false, coff_write_object_contents, /* bfd_write_contents */ | |
511 | _bfd_write_archive_contents, bfd_false}, | |
512 | ||
513 | BFD_JUMP_TABLE_GENERIC (coff), | |
514 | BFD_JUMP_TABLE_COPY (coff), | |
515 | BFD_JUMP_TABLE_CORE (_bfd_nocore), | |
516 | BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), | |
517 | BFD_JUMP_TABLE_SYMBOLS (coff), | |
518 | BFD_JUMP_TABLE_RELOCS (coff), | |
519 | BFD_JUMP_TABLE_WRITE (coff), | |
520 | BFD_JUMP_TABLE_LINK (coff), | |
521 | BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), | |
522 | ||
523 | &tic4x_coff1_vec, | |
524 | ||
525 | (PTR)&ticoff1_swap_table | |
526 | }; | |
527 | ||
528 | /* TI COFF v2, TI DOS tools output (little-endian headers). */ | |
529 | const bfd_target tic4x_coff2_vec = | |
530 | { | |
531 | "coff2-c4x", /* Name. */ | |
532 | bfd_target_coff_flavour, | |
533 | BFD_ENDIAN_LITTLE, /* Data byte order is little. */ | |
534 | BFD_ENDIAN_LITTLE, /* Header byte order is little (DOS tools). */ | |
535 | ||
536 | (HAS_RELOC | EXEC_P | /* Object flags. */ | |
537 | HAS_LINENO | HAS_DEBUG | | |
538 | HAS_SYMS | HAS_LOCALS | WP_TEXT | HAS_LOAD_PAGE ), | |
539 | ||
540 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ | |
541 | '_', /* Leading symbol underscore. */ | |
542 | '/', /* ar_pad_char */ | |
543 | 15, /* ar_max_namelen */ | |
544 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
545 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
546 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ | |
547 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
548 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
549 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ | |
550 | ||
551 | {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ | |
552 | bfd_generic_archive_p, _bfd_dummy_target}, | |
553 | {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ | |
554 | bfd_false}, | |
555 | {bfd_false, coff_write_object_contents, /* bfd_write_contents */ | |
556 | _bfd_write_archive_contents, bfd_false}, | |
557 | ||
558 | BFD_JUMP_TABLE_GENERIC (coff), | |
559 | BFD_JUMP_TABLE_COPY (coff), | |
560 | BFD_JUMP_TABLE_CORE (_bfd_nocore), | |
561 | BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), | |
562 | BFD_JUMP_TABLE_SYMBOLS (coff), | |
563 | BFD_JUMP_TABLE_RELOCS (coff), | |
564 | BFD_JUMP_TABLE_WRITE (coff), | |
565 | BFD_JUMP_TABLE_LINK (coff), | |
566 | BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), | |
567 | ||
568 | &tic4x_coff1_beh_vec, | |
569 | ||
570 | COFF_SWAP_TABLE | |
571 | }; | |
572 | ||
573 | /* TI COFF v2, TI SPARC tools output (big-endian headers). */ | |
574 | const bfd_target tic4x_coff2_beh_vec = | |
575 | { | |
576 | "coff2-beh-c4x", /* Name. */ | |
577 | bfd_target_coff_flavour, | |
578 | BFD_ENDIAN_LITTLE, /* Data byte order is little. */ | |
579 | BFD_ENDIAN_BIG, /* Header byte order is big. */ | |
580 | ||
581 | (HAS_RELOC | EXEC_P | /* Object flags. */ | |
582 | HAS_LINENO | HAS_DEBUG | | |
583 | HAS_SYMS | HAS_LOCALS | WP_TEXT | HAS_LOAD_PAGE ), | |
584 | ||
585 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ | |
586 | '_', /* Leading symbol underscore. */ | |
587 | '/', /* ar_pad_char */ | |
588 | 15, /* ar_max_namelen */ | |
589 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
590 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
591 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ | |
592 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, | |
593 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, | |
594 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ | |
595 | ||
596 | {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ | |
597 | bfd_generic_archive_p, _bfd_dummy_target}, | |
598 | {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ | |
599 | bfd_false}, | |
600 | {bfd_false, coff_write_object_contents, /* bfd_write_contents */ | |
601 | _bfd_write_archive_contents, bfd_false}, | |
602 | ||
603 | BFD_JUMP_TABLE_GENERIC (coff), | |
604 | BFD_JUMP_TABLE_COPY (coff), | |
605 | BFD_JUMP_TABLE_CORE (_bfd_nocore), | |
606 | BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), | |
607 | BFD_JUMP_TABLE_SYMBOLS (coff), | |
608 | BFD_JUMP_TABLE_RELOCS (coff), | |
609 | BFD_JUMP_TABLE_WRITE (coff), | |
610 | BFD_JUMP_TABLE_LINK (coff), | |
611 | BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), | |
612 | ||
613 | &tic4x_coff2_vec, | |
614 | ||
615 | COFF_SWAP_TABLE | |
616 | }; |