+ r_symndx = ELF32_R_SYM (rel->r_info);
+ howto = elf32_frv_howto_table + ELF32_R_TYPE (rel->r_info);
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ osec = sec = local_sections [r_symndx];
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
+
+ name = bfd_elf_string_from_elf_section
+ (input_bfd, symtab_hdr->sh_link, sym->st_name);
+ if (name == NULL || name[0] == 0)
+ name = bfd_section_name (sec);
+ }
+ else
+ {
+ bfd_boolean warned, ignored;
+ bfd_boolean unresolved_reloc;
+
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ h, sec, relocation,
+ unresolved_reloc, warned, ignored);
+ osec = sec;
+ name = h->root.root.string;
+ }
+
+ if (sec != NULL && discarded_section (sec))
+ RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
+ rel, 1, relend, howto, 0, contents);
+
+ if (bfd_link_relocatable (info))
+ continue;
+
+ if (r_type != R_FRV_TLSMOFF
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && !FRVFDPIC_SYM_LOCAL (info, h))
+ {
+ osec = sec = NULL;
+ relocation = 0;
+ }
+
+ switch (r_type)
+ {
+ case R_FRV_LABEL24:
+ case R_FRV_32:
+ if (! IS_FDPIC (output_bfd))
+ goto non_fdpic;
+ /* Fall through. */
+
+ case R_FRV_GOT12:
+ case R_FRV_GOTHI:
+ case R_FRV_GOTLO:
+ case R_FRV_FUNCDESC_GOT12:
+ case R_FRV_FUNCDESC_GOTHI:
+ case R_FRV_FUNCDESC_GOTLO:
+ case R_FRV_GOTOFF12:
+ case R_FRV_GOTOFFHI:
+ case R_FRV_GOTOFFLO:
+ case R_FRV_FUNCDESC_GOTOFF12:
+ case R_FRV_FUNCDESC_GOTOFFHI:
+ case R_FRV_FUNCDESC_GOTOFFLO:
+ case R_FRV_FUNCDESC:
+ case R_FRV_FUNCDESC_VALUE:
+ case R_FRV_GETTLSOFF:
+ case R_FRV_TLSDESC_VALUE:
+ case R_FRV_GOTTLSDESC12:
+ case R_FRV_GOTTLSDESCHI:
+ case R_FRV_GOTTLSDESCLO:
+ case R_FRV_TLSMOFF12:
+ case R_FRV_TLSMOFFHI:
+ case R_FRV_TLSMOFFLO:
+ case R_FRV_GOTTLSOFF12:
+ case R_FRV_GOTTLSOFFHI:
+ case R_FRV_GOTTLSOFFLO:
+ case R_FRV_TLSOFF:
+ case R_FRV_TLSDESC_RELAX:
+ case R_FRV_GETTLSOFF_RELAX:
+ case R_FRV_TLSOFF_RELAX:
+ case R_FRV_TLSMOFF:
+ if ((input_section->flags & SEC_ALLOC) == 0)
+ break;
+
+ if (h != NULL)
+ picrel = frvfdpic_relocs_info_for_global (frvfdpic_relocs_info
+ (info), input_bfd, h,
+ orig_addend, INSERT);
+ else
+ /* In order to find the entry we created before, we must
+ use the original addend, not the one that may have been
+ modified by _bfd_elf_rela_local_sym(). */
+ picrel = frvfdpic_relocs_info_for_local (frvfdpic_relocs_info
+ (info), input_bfd, r_symndx,
+ orig_addend, INSERT);
+ if (! picrel)
+ return FALSE;
+
+ if (!_frvfdpic_emit_got_relocs_plt_entries (picrel, output_bfd, info,
+ osec, sym,
+ rel->r_addend))
+ {
+ info->callbacks->einfo
+ /* xgettext:c-format */
+ (_("%H: relocation to `%s+%v'"
+ " may have caused the error above\n"),
+ input_bfd, input_section, rel->r_offset, name, rel->r_addend);
+ return FALSE;
+ }
+
+ break;
+
+ default:
+ non_fdpic:
+ picrel = NULL;
+ if (h
+ && ! FRVFDPIC_SYM_LOCAL (info, h)
+ && _bfd_elf_section_offset (output_bfd, info, input_section,
+ rel->r_offset) != (bfd_vma) -1)
+ {
+ info->callbacks->einfo
+ (_("%H: relocation references symbol"
+ " not defined in the module\n"),
+ input_bfd, input_section, rel->r_offset);
+ return FALSE;
+ }
+ break;
+ }
+
+ switch (r_type)
+ {
+ case R_FRV_GETTLSOFF:
+ case R_FRV_TLSDESC_VALUE:
+ case R_FRV_GOTTLSDESC12:
+ case R_FRV_GOTTLSDESCHI:
+ case R_FRV_GOTTLSDESCLO:
+ case R_FRV_TLSMOFF12:
+ case R_FRV_TLSMOFFHI:
+ case R_FRV_TLSMOFFLO:
+ case R_FRV_GOTTLSOFF12:
+ case R_FRV_GOTTLSOFFHI:
+ case R_FRV_GOTTLSOFFLO:
+ case R_FRV_TLSOFF:
+ case R_FRV_TLSDESC_RELAX:
+ case R_FRV_GETTLSOFF_RELAX:
+ case R_FRV_TLSOFF_RELAX:
+ case R_FRV_TLSMOFF:
+ if (sec && (bfd_is_abs_section (sec) || bfd_is_und_section (sec)))
+ relocation += tls_biased_base (info);
+ break;
+
+ default:
+ break;
+ }
+
+ /* Try to apply TLS relaxations. */
+ if (1)
+ switch (r_type)
+ {
+
+#define LOCAL_EXEC_P(info, picrel) \
+ (bfd_link_executable (info) \
+ && (picrel->symndx != -1 || FRVFDPIC_SYM_LOCAL ((info), (picrel)->d.h)))
+#define INITIAL_EXEC_P(info, picrel) \
+ ((bfd_link_executable (info)|| (info)->flags & DF_STATIC_TLS) \
+ && (picrel)->tlsoff_entry)
+
+#define IN_RANGE_FOR_OFST12_P(value) \
+ ((bfd_vma)((value) + 2048) < (bfd_vma)4096)
+#define IN_RANGE_FOR_SETLOS_P(value) \
+ ((bfd_vma)((value) + 32768) < (bfd_vma)65536)
+#define TLSMOFF_IN_RANGE_FOR_SETLOS_P(value, info) \
+ (IN_RANGE_FOR_SETLOS_P ((value) - tls_biased_base (info)))
+
+#define RELAX_GETTLSOFF_LOCAL_EXEC_P(info, picrel, value) \
+ (LOCAL_EXEC_P ((info), (picrel)) \
+ && TLSMOFF_IN_RANGE_FOR_SETLOS_P((value), (info)))
+#define RELAX_GETTLSOFF_INITIAL_EXEC_P(info, picrel) \
+ (INITIAL_EXEC_P ((info), (picrel)) \
+ && IN_RANGE_FOR_OFST12_P ((picrel)->tlsoff_entry))
+
+#define RELAX_TLSDESC_LOCAL_EXEC_P(info, picrel, value) \
+ (LOCAL_EXEC_P ((info), (picrel)))
+#define RELAX_TLSDESC_INITIAL_EXEC_P(info, picrel) \
+ (INITIAL_EXEC_P ((info), (picrel)))
+
+#define RELAX_GOTTLSOFF_LOCAL_EXEC_P(info, picrel, value) \
+ (LOCAL_EXEC_P ((info), (picrel)) \
+ && TLSMOFF_IN_RANGE_FOR_SETLOS_P((value), (info)))
+
+ case R_FRV_GETTLSOFF:
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+
+ /* Is this a call instruction? */
+ if ((insn & (unsigned long)0x01fc0000) != 0x003c0000)
+ {
+ info->callbacks->einfo
+ (_("%H: R_FRV_GETTLSOFF not applied to a call instruction\n"),
+ input_bfd, input_section, rel->r_offset);
+ return FALSE;
+ }
+
+ if (RELAX_GETTLSOFF_LOCAL_EXEC_P (info, picrel,
+ relocation + rel->r_addend))
+ {
+ /* Replace the call instruction (except the packing bit)
+ with setlos #tlsmofflo(symbol+offset), gr9. */
+ insn &= (unsigned long)0x80000000;
+ insn |= (unsigned long)0x12fc0000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ r_type = R_FRV_TLSMOFFLO;
+ howto = elf32_frv_howto_table + r_type;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ }
+
+ else if (RELAX_GETTLSOFF_INITIAL_EXEC_P (info, picrel))
+ {
+ /* Replace the call instruction (except the packing bit)
+ with ldi @(gr15, #gottlsoff12(symbol+addend)), gr9. */
+ insn &= (unsigned long)0x80000000;
+ insn |= (unsigned long)0x12c8f000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ r_type = R_FRV_GOTTLSOFF12;
+ howto = elf32_frv_howto_table + r_type;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ }
+
+ break;
+
+ case R_FRV_GOTTLSDESC12:
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+
+ /* Is this an lddi instruction? */
+ if ((insn & (unsigned long)0x01fc0000) != 0x00cc0000)
+ {
+ info->callbacks->einfo
+ (_("%H: R_FRV_GOTTLSDESC12"
+ " not applied to an lddi instruction\n"),
+ input_bfd, input_section, rel->r_offset);
+ return FALSE;
+ }
+
+ if (RELAX_TLSDESC_LOCAL_EXEC_P (info, picrel,
+ relocation + rel->r_addend)
+ && TLSMOFF_IN_RANGE_FOR_SETLOS_P (relocation + rel->r_addend,
+ info))
+ {
+ /* Replace lddi @(grB, #gottlsdesc12(symbol+offset), grC
+ with setlos #tlsmofflo(symbol+offset), gr<C+1>.
+ Preserve the packing bit. */
+ insn = (insn & (unsigned long)0x80000000)
+ | ((insn + (unsigned long)0x02000000)
+ & (unsigned long)0x7e000000);
+ insn |= (unsigned long)0x00fc0000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ r_type = R_FRV_TLSMOFFLO;
+ howto = elf32_frv_howto_table + r_type;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ }
+
+ else if (RELAX_TLSDESC_LOCAL_EXEC_P (info, picrel,
+ relocation + rel->r_addend))
+ {
+ /* Replace lddi @(grB, #gottlsdesc12(symbol+offset), grC
+ with sethi #tlsmoffhi(symbol+offset), gr<C+1>.
+ Preserve the packing bit. */
+ insn = (insn & (unsigned long)0x80000000)
+ | ((insn + (unsigned long)0x02000000)
+ & (unsigned long)0x7e000000);
+ insn |= (unsigned long)0x00f80000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ r_type = R_FRV_TLSMOFFHI;
+ howto = elf32_frv_howto_table + r_type;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ }
+
+ else if (RELAX_TLSDESC_INITIAL_EXEC_P (info, picrel))
+ {
+ /* Replace lddi @(grB, #gottlsdesc12(symbol+offset), grC
+ with ldi @(grB, #gottlsoff12(symbol+offset),
+ gr<C+1>. Preserve the packing bit. If gottlsoff12
+ overflows, we'll error out, but that's sort-of ok,
+ since we'd started with gottlsdesc12, that's actually
+ more demanding. Compiling with -fPIE instead of
+ -fpie would fix it; linking with --relax should fix
+ it as well. */
+ insn = (insn & (unsigned long)0x80cbf000)
+ | ((insn + (unsigned long)0x02000000)
+ & (unsigned long)0x7e000000);
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ r_type = R_FRV_GOTTLSOFF12;
+ howto = elf32_frv_howto_table + r_type;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ }
+
+ break;
+
+ case R_FRV_GOTTLSDESCHI:
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+
+ /* Is this a sethi instruction? */
+ if ((insn & (unsigned long)0x01ff0000) != 0x00f80000)
+ {
+ info->callbacks->einfo
+ (_("%H: R_FRV_GOTTLSDESCHI"
+ " not applied to a sethi instruction\n"),
+ input_bfd, input_section, rel->r_offset);
+ return FALSE;
+ }
+
+ if (RELAX_TLSDESC_LOCAL_EXEC_P (info, picrel,
+ relocation + rel->r_addend)
+ || (RELAX_TLSDESC_INITIAL_EXEC_P (info, picrel)
+ && IN_RANGE_FOR_SETLOS_P (picrel->tlsoff_entry)))
+ {
+ /* Replace sethi with a nop. Preserve the packing bit. */
+ insn &= (unsigned long)0x80000000;
+ insn |= (unsigned long)0x00880000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ /* Nothing to relocate. */
+ continue;
+ }
+
+ else if (RELAX_TLSDESC_INITIAL_EXEC_P (info, picrel))
+ {
+ /* Simply decay GOTTLSDESC to GOTTLSOFF. */
+ r_type = R_FRV_GOTTLSOFFHI;
+ howto = elf32_frv_howto_table + r_type;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ }
+
+ break;
+
+ case R_FRV_GOTTLSDESCLO:
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+
+ /* Is this a setlo or setlos instruction? */
+ if ((insn & (unsigned long)0x01f70000) != 0x00f40000)
+ {
+ info->callbacks->einfo
+ (_("%H: R_FRV_GOTTLSDESCLO"
+ " not applied to a setlo or setlos instruction\n"),
+ input_bfd, input_section, rel->r_offset);
+ return FALSE;
+ }
+
+ if (RELAX_TLSDESC_LOCAL_EXEC_P (info, picrel,
+ relocation + rel->r_addend)
+ || (RELAX_TLSDESC_INITIAL_EXEC_P (info, picrel)
+ && IN_RANGE_FOR_OFST12_P (picrel->tlsoff_entry)))
+ {
+ /* Replace setlo/setlos with a nop. Preserve the
+ packing bit. */
+ insn &= (unsigned long)0x80000000;
+ insn |= (unsigned long)0x00880000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ /* Nothing to relocate. */
+ continue;
+ }
+
+ else if (RELAX_TLSDESC_INITIAL_EXEC_P (info, picrel))
+ {
+ /* If the corresponding sethi (if it exists) decayed
+ to a nop, make sure this becomes (or already is) a
+ setlos, not setlo. */
+ if (IN_RANGE_FOR_SETLOS_P (picrel->tlsoff_entry))
+ {
+ insn |= (unsigned long)0x00080000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+ }
+
+ /* Simply decay GOTTLSDESC to GOTTLSOFF. */
+ r_type = R_FRV_GOTTLSOFFLO;
+ howto = elf32_frv_howto_table + r_type;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ }
+
+ break;
+
+ case R_FRV_TLSDESC_RELAX:
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+
+ /* Is this an ldd instruction? */
+ if ((insn & (unsigned long)0x01fc0fc0) != 0x00080140)
+ {
+ info->callbacks->einfo
+ (_("%H: R_FRV_TLSDESC_RELAX"
+ " not applied to an ldd instruction\n"),
+ input_bfd, input_section, rel->r_offset);
+ return FALSE;
+ }
+
+ if (RELAX_TLSDESC_LOCAL_EXEC_P (info, picrel,
+ relocation + rel->r_addend)
+ && TLSMOFF_IN_RANGE_FOR_SETLOS_P (relocation + rel->r_addend,
+ info))
+ {
+ /* Replace ldd #tlsdesc(symbol+offset)@(grB, grA), grC
+ with setlos #tlsmofflo(symbol+offset), gr<C+1>.
+ Preserve the packing bit. */
+ insn = (insn & (unsigned long)0x80000000)
+ | ((insn + (unsigned long)0x02000000)
+ & (unsigned long)0x7e000000);
+ insn |= (unsigned long)0x00fc0000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ r_type = R_FRV_TLSMOFFLO;
+ howto = elf32_frv_howto_table + r_type;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ }
+
+ else if (RELAX_TLSDESC_LOCAL_EXEC_P (info, picrel,
+ relocation + rel->r_addend))
+ {
+ /* Replace ldd #tlsdesc(symbol+offset)@(grB, grA), grC
+ with sethi #tlsmoffhi(symbol+offset), gr<C+1>.
+ Preserve the packing bit. */
+ insn = (insn & (unsigned long)0x80000000)
+ | ((insn + (unsigned long)0x02000000)
+ & (unsigned long)0x7e000000);
+ insn |= (unsigned long)0x00f80000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ r_type = R_FRV_TLSMOFFHI;
+ howto = elf32_frv_howto_table + r_type;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ }
+
+ else if (RELAX_TLSDESC_INITIAL_EXEC_P (info, picrel)
+ && IN_RANGE_FOR_OFST12_P (picrel->tlsoff_entry))
+ {
+ /* Replace ldd #tlsdesc(symbol+offset)@(grB, grA), grC
+ with ldi @(grB, #gottlsoff12(symbol+offset), gr<C+1>.
+ Preserve the packing bit. */
+ insn = (insn & (unsigned long)0x8003f000)
+ | (unsigned long)0x00c80000
+ | ((insn + (unsigned long)0x02000000)
+ & (unsigned long)0x7e000000);
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ r_type = R_FRV_GOTTLSOFF12;
+ howto = elf32_frv_howto_table + r_type;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ }
+
+ else if (RELAX_TLSDESC_INITIAL_EXEC_P (info, picrel))
+ {
+ /* Replace ldd #tlsdesc(symbol+offset)@(grB, grA), grC
+ with ld #tlsoff(symbol+offset)@(grB, grA), gr<C+1>.
+ Preserve the packing bit. */
+ insn = (insn & (unsigned long)0x81ffffbf)
+ | ((insn + (unsigned long)0x02000000)
+ & (unsigned long)0x7e000000);
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ /* #tlsoff(symbol+offset) is just a relaxation
+ annotation, so there's nothing left to
+ relocate. */
+ continue;
+ }
+
+ break;
+
+ case R_FRV_GETTLSOFF_RELAX:
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+
+ /* Is this a calll or callil instruction? */
+ if ((insn & (unsigned long)0x7ff80fc0) != 0x02300000)
+ {
+ info->callbacks->einfo
+ (_("%H: R_FRV_GETTLSOFF_RELAX"
+ " not applied to a calll instruction\n"),
+ input_bfd, input_section, rel->r_offset);
+ return FALSE;
+ }
+
+ if (RELAX_TLSDESC_LOCAL_EXEC_P (info, picrel,
+ relocation + rel->r_addend)
+ && TLSMOFF_IN_RANGE_FOR_SETLOS_P (relocation + rel->r_addend,
+ info))
+ {
+ /* Replace calll with a nop. Preserve the packing bit. */
+ insn &= (unsigned long)0x80000000;
+ insn |= (unsigned long)0x00880000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ /* Nothing to relocate. */
+ continue;
+ }
+
+ else if (RELAX_TLSDESC_LOCAL_EXEC_P (info, picrel,
+ relocation + rel->r_addend))
+ {
+ /* Replace calll with setlo #tlsmofflo(symbol+offset), gr9.
+ Preserve the packing bit. */
+ insn &= (unsigned long)0x80000000;
+ insn |= (unsigned long)0x12f40000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ r_type = R_FRV_TLSMOFFLO;
+ howto = elf32_frv_howto_table + r_type;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ }
+
+ else if (RELAX_TLSDESC_INITIAL_EXEC_P (info, picrel))
+ {
+ /* Replace calll with a nop. Preserve the packing bit. */
+ insn &= (unsigned long)0x80000000;
+ insn |= (unsigned long)0x00880000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ /* Nothing to relocate. */
+ continue;
+ }
+
+ break;
+
+ case R_FRV_GOTTLSOFF12:
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+
+ /* Is this an ldi instruction? */
+ if ((insn & (unsigned long)0x01fc0000) != 0x00c80000)
+ {
+ info->callbacks->einfo
+ (_("%H: R_FRV_GOTTLSOFF12"
+ " not applied to an ldi instruction\n"),
+ input_bfd, input_section, rel->r_offset);
+ return FALSE;
+ }
+
+ if (RELAX_GOTTLSOFF_LOCAL_EXEC_P (info, picrel,
+ relocation + rel->r_addend))
+ {
+ /* Replace ldi @(grB, #gottlsoff12(symbol+offset), grC
+ with setlos #tlsmofflo(symbol+offset), grC.
+ Preserve the packing bit. */
+ insn &= (unsigned long)0xfe000000;
+ insn |= (unsigned long)0x00fc0000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ r_type = R_FRV_TLSMOFFLO;
+ howto = elf32_frv_howto_table + r_type;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ }
+
+ break;
+
+ case R_FRV_GOTTLSOFFHI:
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+
+ /* Is this a sethi instruction? */
+ if ((insn & (unsigned long)0x01ff0000) != 0x00f80000)
+ {
+ info->callbacks->einfo
+ (_("%H: R_FRV_GOTTLSOFFHI"
+ " not applied to a sethi instruction\n"),
+ input_bfd, input_section, rel->r_offset);
+ return FALSE;
+ }
+
+ if (RELAX_GOTTLSOFF_LOCAL_EXEC_P (info, picrel,
+ relocation + rel->r_addend)
+ || (RELAX_TLSDESC_INITIAL_EXEC_P (info, picrel)
+ && IN_RANGE_FOR_OFST12_P (picrel->tlsoff_entry)))
+ {
+ /* Replace sethi with a nop. Preserve the packing bit. */
+ insn &= (unsigned long)0x80000000;
+ insn |= (unsigned long)0x00880000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ /* Nothing to relocate. */
+ continue;
+ }
+
+ break;
+
+ case R_FRV_GOTTLSOFFLO:
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+
+ /* Is this a setlo or setlos instruction? */
+ if ((insn & (unsigned long)0x01f70000) != 0x00f40000)
+ {
+ info->callbacks->einfo
+ (_("%H: R_FRV_GOTTLSOFFLO"
+ " not applied to a setlo or setlos instruction\n"),
+ input_bfd, input_section, rel->r_offset);
+ return FALSE;
+ }
+
+ if (RELAX_GOTTLSOFF_LOCAL_EXEC_P (info, picrel,
+ relocation + rel->r_addend)
+ || (RELAX_TLSDESC_INITIAL_EXEC_P (info, picrel)
+ && IN_RANGE_FOR_OFST12_P (picrel->tlsoff_entry)))
+ {
+ /* Replace setlo/setlos with a nop. Preserve the
+ packing bit. */
+ insn &= (unsigned long)0x80000000;
+ insn |= (unsigned long)0x00880000;
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+
+ /* Nothing to relocate. */
+ continue;
+ }
+
+ break;
+
+ case R_FRV_TLSOFF_RELAX:
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+
+ /* Is this an ld instruction? */
+ if ((insn & (unsigned long)0x01fc0fc0) != 0x00080100)
+ {
+ info->callbacks->einfo
+ (_("%H: R_FRV_TLSOFF_RELAX"
+ " not applied to an ld instruction\n"),
+ input_bfd, input_section, rel->r_offset);
+ return FALSE;
+ }