elf32-dlx.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. /* DLX specific support for 32-bit ELF
  2. Copyright (C) 2002-2015 Free Software Foundation, Inc.
  3. This file is part of BFD, the Binary File Descriptor library.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  15. MA 02110-1301, USA. */
  16. #include "sysdep.h"
  17. #include "bfd.h"
  18. #include "libbfd.h"
  19. #include "elf-bfd.h"
  20. #include "elf/dlx.h"
  21. #define USE_REL 1
  22. #define bfd_elf32_bfd_reloc_type_lookup elf32_dlx_reloc_type_lookup
  23. #define bfd_elf32_bfd_reloc_name_lookup elf32_dlx_reloc_name_lookup
  24. #define elf_info_to_howto elf32_dlx_info_to_howto
  25. #define elf_info_to_howto_rel elf32_dlx_info_to_howto_rel
  26. #define elf_backend_check_relocs elf32_dlx_check_relocs
  27. /* The gas default behavior is not to preform the %hi modifier so that the
  28. GNU assembler can have the lower 16 bits offset placed in the insn, BUT
  29. we do like the gas to indicate it is %hi reloc type so when we in the link
  30. loader phase we can have the corrected hi16 vale replace the buggous lo16
  31. value that was placed there by gas. */
  32. static int skip_dlx_elf_hi16_reloc = 0;
  33. extern int set_dlx_skip_hi16_flag (int);
  34. int
  35. set_dlx_skip_hi16_flag (int flag)
  36. {
  37. skip_dlx_elf_hi16_reloc = flag;
  38. return flag;
  39. }
  40. static bfd_reloc_status_type
  41. _bfd_dlx_elf_hi16_reloc (bfd *abfd,
  42. arelent *reloc_entry,
  43. asymbol *symbol,
  44. void * data,
  45. asection *input_section,
  46. bfd *output_bfd,
  47. char **error_message)
  48. {
  49. bfd_reloc_status_type ret;
  50. bfd_vma relocation;
  51. /* If the skip flag is set then we simply do the generic relocating, this
  52. is more of a hack for dlx gas/gld, so we do not need to do the %hi/%lo
  53. fixup like mips gld did. */
  54. if (skip_dlx_elf_hi16_reloc)
  55. return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
  56. input_section, output_bfd, error_message);
  57. /* If we're relocating, and this an external symbol, we don't want
  58. to change anything. */
  59. if (output_bfd != (bfd *) NULL
  60. && (symbol->flags & BSF_SECTION_SYM) == 0
  61. && reloc_entry->addend == 0)
  62. {
  63. reloc_entry->address += input_section->output_offset;
  64. return bfd_reloc_ok;
  65. }
  66. ret = bfd_reloc_ok;
  67. if (bfd_is_und_section (symbol->section)
  68. && output_bfd == (bfd *) NULL)
  69. ret = bfd_reloc_undefined;
  70. relocation = (bfd_is_com_section (symbol->section)) ? 0 : symbol->value;
  71. relocation += symbol->section->output_section->vma;
  72. relocation += symbol->section->output_offset;
  73. relocation += reloc_entry->addend;
  74. relocation += bfd_get_16 (abfd, (bfd_byte *)data + reloc_entry->address);
  75. if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
  76. return bfd_reloc_outofrange;
  77. bfd_put_16 (abfd, (short)((relocation >> 16) & 0xFFFF),
  78. (bfd_byte *)data + reloc_entry->address);
  79. return ret;
  80. }
  81. /* ELF relocs are against symbols. If we are producing relocatable
  82. output, and the reloc is against an external symbol, and nothing
  83. has given us any additional addend, the resulting reloc will also
  84. be against the same symbol. In such a case, we don't want to
  85. change anything about the way the reloc is handled, since it will
  86. all be done at final link time. Rather than put special case code
  87. into bfd_perform_relocation, all the reloc types use this howto
  88. function. It just short circuits the reloc if producing
  89. relocatable output against an external symbol. */
  90. static bfd_reloc_status_type
  91. elf32_dlx_relocate16 (bfd *abfd,
  92. arelent *reloc_entry,
  93. asymbol *symbol,
  94. void * data,
  95. asection *input_section,
  96. bfd *output_bfd,
  97. char **error_message ATTRIBUTE_UNUSED)
  98. {
  99. unsigned long insn, vallo, allignment;
  100. int val;
  101. /* HACK: I think this first condition is necessary when producing
  102. relocatable output. After the end of HACK, the code is identical
  103. to bfd_elf_generic_reloc(). I would _guess_ the first change
  104. belongs there rather than here. martindo 1998-10-23. */
  105. if (skip_dlx_elf_hi16_reloc)
  106. return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
  107. input_section, output_bfd, error_message);
  108. /* Check undefined section and undefined symbols. */
  109. if (bfd_is_und_section (symbol->section)
  110. && output_bfd == (bfd *) NULL)
  111. return bfd_reloc_undefined;
  112. /* Can not support a long jump to sections other then .text. */
  113. if (strcmp (input_section->name, symbol->section->output_section->name) != 0)
  114. {
  115. (*_bfd_error_handler) (_("BFD Link Error: branch (PC rel16) to section (%s) not supported"),
  116. symbol->section->output_section->name);
  117. return bfd_reloc_undefined;
  118. }
  119. insn = bfd_get_32 (abfd, (bfd_byte *)data + reloc_entry->address);
  120. allignment = 1 << (input_section->output_section->alignment_power - 1);
  121. vallo = insn & 0x0000FFFF;
  122. if (vallo & 0x8000)
  123. vallo = ~(vallo | 0xFFFF0000) + 1;
  124. /* vallo points to the vma of next instruction. */
  125. vallo += (((unsigned long)(input_section->output_section->vma +
  126. input_section->output_offset) +
  127. allignment) & ~allignment);
  128. /* val is the displacement (PC relative to next instruction). */
  129. val = (symbol->section->output_offset +
  130. symbol->section->output_section->vma +
  131. symbol->value) - vallo;
  132. if (abs ((int) val) > 0x00007FFF)
  133. return bfd_reloc_outofrange;
  134. insn = (insn & 0xFFFF0000) | (val & 0x0000FFFF);
  135. bfd_put_32 (abfd, insn,
  136. (bfd_byte *) data + reloc_entry->address);
  137. return bfd_reloc_ok;
  138. }
  139. static bfd_reloc_status_type
  140. elf32_dlx_relocate26 (bfd *abfd,
  141. arelent *reloc_entry,
  142. asymbol *symbol,
  143. void * data,
  144. asection *input_section,
  145. bfd *output_bfd,
  146. char **error_message ATTRIBUTE_UNUSED)
  147. {
  148. unsigned long insn, vallo, allignment;
  149. int val;
  150. /* HACK: I think this first condition is necessary when producing
  151. relocatable output. After the end of HACK, the code is identical
  152. to bfd_elf_generic_reloc(). I would _guess_ the first change
  153. belongs there rather than here. martindo 1998-10-23. */
  154. if (skip_dlx_elf_hi16_reloc)
  155. return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
  156. input_section, output_bfd, error_message);
  157. /* Check undefined section and undefined symbols. */
  158. if (bfd_is_und_section (symbol->section)
  159. && output_bfd == (bfd *) NULL)
  160. return bfd_reloc_undefined;
  161. /* Can not support a long jump to sections other then .text */
  162. if (strcmp (input_section->name, symbol->section->output_section->name) != 0)
  163. {
  164. (*_bfd_error_handler) (_("BFD Link Error: jump (PC rel26) to section (%s) not supported"),
  165. symbol->section->output_section->name);
  166. return bfd_reloc_undefined;
  167. }
  168. insn = bfd_get_32 (abfd, (bfd_byte *)data + reloc_entry->address);
  169. allignment = 1 << (input_section->output_section->alignment_power - 1);
  170. vallo = insn & 0x03FFFFFF;
  171. if (vallo & 0x03000000)
  172. vallo = ~(vallo | 0xFC000000) + 1;
  173. /* vallo is the vma for the next instruction. */
  174. vallo += (((unsigned long) (input_section->output_section->vma +
  175. input_section->output_offset) +
  176. allignment) & ~allignment);
  177. /* val is the displacement (PC relative to next instruction). */
  178. val = (symbol->section->output_offset +
  179. symbol->section->output_section->vma + symbol->value)
  180. - vallo;
  181. if (abs ((int) val) > 0x01FFFFFF)
  182. return bfd_reloc_outofrange;
  183. insn = (insn & 0xFC000000) | (val & 0x03FFFFFF);
  184. bfd_put_32 (abfd, insn,
  185. (bfd_byte *) data + reloc_entry->address);
  186. return bfd_reloc_ok;
  187. }
  188. static reloc_howto_type dlx_elf_howto_table[]=
  189. {
  190. /* No relocation. */
  191. HOWTO (R_DLX_NONE, /* Type. */
  192. 0, /* Rightshift. */
  193. 3, /* size (0 = byte, 1 = short, 2 = long). */
  194. 0, /* Bitsize. */
  195. FALSE, /* PC_relative. */
  196. 0, /* Bitpos. */
  197. complain_overflow_dont,/* Complain_on_overflow. */
  198. bfd_elf_generic_reloc, /* Special_function. */
  199. "R_DLX_NONE", /* Name. */
  200. FALSE, /* Partial_inplace. */
  201. 0, /* Src_mask. */
  202. 0, /* Dst_mask. */
  203. FALSE), /* PCrel_offset. */
  204. /* 8 bit relocation. */
  205. HOWTO (R_DLX_RELOC_8, /* Type. */
  206. 0, /* Rightshift. */
  207. 0, /* Size (0 = byte, 1 = short, 2 = long). */
  208. 8, /* Bitsize. */
  209. FALSE, /* PC_relative. */
  210. 0, /* Bitpos. */
  211. complain_overflow_dont,/* Complain_on_overflow. */
  212. bfd_elf_generic_reloc, /* Special_function. */
  213. "R_DLX_RELOC_8", /* Name. */
  214. TRUE, /* Partial_inplace. */
  215. 0xff, /* Src_mask. */
  216. 0xff, /* Dst_mask. */
  217. FALSE), /* PCrel_offset. */
  218. /* 16 bit relocation. */
  219. HOWTO (R_DLX_RELOC_16, /* Type. */
  220. 0, /* Rightshift. */
  221. 1, /* Size (0 = byte, 1 = short, 2 = long). */
  222. 16, /* Bitsize. */
  223. FALSE, /* PC_relative. */
  224. 0, /* Bitpos. */
  225. complain_overflow_dont,/* Complain_on_overflow. */
  226. bfd_elf_generic_reloc, /* Special_function. */
  227. "R_DLX_RELOC_16", /* Name. */
  228. TRUE, /* Partial_inplace. */
  229. 0xffff, /* Src_mask. */
  230. 0xffff, /* Dst_mask. */
  231. FALSE), /* PCrel_offset. */
  232. /* 32 bit relocation. */
  233. HOWTO (R_DLX_RELOC_32, /* Type. */
  234. 0, /* Rightshift. */
  235. 2, /* Size (0 = byte, 1 = short, 2 = long). */
  236. 32, /* Bitsize. */
  237. FALSE, /* PC_relative. */
  238. 0, /* Bitpos. */
  239. complain_overflow_dont,/* Complain_on_overflow. */
  240. bfd_elf_generic_reloc, /* Special_function. */
  241. "R_DLX_RELOC_32", /* Name. */
  242. TRUE, /* Partial_inplace. */
  243. 0xffffffff, /* Src_mask. */
  244. 0xffffffff, /* Dst_mask. */
  245. FALSE), /* PCrel_offset. */
  246. /* GNU extension to record C++ vtable hierarchy. */
  247. HOWTO (R_DLX_GNU_VTINHERIT, /* Type. */
  248. 0, /* Rightshift. */
  249. 2, /* Size (0 = byte, 1 = short, 2 = long). */
  250. 0, /* Bitsize. */
  251. FALSE, /* PC_relative. */
  252. 0, /* Bitpos. */
  253. complain_overflow_dont,/* Complain_on_overflow. */
  254. NULL, /* Special_function. */
  255. "R_DLX_GNU_VTINHERIT", /* Name. */
  256. FALSE, /* Partial_inplace. */
  257. 0, /* Src_mask. */
  258. 0, /* Dst_mask. */
  259. FALSE), /* PCrel_offset. */
  260. /* GNU extension to record C++ vtable member usage. */
  261. HOWTO (R_DLX_GNU_VTENTRY, /* Type. */
  262. 0, /* Rightshift. */
  263. 2, /* Size (0 = byte, 1 = short, 2 = long). */
  264. 0, /* Bitsize. */
  265. FALSE, /* PC_relative. */
  266. 0, /* Bitpos. */
  267. complain_overflow_dont,/* Complain_on_overflow. */
  268. _bfd_elf_rel_vtable_reloc_fn,/* Special_function. */
  269. "R_DLX_GNU_VTENTRY", /* Name. */
  270. FALSE, /* Partial_inplace. */
  271. 0, /* Src_mask. */
  272. 0, /* Dst_mask. */
  273. FALSE) /* PCrel_offset. */
  274. };
  275. /* 16 bit offset for pc-relative branches. */
  276. static reloc_howto_type elf_dlx_gnu_rel16_s2 =
  277. HOWTO (R_DLX_RELOC_16_PCREL, /* Type. */
  278. 0, /* Rightshift. */
  279. 1, /* Size (0 = byte, 1 = short, 2 = long). */
  280. 16, /* Bitsize. */
  281. TRUE, /* PC_relative. */
  282. 0, /* Bitpos. */
  283. complain_overflow_signed, /* Complain_on_overflow. */
  284. elf32_dlx_relocate16, /* Special_function. */
  285. "R_DLX_RELOC_16_PCREL",/* Name. */
  286. TRUE, /* Partial_inplace. */
  287. 0xffff, /* Src_mask. */
  288. 0xffff, /* Dst_mask. */
  289. TRUE); /* PCrel_offset. */
  290. /* 26 bit offset for pc-relative branches. */
  291. static reloc_howto_type elf_dlx_gnu_rel26_s2 =
  292. HOWTO (R_DLX_RELOC_26_PCREL, /* Type. */
  293. 0, /* Rightshift. */
  294. 2, /* Size (0 = byte, 1 = short, 2 = long). */
  295. 26, /* Bitsize. */
  296. TRUE, /* PC_relative. */
  297. 0, /* Bitpos. */
  298. complain_overflow_dont,/* Complain_on_overflow. */
  299. elf32_dlx_relocate26, /* Special_function. */
  300. "R_DLX_RELOC_26_PCREL",/* Name. */
  301. TRUE, /* Partial_inplace. */
  302. 0xffff, /* Src_mask. */
  303. 0xffff, /* Dst_mask. */
  304. TRUE); /* PCrel_offset. */
  305. /* High 16 bits of symbol value. */
  306. static reloc_howto_type elf_dlx_reloc_16_hi =
  307. HOWTO (R_DLX_RELOC_16_HI, /* Type. */
  308. 16, /* Rightshift. */
  309. 2, /* Size (0 = byte, 1 = short, 2 = long). */
  310. 32, /* Bitsize. */
  311. FALSE, /* PC_relative. */
  312. 0, /* Bitpos. */
  313. complain_overflow_dont,/* Complain_on_overflow. */
  314. _bfd_dlx_elf_hi16_reloc,/* Special_function. */
  315. "R_DLX_RELOC_16_HI", /* Name. */
  316. TRUE, /* Partial_inplace. */
  317. 0xFFFF, /* Src_mask. */
  318. 0xffff, /* Dst_mask. */
  319. FALSE); /* PCrel_offset. */
  320. /* Low 16 bits of symbol value. */
  321. static reloc_howto_type elf_dlx_reloc_16_lo =
  322. HOWTO (R_DLX_RELOC_16_LO, /* Type. */
  323. 0, /* Rightshift. */
  324. 1, /* Size (0 = byte, 1 = short, 2 = long). */
  325. 16, /* Bitsize. */
  326. FALSE, /* PC_relative. */
  327. 0, /* Bitpos. */
  328. complain_overflow_dont,/* Complain_on_overflow. */
  329. bfd_elf_generic_reloc, /* Special_function. */
  330. "R_DLX_RELOC_16_LO", /* Name. */
  331. TRUE, /* Partial_inplace. */
  332. 0xffff, /* Src_mask. */
  333. 0xffff, /* Dst_mask. */
  334. FALSE); /* PCrel_offset. */
  335. /* A mapping from BFD reloc types to DLX ELF reloc types.
  336. Stolen from elf32-mips.c.
  337. More about this table - for dlx elf relocation we do not really
  338. need this table, if we have a rtype defined in this table will
  339. caused tc_gen_relocate confused and die on us, but if we remove
  340. this table it will caused more problem, so for now simple solution
  341. is to remove those entries which may cause problem. */
  342. struct elf_reloc_map
  343. {
  344. bfd_reloc_code_real_type bfd_reloc_val;
  345. enum elf_dlx_reloc_type elf_reloc_val;
  346. };
  347. static const struct elf_reloc_map dlx_reloc_map[] =
  348. {
  349. { BFD_RELOC_NONE, R_DLX_NONE },
  350. { BFD_RELOC_16, R_DLX_RELOC_16 },
  351. { BFD_RELOC_32, R_DLX_RELOC_32 },
  352. { BFD_RELOC_DLX_HI16_S, R_DLX_RELOC_16_HI },
  353. { BFD_RELOC_DLX_LO16, R_DLX_RELOC_16_LO },
  354. { BFD_RELOC_VTABLE_INHERIT, R_DLX_GNU_VTINHERIT },
  355. { BFD_RELOC_VTABLE_ENTRY, R_DLX_GNU_VTENTRY }
  356. };
  357. /* Look through the relocs for a section during the first phase.
  358. Since we don't do .gots or .plts, we just need to consider the
  359. virtual table relocs for gc. */
  360. static bfd_boolean
  361. elf32_dlx_check_relocs (bfd *abfd,
  362. struct bfd_link_info *info,
  363. asection *sec,
  364. const Elf_Internal_Rela *relocs)
  365. {
  366. Elf_Internal_Shdr *symtab_hdr;
  367. struct elf_link_hash_entry **sym_hashes;
  368. const Elf_Internal_Rela *rel;
  369. const Elf_Internal_Rela *rel_end;
  370. if (bfd_link_relocatable (info))
  371. return TRUE;
  372. symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
  373. sym_hashes = elf_sym_hashes (abfd);
  374. rel_end = relocs + sec->reloc_count;
  375. for (rel = relocs; rel < rel_end; rel++)
  376. {
  377. struct elf_link_hash_entry *h;
  378. unsigned long r_symndx;
  379. r_symndx = ELF32_R_SYM (rel->r_info);
  380. if (r_symndx < symtab_hdr->sh_info)
  381. h = NULL;
  382. else
  383. {
  384. h = sym_hashes[r_symndx - symtab_hdr->sh_info];
  385. while (h->root.type == bfd_link_hash_indirect
  386. || h->root.type == bfd_link_hash_warning)
  387. h = (struct elf_link_hash_entry *) h->root.u.i.link;
  388. /* PR15323, ref flags aren't set for references in the same
  389. object. */
  390. h->root.non_ir_ref = 1;
  391. }
  392. switch (ELF32_R_TYPE (rel->r_info))
  393. {
  394. /* This relocation describes the C++ object vtable hierarchy.
  395. Reconstruct it for later use during GC. */
  396. case R_DLX_GNU_VTINHERIT:
  397. if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
  398. return FALSE;
  399. break;
  400. /* This relocation describes which C++ vtable entries are actually
  401. used. Record for later use during GC. */
  402. case R_DLX_GNU_VTENTRY:
  403. BFD_ASSERT (h != NULL);
  404. if (h != NULL
  405. && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
  406. return FALSE;
  407. break;
  408. }
  409. }
  410. return TRUE;
  411. }
  412. /* Given a BFD reloc type, return a howto structure. */
  413. static reloc_howto_type *
  414. elf32_dlx_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
  415. bfd_reloc_code_real_type code)
  416. {
  417. unsigned int i;
  418. for (i = 0; i < sizeof (dlx_reloc_map) / sizeof (struct elf_reloc_map); i++)
  419. if (dlx_reloc_map[i].bfd_reloc_val == code)
  420. return &dlx_elf_howto_table[(int) dlx_reloc_map[i].elf_reloc_val];
  421. switch (code)
  422. {
  423. default:
  424. bfd_set_error (bfd_error_bad_value);
  425. return NULL;
  426. case BFD_RELOC_16_PCREL_S2:
  427. return &elf_dlx_gnu_rel16_s2;
  428. case BFD_RELOC_DLX_JMP26:
  429. return &elf_dlx_gnu_rel26_s2;
  430. case BFD_RELOC_HI16_S:
  431. return &elf_dlx_reloc_16_hi;
  432. case BFD_RELOC_LO16:
  433. return &elf_dlx_reloc_16_lo;
  434. }
  435. }
  436. static reloc_howto_type *
  437. elf32_dlx_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
  438. const char *r_name)
  439. {
  440. unsigned int i;
  441. for (i = 0;
  442. i < sizeof (dlx_elf_howto_table) / sizeof (dlx_elf_howto_table[0]);
  443. i++)
  444. if (dlx_elf_howto_table[i].name != NULL
  445. && strcasecmp (dlx_elf_howto_table[i].name, r_name) == 0)
  446. return &dlx_elf_howto_table[i];
  447. if (strcasecmp (elf_dlx_gnu_rel16_s2.name, r_name) == 0)
  448. return &elf_dlx_gnu_rel16_s2;
  449. if (strcasecmp (elf_dlx_gnu_rel26_s2.name, r_name) == 0)
  450. return &elf_dlx_gnu_rel26_s2;
  451. if (strcasecmp (elf_dlx_reloc_16_hi.name, r_name) == 0)
  452. return &elf_dlx_reloc_16_hi;
  453. if (strcasecmp (elf_dlx_reloc_16_lo.name, r_name) == 0)
  454. return &elf_dlx_reloc_16_lo;
  455. return NULL;
  456. }
  457. static reloc_howto_type *
  458. dlx_rtype_to_howto (unsigned int r_type)
  459. {
  460. switch (r_type)
  461. {
  462. case R_DLX_RELOC_16_PCREL:
  463. return & elf_dlx_gnu_rel16_s2;
  464. case R_DLX_RELOC_26_PCREL:
  465. return & elf_dlx_gnu_rel26_s2;
  466. case R_DLX_RELOC_16_HI:
  467. return & elf_dlx_reloc_16_hi;
  468. case R_DLX_RELOC_16_LO:
  469. return & elf_dlx_reloc_16_lo;
  470. default:
  471. if (r_type >= (unsigned int) R_DLX_max)
  472. {
  473. _bfd_error_handler (_("Invalid DLX reloc number: %d"), r_type);
  474. r_type = 0;
  475. }
  476. return & dlx_elf_howto_table[r_type];
  477. }
  478. }
  479. static void
  480. elf32_dlx_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED,
  481. arelent * cache_ptr ATTRIBUTE_UNUSED,
  482. Elf_Internal_Rela * dst ATTRIBUTE_UNUSED)
  483. {
  484. abort ();
  485. }
  486. static void
  487. elf32_dlx_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
  488. arelent *cache_ptr,
  489. Elf_Internal_Rela *dst)
  490. {
  491. unsigned int r_type;
  492. r_type = ELF32_R_TYPE (dst->r_info);
  493. cache_ptr->howto = dlx_rtype_to_howto (r_type);
  494. return;
  495. }
  496. #define TARGET_BIG_SYM dlx_elf32_be_vec
  497. #define TARGET_BIG_NAME "elf32-dlx"
  498. #define ELF_ARCH bfd_arch_dlx
  499. #define ELF_MACHINE_CODE EM_DLX
  500. #define ELF_MAXPAGESIZE 1 /* FIXME: This number is wrong, It should be the page size in bytes. */
  501. #include "elf32-target.h"