coff-tic54x.c 21 KB

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