+static bfd_reloc_status_type
+iq2000_elf_relocate_offset16 (bfd *input_bfd,
+ Elf_Internal_Rela *rel,
+ bfd_byte *contents,
+ bfd_vma value,
+ bfd_vma location)
+{
+ bfd_vma insn;
+ bfd_vma jtarget;
+
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+
+ value += rel->r_addend;
+
+ if (value & 3)
+ return bfd_reloc_dangerous;
+
+ jtarget = (value & 0x3fffc) | (location & 0xf0000000L);
+
+ if (jtarget != value)
+ return bfd_reloc_overflow;
+
+ insn = (insn & ~0xFFFF) | ((value >> 2) & 0xFFFF);
+
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+ return bfd_reloc_ok;
+}
+