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