coff-tic54x.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  1. /* BFD back-end for TMS320C54X coff binaries.
  2. Copyright (C) 1999-2022 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. static 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. static 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 bool
  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 (bfd *abfd,
  217. arelent *internal,
  218. struct internal_reloc *dst)
  219. {
  220. unsigned i;
  221. int bank = (dst->r_symndx == -1) ? HOWTO_BANK : 0;
  222. for (i = 0; i < sizeof tic54x_howto_table/sizeof tic54x_howto_table[0]; i++)
  223. {
  224. if (tic54x_howto_table[i].type == dst->r_type)
  225. {
  226. internal->howto = tic54x_howto_table + i + bank;
  227. return;
  228. }
  229. }
  230. _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
  231. abfd, (unsigned int) dst->r_type);
  232. internal->howto = NULL;
  233. }
  234. #define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\
  235. tic54x_reloc_processing(RELENT,RELOC,SYMS,ABFD,SECT)
  236. #define coff_rtype_to_howto coff_tic54x_rtype_to_howto
  237. static reloc_howto_type *
  238. coff_tic54x_rtype_to_howto (bfd *abfd,
  239. asection *sec,
  240. struct internal_reloc *rel,
  241. struct coff_link_hash_entry *h ATTRIBUTE_UNUSED,
  242. struct internal_syment *sym ATTRIBUTE_UNUSED,
  243. bfd_vma *addendp)
  244. {
  245. arelent genrel;
  246. if (rel->r_symndx == -1 && addendp != NULL)
  247. {
  248. /* This is a TI "internal relocation", which means that the relocation
  249. amount is the amount by which the current section is being relocated
  250. in the output section. */
  251. *addendp = (sec->output_section->vma + sec->output_offset) - sec->vma;
  252. }
  253. tic54x_lookup_howto (abfd, &genrel, rel);
  254. return genrel.howto;
  255. }
  256. /* Replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local
  257. labels. */
  258. static bool
  259. ticoff_bfd_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED,
  260. const char *name)
  261. {
  262. if (TICOFF_LOCAL_LABEL_P(name))
  263. return true;
  264. return false;
  265. }
  266. #define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name
  267. /* Customize coffcode.h; the default coff_ functions are set up to use COFF2;
  268. coff_bad_format_hook uses BADMAG, so set that for COFF2. The COFF1
  269. and COFF0 vectors use custom _bad_format_hook procs instead of setting
  270. BADMAG. */
  271. #define BADMAG(x) COFF2_BADMAG(x)
  272. #ifndef bfd_pe_print_pdata
  273. #define bfd_pe_print_pdata NULL
  274. #endif
  275. #include "coffcode.h"
  276. static bool
  277. tic54x_set_section_contents (bfd *abfd,
  278. sec_ptr section,
  279. const void * location,
  280. file_ptr offset,
  281. bfd_size_type bytes_to_do)
  282. {
  283. return coff_set_section_contents (abfd, section, location,
  284. offset, bytes_to_do);
  285. }
  286. static void
  287. tic54x_reloc_processing (arelent *relent,
  288. struct internal_reloc *reloc,
  289. asymbol **symbols,
  290. bfd *abfd,
  291. asection *section)
  292. {
  293. asymbol *ptr;
  294. relent->address = reloc->r_vaddr;
  295. if (reloc->r_symndx != -1)
  296. {
  297. if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd))
  298. {
  299. _bfd_error_handler
  300. /* xgettext: c-format */
  301. (_("%pB: warning: illegal symbol index %ld in relocs"),
  302. abfd, reloc->r_symndx);
  303. relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
  304. ptr = NULL;
  305. }
  306. else
  307. {
  308. relent->sym_ptr_ptr = (symbols
  309. + obj_convert (abfd)[reloc->r_symndx]);
  310. ptr = *(relent->sym_ptr_ptr);
  311. }
  312. }
  313. else
  314. {
  315. relent->sym_ptr_ptr = section->symbol_ptr_ptr;
  316. ptr = *(relent->sym_ptr_ptr);
  317. }
  318. /* The symbols definitions that we have read in have been
  319. relocated as if their sections started at 0. But the offsets
  320. refering to the symbols in the raw data have not been
  321. modified, so we have to have a negative addend to compensate.
  322. Note that symbols which used to be common must be left alone. */
  323. /* Calculate any reloc addend by looking at the symbol. */
  324. CALC_ADDEND (abfd, ptr, *reloc, relent);
  325. relent->address -= section->vma;
  326. /* !! relent->section = (asection *) NULL;*/
  327. /* Fill in the relent->howto field from reloc->r_type. */
  328. tic54x_lookup_howto (abfd, relent, reloc);
  329. }
  330. /* TI COFF v0, DOS tools (little-endian headers). */
  331. const bfd_target tic54x_coff0_vec =
  332. {
  333. "coff0-c54x", /* name */
  334. bfd_target_coff_flavour,
  335. BFD_ENDIAN_LITTLE, /* data byte order is little */
  336. BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */
  337. (HAS_RELOC | EXEC_P /* object flags */
  338. | HAS_LINENO | HAS_DEBUG
  339. | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
  340. (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
  341. '_', /* leading symbol underscore */
  342. '/', /* ar_pad_char */
  343. 15, /* ar_max_namelen */
  344. 0, /* match priority. */
  345. TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
  346. bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  347. tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
  348. bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
  349. bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  350. bfd_getl32, bfd_getl_signed_32, bfd_putl32,
  351. bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
  352. { /* bfd_check_format */
  353. _bfd_dummy_target,
  354. coff_object_p,
  355. bfd_generic_archive_p,
  356. _bfd_dummy_target
  357. },
  358. { /* bfd_set_format */
  359. _bfd_bool_bfd_false_error,
  360. coff_mkobject,
  361. _bfd_generic_mkarchive,
  362. _bfd_bool_bfd_false_error
  363. },
  364. { /* bfd_write_contents */
  365. _bfd_bool_bfd_false_error,
  366. coff_write_object_contents,
  367. _bfd_write_archive_contents,
  368. _bfd_bool_bfd_false_error
  369. },
  370. BFD_JUMP_TABLE_GENERIC (coff),
  371. BFD_JUMP_TABLE_COPY (coff),
  372. BFD_JUMP_TABLE_CORE (_bfd_nocore),
  373. BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
  374. BFD_JUMP_TABLE_SYMBOLS (coff),
  375. BFD_JUMP_TABLE_RELOCS (coff),
  376. BFD_JUMP_TABLE_WRITE (tic54x),
  377. BFD_JUMP_TABLE_LINK (coff),
  378. BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  379. NULL,
  380. &ticoff0_swap_table
  381. };
  382. /* TI COFF v0, SPARC tools (big-endian headers). */
  383. const bfd_target tic54x_coff0_beh_vec =
  384. {
  385. "coff0-beh-c54x", /* name */
  386. bfd_target_coff_flavour,
  387. BFD_ENDIAN_LITTLE, /* data byte order is little */
  388. BFD_ENDIAN_BIG, /* header byte order is big */
  389. (HAS_RELOC | EXEC_P /* object flags */
  390. | HAS_LINENO | HAS_DEBUG
  391. | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
  392. (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
  393. '_', /* leading symbol underscore */
  394. '/', /* ar_pad_char */
  395. 15, /* ar_max_namelen */
  396. 0, /* match priority. */
  397. #ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
  398. true, /* keep unused section symbols. */
  399. #else
  400. false, /* keep unused section symbols. */
  401. #endif
  402. bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  403. tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
  404. bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
  405. bfd_getb64, bfd_getb_signed_64, bfd_putb64,
  406. bfd_getb32, bfd_getb_signed_32, bfd_putb32,
  407. bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
  408. { /* bfd_check_format */
  409. _bfd_dummy_target,
  410. coff_object_p,
  411. bfd_generic_archive_p,
  412. _bfd_dummy_target
  413. },
  414. { /* bfd_set_format */
  415. _bfd_bool_bfd_false_error,
  416. coff_mkobject,
  417. _bfd_generic_mkarchive,
  418. _bfd_bool_bfd_false_error
  419. },
  420. { /* bfd_write_contents */
  421. _bfd_bool_bfd_false_error,
  422. coff_write_object_contents,
  423. _bfd_write_archive_contents,
  424. _bfd_bool_bfd_false_error
  425. },
  426. BFD_JUMP_TABLE_GENERIC (coff),
  427. BFD_JUMP_TABLE_COPY (coff),
  428. BFD_JUMP_TABLE_CORE (_bfd_nocore),
  429. BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
  430. BFD_JUMP_TABLE_SYMBOLS (coff),
  431. BFD_JUMP_TABLE_RELOCS (coff),
  432. BFD_JUMP_TABLE_WRITE (tic54x),
  433. BFD_JUMP_TABLE_LINK (coff),
  434. BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  435. &tic54x_coff0_vec,
  436. &ticoff0_swap_table
  437. };
  438. /* TI COFF v1, DOS tools (little-endian headers). */
  439. const bfd_target tic54x_coff1_vec =
  440. {
  441. "coff1-c54x", /* 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. (HAS_RELOC | EXEC_P /* object flags */
  446. | HAS_LINENO | HAS_DEBUG
  447. | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
  448. (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
  449. '_', /* leading symbol underscore */
  450. '/', /* ar_pad_char */
  451. 15, /* ar_max_namelen */
  452. 0, /* match priority. */
  453. #ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
  454. true, /* keep unused section symbols. */
  455. #else
  456. false, /* keep unused section symbols. */
  457. #endif
  458. bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  459. tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
  460. bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
  461. bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  462. bfd_getl32, bfd_getl_signed_32, bfd_putl32,
  463. bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
  464. { /* bfd_check_format */
  465. _bfd_dummy_target,
  466. coff_object_p,
  467. bfd_generic_archive_p,
  468. _bfd_dummy_target
  469. },
  470. { /* bfd_set_format */
  471. _bfd_bool_bfd_false_error,
  472. coff_mkobject,
  473. _bfd_generic_mkarchive,
  474. _bfd_bool_bfd_false_error
  475. },
  476. { /* bfd_write_contents */
  477. _bfd_bool_bfd_false_error,
  478. coff_write_object_contents,
  479. _bfd_write_archive_contents,
  480. _bfd_bool_bfd_false_error
  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. &tic54x_coff0_beh_vec,
  492. &ticoff1_swap_table
  493. };
  494. /* TI COFF v1, SPARC tools (big-endian headers). */
  495. const bfd_target tic54x_coff1_beh_vec =
  496. {
  497. "coff1-beh-c54x", /* name */
  498. bfd_target_coff_flavour,
  499. BFD_ENDIAN_LITTLE, /* data byte order is little */
  500. BFD_ENDIAN_BIG, /* header byte order is big */
  501. (HAS_RELOC | EXEC_P /* object flags */
  502. | HAS_LINENO | HAS_DEBUG
  503. | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
  504. (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
  505. '_', /* leading symbol underscore */
  506. '/', /* ar_pad_char */
  507. 15, /* ar_max_namelen */
  508. 0, /* match priority. */
  509. #ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
  510. true, /* keep unused section symbols. */
  511. #else
  512. false, /* keep unused section symbols. */
  513. #endif
  514. bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  515. tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
  516. bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
  517. bfd_getb64, bfd_getb_signed_64, bfd_putb64,
  518. bfd_getb32, bfd_getb_signed_32, bfd_putb32,
  519. bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
  520. { /* bfd_check_format */
  521. _bfd_dummy_target,
  522. coff_object_p,
  523. bfd_generic_archive_p,
  524. _bfd_dummy_target
  525. },
  526. { /* bfd_set_format */
  527. _bfd_bool_bfd_false_error,
  528. coff_mkobject,
  529. _bfd_generic_mkarchive,
  530. _bfd_bool_bfd_false_error
  531. },
  532. { /* bfd_write_contents */
  533. _bfd_bool_bfd_false_error,
  534. coff_write_object_contents,
  535. _bfd_write_archive_contents,
  536. _bfd_bool_bfd_false_error
  537. },
  538. BFD_JUMP_TABLE_GENERIC (coff),
  539. BFD_JUMP_TABLE_COPY (coff),
  540. BFD_JUMP_TABLE_CORE (_bfd_nocore),
  541. BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
  542. BFD_JUMP_TABLE_SYMBOLS (coff),
  543. BFD_JUMP_TABLE_RELOCS (coff),
  544. BFD_JUMP_TABLE_WRITE (tic54x),
  545. BFD_JUMP_TABLE_LINK (coff),
  546. BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  547. &tic54x_coff1_vec,
  548. &ticoff1_swap_table
  549. };
  550. /* TI COFF v2, TI DOS tools output (little-endian headers). */
  551. const bfd_target tic54x_coff2_vec =
  552. {
  553. "coff2-c54x", /* name */
  554. bfd_target_coff_flavour,
  555. BFD_ENDIAN_LITTLE, /* data byte order is little */
  556. BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */
  557. (HAS_RELOC | EXEC_P /* object flags */
  558. | HAS_LINENO | HAS_DEBUG
  559. | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
  560. (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
  561. '_', /* leading symbol underscore */
  562. '/', /* ar_pad_char */
  563. 15, /* ar_max_namelen */
  564. 0, /* match priority. */
  565. #ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
  566. true, /* keep unused section symbols. */
  567. #else
  568. false, /* keep unused section symbols. */
  569. #endif
  570. bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  571. tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
  572. bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
  573. bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  574. bfd_getl32, bfd_getl_signed_32, bfd_putl32,
  575. bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
  576. { /* bfd_check_format */
  577. _bfd_dummy_target,
  578. coff_object_p,
  579. bfd_generic_archive_p,
  580. _bfd_dummy_target
  581. },
  582. { /* bfd_set_format */
  583. _bfd_bool_bfd_false_error,
  584. coff_mkobject,
  585. _bfd_generic_mkarchive,
  586. _bfd_bool_bfd_false_error
  587. },
  588. { /* bfd_write_contents */
  589. _bfd_bool_bfd_false_error,
  590. coff_write_object_contents,
  591. _bfd_write_archive_contents,
  592. _bfd_bool_bfd_false_error
  593. },
  594. BFD_JUMP_TABLE_GENERIC (coff),
  595. BFD_JUMP_TABLE_COPY (coff),
  596. BFD_JUMP_TABLE_CORE (_bfd_nocore),
  597. BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
  598. BFD_JUMP_TABLE_SYMBOLS (coff),
  599. BFD_JUMP_TABLE_RELOCS (coff),
  600. BFD_JUMP_TABLE_WRITE (tic54x),
  601. BFD_JUMP_TABLE_LINK (coff),
  602. BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  603. &tic54x_coff1_beh_vec,
  604. COFF_SWAP_TABLE
  605. };
  606. /* TI COFF v2, TI SPARC tools output (big-endian headers). */
  607. const bfd_target tic54x_coff2_beh_vec =
  608. {
  609. "coff2-beh-c54x", /* name */
  610. bfd_target_coff_flavour,
  611. BFD_ENDIAN_LITTLE, /* data byte order is little */
  612. BFD_ENDIAN_BIG, /* header byte order is big */
  613. (HAS_RELOC | EXEC_P /* object flags */
  614. | HAS_LINENO | HAS_DEBUG
  615. | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
  616. (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
  617. '_', /* leading symbol underscore */
  618. '/', /* ar_pad_char */
  619. 15, /* ar_max_namelen */
  620. 0, /* match priority. */
  621. #ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
  622. true, /* keep unused section symbols. */
  623. #else
  624. false, /* keep unused section symbols. */
  625. #endif
  626. bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  627. tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
  628. bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
  629. bfd_getb64, bfd_getb_signed_64, bfd_putb64,
  630. bfd_getb32, bfd_getb_signed_32, bfd_putb32,
  631. bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
  632. { /* bfd_check_format */
  633. _bfd_dummy_target,
  634. coff_object_p,
  635. bfd_generic_archive_p,
  636. _bfd_dummy_target
  637. },
  638. { /* bfd_set_format */
  639. _bfd_bool_bfd_false_error,
  640. coff_mkobject,
  641. _bfd_generic_mkarchive,
  642. _bfd_bool_bfd_false_error
  643. },
  644. { /* bfd_write_contents */
  645. _bfd_bool_bfd_false_error,
  646. coff_write_object_contents,
  647. _bfd_write_archive_contents,
  648. _bfd_bool_bfd_false_error
  649. },
  650. BFD_JUMP_TABLE_GENERIC (coff),
  651. BFD_JUMP_TABLE_COPY (coff),
  652. BFD_JUMP_TABLE_CORE (_bfd_nocore),
  653. BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
  654. BFD_JUMP_TABLE_SYMBOLS (coff),
  655. BFD_JUMP_TABLE_RELOCS (coff),
  656. BFD_JUMP_TABLE_WRITE (tic54x),
  657. BFD_JUMP_TABLE_LINK (coff),
  658. BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  659. &tic54x_coff2_vec,
  660. COFF_SWAP_TABLE
  661. };