aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2005-01-25 20:22:41 +0000
committerAlexandre Oliva <aoliva@redhat.com>2005-01-25 20:22:41 +0000
commit90219bd0f3e7ff1b4988da0ae32a14f813f7cacc (patch)
treec1fe8cdd2851e7436786a80afdc779bfdc6f2014 /ld/testsuite
parent8615f3f213dc2fa20bd7c0349c84e22c81c48c9e (diff)
downloadgdb-90219bd0f3e7ff1b4988da0ae32a14f813f7cacc.zip
gdb-90219bd0f3e7ff1b4988da0ae32a14f813f7cacc.tar.gz
gdb-90219bd0f3e7ff1b4988da0ae32a14f813f7cacc.tar.bz2
bfd/ChangeLog:
2004-12-10 Alexandre Oliva <aoliva@redhat.com> * elf32-frv.c (elf32_frv_relocate_section): Force local binding for TLSMOFF. * reloc.c: Add R_FRV_TLSMOFF. * elf32-frv.c (elf32_frv_howto_table): Likewise. (frv_reloc_map, frv_reloc_type_lookup): Map it. (elf32_frv_relocate_section): Handle it. (elf32_frv_check_relocs): Likewise. * libbfd.h, bfd-in2.h: Rebuilt. 2004-11-26 Alexandre Oliva <aoliva@redhat.com> * elf32-frv.c (_frvfdpic_emit_got_relocs_plt_entries): Don't crash when given an undefweak TLS symbol. Fix constant TLS PLT entries such that they return the constant in gr9. (_frvfdpic_relax_tls_entries): Don't crash for undefweak TLS symbols. (_frvfdpic_size_got_plt): Set _cooked_size of dynamic sections. too, such that they shrink on relaxation. (elf32_frvfdpic_finish_dynamic_sections): Check __ROFIXUP_END__ as marking the position right past the _GLOBAL_OFFSET_TABLE_ value. (_frvfdpic_assign_plt_entries): Shrink constant TLS PLT entries if we can guarantee the use of 16-bit constants. 2004-11-10 Alexandre Oliva <aoliva@redhat.com> Introduce TLS support for FR-V FDPIC. * reloc.c: Add TLS relocations. * elf32-frv.c (elf32_frv_howto_table): Add TLS relocations. (elf32_frv_rel_tlsdesc_value_howto): New. (elf32_frv_rel_tlsoff_howto): New. (frv_reloc_map): Add new mappings. (struct frvfdpic_elf_link_hash_table): Add pointer to summary reloc information. (frvfdpic_dynamic_got_plt_info): New. (frvfdpic_plt_tls_ret_offset): New. (ELF_DYNAMIC_INTERPRETER, DEFAULT_STACK_SIZE): Move earlier. (struct _frvfdpic_dynamic_got_info): Likewise. Add TLS members. (struct _frvfdpic_dynamic_got_plt_info): Likewise. (FRVFDPIC_SYM_LOCAL): Regard symbols defined in the absolute section as local. (struct frvfdpic_relocs_info): Add TLS fields. (frvfdpic_relocs_info_hash): Warning clean up. (frvfdpic_relocs_info_find): Initialize tlsplt_entry. (frvfdpic_pic_merge_early_relocs_info): Merge TLS fields. (FRVFDPIC_TLS_BIAS): Define. (tls_biased_base): New. (_frvfdpic_emit_got_relocs_plt_entries): Deal with TLS relocations. (frv_reloc_type_lookup): Likewise. (frvfdpic_info_to_howto_rel): Likewise. (elf32_frv_relocate_section): Likewise. (_frv_create_got_section): Create the PLT section here. (elf32_frvfdpic_create_dynamic_sections): Not here. (_frvfdpic_count_nontls_entries): Move out of... (_frvfdpic_count_got_plt_entries): ... here. (_frvfdpic_count_tls_entries): Likewise. Add TLS support. (_frvfdpic_count_relocs_fixups): Likewise. Add relaxation support. (_frvfdpic_relax_tls_entries): New. (_frvfdpic_compute_got_alloc_data): Add TLS support. (_frvfdpic_get_tlsdesc_entry): New. (_frvfdpic_assign_got_entries): Add TLS support. (_frvfdpic_assign_plt_entries): Likewise. (_frvfdpic_reset_got_plt_entries): New. (_frvfdpic_size_got_plt): Move out of... (elf32_frvfdpic_size_dynamic_sections): ... here. (_frvfdpic_relax_got_plt_entries): New. (elf32_frvfdpic_relax_section): New. (elf32_frvfdpic_finish_dynamic_sections): Add TLS sanity check. (elf32_frv_check_relocs): Add TLS support. (bfd_elf32_bfd_relax_section): Define for FDPIC. * libbfd.h, bfd-in2.h: Rebuilt. cpu/ChangeLog: 2004-11-10 Alexandre Oliva <aoliva@redhat.com> * frv.cpu: Add support for TLS annotations in loads and calll. * frv.opc (parse_symbolic_address): New. (parse_ldd_annotation): New. (parse_call_annotation): New. (parse_ld_annotation): New. (parse_ulo16, parse_uslo16): Use parse_symbolic_address. Introduce TLS relocations. (parse_d12, parse_s12, parse_u12): Likewise. (parse_uhi16): Likewise. Fix constant checking on 64-bit host. (parse_call_label, print_at): New. gas/ChangeLog: * config/tc-frv.c (md_apply_fix3): Mark TLS symbols as such. 2004-12-10 Alexandre Oliva <aoliva@redhat.com> * config/tc-frv.c (frv_pic_ptr): Add tlsmoff support. 2004-11-10 Alexandre Oliva <aoliva@redhat.com> * cgen.c (gas_cgen_parse_operand): Handle CGEN_PARSE_OPERAND_SYMBOLIC. * config/tc-frv.c (md_cgen_lookup_reloc): Handle TLS relocations. (frv_force_relocation): Likewise. Fix handling of PIC relocations. (md_apply_fix3): Likewise. include/elf/ChangeLog: 2004-12-10 Alexandre Oliva <aoliva@redhat.com> * frv.h: Add R_FRV_TLSMOFF. 2004-11-10 Alexandre Oliva <aoliva@redhat.com> * frv.h: Add TLS relocations. include/opcode/ChangeLog: 2004-11-10 Alexandre Oliva <aoliva@redhat.com> * cgen.h (enum cgen_parse_operand_type): Add CGEN_PARSE_OPERAND_SYMBOLIC. ld/testsuite/ChangeLog: * ld-frv/fdpic.exp: Add -mfdpic to ASFLAGS. * ld-frv/tls.exp: Likewise. 2004-11-26 Alexandre Oliva <aoliva@redhat.com> * ld-frv/tls-3.s: New. * ld-frv/tls-static-3.d: New. * ld-frv/tls-dynamic-3.d: New. * ld-frv/tls-pie-3.d: New. * ld-frv/tls-shared-3.d: New. * ld-frv/tls-relax-static-3.d: New. * ld-frv/tls-relax-dynamic-3.d: New. * ld-frv/tls-relax-pie-3.d: New. * ld-frv/tls-relax-shared-3.d: New. * ld-frv/tls.exp: Run the new tests. * ld-frv/tls-dynamic-2.d: Adjust for improved relaxation. * ld-frv/tls-relax-dynamic-2.d: Likewise. * ld-frv/tls-relax-initial-shared-2.d: Likewise. 2004-11-10 Alexandre Oliva <aoliva@redhat.com> * ld-frv/tls-1-dep.s: New. * ld-frv/tls-1-shared.lds: New. * ld-frv/tls-1.s: New. * ld-frv/tls-2.s: New. * ld-frv/tls-dynamic-1.d: New. * ld-frv/tls-dynamic-2.d: New. * ld-frv/tls-initial-shared-2.d: New. * ld-frv/tls-pie-1.d: New. * ld-frv/tls-relax-dynamic-1.d: New. * ld-frv/tls-relax-dynamic-2.d: New. * ld-frv/tls-relax-initial-shared-2.d: New. * ld-frv/tls-relax-pie-1.d: New. * ld-frv/tls-relax-shared-1.d: New. * ld-frv/tls-relax-shared-2.d: New. * ld-frv/tls-relax-static-1.d: New. * ld-frv/tls-shared-1-fail.d: New. * ld-frv/tls-shared-1.d: New. * ld-frv/tls-shared-2.d: New. * ld-frv/tls-static-1.d: New. * ld-frv/tls.exp: New. * ld-frv/fdpic-pie-1.d: Adjust for 64-bit host. * ld-frv/fdpic-pie-2.d: Likewise. * ld-frv/fdpic-pie-6.d: Likewise. * ld-frv/fdpic-pie-7.d: Likewise. * ld-frv/fdpic-pie-8.d: Likewise. * ld-frv/fdpic-shared-1.d: Likewise. * ld-frv/fdpic-shared-2.d: Likewise. * ld-frv/fdpic-shared-3.d: Likewise. * ld-frv/fdpic-shared-4.d: Likewise. * ld-frv/fdpic-shared-5.d: Likewise. * ld-frv/fdpic-shared-6.d: Likewise. * ld-frv/fdpic-shared-7.d: Likewise. * ld-frv/fdpic-shared-8.d: Likewise. * ld-frv/fdpic-shared-local-2.d: Likewise. * ld-frv/fdpic-shared-local-8.d: Likewise. * ld-frv/fdpic-static-1.d: Likewise. * ld-frv/fdpic-static-2.d: Likewise. * ld-frv/fdpic-static-6.d: Likewise. * ld-frv/fdpic-static-7.d: Likewise. * ld-frv/fdpic-static-8.d: Likewise. opcodes/ChangeLog: 2004-11-10 Alexandre Oliva <aoliva@redhat.com> * frv-asm.c: Rebuilt. * frv-desc.c: Rebuilt. * frv-desc.h: Rebuilt. * frv-dis.c: Rebuilt. * frv-ibld.c: Rebuilt. * frv-opc.c: Rebuilt. * frv-opc.h: Rebuilt.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog60
-rw-r--r--ld/testsuite/ld-frv/fdpic-pie-1.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-pie-2.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-pie-6.d2
-rw-r--r--ld/testsuite/ld-frv/fdpic-pie-7.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-pie-8.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-shared-1.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-shared-2.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-shared-3.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-shared-4.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-shared-5.d2
-rw-r--r--ld/testsuite/ld-frv/fdpic-shared-6.d2
-rw-r--r--ld/testsuite/ld-frv/fdpic-shared-7.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-shared-8.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-shared-local-2.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-shared-local-8.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-static-1.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-static-2.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-static-6.d2
-rw-r--r--ld/testsuite/ld-frv/fdpic-static-7.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic-static-8.d4
-rw-r--r--ld/testsuite/ld-frv/fdpic.exp7
-rw-r--r--ld/testsuite/ld-frv/tls-1-dep.s7
-rw-r--r--ld/testsuite/ld-frv/tls-1-shared.lds3
-rw-r--r--ld/testsuite/ld-frv/tls-1.s85
-rw-r--r--ld/testsuite/ld-frv/tls-2.s183
-rw-r--r--ld/testsuite/ld-frv/tls-3.s20
-rw-r--r--ld/testsuite/ld-frv/tls-dynamic-1.d71
-rw-r--r--ld/testsuite/ld-frv/tls-dynamic-2.d200
-rw-r--r--ld/testsuite/ld-frv/tls-dynamic-3.d27
-rw-r--r--ld/testsuite/ld-frv/tls-initial-shared-2.d235
-rw-r--r--ld/testsuite/ld-frv/tls-pie-1.d71
-rw-r--r--ld/testsuite/ld-frv/tls-pie-3.d27
-rw-r--r--ld/testsuite/ld-frv/tls-relax-dynamic-1.d67
-rw-r--r--ld/testsuite/ld-frv/tls-relax-dynamic-2.d149
-rw-r--r--ld/testsuite/ld-frv/tls-relax-dynamic-3.d27
-rw-r--r--ld/testsuite/ld-frv/tls-relax-initial-shared-2.d214
-rw-r--r--ld/testsuite/ld-frv/tls-relax-pie-1.d67
-rw-r--r--ld/testsuite/ld-frv/tls-relax-pie-3.d27
-rw-r--r--ld/testsuite/ld-frv/tls-relax-shared-1.d73
-rw-r--r--ld/testsuite/ld-frv/tls-relax-shared-2.d264
-rw-r--r--ld/testsuite/ld-frv/tls-relax-shared-3.d27
-rw-r--r--ld/testsuite/ld-frv/tls-relax-static-1.d62
-rw-r--r--ld/testsuite/ld-frv/tls-relax-static-3.d26
-rw-r--r--ld/testsuite/ld-frv/tls-shared-1-fail.d4
-rw-r--r--ld/testsuite/ld-frv/tls-shared-1.d73
-rw-r--r--ld/testsuite/ld-frv/tls-shared-2.d264
-rw-r--r--ld/testsuite/ld-frv/tls-shared-3.d27
-rw-r--r--ld/testsuite/ld-frv/tls-static-1.d70
-rw-r--r--ld/testsuite/ld-frv/tls-static-3.d26
-rw-r--r--ld/testsuite/ld-frv/tls.exp62
51 files changed, 2560 insertions, 37 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 7db3064..1aa1671 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,63 @@
+2005-01-25 Alexandre Oliva <aoliva@redhat.com>
+
+ * ld-frv/fdpic.exp: Add -mfdpic to ASFLAGS.
+ * ld-frv/tls.exp: Likewise.
+ 2004-11-26 Alexandre Oliva <aoliva@redhat.com>
+ * ld-frv/tls-3.s: New.
+ * ld-frv/tls-static-3.d: New.
+ * ld-frv/tls-dynamic-3.d: New.
+ * ld-frv/tls-pie-3.d: New.
+ * ld-frv/tls-shared-3.d: New.
+ * ld-frv/tls-relax-static-3.d: New.
+ * ld-frv/tls-relax-dynamic-3.d: New.
+ * ld-frv/tls-relax-pie-3.d: New.
+ * ld-frv/tls-relax-shared-3.d: New.
+ * ld-frv/tls.exp: Run the new tests.
+ * ld-frv/tls-dynamic-2.d: Adjust for improved relaxation.
+ * ld-frv/tls-relax-dynamic-2.d: Likewise.
+ * ld-frv/tls-relax-initial-shared-2.d: Likewise.
+ 2004-11-10 Alexandre Oliva <aoliva@redhat.com>
+ * ld-frv/tls-1-dep.s: New.
+ * ld-frv/tls-1-shared.lds: New.
+ * ld-frv/tls-1.s: New.
+ * ld-frv/tls-2.s: New.
+ * ld-frv/tls-dynamic-1.d: New.
+ * ld-frv/tls-dynamic-2.d: New.
+ * ld-frv/tls-initial-shared-2.d: New.
+ * ld-frv/tls-pie-1.d: New.
+ * ld-frv/tls-relax-dynamic-1.d: New.
+ * ld-frv/tls-relax-dynamic-2.d: New.
+ * ld-frv/tls-relax-initial-shared-2.d: New.
+ * ld-frv/tls-relax-pie-1.d: New.
+ * ld-frv/tls-relax-shared-1.d: New.
+ * ld-frv/tls-relax-shared-2.d: New.
+ * ld-frv/tls-relax-static-1.d: New.
+ * ld-frv/tls-shared-1-fail.d: New.
+ * ld-frv/tls-shared-1.d: New.
+ * ld-frv/tls-shared-2.d: New.
+ * ld-frv/tls-static-1.d: New.
+ * ld-frv/tls.exp: New.
+ * ld-frv/fdpic-pie-1.d: Adjust for 64-bit host.
+ * ld-frv/fdpic-pie-2.d: Likewise.
+ * ld-frv/fdpic-pie-6.d: Likewise.
+ * ld-frv/fdpic-pie-7.d: Likewise.
+ * ld-frv/fdpic-pie-8.d: Likewise.
+ * ld-frv/fdpic-shared-1.d: Likewise.
+ * ld-frv/fdpic-shared-2.d: Likewise.
+ * ld-frv/fdpic-shared-3.d: Likewise.
+ * ld-frv/fdpic-shared-4.d: Likewise.
+ * ld-frv/fdpic-shared-5.d: Likewise.
+ * ld-frv/fdpic-shared-6.d: Likewise.
+ * ld-frv/fdpic-shared-7.d: Likewise.
+ * ld-frv/fdpic-shared-8.d: Likewise.
+ * ld-frv/fdpic-shared-local-2.d: Likewise.
+ * ld-frv/fdpic-shared-local-8.d: Likewise.
+ * ld-frv/fdpic-static-1.d: Likewise.
+ * ld-frv/fdpic-static-2.d: Likewise.
+ * ld-frv/fdpic-static-6.d: Likewise.
+ * ld-frv/fdpic-static-7.d: Likewise.
+ * ld-frv/fdpic-static-8.d: Likewise.
+
2005-01-17 Richard Sandiford <rsandifo@redhat.com>
* ld-mips-elf/eh-frame2-{n32,n64}.d: New tests.
diff --git a/ld/testsuite/ld-frv/fdpic-pie-1.d b/ld/testsuite/ld-frv/fdpic-pie-1.d
index 17901e8..70d2cca 100644
--- a/ld/testsuite/ld-frv/fdpic-pie-1.d
+++ b/ld/testsuite/ld-frv/fdpic-pie-1.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
35c: 80 f4 00 10 setlo 0x10,gr0
360: 80 f8 00 00 sethi hi\(0x0\),gr0
364: 80 40 ff f8 addi gr15,-8,gr0
- 368: 80 fc ff f8 setlos 0xfffffff8,gr0
+ 368: 80 fc ff f8 setlos 0xf*fffffff8,gr0
36c: 80 f4 ff f8 setlo 0xfff8,gr0
370: 80 f8 ff ff sethi 0xffff,gr0
374: 80 40 ff ec addi gr15,-20,gr0
- 378: 80 fc ff ec setlos 0xffffffec,gr0
+ 378: 80 fc ff ec setlos 0xf*ffffffec,gr0
37c: 80 f4 ff ec setlo 0xffec,gr0
380: 80 f8 ff ff sethi 0xffff,gr0
384: 80 f4 00 14 setlo 0x14,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-pie-2.d b/ld/testsuite/ld-frv/fdpic-pie-2.d
index e03af40..a6a5f8b 100644
--- a/ld/testsuite/ld-frv/fdpic-pie-2.d
+++ b/ld/testsuite/ld-frv/fdpic-pie-2.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
50c: 80 f4 00 14 setlo 0x14,gr0
510: 80 f8 00 00 sethi hi\(0x0\),gr0
514: 80 40 ff f8 addi gr15,-8,gr0
- 518: 80 fc ff f0 setlos 0xfffffff0,gr0
+ 518: 80 fc ff f0 setlos 0xf*fffffff0,gr0
51c: 80 f4 ff e8 setlo 0xffe8,gr0
520: 80 f8 ff ff sethi 0xffff,gr0
524: 80 40 ff dc addi gr15,-36,gr0
- 528: 80 fc ff dc setlos 0xffffffdc,gr0
+ 528: 80 fc ff dc setlos 0xf*ffffffdc,gr0
52c: 80 f4 ff dc setlo 0xffdc,gr0
530: 80 f8 ff ff sethi 0xffff,gr0
534: 80 f4 00 1c setlo 0x1c,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-pie-6.d b/ld/testsuite/ld-frv/fdpic-pie-6.d
index 9ad328b..9c39cc5 100644
--- a/ld/testsuite/ld-frv/fdpic-pie-6.d
+++ b/ld/testsuite/ld-frv/fdpic-pie-6.d
@@ -33,7 +33,7 @@ Disassembly of section \.text:
510: 80 f4 00 1c setlo 0x1c,gr0
514: 80 f8 00 00 sethi hi\(0x0\),gr0
518: 80 40 ff f8 addi gr15,-8,gr0
- 51c: 80 fc ff e8 setlos 0xffffffe8,gr0
+ 51c: 80 fc ff e8 setlos 0xf*ffffffe8,gr0
520: 80 f4 ff e0 setlo 0xffe0,gr0
524: 80 f8 ff ff sethi 0xffff,gr0
528: 80 f4 ff d4 setlo 0xffd4,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-pie-7.d b/ld/testsuite/ld-frv/fdpic-pie-7.d
index 8448e5d..c22c5de 100644
--- a/ld/testsuite/ld-frv/fdpic-pie-7.d
+++ b/ld/testsuite/ld-frv/fdpic-pie-7.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
35c: 80 f4 00 10 setlo 0x10,gr0
360: 80 f8 00 00 sethi hi\(0x0\),gr0
364: 80 40 ff f8 addi gr15,-8,gr0
- 368: 80 fc ff f8 setlos 0xfffffff8,gr0
+ 368: 80 fc ff f8 setlos 0xf*fffffff8,gr0
36c: 80 f4 ff f8 setlo 0xfff8,gr0
370: 80 f8 ff ff sethi 0xffff,gr0
374: 80 40 ff f0 addi gr15,-16,gr0
- 378: 80 fc ff f0 setlos 0xfffffff0,gr0
+ 378: 80 fc ff f0 setlos 0xf*fffffff0,gr0
37c: 80 f4 ff f0 setlo 0xfff0,gr0
380: 80 f8 ff ff sethi 0xffff,gr0
384: 80 f4 00 14 setlo 0x14,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-pie-8.d b/ld/testsuite/ld-frv/fdpic-pie-8.d
index 85437aa..f504016 100644
--- a/ld/testsuite/ld-frv/fdpic-pie-8.d
+++ b/ld/testsuite/ld-frv/fdpic-pie-8.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
50c: 80 f4 00 18 setlo 0x18,gr0
510: 80 f8 00 00 sethi hi\(0x0\),gr0
514: 80 40 ff f8 addi gr15,-8,gr0
- 518: 80 fc ff f0 setlos 0xfffffff0,gr0
+ 518: 80 fc ff f0 setlos 0xf*fffffff0,gr0
51c: 80 f4 ff e8 setlo 0xffe8,gr0
520: 80 f8 ff ff sethi 0xffff,gr0
524: 80 40 ff e0 addi gr15,-32,gr0
- 528: 80 fc ff e0 setlos 0xffffffe0,gr0
+ 528: 80 fc ff e0 setlos 0xf*ffffffe0,gr0
52c: 80 f4 ff e0 setlo 0xffe0,gr0
530: 80 f8 ff ff sethi 0xffff,gr0
534: 80 f4 00 20 setlo 0x20,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-shared-1.d b/ld/testsuite/ld-frv/fdpic-shared-1.d
index ad5cbc4..7d6d03d 100644
--- a/ld/testsuite/ld-frv/fdpic-shared-1.d
+++ b/ld/testsuite/ld-frv/fdpic-shared-1.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
358: 80 f4 00 10 setlo 0x10,gr0
35c: 80 f8 00 00 sethi hi\(0x0\),gr0
360: 80 40 ff f8 addi gr15,-8,gr0
- 364: 80 fc ff f8 setlos 0xfffffff8,gr0
+ 364: 80 fc ff f8 setlos 0xf*fffffff8,gr0
368: 80 f4 ff f8 setlo 0xfff8,gr0
36c: 80 f8 ff ff sethi 0xffff,gr0
370: 80 40 ff f0 addi gr15,-16,gr0
- 374: 80 fc ff f0 setlos 0xfffffff0,gr0
+ 374: 80 fc ff f0 setlos 0xf*fffffff0,gr0
378: 80 f4 ff f0 setlo 0xfff0,gr0
37c: 80 f8 ff ff sethi 0xffff,gr0
380: 80 f4 00 14 setlo 0x14,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-shared-2.d b/ld/testsuite/ld-frv/fdpic-shared-2.d
index 6cc589f..b517d7b 100644
--- a/ld/testsuite/ld-frv/fdpic-shared-2.d
+++ b/ld/testsuite/ld-frv/fdpic-shared-2.d
@@ -35,11 +35,11 @@ Disassembly of section \.text:
520: 80 f4 00 14 setlo 0x14,gr0
524: 80 f8 00 00 sethi hi\(0x0\),gr0
528: 80 40 ff f0 addi gr15,-16,gr0
- 52c: 80 fc ff e8 setlos 0xffffffe8,gr0
+ 52c: 80 fc ff e8 setlos 0xf*ffffffe8,gr0
530: 80 f4 ff e0 setlo 0xffe0,gr0
534: 80 f8 ff ff sethi 0xffff,gr0
538: 80 40 ff d8 addi gr15,-40,gr0
- 53c: 80 fc ff d8 setlos 0xffffffd8,gr0
+ 53c: 80 fc ff d8 setlos 0xf*ffffffd8,gr0
540: 80 f4 ff d8 setlo 0xffd8,gr0
544: 80 f8 ff ff sethi 0xffff,gr0
548: 80 f4 00 1c setlo 0x1c,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-shared-3.d b/ld/testsuite/ld-frv/fdpic-shared-3.d
index 638be7b..3c39d2c 100644
--- a/ld/testsuite/ld-frv/fdpic-shared-3.d
+++ b/ld/testsuite/ld-frv/fdpic-shared-3.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
3a8: 80 f4 00 14 setlo 0x14,gr0
3ac: 80 f8 00 00 sethi hi\(0x0\),gr0
3b0: 80 40 ff f8 addi gr15,-8,gr0
- 3b4: 80 fc ff e8 setlos 0xffffffe8,gr0
+ 3b4: 80 fc ff e8 setlos 0xf*ffffffe8,gr0
3b8: 80 f4 ff d8 setlo 0xffd8,gr0
3bc: 80 f8 ff ff sethi 0xffff,gr0
3c0: 80 40 ff c0 addi gr15,-64,gr0
- 3c4: 80 fc ff c0 setlos 0xffffffc0,gr0
+ 3c4: 80 fc ff c0 setlos 0xf*ffffffc0,gr0
3c8: 80 f4 ff c0 setlo 0xffc0,gr0
3cc: 80 f8 ff ff sethi 0xffff,gr0
3d0: 80 f4 00 24 setlo 0x24,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-shared-4.d b/ld/testsuite/ld-frv/fdpic-shared-4.d
index 5769e86..fa3a3c2 100644
--- a/ld/testsuite/ld-frv/fdpic-shared-4.d
+++ b/ld/testsuite/ld-frv/fdpic-shared-4.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
580: 80 f4 00 18 setlo 0x18,gr0
584: 80 f8 00 00 sethi hi\(0x0\),gr0
588: 80 40 ff f8 addi gr15,-8,gr0
- 58c: 80 fc ff f0 setlos 0xfffffff0,gr0
+ 58c: 80 fc ff f0 setlos 0xf*fffffff0,gr0
590: 80 f4 ff e8 setlo 0xffe8,gr0
594: 80 f8 ff ff sethi 0xffff,gr0
598: 80 40 ff e0 addi gr15,-32,gr0
- 59c: 80 fc ff e0 setlos 0xffffffe0,gr0
+ 59c: 80 fc ff e0 setlos 0xf*ffffffe0,gr0
5a0: 80 f4 ff e0 setlo 0xffe0,gr0
5a4: 80 f8 ff ff sethi 0xffff,gr0
5a8: 80 f4 00 14 setlo 0x14,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-shared-5.d b/ld/testsuite/ld-frv/fdpic-shared-5.d
index f7f9d31..33cbde3 100644
--- a/ld/testsuite/ld-frv/fdpic-shared-5.d
+++ b/ld/testsuite/ld-frv/fdpic-shared-5.d
@@ -33,7 +33,7 @@ Disassembly of section \.text:
4f0: 80 f4 00 18 setlo 0x18,gr0
4f4: 80 f8 00 00 sethi hi\(0x0\),gr0
4f8: 80 40 ff f8 addi gr15,-8,gr0
- 4fc: 80 fc ff e8 setlos 0xffffffe8,gr0
+ 4fc: 80 fc ff e8 setlos 0xf*ffffffe8,gr0
500: 80 f4 ff e0 setlo 0xffe0,gr0
504: 80 f8 ff ff sethi 0xffff,gr0
508: 80 f4 00 14 setlo 0x14,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-shared-6.d b/ld/testsuite/ld-frv/fdpic-shared-6.d
index 0d18336..03abbe7 100644
--- a/ld/testsuite/ld-frv/fdpic-shared-6.d
+++ b/ld/testsuite/ld-frv/fdpic-shared-6.d
@@ -33,7 +33,7 @@ Disassembly of section \.text:
3c4: 80 f4 00 1c setlo 0x1c,gr0
3c8: 80 f8 00 00 sethi hi\(0x0\),gr0
3cc: 80 40 ff f8 addi gr15,-8,gr0
- 3d0: 80 fc ff e8 setlos 0xffffffe8,gr0
+ 3d0: 80 fc ff e8 setlos 0xf*ffffffe8,gr0
3d4: 80 f4 ff e0 setlo 0xffe0,gr0
3d8: 80 f8 ff ff sethi 0xffff,gr0
3dc: 80 f4 ff d0 setlo 0xffd0,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-shared-7.d b/ld/testsuite/ld-frv/fdpic-shared-7.d
index 0a1464f..82218c3 100644
--- a/ld/testsuite/ld-frv/fdpic-shared-7.d
+++ b/ld/testsuite/ld-frv/fdpic-shared-7.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
358: 80 f4 00 10 setlo 0x10,gr0
35c: 80 f8 00 00 sethi hi\(0x0\),gr0
360: 80 40 ff f8 addi gr15,-8,gr0
- 364: 80 fc ff f8 setlos 0xfffffff8,gr0
+ 364: 80 fc ff f8 setlos 0xf*fffffff8,gr0
368: 80 f4 ff f8 setlo 0xfff8,gr0
36c: 80 f8 ff ff sethi 0xffff,gr0
370: 80 40 ff f4 addi gr15,-12,gr0
- 374: 80 fc ff f4 setlos 0xfffffff4,gr0
+ 374: 80 fc ff f4 setlos 0xf*fffffff4,gr0
378: 80 f4 ff f4 setlo 0xfff4,gr0
37c: 80 f8 ff ff sethi 0xffff,gr0
380: 80 f4 00 14 setlo 0x14,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-shared-8.d b/ld/testsuite/ld-frv/fdpic-shared-8.d
index a546165..292bba5 100644
--- a/ld/testsuite/ld-frv/fdpic-shared-8.d
+++ b/ld/testsuite/ld-frv/fdpic-shared-8.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
450: 80 f4 00 18 setlo 0x18,gr0
454: 80 f8 00 00 sethi hi\(0x0\),gr0
458: 80 40 ff f8 addi gr15,-8,gr0
- 45c: 80 fc ff f0 setlos 0xfffffff0,gr0
+ 45c: 80 fc ff f0 setlos 0xf*fffffff0,gr0
460: 80 f4 ff c8 setlo 0xffc8,gr0
464: 80 f8 ff ff sethi 0xffff,gr0
468: 80 40 ff c4 addi gr15,-60,gr0
- 46c: 80 fc ff c4 setlos 0xffffffc4,gr0
+ 46c: 80 fc ff c4 setlos 0xf*ffffffc4,gr0
470: 80 f4 ff c4 setlo 0xffc4,gr0
474: 80 f8 ff ff sethi 0xffff,gr0
478: 80 f4 00 20 setlo 0x20,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-shared-local-2.d b/ld/testsuite/ld-frv/fdpic-shared-local-2.d
index 67fa6d1..e18ced0 100644
--- a/ld/testsuite/ld-frv/fdpic-shared-local-2.d
+++ b/ld/testsuite/ld-frv/fdpic-shared-local-2.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
244: 80 f4 00 14 setlo 0x14,gr0
248: 80 f8 00 00 sethi hi\(0x0\),gr0
24c: 80 40 ff f8 addi gr15,-8,gr0
- 250: 80 fc ff d0 setlos 0xffffffd0,gr0
+ 250: 80 fc ff d0 setlos 0xf*ffffffd0,gr0
254: 80 f4 ff c8 setlo 0xffc8,gr0
258: 80 f8 ff ff sethi 0xffff,gr0
25c: 80 40 ff bc addi gr15,-68,gr0
- 260: 80 fc ff bc setlos 0xffffffbc,gr0
+ 260: 80 fc ff bc setlos 0xf*ffffffbc,gr0
264: 80 f4 ff bc setlo 0xffbc,gr0
268: 80 f8 ff ff sethi 0xffff,gr0
26c: 80 f4 00 1c setlo 0x1c,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-shared-local-8.d b/ld/testsuite/ld-frv/fdpic-shared-local-8.d
index b0aeec1..4c92b07 100644
--- a/ld/testsuite/ld-frv/fdpic-shared-local-8.d
+++ b/ld/testsuite/ld-frv/fdpic-shared-local-8.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
244: 80 f4 00 18 setlo 0x18,gr0
248: 80 f8 00 00 sethi hi\(0x0\),gr0
24c: 80 40 ff f8 addi gr15,-8,gr0
- 250: 80 fc ff f0 setlos 0xfffffff0,gr0
+ 250: 80 fc ff f0 setlos 0xf*fffffff0,gr0
254: 80 f4 ff c8 setlo 0xffc8,gr0
258: 80 f8 ff ff sethi 0xffff,gr0
25c: 80 40 ff c0 addi gr15,-64,gr0
- 260: 80 fc ff c0 setlos 0xffffffc0,gr0
+ 260: 80 fc ff c0 setlos 0xf*ffffffc0,gr0
264: 80 f4 ff c0 setlo 0xffc0,gr0
268: 80 f8 ff ff sethi 0xffff,gr0
26c: 80 f4 00 20 setlo 0x20,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-static-1.d b/ld/testsuite/ld-frv/fdpic-static-1.d
index dd3a498..7512144 100644
--- a/ld/testsuite/ld-frv/fdpic-static-1.d
+++ b/ld/testsuite/ld-frv/fdpic-static-1.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
100b0: 80 f4 00 10 setlo 0x10,gr0
100b4: 80 f8 00 00 sethi hi\(0x0\),gr0
100b8: 80 40 ff f8 addi gr15,-8,gr0
- 100bc: 80 fc ff f8 setlos 0xfffffff8,gr0
+ 100bc: 80 fc ff f8 setlos 0xf*fffffff8,gr0
100c0: 80 f4 ff f8 setlo 0xfff8,gr0
100c4: 80 f8 ff ff sethi 0xffff,gr0
100c8: 80 40 ff f0 addi gr15,-16,gr0
- 100cc: 80 fc ff f0 setlos 0xfffffff0,gr0
+ 100cc: 80 fc ff f0 setlos 0xf*fffffff0,gr0
100d0: 80 f4 ff f0 setlo 0xfff0,gr0
100d4: 80 f8 ff ff sethi 0xffff,gr0
100d8: 80 f4 00 14 setlo 0x14,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-static-2.d b/ld/testsuite/ld-frv/fdpic-static-2.d
index 26003b3..9b5a9c2 100644
--- a/ld/testsuite/ld-frv/fdpic-static-2.d
+++ b/ld/testsuite/ld-frv/fdpic-static-2.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
100b0: 80 f4 00 14 setlo 0x14,gr0
100b4: 80 f8 00 00 sethi hi\(0x0\),gr0
100b8: 80 40 ff f8 addi gr15,-8,gr0
- 100bc: 80 fc ff d0 setlos 0xffffffd0,gr0
+ 100bc: 80 fc ff d0 setlos 0xf*ffffffd0,gr0
100c0: 80 f4 ff c8 setlo 0xffc8,gr0
100c4: 80 f8 ff ff sethi 0xffff,gr0
100c8: 80 40 ff c0 addi gr15,-64,gr0
- 100cc: 80 fc ff c0 setlos 0xffffffc0,gr0
+ 100cc: 80 fc ff c0 setlos 0xf*ffffffc0,gr0
100d0: 80 f4 ff c0 setlo 0xffc0,gr0
100d4: 80 f8 ff ff sethi 0xffff,gr0
100d8: 80 f4 00 1c setlo 0x1c,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-static-6.d b/ld/testsuite/ld-frv/fdpic-static-6.d
index 54a225b..9615876 100644
--- a/ld/testsuite/ld-frv/fdpic-static-6.d
+++ b/ld/testsuite/ld-frv/fdpic-static-6.d
@@ -20,7 +20,7 @@ Disassembly of section \.text:
1001c: 80 f4 00 1c setlo 0x1c,gr0
10020: 80 f8 00 00 sethi hi\(0x0\),gr0
10024: 80 40 ff f8 addi gr15,-8,gr0
- 10028: 80 fc ff f0 setlos 0xfffffff0,gr0
+ 10028: 80 fc ff f0 setlos 0xf*fffffff0,gr0
1002c: 80 f4 ff e8 setlo 0xffe8,gr0
10030: 80 f8 ff ff sethi 0xffff,gr0
10034: 80 f4 ff 18 setlo 0xff18,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-static-7.d b/ld/testsuite/ld-frv/fdpic-static-7.d
index 0363a67..1f882c5 100644
--- a/ld/testsuite/ld-frv/fdpic-static-7.d
+++ b/ld/testsuite/ld-frv/fdpic-static-7.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
100b0: 80 f4 00 10 setlo 0x10,gr0
100b4: 80 f8 00 00 sethi hi\(0x0\),gr0
100b8: 80 40 ff f8 addi gr15,-8,gr0
- 100bc: 80 fc ff f8 setlos 0xfffffff8,gr0
+ 100bc: 80 fc ff f8 setlos 0xf*fffffff8,gr0
100c0: 80 f4 ff f8 setlo 0xfff8,gr0
100c4: 80 f8 ff ff sethi 0xffff,gr0
100c8: 80 40 ff f4 addi gr15,-12,gr0
- 100cc: 80 fc ff f4 setlos 0xfffffff4,gr0
+ 100cc: 80 fc ff f4 setlos 0xf*fffffff4,gr0
100d0: 80 f4 ff f4 setlo 0xfff4,gr0
100d4: 80 f8 ff ff sethi 0xffff,gr0
100d8: 80 f4 00 14 setlo 0x14,gr0
diff --git a/ld/testsuite/ld-frv/fdpic-static-8.d b/ld/testsuite/ld-frv/fdpic-static-8.d
index 804c56e..4f0deae 100644
--- a/ld/testsuite/ld-frv/fdpic-static-8.d
+++ b/ld/testsuite/ld-frv/fdpic-static-8.d
@@ -21,11 +21,11 @@ Disassembly of section \.text:
100b0: 80 f4 00 18 setlo 0x18,gr0
100b4: 80 f8 00 00 sethi hi\(0x0\),gr0
100b8: 80 40 ff f8 addi gr15,-8,gr0
- 100bc: 80 fc ff f0 setlos 0xfffffff0,gr0
+ 100bc: 80 fc ff f0 setlos 0xf*fffffff0,gr0
100c0: 80 f4 ff c8 setlo 0xffc8,gr0
100c4: 80 f8 ff ff sethi 0xffff,gr0
100c8: 80 40 ff c4 addi gr15,-60,gr0
- 100cc: 80 fc ff c4 setlos 0xffffffc4,gr0
+ 100cc: 80 fc ff c4 setlos 0xf*ffffffc4,gr0
100d0: 80 f4 ff c4 setlo 0xffc4,gr0
100d4: 80 f8 ff ff sethi 0xffff,gr0
100d8: 80 f4 00 20 setlo 0x20,gr0
diff --git a/ld/testsuite/ld-frv/fdpic.exp b/ld/testsuite/ld-frv/fdpic.exp
index cc43848..6cf3666 100644
--- a/ld/testsuite/ld-frv/fdpic.exp
+++ b/ld/testsuite/ld-frv/fdpic.exp
@@ -1,5 +1,5 @@
# Expect script for FRV FDPIC linker tests
-# Copyright 2003 Free Software Foundation, Inc.
+# Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,6 +20,10 @@ if {![istarget frv*-*-*] || ![is_elf_format]} {
return
}
+global ASFLAGS
+set saved_ASFLAGS "$ASFLAGS"
+set ASFLAGS "$ASFLAGS -mfdpic"
+
global LDFLAGS
set saved_LDFLAGS "$LDFLAGS"
set LDFLAGS "$LDFLAGS -melf32frvfd"
@@ -59,3 +63,4 @@ run_dump_test "fdpic-shared-8"
run_dump_test "fdpic-shared-local-8"
set LDFLAGS "$saved_LDFLAGS"
+set ASFLAGS "$saved_ASFLAGS"
diff --git a/ld/testsuite/ld-frv/tls-1-dep.s b/ld/testsuite/ld-frv/tls-1-dep.s
new file mode 100644
index 0000000..75daab7
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-1-dep.s
@@ -0,0 +1,7 @@
+ .section .tbss,"awT",@nobits
+ .align 4
+ .globl x
+ .type x, @tls_object
+ .size x, 4
+x:
+ .zero 4
diff --git a/ld/testsuite/ld-frv/tls-1-shared.lds b/ld/testsuite/ld-frv/tls-1-shared.lds
new file mode 100644
index 0000000..3769e01
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-1-shared.lds
@@ -0,0 +1,3 @@
+{
+ local: x; i;
+};
diff --git a/ld/testsuite/ld-frv/tls-1.s b/ld/testsuite/ld-frv/tls-1.s
new file mode 100644
index 0000000..a13c91b
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-1.s
@@ -0,0 +1,85 @@
+ .section .tbss,"awT",@nobits
+ .align 4
+ .globl i
+ .type i, @object
+ .size i, 4
+i:
+ .zero 4
+ .align 4
+ .type l, @object
+ .size l, 4
+l:
+ .zero 4
+ .text
+ .globl _start
+_start:
+ call #gettlsoff(x)
+
+ sethi.p #gottlsdeschi(x), gr14
+ setlo #gottlsdesclo(x), gr14
+ ldd #tlsdesc(x)@(gr15, gr14), gr8
+ calll #gettlsoff(x)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(x)), gr8
+ setlos #gottlsdesclo(x), gr14
+ calll #gettlsoff(x)@(gr8, gr0)
+
+ call #gettlsoff(i)
+
+ sethi.p #gottlsdeschi(i), gr14
+ setlo #gottlsdesclo(i), gr14
+ ldd #tlsdesc(i)@(gr15, gr14), gr8
+ calll #gettlsoff(i)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(i)), gr8
+ setlos #gottlsdesclo(i), gr14
+ calll #gettlsoff(i)@(gr8, gr0)
+
+ call #gettlsoff(l)
+
+ sethi.p #gottlsdeschi(l), gr14
+ setlo #gottlsdesclo(l), gr14
+ ldd #tlsdesc(l)@(gr15, gr14), gr8
+ calll #gettlsoff(l)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(l)), gr8
+ setlos #gottlsdesclo(l), gr14
+ calll #gettlsoff(l)@(gr8, gr0)
+
+ call #gettlsoff(0)
+
+ sethi.p #gottlsdeschi(0), gr14
+ setlo #gottlsdesclo(0), gr14
+ ldd #tlsdesc(0)@(gr15, gr14), gr8
+ calll #gettlsoff(0)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(0)), gr8
+ setlos #gottlsdesclo(0), gr14
+ calll #gettlsoff(0)@(gr8, gr0)
+
+ sethi.p #tlsmoffhi(l), gr8
+ setlo #tlsmofflo(l), gr8
+
+ sethi.p #tlsmoffhi(i), gr9
+ setlo #tlsmofflo(i), gr9
+
+ ldi @(gr15, #gottlsoff12(x)), gr9
+ ldi @(gr15, #gottlsoff12(i)), gr9
+ ldi @(gr15, #gottlsoff12(l)), gr9
+ ldi @(gr15, #gottlsoff12(0)), gr9
+
+ sethi.p #gottlsoffhi(x), gr14
+ setlo #gottlsofflo(x), gr14
+ ld #tlsoff(x)@(gr15, gr14), gr9
+
+ sethi.p #gottlsoffhi(i), gr14
+ setlo #gottlsofflo(i), gr14
+ ld #tlsoff(i)@(gr15, gr14), gr9
+
+ sethi.p #gottlsoffhi(l), gr14
+ setlo #gottlsofflo(l), gr14
+ ld #tlsoff(l)@(gr15, gr14), gr9
+
+ sethi.p #gottlsoffhi(0), gr14
+ setlo #gottlsofflo(0), gr14
+ ld #tlsoff(0)@(gr15, gr14), gr9
diff --git a/ld/testsuite/ld-frv/tls-2.s b/ld/testsuite/ld-frv/tls-2.s
new file mode 100644
index 0000000..f0712e3
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-2.s
@@ -0,0 +1,183 @@
+ .section .tbss,"awT",@nobits
+ .align 4
+ .type l, @object
+ .size l, 4
+l:
+ .zero 4
+ .align 4
+ .globl i
+ .type i, @object
+ .size i, 4
+i:
+ .zero 4
+ .text
+ .globl _start
+_start:
+ call #gettlsoff(l+1)
+ call #gettlsoff(l+1+4096)
+ call #gettlsoff(l+1+65536)
+
+ sethi.p #gottlsdeschi(l+2), gr14
+ setlo #gottlsdesclo(l+2), gr14
+ ldd #tlsdesc(l+2)@(gr15, gr14), gr8
+ calll #gettlsoff(l+2)@(gr8, gr0)
+
+ sethi.p #gottlsdeschi(l+2+4096), gr14
+ setlo #gottlsdesclo(l+2+4096), gr14
+ ldd #tlsdesc(l+2+4096)@(gr15, gr14), gr8
+ calll #gettlsoff(l+2+4096)@(gr8, gr0)
+
+ sethi.p #gottlsdeschi(l+2+65536), gr14
+ setlo #gottlsdesclo(l+2+65536), gr14
+ ldd #tlsdesc(l+2+65536)@(gr15, gr14), gr8
+ calll #gettlsoff(l+2+65536)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(l+3)), gr8
+ setlos #gottlsdesclo(l+3), gr14
+ calll #gettlsoff(l+3)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(l+3+4096)), gr8
+ setlos #gottlsdesclo(l+3+4096), gr14
+ calll #gettlsoff(l+3+4096)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(l+3+65536)), gr8
+ setlos #gottlsdesclo(l+3+65536), gr14
+ calll #gettlsoff(l+3+65536)@(gr8, gr0)
+
+ sethi #tlsmoffhi(l+4), gr9
+ setlo #tlsmofflo(l+4), gr9
+
+ sethi #tlsmoffhi(l+4+4096), gr9
+ setlo #tlsmofflo(l+4+4096), gr9
+
+ sethi #tlsmoffhi(l+4+65536), gr9
+ setlo #tlsmofflo(l+4+65536), gr9
+
+ call #gettlsoff(i+1)
+ call #gettlsoff(i+1+4096)
+ call #gettlsoff(i+1+65536)
+
+ sethi.p #gottlsdeschi(i+2), gr14
+ setlo #gottlsdesclo(i+2), gr14
+ ldd #tlsdesc(i+2)@(gr15, gr14), gr8
+ calll #gettlsoff(i+2)@(gr8, gr0)
+
+ sethi.p #gottlsdeschi(i+2+4096), gr14
+ setlo #gottlsdesclo(i+2+4096), gr14
+ ldd #tlsdesc(i+2+4096)@(gr15, gr14), gr8
+ calll #gettlsoff(i+2+4096)@(gr8, gr0)
+
+ sethi.p #gottlsdeschi(i+2+65536), gr14
+ setlo #gottlsdesclo(i+2+65536), gr14
+ ldd #tlsdesc(i+2+65536)@(gr15, gr14), gr8
+ calll #gettlsoff(i+2+65536)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(i+3)), gr8
+ setlos #gottlsdesclo(i+3), gr14
+ calll #gettlsoff(i+3)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(i+3+4096)), gr8
+ setlos #gottlsdesclo(i+3+4096), gr14
+ calll #gettlsoff(i+3+4096)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(i+3+65536)), gr8
+ setlos #gottlsdesclo(i+3+65536), gr14
+ calll #gettlsoff(i+3+65536)@(gr8, gr0)
+
+ sethi #tlsmoffhi(i+4), gr9
+ setlo #tlsmofflo(i+4), gr9
+
+ sethi #tlsmoffhi(i+4+4096), gr9
+ setlo #tlsmofflo(i+4+4096), gr9
+
+ sethi #tlsmoffhi(i+4+65536), gr9
+ setlo #tlsmofflo(i+4+65536), gr9
+
+ call #gettlsoff(0+1)
+ call #gettlsoff(0+1+4096)
+ call #gettlsoff(0+1+65536)
+
+ sethi.p #gottlsdeschi(0+2), gr14
+ setlo #gottlsdesclo(0+2), gr14
+ ldd #tlsdesc(0+2)@(gr15, gr14), gr8
+ calll #gettlsoff(0+2)@(gr8, gr0)
+
+ sethi.p #gottlsdeschi(0+2+4096), gr14
+ setlo #gottlsdesclo(0+2+4096), gr14
+ ldd #tlsdesc(0+2+4096)@(gr15, gr14), gr8
+ calll #gettlsoff(0+2+4096)@(gr8, gr0)
+
+ sethi.p #gottlsdeschi(0+2+65536), gr14
+ setlo #gottlsdesclo(0+2+65536), gr14
+ ldd #tlsdesc(0+2+65536)@(gr15, gr14), gr8
+ calll #gettlsoff(0+2+65536)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(0+3)), gr8
+ setlos #gottlsdesclo(0+3), gr14
+ calll #gettlsoff(0+3)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(0+3+4096)), gr8
+ setlos #gottlsdesclo(0+3+4096), gr14
+ calll #gettlsoff(0+3+4096)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(0+3+65536)), gr8
+ setlos #gottlsdesclo(0+3+65536), gr14
+ calll #gettlsoff(0+3+65536)@(gr8, gr0)
+
+ sethi #tlsmoffhi(0+4), gr9
+ setlo #tlsmofflo(0+4), gr9
+
+ sethi #tlsmoffhi(0+4+4096), gr9
+ setlo #tlsmofflo(0+4+4096), gr9
+
+ sethi #tlsmoffhi(0+4+65536), gr9
+ setlo #tlsmofflo(0+4+65536), gr9
+
+ call #gettlsoff(x+1)
+ call #gettlsoff(x+1+4096)
+ call #gettlsoff(x+1+65536)
+
+ sethi.p #gottlsdeschi(x+2), gr14
+ setlo #gottlsdesclo(x+2), gr14
+ ldd #tlsdesc(x+2)@(gr15, gr14), gr8
+ calll #gettlsoff(x+2)@(gr8, gr0)
+
+ sethi.p #gottlsdeschi(x+2+4096), gr14
+ setlo #gottlsdesclo(x+2+4096), gr14
+ ldd #tlsdesc(x+2+4096)@(gr15, gr14), gr8
+ calll #gettlsoff(x+2+4096)@(gr8, gr0)
+
+ sethi.p #gottlsdeschi(x+2+65536), gr14
+ setlo #gottlsdesclo(x+2+65536), gr14
+ ldd #tlsdesc(x+2+65536)@(gr15, gr14), gr8
+ calll #gettlsoff(x+2+65536)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(x+3)), gr8
+ setlos #gottlsdesclo(x+3), gr14
+ calll #gettlsoff(x+3)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(x+3+4096)), gr8
+ setlos #gottlsdesclo(x+3+4096), gr14
+ calll #gettlsoff(x+3+4096)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(x+3+65536)), gr8
+ setlos #gottlsdesclo(x+3+65536), gr14
+ calll #gettlsoff(x+3+65536)@(gr8, gr0)
+
+.ifdef static_tls
+ ldi @(gr15, #gottlsoff12(l+1)), gr9
+ ldi @(gr15, #gottlsoff12(l+1+65536)), gr9
+ ldi @(gr15, #gottlsoff12(i+1)), gr9
+ ldi @(gr15, #gottlsoff12(i+1+65536)), gr9
+ ldi @(gr15, #gottlsoff12(0+1)), gr9
+ ldi @(gr15, #gottlsoff12(0+1+65536)), gr9
+ ldi @(gr15, #gottlsoff12(x+1)), gr9
+ ldi @(gr15, #gottlsoff12(x+1+65536)), gr9
+
+ setlos #gottlsofflo(l+1+4096), gr8
+ ld #tlsoff(l+1+4096)@(gr15, gr8), gr9
+
+ sethi #gottlsoffhi(i+1+4096), gr8
+ setlo #gottlsofflo(i+1+4096), gr8
+ ld #tlsoff(i+1+4096)@(gr15, gr8), gr9
+.endif
diff --git a/ld/testsuite/ld-frv/tls-3.s b/ld/testsuite/ld-frv/tls-3.s
new file mode 100644
index 0000000..6dd7972
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-3.s
@@ -0,0 +1,20 @@
+ .text
+ .weak u
+ .globl _start
+_start:
+ call #gettlsoff(u)
+
+ sethi.p #gottlsdeschi(u), gr14
+ setlo #gottlsdesclo(u), gr14
+ ldd #tlsdesc(u)@(gr15, gr14), gr8
+ calll #gettlsoff(u)@(gr8, gr0)
+
+ lddi.p @(gr15, #gottlsdesc12(u)), gr8
+ setlos #gottlsdesclo(u), gr14
+ calll #gettlsoff(u)@(gr8, gr0)
+
+ ldi @(gr15, #gottlsoff12(u)), gr9
+
+ sethi.p #gottlsoffhi(u), gr14
+ setlo #gottlsofflo(u), gr14
+ ld #tlsoff(u)@(gr15, gr14), gr9
diff --git a/ld/testsuite/ld-frv/tls-dynamic-1.d b/ld/testsuite/ld-frv/tls-dynamic-1.d
new file mode 100644
index 0000000..27075d5
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-dynamic-1.d
@@ -0,0 +1,71 @@
+#name: FRV TLS relocs, dynamic linking
+#source: tls-1.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: tmpdir/tls-1-dep.so
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+000102c8 <_start>:
+ 102c8: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 102cc: 00 88 00 00 nop\.p
+ 102d0: 80 88 00 00 nop
+ 102d4: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 102d8: 80 88 00 00 nop
+ 102dc: 12 c8 f0 10 ldi\.p @\(gr15,16\),gr9
+ 102e0: 80 88 00 00 nop
+ 102e4: 80 88 00 00 nop
+ 102e8: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 102ec: 00 88 00 00 nop\.p
+ 102f0: 80 88 00 00 nop
+ 102f4: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 102f8: 80 88 00 00 nop
+ 102fc: 12 fc f8 10 setlos\.p 0xf*fffff810,gr9
+ 10300: 80 88 00 00 nop
+ 10304: 80 88 00 00 nop
+ 10308: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 1030c: 00 88 00 00 nop\.p
+ 10310: 80 88 00 00 nop
+ 10314: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 10318: 80 88 00 00 nop
+ 1031c: 12 fc f8 20 setlos\.p 0xf*fffff820,gr9
+ 10320: 80 88 00 00 nop
+ 10324: 80 88 00 00 nop
+ 10328: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 1032c: 00 88 00 00 nop\.p
+ 10330: 80 88 00 00 nop
+ 10334: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 10338: 80 88 00 00 nop
+ 1033c: 12 fc 00 00 setlos\.p lo\(0x0\),gr9
+ 10340: 80 88 00 00 nop
+ 10344: 80 88 00 00 nop
+ 10348: 00 88 00 00 nop\.p
+ 1034c: 90 fc f8 20 setlos 0xf*fffff820,gr8
+ 10350: 00 88 00 00 nop\.p
+ 10354: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 10358: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 1035c: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 10360: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 10364: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 10368: 00 88 00 00 nop\.p
+ 1036c: 80 88 00 00 nop
+ 10370: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 10374: 00 88 00 00 nop\.p
+ 10378: 80 88 00 00 nop
+ 1037c: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 10380: 00 88 00 00 nop\.p
+ 10384: 80 88 00 00 nop
+ 10388: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 1038c: 00 88 00 00 nop\.p
+ 10390: 80 88 00 00 nop
+ 10394: 92 fc 00 00 setlos lo\(0x0\),gr9
+Disassembly of section \.got:
+
+00014428 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 14434: ff ff f8 20 cop2 -32,cpr63,cpr32,cpr63
+ 14438: 00 00 00 00 add\.p gr0,gr0,gr0
+ 14438: R_FRV_TLSOFF x
+ 1443c: ff ff f8 10 cop2 -32,cpr63,cpr16,cpr63
+ 14440: 00 00 00 00 add\.p gr0,gr0,gr0
diff --git a/ld/testsuite/ld-frv/tls-dynamic-2.d b/ld/testsuite/ld-frv/tls-dynamic-2.d
new file mode 100644
index 0000000..986789c
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-dynamic-2.d
@@ -0,0 +1,200 @@
+#name: FRV TLS relocs with addends, dynamic linking
+#source: tls-2.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: tmpdir/tls-1-dep.so
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.plt:
+
+00010308 <\.plt>:
+ 10308: c0 3a 40 00 bralr
+ 1030c: 92 fc 08 21 setlos 0x821,gr9
+ 10310: c0 3a 40 00 bralr
+ 10314: 12 f8 00 00 sethi\.p hi\(0x0\),gr9
+ 10318: 92 f4 f8 21 setlo 0xf821,gr9
+ 1031c: c0 3a 40 00 bralr
+ 10320: 92 fc 00 01 setlos 0x1,gr9
+ 10324: c0 3a 40 00 bralr
+ 10328: 92 c8 ff bc ldi @\(gr15,-68\),gr9
+ 1032c: c0 3a 40 00 bralr
+ 10330: 92 fc f8 11 setlos 0xf*fffff811,gr9
+ 10334: c0 3a 40 00 bralr
+ 10338: 92 fc 10 01 setlos 0x1001,gr9
+ 1033c: c0 3a 40 00 bralr
+ 10340: 92 c8 ff d4 ldi @\(gr15,-44\),gr9
+ 10344: c0 3a 40 00 bralr
+ 10348: 92 fc 08 11 setlos 0x811,gr9
+ 1034c: c0 3a 40 00 bralr
+ 10350: 12 f8 00 01 sethi\.p 0x1,gr9
+ 10354: 92 f4 00 01 setlo 0x1,gr9
+ 10358: c0 3a 40 00 bralr
+ 1035c: 92 c8 ff ec ldi @\(gr15,-20\),gr9
+ 10360: c0 3a 40 00 bralr
+ 10364: 12 f8 00 00 sethi\.p hi\(0x0\),gr9
+ 10368: 92 f4 f8 11 setlo 0xf811,gr9
+ 1036c: c0 3a 40 00 bralr
+ 10370: 92 fc f8 21 setlos 0xf*fffff821,gr9
+ 10374: c0 3a 40 00 bralr
+Disassembly of section \.text:
+
+00010378 <_start>:
+ 10378: 92 fc f8 11 setlos 0xf*fffff811,gr9
+ 1037c: 92 fc 08 11 setlos 0x811,gr9
+ 10380: 92 c8 ff f4 ldi @\(gr15,-12\),gr9
+ 10384: 00 88 00 00 nop\.p
+ 10388: 80 88 00 00 nop
+ 1038c: 92 fc f8 12 setlos 0xf*fffff812,gr9
+ 10390: 80 88 00 00 nop
+ 10394: 00 88 00 00 nop\.p
+ 10398: 80 88 00 00 nop
+ 1039c: 92 fc 08 12 setlos 0x812,gr9
+ 103a0: 80 88 00 00 nop
+ 103a4: 00 88 00 00 nop\.p
+ 103a8: 80 88 00 00 nop
+ 103ac: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 103b0: 92 f4 f8 12 setlo 0xf812,gr9
+ 103b4: 12 fc f8 13 setlos\.p 0xf*fffff813,gr9
+ 103b8: 80 88 00 00 nop
+ 103bc: 80 88 00 00 nop
+ 103c0: 12 fc 08 13 setlos\.p 0x813,gr9
+ 103c4: 80 88 00 00 nop
+ 103c8: 80 88 00 00 nop
+ 103cc: 12 f8 00 00 sethi\.p hi\(0x0\),gr9
+ 103d0: 80 88 00 00 nop
+ 103d4: 92 f4 f8 13 setlo 0xf813,gr9
+ 103d8: 80 88 00 00 nop
+ 103dc: 92 fc f8 14 setlos 0xf*fffff814,gr9
+ 103e0: 80 88 00 00 nop
+ 103e4: 92 fc 08 14 setlos 0x814,gr9
+ 103e8: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 103ec: 92 f4 f8 14 setlo 0xf814,gr9
+ 103f0: 92 fc f8 21 setlos 0xf*fffff821,gr9
+ 103f4: 92 fc 08 21 setlos 0x821,gr9
+ 103f8: 92 c8 ff ac ldi @\(gr15,-84\),gr9
+ 103fc: 00 88 00 00 nop\.p
+ 10400: 80 88 00 00 nop
+ 10404: 92 fc f8 22 setlos 0xf*fffff822,gr9
+ 10408: 80 88 00 00 nop
+ 1040c: 00 88 00 00 nop\.p
+ 10410: 80 88 00 00 nop
+ 10414: 92 fc 08 22 setlos 0x822,gr9
+ 10418: 80 88 00 00 nop
+ 1041c: 00 88 00 00 nop\.p
+ 10420: 80 88 00 00 nop
+ 10424: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 10428: 92 f4 f8 22 setlo 0xf822,gr9
+ 1042c: 12 fc f8 23 setlos\.p 0xf*fffff823,gr9
+ 10430: 80 88 00 00 nop
+ 10434: 80 88 00 00 nop
+ 10438: 12 fc 08 23 setlos\.p 0x823,gr9
+ 1043c: 80 88 00 00 nop
+ 10440: 80 88 00 00 nop
+ 10444: 12 f8 00 00 sethi\.p hi\(0x0\),gr9
+ 10448: 80 88 00 00 nop
+ 1044c: 92 f4 f8 23 setlo 0xf823,gr9
+ 10450: 80 88 00 00 nop
+ 10454: 92 fc f8 24 setlos 0xf*fffff824,gr9
+ 10458: 80 88 00 00 nop
+ 1045c: 92 fc 08 24 setlos 0x824,gr9
+ 10460: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 10464: 92 f4 f8 24 setlo 0xf824,gr9
+ 10468: 92 fc 00 01 setlos 0x1,gr9
+ 1046c: 92 fc 10 01 setlos 0x1001,gr9
+ 10470: 92 c8 ff e4 ldi @\(gr15,-28\),gr9
+ 10474: 00 88 00 00 nop\.p
+ 10478: 80 88 00 00 nop
+ 1047c: 92 fc 00 02 setlos 0x2,gr9
+ 10480: 80 88 00 00 nop
+ 10484: 00 88 00 00 nop\.p
+ 10488: 80 88 00 00 nop
+ 1048c: 92 fc 10 02 setlos 0x1002,gr9
+ 10490: 80 88 00 00 nop
+ 10494: 00 88 00 00 nop\.p
+ 10498: 80 88 00 00 nop
+ 1049c: 92 f8 00 01 sethi 0x1,gr9
+ 104a0: 92 f4 00 02 setlo 0x2,gr9
+ 104a4: 12 fc 00 03 setlos\.p 0x3,gr9
+ 104a8: 80 88 00 00 nop
+ 104ac: 80 88 00 00 nop
+ 104b0: 12 fc 10 03 setlos\.p 0x1003,gr9
+ 104b4: 80 88 00 00 nop
+ 104b8: 80 88 00 00 nop
+ 104bc: 12 f8 00 01 sethi\.p 0x1,gr9
+ 104c0: 80 88 00 00 nop
+ 104c4: 92 f4 00 03 setlo 0x3,gr9
+ 104c8: 80 88 00 00 nop
+ 104cc: 92 fc 00 04 setlos 0x4,gr9
+ 104d0: 80 88 00 00 nop
+ 104d4: 92 fc 10 04 setlos 0x1004,gr9
+ 104d8: 92 f8 00 01 sethi 0x1,gr9
+ 104dc: 92 f4 00 04 setlo 0x4,gr9
+ 104e0: 92 c8 ff bc ldi @\(gr15,-68\),gr9
+ 104e4: 92 c8 ff d4 ldi @\(gr15,-44\),gr9
+ 104e8: 92 c8 ff ec ldi @\(gr15,-20\),gr9
+ 104ec: 00 88 00 00 nop\.p
+ 104f0: 80 88 00 00 nop
+ 104f4: 92 c8 f0 20 ldi @\(gr15,32\),gr9
+ 104f8: 80 88 00 00 nop
+ 104fc: 00 88 00 00 nop\.p
+ 10500: 80 88 00 00 nop
+ 10504: 92 c8 f0 1c ldi @\(gr15,28\),gr9
+ 10508: 80 88 00 00 nop
+ 1050c: 00 88 00 00 nop\.p
+ 10510: 80 88 00 00 nop
+ 10514: 92 c8 f0 18 ldi @\(gr15,24\),gr9
+ 10518: 80 88 00 00 nop
+ 1051c: 12 c8 f0 0c ldi\.p @\(gr15,12\),gr9
+ 10520: 80 88 00 00 nop
+ 10524: 80 88 00 00 nop
+ 10528: 12 c8 f0 10 ldi\.p @\(gr15,16\),gr9
+ 1052c: 80 88 00 00 nop
+ 10530: 80 88 00 00 nop
+ 10534: 12 c8 f0 14 ldi\.p @\(gr15,20\),gr9
+ 10538: 80 88 00 00 nop
+ 1053c: 80 88 00 00 nop
+Disassembly of section \.got:
+
+000145f8 <_GLOBAL_OFFSET_TABLE_-0x60>:
+ 145f8: 00 01 03 08 cmpb\.p gr16,gr8,icc0
+ 145fc: 00 00 08 21 \*unknown\*
+ 14600: 00 01 03 08 cmpb\.p gr16,gr8,icc0
+ 14604: 00 00 f8 21 \*unknown\*
+ 14608: 00 01 03 08 cmpb\.p gr16,gr8,icc0
+ 1460c: 00 00 00 01 add\.p gr0,sp,gr0
+ 14610: 00 00 00 00 add\.p gr0,gr0,gr0
+ 14610: R_FRV_TLSDESC_VALUE x
+ 14614: 00 00 00 01 add\.p gr0,sp,gr0
+ 14618: 00 01 03 08 cmpb\.p gr16,gr8,icc0
+ 1461c: ff ff f8 11 cop2 -32,cpr63,cpr17,cpr63
+ 14620: 00 01 03 08 cmpb\.p gr16,gr8,icc0
+ 14624: 00 00 10 01 add\.p sp,sp,gr0
+ 14628: 00 00 00 00 add\.p gr0,gr0,gr0
+ 14628: R_FRV_TLSDESC_VALUE x
+ 1462c: 00 00 10 01 add\.p sp,sp,gr0
+ 14630: 00 01 03 08 cmpb\.p gr16,gr8,icc0
+ 14634: 00 00 08 11 \*unknown\*
+ 14638: 00 01 03 08 cmpb\.p gr16,gr8,icc0
+ 1463c: 00 01 00 01 add\.p gr16,sp,gr0
+ 14640: 00 00 00 00 add\.p gr0,gr0,gr0
+ 14640: R_FRV_TLSDESC_VALUE x
+ 14644: 00 01 00 01 add\.p gr16,sp,gr0
+ 14648: 00 01 03 08 cmpb\.p gr16,gr8,icc0
+ 1464c: 00 00 f8 11 \*unknown\*
+ 14650: 00 01 03 08 cmpb\.p gr16,gr8,icc0
+ 14654: ff ff f8 21 cop2 -32,cpr63,cpr33,cpr63
+
+00014658 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 14664: 00 00 00 03 add\.p gr0,gr3,gr0
+ 14664: R_FRV_TLSOFF x
+ 14668: 00 00 10 03 add\.p sp,gr3,gr0
+ 14668: R_FRV_TLSOFF x
+ 1466c: 00 01 00 03 add\.p gr16,gr3,gr0
+ 1466c: R_FRV_TLSOFF x
+ 14670: 00 01 00 02 add\.p gr16,fp,gr0
+ 14670: R_FRV_TLSOFF x
+ 14674: 00 00 10 02 add\.p sp,fp,gr0
+ 14674: R_FRV_TLSOFF x
+ 14678: 00 00 00 02 add\.p gr0,fp,gr0
+ 14678: R_FRV_TLSOFF x
diff --git a/ld/testsuite/ld-frv/tls-dynamic-3.d b/ld/testsuite/ld-frv/tls-dynamic-3.d
new file mode 100644
index 0000000..f4d3337
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-dynamic-3.d
@@ -0,0 +1,27 @@
+#name: FRV TLS undefweak relocs, dynamic linking
+#source: tls-3.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: tmpdir/tls-1-dep.so
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+00010294 <_start>:
+ 10294: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 10298: 00 88 00 00 nop\.p
+ 1029c: 80 88 00 00 nop
+ 102a0: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 102a4: 80 88 00 00 nop
+ 102a8: 12 c8 f0 0c ldi\.p @\(gr15,12\),gr9
+ 102ac: 80 88 00 00 nop
+ 102b0: 80 88 00 00 nop
+ 102b4: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 102b8: 00 88 00 00 nop\.p
+ 102bc: 80 88 00 00 nop
+ 102c0: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+Disassembly of section \.got:
+
+00014350 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 1435c: R_FRV_TLSOFF u
diff --git a/ld/testsuite/ld-frv/tls-initial-shared-2.d b/ld/testsuite/ld-frv/tls-initial-shared-2.d
new file mode 100644
index 0000000..3d276db
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-initial-shared-2.d
@@ -0,0 +1,235 @@
+#name: FRV TLS relocs with addends, shared linking with static TLS
+#source: tls-2.s
+#as: --defsym static_tls=1
+#objdump: -DR -j .text -j .got -j .plt
+#ld: -shared tmpdir/tls-1-dep.so --version-script tls-1-shared.lds
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.plt:
+
+00000464 <\.plt>:
+ 464: 92 c8 f0 5c ldi @\(gr15,92\),gr9
+ 468: c0 3a 40 00 bralr
+ 46c: 90 cc ff e8 lddi @\(gr15,-24\),gr8
+ 470: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 474: 92 c8 f0 78 ldi @\(gr15,120\),gr9
+ 478: c0 3a 40 00 bralr
+ 47c: 90 cc ff f8 lddi @\(gr15,-8\),gr8
+ 480: 80 30 80 00 jmpl @\(gr8,gr0\)
+Disassembly of section \.text:
+
+00000484 <_start>:
+ 484: 92 c8 f0 30 ldi @\(gr15,48\),gr9
+ 488: 92 c8 f0 78 ldi @\(gr15,120\),gr9
+ 48c: 92 c8 f0 4c ldi @\(gr15,76\),gr9
+ 490: 00 88 00 00 nop\.p
+ 494: 80 88 00 00 nop
+ 498: 92 c8 f0 70 ldi @\(gr15,112\),gr9
+ 49c: 80 88 00 00 nop
+ 4a0: 00 88 00 00 nop\.p
+ 4a4: 80 88 00 00 nop
+ 4a8: 92 c8 f0 7c ldi @\(gr15,124\),gr9
+ 4ac: 80 88 00 00 nop
+ 4b0: 00 88 00 00 nop\.p
+ 4b4: 80 88 00 00 nop
+ 4b8: 92 c8 f0 8c ldi @\(gr15,140\),gr9
+ 4bc: 80 88 00 00 nop
+ 4c0: 12 c8 f0 34 ldi\.p @\(gr15,52\),gr9
+ 4c4: 80 88 00 00 nop
+ 4c8: 80 88 00 00 nop
+ 4cc: 12 c8 f0 3c ldi\.p @\(gr15,60\),gr9
+ 4d0: 80 88 00 00 nop
+ 4d4: 80 88 00 00 nop
+ 4d8: 12 c8 f0 50 ldi\.p @\(gr15,80\),gr9
+ 4dc: 80 88 00 00 nop
+ 4e0: 80 88 00 00 nop
+ 4e4: 80 88 00 00 nop
+ 4e8: 92 fc f8 14 setlos 0xf*fffff814,gr9
+ 4ec: 80 88 00 00 nop
+ 4f0: 92 fc 08 14 setlos 0x814,gr9
+ 4f4: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 4f8: 92 f4 f8 14 setlo 0xf814,gr9
+ 4fc: 92 c8 f0 54 ldi @\(gr15,84\),gr9
+ 500: 92 c8 f0 5c ldi @\(gr15,92\),gr9
+ 504: 92 c8 f0 18 ldi @\(gr15,24\),gr9
+ 508: 00 88 00 00 nop\.p
+ 50c: 80 88 00 00 nop
+ 510: 92 c8 f0 90 ldi @\(gr15,144\),gr9
+ 514: 80 88 00 00 nop
+ 518: 00 88 00 00 nop\.p
+ 51c: 80 88 00 00 nop
+ 520: 92 c8 f0 60 ldi @\(gr15,96\),gr9
+ 524: 80 88 00 00 nop
+ 528: 00 88 00 00 nop\.p
+ 52c: 80 88 00 00 nop
+ 530: 92 c8 f0 64 ldi @\(gr15,100\),gr9
+ 534: 80 88 00 00 nop
+ 538: 12 c8 f0 58 ldi\.p @\(gr15,88\),gr9
+ 53c: 80 88 00 00 nop
+ 540: 80 88 00 00 nop
+ 544: 12 c8 f0 0c ldi\.p @\(gr15,12\),gr9
+ 548: 80 88 00 00 nop
+ 54c: 80 88 00 00 nop
+ 550: 12 c8 f0 1c ldi\.p @\(gr15,28\),gr9
+ 554: 80 88 00 00 nop
+ 558: 80 88 00 00 nop
+ 55c: 80 88 00 00 nop
+ 560: 92 fc f8 24 setlos 0xf*fffff824,gr9
+ 564: 80 88 00 00 nop
+ 568: 92 fc 08 24 setlos 0x824,gr9
+ 56c: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 570: 92 f4 f8 24 setlo 0xf824,gr9
+ 574: 92 c8 f0 24 ldi @\(gr15,36\),gr9
+ 578: fe 3f ff c1 call 47c <i\+0x46c>
+ 57c: 92 c8 f0 40 ldi @\(gr15,64\),gr9
+ 580: 00 88 00 00 nop\.p
+ 584: 80 88 00 00 nop
+ 588: 92 c8 f0 68 ldi @\(gr15,104\),gr9
+ 58c: 80 88 00 00 nop
+ 590: 00 88 00 00 nop\.p
+ 594: 80 88 00 00 nop
+ 598: 92 c8 f0 80 ldi @\(gr15,128\),gr9
+ 59c: 80 88 00 00 nop
+ 5a0: 00 88 00 00 nop\.p
+ 5a4: 80 88 00 00 nop
+ 5a8: 92 c8 f0 84 ldi @\(gr15,132\),gr9
+ 5ac: 80 88 00 00 nop
+ 5b0: 12 c8 f0 28 ldi\.p @\(gr15,40\),gr9
+ 5b4: 80 88 00 00 nop
+ 5b8: 80 88 00 00 nop
+ 5bc: 12 c8 f0 38 ldi\.p @\(gr15,56\),gr9
+ 5c0: 80 88 00 00 nop
+ 5c4: 80 88 00 00 nop
+ 5c8: 12 c8 f0 44 ldi\.p @\(gr15,68\),gr9
+ 5cc: 80 88 00 00 nop
+ 5d0: 80 88 00 00 nop
+ 5d4: 80 88 00 00 nop
+ 5d8: 92 fc 00 04 setlos 0x4,gr9
+ 5dc: 80 88 00 00 nop
+ 5e0: 92 fc 10 04 setlos 0x1004,gr9
+ 5e4: 92 f8 00 01 sethi 0x1,gr9
+ 5e8: 92 f4 00 04 setlo 0x4,gr9
+ 5ec: 92 c8 f0 2c ldi @\(gr15,44\),gr9
+ 5f0: fe 3f ff 9f call 46c <i\+0x45c>
+ 5f4: 92 c8 f0 48 ldi @\(gr15,72\),gr9
+ 5f8: 00 88 00 00 nop\.p
+ 5fc: 80 88 00 00 nop
+ 600: 92 c8 f0 6c ldi @\(gr15,108\),gr9
+ 604: 80 88 00 00 nop
+ 608: 00 88 00 00 nop\.p
+ 60c: 80 88 00 00 nop
+ 610: 92 c8 f0 74 ldi @\(gr15,116\),gr9
+ 614: 80 88 00 00 nop
+ 618: 00 88 00 00 nop\.p
+ 61c: 80 88 00 00 nop
+ 620: 92 c8 f0 88 ldi @\(gr15,136\),gr9
+ 624: 80 88 00 00 nop
+ 628: 12 c8 f0 10 ldi\.p @\(gr15,16\),gr9
+ 62c: 80 88 00 00 nop
+ 630: 80 88 00 00 nop
+ 634: 12 c8 f0 14 ldi\.p @\(gr15,20\),gr9
+ 638: 80 88 00 00 nop
+ 63c: 80 88 00 00 nop
+ 640: 12 c8 f0 20 ldi\.p @\(gr15,32\),gr9
+ 644: 80 88 00 00 nop
+ 648: 80 88 00 00 nop
+ 64c: 92 c8 f0 30 ldi @\(gr15,48\),gr9
+ 650: 92 c8 f0 4c ldi @\(gr15,76\),gr9
+ 654: 92 c8 f0 54 ldi @\(gr15,84\),gr9
+ 658: 92 c8 f0 18 ldi @\(gr15,24\),gr9
+ 65c: 92 c8 f0 24 ldi @\(gr15,36\),gr9
+ 660: 92 c8 f0 40 ldi @\(gr15,64\),gr9
+ 664: 92 c8 f0 2c ldi @\(gr15,44\),gr9
+ 668: 92 c8 f0 48 ldi @\(gr15,72\),gr9
+ 66c: 80 88 00 00 nop
+ 670: 92 c8 f0 78 ldi @\(gr15,120\),gr9
+ 674: 80 88 00 00 nop
+ 678: 80 88 00 00 nop
+ 67c: 92 c8 f0 5c ldi @\(gr15,92\),gr9
+Disassembly of section \.got:
+
+00004718 <_GLOBAL_OFFSET_TABLE_-0x20>:
+ 4718: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4718: R_FRV_TLSDESC_VALUE \.tbss
+ 471c: 00 00 10 11 add\.p sp,gr17,gr0
+ 4720: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4720: R_FRV_TLSDESC_VALUE x
+ 4724: 00 00 10 01 add\.p sp,sp,gr0
+ 4728: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4728: R_FRV_TLSDESC_VALUE \.tbss
+ 472c: 00 00 10 01 add\.p sp,sp,gr0
+ 4730: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4730: R_FRV_TLSDESC_VALUE \.tbss
+ 4734: 00 00 17 f1 \*unknown\*
+
+00004738 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 4744: 00 00 10 13 add\.p sp,gr19,gr0
+ 4744: R_FRV_TLSOFF \.tbss
+ 4748: 00 00 00 03 add\.p gr0,gr3,gr0
+ 4748: R_FRV_TLSOFF x
+ 474c: 00 00 10 03 add\.p sp,gr3,gr0
+ 474c: R_FRV_TLSOFF x
+ 4750: 00 01 00 11 add\.p gr16,gr17,gr0
+ 4750: R_FRV_TLSOFF \.tbss
+ 4754: 00 01 00 13 add\.p gr16,gr19,gr0
+ 4754: R_FRV_TLSOFF \.tbss
+ 4758: 00 01 00 03 add\.p gr16,gr3,gr0
+ 4758: R_FRV_TLSOFF x
+ 475c: 00 00 07 f1 \*unknown\*
+ 475c: R_FRV_TLSOFF \.tbss
+ 4760: 00 00 07 f3 \*unknown\*
+ 4760: R_FRV_TLSOFF \.tbss
+ 4764: 00 00 00 01 add\.p gr0,sp,gr0
+ 4764: R_FRV_TLSOFF x
+ 4768: 00 00 00 01 add\.p gr0,sp,gr0
+ 4768: R_FRV_TLSOFF \.tbss
+ 476c: 00 00 00 03 add\.p gr0,gr3,gr0
+ 476c: R_FRV_TLSOFF \.tbss
+ 4770: 00 00 17 f3 \*unknown\*
+ 4770: R_FRV_TLSOFF \.tbss
+ 4774: 00 00 10 03 add\.p sp,gr3,gr0
+ 4774: R_FRV_TLSOFF \.tbss
+ 4778: 00 01 07 f1 \*unknown\*
+ 4778: R_FRV_TLSOFF \.tbss
+ 477c: 00 01 07 f3 \*unknown\*
+ 477c: R_FRV_TLSOFF \.tbss
+ 4780: 00 01 00 01 add\.p gr16,sp,gr0
+ 4780: R_FRV_TLSOFF x
+ 4784: 00 01 00 01 add\.p gr16,sp,gr0
+ 4784: R_FRV_TLSOFF \.tbss
+ 4788: 00 01 00 03 add\.p gr16,gr3,gr0
+ 4788: R_FRV_TLSOFF \.tbss
+ 478c: 00 00 00 11 add\.p gr0,gr17,gr0
+ 478c: R_FRV_TLSOFF \.tbss
+ 4790: 00 00 00 13 add\.p gr0,gr19,gr0
+ 4790: R_FRV_TLSOFF \.tbss
+ 4794: 00 00 10 11 add\.p sp,gr17,gr0
+ 4794: R_FRV_TLSOFF \.tbss
+ 4798: 00 00 10 12 add\.p sp,gr18,gr0
+ 4798: R_FRV_TLSOFF \.tbss
+ 479c: 00 01 00 12 add\.p gr16,gr18,gr0
+ 479c: R_FRV_TLSOFF \.tbss
+ 47a0: 00 00 07 f2 \*unknown\*
+ 47a0: R_FRV_TLSOFF \.tbss
+ 47a4: 00 00 00 02 add\.p gr0,fp,gr0
+ 47a4: R_FRV_TLSOFF x
+ 47a8: 00 00 00 02 add\.p gr0,fp,gr0
+ 47a8: R_FRV_TLSOFF \.tbss
+ 47ac: 00 00 10 02 add\.p sp,fp,gr0
+ 47ac: R_FRV_TLSOFF x
+ 47b0: 00 00 10 01 add\.p sp,sp,gr0
+ 47b0: R_FRV_TLSOFF \.tbss
+ 47b4: 00 00 10 02 add\.p sp,fp,gr0
+ 47b4: R_FRV_TLSOFF \.tbss
+ 47b8: 00 00 17 f2 \*unknown\*
+ 47b8: R_FRV_TLSOFF \.tbss
+ 47bc: 00 01 07 f2 \*unknown\*
+ 47bc: R_FRV_TLSOFF \.tbss
+ 47c0: 00 01 00 02 add\.p gr16,fp,gr0
+ 47c0: R_FRV_TLSOFF x
+ 47c4: 00 01 00 02 add\.p gr16,fp,gr0
+ 47c4: R_FRV_TLSOFF \.tbss
+ 47c8: 00 00 00 12 add\.p gr0,gr18,gr0
+ 47c8: R_FRV_TLSOFF \.tbss
diff --git a/ld/testsuite/ld-frv/tls-pie-1.d b/ld/testsuite/ld-frv/tls-pie-1.d
new file mode 100644
index 0000000..5e4b6a1
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-pie-1.d
@@ -0,0 +1,71 @@
+#name: FRV TLS relocs, pie linking
+#source: tls-1.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: -pie tmpdir/tls-1-dep.so
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+000003a0 <_start>:
+ 3a0: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 3a4: 00 88 00 00 nop\.p
+ 3a8: 80 88 00 00 nop
+ 3ac: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 3b0: 80 88 00 00 nop
+ 3b4: 12 c8 f0 10 ldi\.p @\(gr15,16\),gr9
+ 3b8: 80 88 00 00 nop
+ 3bc: 80 88 00 00 nop
+ 3c0: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 3c4: 00 88 00 00 nop\.p
+ 3c8: 80 88 00 00 nop
+ 3cc: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 3d0: 80 88 00 00 nop
+ 3d4: 12 fc f8 10 setlos\.p 0xf*fffff810,gr9
+ 3d8: 80 88 00 00 nop
+ 3dc: 80 88 00 00 nop
+ 3e0: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 3e4: 00 88 00 00 nop\.p
+ 3e8: 80 88 00 00 nop
+ 3ec: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 3f0: 80 88 00 00 nop
+ 3f4: 12 fc f8 20 setlos\.p 0xf*fffff820,gr9
+ 3f8: 80 88 00 00 nop
+ 3fc: 80 88 00 00 nop
+ 400: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 404: 00 88 00 00 nop\.p
+ 408: 80 88 00 00 nop
+ 40c: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 410: 80 88 00 00 nop
+ 414: 12 fc 00 00 setlos\.p lo\(0x0\),gr9
+ 418: 80 88 00 00 nop
+ 41c: 80 88 00 00 nop
+ 420: 00 88 00 00 nop\.p
+ 424: 90 fc f8 20 setlos 0xf*fffff820,gr8
+ 428: 00 88 00 00 nop\.p
+ 42c: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 430: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 434: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 438: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 43c: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 440: 00 88 00 00 nop\.p
+ 444: 80 88 00 00 nop
+ 448: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 44c: 00 88 00 00 nop\.p
+ 450: 80 88 00 00 nop
+ 454: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 458: 00 88 00 00 nop\.p
+ 45c: 80 88 00 00 nop
+ 460: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 464: 00 88 00 00 nop\.p
+ 468: 80 88 00 00 nop
+ 46c: 92 fc 00 00 setlos lo\(0x0\),gr9
+Disassembly of section \.got:
+
+00004508 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 4514: ff ff f8 20 cop2 -32,cpr63,cpr32,cpr63
+ 4518: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4518: R_FRV_TLSOFF x
+ 451c: ff ff f8 10 cop2 -32,cpr63,cpr16,cpr63
+ 4520: 00 00 00 00 add\.p gr0,gr0,gr0
diff --git a/ld/testsuite/ld-frv/tls-pie-3.d b/ld/testsuite/ld-frv/tls-pie-3.d
new file mode 100644
index 0000000..440002b
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-pie-3.d
@@ -0,0 +1,27 @@
+#name: FRV TLS undefweak relocs, pie linking
+#source: tls-3.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: -pie
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+00000324 <_start>:
+ 324: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 328: 00 88 00 00 nop\.p
+ 32c: 80 88 00 00 nop
+ 330: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 334: 80 88 00 00 nop
+ 338: 12 c8 f0 0c ldi\.p @\(gr15,12\),gr9
+ 33c: 80 88 00 00 nop
+ 340: 80 88 00 00 nop
+ 344: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 348: 00 88 00 00 nop\.p
+ 34c: 80 88 00 00 nop
+ 350: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+Disassembly of section \.got:
+
+000043d8 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 43e4: R_FRV_TLSOFF u
diff --git a/ld/testsuite/ld-frv/tls-relax-dynamic-1.d b/ld/testsuite/ld-frv/tls-relax-dynamic-1.d
new file mode 100644
index 0000000..94fdb1b
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-relax-dynamic-1.d
@@ -0,0 +1,67 @@
+#name: FRV TLS relocs, dynamic linking with relaxation
+#source: tls-1.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: tmpdir/tls-1-dep.so --relax
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+000102c8 <_start>:
+ 102c8: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 102cc: 00 88 00 00 nop\.p
+ 102d0: 80 88 00 00 nop
+ 102d4: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 102d8: 80 88 00 00 nop
+ 102dc: 12 c8 f0 0c ldi\.p @\(gr15,12\),gr9
+ 102e0: 80 88 00 00 nop
+ 102e4: 80 88 00 00 nop
+ 102e8: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 102ec: 00 88 00 00 nop\.p
+ 102f0: 80 88 00 00 nop
+ 102f4: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 102f8: 80 88 00 00 nop
+ 102fc: 12 fc f8 10 setlos\.p 0xf*fffff810,gr9
+ 10300: 80 88 00 00 nop
+ 10304: 80 88 00 00 nop
+ 10308: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 1030c: 00 88 00 00 nop\.p
+ 10310: 80 88 00 00 nop
+ 10314: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 10318: 80 88 00 00 nop
+ 1031c: 12 fc f8 20 setlos\.p 0xf*fffff820,gr9
+ 10320: 80 88 00 00 nop
+ 10324: 80 88 00 00 nop
+ 10328: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 1032c: 00 88 00 00 nop\.p
+ 10330: 80 88 00 00 nop
+ 10334: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 10338: 80 88 00 00 nop
+ 1033c: 12 fc 00 00 setlos\.p lo\(0x0\),gr9
+ 10340: 80 88 00 00 nop
+ 10344: 80 88 00 00 nop
+ 10348: 00 88 00 00 nop\.p
+ 1034c: 90 fc f8 20 setlos 0xf*fffff820,gr8
+ 10350: 00 88 00 00 nop\.p
+ 10354: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 10358: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 1035c: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 10360: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 10364: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 10368: 00 88 00 00 nop\.p
+ 1036c: 80 88 00 00 nop
+ 10370: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 10374: 00 88 00 00 nop\.p
+ 10378: 80 88 00 00 nop
+ 1037c: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 10380: 00 88 00 00 nop\.p
+ 10384: 80 88 00 00 nop
+ 10388: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 1038c: 00 88 00 00 nop\.p
+ 10390: 80 88 00 00 nop
+ 10394: 92 fc 00 00 setlos lo\(0x0\),gr9
+Disassembly of section \.got:
+
+00014428 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 14434: R_FRV_TLSOFF x
diff --git a/ld/testsuite/ld-frv/tls-relax-dynamic-2.d b/ld/testsuite/ld-frv/tls-relax-dynamic-2.d
new file mode 100644
index 0000000..c8b35e0
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-relax-dynamic-2.d
@@ -0,0 +1,149 @@
+#name: FRV TLS relocs with addends, dynamic linking, relaxing
+#source: tls-2.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: tmpdir/tls-1-dep.so --relax
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+00010308 <_start>:
+ 10308: 92 fc f8 11 setlos 0xf*fffff811,gr9
+ 1030c: 92 fc 08 11 setlos 0x811,gr9
+ 10310: 92 c8 f0 2c ldi @\(gr15,44\),gr9
+ 10314: 00 88 00 00 nop\.p
+ 10318: 80 88 00 00 nop
+ 1031c: 92 fc f8 12 setlos 0xf*fffff812,gr9
+ 10320: 80 88 00 00 nop
+ 10324: 00 88 00 00 nop\.p
+ 10328: 80 88 00 00 nop
+ 1032c: 92 fc 08 12 setlos 0x812,gr9
+ 10330: 80 88 00 00 nop
+ 10334: 00 88 00 00 nop\.p
+ 10338: 80 88 00 00 nop
+ 1033c: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 10340: 92 f4 f8 12 setlo 0xf812,gr9
+ 10344: 12 fc f8 13 setlos\.p 0xf*fffff813,gr9
+ 10348: 80 88 00 00 nop
+ 1034c: 80 88 00 00 nop
+ 10350: 12 fc 08 13 setlos\.p 0x813,gr9
+ 10354: 80 88 00 00 nop
+ 10358: 80 88 00 00 nop
+ 1035c: 12 f8 00 00 sethi\.p hi\(0x0\),gr9
+ 10360: 80 88 00 00 nop
+ 10364: 92 f4 f8 13 setlo 0xf813,gr9
+ 10368: 80 88 00 00 nop
+ 1036c: 92 fc f8 14 setlos 0xf*fffff814,gr9
+ 10370: 80 88 00 00 nop
+ 10374: 92 fc 08 14 setlos 0x814,gr9
+ 10378: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 1037c: 92 f4 f8 14 setlo 0xf814,gr9
+ 10380: 92 fc f8 21 setlos 0xf*fffff821,gr9
+ 10384: 92 fc 08 21 setlos 0x821,gr9
+ 10388: 92 c8 f0 14 ldi @\(gr15,20\),gr9
+ 1038c: 00 88 00 00 nop\.p
+ 10390: 80 88 00 00 nop
+ 10394: 92 fc f8 22 setlos 0xf*fffff822,gr9
+ 10398: 80 88 00 00 nop
+ 1039c: 00 88 00 00 nop\.p
+ 103a0: 80 88 00 00 nop
+ 103a4: 92 fc 08 22 setlos 0x822,gr9
+ 103a8: 80 88 00 00 nop
+ 103ac: 00 88 00 00 nop\.p
+ 103b0: 80 88 00 00 nop
+ 103b4: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 103b8: 92 f4 f8 22 setlo 0xf822,gr9
+ 103bc: 12 fc f8 23 setlos\.p 0xf*fffff823,gr9
+ 103c0: 80 88 00 00 nop
+ 103c4: 80 88 00 00 nop
+ 103c8: 12 fc 08 23 setlos\.p 0x823,gr9
+ 103cc: 80 88 00 00 nop
+ 103d0: 80 88 00 00 nop
+ 103d4: 12 f8 00 00 sethi\.p hi\(0x0\),gr9
+ 103d8: 80 88 00 00 nop
+ 103dc: 92 f4 f8 23 setlo 0xf823,gr9
+ 103e0: 80 88 00 00 nop
+ 103e4: 92 fc f8 24 setlos 0xf*fffff824,gr9
+ 103e8: 80 88 00 00 nop
+ 103ec: 92 fc 08 24 setlos 0x824,gr9
+ 103f0: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 103f4: 92 f4 f8 24 setlo 0xf824,gr9
+ 103f8: 92 fc 00 01 setlos 0x1,gr9
+ 103fc: 92 fc 10 01 setlos 0x1001,gr9
+ 10400: 92 c8 f0 24 ldi @\(gr15,36\),gr9
+ 10404: 00 88 00 00 nop\.p
+ 10408: 80 88 00 00 nop
+ 1040c: 92 fc 00 02 setlos 0x2,gr9
+ 10410: 80 88 00 00 nop
+ 10414: 00 88 00 00 nop\.p
+ 10418: 80 88 00 00 nop
+ 1041c: 92 fc 10 02 setlos 0x1002,gr9
+ 10420: 80 88 00 00 nop
+ 10424: 00 88 00 00 nop\.p
+ 10428: 80 88 00 00 nop
+ 1042c: 92 f8 00 01 sethi 0x1,gr9
+ 10430: 92 f4 00 02 setlo 0x2,gr9
+ 10434: 12 fc 00 03 setlos\.p 0x3,gr9
+ 10438: 80 88 00 00 nop
+ 1043c: 80 88 00 00 nop
+ 10440: 12 fc 10 03 setlos\.p 0x1003,gr9
+ 10444: 80 88 00 00 nop
+ 10448: 80 88 00 00 nop
+ 1044c: 12 f8 00 01 sethi\.p 0x1,gr9
+ 10450: 80 88 00 00 nop
+ 10454: 92 f4 00 03 setlo 0x3,gr9
+ 10458: 80 88 00 00 nop
+ 1045c: 92 fc 00 04 setlos 0x4,gr9
+ 10460: 80 88 00 00 nop
+ 10464: 92 fc 10 04 setlos 0x1004,gr9
+ 10468: 92 f8 00 01 sethi 0x1,gr9
+ 1046c: 92 f4 00 04 setlo 0x4,gr9
+ 10470: 92 c8 f0 18 ldi @\(gr15,24\),gr9
+ 10474: 92 c8 f0 1c ldi @\(gr15,28\),gr9
+ 10478: 92 c8 f0 28 ldi @\(gr15,40\),gr9
+ 1047c: 00 88 00 00 nop\.p
+ 10480: 80 88 00 00 nop
+ 10484: 92 c8 f0 38 ldi @\(gr15,56\),gr9
+ 10488: 80 88 00 00 nop
+ 1048c: 00 88 00 00 nop\.p
+ 10490: 80 88 00 00 nop
+ 10494: 92 c8 f0 34 ldi @\(gr15,52\),gr9
+ 10498: 80 88 00 00 nop
+ 1049c: 00 88 00 00 nop\.p
+ 104a0: 80 88 00 00 nop
+ 104a4: 92 c8 f0 30 ldi @\(gr15,48\),gr9
+ 104a8: 80 88 00 00 nop
+ 104ac: 12 c8 f0 0c ldi\.p @\(gr15,12\),gr9
+ 104b0: 80 88 00 00 nop
+ 104b4: 80 88 00 00 nop
+ 104b8: 12 c8 f0 10 ldi\.p @\(gr15,16\),gr9
+ 104bc: 80 88 00 00 nop
+ 104c0: 80 88 00 00 nop
+ 104c4: 12 c8 f0 20 ldi\.p @\(gr15,32\),gr9
+ 104c8: 80 88 00 00 nop
+ 104cc: 80 88 00 00 nop
+Disassembly of section \.got:
+
+00014568 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 14574: 00 00 00 03 add\.p gr0,gr3,gr0
+ 14574: R_FRV_TLSOFF x
+ 14578: 00 00 10 03 add\.p sp,gr3,gr0
+ 14578: R_FRV_TLSOFF x
+ 1457c: 00 00 f8 21 \*unknown\*
+ 14580: 00 00 00 01 add\.p gr0,sp,gr0
+ 14580: R_FRV_TLSOFF x
+ 14584: 00 00 10 01 add\.p sp,sp,gr0
+ 14584: R_FRV_TLSOFF x
+ 14588: 00 01 00 03 add\.p gr16,gr3,gr0
+ 14588: R_FRV_TLSOFF x
+ 1458c: 00 01 00 01 add\.p gr16,sp,gr0
+ 14590: 00 01 00 01 add\.p gr16,sp,gr0
+ 14590: R_FRV_TLSOFF x
+ 14594: 00 00 f8 11 \*unknown\*
+ 14598: 00 01 00 02 add\.p gr16,fp,gr0
+ 14598: R_FRV_TLSOFF x
+ 1459c: 00 00 10 02 add\.p sp,fp,gr0
+ 1459c: R_FRV_TLSOFF x
+ 145a0: 00 00 00 02 add\.p gr0,fp,gr0
+ 145a0: R_FRV_TLSOFF x
diff --git a/ld/testsuite/ld-frv/tls-relax-dynamic-3.d b/ld/testsuite/ld-frv/tls-relax-dynamic-3.d
new file mode 100644
index 0000000..0043319
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-relax-dynamic-3.d
@@ -0,0 +1,27 @@
+#name: FRV TLS undefweak relocs, dynamic linking with relaxation
+#source: tls-3.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: tmpdir/tls-1-dep.so --relax
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+00010294 <_start>:
+ 10294: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 10298: 00 88 00 00 nop\.p
+ 1029c: 80 88 00 00 nop
+ 102a0: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 102a4: 80 88 00 00 nop
+ 102a8: 12 c8 f0 0c ldi\.p @\(gr15,12\),gr9
+ 102ac: 80 88 00 00 nop
+ 102b0: 80 88 00 00 nop
+ 102b4: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 102b8: 00 88 00 00 nop\.p
+ 102bc: 80 88 00 00 nop
+ 102c0: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+Disassembly of section \.got:
+
+00014350 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 1435c: R_FRV_TLSOFF u
diff --git a/ld/testsuite/ld-frv/tls-relax-initial-shared-2.d b/ld/testsuite/ld-frv/tls-relax-initial-shared-2.d
new file mode 100644
index 0000000..7911890
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-relax-initial-shared-2.d
@@ -0,0 +1,214 @@
+#name: FRV TLS relocs with addends, shared linking with static TLS, relaxing
+#source: tls-2.s
+#as: --defsym static_tls=1
+#objdump: -DR -j .text -j .got -j .plt
+#ld: -shared tmpdir/tls-1-dep.so --version-script tls-1-shared.lds --relax
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+00000454 <_start>:
+ 454: 92 c8 f0 34 ldi @\(gr15,52\),gr9
+ 458: 92 c8 f0 44 ldi @\(gr15,68\),gr9
+ 45c: 92 c8 f0 5c ldi @\(gr15,92\),gr9
+ 460: 00 88 00 00 nop\.p
+ 464: 80 88 00 00 nop
+ 468: 92 c8 f0 7c ldi @\(gr15,124\),gr9
+ 46c: 80 88 00 00 nop
+ 470: 00 88 00 00 nop\.p
+ 474: 80 88 00 00 nop
+ 478: 92 c8 f0 84 ldi @\(gr15,132\),gr9
+ 47c: 80 88 00 00 nop
+ 480: 00 88 00 00 nop\.p
+ 484: 80 88 00 00 nop
+ 488: 92 c8 f0 94 ldi @\(gr15,148\),gr9
+ 48c: 80 88 00 00 nop
+ 490: 12 c8 f0 38 ldi\.p @\(gr15,56\),gr9
+ 494: 80 88 00 00 nop
+ 498: 80 88 00 00 nop
+ 49c: 12 c8 f0 48 ldi\.p @\(gr15,72\),gr9
+ 4a0: 80 88 00 00 nop
+ 4a4: 80 88 00 00 nop
+ 4a8: 12 c8 f0 60 ldi\.p @\(gr15,96\),gr9
+ 4ac: 80 88 00 00 nop
+ 4b0: 80 88 00 00 nop
+ 4b4: 80 88 00 00 nop
+ 4b8: 92 fc f8 14 setlos 0xf*fffff814,gr9
+ 4bc: 80 88 00 00 nop
+ 4c0: 92 fc 08 14 setlos 0x814,gr9
+ 4c4: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 4c8: 92 f4 f8 14 setlo 0xf814,gr9
+ 4cc: 92 c8 f0 64 ldi @\(gr15,100\),gr9
+ 4d0: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 4d4: 92 c8 f0 1c ldi @\(gr15,28\),gr9
+ 4d8: 00 88 00 00 nop\.p
+ 4dc: 80 88 00 00 nop
+ 4e0: 92 c8 f0 98 ldi @\(gr15,152\),gr9
+ 4e4: 80 88 00 00 nop
+ 4e8: 00 88 00 00 nop\.p
+ 4ec: 80 88 00 00 nop
+ 4f0: 92 c8 f0 6c ldi @\(gr15,108\),gr9
+ 4f4: 80 88 00 00 nop
+ 4f8: 00 88 00 00 nop\.p
+ 4fc: 80 88 00 00 nop
+ 500: 92 c8 f0 70 ldi @\(gr15,112\),gr9
+ 504: 80 88 00 00 nop
+ 508: 12 c8 f0 68 ldi\.p @\(gr15,104\),gr9
+ 50c: 80 88 00 00 nop
+ 510: 80 88 00 00 nop
+ 514: 12 c8 f0 10 ldi\.p @\(gr15,16\),gr9
+ 518: 80 88 00 00 nop
+ 51c: 80 88 00 00 nop
+ 520: 12 c8 f0 20 ldi\.p @\(gr15,32\),gr9
+ 524: 80 88 00 00 nop
+ 528: 80 88 00 00 nop
+ 52c: 80 88 00 00 nop
+ 530: 92 fc f8 24 setlos 0xf*fffff824,gr9
+ 534: 80 88 00 00 nop
+ 538: 92 fc 08 24 setlos 0x824,gr9
+ 53c: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 540: 92 f4 f8 24 setlo 0xf824,gr9
+ 544: 92 c8 f0 28 ldi @\(gr15,40\),gr9
+ 548: 92 c8 f0 4c ldi @\(gr15,76\),gr9
+ 54c: 92 c8 f0 50 ldi @\(gr15,80\),gr9
+ 550: 00 88 00 00 nop\.p
+ 554: 80 88 00 00 nop
+ 558: 92 c8 f0 74 ldi @\(gr15,116\),gr9
+ 55c: 80 88 00 00 nop
+ 560: 00 88 00 00 nop\.p
+ 564: 80 88 00 00 nop
+ 568: 92 c8 f0 88 ldi @\(gr15,136\),gr9
+ 56c: 80 88 00 00 nop
+ 570: 00 88 00 00 nop\.p
+ 574: 80 88 00 00 nop
+ 578: 92 c8 f0 8c ldi @\(gr15,140\),gr9
+ 57c: 80 88 00 00 nop
+ 580: 12 c8 f0 2c ldi\.p @\(gr15,44\),gr9
+ 584: 80 88 00 00 nop
+ 588: 80 88 00 00 nop
+ 58c: 12 c8 f0 3c ldi\.p @\(gr15,60\),gr9
+ 590: 80 88 00 00 nop
+ 594: 80 88 00 00 nop
+ 598: 12 c8 f0 54 ldi\.p @\(gr15,84\),gr9
+ 59c: 80 88 00 00 nop
+ 5a0: 80 88 00 00 nop
+ 5a4: 80 88 00 00 nop
+ 5a8: 92 fc 00 04 setlos 0x4,gr9
+ 5ac: 80 88 00 00 nop
+ 5b0: 92 fc 10 04 setlos 0x1004,gr9
+ 5b4: 92 f8 00 01 sethi 0x1,gr9
+ 5b8: 92 f4 00 04 setlo 0x4,gr9
+ 5bc: 92 c8 f0 30 ldi @\(gr15,48\),gr9
+ 5c0: 92 c8 f0 40 ldi @\(gr15,64\),gr9
+ 5c4: 92 c8 f0 58 ldi @\(gr15,88\),gr9
+ 5c8: 00 88 00 00 nop\.p
+ 5cc: 80 88 00 00 nop
+ 5d0: 92 c8 f0 78 ldi @\(gr15,120\),gr9
+ 5d4: 80 88 00 00 nop
+ 5d8: 00 88 00 00 nop\.p
+ 5dc: 80 88 00 00 nop
+ 5e0: 92 c8 f0 80 ldi @\(gr15,128\),gr9
+ 5e4: 80 88 00 00 nop
+ 5e8: 00 88 00 00 nop\.p
+ 5ec: 80 88 00 00 nop
+ 5f0: 92 c8 f0 90 ldi @\(gr15,144\),gr9
+ 5f4: 80 88 00 00 nop
+ 5f8: 12 c8 f0 14 ldi\.p @\(gr15,20\),gr9
+ 5fc: 80 88 00 00 nop
+ 600: 80 88 00 00 nop
+ 604: 12 c8 f0 18 ldi\.p @\(gr15,24\),gr9
+ 608: 80 88 00 00 nop
+ 60c: 80 88 00 00 nop
+ 610: 12 c8 f0 24 ldi\.p @\(gr15,36\),gr9
+ 614: 80 88 00 00 nop
+ 618: 80 88 00 00 nop
+ 61c: 92 c8 f0 34 ldi @\(gr15,52\),gr9
+ 620: 92 c8 f0 5c ldi @\(gr15,92\),gr9
+ 624: 92 c8 f0 64 ldi @\(gr15,100\),gr9
+ 628: 92 c8 f0 1c ldi @\(gr15,28\),gr9
+ 62c: 92 c8 f0 28 ldi @\(gr15,40\),gr9
+ 630: 92 c8 f0 50 ldi @\(gr15,80\),gr9
+ 634: 92 c8 f0 30 ldi @\(gr15,48\),gr9
+ 638: 92 c8 f0 58 ldi @\(gr15,88\),gr9
+ 63c: 80 88 00 00 nop
+ 640: 92 c8 f0 44 ldi @\(gr15,68\),gr9
+ 644: 80 88 00 00 nop
+ 648: 80 88 00 00 nop
+ 64c: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+Disassembly of section \.got:
+
+000046e8 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 46f4: 00 00 10 11 add\.p sp,gr17,gr0
+ 46f4: R_FRV_TLSOFF \.tbss
+ 46f8: 00 00 10 13 add\.p sp,gr19,gr0
+ 46f8: R_FRV_TLSOFF \.tbss
+ 46fc: 00 00 00 03 add\.p gr0,gr3,gr0
+ 46fc: R_FRV_TLSOFF x
+ 4700: 00 00 10 03 add\.p sp,gr3,gr0
+ 4700: R_FRV_TLSOFF x
+ 4704: 00 01 00 11 add\.p gr16,gr17,gr0
+ 4704: R_FRV_TLSOFF \.tbss
+ 4708: 00 01 00 13 add\.p gr16,gr19,gr0
+ 4708: R_FRV_TLSOFF \.tbss
+ 470c: 00 01 00 03 add\.p gr16,gr3,gr0
+ 470c: R_FRV_TLSOFF x
+ 4710: 00 00 07 f1 \*unknown\*
+ 4710: R_FRV_TLSOFF \.tbss
+ 4714: 00 00 07 f3 \*unknown\*
+ 4714: R_FRV_TLSOFF \.tbss
+ 4718: 00 00 00 01 add\.p gr0,sp,gr0
+ 4718: R_FRV_TLSOFF x
+ 471c: 00 00 00 01 add\.p gr0,sp,gr0
+ 471c: R_FRV_TLSOFF \.tbss
+ 4720: 00 00 00 03 add\.p gr0,gr3,gr0
+ 4720: R_FRV_TLSOFF \.tbss
+ 4724: 00 00 17 f3 \*unknown\*
+ 4724: R_FRV_TLSOFF \.tbss
+ 4728: 00 00 10 01 add\.p sp,sp,gr0
+ 4728: R_FRV_TLSOFF x
+ 472c: 00 00 10 01 add\.p sp,sp,gr0
+ 472c: R_FRV_TLSOFF \.tbss
+ 4730: 00 00 10 03 add\.p sp,gr3,gr0
+ 4730: R_FRV_TLSOFF \.tbss
+ 4734: 00 00 17 f1 \*unknown\*
+ 4734: R_FRV_TLSOFF \.tbss
+ 4738: 00 01 07 f1 \*unknown\*
+ 4738: R_FRV_TLSOFF \.tbss
+ 473c: 00 01 07 f3 \*unknown\*
+ 473c: R_FRV_TLSOFF \.tbss
+ 4740: 00 01 00 01 add\.p gr16,sp,gr0
+ 4740: R_FRV_TLSOFF x
+ 4744: 00 01 00 01 add\.p gr16,sp,gr0
+ 4744: R_FRV_TLSOFF \.tbss
+ 4748: 00 01 00 03 add\.p gr16,gr3,gr0
+ 4748: R_FRV_TLSOFF \.tbss
+ 474c: 00 00 00 11 add\.p gr0,gr17,gr0
+ 474c: R_FRV_TLSOFF \.tbss
+ 4750: 00 00 00 13 add\.p gr0,gr19,gr0
+ 4750: R_FRV_TLSOFF \.tbss
+ 4754: 00 00 10 12 add\.p sp,gr18,gr0
+ 4754: R_FRV_TLSOFF \.tbss
+ 4758: 00 01 00 12 add\.p gr16,gr18,gr0
+ 4758: R_FRV_TLSOFF \.tbss
+ 475c: 00 00 07 f2 \*unknown\*
+ 475c: R_FRV_TLSOFF \.tbss
+ 4760: 00 00 00 02 add\.p gr0,fp,gr0
+ 4760: R_FRV_TLSOFF x
+ 4764: 00 00 00 02 add\.p gr0,fp,gr0
+ 4764: R_FRV_TLSOFF \.tbss
+ 4768: 00 00 10 02 add\.p sp,fp,gr0
+ 4768: R_FRV_TLSOFF x
+ 476c: 00 00 10 02 add\.p sp,fp,gr0
+ 476c: R_FRV_TLSOFF \.tbss
+ 4770: 00 00 17 f2 \*unknown\*
+ 4770: R_FRV_TLSOFF \.tbss
+ 4774: 00 01 07 f2 \*unknown\*
+ 4774: R_FRV_TLSOFF \.tbss
+ 4778: 00 01 00 02 add\.p gr16,fp,gr0
+ 4778: R_FRV_TLSOFF x
+ 477c: 00 01 00 02 add\.p gr16,fp,gr0
+ 477c: R_FRV_TLSOFF \.tbss
+ 4780: 00 00 00 12 add\.p gr0,gr18,gr0
+ 4780: R_FRV_TLSOFF \.tbss
diff --git a/ld/testsuite/ld-frv/tls-relax-pie-1.d b/ld/testsuite/ld-frv/tls-relax-pie-1.d
new file mode 100644
index 0000000..3979080
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-relax-pie-1.d
@@ -0,0 +1,67 @@
+#name: FRV TLS relocs, pie linking with relaxation
+#source: tls-1.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: -pie tmpdir/tls-1-dep.so --relax
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+000003a0 <_start>:
+ 3a0: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 3a4: 00 88 00 00 nop\.p
+ 3a8: 80 88 00 00 nop
+ 3ac: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 3b0: 80 88 00 00 nop
+ 3b4: 12 c8 f0 0c ldi\.p @\(gr15,12\),gr9
+ 3b8: 80 88 00 00 nop
+ 3bc: 80 88 00 00 nop
+ 3c0: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 3c4: 00 88 00 00 nop\.p
+ 3c8: 80 88 00 00 nop
+ 3cc: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 3d0: 80 88 00 00 nop
+ 3d4: 12 fc f8 10 setlos\.p 0xf*fffff810,gr9
+ 3d8: 80 88 00 00 nop
+ 3dc: 80 88 00 00 nop
+ 3e0: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 3e4: 00 88 00 00 nop\.p
+ 3e8: 80 88 00 00 nop
+ 3ec: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 3f0: 80 88 00 00 nop
+ 3f4: 12 fc f8 20 setlos\.p 0xf*fffff820,gr9
+ 3f8: 80 88 00 00 nop
+ 3fc: 80 88 00 00 nop
+ 400: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 404: 00 88 00 00 nop\.p
+ 408: 80 88 00 00 nop
+ 40c: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 410: 80 88 00 00 nop
+ 414: 12 fc 00 00 setlos\.p lo\(0x0\),gr9
+ 418: 80 88 00 00 nop
+ 41c: 80 88 00 00 nop
+ 420: 00 88 00 00 nop\.p
+ 424: 90 fc f8 20 setlos 0xf*fffff820,gr8
+ 428: 00 88 00 00 nop\.p
+ 42c: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 430: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 434: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 438: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 43c: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 440: 00 88 00 00 nop\.p
+ 444: 80 88 00 00 nop
+ 448: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 44c: 00 88 00 00 nop\.p
+ 450: 80 88 00 00 nop
+ 454: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 458: 00 88 00 00 nop\.p
+ 45c: 80 88 00 00 nop
+ 460: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 464: 00 88 00 00 nop\.p
+ 468: 80 88 00 00 nop
+ 46c: 92 fc 00 00 setlos lo\(0x0\),gr9
+Disassembly of section \.got:
+
+00004508 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 4514: R_FRV_TLSOFF x
diff --git a/ld/testsuite/ld-frv/tls-relax-pie-3.d b/ld/testsuite/ld-frv/tls-relax-pie-3.d
new file mode 100644
index 0000000..e83d317
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-relax-pie-3.d
@@ -0,0 +1,27 @@
+#name: FRV TLS undefweak relocs, pie linking with relaxation
+#source: tls-3.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: -pie --relax
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+00000324 <_start>:
+ 324: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 328: 00 88 00 00 nop\.p
+ 32c: 80 88 00 00 nop
+ 330: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 334: 80 88 00 00 nop
+ 338: 12 c8 f0 0c ldi\.p @\(gr15,12\),gr9
+ 33c: 80 88 00 00 nop
+ 340: 80 88 00 00 nop
+ 344: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 348: 00 88 00 00 nop\.p
+ 34c: 80 88 00 00 nop
+ 350: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+Disassembly of section \.got:
+
+000043d8 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 43e4: R_FRV_TLSOFF u
diff --git a/ld/testsuite/ld-frv/tls-relax-shared-1.d b/ld/testsuite/ld-frv/tls-relax-shared-1.d
new file mode 100644
index 0000000..6aafd23
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-relax-shared-1.d
@@ -0,0 +1,73 @@
+#name: FRV TLS relocs, shared linking with relaxation
+#source: tls-1.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: -shared tmpdir/tls-1-dep.so --version-script tls-1-shared.lds --relax
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+00000354 <_start>:
+ 354: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 358: 00 88 00 00 nop\.p
+ 35c: 80 88 00 00 nop
+ 360: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 364: 80 88 00 00 nop
+ 368: 12 c8 f0 10 ldi\.p @\(gr15,16\),gr9
+ 36c: 80 88 00 00 nop
+ 370: 80 88 00 00 nop
+ 374: 92 c8 f0 14 ldi @\(gr15,20\),gr9
+ 378: 00 88 00 00 nop\.p
+ 37c: 80 88 00 00 nop
+ 380: 92 c8 f0 14 ldi @\(gr15,20\),gr9
+ 384: 80 88 00 00 nop
+ 388: 12 c8 f0 14 ldi\.p @\(gr15,20\),gr9
+ 38c: 80 88 00 00 nop
+ 390: 80 88 00 00 nop
+ 394: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 398: 00 88 00 00 nop\.p
+ 39c: 80 88 00 00 nop
+ 3a0: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 3a4: 80 88 00 00 nop
+ 3a8: 12 c8 f0 0c ldi\.p @\(gr15,12\),gr9
+ 3ac: 80 88 00 00 nop
+ 3b0: 80 88 00 00 nop
+ 3b4: 92 c8 f0 18 ldi @\(gr15,24\),gr9
+ 3b8: 00 88 00 00 nop\.p
+ 3bc: 80 88 00 00 nop
+ 3c0: 92 c8 f0 18 ldi @\(gr15,24\),gr9
+ 3c4: 80 88 00 00 nop
+ 3c8: 12 c8 f0 18 ldi\.p @\(gr15,24\),gr9
+ 3cc: 80 88 00 00 nop
+ 3d0: 80 88 00 00 nop
+ 3d4: 00 88 00 00 nop\.p
+ 3d8: 90 fc f8 20 setlos 0xf*fffff820,gr8
+ 3dc: 00 88 00 00 nop\.p
+ 3e0: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 3e4: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 3e8: 92 c8 f0 14 ldi @\(gr15,20\),gr9
+ 3ec: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 3f0: 92 c8 f0 18 ldi @\(gr15,24\),gr9
+ 3f4: 00 88 00 00 nop\.p
+ 3f8: 80 88 00 00 nop
+ 3fc: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 400: 00 88 00 00 nop\.p
+ 404: 80 88 00 00 nop
+ 408: 92 c8 f0 14 ldi @\(gr15,20\),gr9
+ 40c: 00 88 00 00 nop\.p
+ 410: 80 88 00 00 nop
+ 414: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 418: 00 88 00 00 nop\.p
+ 41c: 80 88 00 00 nop
+ 420: 92 c8 f0 18 ldi @\(gr15,24\),gr9
+Disassembly of section \.got:
+
+000044b8 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 44c4: 00 00 00 10 add\.p gr0,gr16,gr0
+ 44c4: R_FRV_TLSOFF \.tbss
+ \.\.\.
+ 44c8: R_FRV_TLSOFF x
+ 44cc: R_FRV_TLSOFF \.tbss
+ 44d0: 00 00 07 f0 \*unknown\*
+ 44d0: R_FRV_TLSOFF \.tbss
diff --git a/ld/testsuite/ld-frv/tls-relax-shared-2.d b/ld/testsuite/ld-frv/tls-relax-shared-2.d
new file mode 100644
index 0000000..49cfea7
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-relax-shared-2.d
@@ -0,0 +1,264 @@
+#name: FRV TLS relocs with addends, shared linking, relaxing
+#source: tls-2.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: -shared tmpdir/tls-1-dep.so --version-script tls-1-shared.lds --relax
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.plt:
+
+00000454 <\.plt>:
+ 454: 90 cc f0 10 lddi @\(gr15,16\),gr8
+ 458: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 45c: 90 cc f0 30 lddi @\(gr15,48\),gr8
+ 460: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 464: 90 cc f0 40 lddi @\(gr15,64\),gr8
+ 468: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 46c: 90 cc f0 50 lddi @\(gr15,80\),gr8
+ 470: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 474: 90 cc f0 58 lddi @\(gr15,88\),gr8
+ 478: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 47c: 90 cc f0 68 lddi @\(gr15,104\),gr8
+ 480: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 484: 90 cc ff a8 lddi @\(gr15,-88\),gr8
+ 488: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 48c: 90 cc ff b0 lddi @\(gr15,-80\),gr8
+ 490: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 494: 90 cc ff c8 lddi @\(gr15,-56\),gr8
+ 498: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 49c: 90 cc ff d8 lddi @\(gr15,-40\),gr8
+ 4a0: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 4a4: 90 cc ff e0 lddi @\(gr15,-32\),gr8
+ 4a8: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 4ac: 90 cc ff f0 lddi @\(gr15,-16\),gr8
+ 4b0: 80 30 80 00 jmpl @\(gr8,gr0\)
+Disassembly of section \.text:
+
+000004b4 <_start>:
+ 4b4: fe 3f ff f0 call 474 <i\+0x464>
+ 4b8: fe 3f ff f5 call 48c <i\+0x47c>
+ 4bc: fe 3f ff fa call 4a4 <i\+0x494>
+ 4c0: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 4c4: 9c f4 00 98 setlo 0x98,gr14
+ 4c8: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 4cc: 82 30 80 00 calll @\(gr8,gr0\)
+ 4d0: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 4d4: 9c f4 00 a8 setlo 0xa8,gr14
+ 4d8: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 4dc: 82 30 80 00 calll @\(gr8,gr0\)
+ 4e0: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 4e4: 9c f4 00 c0 setlo 0xc0,gr14
+ 4e8: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 4ec: 82 30 80 00 calll @\(gr8,gr0\)
+ 4f0: 10 cc f0 60 lddi\.p @\(gr15,96\),gr8
+ 4f4: 9c fc 00 60 setlos 0x60,gr14
+ 4f8: 82 30 80 00 calll @\(gr8,gr0\)
+ 4fc: 10 cc ff b8 lddi\.p @\(gr15,-72\),gr8
+ 500: 9c fc ff b8 setlos 0xf*ffffffb8,gr14
+ 504: 82 30 80 00 calll @\(gr8,gr0\)
+ 508: 10 cc ff e8 lddi\.p @\(gr15,-24\),gr8
+ 50c: 9c fc ff e8 setlos 0xf*ffffffe8,gr14
+ 510: 82 30 80 00 calll @\(gr8,gr0\)
+ 514: 80 88 00 00 nop
+ 518: 92 fc f8 14 setlos 0xf*fffff814,gr9
+ 51c: 80 88 00 00 nop
+ 520: 92 fc 08 14 setlos 0x814,gr9
+ 524: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 528: 92 f4 f8 14 setlo 0xf814,gr9
+ 52c: fe 3f ff e0 call 4ac <i\+0x49c>
+ 530: fe 3f ff c9 call 454 <i\+0x444>
+ 534: fe 3f ff ca call 45c <i\+0x44c>
+ 538: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 53c: 9c f4 00 c8 setlo 0xc8,gr14
+ 540: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 544: 82 30 80 00 calll @\(gr8,gr0\)
+ 548: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 54c: 9c f4 00 78 setlo 0x78,gr14
+ 550: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 554: 82 30 80 00 calll @\(gr8,gr0\)
+ 558: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 55c: 9c f4 00 88 setlo 0x88,gr14
+ 560: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 564: 82 30 80 00 calll @\(gr8,gr0\)
+ 568: 10 cc ff f8 lddi\.p @\(gr15,-8\),gr8
+ 56c: 9c fc ff f8 setlos 0xf*fffffff8,gr14
+ 570: 82 30 80 00 calll @\(gr8,gr0\)
+ 574: 10 cc f0 18 lddi\.p @\(gr15,24\),gr8
+ 578: 9c fc 00 18 setlos 0x18,gr14
+ 57c: 82 30 80 00 calll @\(gr8,gr0\)
+ 580: 10 cc f0 38 lddi\.p @\(gr15,56\),gr8
+ 584: 9c fc 00 38 setlos 0x38,gr14
+ 588: 82 30 80 00 calll @\(gr8,gr0\)
+ 58c: 80 88 00 00 nop
+ 590: 92 fc f8 24 setlos 0xf*fffff824,gr9
+ 594: 80 88 00 00 nop
+ 598: 92 fc 08 24 setlos 0x824,gr9
+ 59c: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 5a0: 92 f4 f8 24 setlo 0xf824,gr9
+ 5a4: fe 3f ff b0 call 464 <i\+0x454>
+ 5a8: fe 3f ff b5 call 47c <i\+0x46c>
+ 5ac: fe 3f ff ba call 494 <i\+0x484>
+ 5b0: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 5b4: 9c f4 00 90 setlo 0x90,gr14
+ 5b8: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 5bc: 82 30 80 00 calll @\(gr8,gr0\)
+ 5c0: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 5c4: 9c f4 00 a0 setlo 0xa0,gr14
+ 5c8: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 5cc: 82 30 80 00 calll @\(gr8,gr0\)
+ 5d0: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 5d4: 9c f4 00 b8 setlo 0xb8,gr14
+ 5d8: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 5dc: 82 30 80 00 calll @\(gr8,gr0\)
+ 5e0: 10 cc f0 48 lddi\.p @\(gr15,72\),gr8
+ 5e4: 9c fc 00 48 setlos 0x48,gr14
+ 5e8: 82 30 80 00 calll @\(gr8,gr0\)
+ 5ec: 10 cc ff a0 lddi\.p @\(gr15,-96\),gr8
+ 5f0: 9c fc ff a0 setlos 0xf*ffffffa0,gr14
+ 5f4: 82 30 80 00 calll @\(gr8,gr0\)
+ 5f8: 10 cc ff d0 lddi\.p @\(gr15,-48\),gr8
+ 5fc: 9c fc ff d0 setlos 0xf*ffffffd0,gr14
+ 600: 82 30 80 00 calll @\(gr8,gr0\)
+ 604: 80 88 00 00 nop
+ 608: 92 fc 00 04 setlos 0x4,gr9
+ 60c: 80 88 00 00 nop
+ 610: 92 fc 10 04 setlos 0x1004,gr9
+ 614: 92 f8 00 01 sethi 0x1,gr9
+ 618: 92 f4 00 04 setlo 0x4,gr9
+ 61c: fe 3f ff 94 call 46c <i\+0x45c>
+ 620: fe 3f ff 99 call 484 <i\+0x474>
+ 624: fe 3f ff 9e call 49c <i\+0x48c>
+ 628: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 62c: 9c f4 00 b0 setlo 0xb0,gr14
+ 630: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 634: 82 30 80 00 calll @\(gr8,gr0\)
+ 638: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 63c: 9c f4 00 80 setlo 0x80,gr14
+ 640: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 644: 82 30 80 00 calll @\(gr8,gr0\)
+ 648: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 64c: 9c f4 00 70 setlo 0x70,gr14
+ 650: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 654: 82 30 80 00 calll @\(gr8,gr0\)
+ 658: 10 cc f0 20 lddi\.p @\(gr15,32\),gr8
+ 65c: 9c fc 00 20 setlos 0x20,gr14
+ 660: 82 30 80 00 calll @\(gr8,gr0\)
+ 664: 10 cc f0 28 lddi\.p @\(gr15,40\),gr8
+ 668: 9c fc 00 28 setlos 0x28,gr14
+ 66c: 82 30 80 00 calll @\(gr8,gr0\)
+ 670: 10 cc ff c0 lddi\.p @\(gr15,-64\),gr8
+ 674: 9c fc ff c0 setlos 0xf*ffffffc0,gr14
+ 678: 82 30 80 00 calll @\(gr8,gr0\)
+Disassembly of section \.got:
+
+00004700 <_GLOBAL_OFFSET_TABLE_-0x60>:
+ 4700: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4700: R_FRV_TLSDESC_VALUE \.tbss
+ 4704: 00 00 17 f3 \*unknown\*
+ 4708: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4708: R_FRV_TLSDESC_VALUE x
+ 470c: 00 00 10 01 add\.p sp,sp,gr0
+ 4710: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4710: R_FRV_TLSDESC_VALUE \.tbss
+ 4714: 00 00 10 01 add\.p sp,sp,gr0
+ 4718: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4718: R_FRV_TLSDESC_VALUE \.tbss
+ 471c: 00 00 10 03 add\.p sp,gr3,gr0
+ 4720: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4720: R_FRV_TLSDESC_VALUE x
+ 4724: 00 01 00 03 add\.p gr16,gr3,gr0
+ 4728: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4728: R_FRV_TLSDESC_VALUE \.tbss
+ 472c: 00 01 07 f1 \*unknown\*
+ 4730: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4730: R_FRV_TLSDESC_VALUE \.tbss
+ 4734: 00 01 07 f3 \*unknown\*
+ 4738: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4738: R_FRV_TLSDESC_VALUE x
+ 473c: 00 01 00 01 add\.p gr16,sp,gr0
+ 4740: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4740: R_FRV_TLSDESC_VALUE \.tbss
+ 4744: 00 01 00 01 add\.p gr16,sp,gr0
+ 4748: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4748: R_FRV_TLSDESC_VALUE \.tbss
+ 474c: 00 01 00 03 add\.p gr16,gr3,gr0
+ 4750: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4750: R_FRV_TLSDESC_VALUE \.tbss
+ 4754: 00 00 00 11 add\.p gr0,gr17,gr0
+ 4758: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4758: R_FRV_TLSDESC_VALUE \.tbss
+ 475c: 00 00 00 13 add\.p gr0,gr19,gr0
+
+00004760 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 4770: R_FRV_TLSDESC_VALUE \.tbss
+ 4774: 00 00 10 11 add\.p sp,gr17,gr0
+ 4778: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4778: R_FRV_TLSDESC_VALUE \.tbss
+ 477c: 00 00 10 13 add\.p sp,gr19,gr0
+ 4780: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4780: R_FRV_TLSDESC_VALUE x
+ 4784: 00 00 00 03 add\.p gr0,gr3,gr0
+ 4788: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4788: R_FRV_TLSDESC_VALUE x
+ 478c: 00 00 10 03 add\.p sp,gr3,gr0
+ 4790: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4790: R_FRV_TLSDESC_VALUE \.tbss
+ 4794: 00 01 00 11 add\.p gr16,gr17,gr0
+ 4798: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4798: R_FRV_TLSDESC_VALUE \.tbss
+ 479c: 00 01 00 13 add\.p gr16,gr19,gr0
+ 47a0: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47a0: R_FRV_TLSDESC_VALUE \.tbss
+ 47a4: 00 00 07 f1 \*unknown\*
+ 47a8: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47a8: R_FRV_TLSDESC_VALUE \.tbss
+ 47ac: 00 00 07 f3 \*unknown\*
+ 47b0: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47b0: R_FRV_TLSDESC_VALUE x
+ 47b4: 00 00 00 01 add\.p gr0,sp,gr0
+ 47b8: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47b8: R_FRV_TLSDESC_VALUE \.tbss
+ 47bc: 00 00 00 01 add\.p gr0,sp,gr0
+ 47c0: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47c0: R_FRV_TLSDESC_VALUE \.tbss
+ 47c4: 00 00 00 03 add\.p gr0,gr3,gr0
+ 47c8: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47c8: R_FRV_TLSDESC_VALUE \.tbss
+ 47cc: 00 00 17 f1 \*unknown\*
+ 47d0: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47d0: R_FRV_TLSDESC_VALUE x
+ 47d4: 00 01 00 02 add\.p gr16,fp,gr0
+ 47d8: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47d8: R_FRV_TLSDESC_VALUE \.tbss
+ 47dc: 00 00 10 12 add\.p sp,gr18,gr0
+ 47e0: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47e0: R_FRV_TLSDESC_VALUE x
+ 47e4: 00 00 10 02 add\.p sp,fp,gr0
+ 47e8: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47e8: R_FRV_TLSDESC_VALUE \.tbss
+ 47ec: 00 01 00 12 add\.p gr16,gr18,gr0
+ 47f0: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47f0: R_FRV_TLSDESC_VALUE \.tbss
+ 47f4: 00 00 07 f2 \*unknown\*
+ 47f8: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47f8: R_FRV_TLSDESC_VALUE \.tbss
+ 47fc: 00 00 00 02 add\.p gr0,fp,gr0
+ 4800: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4800: R_FRV_TLSDESC_VALUE \.tbss
+ 4804: 00 00 17 f2 \*unknown\*
+ 4808: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4808: R_FRV_TLSDESC_VALUE \.tbss
+ 480c: 00 00 10 02 add\.p sp,fp,gr0
+ 4810: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4810: R_FRV_TLSDESC_VALUE x
+ 4814: 00 00 00 02 add\.p gr0,fp,gr0
+ 4818: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4818: R_FRV_TLSDESC_VALUE \.tbss
+ 481c: 00 01 07 f2 \*unknown\*
+ 4820: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4820: R_FRV_TLSDESC_VALUE \.tbss
+ 4824: 00 01 00 02 add\.p gr16,fp,gr0
+ 4828: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4828: R_FRV_TLSDESC_VALUE \.tbss
+ 482c: 00 00 00 12 add\.p gr0,gr18,gr0
diff --git a/ld/testsuite/ld-frv/tls-relax-shared-3.d b/ld/testsuite/ld-frv/tls-relax-shared-3.d
new file mode 100644
index 0000000..216e4ff
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-relax-shared-3.d
@@ -0,0 +1,27 @@
+#name: FRV TLS undefweak relocs, shared linking with relaxation
+#source: tls-3.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: -shared --relax
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+000002f4 <_start>:
+ 2f4: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 2f8: 00 88 00 00 nop\.p
+ 2fc: 80 88 00 00 nop
+ 300: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 304: 80 88 00 00 nop
+ 308: 12 c8 f0 0c ldi\.p @\(gr15,12\),gr9
+ 30c: 80 88 00 00 nop
+ 310: 80 88 00 00 nop
+ 314: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 318: 00 88 00 00 nop\.p
+ 31c: 80 88 00 00 nop
+ 320: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+Disassembly of section \.got:
+
+000043a8 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 43b4: R_FRV_TLSOFF u
diff --git a/ld/testsuite/ld-frv/tls-relax-static-1.d b/ld/testsuite/ld-frv/tls-relax-static-1.d
new file mode 100644
index 0000000..45038e7
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-relax-static-1.d
@@ -0,0 +1,62 @@
+#name: FRV TLS relocs, static linking with relaxation
+#source: tls-1.s
+#objdump: -D -j .text -j .got -j .plt
+#ld: -static tmpdir/tls-1-dep.o --relax
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+000100b4 <_start>:
+ 100b4: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 100b8: 00 88 00 00 nop\.p
+ 100bc: 80 88 00 00 nop
+ 100c0: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 100c4: 80 88 00 00 nop
+ 100c8: 12 fc f8 10 setlos\.p 0xf*fffff810,gr9
+ 100cc: 80 88 00 00 nop
+ 100d0: 80 88 00 00 nop
+ 100d4: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 100d8: 00 88 00 00 nop\.p
+ 100dc: 80 88 00 00 nop
+ 100e0: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 100e4: 80 88 00 00 nop
+ 100e8: 12 fc f8 20 setlos\.p 0xf*fffff820,gr9
+ 100ec: 80 88 00 00 nop
+ 100f0: 80 88 00 00 nop
+ 100f4: 92 fc f8 30 setlos 0xf*fffff830,gr9
+ 100f8: 00 88 00 00 nop\.p
+ 100fc: 80 88 00 00 nop
+ 10100: 92 fc f8 30 setlos 0xf*fffff830,gr9
+ 10104: 80 88 00 00 nop
+ 10108: 12 fc f8 30 setlos\.p 0xf*fffff830,gr9
+ 1010c: 80 88 00 00 nop
+ 10110: 80 88 00 00 nop
+ 10114: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 10118: 00 88 00 00 nop\.p
+ 1011c: 80 88 00 00 nop
+ 10120: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 10124: 80 88 00 00 nop
+ 10128: 12 fc 00 00 setlos\.p lo\(0x0\),gr9
+ 1012c: 80 88 00 00 nop
+ 10130: 80 88 00 00 nop
+ 10134: 00 88 00 00 nop\.p
+ 10138: 90 fc f8 30 setlos 0xf*fffff830,gr8
+ 1013c: 00 88 00 00 nop\.p
+ 10140: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 10144: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 10148: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 1014c: 92 fc f8 30 setlos 0xf*fffff830,gr9
+ 10150: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 10154: 00 88 00 00 nop\.p
+ 10158: 80 88 00 00 nop
+ 1015c: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 10160: 00 88 00 00 nop\.p
+ 10164: 80 88 00 00 nop
+ 10168: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 1016c: 00 88 00 00 nop\.p
+ 10170: 80 88 00 00 nop
+ 10174: 92 fc f8 30 setlos 0xf*fffff830,gr9
+ 10178: 00 88 00 00 nop\.p
+ 1017c: 80 88 00 00 nop
+ 10180: 92 fc 00 00 setlos lo\(0x0\),gr9
diff --git a/ld/testsuite/ld-frv/tls-relax-static-3.d b/ld/testsuite/ld-frv/tls-relax-static-3.d
new file mode 100644
index 0000000..f4ce45f
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-relax-static-3.d
@@ -0,0 +1,26 @@
+#name: FRV TLS undefweak relocs, static linking with relaxation
+#source: tls-3.s
+#objdump: -D -j .text -j .got -j .plt
+#ld: -static --relax
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+00010094 <_start>:
+ 10094: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 10098: 00 88 00 00 nop\.p
+ 1009c: 80 88 00 00 nop
+ 100a0: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 100a4: 80 88 00 00 nop
+ 100a8: 12 fc 00 00 setlos\.p lo\(0x0\),gr9
+ 100ac: 80 88 00 00 nop
+ 100b0: 80 88 00 00 nop
+ 100b4: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 100b8: 00 88 00 00 nop\.p
+ 100bc: 80 88 00 00 nop
+ 100c0: 92 fc 00 00 setlos lo\(0x0\),gr9
+Disassembly of section \.got:
+
+000140c8 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
diff --git a/ld/testsuite/ld-frv/tls-shared-1-fail.d b/ld/testsuite/ld-frv/tls-shared-1-fail.d
new file mode 100644
index 0000000..511d094
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-shared-1-fail.d
@@ -0,0 +1,4 @@
+#name: FRV TLS relocs, shared linking
+#source: tls-1.s
+#ld: -shared tmpdir/tls-1-dep.so
+#error: different segments
diff --git a/ld/testsuite/ld-frv/tls-shared-1.d b/ld/testsuite/ld-frv/tls-shared-1.d
new file mode 100644
index 0000000..aabd072
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-shared-1.d
@@ -0,0 +1,73 @@
+#name: FRV TLS relocs, shared linking with local binding
+#source: tls-1.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: -shared tmpdir/tls-1-dep.so --version-script tls-1-shared.lds
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+00000354 <_start>:
+ 354: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 358: 00 88 00 00 nop\.p
+ 35c: 80 88 00 00 nop
+ 360: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 364: 80 88 00 00 nop
+ 368: 12 c8 f0 10 ldi\.p @\(gr15,16\),gr9
+ 36c: 80 88 00 00 nop
+ 370: 80 88 00 00 nop
+ 374: 92 c8 f0 14 ldi @\(gr15,20\),gr9
+ 378: 00 88 00 00 nop\.p
+ 37c: 80 88 00 00 nop
+ 380: 92 c8 f0 14 ldi @\(gr15,20\),gr9
+ 384: 80 88 00 00 nop
+ 388: 12 c8 f0 14 ldi\.p @\(gr15,20\),gr9
+ 38c: 80 88 00 00 nop
+ 390: 80 88 00 00 nop
+ 394: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 398: 00 88 00 00 nop\.p
+ 39c: 80 88 00 00 nop
+ 3a0: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 3a4: 80 88 00 00 nop
+ 3a8: 12 c8 f0 0c ldi\.p @\(gr15,12\),gr9
+ 3ac: 80 88 00 00 nop
+ 3b0: 80 88 00 00 nop
+ 3b4: 92 c8 f0 18 ldi @\(gr15,24\),gr9
+ 3b8: 00 88 00 00 nop\.p
+ 3bc: 80 88 00 00 nop
+ 3c0: 92 c8 f0 18 ldi @\(gr15,24\),gr9
+ 3c4: 80 88 00 00 nop
+ 3c8: 12 c8 f0 18 ldi\.p @\(gr15,24\),gr9
+ 3cc: 80 88 00 00 nop
+ 3d0: 80 88 00 00 nop
+ 3d4: 00 88 00 00 nop\.p
+ 3d8: 90 fc f8 20 setlos 0xf*fffff820,gr8
+ 3dc: 00 88 00 00 nop\.p
+ 3e0: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 3e4: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 3e8: 92 c8 f0 14 ldi @\(gr15,20\),gr9
+ 3ec: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 3f0: 92 c8 f0 18 ldi @\(gr15,24\),gr9
+ 3f4: 00 88 00 00 nop\.p
+ 3f8: 80 88 00 00 nop
+ 3fc: 92 c8 f0 10 ldi @\(gr15,16\),gr9
+ 400: 00 88 00 00 nop\.p
+ 404: 80 88 00 00 nop
+ 408: 92 c8 f0 14 ldi @\(gr15,20\),gr9
+ 40c: 00 88 00 00 nop\.p
+ 410: 80 88 00 00 nop
+ 414: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 418: 00 88 00 00 nop\.p
+ 41c: 80 88 00 00 nop
+ 420: 92 c8 f0 18 ldi @\(gr15,24\),gr9
+Disassembly of section \.got:
+
+000044b8 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 44c4: 00 00 00 10 add\.p gr0,gr16,gr0
+ 44c4: R_FRV_TLSOFF \.tbss
+ \.\.\.
+ 44c8: R_FRV_TLSOFF x
+ 44cc: R_FRV_TLSOFF \.tbss
+ 44d0: 00 00 07 f0 \*unknown\*
+ 44d0: R_FRV_TLSOFF \.tbss
diff --git a/ld/testsuite/ld-frv/tls-shared-2.d b/ld/testsuite/ld-frv/tls-shared-2.d
new file mode 100644
index 0000000..14d8462
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-shared-2.d
@@ -0,0 +1,264 @@
+#name: FRV TLS relocs with addends, shared linking
+#source: tls-2.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: -shared tmpdir/tls-1-dep.so --version-script tls-1-shared.lds
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.plt:
+
+00000454 <\.plt>:
+ 454: 90 cc f0 10 lddi @\(gr15,16\),gr8
+ 458: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 45c: 90 cc f0 30 lddi @\(gr15,48\),gr8
+ 460: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 464: 90 cc f0 40 lddi @\(gr15,64\),gr8
+ 468: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 46c: 90 cc f0 50 lddi @\(gr15,80\),gr8
+ 470: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 474: 90 cc f0 58 lddi @\(gr15,88\),gr8
+ 478: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 47c: 90 cc f0 68 lddi @\(gr15,104\),gr8
+ 480: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 484: 90 cc ff a8 lddi @\(gr15,-88\),gr8
+ 488: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 48c: 90 cc ff b0 lddi @\(gr15,-80\),gr8
+ 490: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 494: 90 cc ff c8 lddi @\(gr15,-56\),gr8
+ 498: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 49c: 90 cc ff d8 lddi @\(gr15,-40\),gr8
+ 4a0: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 4a4: 90 cc ff e0 lddi @\(gr15,-32\),gr8
+ 4a8: 80 30 80 00 jmpl @\(gr8,gr0\)
+ 4ac: 90 cc ff f0 lddi @\(gr15,-16\),gr8
+ 4b0: 80 30 80 00 jmpl @\(gr8,gr0\)
+Disassembly of section \.text:
+
+000004b4 <_start>:
+ 4b4: fe 3f ff f0 call 474 <i\+0x464>
+ 4b8: fe 3f ff f5 call 48c <i\+0x47c>
+ 4bc: fe 3f ff fa call 4a4 <i\+0x494>
+ 4c0: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 4c4: 9c f4 00 98 setlo 0x98,gr14
+ 4c8: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 4cc: 82 30 80 00 calll @\(gr8,gr0\)
+ 4d0: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 4d4: 9c f4 00 a8 setlo 0xa8,gr14
+ 4d8: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 4dc: 82 30 80 00 calll @\(gr8,gr0\)
+ 4e0: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 4e4: 9c f4 00 c0 setlo 0xc0,gr14
+ 4e8: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 4ec: 82 30 80 00 calll @\(gr8,gr0\)
+ 4f0: 10 cc f0 60 lddi\.p @\(gr15,96\),gr8
+ 4f4: 9c fc 00 60 setlos 0x60,gr14
+ 4f8: 82 30 80 00 calll @\(gr8,gr0\)
+ 4fc: 10 cc ff b8 lddi\.p @\(gr15,-72\),gr8
+ 500: 9c fc ff b8 setlos 0xf*ffffffb8,gr14
+ 504: 82 30 80 00 calll @\(gr8,gr0\)
+ 508: 10 cc ff e8 lddi\.p @\(gr15,-24\),gr8
+ 50c: 9c fc ff e8 setlos 0xf*ffffffe8,gr14
+ 510: 82 30 80 00 calll @\(gr8,gr0\)
+ 514: 80 88 00 00 nop
+ 518: 92 fc f8 14 setlos 0xf*fffff814,gr9
+ 51c: 80 88 00 00 nop
+ 520: 92 fc 08 14 setlos 0x814,gr9
+ 524: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 528: 92 f4 f8 14 setlo 0xf814,gr9
+ 52c: fe 3f ff e0 call 4ac <i\+0x49c>
+ 530: fe 3f ff c9 call 454 <i\+0x444>
+ 534: fe 3f ff ca call 45c <i\+0x44c>
+ 538: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 53c: 9c f4 00 c8 setlo 0xc8,gr14
+ 540: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 544: 82 30 80 00 calll @\(gr8,gr0\)
+ 548: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 54c: 9c f4 00 78 setlo 0x78,gr14
+ 550: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 554: 82 30 80 00 calll @\(gr8,gr0\)
+ 558: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 55c: 9c f4 00 88 setlo 0x88,gr14
+ 560: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 564: 82 30 80 00 calll @\(gr8,gr0\)
+ 568: 10 cc ff f8 lddi\.p @\(gr15,-8\),gr8
+ 56c: 9c fc ff f8 setlos 0xf*fffffff8,gr14
+ 570: 82 30 80 00 calll @\(gr8,gr0\)
+ 574: 10 cc f0 18 lddi\.p @\(gr15,24\),gr8
+ 578: 9c fc 00 18 setlos 0x18,gr14
+ 57c: 82 30 80 00 calll @\(gr8,gr0\)
+ 580: 10 cc f0 38 lddi\.p @\(gr15,56\),gr8
+ 584: 9c fc 00 38 setlos 0x38,gr14
+ 588: 82 30 80 00 calll @\(gr8,gr0\)
+ 58c: 80 88 00 00 nop
+ 590: 92 fc f8 24 setlos 0xf*fffff824,gr9
+ 594: 80 88 00 00 nop
+ 598: 92 fc 08 24 setlos 0x824,gr9
+ 59c: 92 f8 00 00 sethi hi\(0x0\),gr9
+ 5a0: 92 f4 f8 24 setlo 0xf824,gr9
+ 5a4: fe 3f ff b0 call 464 <i\+0x454>
+ 5a8: fe 3f ff b5 call 47c <i\+0x46c>
+ 5ac: fe 3f ff ba call 494 <i\+0x484>
+ 5b0: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 5b4: 9c f4 00 90 setlo 0x90,gr14
+ 5b8: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 5bc: 82 30 80 00 calll @\(gr8,gr0\)
+ 5c0: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 5c4: 9c f4 00 a0 setlo 0xa0,gr14
+ 5c8: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 5cc: 82 30 80 00 calll @\(gr8,gr0\)
+ 5d0: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 5d4: 9c f4 00 b8 setlo 0xb8,gr14
+ 5d8: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 5dc: 82 30 80 00 calll @\(gr8,gr0\)
+ 5e0: 10 cc f0 48 lddi\.p @\(gr15,72\),gr8
+ 5e4: 9c fc 00 48 setlos 0x48,gr14
+ 5e8: 82 30 80 00 calll @\(gr8,gr0\)
+ 5ec: 10 cc ff a0 lddi\.p @\(gr15,-96\),gr8
+ 5f0: 9c fc ff a0 setlos 0xf*ffffffa0,gr14
+ 5f4: 82 30 80 00 calll @\(gr8,gr0\)
+ 5f8: 10 cc ff d0 lddi\.p @\(gr15,-48\),gr8
+ 5fc: 9c fc ff d0 setlos 0xf*ffffffd0,gr14
+ 600: 82 30 80 00 calll @\(gr8,gr0\)
+ 604: 80 88 00 00 nop
+ 608: 92 fc 00 04 setlos 0x4,gr9
+ 60c: 80 88 00 00 nop
+ 610: 92 fc 10 04 setlos 0x1004,gr9
+ 614: 92 f8 00 01 sethi 0x1,gr9
+ 618: 92 f4 00 04 setlo 0x4,gr9
+ 61c: fe 3f ff 94 call 46c <i\+0x45c>
+ 620: fe 3f ff 99 call 484 <i\+0x474>
+ 624: fe 3f ff 9e call 49c <i\+0x48c>
+ 628: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 62c: 9c f4 00 b0 setlo 0xb0,gr14
+ 630: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 634: 82 30 80 00 calll @\(gr8,gr0\)
+ 638: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 63c: 9c f4 00 80 setlo 0x80,gr14
+ 640: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 644: 82 30 80 00 calll @\(gr8,gr0\)
+ 648: 1c f8 00 00 sethi\.p hi\(0x0\),gr14
+ 64c: 9c f4 00 70 setlo 0x70,gr14
+ 650: 90 08 f1 4e ldd @\(gr15,gr14\),gr8
+ 654: 82 30 80 00 calll @\(gr8,gr0\)
+ 658: 10 cc f0 20 lddi\.p @\(gr15,32\),gr8
+ 65c: 9c fc 00 20 setlos 0x20,gr14
+ 660: 82 30 80 00 calll @\(gr8,gr0\)
+ 664: 10 cc f0 28 lddi\.p @\(gr15,40\),gr8
+ 668: 9c fc 00 28 setlos 0x28,gr14
+ 66c: 82 30 80 00 calll @\(gr8,gr0\)
+ 670: 10 cc ff c0 lddi\.p @\(gr15,-64\),gr8
+ 674: 9c fc ff c0 setlos 0xf*ffffffc0,gr14
+ 678: 82 30 80 00 calll @\(gr8,gr0\)
+Disassembly of section \.got:
+
+00004700 <_GLOBAL_OFFSET_TABLE_-0x60>:
+ 4700: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4700: R_FRV_TLSDESC_VALUE \.tbss
+ 4704: 00 00 17 f3 \*unknown\*
+ 4708: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4708: R_FRV_TLSDESC_VALUE x
+ 470c: 00 00 10 01 add\.p sp,sp,gr0
+ 4710: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4710: R_FRV_TLSDESC_VALUE \.tbss
+ 4714: 00 00 10 01 add\.p sp,sp,gr0
+ 4718: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4718: R_FRV_TLSDESC_VALUE \.tbss
+ 471c: 00 00 10 03 add\.p sp,gr3,gr0
+ 4720: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4720: R_FRV_TLSDESC_VALUE x
+ 4724: 00 01 00 03 add\.p gr16,gr3,gr0
+ 4728: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4728: R_FRV_TLSDESC_VALUE \.tbss
+ 472c: 00 01 07 f1 \*unknown\*
+ 4730: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4730: R_FRV_TLSDESC_VALUE \.tbss
+ 4734: 00 01 07 f3 \*unknown\*
+ 4738: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4738: R_FRV_TLSDESC_VALUE x
+ 473c: 00 01 00 01 add\.p gr16,sp,gr0
+ 4740: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4740: R_FRV_TLSDESC_VALUE \.tbss
+ 4744: 00 01 00 01 add\.p gr16,sp,gr0
+ 4748: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4748: R_FRV_TLSDESC_VALUE \.tbss
+ 474c: 00 01 00 03 add\.p gr16,gr3,gr0
+ 4750: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4750: R_FRV_TLSDESC_VALUE \.tbss
+ 4754: 00 00 00 11 add\.p gr0,gr17,gr0
+ 4758: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4758: R_FRV_TLSDESC_VALUE \.tbss
+ 475c: 00 00 00 13 add\.p gr0,gr19,gr0
+
+00004760 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 4770: R_FRV_TLSDESC_VALUE \.tbss
+ 4774: 00 00 10 11 add\.p sp,gr17,gr0
+ 4778: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4778: R_FRV_TLSDESC_VALUE \.tbss
+ 477c: 00 00 10 13 add\.p sp,gr19,gr0
+ 4780: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4780: R_FRV_TLSDESC_VALUE x
+ 4784: 00 00 00 03 add\.p gr0,gr3,gr0
+ 4788: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4788: R_FRV_TLSDESC_VALUE x
+ 478c: 00 00 10 03 add\.p sp,gr3,gr0
+ 4790: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4790: R_FRV_TLSDESC_VALUE \.tbss
+ 4794: 00 01 00 11 add\.p gr16,gr17,gr0
+ 4798: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4798: R_FRV_TLSDESC_VALUE \.tbss
+ 479c: 00 01 00 13 add\.p gr16,gr19,gr0
+ 47a0: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47a0: R_FRV_TLSDESC_VALUE \.tbss
+ 47a4: 00 00 07 f1 \*unknown\*
+ 47a8: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47a8: R_FRV_TLSDESC_VALUE \.tbss
+ 47ac: 00 00 07 f3 \*unknown\*
+ 47b0: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47b0: R_FRV_TLSDESC_VALUE x
+ 47b4: 00 00 00 01 add\.p gr0,sp,gr0
+ 47b8: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47b8: R_FRV_TLSDESC_VALUE \.tbss
+ 47bc: 00 00 00 01 add\.p gr0,sp,gr0
+ 47c0: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47c0: R_FRV_TLSDESC_VALUE \.tbss
+ 47c4: 00 00 00 03 add\.p gr0,gr3,gr0
+ 47c8: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47c8: R_FRV_TLSDESC_VALUE \.tbss
+ 47cc: 00 00 17 f1 \*unknown\*
+ 47d0: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47d0: R_FRV_TLSDESC_VALUE x
+ 47d4: 00 01 00 02 add\.p gr16,fp,gr0
+ 47d8: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47d8: R_FRV_TLSDESC_VALUE \.tbss
+ 47dc: 00 00 10 12 add\.p sp,gr18,gr0
+ 47e0: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47e0: R_FRV_TLSDESC_VALUE x
+ 47e4: 00 00 10 02 add\.p sp,fp,gr0
+ 47e8: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47e8: R_FRV_TLSDESC_VALUE \.tbss
+ 47ec: 00 01 00 12 add\.p gr16,gr18,gr0
+ 47f0: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47f0: R_FRV_TLSDESC_VALUE \.tbss
+ 47f4: 00 00 07 f2 \*unknown\*
+ 47f8: 00 00 00 00 add\.p gr0,gr0,gr0
+ 47f8: R_FRV_TLSDESC_VALUE \.tbss
+ 47fc: 00 00 00 02 add\.p gr0,fp,gr0
+ 4800: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4800: R_FRV_TLSDESC_VALUE \.tbss
+ 4804: 00 00 17 f2 \*unknown\*
+ 4808: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4808: R_FRV_TLSDESC_VALUE \.tbss
+ 480c: 00 00 10 02 add\.p sp,fp,gr0
+ 4810: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4810: R_FRV_TLSDESC_VALUE x
+ 4814: 00 00 00 02 add\.p gr0,fp,gr0
+ 4818: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4818: R_FRV_TLSDESC_VALUE \.tbss
+ 481c: 00 01 07 f2 \*unknown\*
+ 4820: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4820: R_FRV_TLSDESC_VALUE \.tbss
+ 4824: 00 01 00 02 add\.p gr16,fp,gr0
+ 4828: 00 00 00 00 add\.p gr0,gr0,gr0
+ 4828: R_FRV_TLSDESC_VALUE \.tbss
+ 482c: 00 00 00 12 add\.p gr0,gr18,gr0
diff --git a/ld/testsuite/ld-frv/tls-shared-3.d b/ld/testsuite/ld-frv/tls-shared-3.d
new file mode 100644
index 0000000..d1a74c8
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-shared-3.d
@@ -0,0 +1,27 @@
+#name: FRV TLS undefweak relocs, shared linking
+#source: tls-3.s
+#objdump: -DR -j .text -j .got -j .plt
+#ld: -shared
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+000002f4 <_start>:
+ 2f4: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 2f8: 00 88 00 00 nop\.p
+ 2fc: 80 88 00 00 nop
+ 300: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 304: 80 88 00 00 nop
+ 308: 12 c8 f0 0c ldi\.p @\(gr15,12\),gr9
+ 30c: 80 88 00 00 nop
+ 310: 80 88 00 00 nop
+ 314: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+ 318: 00 88 00 00 nop\.p
+ 31c: 80 88 00 00 nop
+ 320: 92 c8 f0 0c ldi @\(gr15,12\),gr9
+Disassembly of section \.got:
+
+000043a8 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 43b4: R_FRV_TLSOFF u
diff --git a/ld/testsuite/ld-frv/tls-static-1.d b/ld/testsuite/ld-frv/tls-static-1.d
new file mode 100644
index 0000000..75b4011
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-static-1.d
@@ -0,0 +1,70 @@
+#name: FRV TLS relocs, static linking
+#source: tls-1.s
+#objdump: -D -j .text -j .got -j .plt
+#ld: -static tmpdir/tls-1-dep.o
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+000100b4 <_start>:
+ 100b4: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 100b8: 00 88 00 00 nop\.p
+ 100bc: 80 88 00 00 nop
+ 100c0: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 100c4: 80 88 00 00 nop
+ 100c8: 12 fc f8 10 setlos\.p 0xf*fffff810,gr9
+ 100cc: 80 88 00 00 nop
+ 100d0: 80 88 00 00 nop
+ 100d4: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 100d8: 00 88 00 00 nop\.p
+ 100dc: 80 88 00 00 nop
+ 100e0: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 100e4: 80 88 00 00 nop
+ 100e8: 12 fc f8 20 setlos\.p 0xf*fffff820,gr9
+ 100ec: 80 88 00 00 nop
+ 100f0: 80 88 00 00 nop
+ 100f4: 92 fc f8 30 setlos 0xf*fffff830,gr9
+ 100f8: 00 88 00 00 nop\.p
+ 100fc: 80 88 00 00 nop
+ 10100: 92 fc f8 30 setlos 0xf*fffff830,gr9
+ 10104: 80 88 00 00 nop
+ 10108: 12 fc f8 30 setlos\.p 0xf*fffff830,gr9
+ 1010c: 80 88 00 00 nop
+ 10110: 80 88 00 00 nop
+ 10114: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 10118: 00 88 00 00 nop\.p
+ 1011c: 80 88 00 00 nop
+ 10120: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 10124: 80 88 00 00 nop
+ 10128: 12 fc 00 00 setlos\.p lo\(0x0\),gr9
+ 1012c: 80 88 00 00 nop
+ 10130: 80 88 00 00 nop
+ 10134: 00 88 00 00 nop\.p
+ 10138: 90 fc f8 30 setlos 0xf*fffff830,gr8
+ 1013c: 00 88 00 00 nop\.p
+ 10140: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 10144: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 10148: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 1014c: 92 fc f8 30 setlos 0xf*fffff830,gr9
+ 10150: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 10154: 00 88 00 00 nop\.p
+ 10158: 80 88 00 00 nop
+ 1015c: 92 fc f8 10 setlos 0xf*fffff810,gr9
+ 10160: 00 88 00 00 nop\.p
+ 10164: 80 88 00 00 nop
+ 10168: 92 fc f8 20 setlos 0xf*fffff820,gr9
+ 1016c: 00 88 00 00 nop\.p
+ 10170: 80 88 00 00 nop
+ 10174: 92 fc f8 30 setlos 0xf*fffff830,gr9
+ 10178: 00 88 00 00 nop\.p
+ 1017c: 80 88 00 00 nop
+ 10180: 92 fc 00 00 setlos lo\(0x0\),gr9
+Disassembly of section \.got:
+
+00014190 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 1419c: ff ff f8 30 cop2 -32,cpr63,cpr48,cpr63
+ 141a0: ff ff f8 10 cop2 -32,cpr63,cpr16,cpr63
+ 141a4: ff ff f8 20 cop2 -32,cpr63,cpr32,cpr63
+ 141a8: 00 00 00 00 add\.p gr0,gr0,gr0
diff --git a/ld/testsuite/ld-frv/tls-static-3.d b/ld/testsuite/ld-frv/tls-static-3.d
new file mode 100644
index 0000000..3a678b3
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls-static-3.d
@@ -0,0 +1,26 @@
+#name: FRV TLS undefweak relocs, static linking
+#source: tls-3.s
+#objdump: -D -j .text -j .got -j .plt
+#ld: -static
+
+.*: file format elf.*frv.*
+
+Disassembly of section \.text:
+
+00010094 <_start>:
+ 10094: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 10098: 00 88 00 00 nop\.p
+ 1009c: 80 88 00 00 nop
+ 100a0: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 100a4: 80 88 00 00 nop
+ 100a8: 12 fc 00 00 setlos\.p lo\(0x0\),gr9
+ 100ac: 80 88 00 00 nop
+ 100b0: 80 88 00 00 nop
+ 100b4: 92 fc 00 00 setlos lo\(0x0\),gr9
+ 100b8: 00 88 00 00 nop\.p
+ 100bc: 80 88 00 00 nop
+ 100c0: 92 fc 00 00 setlos lo\(0x0\),gr9
+Disassembly of section \.got:
+
+000140c8 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
diff --git a/ld/testsuite/ld-frv/tls.exp b/ld/testsuite/ld-frv/tls.exp
new file mode 100644
index 0000000..a6c2603
--- /dev/null
+++ b/ld/testsuite/ld-frv/tls.exp
@@ -0,0 +1,62 @@
+# Expect script for FRV FDPIC TLS linker tests
+# Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+if {![istarget frv*-*-*] || ![is_elf_format]} {
+ return
+}
+
+global ASFLAGS
+set saved_ASFLAGS "$ASFLAGS"
+set ASFLAGS "$ASFLAGS -mfdpic"
+
+global LDFLAGS
+set saved_LDFLAGS "$LDFLAGS"
+set LDFLAGS "$LDFLAGS -melf32frvfd"
+
+run_ld_link_tests [list [list "tls-1-dep" "$LDFLAGS -shared" "" "tls-1-dep.s" [list] "tls-1-dep.so" ""]]
+run_dump_test "tls-static-1"
+run_dump_test "tls-dynamic-1"
+run_dump_test "tls-pie-1"
+run_dump_test "tls-shared-1-fail"
+run_dump_test "tls-shared-1"
+
+run_dump_test "tls-relax-static-1"
+run_dump_test "tls-relax-dynamic-1"
+run_dump_test "tls-relax-pie-1"
+run_dump_test "tls-relax-shared-1"
+
+run_dump_test "tls-dynamic-2"
+run_dump_test "tls-shared-2"
+run_dump_test "tls-initial-shared-2"
+
+run_dump_test "tls-relax-dynamic-2"
+run_dump_test "tls-relax-shared-2"
+run_dump_test "tls-relax-initial-shared-2"
+
+run_dump_test "tls-static-3"
+run_dump_test "tls-dynamic-3"
+run_dump_test "tls-pie-3"
+run_dump_test "tls-shared-3"
+
+run_dump_test "tls-relax-static-3"
+run_dump_test "tls-relax-dynamic-3"
+run_dump_test "tls-relax-pie-3"
+run_dump_test "tls-relax-shared-3"
+
+set LDFLAGS "$saved_LDFLAGS"
+set ASFLAGS "$saved_ASFLAGS"