elf32-epiphany.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. /* Adapteva epiphany specific support for 32-bit ELF
  2. Copyright (C) 2000-2022 Free Software Foundation, Inc.
  3. Contributed by Embecosm on behalf of Adapteva, Inc.
  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,
  16. MA 02110-1301, USA. */
  17. #include "sysdep.h"
  18. #include "bfd.h"
  19. #include "libbfd.h"
  20. #include "elf-bfd.h"
  21. #include "elf/epiphany.h"
  22. #include "libiberty.h"
  23. /* Struct used to pass miscellaneous paramaters which
  24. helps to avoid overly long parameter lists. */
  25. struct misc
  26. {
  27. Elf_Internal_Shdr * symtab_hdr;
  28. Elf_Internal_Rela * irelbase;
  29. bfd_byte * contents;
  30. Elf_Internal_Sym * isymbuf;
  31. };
  32. struct epiphany_opcode
  33. {
  34. unsigned short opcode;
  35. unsigned short mask;
  36. };
  37. static bool epiphany_relaxed = false;
  38. /* Relocation tables. */
  39. static reloc_howto_type epiphany_elf_howto_table [] =
  40. {
  41. #define AHOW(t,rs,s,bs,pr,bp,co,name,sm,dm) \
  42. HOWTO(t, /* type */ \
  43. rs, /* rightshift */ \
  44. s, /* size (0 = byte, 1 = short, 2 = long) */ \
  45. bs, /* bitsize */ \
  46. pr, /* pc_relative */ \
  47. bp, /* bitpos */ \
  48. co, /* complain_on_overflow */ \
  49. bfd_elf_generic_reloc,/* special_function */ \
  50. name, /* name */ \
  51. false, /* partial_inplace */ \
  52. sm, /* src_mask */ \
  53. dm, /* dst_mask */ \
  54. pr) /* pcrel_offset */
  55. /* This reloc does nothing. */
  56. AHOW (R_EPIPHANY_NONE, 0, 3,0, false, 0, complain_overflow_dont, "R_EPIPHANY_NONE", 0, 0),
  57. /* 8 bit absolute (not likely) */
  58. AHOW (R_EPIPHANY_8, 0, 0, 8, false, 0, complain_overflow_bitfield, "R_EPIPHANY_8", 0x000000ff, 0x000000ff),
  59. /* 16 bit absolute */
  60. AHOW (R_EPIPHANY_16, 0, 1,16, false, 0, complain_overflow_bitfield, "R_EPIPHANY_16", 0x0000ffff, 0x00ff1fe0),
  61. /* A 32 bit absolute relocation. */
  62. AHOW (R_EPIPHANY_32, 0, 2,32, false, 0, complain_overflow_dont, "R_EPIPHANY_32", 0xffffffff, 0xffffffff),
  63. /* 8 bit relative relocation */
  64. HOWTO ( R_EPIPHANY_8_PCREL, 0, 0, 8, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_EPIPHANY_8_PCREL", false, 0x000000ff, 0x000000ff, false),
  65. /* 16 bit relative relocation */
  66. HOWTO ( R_EPIPHANY_16_PCREL, 0, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_EPIPHANY_8_PCREL", false, 0x000000ff, 0x000000ff, false),
  67. /* 32 bit relative relocation */
  68. HOWTO ( R_EPIPHANY_32_PCREL, 0, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_EPIPHANY_8_PCREL", false, 0x000000ff, 0x000000ff, false),
  69. /* 8 bit pc-relative relocation */
  70. AHOW (R_EPIPHANY_SIMM8, 1, 0, 8, true, 8, complain_overflow_signed, "R_EPIPHANY_SIMM8", 0x000000ff, 0x0000ff00),
  71. /* 24 bit pc-relative relocation */
  72. AHOW (R_EPIPHANY_SIMM24, 1, 2,24, true, 8, complain_overflow_signed, "R_EPIPHANY_SIMM24", 0x00ffffff, 0xffffff00),
  73. /* %HIGH(EA) */
  74. AHOW (R_EPIPHANY_HIGH, 0, 2,16, false, 0, complain_overflow_dont, "R_EPIPHANY_HIGH", 0x0ff01fe0, 0x0ff01fe0),
  75. /* %LOW(EA) */
  76. AHOW (R_EPIPHANY_LOW, 0, 2,16, false, 0, complain_overflow_dont, "R_EPIPHANY_LOW", 0x0ff01fe0, 0x0ff01fe0),
  77. /* simm11 */
  78. AHOW (R_EPIPHANY_SIMM11, 0, 2,11, false, 0, complain_overflow_bitfield, "R_EPIPHANY_SIMM11", 0x00ff0380, 0x00ff0380),
  79. /* imm12 - sign-magnitude */
  80. AHOW (R_EPIPHANY_IMM11, 0, 2,11, false, 0, complain_overflow_bitfield, "R_EPIPHANY_IMM12", 0x00ff0380, 0x00ff0380),
  81. /* imm8 */
  82. AHOW (R_EPIPHANY_IMM8, 0, 1, 8, false, 8, complain_overflow_signed, "R_EPIPHANY_IMM8", 0x0000ff00, 0x0000ff00)
  83. };
  84. #undef AHOW
  85. /* Map BFD reloc types to EPIPHANY ELF reloc types. */
  86. static reloc_howto_type *
  87. epiphany_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
  88. bfd_reloc_code_real_type code)
  89. {
  90. /* Note that the epiphany_elf_howto_table is indxed by the R_
  91. constants. Thus, the order that the howto records appear in the
  92. table *must* match the order of the relocation types defined in
  93. include/elf/epiphany.h. */
  94. switch (code)
  95. {
  96. case BFD_RELOC_NONE:
  97. return &epiphany_elf_howto_table[ (int) R_EPIPHANY_NONE];
  98. case BFD_RELOC_EPIPHANY_SIMM8:
  99. return &epiphany_elf_howto_table[ (int) R_EPIPHANY_SIMM8];
  100. case BFD_RELOC_EPIPHANY_SIMM24:
  101. return &epiphany_elf_howto_table[ (int) R_EPIPHANY_SIMM24];
  102. case BFD_RELOC_8_PCREL:
  103. return &epiphany_elf_howto_table[ (int) R_EPIPHANY_8_PCREL];
  104. case BFD_RELOC_16_PCREL:
  105. return &epiphany_elf_howto_table[ (int) R_EPIPHANY_16_PCREL];
  106. case BFD_RELOC_32_PCREL:
  107. return &epiphany_elf_howto_table[ (int) R_EPIPHANY_32_PCREL];
  108. case BFD_RELOC_8:
  109. return &epiphany_elf_howto_table[ (int) R_EPIPHANY_8];
  110. case BFD_RELOC_16:
  111. return &epiphany_elf_howto_table[ (int) R_EPIPHANY_16];
  112. case BFD_RELOC_32:
  113. return &epiphany_elf_howto_table[ (int) R_EPIPHANY_32];
  114. case BFD_RELOC_EPIPHANY_HIGH:
  115. return & epiphany_elf_howto_table[ (int) R_EPIPHANY_HIGH];
  116. case BFD_RELOC_EPIPHANY_LOW:
  117. return & epiphany_elf_howto_table[ (int) R_EPIPHANY_LOW];
  118. case BFD_RELOC_EPIPHANY_SIMM11:
  119. return & epiphany_elf_howto_table[ (int) R_EPIPHANY_SIMM11];
  120. case BFD_RELOC_EPIPHANY_IMM11:
  121. return & epiphany_elf_howto_table[ (int) R_EPIPHANY_IMM11];
  122. case BFD_RELOC_EPIPHANY_IMM8:
  123. return & epiphany_elf_howto_table[ (int) R_EPIPHANY_IMM8];
  124. default:
  125. /* Pacify gcc -Wall. */
  126. return NULL;
  127. }
  128. return NULL;
  129. }
  130. static reloc_howto_type *
  131. epiphany_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
  132. {
  133. unsigned int i;
  134. for (i = 0; i < ARRAY_SIZE (epiphany_elf_howto_table); i++)
  135. if (epiphany_elf_howto_table[i].name != NULL
  136. && strcasecmp (epiphany_elf_howto_table[i].name, r_name) == 0)
  137. return &epiphany_elf_howto_table[i];
  138. return NULL;
  139. }
  140. #define PAGENO(ABSADDR) ((ABSADDR) & 0xFFFFC000)
  141. #define BASEADDR(SEC) ((SEC)->output_section->vma + (SEC)->output_offset)
  142. /* This function handles relaxing for the epiphany.
  143. Dummy placeholder for future optimizations. */
  144. static bool
  145. epiphany_elf_relax_section (bfd *abfd, asection *sec,
  146. struct bfd_link_info *link_info,
  147. bool *again)
  148. {
  149. Elf_Internal_Shdr *symtab_hdr;
  150. Elf_Internal_Rela *internal_relocs;
  151. bfd_byte *contents = NULL;
  152. Elf_Internal_Sym *isymbuf = NULL;
  153. static asection * first_section = NULL;
  154. static unsigned long search_addr;
  155. static unsigned long page_start = 0;
  156. static unsigned long page_end = 0;
  157. static unsigned int pass = 0;
  158. static bool new_pass = false;
  159. static bool changed = false;
  160. struct misc misc ATTRIBUTE_UNUSED;
  161. asection *stab;
  162. /* Assume nothing changes. */
  163. *again = false;
  164. if (first_section == NULL)
  165. {
  166. epiphany_relaxed = true;
  167. first_section = sec;
  168. }
  169. if (first_section == sec)
  170. {
  171. pass++;
  172. new_pass = true;
  173. }
  174. /* We don't have to do anything for a relocatable link,
  175. if this section does not have relocs, or if this is
  176. not a code section. */
  177. if (bfd_link_relocatable (link_info)
  178. || (sec->flags & SEC_RELOC) == 0
  179. || sec->reloc_count == 0
  180. || (sec->flags & SEC_CODE) == 0)
  181. return true;
  182. symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
  183. internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL,
  184. link_info->keep_memory);
  185. if (internal_relocs == NULL)
  186. goto error_return;
  187. /* Make sure the stac.rela stuff gets read in. */
  188. stab = bfd_get_section_by_name (abfd, ".stab");
  189. if (stab)
  190. {
  191. /* So stab does exits. */
  192. Elf_Internal_Rela * irelbase ATTRIBUTE_UNUSED;
  193. irelbase = _bfd_elf_link_read_relocs (abfd, stab, NULL, NULL,
  194. link_info->keep_memory);
  195. }
  196. /* Get section contents cached copy if it exists. */
  197. if (contents == NULL)
  198. {
  199. /* Get cached copy if it exists. */
  200. if (elf_section_data (sec)->this_hdr.contents != NULL)
  201. contents = elf_section_data (sec)->this_hdr.contents;
  202. else
  203. {
  204. /* Go get them off disk. */
  205. if (!bfd_malloc_and_get_section (abfd, sec, &contents))
  206. goto error_return;
  207. }
  208. }
  209. /* Read this BFD's symbols cached copy if it exists. */
  210. if (isymbuf == NULL && symtab_hdr->sh_info != 0)
  211. {
  212. isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
  213. if (isymbuf == NULL)
  214. isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
  215. symtab_hdr->sh_info, 0,
  216. NULL, NULL, NULL);
  217. if (isymbuf == NULL)
  218. goto error_return;
  219. }
  220. misc.symtab_hdr = symtab_hdr;
  221. misc.isymbuf = isymbuf;
  222. misc.irelbase = internal_relocs;
  223. misc.contents = contents;
  224. /* This is where all the relaxation actually get done. */
  225. if ((pass == 1) || (new_pass && !changed))
  226. {
  227. /* On the first pass we simply search for the lowest page that
  228. we havn't relaxed yet. Note that the pass count is reset
  229. each time a page is complete in order to move on to the next page.
  230. If we can't find any more pages then we are finished. */
  231. if (new_pass)
  232. {
  233. pass = 1;
  234. new_pass = false;
  235. changed = true; /* Pre-initialize to break out of pass 1. */
  236. search_addr = 0xFFFFFFFF;
  237. }
  238. if ((BASEADDR (sec) + sec->size < search_addr)
  239. && (BASEADDR (sec) + sec->size > page_end))
  240. {
  241. if (BASEADDR (sec) <= page_end)
  242. search_addr = page_end + 1;
  243. else
  244. search_addr = BASEADDR (sec);
  245. /* Found a page => more work to do. */
  246. *again = true;
  247. }
  248. }
  249. else
  250. {
  251. if (new_pass)
  252. {
  253. new_pass = false;
  254. changed = false;
  255. page_start = PAGENO (search_addr);
  256. page_end = page_start | 0x00003FFF;
  257. }
  258. /* Only process sections in range. */
  259. if ((BASEADDR (sec) + sec->size >= page_start)
  260. && (BASEADDR (sec) <= page_end))
  261. {
  262. #if 0
  263. if (!epiphany_elf_relax_section_page (abfd, sec, &changed, &misc,
  264. page_start, page_end))
  265. #endif
  266. return false;
  267. }
  268. *again = true;
  269. }
  270. /* Perform some house keeping after relaxing the section. */
  271. if (isymbuf != NULL
  272. && symtab_hdr->contents != (unsigned char *) isymbuf)
  273. {
  274. if (! link_info->keep_memory)
  275. free (isymbuf);
  276. else
  277. symtab_hdr->contents = (unsigned char *) isymbuf;
  278. }
  279. if (contents != NULL
  280. && elf_section_data (sec)->this_hdr.contents != contents)
  281. {
  282. if (! link_info->keep_memory)
  283. free (contents);
  284. else
  285. {
  286. /* Cache the section contents for elf_link_input_bfd. */
  287. elf_section_data (sec)->this_hdr.contents = contents;
  288. }
  289. }
  290. if (elf_section_data (sec)->relocs != internal_relocs)
  291. free (internal_relocs);
  292. return true;
  293. error_return:
  294. if (symtab_hdr->contents != (unsigned char *) isymbuf)
  295. free (isymbuf);
  296. if (elf_section_data (sec)->this_hdr.contents != contents)
  297. free (contents);
  298. if (elf_section_data (sec)->relocs != internal_relocs)
  299. free (internal_relocs);
  300. return false;
  301. }
  302. /* Set the howto pointer for a EPIPHANY ELF reloc. */
  303. static bool
  304. epiphany_info_to_howto_rela (bfd * abfd,
  305. arelent * cache_ptr,
  306. Elf_Internal_Rela * dst)
  307. {
  308. unsigned int r_type;
  309. r_type = ELF32_R_TYPE (dst->r_info);
  310. if (r_type >= (unsigned int) R_EPIPHANY_max)
  311. {
  312. /* xgettext:c-format */
  313. _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
  314. abfd, r_type);
  315. bfd_set_error (bfd_error_bad_value);
  316. return false;
  317. }
  318. cache_ptr->howto = & epiphany_elf_howto_table [r_type];
  319. return true;
  320. }
  321. /* Perform a single relocation.
  322. By default we use the standard BFD routines. */
  323. static bfd_reloc_status_type
  324. epiphany_final_link_relocate (reloc_howto_type * howto,
  325. bfd * input_bfd,
  326. asection * input_section,
  327. bfd_byte * contents,
  328. Elf_Internal_Rela * rel,
  329. bfd_vma relocation)
  330. {
  331. switch (howto->type)
  332. {
  333. /* Handle 16 bit immediates. */
  334. case R_EPIPHANY_HIGH:
  335. relocation += rel->r_addend;
  336. relocation >>= 16;
  337. goto common;
  338. case R_EPIPHANY_LOW:
  339. relocation += rel->r_addend;
  340. common:
  341. relocation = ((relocation & 0xff00L) << 12)
  342. | ((relocation & 0x00ffL) << 5);
  343. /* Sanity check the address. */
  344. if (rel->r_offset > bfd_get_section_limit (input_bfd, input_section))
  345. return bfd_reloc_outofrange;
  346. return _bfd_relocate_contents (howto, input_bfd, relocation,
  347. contents + rel->r_offset);
  348. case R_EPIPHANY_SIMM11:
  349. relocation += rel->r_addend;
  350. /* Check signed overflow. */
  351. if ((int)relocation > 1023 || (int)relocation < -1024)
  352. return bfd_reloc_outofrange;
  353. goto disp11;
  354. case R_EPIPHANY_IMM11:
  355. relocation += rel->r_addend;
  356. if ((unsigned int) relocation > 0x7ff)
  357. return bfd_reloc_outofrange;
  358. /* Fall through. */
  359. disp11:
  360. relocation = (((relocation & 7) << 5)
  361. | ((relocation & 0x7f8 ) << 13));
  362. return _bfd_relocate_contents (howto, input_bfd, relocation,
  363. contents + rel->r_offset);
  364. /* Pass others through. */
  365. default:
  366. break;
  367. }
  368. /* Only install relocation if above tests did not disqualify it. */
  369. return _bfd_final_link_relocate (howto, input_bfd, input_section,
  370. contents, rel->r_offset,
  371. relocation, rel->r_addend);
  372. }
  373. /* Relocate an EPIPHANY ELF section.
  374. The RELOCATE_SECTION function is called by the new ELF backend linker
  375. to handle the relocations for a section.
  376. The relocs are always passed as Rela structures; if the section
  377. actually uses Rel structures, the r_addend field will always be
  378. zero.
  379. This function is responsible for adjusting the section contents as
  380. necessary, and (if using Rela relocs and generating a relocatable
  381. output file) adjusting the reloc addend as necessary.
  382. This function does not have to worry about setting the reloc
  383. address or the reloc symbol index.
  384. LOCAL_SYMS is a pointer to the swapped in local symbols.
  385. LOCAL_SECTIONS is an array giving the section in the input file
  386. corresponding to the st_shndx field of each local symbol.
  387. The global hash table entry for the global symbols can be found
  388. via elf_sym_hashes (input_bfd).
  389. When generating relocatable output, this function must handle
  390. STB_LOCAL/STT_SECTION symbols specially. The output symbol is
  391. going to be the section symbol corresponding to the output
  392. section, which means that the addend must be adjusted
  393. accordingly. */
  394. static int
  395. epiphany_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
  396. struct bfd_link_info *info,
  397. bfd *input_bfd,
  398. asection *input_section,
  399. bfd_byte *contents,
  400. Elf_Internal_Rela *relocs,
  401. Elf_Internal_Sym *local_syms,
  402. asection **local_sections)
  403. {
  404. Elf_Internal_Shdr *symtab_hdr;
  405. struct elf_link_hash_entry **sym_hashes;
  406. Elf_Internal_Rela *rel;
  407. Elf_Internal_Rela *relend;
  408. symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
  409. sym_hashes = elf_sym_hashes (input_bfd);
  410. relend = relocs + input_section->reloc_count;
  411. for (rel = relocs; rel < relend; rel ++)
  412. {
  413. reloc_howto_type * howto;
  414. unsigned long r_symndx;
  415. Elf_Internal_Sym * sym;
  416. asection * sec;
  417. struct elf_link_hash_entry * h;
  418. bfd_vma relocation;
  419. bfd_reloc_status_type r;
  420. const char * name = NULL;
  421. int r_type ATTRIBUTE_UNUSED;
  422. r_type = ELF32_R_TYPE (rel->r_info);
  423. r_symndx = ELF32_R_SYM (rel->r_info);
  424. howto = epiphany_elf_howto_table + ELF32_R_TYPE (rel->r_info);
  425. h = NULL;
  426. sym = NULL;
  427. sec = NULL;
  428. if (r_symndx < symtab_hdr->sh_info)
  429. {
  430. sym = local_syms + r_symndx;
  431. sec = local_sections [r_symndx];
  432. relocation = BASEADDR (sec) + sym->st_value;
  433. name = bfd_elf_string_from_elf_section
  434. (input_bfd, symtab_hdr->sh_link, sym->st_name);
  435. name = name == NULL ? bfd_section_name (sec) : name;
  436. }
  437. else
  438. {
  439. bool warned ATTRIBUTE_UNUSED;
  440. bool unresolved_reloc ATTRIBUTE_UNUSED;
  441. bool ignored ATTRIBUTE_UNUSED;
  442. RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
  443. r_symndx, symtab_hdr, sym_hashes,
  444. h, sec, relocation,
  445. unresolved_reloc, warned, ignored);
  446. name = h->root.root.string;
  447. }
  448. if (sec != NULL && discarded_section (sec))
  449. RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
  450. rel, 1, relend, howto, 0, contents);
  451. if (bfd_link_relocatable (info))
  452. continue;
  453. /* Finally, the sole EPIPHANY-specific part. */
  454. r = epiphany_final_link_relocate (howto, input_bfd, input_section,
  455. contents, rel, relocation);
  456. if (r != bfd_reloc_ok)
  457. {
  458. const char * msg = NULL;
  459. switch (r)
  460. {
  461. case bfd_reloc_overflow:
  462. (*info->callbacks->reloc_overflow)
  463. (info, (h ? &h->root : NULL), name, howto->name,
  464. (bfd_vma) 0, input_bfd, input_section, rel->r_offset);
  465. break;
  466. case bfd_reloc_undefined:
  467. (*info->callbacks->undefined_symbol)
  468. (info, name, input_bfd, input_section, rel->r_offset, true);
  469. break;
  470. case bfd_reloc_outofrange:
  471. msg = _("internal error: out of range error");
  472. break;
  473. /* This is how epiphany_final_link_relocate tells us of a
  474. non-kosher reference between insn & data address spaces. */
  475. case bfd_reloc_notsupported:
  476. if (sym != NULL) /* Only if it's not an unresolved symbol. */
  477. msg = _("unsupported relocation between data/insn address spaces");
  478. break;
  479. case bfd_reloc_dangerous:
  480. msg = _("internal error: dangerous relocation");
  481. break;
  482. default:
  483. msg = _("internal error: unknown error");
  484. break;
  485. }
  486. if (msg)
  487. (*info->callbacks->warning) (info, msg, name, input_bfd,
  488. input_section, rel->r_offset);
  489. }
  490. }
  491. return true;
  492. }
  493. /* We only have a little-endian target. */
  494. #define TARGET_LITTLE_SYM epiphany_elf32_vec
  495. #define TARGET_LITTLE_NAME "elf32-epiphany"
  496. #define ELF_ARCH bfd_arch_epiphany
  497. #define ELF_MACHINE_CODE EM_ADAPTEVA_EPIPHANY
  498. #define ELF_MAXPAGESIZE 0x8000 /* No pages on the EPIPHANY. */
  499. #define elf_info_to_howto_rel NULL
  500. #define elf_info_to_howto epiphany_info_to_howto_rela
  501. #define elf_backend_can_gc_sections 1
  502. #define elf_backend_rela_normal 1
  503. #define elf_backend_relocate_section epiphany_elf_relocate_section
  504. #define elf_symbol_leading_char '_'
  505. #define bfd_elf32_bfd_reloc_type_lookup epiphany_reloc_type_lookup
  506. #define bfd_elf32_bfd_reloc_name_lookup epiphany_reloc_name_lookup
  507. #define bfd_elf32_bfd_relax_section epiphany_elf_relax_section
  508. #include "elf32-target.h"